|
@@ -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>");
|