Commit f9acd47f authored by 刘凡's avatar 刘凡

新增:气瓶信息同步方法

parent b8a08602
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.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -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.CylinderInfo;
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.mapper.CylinderFillingCheckMapper;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingExamineMapper;
......@@ -81,4 +81,19 @@ public class SyncCylinderDataService
List<CylinderInfo> cylinderUnitList = Bean.toModels(cylinderInfoDto,CylinderInfo.class);
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;
import java.util.Date;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis;
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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -34,12 +38,16 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFillingExamine;
public class TmCylinderFillingExamineService extends BaseService<TmCylinderFillingExamineModel, TmCylinderFillingExamine, TmCylinderFillingExamineMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
// TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model))
throw new BadRequest("液化气体气瓶充装信息审核为空.");
syncCylinderFillingExamine(model);
for (TmCylinderFillingExamineModel cylinderFillingExamineModel : model) {
cylinderFillingExamineModel.setRecDate(new Date());
cylinderFillingExamineModel.setAppId(getAppId());
......@@ -53,4 +61,10 @@ public class TmCylinderFillingExamineService extends BaseService<TmCylinderFilli
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
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;
import com.yeejoin.amos.api.openapi.face.orm.dao.ESCylinderFillingRecordRepository;
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.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.mapper.CylinderFillingRecordMapper;
import org.springframework.beans.BeanUtils;
......@@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis;
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 com.yeejoin.amos.api.openapi.constant.Constant;
......@@ -49,13 +52,15 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin
@Autowired
ESCylinderFillingRecordRepository esCylinderFillingRecordRepository;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderFilling(List<TmCylinderFillingRecordModel> model) {
// TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空.");
syncCylinderFilling(model);
for (TmCylinderFillingRecordModel cylinderFillingRecordModel : model) {
cylinderFillingRecordModel.setRecDate(new Date());
cylinderFillingRecordModel.setAppId(getAppId());
......@@ -64,6 +69,11 @@ public class TmCylinderFillingRecordService extends BaseService<TmCylinderFillin
return "OK";
}
private void syncCylinderFilling(List<TmCylinderFillingRecordModel> model) {
List<CylinderFillingRecordDto> cylinderFillingRecordDtos = Bean.toModels(model, CylinderFillingRecordDto.class);
syncCylinderDataService.syncCylinderFillingRecord(cylinderFillingRecordDtos);
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
......@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis;
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 com.yeejoin.amos.api.openapi.constant.Constant;
......@@ -32,12 +35,14 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFilling;
public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel, TmCylinderFilling, TmCylinderFillingMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderFillingBefore(List<TmCylinderFillingModel> model) {
// TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空.");
for (TmCylinderFillingModel cylinderFillingModel : model) {
cylinderFillingModel.setRecDate(new Date());
cylinderFillingModel.setAppId(getAppId());
......@@ -46,11 +51,11 @@ public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel
return "OK";
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
return bizTokenModel.getAppId();
}
}
......@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis;
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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -34,11 +37,13 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderInspection;
public class TmCylinderInspectionService extends BaseService<TmCylinderInspectionModel, TmCylinderInspection, TmCylinderInspectionMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderInspection(List<TmCylinderInspectionModel> model) {
if (ValidationUtil.isEmpty(model))
throw new BadRequest("气瓶检验信息为空.");
syncCylinderInspectionModel(model);
for (TmCylinderInspectionModel cylinderInspectionModel : model) {
cylinderInspectionModel.setRecDate(new Date());
cylinderInspectionModel.setAppId(getAppId());
......@@ -47,6 +52,11 @@ public class TmCylinderInspectionService extends BaseService<TmCylinderInspectio
return "OK";
}
private void syncCylinderInspectionModel(List<TmCylinderInspectionModel> model) {
List<CylinderInspectionDto> cylinderUnitDto = Bean.toModels(model,CylinderInspectionDto.class);
syncCylinderDataService.syncCylinderInspection(cylinderUnitDto);
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
......@@ -4,12 +4,15 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.cache.Redis;
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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -34,12 +37,15 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderTags;
public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCylinderTags, TmCylinderTagsMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderTag(List<TmCylinderTagsModel> model) {
// TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model))
throw new BadRequest("气瓶标签信息为空.");
syncCylinderTag(model);
for (TmCylinderTagsModel cylinderTagsModel : model) {
cylinderTagsModel.setRecDate(new Date());
cylinderTagsModel.setAppId(getAppId());
......@@ -48,6 +54,11 @@ public class TmCylinderTagsService extends BaseService<TmCylinderTagsModel, TmCy
return "OK";
}
private void syncCylinderTag(List<TmCylinderTagsModel> model) {
List<CylinderTagsDto> cylinderTagsDtos = Bean.toModels(model,CylinderTagsDto.class);
syncCylinderDataService.syncCylinderTag(cylinderTagsDtos);
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
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