xieb
2023-11-28 a196fc3cf85ac2bb993a4d185ae9c3a255e9fa6a
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/service/impl/TbAttResMgrSysBServiceImpl.java
@@ -2,6 +2,7 @@
import cn.gistack.sm.sjztmd.entity.TbAttResMgrSysB;
import cn.gistack.sm.sjztmd.mapper.TbAttResMgrSysBMapper;
import cn.gistack.sm.sjztmd.service.ITbAttResBaseService;
import cn.gistack.sm.sjztmd.service.ITbAttResMgrSysBService;
import cn.gistack.system.user.feign.IUserClient;
import com.baomidou.dynamic.datasource.annotation.DS;
@@ -27,6 +28,9 @@
   @Autowired
   private IUserClient userClient;
   @Autowired
   private ITbAttResBaseService tbAttResBaseService;
   /**
    * 查询水库填报详情信息
    * @param guid
@@ -44,6 +48,11 @@
    */
   @Override
   public boolean updateByGuid(TbAttResMgrSysB tbAttResMgrSysB) {
      boolean edit = false;
      // 编辑标记
      if (tbAttResMgrSysB.getCheckState()==4){
         edit = true;
      }
      // 查询是否存在
      TbAttResMgrSysB detail = baseMapper.getDetailByResGuid(tbAttResMgrSysB.getResGuid());
      // 更新日志
@@ -51,6 +60,9 @@
      // 修改
      int i = addOrUpdateByGuid(detail,tbAttResMgrSysB);
      if (i>0){
//         if (!edit) {
//            tbAttResBaseService.updateFinalState(tbAttResMgrSysB.getResGuid(), 0);
//         }
         return true;
      }
      return false;
@@ -63,6 +75,11 @@
    */
   @Override
   public boolean auditByGuid(TbAttResMgrSysB tbAttResMgrSysB) {
      boolean edit = false;
      // 编辑标记
      if (tbAttResMgrSysB.getCheckState()==4){
         edit = true;
      }
      // 查询是否存在
      TbAttResMgrSysB detail = baseMapper.getDetailByResGuid(tbAttResMgrSysB.getResGuid());
      // 更新操作日志
@@ -76,9 +93,15 @@
      if (tbAttResMgrSysB.getCheckState()==3){
         tbAttResMgrSysB.setCheckState(0);
      }
      detail.setCheckState(tbAttResMgrSysB.getCheckState());
      // 更新数据
      int i = baseMapper.updateById(tbAttResMgrSysB);
      int i = baseMapper.updateById(detail);
      if (i>0){
         if (!edit) {
            tbAttResBaseService.updateFinalState(tbAttResMgrSysB.getResGuid(), tbAttResMgrSysB.getCheckState());
         }
         return true;
      }
      return false;
@@ -92,8 +115,10 @@
   private int addOrUpdateByGuid(TbAttResMgrSysB oldAbAttResBase,TbAttResMgrSysB tbAttResMgrSysB){
      int i = 0;
      if (null!=oldAbAttResBase){
         tbAttResMgrSysB.setGuid(oldAbAttResBase.getGuid());
         // 更新
         i = baseMapper.updateById(tbAttResMgrSysB);
         tbAttResBaseService.updateFinalState(tbAttResMgrSysB.getResGuid(), tbAttResMgrSysB.getCheckState());
      }else {
         tbAttResMgrSysB.setCreateTime(new Date());
         i = baseMapper.insert(tbAttResMgrSysB);
@@ -160,6 +185,11 @@
      if (newTbAttResMgrSysB.getCheckState()==3){
         fillName = "退回" + (null==newTbAttResMgrSysB.getCheckLog()?"":":" + newTbAttResMgrSysB.getCheckLog());
      }
      // 管理员编辑
      if (newTbAttResMgrSysB.getCheckState()==4){
         fillName = "编辑";
         newTbAttResMgrSysB.setCheckState(oldAbAttResBase.getCheckState());
      }
      // 拼接
      String time = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());