Commit a47f10d5 authored by cq990612's avatar cq990612

优化代码结构

parent c2e2d8fb
......@@ -62,6 +62,8 @@ public enum BASE_RESP_CODE_ENUM {
PASSWORD_FORMAT_ERROR("640","密码由6到16位数字组成"),
INCOMPLETE_WORK_ORDER_INFORMATION("621","请填写完整的工单信息"),
NOT_MANAGER_TYPE("642","没有可以管理的类型项目"),
HAVE_ORDER_DELETE("643", "有工单被用户删除,审批失败,请重新审批"),
ORDER_EXAMINE("644","该工单已经被审批,请刷新查看"),
;
......
......@@ -24,7 +24,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -263,7 +265,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
workTimeOrder.setDeptId(workUserDeptService.getDeptIdByUserId(dto.getUserId()));
BeanUtils.copyProperties(dto, workTimeOrder);
totalTime += dto.getWorkTime();
if (2 == dto.getStatus() || 5 == dto.getStatus()) {
WorkTimeOrder workTimeOrder1 = workTimeOrderMapper.selectById(dto.getWorkId());
if (2 == workTimeOrder1.getStatus()||5 == workTimeOrder1.getStatus()){
if (!dto.getStatus().equals(workTimeOrder1.getStatus())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.ORDER_EXAMINE);
}
continue;
}
BeanUtils.copyProperties(workTimeOrder, dto);
......@@ -518,7 +524,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
List<WorkTimeOrder> workTimeOrders = workTimeOrderMapper.selectBatchIds(ids);
if (ids.size() != workTimeOrders.size()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.HAVE_ORDER_DELETE);
}
// 更新collect表
workCollectService.updateByWorkTimeOrder(workTimeOrders);
......@@ -733,7 +741,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
if (null == dto.getWorkTime() || 0 == dto.getWorkTime()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.TIME_NOT_IS_NULL);
}
......@@ -894,7 +901,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (0 != level) {
Integer deptId = user.getDeptId();
workTimeOrders = workTimeOrderMapper.queryByPage(status, projectId, type,deptId);
workTimeOrders = workTimeOrderMapper.queryByPage(status, projectId, type, deptId);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment