Commit 2b712b8d93020eed7c563b9ac44b8f0d16190079

Authored by 戈灵虎
2 parents 54a328ba 68c7e7df

Merge remote-tracking branch 'origin/master'

Showing 16 changed files with 212 additions and 58 deletions
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/util/validation/ValidationUtils.java
... ... @@ -18,8 +18,9 @@ import java.util.regex.Pattern;
18 18 */
19 19 public class ValidationUtils {
20 20  
21   - private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$");
22   -
  21 + //private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$");
  22 + //add by wq 20260327 手机号码校验覆盖全号段
  23 + private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:\\+86|0086)?1[3-9]\\d{9}$");
23 24 private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
24 25  
25 26 private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*");
... ... @@ -51,5 +52,4 @@ public class ValidationUtils {
51 52 throw new ConstraintViolationException(constraintViolations);
52 53 }
53 54 }
54   -
55 55 }
... ...
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/material/MaterialInventoryOutDto.java
... ... @@ -17,6 +17,9 @@ public class MaterialInventoryOutDto {
17 17 @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713")
18 18 private Long id;
19 19  
  20 + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
  21 + private Long inventoryId;
  22 +
20 23 @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541")
21 24 @NotNull(message = "物料ID不能为空")
22 25 private Long materialId;
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/CostFeeController.java
... ... @@ -5,16 +5,24 @@ import com.zteits.urbanops.framework.excel.core.util.ExcelUtils;
5 5 import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.WaterFeeImport;
6 6 import com.zteits.urbanops.module.garden.enums.TemplateEnum;
7 7 import com.zteits.urbanops.module.garden.service.costfee.CostFeeService;
  8 +import com.zteits.urbanops.module.system.api.dept.DeptApi;
  9 +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
8 10 import io.swagger.v3.oas.annotations.Operation;
9 11 import io.swagger.v3.oas.annotations.tags.Tag;
  12 +import jakarta.annotation.security.PermitAll;
10 13 import jakarta.servlet.http.HttpServletResponse;
11 14 import lombok.AllArgsConstructor;
12 15 import lombok.Data;
13 16 import lombok.extern.slf4j.Slf4j;
  17 +import org.apache.poi.ss.usermodel.*;
  18 +import org.apache.poi.ss.util.CellRangeAddressList;
  19 +import org.apache.poi.xssf.usermodel.XSSFWorkbook;
14 20 import org.springframework.beans.factory.annotation.Autowired;
15 21 import org.springframework.beans.factory.annotation.Value;
16   -import org.springframework.core.io.ClassPathResource;
  22 +import org.springframework.core.io.Resource;
  23 +import org.springframework.core.io.ResourceLoader;
17 24 import org.springframework.util.CollectionUtils;
  25 +import org.springframework.util.StringUtils;
18 26 import org.springframework.web.bind.annotation.*;
19 27 import org.springframework.web.multipart.MultipartFile;
20 28  
... ... @@ -23,7 +31,6 @@ import java.io.InputStream;
23 31 import java.io.OutputStream;
24 32 import java.lang.reflect.Method;
25 33 import java.net.URLEncoder;
26   -import java.nio.charset.StandardCharsets;
27 34 import java.util.*;
28 35  
29 36 import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
... ... @@ -49,6 +56,12 @@ public class CostFeeController{
49 56 @Value("${static.resource.server.enable}")
50 57 private Boolean staticResourceServerenable;
51 58  
  59 + @Autowired
  60 + private ResourceLoader resourceLoader;
  61 +
  62 + @jakarta.annotation.Resource
  63 + private DeptApi deptApi;
  64 +
52 65 // Excel文件校验相关
53 66 private static final List<String> ALLOWED_EXCEL_SUFFIX = Arrays.asList(".xlsx", ".xlsm");
54 67 private static final String EXCEL_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
... ... @@ -59,6 +72,7 @@ public class CostFeeController{
59 72 */
60 73 @GetMapping("/get-import-template")
61 74 @Operation(summary = "获得导入用户模板")
  75 + @PermitAll
62 76 public void importTemplate(HttpServletResponse response,
63 77 @RequestParam("templateName") String templateName) throws IOException {
64 78 // 参数校验
... ... @@ -74,29 +88,150 @@ public class CostFeeController{
74 88 return;
75 89 }
76 90  
77   - if (staticResourceServerenable) {
78   - // 构建完整的静态服务器URL(确保路径正确)
79   - String serverUrl = staticResourceServerUrl;
80   - if (serverUrl != null && !serverUrl.endsWith("/")) {
81   - serverUrl += "/"; // 确保URL以/结尾,避免拼接错误
82   - }
  91 + writeAndModifyTemplate(response, template.getName(), template.getStartIndex());
  92 + }
  93 +
  94 + private void writeAndModifyTemplate(HttpServletResponse response,
  95 + String downloadFileName,
  96 + int startIndexRow) throws IOException {
  97 +
  98 + // 拼接模板路径
  99 + String serverUrl = staticResourceServerUrl;
  100 + if (serverUrl != null && !serverUrl.endsWith("/")) {
  101 + serverUrl += "/";
  102 + }
  103 + String fullPath = serverUrl + downloadFileName;
  104 + fullPath = fullPath.replace("\\", "/");
  105 +
  106 + Resource resource = resourceLoader.getResource(fullPath);
  107 +
  108 + // 检查文件是否存在
  109 + if (!resource.exists()) {
  110 + response.sendError(HttpServletResponse.SC_NOT_FOUND, "模板文件不存在");
  111 + return;
  112 + }
  113 +
  114 + // 设置下载响应头
  115 + response.reset();
  116 + response.setContentType(EXCEL_MIME_TYPE);
  117 + // response.setCharacterEncoding("UTF-8");
  118 + String encodedName = URLEncoder.encode(downloadFileName, "UTF-8");
  119 + // 标准文件名编码(Chrome / Edge / Firefox 全兼容)
  120 + response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName);
  121 + // 浏览器缓存配置(必须)
  122 + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
  123 + response.setHeader("Pragma", "no-cache");
  124 + response.setHeader("Expires", "0");
  125 +
  126 +
  127 + try (InputStream in = resource.getInputStream();
  128 + XSSFWorkbook workbook = new XSSFWorkbook(in);
  129 + OutputStream out = response.getOutputStream()) {
83 130  
84   - String encodedFileName = URLEncoder.encode(template.getName().split("\\.")[0], StandardCharsets.UTF_8.name());
  131 + Sheet sheet = workbook.getSheetAt(0);
85 132  
86   - String templateFileName = encodedFileName + "." + template.getName().split("\\.")[1];
  133 + // ==============================================
  134 + // 获取最新单位列表
  135 + // ==============================================
  136 + List<DeptRespDTO> companyList = deptApi.getSubDeptList();
  137 + List<String> newUnits = companyList.stream()
  138 + .map(DeptRespDTO::getName)
  139 + .filter(Objects::nonNull)
  140 + .toList();
87 141  
88   - String templateUrl = serverUrl + templateFileName; // 包含templates目录
  142 + log.info("加载到单位列表:{},共{}条", newUnits, newUnits.size());
89 143  
90   - // 方式1:重定向到静态资源服务器
91   - response.sendRedirect(templateUrl);
92   - } else {
93   - String templateFileName = templateName + "." + template.getName().split("\\.")[1];
  144 + // ==============================================
  145 + // 生成新下拉 + 自动赋值
  146 + // ==============================================
  147 + createDropdownAndSetValue(sheet, newUnits, startIndexRow);
  148 +
  149 + // 写入并强制刷新
  150 + workbook.write(out);
  151 + out.flush();
94 152  
95   - // 写入模板文件到响应
96   - writeTemplateToResponse(response, template.getName(), templateFileName);
  153 + } catch (Exception e) {
  154 + log.error("模板处理失败", e);
  155 + throw new IOException("文件处理失败", e);
97 156 }
98 157 }
99 158  
  159 + /**
  160 + * 创建下拉框 + 给单元格赋值
  161 + */
  162 + private void createDropdownAndSetValue(Sheet sheet, List<String> options, int startRow) {
  163 + if (options.isEmpty()) {
  164 + log.error("下拉选项为空,不创建");
  165 + return;
  166 + }
  167 +
  168 + // 获取表头行
  169 + Row headerRow = sheet.getRow(startRow - 1);
  170 + if (headerRow == null) {
  171 + log.error("表头行不存在:{}", startRow - 1);
  172 + return;
  173 + }
  174 +
  175 + // 查找“所属单位”列
  176 + int targetCol = -1;
  177 + for (Cell cell : headerRow) {
  178 + if (cell != null && cell.getCellType() == CellType.STRING) {
  179 + String val = cell.getStringCellValue().trim();
  180 + if (val.contains("所属单位") || val.contains("所属公司") ) {
  181 + targetCol = cell.getColumnIndex();
  182 + break;
  183 + }
  184 + }
  185 + }
  186 +
  187 + if (targetCol == -1) {
  188 + log.error("未找到【所属单位】列表头");
  189 + return;
  190 + }
  191 +
  192 + // 取消列隐藏
  193 + sheet.setColumnHidden(targetCol, false);
  194 +
  195 + // ==============================================
  196 + // 遍历行:清空原有内容 + 设置默认值
  197 + // ==============================================
  198 + int endRow = 100;
  199 + for (int r = startRow; r <= endRow; r++) {
  200 + Row row = sheet.getRow(r);
  201 + if (row == null) {
  202 + row = sheet.createRow(r);
  203 + }
  204 +
  205 + Cell cell = row.getCell(targetCol);
  206 + if (cell == null) {
  207 + cell = row.createCell(targetCol);
  208 + }
  209 + String unit = cell.getStringCellValue();
  210 + // 默认赋值【第一个单位】,你可以根据业务改成其他值
  211 + if (!StringUtils.isEmpty(unit)) {
  212 + cell.setCellValue(options.get(0));
  213 + }
  214 + }
  215 +
  216 + // ==============================================
  217 + // 创建下拉框(作用范围:startRow ~ 1000行)
  218 + // ==============================================
  219 + CellRangeAddressList regions = new CellRangeAddressList(startRow, endRow, targetCol, targetCol);
  220 + DataValidationHelper helper = sheet.getDataValidationHelper();
  221 + DataValidationConstraint constraint = helper.createExplicitListConstraint(
  222 + options.toArray(new String[0])
  223 + );
  224 + DataValidation validation = helper.createValidation(constraint, regions);
  225 + // 下拉框基础配置
  226 + validation.setEmptyCellAllowed(true);
  227 + validation.setSuppressDropDownArrow(true); // 显示箭头
  228 + validation.setShowErrorBox(true);
  229 + validation.setShowPromptBox(true); // 启用点击弹出提示
  230 + sheet.addValidationData(validation);
  231 +
  232 + log.info("【成功】为列{}添加下拉并赋值,行{}~{},选项数:{}",
  233 + targetCol, startRow, endRow, options.size());
  234 + }
100 235  
101 236 /**
102 237 * Excel文件上传预览
... ... @@ -214,31 +349,6 @@ public class CostFeeController{
214 349 }
215 350  
216 351 /**
217   - * 写入模板文件到响应流
218   - */
219   - private void writeTemplateToResponse(HttpServletResponse response, String filename, String templatePath) throws IOException {
220   - // 设置响应头
221   - response.setContentType(EXCEL_MIME_TYPE);
222   - response.setCharacterEncoding("UTF-8");
223   - String encodedFileName = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
224   - response.setHeader("Content-Disposition", "attachment;filename=" + encodedFileName);
225   - response.setHeader("Cache-Control", "no-store"); // 禁止缓存
226   -
227   - // 读取模板文件并写入响应
228   - try (InputStream in = new ClassPathResource("template/" + templatePath).getInputStream();
229   - OutputStream out = response.getOutputStream()) {
230   -
231   - byte[] buffer = new byte[4096];
232   - int bytesRead;
233   - while ((bytesRead = in.read(buffer)) != -1) {
234   - out.write(buffer, 0, bytesRead);
235   - }
236   - out.flush();
237   - }
238   - }
239   -
240   -
241   - /**
242 352 * 校验Excel文件有效性(后缀+MIME类型)
243 353 */
244 354 private boolean isValidExcelFile(MultipartFile file) {
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/convert/AppGardenWorkOrderConvert.java
... ... @@ -24,7 +24,7 @@ public interface AppGardenWorkOrderConvert {
24 24 orderReqVO.setPressingType(2);//紧急
25 25 orderReqVO.setOrderName(inspectionPlanDO.getPlanName());
26 26 orderReqVO.setSourceId(1);//来源ID 工单来源 1、巡查
27   - orderReqVO.setSourceName("园林巡查上报");
  27 + orderReqVO.setSourceName("巡查上报");
28 28 orderReqVO.setThirdWorkNo(planNo);
29 29 orderReqVO.setOrderType("C");
30 30 orderReqVO.setPressingType(createReqVO.getPressingType());
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
... ... @@ -87,9 +87,11 @@ public interface ErrorCodeConstants {
87 87 ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误");
88 88 ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-007, "道路对应类型已存在记录");
89 89 ErrorCode INSPECTION_PLAN_NOT_ALLOW_DELETE = new ErrorCode(1-100-007-005, "计划已开始执行不能删除");
  90 + ErrorCode INSPECTION_COMMIT_PLAN__EXISTS = new ErrorCode(1-100-007-005, "巡检计划明细已提交");
90 91  
91 92 // ========== 养护计划汇总 TODO 补充编号 ==========
92 93 ErrorCode MAINTAIN_PLAN_NOT_EXISTS = new ErrorCode(1-100-007-001, "养护计划汇总不存在");
  94 + ErrorCode MAINTAIN_COMMIT_PLAN__EXISTS = new ErrorCode(1-100-007-007, "养护计划明细已提交");
93 95  
94 96 //========== 频次 TODO 补充编号 ==========
95 97 ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-100-007-001, "养护频次已存在");
... ...
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 206 log.info("数据列表为空,跳过插入操作");
207 207 return;
208 208 }
  209 + //总公司
  210 + DeptRespDTO deptRespDTO = deptApi.getDept(getCompanyId());
209 211 //单位集合
210 212 List<DeptRespDTO> companyList = deptApi.getSubDeptList();
211 213 // 1. 预加载部门映射(循环外加载,避免重复查询)
... ... @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService {
220 222 ));
221 223  
222 224  
223   - // 模板类型校验
  225 + // 模板类型校验
224 226 Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch
225 227 // 根据不同模板类型执行不同的处理逻辑
226 228 if (WaterFeeImport.class.isAssignableFrom(importClass)) {
... ... @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService {
239 241 WaterFeeDO fee = new WaterFeeDO();
240 242 BeanUtils.copyProperties(importObj, fee);
241 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 246 } else {
245 247 // 设置单位id
246 248 fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId())));
... ... @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService {
612 614 Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean);
613 615 if (!violations.isEmpty()) {
614 616 // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”)
615   - // StringBuilder errorMsg = new StringBuilder();
  617 + // StringBuilder errorMsg = new StringBuilder();
616 618 for (ConstraintViolation<WaterFeeImport> violation : violations) {
617 619 //errorMsg.append(violation.getMessage()).append(";");
618 620 throw exception0(BAD_REQUEST.getCode() ,String.format(
... ... @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService {
644 646 // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”)
645 647 //StringBuilder errorMsg = new StringBuilder();
646 648 for (ConstraintViolation<PersonalCostImport> violation : violations) {
647   - // errorMsg.append(violation.getMessage()).append(";");
  649 + // errorMsg.append(violation.getMessage()).append(";");
648 650 throw exception0(BAD_REQUEST.getCode() ,String.format(
649 651 "第[{}]条数据:"+ violation.getMessage()
650 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 657 Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName());
656 658 //单位校验
... ... @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService {
766 768 Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean);
767 769 if (!violations.isEmpty()) {
768 770 // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”)
769   - // StringBuilder errorMsg = new StringBuilder();
  771 + // StringBuilder errorMsg = new StringBuilder();
770 772 for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) {
771   - // errorMsg.append(violation.getMessage()).append(";");
  773 + // errorMsg.append(violation.getMessage()).append(";");
772 774 throw exception0(BAD_REQUEST.getCode() ,String.format(
773 775 "第[{}]条数据:"+violation.getMessage()
774 776 ), rowNum);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java
... ... @@ -18,6 +18,7 @@ import com.zteits.urbanops.module.garden.convert.AppGardenWorkOrderConvert;
18 18 import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanCommitDO;
19 19 import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO;
20 20 import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO;
  21 +import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanCommitDO;
21 22 import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO;
22 23 import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanCommitMapper;
23 24 import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper;
... ... @@ -43,7 +44,7 @@ import java.util.*;
43 44 import java.util.stream.Collectors;
44 45  
45 46 import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
46   -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.INSPECTION_PLAN_NOT_EXISTS;
  47 +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*;
47 48  
48 49  
49 50 /**
... ... @@ -76,6 +77,10 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ
76 77  
77 78 @Override
78 79 public Long createInspectionPlanCommit(InspectionPlanCommitSaveReqVO createReqVO) {
  80 + List<InspectionPlanCommitDO> list = inspectionPlanCommitMapper.selectList(InspectionPlanCommitDO::getPlanNo, createReqVO.getPlanNo());
  81 + if(!CollectionUtils.isEmpty(list)){
  82 + throw exception(INSPECTION_COMMIT_PLAN__EXISTS);
  83 + }
79 84 // 插入
80 85 InspectionPlanCommitDO inspectionPlanCommit = BeanUtils.toBean(createReqVO, InspectionPlanCommitDO.class);
81 86 inspectionPlanCommitMapper.insert(inspectionPlanCommit);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 6 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
7 7 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
8 8 import com.baomidou.mybatisplus.core.metadata.IPage;
  9 +import com.zteits.urbanops.framework.common.exception.ErrorCode;
9 10 import com.zteits.urbanops.framework.common.pojo.CommonResult;
10 11 import com.zteits.urbanops.framework.common.pojo.PageResult;
11 12 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
... ... @@ -89,6 +90,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
89 90 @Transactional(rollbackFor = Exception.class)
90 91 @Override
91 92 public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) {
  93 + createReqVO.getRoadListReqVO().forEach(road -> {
  94 + if (road.getDeptId() == null || road.getRoadId() == 0L) {
  95 + ErrorCode errorCode = new ErrorCode(INSPECTION_PLAN_NOT_EXISTS.getCode(), road.getRoadName()+"未配置部门信息,请在道路管理界面配置班组");
  96 + throw exception(errorCode);
  97 + }
  98 + });
92 99 //存在性校验
93 100 validateInspectionPlanExists(createReqVO);
94 101 LocalDateTime now = LocalDateTime.now();
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanCommitServiceImpl.java
... ... @@ -63,6 +63,10 @@ public class MaintainPlanCommitServiceImpl implements MaintainPlanCommitService
63 63  
64 64 @Override
65 65 public Long createMaintainPlanCommit(MaintainPlanCommitSaveReqVO createReqVO) {
  66 + List<MaintainPlanCommitDO> list = maintainPlanCommitMapper.selectList(MaintainPlanCommitDO::getPlanNo, createReqVO.getPlanNo());
  67 + if(!CollectionUtils.isEmpty(list)){
  68 + throw exception(MAINTAIN_PLAN_NOT_EXISTS);
  69 + }
66 70 // 插入
67 71 MaintainPlanCommitDO maintainPlanCommit = BeanUtils.toBean(createReqVO, MaintainPlanCommitDO.class);
68 72 maintainPlanCommitMapper.insert(maintainPlanCommit);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
... ... @@ -6,6 +6,7 @@ import cn.hutool.core.util.RandomUtil;
6 6 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 7 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
8 8 import com.baomidou.mybatisplus.core.metadata.IPage;
  9 +import com.zteits.urbanops.framework.common.exception.ErrorCode;
9 10 import com.zteits.urbanops.framework.common.pojo.CommonResult;
10 11 import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils;
11 12 import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils;
... ... @@ -102,6 +103,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService {
102 103  
103 104 @Override
104 105 public CommonResult<Integer> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) {
  106 + createReqVO.getRoadListReqVO().forEach(road -> {
  107 + if (road.getDeptId() == null || road.getRoadId() == 0L) {
  108 + ErrorCode errorCode = new ErrorCode(INSPECTION_PLAN_NOT_EXISTS.getCode(), road.getRoadName() + "未配置部门信息,请在道路管理界面配置班组");
  109 + throw exception(errorCode);
  110 + }
  111 + });
105 112 //存在性校验
106 113 validateMaintainPlanExists(createReqVO);
107 114 LocalDateTime now = LocalDateTime.now();
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryout/MaterialInventoryOutServiceImpl.java
... ... @@ -15,6 +15,7 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi;
15 15 import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
16 16 import jakarta.annotation.Resource;
17 17 import org.apache.commons.collections4.CollectionUtils;
  18 +import org.apache.commons.lang3.StringUtils;
18 19 import org.springframework.stereotype.Service;
19 20 import org.springframework.transaction.annotation.Transactional;
20 21 import org.springframework.validation.annotation.Validated;
... ... @@ -55,6 +56,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
55 56 if(null == material){
56 57 throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId");
57 58 }
  59 +
58 60 MaterialInventoryDO materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId());
59 61 if(null == materialInventory){
60 62 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存");
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/materialdetail/vo/MaterialDetailSaveReqVO.java
... ... @@ -79,4 +79,7 @@ public class MaterialDetailSaveReqVO {
79 79 @Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "规格")
80 80 @NotEmpty(message = "规格不能为空")
81 81 private String specifications;
  82 +
  83 + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
  84 + private Long inventoryId;
82 85 }
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/BusiLineTeamLeaderRoleCodeEnum.java
... ... @@ -25,6 +25,10 @@ public enum BusiLineTeamLeaderRoleCodeEnum { // 注意:枚举类必须用enum
25 25 ROLECODE_WY("wy", "team_leader_wy"),
26 26 /** 市政业务线-角色编码 */
27 27 ROLECODE_SZ("sz", "team_leader_sz"),
  28 + /** 秩序管理业务线-角色编码 */
  29 + ROLECODE_ZX("zx", "team_leader_zxgl"),
  30 + /** 环境卫生业务线-角色编码 */
  31 + ROLECODE_HJ("hj", "team_leader_hjws"),
28 32 /** 园林业务线-角色编码 */
29 33 ROLECODE_YL("yl", "team_leader_yl"); // 最后一个常量必须以分号结尾
30 34  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/BusiLineWorkerRoleCodeEnum.java
... ... @@ -25,6 +25,10 @@ public enum BusiLineWorkerRoleCodeEnum {
25 25 ROLECODE_WORKER_WY("wy", "wy_worker"),
26 26 /** 市政业务线-角色编码 */
27 27 ROLECODE_WORKER_SZ("sz", "sz_worker"),
  28 + /** 环境卫生业务线-角色编码 */
  29 + ROLECODE_HJ("hj", "hjws_worker"),
  30 + /** 秩序管理业务线-角色编码 */
  31 + ROLECODE_ZX("zx", "zxgl_worker"),
28 32 /** 园林业务线-角色编码 */
29 33 ROLECODE_WORKER_YL("yl", "yl_worker"); // 最后一个常量必须以分号结尾
30 34  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/materialdetail/MaterialDetailServiceImpl.java
... ... @@ -133,12 +133,13 @@ public class MaterialDetailServiceImpl implements MaterialDetailService {
133 133 // }
134 134 // }
135 135 //耗材出库
136   - for (MaterialDetailDO materialDetailDO : materialDetailList) {
  136 + for (MaterialDetailSaveReqVO materialDetailDO : createReqVO) {
137 137 MaterialInventoryOutDto outDto = new MaterialInventoryOutDto();
138 138 outDto.setMaterialId(materialDetailDO.getMaterialId());
139 139 outDto.setMaterialName(materialDetailDO.getMaterialName());
140   - outDto.setOutInventoryNum(materialDetailDO.getUserCount());
  140 + outDto.setOutInventoryNum(Long.valueOf(materialDetailDO.getUserCount()));
141 141 outDto.setOutDate(LocalDateTime.now());
  142 + outDto.setInventoryId(materialDetailDO.getInventoryId());
142 143 materialApi.createMaterialInventoryOut(outDto);
143 144 }
144 145 //保存耗材
... ...
urbanops-server/src/main/resources/application-dev.yaml
... ... @@ -251,7 +251,7 @@ wechat:
251 251 tokenUrl: https://api.weixin.qq.com/cgi-bin/stable_token
252 252 sendUrl: https://api.weixin.qq.com/cgi-bin/message/template/send
253 253 siot:
254   - roadUrl: https://iot.jichengshanshui.com.cn:28202/prod-api/fence/fenceInfo/getFenceRoadListByLocation
  254 + roadUrl: https://test.jichengshanshui.com.cn:28202/prod-api/fence/fenceInfo/getFenceRoadListByLocation
255 255  
256 256 # 高德地图配置
257 257 amap:
... ...