Commit f9acd47f authored by 刘凡's avatar 刘凡

新增:气瓶信息同步方法

parent b8a08602
package com.yeejoin.amos.api.openapi.face.service; package com.yeejoin.amos.api.openapi.face.service;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -12,7 +13,6 @@ import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto; ...@@ -12,7 +13,6 @@ import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnitVideo; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnitVideo;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingCheckMapper; import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingCheckMapper;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingExamineMapper; import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingExamineMapper;
...@@ -81,4 +81,19 @@ public class SyncCylinderDataService ...@@ -81,4 +81,19 @@ public class SyncCylinderDataService
List<CylinderInfo> cylinderUnitList = Bean.toModels(cylinderInfoDto,CylinderInfo.class); List<CylinderInfo> cylinderUnitList = Bean.toModels(cylinderInfoDto,CylinderInfo.class);
cylinderInfoMapper.saveOrUpdateBatch(cylinderUnitList); cylinderInfoMapper.saveOrUpdateBatch(cylinderUnitList);
} }
public void syncCylinderFillingExamine(List<CylinderFillingExamineDto> cylinderFillingExamineDto) {
}
public void syncCylinderFillingRecord(List<CylinderFillingRecordDto> cylinderFillingRecordDtos) {
}
public void syncCylinderInspection(List<CylinderInspectionDto> cylinderInspectionDto) {
}
public void syncCylinderTag(List<CylinderTagsDto> cylinderTagsDtos) {
}
public void syncCylinderInfo(List<CylinderInfoDto> cylinderInfoDtos) {
}
} }
...@@ -4,12 +4,16 @@ package com.yeejoin.amos.api.openapi.face.service; ...@@ -4,12 +4,16 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.yeejoin.amos.api.openapi.face.model.TmCylinderUnitModel;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingExamineDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -34,12 +38,16 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFillingExamine; ...@@ -34,12 +38,16 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFillingExamine;
public class TmCylinderFillingExamineService extends BaseService<TmCylinderFillingExamineModel, TmCylinderFillingExamine, TmCylinderFillingExamineMapper> { public class TmCylinderFillingExamineService extends BaseService<TmCylinderFillingExamineModel, TmCylinderFillingExamine, TmCylinderFillingExamineMapper> {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class}) @Transactional(rollbackFor= {Exception.class})
public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) { public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model)) if (ValidationUtil.isEmpty(model))
throw new BadRequest("液化气体气瓶充装信息审核为空."); throw new BadRequest("液化气体气瓶充装信息审核为空.");
syncCylinderFillingExamine(model);
for (TmCylinderFillingExamineModel cylinderFillingExamineModel : model) { for (TmCylinderFillingExamineModel cylinderFillingExamineModel : model) {
cylinderFillingExamineModel.setRecDate(new Date()); cylinderFillingExamineModel.setRecDate(new Date());
cylinderFillingExamineModel.setAppId(getAppId()); cylinderFillingExamineModel.setAppId(getAppId());
...@@ -53,4 +61,10 @@ public class TmCylinderFillingExamineService extends BaseService<TmCylinderFilli ...@@ -53,4 +61,10 @@ public class TmCylinderFillingExamineService extends BaseService<TmCylinderFilli
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
return bizTokenModel.getAppId(); return bizTokenModel.getAppId();
} }
@Transactional(rollbackFor= {Exception.class})
private void syncCylinderFillingExamine(List<TmCylinderFillingExamineModel> model ) {
List<CylinderFillingExamineDto> cylinderFillingExamineDto = Bean.toModels(model, CylinderFillingExamineDto.class);
syncCylinderDataService.syncCylinderFillingExamine(cylinderFillingExamineDto);
}
} }
...@@ -11,6 +11,8 @@ import com.baomidou.dynamic.datasource.annotation.DS; ...@@ -11,6 +11,8 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.yeejoin.amos.api.openapi.face.orm.dao.ESCylinderFillingRecordRepository; import com.yeejoin.amos.api.openapi.face.orm.dao.ESCylinderFillingRecordRepository;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto; import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingRecordMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.yeejoin.amos.api.openapi.constant.Constant; import com.yeejoin.amos.api.openapi.constant.Constant;
...@@ -49,13 +52,15 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin ...@@ -49,13 +52,15 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin
@Autowired @Autowired
ESCylinderFillingRecordRepository esCylinderFillingRecordRepository; ESCylinderFillingRecordRepository esCylinderFillingRecordRepository;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class}) @Transactional(rollbackFor= {Exception.class})
public String createCylinderFilling(List<TmCylinderFillingRecordModel> model) { public String createCylinderFilling(List<TmCylinderFillingRecordModel> model) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model)) // if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空."); // throw new BadRequest("气瓶标签信息为空.");
syncCylinderFilling(model);
for (TmCylinderFillingRecordModel cylinderFillingRecordModel : model) { for (TmCylinderFillingRecordModel cylinderFillingRecordModel : model) {
cylinderFillingRecordModel.setRecDate(new Date()); cylinderFillingRecordModel.setRecDate(new Date());
cylinderFillingRecordModel.setAppId(getAppId()); cylinderFillingRecordModel.setAppId(getAppId());
...@@ -64,6 +69,11 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin ...@@ -64,6 +69,11 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin
return "OK"; return "OK";
} }
private void syncCylinderFilling(List<TmCylinderFillingRecordModel> model) {
List<CylinderFillingRecordDto> cylinderFillingRecordDtos = Bean.toModels(model, CylinderFillingRecordDto.class);
syncCylinderDataService.syncCylinderFillingRecord(cylinderFillingRecordDtos);
}
private String getAppId() { private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken()); String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service; ...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.yeejoin.amos.api.openapi.face.model.TmCylinderUnitModel;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.yeejoin.amos.api.openapi.constant.Constant; import com.yeejoin.amos.api.openapi.constant.Constant;
...@@ -32,12 +35,14 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFilling; ...@@ -32,12 +35,14 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFilling;
public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel, TmCylinderFilling, TmCylinderFillingMapper> { public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel, TmCylinderFilling, TmCylinderFillingMapper> {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class}) @Transactional(rollbackFor= {Exception.class})
public String createCylinderFillingBefore(List<TmCylinderFillingModel> model) { public String createCylinderFillingBefore(List<TmCylinderFillingModel> model) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model)) // if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空."); // throw new BadRequest("气瓶标签信息为空.");
for (TmCylinderFillingModel cylinderFillingModel : model) { for (TmCylinderFillingModel cylinderFillingModel : model) {
cylinderFillingModel.setRecDate(new Date()); cylinderFillingModel.setRecDate(new Date());
cylinderFillingModel.setAppId(getAppId()); cylinderFillingModel.setAppId(getAppId());
...@@ -46,11 +51,11 @@ public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel ...@@ -46,11 +51,11 @@ public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel
return "OK"; return "OK";
} }
private String getAppId() { private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken()); String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
return bizTokenModel.getAppId(); return bizTokenModel.getAppId();
} }
} }
...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service; ...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInspectionDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -34,11 +37,13 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderInspection; ...@@ -34,11 +37,13 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderInspection;
public class TmCylinderInspectionService extends BaseService<TmCylinderInspectionModel, TmCylinderInspection, TmCylinderInspectionMapper> { public class TmCylinderInspectionService extends BaseService<TmCylinderInspectionModel, TmCylinderInspection, TmCylinderInspectionMapper> {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class}) @Transactional(rollbackFor= {Exception.class})
public String createCylinderInspection(List<TmCylinderInspectionModel> model) { public String createCylinderInspection(List<TmCylinderInspectionModel> model) {
if (ValidationUtil.isEmpty(model)) if (ValidationUtil.isEmpty(model))
throw new BadRequest("气瓶检验信息为空."); throw new BadRequest("气瓶检验信息为空.");
syncCylinderInspectionModel(model);
for (TmCylinderInspectionModel cylinderInspectionModel : model) { for (TmCylinderInspectionModel cylinderInspectionModel : model) {
cylinderInspectionModel.setRecDate(new Date()); cylinderInspectionModel.setRecDate(new Date());
cylinderInspectionModel.setAppId(getAppId()); cylinderInspectionModel.setAppId(getAppId());
...@@ -47,6 +52,11 @@ public class TmCylinderInspectionService extends BaseService<TmCylinderInspectio ...@@ -47,6 +52,11 @@ public class TmCylinderInspectionService extends BaseService<TmCylinderInspectio
return "OK"; return "OK";
} }
private void syncCylinderInspectionModel(List<TmCylinderInspectionModel> model) {
List<CylinderInspectionDto> cylinderUnitDto = Bean.toModels(model,CylinderInspectionDto.class);
syncCylinderDataService.syncCylinderInspection(cylinderUnitDto);
}
private String getAppId() { private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken()); String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service; ...@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInspectionDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderTagsDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -34,12 +37,15 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderTags; ...@@ -34,12 +37,15 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderTags;
public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCylinderTags, TmCylinderTagsMapper> { public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCylinderTags, TmCylinderTagsMapper> {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class}) @Transactional(rollbackFor= {Exception.class})
public String createCylinderTag(List<TmCylinderTagsModel> model) { public String createCylinderTag(List<TmCylinderTagsModel> model) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model)) if (ValidationUtil.isEmpty(model))
throw new BadRequest("气瓶标签信息为空."); throw new BadRequest("气瓶标签信息为空.");
syncCylinderTag(model);
for (TmCylinderTagsModel cylinderTagsModel : model) { for (TmCylinderTagsModel cylinderTagsModel : model) {
cylinderTagsModel.setRecDate(new Date()); cylinderTagsModel.setRecDate(new Date());
cylinderTagsModel.setAppId(getAppId()); cylinderTagsModel.setAppId(getAppId());
...@@ -48,6 +54,11 @@ public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCy ...@@ -48,6 +54,11 @@ public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCy
return "OK"; return "OK";
} }
private void syncCylinderTag(List<TmCylinderTagsModel> model) {
List<CylinderTagsDto> cylinderTagsDtos = Bean.toModels(model,CylinderTagsDto.class);
syncCylinderDataService.syncCylinderTag(cylinderTagsDtos);
}
private String getAppId() { private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken()); String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment