Browse Source

监理相关操作逻辑调整

zhuang 1 year ago
parent
commit
913dd5926b

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxSupervisionCustomUserManageDao.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ZhcxSupervisionCustomUserManageDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 监理客户账号管理表 Mapper 接口
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-01-11
+ */
+public interface ZhcxSupervisionCustomUserManageDao extends BaseMapper<ZhcxSupervisionCustomUserManageDo> {
+
+}

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxSupervisionCustomUserManageService.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ZhcxSupervisionCustomUserManageDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 监理客户账号管理表 服务类
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-01-11
+ */
+public interface ZhcxSupervisionCustomUserManageService extends IService<ZhcxSupervisionCustomUserManageDo> {
+
+}

+ 35 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionItpServiceImpl.java

@@ -10,9 +10,11 @@ import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpDao;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpSupervisionDispatchDo;
+import com.rongwei.bsentity.domain.ZhcxSupervisionCustomUserManageDo;
 import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
 import com.rongwei.bsentity.vo.SupervisionVo;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
+import com.rongwei.rwadmincommon.system.domain.SysRoleDo;
 import com.rongwei.rwadmincommon.system.service.SysGeneralCRUDService;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
@@ -63,6 +65,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Autowired
     private SysGeneralCRUDService sysGeneralCRUDService;
 
+    @Autowired
+    private ZhcxSupervisionCustomUserManageService zhcxSupervisionCustomUserManageService;
+
     /**
      * 拆单
      *
@@ -136,10 +141,25 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 //        List<String> dispatchIds = vo.getDispatchIds();
         boolean hasDispatch ;
         boolean hasUpdate ;
+        boolean hasQcRole = false ;
+        boolean hasZgRole = false ;
+        boolean hasJjyRole = false ;
         StringBuilder sb = new StringBuilder();
         List<ZhcxOutsideInspectionItpSupervisionDispatchDo> saveDispatchDos = new ArrayList<>();
         List<ZhcxOutsideInspectionItpSupervisionDispatchDo> updateDispatchDos = new ArrayList<>();
         List<ZhcxOutsideInspectionItpDo> inspectionItpDos = new ArrayList<>();
+        SysUserVo user = zhcxCommon.getCurrentUser();
+        log.info("当前登录用户ID"+user.getId());
+        List<SysRoleDo> roleDos = user.getRoleDos();
+        for (int x = 0; x < roleDos.size(); x++) {
+            if("role065".equals(roleDos.get(x).getCode())){
+                hasQcRole = true;
+            }else if("role061".equals(roleDos.get(x).getCode())){
+                hasZgRole = true;
+            }else if("role062".equals(roleDos.get(x).getCode())){
+                hasJjyRole = true;
+            }
+        }
         for(int i =0;i<vo.size();i++){
             String operType = vo.get(i).getOperType();
             String itpId = vo.get(i).getItpId();
@@ -160,8 +180,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 //            } else {
 //                dispatchDo.setId(SecurityUtil.getUUID());
 //            }
-            SysUserVo user = zhcxCommon.getCurrentUser();
-            log.info("当前登录用户ID"+user.getId());
+
             //10未派单 20已派单
             if (dispatchDo != null && "20".equals(dispatchDo.getDispatchstatus())) {
                 log.info("有Dispatch,有dispatchId="+dispatchId);
@@ -189,6 +208,11 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
             }
             /* 取消 */
             if ("10".equals(operType)) {
+                //监理检验员只能操作自己的数据
+                if(hasJjyRole && !dispatchDo.getSupervisionuserid().equals(user.getId())){
+                    sb.append("单据号:"+inspectioncode+"已被改派,不能取消,请刷新数据查看<br>");
+                    continue;
+                }
                 /* 10: QC 20: 监理 */
                 /* 10: 派单前监理取消 20: 派单后监理取消 30: 派单前QC取消 40: 派单后QC取消 */
                 String cancelSource = vo.get(i).getSource();
@@ -204,12 +228,21 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 dispatchDo.setDispatchstatus("30");
                 inspectionItpDo.setInspectionstatus("40");
             } else if ("20".equals(operType)) {
+                if(hasJjyRole && !dispatchDo.getSupervisionuserid().equals(user.getId())){
+                    sb.append("单据号:"+inspectioncode+"已被改派,不能拒收,请刷新数据查看<br>");
+                    continue;
+                }
                 /* 检验员才有拒收 */
                 dispatchDo.setInspectionconclusion("20");
                 dispatchDo.setRefusereason(vo.get(i).getReason());
                 dispatchDo.setLastrefusereason(vo.get(i).getReason());
                 inspectionItpDo.setInspectionstatus("30");
             } else if (Arrays.asList("30", "40").contains(operType)) {
+                //监理检验员只能操作自己的数据
+                if(hasJjyRole && !dispatchDo.getSupervisionuserid().equals(user.getId())){
+                    sb.append("单据号:"+inspectioncode+"已被改派,不能取消,请刷新数据查看<br>");
+                    continue;
+                }
                 if ("30".equals(operType) && hasDispatch) {
                     //return "该报验单已派单";
                     sb.append("单据号:"+inspectioncode+"已派单<br>");

+ 20 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxSupervisionCustomUserManageServiceImpl.java

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.rongwei.bsentity.domain.ZhcxSupervisionCustomUserManageDo;
+import com.rongwei.bscommon.sys.dao.ZhcxSupervisionCustomUserManageDao;
+import com.rongwei.bscommon.sys.service.ZhcxSupervisionCustomUserManageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 监理客户账号管理表 服务实现类
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-01-11
+ */
+@Service
+public class ZhcxSupervisionCustomUserManageServiceImpl extends ServiceImpl<ZhcxSupervisionCustomUserManageDao, ZhcxSupervisionCustomUserManageDo> implements ZhcxSupervisionCustomUserManageService {
+
+}

+ 88 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxSupervisionCustomUserManageDo.java

@@ -0,0 +1,88 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 监理客户账号管理表
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-01-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("ZHCX_SUPERVISION_CUSTOM_USER_MANAGE")
+public class ZhcxSupervisionCustomUserManageDo extends BaseDo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableField("ID")
+    private String id;
+    /**
+     * 租户id
+     */
+    @TableField("TENANTID")
+    private String tenantid;
+    /**
+     * 扩展json格式配置
+     */
+    @TableField("ROPTION")
+    private String roption;
+    /**
+     * 姓名
+     */
+    @TableField("USER_NAME")
+    private String userName;
+    /**
+     * 账号
+     */
+    @TableField("ACCOUNT")
+    private String account;
+    /**
+     * 签名
+     */
+    @TableField("SIGNATURE")
+    private String signature;
+    /**
+     * 手机号
+     */
+    @TableField("PHONE")
+    private String phone;
+    /**
+     * 邮箱
+     */
+    @TableField("EMAIL")
+    private String email;
+    /**
+     * 角色
+     */
+    @TableField("ROLE")
+    private String role;
+    /**
+     * 账号状态
+     */
+    @TableField("STATUS")
+    private String status;
+    /**
+     * 父id
+     */
+    @TableField("PID")
+    private String pid;
+    /**
+     * 用户表id
+     */
+    @TableField("USERID")
+    private String userid;
+
+
+}