|
@@ -1,6 +1,7 @@
|
|
|
package com.jtgh.yjpt.controller.cgInfo;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -9,17 +10,28 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.flex.remoting.RemotingDestination;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import com.jtgh.yjpt.anon.Log;
|
|
|
import com.jtgh.yjpt.anon.Log.Type;
|
|
|
import com.jtgh.yjpt.common.BusinessContext;
|
|
|
+import com.jtgh.yjpt.common.Constants;
|
|
|
+import com.jtgh.yjpt.common.GlobalData;
|
|
|
import com.jtgh.yjpt.common.PredicateModel;
|
|
|
+import com.jtgh.yjpt.common.SinglePageRequest;
|
|
|
import com.jtgh.yjpt.common.PredicateModel.Operator;
|
|
|
import com.jtgh.yjpt.common.SpecificationCreater;
|
|
|
+import com.jtgh.yjpt.common.Utils;
|
|
|
import com.jtgh.yjpt.controller.BaseController;
|
|
|
import com.jtgh.yjpt.entity.BaseEntity;
|
|
|
import com.jtgh.yjpt.entity.cginfo.CgInfoEntity;
|
|
|
+import com.jtgh.yjpt.entity.cginfo.CgOperationConditionEntity;
|
|
|
+import com.jtgh.yjpt.entity.cginfo.CgStorageEntity;
|
|
|
+import com.jtgh.yjpt.entity.check.ZcyhEntity;
|
|
|
+import com.jtgh.yjpt.entity.common.AccessoryEntity;
|
|
|
import com.jtgh.yjpt.service.cginfo.CgInfoService;
|
|
|
+import com.jtgh.yjpt.service.cginfo.CgOperationConditionService;
|
|
|
+import com.jtgh.yjpt.service.cginfo.CgStorageService;
|
|
|
|
|
|
/**
|
|
|
* 储罐基本信息Controller
|
|
@@ -32,6 +44,10 @@ import com.jtgh.yjpt.service.cginfo.CgInfoService;
|
|
|
public class cgInfoController extends BaseController {
|
|
|
@Autowired
|
|
|
CgInfoService cgInfoService;
|
|
|
+ @Autowired
|
|
|
+ CgStorageService storageService;
|
|
|
+ @Autowired
|
|
|
+ CgOperationConditionService opService;
|
|
|
|
|
|
@Log(Type.QUERY)
|
|
|
public BusinessContext list(Pageable pageable,Long functionId) {
|
|
@@ -45,4 +61,91 @@ public class cgInfoController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Log(Type.ADD)
|
|
|
+ public BusinessContext add(Long functionId, CgInfoEntity entity,
|
|
|
+ List<CgStorageEntity> storageList,List<CgStorageEntity> del_storageList,
|
|
|
+ List<CgOperationConditionEntity> opList,List<CgOperationConditionEntity> del_opList) {
|
|
|
+ return save(functionId, entity, storageList,del_storageList, opList,del_opList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Log(Type.EDIT)
|
|
|
+ public BusinessContext edit(Long functionId, CgInfoEntity entity,
|
|
|
+ List<CgStorageEntity> storageList,List<CgStorageEntity> del_storageList,
|
|
|
+ List<CgOperationConditionEntity> opList,List<CgOperationConditionEntity> del_opList) {
|
|
|
+ return save(functionId, entity, storageList,del_storageList, opList,del_opList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private BusinessContext save(Long functionId, CgInfoEntity entity,
|
|
|
+ List<CgStorageEntity> storageList,List<CgStorageEntity> del_storageList,
|
|
|
+ List<CgOperationConditionEntity> opList,List<CgOperationConditionEntity> del_opList) {
|
|
|
+ if (null == entity.getId() || entity.getId()==0L) {
|
|
|
+ entity.setAddUser(Utils.getCurrentUser());
|
|
|
+ entity.setAddDate(new Date());
|
|
|
+ entity.setRecordCode(getCurrentRoleCode(functionId));
|
|
|
+ } else {
|
|
|
+ entity.setUpdateUser(Utils.getCurrentUser());
|
|
|
+ entity.setUpdateDate(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 先保存cginfo实体
|
|
|
+ CgInfoEntity cginfoEntity = cgInfoService.save(entity);
|
|
|
+
|
|
|
+ //cg storage
|
|
|
+ for(CgStorageEntity storage_entity:storageList){
|
|
|
+ if(storage_entity.getId()==null || storage_entity.getId()==0L){
|
|
|
+ storage_entity.setAddUser(Utils.getCurrentUser());
|
|
|
+ storage_entity.setAddDate(new Date());
|
|
|
+ storage_entity.setRecordCode(getCurrentRoleCode(functionId));
|
|
|
+ storage_entity.setCgInfoId(cginfoEntity);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ storage_entity.setUpdateDate(new Date());
|
|
|
+ storage_entity.setUpdateUser(Utils.getCurrentUser());
|
|
|
+ }
|
|
|
+ storageService.save(storage_entity);
|
|
|
+ }
|
|
|
+ for(CgStorageEntity storage_entity:del_storageList){
|
|
|
+ storageService.logicDelete(storage_entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ //cg operation condidtion
|
|
|
+ for(CgOperationConditionEntity op_entity:opList){
|
|
|
+ if(op_entity.getId()==null || op_entity.getId()==0L){
|
|
|
+ op_entity.setAddUser(Utils.getCurrentUser());
|
|
|
+ op_entity.setAddDate(new Date());
|
|
|
+ op_entity.setRecordCode(getCurrentRoleCode(functionId));
|
|
|
+ op_entity.setCgInfoId(cginfoEntity);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ op_entity.setUpdateDate(new Date());
|
|
|
+ op_entity.setUpdateUser(Utils.getCurrentUser());
|
|
|
+ }
|
|
|
+ opService.save(op_entity);
|
|
|
+ }
|
|
|
+ for(CgOperationConditionEntity op_entity:del_opList){
|
|
|
+ opService.logicDelete(op_entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步
|
|
|
+ if (Constants.YES.equals(GlobalData.JAXWS_SYNC) && GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ BusinessContext bc = new BusinessContext();
|
|
|
+ bc.setAttribute("success", true);
|
|
|
+ return bc;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public BusinessContext getCgRelatedInfo(long cgInfoId) {
|
|
|
+ BusinessContext bc = new BusinessContext();
|
|
|
+ List<CgStorageEntity> storageList=storageService.findCgStorage(cgInfoId);
|
|
|
+ List<CgOperationConditionEntity> opList = opService.findOpCondition(cgInfoId);
|
|
|
+ bc.setAttribute("storage", storageList);
|
|
|
+ bc.setAttribute("op", opList);
|
|
|
+ return bc;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|