|
@@ -108,7 +108,31 @@ public class ManHourServiceImpl implements ManHourService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResMsg submitManHour(List<ManHourInfoVo> manHourInfoVos) {
|
|
|
+ public ResMsg submitManHourBySave(ManHourInfoVo manHourInfoVo) {
|
|
|
+ List<ManHourJobVo> jobs = manHourInfoVo.getJobs();
|
|
|
+ Optional<UserInfoEntity> byId1 = userInfoMapper.findById(manHourInfoVo.getCreateUser());
|
|
|
+ String showName = byId1.orElse(null) != null ? byId1.orElse(null).getShowName() : null;
|
|
|
+ for (ManHourJobVo job : jobs) {
|
|
|
+ ManHourInfoEntity manHourInfoEntity = new ManHourInfoEntity();
|
|
|
+ BeanUtils.copyProperties(manHourInfoVo, manHourInfoEntity);
|
|
|
+ //工时:添加后状态为1,未提交
|
|
|
+ manHourInfoEntity.setProjectUser(showName);
|
|
|
+ manHourInfoEntity.setCreateUser(byId1.get().getUserId());
|
|
|
+ manHourInfoEntity.setManStatus(ManHourStatus.NO_ALLOCATION.getCode());
|
|
|
+ BeanUtils.copyProperties(job, manHourInfoEntity);
|
|
|
+ manHourInfoEntity.setCreateTime(new Date());
|
|
|
+ manHourInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
|
|
|
+ ManHourInfoEntity save = manHourMapper.save(manHourInfoEntity);
|
|
|
+ ResMsg resMsg = manHourFlowStart(save);
|
|
|
+ if (!"200".equals(resMsg.getCode())) {
|
|
|
+ return resMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ResMsg(CodeEnum.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResMsg submitManHourBatch(List<ManHourInfoVo> manHourInfoVos) {
|
|
|
//先判断ID是否为空:不为空就是批量提交的
|
|
|
if (!ObjectUtils.isEmpty(manHourInfoVos.get(0).getManId())) {
|
|
|
for (ManHourInfoVo vo : manHourInfoVos) {
|
|
@@ -119,17 +143,7 @@ public class ManHourServiceImpl implements ManHourService {
|
|
|
return resMsg;
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- //为空就是单个新增并且提交的,新增的也是生成多天记录后提交
|
|
|
- Optional<UserInfoEntity> byId1 = userInfoMapper.findById(TokenData.takeFromRequest().getUserId());
|
|
|
- ManHourInfoVo vo = manHourInfoVos.get(0);
|
|
|
- ManHourInfoEntity manHourInfoEntity = new ManHourInfoEntity();
|
|
|
- BeanUtils.copyProperties(vo, manHourInfoEntity);
|
|
|
- manHourInfoEntity.setProjectUser(byId1.orElse(null) != null ? byId1.orElse(null).getShowName() : null);
|
|
|
- ManHourInfoEntity save = manHourMapper.save(manHourInfoEntity);
|
|
|
- return manHourFlowStart(save);
|
|
|
}
|
|
|
-
|
|
|
return new ResMsg(CodeEnum.OK);
|
|
|
}
|
|
|
|