Commit a5b898f0 authored by 刘凡's avatar 刘凡

新增:气瓶信息同步方法

parent 653b492d
......@@ -94,4 +94,9 @@ public class SyncCylinderDataService
public void syncCylinderTag(List<CylinderTagsDto> cylinderTagsDtos) {
}
public void syncCylinderFillingBefore(List<CylinderFillingDto> cylinderFillingDtos) {
}
public void syncCylinderFillingAfter(List<CylinderFillingCheckDto> cylinderFillingCheckDtos) {
}
}
......@@ -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.CylinderFillingCheckDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingDto;
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.TmCylinderFillingCheck;
public class TmCylinderFillingCheckService extends BaseService<TmCylinderFillingCheckModel, TmCylinderFillingCheck, TmCylinderFillingCheckMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
public String createCylinderFillingAfter(List<TmCylinderFillingCheckModel> model) {
// TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空.");
syncCylinderFillingAfter(model);
for (TmCylinderFillingCheckModel cylinderFillingCheckModel : model) {
cylinderFillingCheckModel.setRecDate(new Date());
cylinderFillingCheckModel.setAppId(getAppId());
......@@ -46,6 +51,11 @@ public class TmCylinderFillingCheckService extends BaseService<TmCylinderFilling
return "OK";
}
private void syncCylinderFillingAfter(List<TmCylinderFillingCheckModel> model) {
List<CylinderFillingCheckDto> cylinderFillingCheckDtos = Bean.toModels(model,CylinderFillingCheckDto.class);
syncCylinderDataService.syncCylinderFillingAfter(cylinderFillingCheckDtos);
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
......
......@@ -5,6 +5,8 @@ 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.CylinderFillingDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto;
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;
......@@ -43,6 +45,8 @@ public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel
// TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model))
// throw new BadRequest("气瓶标签信息为空.");
syncCylinderFillingBefore(model);
for (TmCylinderFillingModel cylinderFillingModel : model) {
cylinderFillingModel.setRecDate(new Date());
cylinderFillingModel.setAppId(getAppId());
......@@ -51,6 +55,11 @@ public class TmCylinderFillingService extends BaseService<TmCylinderFillingModel
return "OK";
}
private void syncCylinderFillingBefore(List<TmCylinderFillingModel> model) {
List<CylinderFillingDto> cylinderFillingDtos = Bean.toModels(model,CylinderFillingDto.class);
syncCylinderDataService.syncCylinderFillingBefore(cylinderFillingDtos);
}
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
......
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