Przeglądaj źródła

日报填报,修复分组检查bug

QuYueTing 1 tydzień temu
rodzic
commit
dff42bfbc7

+ 25 - 23
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -1563,9 +1563,9 @@ public class ReportController {
         if (Constant.HONG_HU_COMPANY_ID == company.getId()) {
             for (Report report : reportList) {
                 //校验分组为车间的分组时,工单号是否必填
-                if (report.getGroupId() != null) {
-                    String groupName = taskGroupService.getById(report.getGroupId()).getName();
-                    if (groupName.contains("车间") && StringUtils.isEmpty(report.getExtraField4())) {
+                if (report.getGroupId() != null && report.getGroupId() != 0) {
+                    TaskGroup group = taskGroupService.getById(report.getGroupId());
+                    if (group != null && group.getName().contains("车间") && StringUtils.isEmpty(report.getExtraField4())) {
                         HttpRespMsg httpRespMsg = new HttpRespMsg();
                         httpRespMsg.setError("当前选择了带车间的工时分组,对应的工单号必填");
                         return httpRespMsg;
@@ -1577,29 +1577,31 @@ public class ReportController {
             if (collect.size() > 0) {
                 List<ErpOrderInfo> orderList = erpOrderInfoMapper.selectList(new QueryWrapper<ErpOrderInfo>().in("order_id", collect));
                 for (Report report : reportList) {
-                    String errorMsg = null;
-                    Optional<ErpOrderInfo> first = orderList.stream().filter(order -> order.getOrderId().equals(report.getExtraField4())).findFirst();
-                    if (first.isPresent()) {
-                        if (first.get().getDeptId() == null) {
-                            errorMsg = "工单号:"+report.getExtraField4()+"无部门id";
-                        } else {
-                            Department deptItem = departmentMapper.selectOne(new QueryWrapper<Department>().eq("dept_code", first.get().getDeptId()));
-                            if (deptItem != null) {
-                                if (!deptItem.getDepartmentId().equals(report.getDeptId())) {
-                                    report.setDeptId(deptItem.getDepartmentId());
-                                    report.setIsAssist(true);
-                                }
+                    if (!StringUtils.isEmpty(report.getExtraField4())) {
+                        String errorMsg = null;
+                        Optional<ErpOrderInfo> first = orderList.stream().filter(order -> order.getOrderId().equals(report.getExtraField4())).findFirst();
+                        if (first.isPresent()) {
+                            if (first.get().getDeptId() == null) {
+                                errorMsg = "工单号:"+report.getExtraField4()+"无部门id";
                             } else {
-                                errorMsg = "工时系统中尚未设置部门编号:"+first.get().getDeptId();
+                                Department deptItem = departmentMapper.selectOne(new QueryWrapper<Department>().eq("dept_code", first.get().getDeptId()));
+                                if (deptItem != null) {
+                                    if (!deptItem.getDepartmentId().equals(report.getDeptId())) {
+                                        report.setDeptId(deptItem.getDepartmentId());
+                                        report.setIsAssist(true);
+                                    }
+                                } else {
+                                    errorMsg = "工时系统中尚未设置部门编号:"+first.get().getDeptId();
+                                }
                             }
+                        } else {
+                            errorMsg = "erpOrderInfo表中工单号不存在:"+report.getExtraField4();
+                        }
+                        if (errorMsg != null) {
+                            HttpRespMsg httpRespMsg = new HttpRespMsg();
+                            httpRespMsg.setError(errorMsg);
+                            return httpRespMsg;
                         }
-                    } else {
-                        errorMsg = "erpOrderInfo表中工单号不存在:"+report.getExtraField4();
-                    }
-                    if (errorMsg != null) {
-                        HttpRespMsg httpRespMsg = new HttpRespMsg();
-                        httpRespMsg.setError(errorMsg);
-                        return httpRespMsg;
                     }
                 }
             }

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -712,7 +712,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("company_id", user.getCompanyId())
                             .eq("status", 1)
-                            .orderByDesc("is_public").orderByAsc("id");
+                            .orderByDesc("is_public").orderByDesc("id");
                     if (projectMainId!=null){
                         queryWrapper.eq("project_main_id",projectMainId);
                     }

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -149,7 +149,7 @@
             WHERE user_id = #{userId}
         )
             or (is_public = 1 and company_id = #{companyId}))
-        ORDER BY is_public DESC, id ASC
+        ORDER BY is_public DESC, id DESC
     </select>
     <!--获取查询者所在公司每个项目的工时成本-->
     <select id="getTimeCost" resultType="java.util.Map">