|
@@ -160,9 +160,72 @@ public class ManHourServiceImpl implements ManHourService {
|
|
public ResMsg findManHourByID(Integer manId) {
|
|
public ResMsg findManHourByID(Integer manId) {
|
|
Optional<ManHourInfoEntity> byId = manHourMapper.findById(manId);
|
|
Optional<ManHourInfoEntity> byId = manHourMapper.findById(manId);
|
|
ManHourInfoEntity infoEntity = byId.orElse(null) != null ? byId.orElse(null) : null;
|
|
ManHourInfoEntity infoEntity = byId.orElse(null) != null ? byId.orElse(null) : null;
|
|
|
|
+ Optional<UserInfoEntity> userInfoEntity = userInfoMapper.findById(infoEntity.getCreateUser());
|
|
|
|
+ infoEntity.setCreateUser(userInfoEntity.get().getShowName());
|
|
|
|
+ infoEntity.setProjectUser(userInfoEntity.get().getShowName());
|
|
|
|
+ Optional<ProjectInfoEntity> projectInfoEntity = projectInfoMapper.findById(Integer.valueOf(infoEntity.getProjectId()));
|
|
|
|
+ infoEntity.setProjectId(projectInfoEntity.get().getProjectName());
|
|
|
|
+ Optional<TaskInfoEntity> taskInfoEntity = taskInfoMapper.findById(Integer.valueOf(infoEntity.getTaskId()));
|
|
|
|
+ infoEntity.setTaskId(taskInfoEntity.get().getTargetTask());
|
|
return new ResMsg(CodeEnum.OK, infoEntity);
|
|
return new ResMsg(CodeEnum.OK, infoEntity);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResMsg editManHour(ManHourInfoVo manHourInfoVo) {
|
|
|
|
+ ManHourInfoEntity byId = manHourMapper.findById(manHourInfoVo.getManId()).get();
|
|
|
|
+ String manStatus = byId.getManStatus();
|
|
|
|
+ //未提交的工时更改
|
|
|
|
+ if (ManHourStatus.NO_ALLOCATION.getCode().equals(manStatus)) {
|
|
|
|
+ ManHourInfoEntity infoEntity = new ManHourInfoEntity();
|
|
|
|
+ BeanUtils.copyProperties(manHourInfoVo, infoEntity);
|
|
|
|
+ //保留原本信息
|
|
|
|
+ infoEntity.setProjectUser(byId.getProjectUser());
|
|
|
|
+ infoEntity.setCreateUser(byId.getCreateUser());
|
|
|
|
+ infoEntity.setManStatus(ManHourStatus.NO_ALLOCATION.getCode());
|
|
|
|
+ infoEntity.setCreateTime(new Date());
|
|
|
|
+ infoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
|
|
|
|
+ ManHourInfoEntity save = manHourMapper.save(infoEntity);
|
|
|
|
+ return new ResMsg(CodeEnum.OK, save);
|
|
|
|
+ } else if (ManHourStatus.REFUSE_ED.getCode().equals(manStatus)) {
|
|
|
|
+ //拒绝后的工时更改
|
|
|
|
+ ManHourInfoEntity infoEntity = new ManHourInfoEntity();
|
|
|
|
+ BeanUtils.copyProperties(manHourInfoVo, infoEntity);
|
|
|
|
+ //保留
|
|
|
|
+ infoEntity.setProjectUser(byId.getProjectUser());
|
|
|
|
+ infoEntity.setCreateUser(byId.getCreateUser());
|
|
|
|
+ infoEntity.setManStatus(ManHourStatus.NO_ALLOCATION.getCode());
|
|
|
|
+ infoEntity.setCreateTime(new Date());
|
|
|
|
+ infoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
|
|
|
|
+ infoEntity.setManId(new ManHourInfoEntity().getManId());
|
|
|
|
+ manHourMapper.deleteById(byId.getManId());
|
|
|
|
+ ManHourInfoEntity save = manHourMapper.save(infoEntity);
|
|
|
|
+ return new ResMsg(CodeEnum.OK, save);
|
|
|
|
+ }
|
|
|
|
+ return new ResMsg(CodeEnum.OK, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 编辑工时之后提交
|
|
|
|
+ *
|
|
|
|
+ * @param manHourInfoVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResMsg submitManHourByeEdit(ManHourInfoVo manHourInfoVo) {
|
|
|
|
+ //先编辑工时
|
|
|
|
+ ManHourInfoEntity infoEntity = (ManHourInfoEntity) editManHour(manHourInfoVo).getData();
|
|
|
|
+ // 提交工时
|
|
|
|
+ if (!ObjectUtils.isEmpty(infoEntity)) {
|
|
|
|
+ ResMsg resMsg = manHourFlowStart(infoEntity);
|
|
|
|
+ if (!"200".equals(resMsg.getCode())) {
|
|
|
|
+ return resMsg;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return new ResMsg(CodeEnum.DATA_VALIDATED_FAILED);
|
|
|
|
+ }
|
|
|
|
+ return new ResMsg(CodeEnum.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
public ResMsg manHourFlowStart(ManHourInfoEntity manHourInfoEntity) {
|
|
public ResMsg manHourFlowStart(ManHourInfoEntity manHourInfoEntity) {
|
|
//param processDefinitionKey 项目人员工时接口审批流程--流程标识。
|
|
//param processDefinitionKey 项目人员工时接口审批流程--流程标识。
|
|
String processDefinitionKey = "manHourCountApply";
|
|
String processDefinitionKey = "manHourCountApply";
|