|
@@ -11,9 +11,11 @@ import com.platform.dao.entity.customize.CustomFieldTemplateData;
|
|
|
import com.platform.dao.entity.repair.RepairApplicationForm;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
+import com.platform.dao.entity.upms.SysUserDept;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.customize.CustomFieldTemplateDataMapper;
|
|
|
import com.platform.dao.mapper.sb.SbPositionMapper;
|
|
|
+import com.platform.dao.mapper.upms.SysUserDeptMapper;
|
|
|
import com.platform.dao.mapper.upms.SysUserMapper;
|
|
|
import com.platform.dao.util.MessageTemplateUtil;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
@@ -48,6 +50,8 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
private PartInfoService partInfoService;
|
|
|
@Resource
|
|
|
private SbPositionMapper sbPositionMapper;
|
|
|
+ @Resource
|
|
|
+ private SysUserDeptMapper sysUserDeptMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -410,7 +414,7 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
// 通知维修人
|
|
|
sendMessageToRepairer(BeanConverterUtil.copyObjectProperties(existForm,RepairApplicationFormDTO.class));
|
|
|
}else if(roles.contains(SysRoleCodeEnum.MM.name())){
|
|
|
- // 维修主管处理
|
|
|
+ // 区域负责人处理
|
|
|
form.setDispatchUserId(model.getDispatchUserId());
|
|
|
form.setStatus(RepairApplicationFormStatusEnum.MM_DISPATCH.getValue());
|
|
|
// 主管派单通知工程师
|
|
@@ -491,21 +495,46 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
public RepairApplicationFormDTO dispatchRepair(RepairApplicationFormDTO model) {
|
|
|
// 完成维修和维修上报的状态才给转派
|
|
|
if(model.getStatus() != RepairApplicationFormStatusEnum.REPAIR_FAIL.getValue() &&
|
|
|
- model.getStatus() != RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue()){
|
|
|
+ model.getStatus() != RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue() &&
|
|
|
+ model.getStatus() != RepairApplicationFormStatusEnum.MM_REPAIR_FAIL.getValue()){
|
|
|
throw new DeniedException("该状态下不允许转派");
|
|
|
}
|
|
|
// 角色是否符合要求
|
|
|
String roles = getCurrentRoles();
|
|
|
- if(!roles.contains(SysRoleCodeEnum.REPAIR_MANAGE.name())){
|
|
|
+ if(!roles.contains(SysRoleCodeEnum.REPAIR_MANAGE.name()) && !roles.contains(SysRoleCodeEnum.MM.name())){
|
|
|
throw new DeniedException("不具备转派的权限");
|
|
|
}
|
|
|
SysUser user = sysUserMapper.selectByPrimaryKey(model.getDispatchUserId());
|
|
|
RepairApplicationForm form = repairApplicationFormMapper.selectByPrimaryKey(model.getId());
|
|
|
- model.setDispatchUserId(form.getDispatchUserId());
|
|
|
+ // 转派人为工程师时
|
|
|
+ if(model.getRoleType() == 2){
|
|
|
+ model.setDispatchUserId(form.getDispatchUserId());
|
|
|
+ // 添加维修转派记录
|
|
|
+ //addRepairDispatchRecord(model,user);
|
|
|
+ // 更新维修信息
|
|
|
+ form.setDispatchUserId(user.getUserId());
|
|
|
+ //form.setRepairUserId(null);
|
|
|
+ //form.setStatus(RepairApplicationFormStatusEnum.DISPATCH_REPAIR.getValue());
|
|
|
+ //form.setUpdateTime(LocalDateTime.now());
|
|
|
+ //repairApplicationFormMapper.updateLongYan(form);
|
|
|
+ // 添加状态记录
|
|
|
+ //addRepairStatusRecord(form,"维修转派");
|
|
|
+ }else if(model.getRoleType() == 4){ // 区域负责人转派
|
|
|
+ model.setDispatchUserId(form.getReportLeaderId());
|
|
|
+ // 添加维修转派记录
|
|
|
+ //addRepairDispatchRecord(model,user);
|
|
|
+ // 更新维修信息
|
|
|
+ form.setReportLeaderId(user.getUserId());
|
|
|
+ form.setRepairDeptId(sysUserDeptMapper.selectDeptIdByUserId(user.getUserId()));
|
|
|
+ //form.setRepairUserId(null);
|
|
|
+ //form.setStatus(RepairApplicationFormStatusEnum.DISPATCH_REPAIR.getValue());
|
|
|
+ //form.setUpdateTime(LocalDateTime.now());
|
|
|
+ //repairApplicationFormMapper.updateLongYan(form);
|
|
|
+ // 添加状态记录
|
|
|
+ //addRepairStatusRecord(form,"维修转派");
|
|
|
+ }
|
|
|
// 添加维修转派记录
|
|
|
addRepairDispatchRecord(model,user);
|
|
|
- // 更新维修信息
|
|
|
- form.setDispatchUserId(user.getUserId());
|
|
|
form.setRepairUserId(null);
|
|
|
form.setStatus(RepairApplicationFormStatusEnum.DISPATCH_REPAIR.getValue());
|
|
|
form.setUpdateTime(LocalDateTime.now());
|