Commit c86e5ad0de470e1867cc8c1814cc0ffc6c851eba
1 parent
80efeb18
模板上传获取总公司名称
Showing
1 changed file
with
10 additions
and
8 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/costfee/CostFeeServiceImpl.java
| @@ -206,6 +206,8 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -206,6 +206,8 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 206 | log.info("数据列表为空,跳过插入操作"); | 206 | log.info("数据列表为空,跳过插入操作"); |
| 207 | return; | 207 | return; |
| 208 | } | 208 | } |
| 209 | + //总公司 | ||
| 210 | + DeptRespDTO deptRespDTO = deptApi.getDept(getCompanyId()); | ||
| 209 | //单位集合 | 211 | //单位集合 |
| 210 | List<DeptRespDTO> companyList = deptApi.getSubDeptList(); | 212 | List<DeptRespDTO> companyList = deptApi.getSubDeptList(); |
| 211 | // 1. 预加载部门映射(循环外加载,避免重复查询) | 213 | // 1. 预加载部门映射(循环外加载,避免重复查询) |
| @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 220 | )); | 222 | )); |
| 221 | 223 | ||
| 222 | 224 | ||
| 223 | - // 模板类型校验 | 225 | + // 模板类型校验 |
| 224 | Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch | 226 | Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch |
| 225 | // 根据不同模板类型执行不同的处理逻辑 | 227 | // 根据不同模板类型执行不同的处理逻辑 |
| 226 | if (WaterFeeImport.class.isAssignableFrom(importClass)) { | 228 | if (WaterFeeImport.class.isAssignableFrom(importClass)) { |
| @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 239 | WaterFeeDO fee = new WaterFeeDO(); | 241 | WaterFeeDO fee = new WaterFeeDO(); |
| 240 | BeanUtils.copyProperties(importObj, fee); | 242 | BeanUtils.copyProperties(importObj, fee); |
| 241 | fee.setCompanyId(String.valueOf(getCompanyId())); | 243 | fee.setCompanyId(String.valueOf(getCompanyId())); |
| 242 | - if (getCompanyId() == 100) { | ||
| 243 | - fee.setCompanyName("蓟城山水"); | 244 | + if (deptRespDTO.getParentId() == 0) { |
| 245 | + fee.setCompanyName(Objects.toString(deptRespDTO.getName(), "")); | ||
| 244 | } else { | 246 | } else { |
| 245 | // 设置单位id | 247 | // 设置单位id |
| 246 | fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId()))); | 248 | fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId()))); |
| @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 612 | Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean); | 614 | Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean); |
| 613 | if (!violations.isEmpty()) { | 615 | if (!violations.isEmpty()) { |
| 614 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 616 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 615 | - // StringBuilder errorMsg = new StringBuilder(); | 617 | + // StringBuilder errorMsg = new StringBuilder(); |
| 616 | for (ConstraintViolation<WaterFeeImport> violation : violations) { | 618 | for (ConstraintViolation<WaterFeeImport> violation : violations) { |
| 617 | //errorMsg.append(violation.getMessage()).append(";"); | 619 | //errorMsg.append(violation.getMessage()).append(";"); |
| 618 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 620 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 644 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 646 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 645 | //StringBuilder errorMsg = new StringBuilder(); | 647 | //StringBuilder errorMsg = new StringBuilder(); |
| 646 | for (ConstraintViolation<PersonalCostImport> violation : violations) { | 648 | for (ConstraintViolation<PersonalCostImport> violation : violations) { |
| 647 | - // errorMsg.append(violation.getMessage()).append(";"); | 649 | + // errorMsg.append(violation.getMessage()).append(";"); |
| 648 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 650 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 649 | "第[{}]条数据:"+ violation.getMessage() | 651 | "第[{}]条数据:"+ violation.getMessage() |
| 650 | ), rowNum); | 652 | ), rowNum); |
| 651 | } | 653 | } |
| 652 | // 抛出包含行号和所有错误的异常 | 654 | // 抛出包含行号和所有错误的异常 |
| 653 | - // throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); | 655 | + // throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); |
| 654 | } | 656 | } |
| 655 | Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); | 657 | Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); |
| 656 | //单位校验 | 658 | //单位校验 |
| @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 766 | Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean); | 768 | Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean); |
| 767 | if (!violations.isEmpty()) { | 769 | if (!violations.isEmpty()) { |
| 768 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 770 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 769 | - // StringBuilder errorMsg = new StringBuilder(); | 771 | + // StringBuilder errorMsg = new StringBuilder(); |
| 770 | for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) { | 772 | for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) { |
| 771 | - // errorMsg.append(violation.getMessage()).append(";"); | 773 | + // errorMsg.append(violation.getMessage()).append(";"); |
| 772 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 774 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 773 | "第[{}]条数据:"+violation.getMessage() | 775 | "第[{}]条数据:"+violation.getMessage() |
| 774 | ), rowNum); | 776 | ), rowNum); |