Explorar o código

更新ZHCX_ITP_PROJECT_NODE_STATE表实体类

sola hai 1 ano
pai
achega
54c954876a

+ 15 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxApiDao.java

@@ -18,4 +18,19 @@ public interface ZhcxApiDao {
 
     @Select("select ALL_QUALIFIED from ZHCX_CHECK_BEFORE_QUALIFIED where DELETED = '0' AND PID =#{id}")
     List<String> getCoreInspectionDetailList(@Param("id") String id);
+
+
+    @Select("select * from ZHCX_SUBCONTRACTOR_MANAGE_USER where DELETED = '0' AND USERID =#{id}")
+    List<Map<String, Object>> getSubcontractorManageUserByUserId(@Param("id") String id);
+
+
+    @Select("select * from SYS_ORGANIZATION where DELETED = '0'")
+    List<Map<String, Object>> getAllOrg();
+
+
+    @Select("SELECT * FROM ZHCX_SUPERVISION_CUSTOM_MANAGE WHERE ID IN (SELECT PID FROM ZHCX_SUPERVISION_CUSTOM_USER_MANAGE WHERE USERID = #{id} AND DELETED = '0') AND DELETED = '0'")
+    List<Map<String, Object>> getSupervisionByUserId(@Param("id") String id);
+
+    @Select("SELECT * FROM ZHCX_SUBCONTRACTOR_MANAGE WHERE ID IN (SELECT PID FROM ZHCX_SUBCONTRACTOR_MANAGE_USER WHERE USERID = #{id} AND DELETED = '0') AND DELETED = '0'")
+    List<Map<String, Object>> getSubcontractorByUserId(@Param("id") String id);
 }

+ 2 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxApiService.java

@@ -26,4 +26,6 @@ public interface ZhcxApiService {
     R forgetPwdSendSmsCode(Map<String, Object> map);
 
     R forgetResetPwd(Map<String, Object> map);
+
+    Map<String, Object> getProjectStaticData(String userId);
 }

+ 37 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxApiServiceImpl.java

@@ -7,17 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.dao.ZhcxApiDao;
 import com.rongwei.bscommon.sys.service.ZhcxApiService;
+import com.rongwei.bscommon.sys.service.ZhcxSubcontractorUserService;
+import com.rongwei.bscommon.sys.service.ZhcxSupervisionCustomUserManageService;
 import com.rongwei.bscommon.sys.utils.CxConstants;
 import com.rongwei.bscommon.sys.utils.HwSmsUtil;
 import com.rongwei.bscommon.sys.utils.SmsCodeGenerateUtils;
+import com.rongwei.bsentity.domain.ZhcxSupervisionCustomUserManageDo;
 import com.rongwei.bsentity.vo.ZhcxOutsideInspectionVo;
 import com.rongwei.commonservice.service.RedisService;
 import com.rongwei.commonservice.service.SysConfigService;
 import com.rongwei.rwadmincommon.system.domain.SysUserDo;
 import com.rongwei.rwadmincommon.system.service.SysUserService;
-import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
-import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.CheckPasswordUtils;
 import com.rongwei.rwcommon.utils.RsaUtil;
 import com.rongwei.rwcommon.utils.SecurityUtil;
@@ -31,7 +32,7 @@ import org.springframework.stereotype.Service;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.*;
-import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * @author zhuang
@@ -49,6 +50,13 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
     @Autowired
     private SysConfigService sysConfigService;
 
+    @Autowired
+    private ZhcxSupervisionCustomUserManageService supervisionUserService;
+
+
+    @Autowired
+    private ZhcxSubcontractorUserService subcontractorUserService;
+
     @Override
     public List<ZhcxOutsideInspectionVo> getOutsideInspectionList(Map<String, Object> map) {
         return zhcxApiDao.getOutsideInspectionList(map);
@@ -315,6 +323,32 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
         return R.error("重置失败,请联系系统管理员排查");
     }
 
