Browse Source

DeBugDeBugDeBug

buzhanyi 2 years ago
parent
commit
d71bc7d3be

BIN
purchase-admin/src/main/resources/template/planQuarter.xlsx


BIN
purchase-admin/src/main/resources/template/planYears.xlsx


BIN
purchase-admin/src/main/resources/template/plan_year.xlsx


BIN
purchase-admin/src/main/resources/template/professional.xlsx


BIN
purchase-admin/src/main/resources/template/provisional_plan.xlsx


+ 38 - 6
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanYearsServiceImpl.java

@@ -372,14 +372,46 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
                         ++failureNum;
                         failureMsg.append(failureNum + "、采购单位“" + ofYear.getPurchaseDeptName() + "”不存在");
                     }
-                    //采购单位
-                    SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofYear.getOrganDivision());
-                    if (!ObjectUtils.isEmpty(infoTow)) {
-                        ofYear.setOrganDivision(String.valueOf(info.getDeptId()));
+                    //机关业务指导处是多选字段
+                    StringBuilder zBuilder = new StringBuilder();
+                    if (ofYear.getOrganDivision().contains(",")) {
+                        String[] split = ofYear.getOrganDivision().split(",");
+                        for (String s : split) {
+                            SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofYear.getOrganDivision());
+                            //不是最后一位就加‘,’,是就直接结尾
+                            if (!ofYear.getOrganDivision().endsWith(s)) {
+                                if (!ObjectUtils.isEmpty(infoTow)) {
+                                    zBuilder.append(infoTow.getDeptId() + ",");
+                                } else {
+                                    ++failureNum;
+                                    failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofYear.getOrganDivision() + "”不存在");
+                                }
+                            } else {
+                                if (!ObjectUtils.isEmpty(infoTow)) {
+                                    zBuilder.append(infoTow.getDeptId());
+                                } else {
+                                    ++failureNum;
+                                    failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofYear.getOrganDivision() + "”不存在");
+                                }
+                            }
+                        }
+                        String zs = zBuilder.toString();
+                        if (zs.endsWith(",")) {
+                            zBuilder = null;
+                            zBuilder.append(zs.substring(0, zs.length() - 1));
+                        }
                     } else {
-                        ++failureNum;
-                        failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofYear.getOrganDivision() + "”不存在");
+                        //没有多选
+                        SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofYear.getOrganDivision());
+                        if (!ObjectUtils.isEmpty(infoTow)) {
+                            zBuilder.append(infoTow.getDeptId());
+                        } else {
+                            ++failureNum;
+                            failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofYear.getOrganDivision() + "”不存在");
+                        }
                     }
+                    ofYear.setOrganDivision(zBuilder.toString());
+
 
                     ofYear.setProjectType(projectTypesMap.get(ofYear.getProjectType()));
                     ofYear.setPurchaseServices(purchaseServicesMap.get(ofYear.getPurchaseServices()));

+ 42 - 1
purchase-system/src/main/java/com/ozs/plan/service/impl/ProvisionalPlanServiceImpl.java

@@ -142,6 +142,48 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
                     }
                     ofProvisionalPlan.setProjectType(projectTypesMap.get(ofProvisionalPlan.getProjectType()));
                     ofProvisionalPlan.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
+
+                    //机关业务指导处是多选字段
+                    StringBuilder zBuilder = new StringBuilder();
+                    if (ofProvisionalPlan.getOrganDivision().contains(",")) {
+                        String[] split = ofProvisionalPlan.getOrganDivision().split(",");
+                        for (String s : split) {
+                            SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofProvisionalPlan.getOrganDivision());
+                            //不是最后一位就加‘,’,是就直接结尾
+                            if (!ofProvisionalPlan.getOrganDivision().endsWith(s)) {
+                                if (!ObjectUtils.isEmpty(infoTow)) {
+                                    zBuilder.append(infoTow.getDeptId() + ",");
+                                } else {
+                                    ++failureNum;
+                                    failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
+                                }
+                            } else {
+                                if (!ObjectUtils.isEmpty(infoTow)) {
+                                    zBuilder.append(infoTow.getDeptId());
+                                } else {
+                                    ++failureNum;
+                                    failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
+                                }
+                            }
+                        }
+                        String zs = zBuilder.toString();
+                        if (zs.endsWith(",")) {
+                            zBuilder = null;
+                            zBuilder.append(zs.substring(0, zs.length() - 1));
+                        }
+                    } else {
+                        //没有多选
+                        SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofProvisionalPlan.getOrganDivision());
+                        if (!ObjectUtils.isEmpty(infoTow)) {
+                            zBuilder.append(infoTow.getDeptId());
+                        } else {
+                            ++failureNum;
+                            failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
+                        }
+                    }
+                    ofProvisionalPlan.setOrganDivision(zBuilder.toString());
+
+
                     //项目属性是多选字段
                     StringBuilder builder = new StringBuilder();
                     if (ofProvisionalPlan.getProjectAttr().contains(",")) {
@@ -157,7 +199,6 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
                         builder.append(projectAttributes.get(ofProvisionalPlan.getProjectAttr()));
                     }
                     ofProvisionalPlan.setProjectAttr(builder.toString());
-                    // ofProvisionalPlan.setPurchaseServices(purchaseServices.get(ofProvisionalPlan.getPurchaseServicesStr()));
                     ofProvisionalPlan.setIsExcess(deptService.isExcessOrNo(ofProvisionalPlan.getProjectType(), ofProvisionalPlan.getEvaluation(), info.getDeptId()));
                     ofProvisionalPlan.setCreated(String.valueOf(loginUser.getUserId()));
                     ofProvisionalPlan.setCreateTime(new Date());