+    @Override
+    public Map<String, Object> getProjectStaticData(String userId) {
+        Map<String, Object> map = new HashMap<>();
+        // 监理用户
+        LambdaQueryWrapper<ZhcxSupervisionCustomUserManageDo> wrapper1 = Wrappers.lambdaQuery();
+        wrapper1.eq(ZhcxSupervisionCustomUserManageDo::getUserid, userId);
+        wrapper1.eq(ZhcxSupervisionCustomUserManageDo::getDeleted, "0");
+        List<ZhcxSupervisionCustomUserManageDo> list1 = supervisionUserService.list(wrapper1);
+        map.put("supervisionUser", list1);
+        // 监理公司
+        List<Map<String, Object>> list2 = zhcxApiDao.getSupervisionByUserId(userId);
+        map.put("supervision", list2);
+
+        // 分包商用户
+        List<Map<String, Object>> list3 = zhcxApiDao.getSubcontractorManageUserByUserId(userId);
+        map.put("subcontractorUser", list3);
+
+        // 分包商公司
+        List<Map<String, Object>> list4 = zhcxApiDao.getSubcontractorByUserId(userId);
+        map.put("subcontractor", list4);
+
+        List<Map<String, Object>> list5 = zhcxApiDao.getAllOrg();
+        map.put("org", list5);
+        return map;
+    }
+
     private R sendSmsCode(String templateId, String redisKeyName, String mobile, String redisLabelName) {
         boolean exists = redisService.hasKey(redisKeyName);
         List<String> list = new ArrayList<>();

+ 71 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionDispatchService;
 import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionOperLogService;
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateService;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
 import com.rongwei.bsentity.domain.*;
 import com.rongwei.bscommon.sys.dao.ZhcxInsideInspectionDao;
@@ -84,6 +85,10 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
     @Autowired
     private SysFileItemService sysFileItemService;
 
+
+    @Autowired
+    private ZhcxItpProjectNodeStateService itpProjectNodeStateService;
+
     @Value("${temp.filepath:#{null}}")
     private String filepath;
 
@@ -274,6 +279,11 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
 
         //发送提醒
         zhcxCommon.sendMsg(notifyList);
+
+        // 写入ZHCX_ITP_PROJECT_NODE_STATE表
+        for (ZhcxInsideInspectionDo row : inspectionList) {
+            saveResultToNodeState(row, "10");
+        }
     }
 
     /**
@@ -578,18 +588,22 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         if(ObjectUtil.isEmpty(req.getInsideIdList())) {
             throw  new CustomException("请联系管理员,暂无报验单");
         }
-
+        // 20: 拒收 50: 接收 60: 有条件接收
+        String es = "";
         OperDto operDto;
         //接收
         if("10".equals(req.getConclusion())) {
+            es = "50";
             operDto = getOper("50");
         }
         //拒收
         else if("20".equals(req.getConclusion())) {
+            es = "20";
             operDto = getOper("20");
         }
         //有条件接收
         else if("30".equals(req.getConclusion())) {
+            es = "60";
             operDto = getOper("60");
         }
         else {
@@ -657,6 +671,11 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             //操作日志
             operLogService.saveOperLog(req, operDto, Collections.emptyMap());
         }
+
+        // 写入ZHCX_ITP_PROJECT_NODE_STATE表
+        for (ZhcxInsideInspectionDo row : inspectionList) {
+            saveResultToNodeState(row, es);
+        }
     }
 
     /**
@@ -1381,4 +1400,55 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         sysSerialVo.setInitValue(0L);
         return serialNumberService.getCodeByTemplate(sysSerialVo);
     }
+
+    /**
+     * 保存数据到ZHCX_ITP_PROJECT_NODE_STATE(项目各机号报验点状态)表
+     * @param operType 操作类型 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间
+     */
+    private void saveResultToNodeState(ZhcxInsideInspectionDo itpDoPa, String operType) {
+        ZhcxInsideInspectionDo itpDo = getById(itpDoPa.getId());
+
+        if("unitp".equals(itpDo.getLaunchtype())) {
+            return;
+        }
+        String machineNo = itpDo.getMachineno();
+        if (StringUtils.isBlank(machineNo)) {
+            machineNo = itpDo.getStructuremachineno();
+        }
+        if (StringUtils.isBlank(machineNo)) {
+            log.error("{}-{}:总装机号和结构机号都没有", itpDo.getId(), itpDo.getInspectioncode());
+            return;
+        }
+        String[] machinenos = machineNo.split(",");
+        List<ZhcxItpProjectNodeStateResultDto> list = new ArrayList<>(machinenos.length);
+        for (String mn : machinenos) {
+            LambdaQueryWrapper<ZhcxItpProjectNodeStateDo> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.eq(ZhcxItpProjectNodeStateDo::getPrjid, itpDo.getProjectid())
+                    .eq(ZhcxItpProjectNodeStateDo::getMathinecode, mn)
+                    .eq(ZhcxItpProjectNodeStateDo::getNodeid, itpDo.getInspectioncontentid());
+            ZhcxItpProjectNodeStateDo stateDo = itpProjectNodeStateService.getOne(queryWrapper);
+
+            ZhcxItpProjectNodeStateDo entity = new ZhcxItpProjectNodeStateDo();
+            if(ObjectUtil.isNull(stateDo)) {
+                entity.setId(SecurityUtil.getUUID());
+                entity.setMathinecode(mn);
+                entity.setPrjid(itpDo.getProjectid());
+                entity.setNodeid(itpDo.getInspectioncontentid());
+                entity.setDeleted("0");
+                entity.setInstate(operType);
+                entity.setIncompletetime(itpDoPa.getInspectioncomplatetime());
+                entity.setIntimes(itpDo.getInspectioncount());
+                entity.setCreatedate(new Date());
+                entity.setModifydate(new Date());
+//                itpProjectNodeStateService.save(entity);
+            } else {
+                stateDo.setInstate(operType);
+                stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
+                stateDo.setIntimes(itpDo.getInspectioncount());
+                stateDo.setModifydate(new Date());
+//                itpProjectNodeStateService.updateById(stateDo);
+            }
+        }
+    }
+
 }

+ 6 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateDo.java

@@ -88,5 +88,11 @@ public class ZhcxItpProjectNodeStateDo extends BaseDo {
     @TableField("OUTCOMPLETETIME")
     private Date outcompletetime;
 
+    /**
+     * 内部报验完成时间
+     */
+    @TableField("INCOMPLETETIME")
+    private Date incompletetime;
+
 
 }

+ 29 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxApiController.java

@@ -4,14 +4,19 @@ import com.alibaba.fastjson.JSONObject;
 import com.rongwei.bscommon.sys.service.DmTableService;
 import com.rongwei.bscommon.sys.service.ZhcxApiService;
 import com.rongwei.bscommon.sys.utils.HwSmsUtil;
+import com.rongwei.bscommon.sys.utils.ZhcxCommon;
 import com.rongwei.bsentity.vo.ZhcxOutsideInspectionVo;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Map;
@@ -22,11 +27,15 @@ import java.util.Random;
  */
 @RestController
 @RequestMapping("/zhcxApi")
+@Slf4j
 public class ZhcxApiController {
 
     @Autowired
     private ZhcxApiService zhcxApiService;
 
+    @Autowired
+    private ZhcxCommon zhcxCommon;
+
     @PostMapping("/getOutsideInspectionList")
     public R getOutsideInspectionList(@RequestBody Map<String,Object> map){
         if(!map.containsKey("projectcode")){
@@ -77,4 +86,24 @@ public class ZhcxApiController {
         R r = zhcxApiService.forgetResetPwd(map);
         return r;
     }
+
+    /**
+     * 用户的监理、分包商等信息(如果存在)
+     * @param map
+     * @return 用户的监理、分包商等信息(如果存在)
+     */
+    @PostMapping("/gpsd")
+    public R getProjectStaticData(@RequestBody Map<String,Object> map, HttpServletRequest request){
+        try {
+            SysUserVo currUser = zhcxCommon.getCurrentUser();
+            if (currUser == null) {
+                return R.ok();
+            }
+            Map<String, Object> userMap = zhcxApiService.getProjectStaticData(currUser.getId());
+            return R.ok(userMap);
+        } catch (Exception e) {
+            log.error(StringUtils.spliceErrorMsg(e), e.fillInStackTrace());
+            return R.error("查询用户数据异常");
+        }
+    }
 }