Commit 64e8ec415ae2865c2b3f0fb1e3eec08335eec835
Merge remote-tracking branch 'origin/dev' into dev
Showing
36 changed files
with
688 additions
and
795 deletions
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/util/ExcelUtils.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/CostFeeController.java
| ... | ... | @@ -6,6 +6,7 @@ import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.WaterFeeImp |
| 6 | 6 | import com.zteits.urbanops.module.garden.enums.TemplateEnum; |
| 7 | 7 | import com.zteits.urbanops.module.garden.service.costfee.CostFeeService; |
| 8 | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | 10 | import jakarta.servlet.http.HttpServletResponse; |
| 10 | 11 | import lombok.AllArgsConstructor; |
| 11 | 12 | import lombok.Data; |
| ... | ... | @@ -32,6 +33,7 @@ import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 32 | 33 | * 人机材公共处理控制器 |
| 33 | 34 | * 处理Excel导入预览、提交等功能 |
| 34 | 35 | */ |
| 36 | +@Tag(name = "管理后台 - 人机材批量导入") | |
| 35 | 37 | @RestController |
| 36 | 38 | @RequestMapping("/costfee") |
| 37 | 39 | @Slf4j |
| ... | ... | @@ -100,6 +102,7 @@ public class CostFeeController{ |
| 100 | 102 | * Excel文件上传预览 |
| 101 | 103 | */ |
| 102 | 104 | @PostMapping("/preview") |
| 105 | + @Operation(summary = "文件上传") | |
| 103 | 106 | public CommonResult previewExcel(@RequestParam("file") MultipartFile file, |
| 104 | 107 | @RequestParam("templateName") String templateName) { |
| 105 | 108 | // 基础参数校验 |
| ... | ... | @@ -145,6 +148,7 @@ public class CostFeeController{ |
| 145 | 148 | * 分页获取预览数据 |
| 146 | 149 | */ |
| 147 | 150 | @GetMapping("/preview-data") |
| 151 | + @Operation(summary = "批量上传分页预览") | |
| 148 | 152 | public CommonResult getPreviewData(@RequestParam("batchId") String batchId, |
| 149 | 153 | @RequestParam("templateName") String templateName, |
| 150 | 154 | @RequestParam(value = "page", defaultValue = "1") int page, |
| ... | ... | @@ -186,6 +190,7 @@ public class CostFeeController{ |
| 186 | 190 | * 提交导入数据到数据库 |
| 187 | 191 | */ |
| 188 | 192 | @PostMapping("/submit") |
| 193 | + @Operation(summary = "批次保存") | |
| 189 | 194 | public CommonResult submitImport(@RequestParam("batchId") String batchId, |
| 190 | 195 | @RequestParam("templateName") String templateName, |
| 191 | 196 | @RequestParam("operator") String operator) { | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/TeamBizdomainRelVo.java renamed to urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/TeamBizdomainRelVo.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import lombok.*; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import lombok.Data; | |
| 7 | 9 | |
| 8 | -import java.time.LocalDate; | |
| 9 | -import java.util.*; | |
| 10 | -import jakarta.validation.constraints.*; | |
| 11 | 10 | import java.math.BigDecimal; |
| 11 | +import java.time.LocalDate; | |
| 12 | +import java.util.List; | |
| 12 | 13 | |
| 13 | 14 | @Schema(description = "管理后台 - 自有机械费用录入新增/修改 Request VO") |
| 14 | 15 | @Data |
| ... | ... | @@ -74,6 +75,6 @@ public class MechanicalCostSaveReqVO { |
| 74 | 75 | private String remark; |
| 75 | 76 | |
| 76 | 77 | @ExcelProperty("班组") |
| 77 | - private List<TeamBizdomainRelDO> teamIds; | |
| 78 | + private List<TeamBizdomainRelVo> teamIds; | |
| 78 | 79 | |
| 79 | 80 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/personalcost/PersonalCostController.java
| ... | ... | @@ -10,10 +10,7 @@ import com.zteits.urbanops.module.garden.controller.admin.personalcost.vo.Person |
| 10 | 10 | import com.zteits.urbanops.module.garden.controller.admin.personalcost.vo.PersonalCostRespVO; |
| 11 | 11 | import com.zteits.urbanops.module.garden.controller.admin.personalcost.vo.PersonalCostSaveReqVO; |
| 12 | 12 | import com.zteits.urbanops.module.garden.dal.dataobject.personalcost.PersonalCostDO; |
| 13 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 14 | -import com.zteits.urbanops.module.garden.enums.CostFeeConstants; | |
| 15 | 13 | import com.zteits.urbanops.module.garden.service.personalcost.PersonalCostService; |
| 16 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 17 | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| 19 | 16 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -26,8 +23,6 @@ import org.springframework.web.bind.annotation.*; |
| 26 | 23 | |
| 27 | 24 | import java.io.IOException; |
| 28 | 25 | import java.util.List; |
| 29 | -import java.util.Objects; | |
| 30 | -import java.util.stream.Collectors; | |
| 31 | 26 | |
| 32 | 27 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| 33 | 28 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/personalcost/vo/PersonalCostSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.personalcost.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import lombok.*; | |
| 7 | -import java.util.*; | |
| 8 | -import jakarta.validation.constraints.*; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import lombok.Data; | |
| 9 | + | |
| 9 | 10 | import java.math.BigDecimal; |
| 11 | +import java.util.List; | |
| 10 | 12 | |
| 11 | 13 | @Schema(description = "管理后台 - 人员费用录入 - 个人费用新增/修改 Request VO") |
| 12 | 14 | @Data |
| ... | ... | @@ -44,6 +46,6 @@ public class PersonalCostSaveReqVO { |
| 44 | 46 | @Schema(description = "备注", example = "随便") |
| 45 | 47 | private String remark; |
| 46 | 48 | @ExcelProperty("班组") |
| 47 | - private List<TeamBizdomainRelDO> teamIds; | |
| 49 | + private List<TeamBizdomainRelVo> teamIds; | |
| 48 | 50 | |
| 49 | 51 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/RentalMechanicalCostController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost; |
| 2 | 2 | |
| 3 | -import com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo.MechanicalCostRespVO; | |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 5 | -import com.zteits.urbanops.module.garden.enums.CostFeeConstants; | |
| 6 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 8 | -import jakarta.annotation.Resource; | |
| 9 | -import org.springframework.validation.annotation.Validated; | |
| 10 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 11 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 12 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | -import io.swagger.v3.oas.annotations.Operation; | |
| 14 | - | |
| 15 | -import jakarta.validation.constraints.*; | |
| 16 | -import jakarta.validation.*; | |
| 17 | -import jakarta.servlet.http.*; | |
| 18 | -import java.util.*; | |
| 19 | -import java.io.IOException; | |
| 20 | -import java.util.stream.Collectors; | |
| 21 | - | |
| 3 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 4 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 22 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 23 | 6 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 24 | -import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 25 | 7 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 26 | -import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 27 | - | |
| 28 | 8 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 29 | - | |
| 30 | -import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 31 | -import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 32 | - | |
| 33 | -import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.*; | |
| 9 | +import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.RentalMechanicalCostPageReqVO; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.RentalMechanicalCostRespVO; | |
| 11 | +import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.RentalMechanicalCostSaveReqVO; | |
| 34 | 12 | import com.zteits.urbanops.module.garden.dal.dataobject.rentalmechanicalcost.RentalMechanicalCostDO; |
| 35 | 13 | import com.zteits.urbanops.module.garden.service.rentalmechanicalcost.RentalMechanicalCostService; |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | +import jakarta.annotation.Resource; | |
| 18 | +import jakarta.servlet.http.HttpServletResponse; | |
| 19 | +import jakarta.validation.Valid; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.io.IOException; | |
| 25 | +import java.util.List; | |
| 26 | + | |
| 27 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 28 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 36 | 29 | |
| 37 | 30 | @Tag(name = "管理后台 - 租赁机械费用录入") |
| 38 | 31 | @RestController | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 5 | -import lombok.*; | |
| 6 | - | |
| 7 | -import java.time.LocalDate; | |
| 8 | -import java.util.*; | |
| 9 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 10 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 11 | -import java.math.BigDecimal; | |
| 6 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import lombok.Data; | |
| 12 | 9 | import org.springframework.format.annotation.DateTimeFormat; |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | +import java.time.LocalDate; | |
| 13 | 13 | import java.time.LocalDateTime; |
| 14 | +import java.util.Date; | |
| 15 | +import java.util.List; | |
| 14 | 16 | |
| 17 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | |
| 15 | 18 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 16 | 19 | |
| 17 | 20 | @Schema(description = "管理后台 - 租赁机械费用录入分页 Request VO") |
| ... | ... | @@ -21,55 +24,14 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 21 | 24 | @Schema(description = "机械名称", example = "张三") |
| 22 | 25 | private String mechName; |
| 23 | 26 | |
| 24 | - @Schema(description = "机械类型", example = "2") | |
| 25 | - private String mechType; | |
| 26 | - | |
| 27 | 27 | @Schema(description = "租赁总价格", example = "316") |
| 28 | - private BigDecimal rentalTotalPrice; | |
| 29 | - | |
| 30 | - @Schema(description = "数量") | |
| 31 | - private Integer quantity; | |
| 32 | - | |
| 33 | - @Schema(description = "车牌号") | |
| 34 | - private String licensePlate; | |
| 35 | - | |
| 36 | - @Schema(description = "车辆类别(如汽油、纯电新能源等)") | |
| 37 | - private String vehicleCategory; | |
| 38 | - | |
| 39 | - @Schema(description = "车辆类型(如大型客车、轻型栏板货车等)", example = "2") | |
| 40 | - private String vehicleType; | |
| 28 | + private BigDecimal[] rentalTotalPrice; | |
| 41 | 29 | |
| 42 | 30 | @Schema(description = "开始使用时间") |
| 43 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 44 | - private LocalDate[] startUseTime; | |
| 31 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 32 | + private Date startUseTime; | |
| 45 | 33 | |
| 46 | 34 | @Schema(description = "使用时长(天)") |
| 47 | 35 | private Integer useDuration; |
| 48 | 36 | |
| 49 | - @Schema(description = "结束使用时间") | |
| 50 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 51 | - private LocalDate[] endUseTime; | |
| 52 | - | |
| 53 | - @Schema(description = "归属公司", example = "李四") | |
| 54 | - private String companyName; | |
| 55 | - | |
| 56 | - @Schema(description = "归属公司ID", example = "25530") | |
| 57 | - private String companyId; | |
| 58 | - | |
| 59 | - @Schema(description = "部门id", example = "25446") | |
| 60 | - private Long deptId; | |
| 61 | - | |
| 62 | - @Schema(description = "道路ID数组(多选)") | |
| 63 | - private String roadIds; | |
| 64 | - | |
| 65 | - @Schema(description = "备注", example = "你说的对") | |
| 66 | - private String remark; | |
| 67 | - | |
| 68 | - @Schema(description = "创建时间") | |
| 69 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 70 | - private LocalDateTime[] createTime; | |
| 71 | - | |
| 72 | - @ExcelProperty("班组") | |
| 73 | - private List<TeamBizdomainRelVo> teamIds; | |
| 74 | - | |
| 75 | 37 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostRespVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo; |
| 2 | 2 | |
| 3 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 4 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | -import lombok.*; | |
| 7 | +import lombok.Data; | |
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | 9 | |
| 7 | -import java.time.LocalDate; | |
| 8 | -import java.util.*; | |
| 9 | 10 | import java.math.BigDecimal; |
| 10 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 11 | +import java.time.LocalDate; | |
| 11 | 12 | import java.time.LocalDateTime; |
| 12 | -import cn.idev.excel.annotation.*; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | |
| 13 | 16 | |
| 14 | 17 | @Schema(description = "管理后台 - 租赁机械费用录入 Response VO") |
| 15 | 18 | @Data | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import lombok.*; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import lombok.Data; | |
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | 10 | |
| 8 | -import java.time.LocalDate; | |
| 9 | -import java.util.*; | |
| 10 | -import jakarta.validation.constraints.*; | |
| 11 | 11 | import java.math.BigDecimal; |
| 12 | +import java.time.LocalDate; | |
| 13 | +import java.util.Date; | |
| 14 | +import java.util.List; | |
| 12 | 15 | |
| 13 | 16 | @Schema(description = "管理后台 - 租赁机械费用录入新增/修改 Request VO") |
| 14 | 17 | @Data |
| ... | ... | @@ -43,14 +46,16 @@ public class RentalMechanicalCostSaveReqVO { |
| 43 | 46 | |
| 44 | 47 | @Schema(description = "开始使用时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 45 | 48 | @NotNull(message = "开始使用时间不能为空") |
| 46 | - private LocalDate startUseTime; | |
| 49 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 50 | + private Date startUseTime; | |
| 47 | 51 | |
| 48 | 52 | @Schema(description = "使用时长(天)") |
| 49 | 53 | private Integer useDuration; |
| 50 | 54 | |
| 51 | 55 | @Schema(description = "结束使用时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 52 | 56 | @NotNull(message = "结束使用时间不能为空") |
| 53 | - private LocalDate endUseTime; | |
| 57 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 58 | + private Date endUseTime; | |
| 54 | 59 | |
| 55 | 60 | @Schema(description = "归属公司", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
| 56 | 61 | @NotEmpty(message = "归属公司不能为空") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/teambizdomainrel/TeamBizdomainRelController.java deleted
| 1 | -package com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | -import jakarta.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | -import io.swagger.v3.oas.annotations.Operation; | |
| 10 | - | |
| 11 | -import jakarta.validation.constraints.*; | |
| 12 | -import jakarta.validation.*; | |
| 13 | -import jakarta.servlet.http.*; | |
| 14 | -import java.util.*; | |
| 15 | -import java.io.IOException; | |
| 16 | - | |
| 17 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | -import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | -import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | -import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | - | |
| 23 | -import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | - | |
| 25 | -import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | -import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | - | |
| 28 | -import com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo.*; | |
| 29 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 30 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 31 | - | |
| 32 | -@Tag(name = "管理后台 - 班组关联") | |
| 33 | -@RestController | |
| 34 | -@RequestMapping("/garden/team-bizdomain-rel") | |
| 35 | -@Validated | |
| 36 | -public class TeamBizdomainRelController { | |
| 37 | - | |
| 38 | - @Resource | |
| 39 | - private TeamBizdomainRelService teamBizdomainRelService; | |
| 40 | - | |
| 41 | - @PostMapping("/create") | |
| 42 | - @Operation(summary = "创建班组关联") | |
| 43 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:create')") | |
| 44 | - public CommonResult<Long> createTeamBizdomainRel(@Valid @RequestBody TeamBizdomainRelSaveReqVO createReqVO) { | |
| 45 | - return success(teamBizdomainRelService.createTeamBizdomainRel(createReqVO)); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @PutMapping("/update") | |
| 49 | - @Operation(summary = "更新班组关联") | |
| 50 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:update')") | |
| 51 | - public CommonResult<Boolean> updateTeamBizdomainRel(@Valid @RequestBody TeamBizdomainRelSaveReqVO updateReqVO) { | |
| 52 | - teamBizdomainRelService.updateTeamBizdomainRel(updateReqVO); | |
| 53 | - return success(true); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @DeleteMapping("/delete") | |
| 57 | - @Operation(summary = "删除班组关联") | |
| 58 | - @Parameter(name = "id", description = "编号", required = true) | |
| 59 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:delete')") | |
| 60 | - public CommonResult<Boolean> deleteTeamBizdomainRel(@RequestParam("id") Long id) { | |
| 61 | - teamBizdomainRelService.deleteTeamBizdomainRel(id); | |
| 62 | - return success(true); | |
| 63 | - } | |
| 64 | - | |
| 65 | - @DeleteMapping("/delete-list") | |
| 66 | - @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | - @Operation(summary = "批量删除班组关联") | |
| 68 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:delete')") | |
| 69 | - public CommonResult<Boolean> deleteTeamBizdomainRelList(@RequestParam("ids") List<Long> ids) { | |
| 70 | - teamBizdomainRelService.deleteTeamBizdomainRelListByIds(ids); | |
| 71 | - return success(true); | |
| 72 | - } | |
| 73 | - | |
| 74 | - @GetMapping("/get") | |
| 75 | - @Operation(summary = "获得班组关联") | |
| 76 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:query')") | |
| 78 | - public CommonResult<TeamBizdomainRelRespVO> getTeamBizdomainRel(@RequestParam("id") Long id) { | |
| 79 | - TeamBizdomainRelDO teamBizdomainRel = teamBizdomainRelService.getTeamBizdomainRel(id); | |
| 80 | - return success(BeanUtils.toBean(teamBizdomainRel, TeamBizdomainRelRespVO.class)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @GetMapping("/page") | |
| 84 | - @Operation(summary = "获得班组关联分页") | |
| 85 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:query')") | |
| 86 | - public CommonResult<PageResult<TeamBizdomainRelRespVO>> getTeamBizdomainRelPage(@Valid TeamBizdomainRelPageReqVO pageReqVO) { | |
| 87 | - PageResult<TeamBizdomainRelDO> pageResult = teamBizdomainRelService.getTeamBizdomainRelPage(pageReqVO); | |
| 88 | - return success(BeanUtils.toBean(pageResult, TeamBizdomainRelRespVO.class)); | |
| 89 | - } | |
| 90 | - | |
| 91 | - @GetMapping("/export-excel") | |
| 92 | - @Operation(summary = "导出班组关联 Excel") | |
| 93 | - @PreAuthorize("@ss.hasPermission('garden:team-bizdomain-rel:export')") | |
| 94 | - @ApiAccessLog(operateType = EXPORT) | |
| 95 | - public void exportTeamBizdomainRelExcel(@Valid TeamBizdomainRelPageReqVO pageReqVO, | |
| 96 | - HttpServletResponse response) throws IOException { | |
| 97 | - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | - List<TeamBizdomainRelDO> list = teamBizdomainRelService.getTeamBizdomainRelPage(pageReqVO).getList(); | |
| 99 | - // 导出 Excel | |
| 100 | - ExcelUtils.write(response, "班组关联.xls", "数据", TeamBizdomainRelRespVO.class, | |
| 101 | - BeanUtils.toBean(list, TeamBizdomainRelRespVO.class)); | |
| 102 | - } | |
| 103 | - | |
| 104 | -} | |
| 105 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/teambizdomainrel/vo/TeamBizdomainRelPageReqVO.java deleted
| 1 | -package com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | -import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@Schema(description = "管理后台 - 班组关联分页 Request VO") | |
| 13 | -@Data | |
| 14 | -public class TeamBizdomainRelPageReqVO extends PageParam { | |
| 15 | - | |
| 16 | - @Schema(description = "业务表主键", example = "4740") | |
| 17 | - private String busiId; | |
| 18 | - | |
| 19 | - @Schema(description = "班组编码", example = "27533") | |
| 20 | - private String teamId; | |
| 21 | - | |
| 22 | - @Schema(description = "班组名称", example = "王五") | |
| 23 | - private String teamName; | |
| 24 | - | |
| 25 | - @Schema(description = "班组名称") | |
| 26 | - private Long weight; | |
| 27 | - | |
| 28 | - @Schema(description = "归属公司", example = "张三") | |
| 29 | - private String companyName; | |
| 30 | - | |
| 31 | - @Schema(description = "归属公司ID", example = "29798") | |
| 32 | - private String companyId; | |
| 33 | - | |
| 34 | - @Schema(description = "创建时间") | |
| 35 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 36 | - private LocalDateTime[] createTime; | |
| 37 | - | |
| 38 | - @Schema(description = "业务类型", example = "1") | |
| 39 | - private String busiType; | |
| 40 | - | |
| 41 | -} | |
| 42 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/teambizdomainrel/vo/TeamBizdomainRelRespVO.java deleted
| 1 | -package com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import cn.idev.excel.annotation.*; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 班组关联 Response VO") | |
| 11 | -@Data | |
| 12 | -@ExcelIgnoreUnannotated | |
| 13 | -public class TeamBizdomainRelRespVO { | |
| 14 | - | |
| 15 | - @Schema(description = "记录ID,自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14177") | |
| 16 | - @ExcelProperty("记录ID,自增主键") | |
| 17 | - private Long id; | |
| 18 | - | |
| 19 | - @Schema(description = "业务表主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4740") | |
| 20 | - @ExcelProperty("业务表主键") | |
| 21 | - private String busiId; | |
| 22 | - | |
| 23 | - @Schema(description = "班组编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "27533") | |
| 24 | - @ExcelProperty("班组编码") | |
| 25 | - private String teamId; | |
| 26 | - | |
| 27 | - @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | |
| 28 | - @ExcelProperty("班组名称") | |
| 29 | - private String teamName; | |
| 30 | - | |
| 31 | - @Schema(description = "班组名称") | |
| 32 | - @ExcelProperty("班组名称") | |
| 33 | - private Long weight; | |
| 34 | - | |
| 35 | - @Schema(description = "归属公司", example = "张三") | |
| 36 | - @ExcelProperty("归属公司") | |
| 37 | - private String companyName; | |
| 38 | - | |
| 39 | - @Schema(description = "归属公司ID", example = "29798") | |
| 40 | - @ExcelProperty("归属公司ID") | |
| 41 | - private String companyId; | |
| 42 | - | |
| 43 | - @Schema(description = "创建时间") | |
| 44 | - @ExcelProperty("创建时间") | |
| 45 | - private LocalDateTime createTime; | |
| 46 | - | |
| 47 | - @Schema(description = "业务类型", example = "1") | |
| 48 | - @ExcelProperty("业务类型") | |
| 49 | - private String busiType; | |
| 50 | - | |
| 51 | -} | |
| 52 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/teambizdomainrel/vo/TeamBizdomainRelSaveReqVO.java deleted
| 1 | -package com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import jakarta.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 班组关联新增/修改 Request VO") | |
| 9 | -@Data | |
| 10 | -public class TeamBizdomainRelSaveReqVO { | |
| 11 | - | |
| 12 | - @Schema(description = "记录ID,自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14177") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | - @Schema(description = "业务表主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4740") | |
| 16 | - @NotEmpty(message = "业务表主键不能为空") | |
| 17 | - private String busiId; | |
| 18 | - | |
| 19 | - @Schema(description = "班组编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "27533") | |
| 20 | - @NotEmpty(message = "班组编码不能为空") | |
| 21 | - private String teamId; | |
| 22 | - | |
| 23 | - @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | |
| 24 | - @NotEmpty(message = "班组名称不能为空") | |
| 25 | - private String teamName; | |
| 26 | - | |
| 27 | - @Schema(description = "班组名称") | |
| 28 | - private Long weight; | |
| 29 | - | |
| 30 | - @Schema(description = "归属公司", example = "张三") | |
| 31 | - private String companyName; | |
| 32 | - | |
| 33 | - @Schema(description = "归属公司ID", example = "29798") | |
| 34 | - private String companyId; | |
| 35 | - | |
| 36 | - @Schema(description = "业务类型", example = "1") | |
| 37 | - private String busiType; | |
| 38 | - | |
| 39 | -} | |
| 40 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/wasterecord/vo/WasteRecordSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.wasterecord.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import lombok.*; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import lombok.Data; | |
| 7 | 9 | |
| 8 | -import java.time.LocalDate; | |
| 9 | -import java.util.*; | |
| 10 | -import jakarta.validation.constraints.*; | |
| 11 | 10 | import java.math.BigDecimal; |
| 11 | +import java.time.LocalDate; | |
| 12 | +import java.util.List; | |
| 12 | 13 | |
| 13 | 14 | @Schema(description = "管理后台 - 园林废弃物录入新增/修改 Request VO") |
| 14 | 15 | @Data |
| ... | ... | @@ -59,5 +60,5 @@ public class WasteRecordSaveReqVO { |
| 59 | 60 | private String remark; |
| 60 | 61 | |
| 61 | 62 | @ExcelProperty("班组") |
| 62 | - private List<TeamBizdomainRelDO> teamIds; | |
| 63 | + private List<TeamBizdomainRelVo> teamIds; | |
| 63 | 64 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/rentalmechanicalcost/RentalMechanicalCostDO.java
| ... | ... | @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| 8 | 8 | import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; |
| 9 | -import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.TeamBizdomainRelVo; | |
| 9 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 10 | 10 | import lombok.*; |
| 11 | 11 | |
| 12 | 12 | import java.math.BigDecimal; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/teambizdomainrel/TeamBizdomainRelDO.java deleted
| 1 | -package com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | -import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 班组关联 DO | |
| 12 | - * | |
| 13 | - * @author 超级管理员 | |
| 14 | - */ | |
| 15 | -@TableName("garden_team_bizdomain_rel") | |
| 16 | -@KeySequence("garden_team_bizdomain_rel_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class TeamBizdomainRelDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 记录ID,自增主键 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Long id; | |
| 30 | - /** | |
| 31 | - * 业务表主键 | |
| 32 | - */ | |
| 33 | - private String busiId; | |
| 34 | - /** | |
| 35 | - * 班组编码 | |
| 36 | - */ | |
| 37 | - private String teamId; | |
| 38 | - /** | |
| 39 | - * 班组名称 | |
| 40 | - */ | |
| 41 | - private String teamName; | |
| 42 | - /** | |
| 43 | - * 班组名称 | |
| 44 | - */ | |
| 45 | - private Long weight; | |
| 46 | - /** | |
| 47 | - * 归属公司 | |
| 48 | - */ | |
| 49 | - private String companyName; | |
| 50 | - /** | |
| 51 | - * 归属公司ID | |
| 52 | - */ | |
| 53 | - private String companyId; | |
| 54 | - /** | |
| 55 | - * 业务类型 | |
| 56 | - */ | |
| 57 | - private String busiType; | |
| 58 | - | |
| 59 | - | |
| 60 | -} | |
| 61 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/departmentcost/DepartmentCostMapper.java
| ... | ... | @@ -31,5 +31,12 @@ public interface DepartmentCostMapper extends BaseMapperX<DepartmentCostDO> { |
| 31 | 31 | .betweenIfPresent(DepartmentCostDO::getCreateTime, reqVO.getCreateTime()) |
| 32 | 32 | .orderByDesc(DepartmentCostDO::getId)); |
| 33 | 33 | } |
| 34 | + /** | |
| 35 | + * 批量查询重复数据 | |
| 36 | + * | |
| 37 | + * @param keyList 部门信息集合 | |
| 38 | + * @return 结果 | |
| 39 | + */ | |
| 40 | + public List<Long> selectDuplicateIds(List<DepartmentCostDO> keyList); | |
| 34 | 41 | |
| 35 | -} | |
| 36 | 42 | \ No newline at end of file |
| 43 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/mechanicalcost/MechanicalCostMapper.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/personalcost/PersonalCostMapper.java
| ... | ... | @@ -32,4 +32,13 @@ public interface PersonalCostMapper extends BaseMapperX<PersonalCostDO> { |
| 32 | 32 | .orderByDesc(PersonalCostDO::getId)); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -} | |
| 36 | 35 | \ No newline at end of file |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 批量查询重复数据 | |
| 39 | + * | |
| 40 | + * @param keyList 人员费用信息集合 | |
| 41 | + * @return 结果 | |
| 42 | + */ | |
| 43 | + public List<Long> selectDuplicateIds(List<PersonalCostDO> keyList); | |
| 44 | + | |
| 45 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/rentalmechanicalcost/RentalMechanicalCostMapper.java
| ... | ... | @@ -20,23 +20,23 @@ public interface RentalMechanicalCostMapper extends BaseMapperX<RentalMechanical |
| 20 | 20 | default PageResult<RentalMechanicalCostDO> selectPage(RentalMechanicalCostPageReqVO reqVO) { |
| 21 | 21 | return selectPage(reqVO, new LambdaQueryWrapperX<RentalMechanicalCostDO>() |
| 22 | 22 | .likeIfPresent(RentalMechanicalCostDO::getMechName, reqVO.getMechName()) |
| 23 | - .eqIfPresent(RentalMechanicalCostDO::getMechType, reqVO.getMechType()) | |
| 24 | - .eqIfPresent(RentalMechanicalCostDO::getRentalTotalPrice, reqVO.getRentalTotalPrice()) | |
| 25 | - .eqIfPresent(RentalMechanicalCostDO::getQuantity, reqVO.getQuantity()) | |
| 26 | - .eqIfPresent(RentalMechanicalCostDO::getLicensePlate, reqVO.getLicensePlate()) | |
| 27 | - .eqIfPresent(RentalMechanicalCostDO::getVehicleCategory, reqVO.getVehicleCategory()) | |
| 28 | - .eqIfPresent(RentalMechanicalCostDO::getVehicleType, reqVO.getVehicleType()) | |
| 29 | - .betweenIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 23 | + //.eqIfPresent(RentalMechanicalCostDO::getMechType, reqVO.getMechType()) | |
| 24 | + .betweenIfPresent(RentalMechanicalCostDO::getRentalTotalPrice, reqVO.getRentalTotalPrice()) | |
| 25 | + //.eqIfPresent(RentalMechanicalCostDO::getQuantity, reqVO.getQuantity()) | |
| 26 | + //.eqIfPresent(RentalMechanicalCostDO::getLicensePlate, reqVO.getLicensePlate()) | |
| 27 | + //.eqIfPresent(RentalMechanicalCostDO::getVehicleCategory, reqVO.getVehicleCategory()) | |
| 28 | + // .eqIfPresent(RentalMechanicalCostDO::getVehicleType, reqVO.getVehicleType()) | |
| 29 | + //.betweenIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 30 | + .eqIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 30 | 31 | .eqIfPresent(RentalMechanicalCostDO::getUseDuration, reqVO.getUseDuration()) |
| 31 | - .betweenIfPresent(RentalMechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 32 | - .likeIfPresent(RentalMechanicalCostDO::getCompanyName, reqVO.getCompanyName()) | |
| 33 | - .eqIfPresent(RentalMechanicalCostDO::getCompanyId, reqVO.getCompanyId()) | |
| 34 | - .eqIfPresent(RentalMechanicalCostDO::getDeptId, reqVO.getDeptId()) | |
| 35 | - .eqIfPresent(RentalMechanicalCostDO::getTeamIds, reqVO.getTeamIds()) | |
| 36 | - .eqIfPresent(RentalMechanicalCostDO::getRoadIds, reqVO.getRoadIds()) | |
| 37 | - .eqIfPresent(RentalMechanicalCostDO::getRemark, reqVO.getRemark()) | |
| 38 | - .betweenIfPresent(RentalMechanicalCostDO::getCreateTime, reqVO.getCreateTime()) | |
| 32 | + //.betweenIfPresent(RentalMechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 33 | + //.likeIfPresent(RentalMechanicalCostDO::getCompanyName, reqVO.getCompanyName()) | |
| 34 | + //.eqIfPresent(RentalMechanicalCostDO::getCompanyId, reqVO.getCompanyId()) | |
| 35 | + //.eqIfPresent(RentalMechanicalCostDO::getDeptId, reqVO.getDeptId()) | |
| 36 | + //.eqIfPresent(RentalMechanicalCostDO::getRoadIds, reqVO.getRoadIds()) | |
| 37 | + ///.//eqIfPresent(RentalMechanicalCostDO::getRemark, reqVO.getRemark()) | |
| 38 | + //.betweenIfPresent(RentalMechanicalCostDO::getCreateTime, reqVO.getCreateTime()) | |
| 39 | 39 | .orderByDesc(RentalMechanicalCostDO::getId)); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -} | |
| 43 | 42 | \ No newline at end of file |
| 43 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/teambizdomainrel/TeamBizdomainRelMapper.java deleted
| 1 | -package com.zteits.urbanops.module.garden.dal.mysql.teambizdomainrel; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 6 | -import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 班组关联 Mapper | |
| 14 | - * | |
| 15 | - * @author 超级管理员 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface TeamBizdomainRelMapper extends BaseMapperX<TeamBizdomainRelDO> { | |
| 19 | - | |
| 20 | - default PageResult<TeamBizdomainRelDO> selectPage(TeamBizdomainRelPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<TeamBizdomainRelDO>() | |
| 22 | - .eqIfPresent(TeamBizdomainRelDO::getBusiId, reqVO.getBusiId()) | |
| 23 | - .eqIfPresent(TeamBizdomainRelDO::getTeamId, reqVO.getTeamId()) | |
| 24 | - .likeIfPresent(TeamBizdomainRelDO::getTeamName, reqVO.getTeamName()) | |
| 25 | - .eqIfPresent(TeamBizdomainRelDO::getWeight, reqVO.getWeight()) | |
| 26 | - .likeIfPresent(TeamBizdomainRelDO::getCompanyName, reqVO.getCompanyName()) | |
| 27 | - .eqIfPresent(TeamBizdomainRelDO::getCompanyId, reqVO.getCompanyId()) | |
| 28 | - .betweenIfPresent(TeamBizdomainRelDO::getCreateTime, reqVO.getCreateTime()) | |
| 29 | - .eqIfPresent(TeamBizdomainRelDO::getBusiType, reqVO.getBusiType()) | |
| 30 | - .orderByDesc(TeamBizdomainRelDO::getId)); | |
| 31 | - } | |
| 32 | - | |
| 33 | -} | |
| 34 | 0 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/waterfee/WaterFeeMapper.java
| ... | ... | @@ -32,4 +32,12 @@ public interface WaterFeeMapper extends BaseMapperX<WaterFeeDO> { |
| 32 | 32 | .orderByDesc(WaterFeeDO::getId)); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -} | |
| 36 | 35 | \ No newline at end of file |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 批量查询重复数据 | |
| 39 | + * | |
| 40 | + * @param keyList 水费录入信息集合 | |
| 41 | + * @return 结果 | |
| 42 | + */ | |
| 43 | + public List<Long> selectDuplicateIds(List<WaterFeeDO> keyList); | |
| 44 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/TemplateEnum.java
| ... | ... | @@ -7,6 +7,9 @@ import lombok.Getter; |
| 7 | 7 | import java.util.HashMap; |
| 8 | 8 | import java.util.Map; |
| 9 | 9 | |
| 10 | +import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | |
| 11 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0; | |
| 12 | + | |
| 10 | 13 | /** |
| 11 | 14 | * Excel导入模板枚举 |
| 12 | 15 | * 存储模板编码、名称、起始行索引及对应的数据导入类 |
| ... | ... | @@ -29,35 +32,35 @@ public enum TemplateEnum { |
| 29 | 32 | 2, |
| 30 | 33 | PersonalCostImport.class, |
| 31 | 34 | true // 新增默认值 |
| 35 | + ), | |
| 36 | + COSTFEE_DEPARTMENT( | |
| 37 | + "costFee_department", | |
| 38 | + "综合费用导入模板.xlsx", | |
| 39 | + 2, | |
| 40 | + DepartmentCostImport.class, | |
| 41 | + true // 新增默认值 | |
| 42 | + ), | |
| 43 | + COSTFEE_GARDENWASTE( | |
| 44 | + "costFee_gardenWaste", | |
| 45 | + "园林废弃物费用导入模板.xlsx", | |
| 46 | + 2, | |
| 47 | + GardenWasteRecordImport.class, | |
| 48 | + true // 新增默认值 | |
| 49 | + ), | |
| 50 | + COSTFEE_MECHANICAL( | |
| 51 | + "costFee_mechanical", | |
| 52 | + "自有机械费用导入模板.xlsx", | |
| 53 | + 2, | |
| 54 | + MechanicalCostImport.class, | |
| 55 | + true // 新增默认值 | |
| 56 | + ), | |
| 57 | + COSTFEE_RENTALMECHANICAL( | |
| 58 | + "costFee_rentalmechanical", | |
| 59 | + "租赁机械费用导入模板.xlsx", | |
| 60 | + 2, | |
| 61 | + RentalMechanicalCostImport.class, | |
| 62 | + true // 新增默认值 | |
| 32 | 63 | ); |
| 33 | -// COSTFEE_DEPARTMENT( | |
| 34 | -// "costFee_department", | |
| 35 | -// "综合费用导入模板.xlsx", | |
| 36 | -// 1, | |
| 37 | -// DepartmentCostImport.class, | |
| 38 | -// true // 新增默认值 | |
| 39 | -// ), | |
| 40 | -// COSTFEE_GARDENWASTE( | |
| 41 | -// "costFee_gardenWaste", | |
| 42 | -// "园林废弃物费用导入模板.xlsx", | |
| 43 | -// 1, | |
| 44 | -// GardenWasteRecordImport.class, | |
| 45 | -// true // 新增默认值 | |
| 46 | -// ), | |
| 47 | -// COSTFEE_MECHANICAL( | |
| 48 | -// "costFee_mechanical", | |
| 49 | -// "自有机械费用导入模板.xlsx", | |
| 50 | -// 1, | |
| 51 | -// MechanicalCostImport.class, | |
| 52 | -// true // 新增默认值 | |
| 53 | -// ), | |
| 54 | -// COSTFEE_RENTALMECHANICAL( | |
| 55 | -// "costFee_rentalmechanical", | |
| 56 | -// "租赁机械费用导入模板.xlsx", | |
| 57 | -// 1, | |
| 58 | -// RentalMechanicalCostImport.class, | |
| 59 | -// true // 新增默认值 | |
| 60 | -// ); | |
| 61 | 64 | |
| 62 | 65 | // 模板编码(前端传递的标识) |
| 63 | 66 | private final String code; |
| ... | ... | @@ -86,12 +89,12 @@ public enum TemplateEnum { |
| 86 | 89 | public static TemplateEnum getByCode(String code) { |
| 87 | 90 | // 空值校验 |
| 88 | 91 | if (code == null || code.trim().isEmpty()) { |
| 89 | - throw new RuntimeException("模板编码不能为空"); | |
| 92 | + throw exception0(BAD_REQUEST.getCode(),"模板编码不能为空"); | |
| 90 | 93 | } |
| 91 | 94 | // 从缓存获取,避免循环遍历 |
| 92 | 95 | TemplateEnum template = CODE_MAP.get(code); |
| 93 | 96 | if (template == null) { |
| 94 | - throw new RuntimeException("无效的模板编码:" + code); | |
| 97 | + throw exception0(BAD_REQUEST.getCode(),"无效的模板编码"+code); | |
| 95 | 98 | } |
| 96 | 99 | return template; |
| 97 | 100 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/costfee/CostFeeServiceImpl.java
| ... | ... | @@ -5,6 +5,18 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
| 5 | 5 | import com.zteits.urbanops.framework.security.core.LoginUser; |
| 6 | 6 | import com.zteits.urbanops.module.garden.controller.admin.costfee.CostFeeController; |
| 7 | 7 | import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.*; |
| 8 | +import com.zteits.urbanops.module.garden.dal.dataobject.departmentcost.DepartmentCostDO; | |
| 9 | +import com.zteits.urbanops.module.garden.dal.dataobject.mechanicalcost.MechanicalCostDO; | |
| 10 | +import com.zteits.urbanops.module.garden.dal.dataobject.personalcost.PersonalCostDO; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.rentalmechanicalcost.RentalMechanicalCostDO; | |
| 12 | +import com.zteits.urbanops.module.garden.dal.dataobject.wasterecord.WasteRecordDO; | |
| 13 | +import com.zteits.urbanops.module.garden.dal.dataobject.waterfee.WaterFeeDO; | |
| 14 | +import com.zteits.urbanops.module.garden.dal.mysql.departmentcost.DepartmentCostMapper; | |
| 15 | +import com.zteits.urbanops.module.garden.dal.mysql.mechanicalcost.MechanicalCostMapper; | |
| 16 | +import com.zteits.urbanops.module.garden.dal.mysql.personalcost.PersonalCostMapper; | |
| 17 | +import com.zteits.urbanops.module.garden.dal.mysql.rentalmechanicalcost.RentalMechanicalCostMapper; | |
| 18 | +import com.zteits.urbanops.module.garden.dal.mysql.wasterecord.WasteRecordMapper; | |
| 19 | +import com.zteits.urbanops.module.garden.dal.mysql.waterfee.WaterFeeMapper; | |
| 8 | 20 | import com.zteits.urbanops.module.garden.enums.AssignTasksConstants; |
| 9 | 21 | import com.zteits.urbanops.module.garden.enums.CostFeeConstants; |
| 10 | 22 | import com.zteits.urbanops.module.garden.enums.TemplateEnum; |
| ... | ... | @@ -16,6 +28,7 @@ import jakarta.validation.ConstraintViolationException; |
| 16 | 28 | import jakarta.validation.Validator; |
| 17 | 29 | import lombok.extern.slf4j.Slf4j; |
| 18 | 30 | import org.apache.commons.lang3.StringUtils; |
| 31 | +import org.springframework.beans.BeanUtils; | |
| 19 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 33 | import org.springframework.data.redis.core.BoundHashOperations; |
| 21 | 34 | import org.springframework.data.redis.core.RedisTemplate; |
| ... | ... | @@ -24,8 +37,10 @@ import org.springframework.transaction.annotation.Transactional; |
| 24 | 37 | import org.springframework.util.CollectionUtils; |
| 25 | 38 | |
| 26 | 39 | import java.io.IOException; |
| 40 | +import java.time.LocalDate; | |
| 27 | 41 | import java.util.*; |
| 28 | 42 | import java.util.concurrent.TimeUnit; |
| 43 | +import java.util.function.Function; | |
| 29 | 44 | import java.util.stream.Collectors; |
| 30 | 45 | import java.util.stream.IntStream; |
| 31 | 46 | |
| ... | ... | @@ -59,6 +74,20 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 59 | 74 | @Resource |
| 60 | 75 | private DeptApi deptApi; |
| 61 | 76 | |
| 77 | + @Autowired | |
| 78 | + private WaterFeeMapper waterFeeMapper; | |
| 79 | + @Autowired | |
| 80 | + private PersonalCostMapper personalCostMapper; | |
| 81 | + @Autowired | |
| 82 | + private DepartmentCostMapper departmentCostMapper; | |
| 83 | + @Autowired | |
| 84 | + private MechanicalCostMapper mechanicalCostMapper; | |
| 85 | + @Autowired | |
| 86 | + private RentalMechanicalCostMapper rentalMechanicalCostMapper; | |
| 87 | + @Autowired | |
| 88 | + private WasteRecordMapper wasteRecordMapper; | |
| 89 | + | |
| 90 | + | |
| 62 | 91 | @Override |
| 63 | 92 | /** |
| 64 | 93 | * 保存数据到Redis |
| ... | ... | @@ -99,7 +128,7 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 99 | 128 | TemplateEnum template = TemplateEnum.getByCode(templateName); |
| 100 | 129 | Class<?> importClass = template.getImportClass(); |
| 101 | 130 | if (importClass == null) { |
| 102 | - throw exception(COST_FEE_NOT_EXISTS_001); | |
| 131 | + throw exception0(BAD_REQUEST.getCode(),"导入模板配置异常"); | |
| 103 | 132 | } |
| 104 | 133 | |
| 105 | 134 | // 分页参数设置 |
| ... | ... | @@ -118,7 +147,7 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 118 | 147 | if (dataList == null || dataList.isEmpty()) { |
| 119 | 148 | // 首次分页就无数据,抛出异常 |
| 120 | 149 | if (pageNum == 1) { |
| 121 | - throw new IllegalArgumentException("没有可导入的数据或数据已过期"); | |
| 150 | + throw exception0(BAD_REQUEST.getCode(),"没有可导入的数据或数据已过期"); | |
| 122 | 151 | } |
| 123 | 152 | break; |
| 124 | 153 | } |
| ... | ... | @@ -128,7 +157,7 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 128 | 157 | |
| 129 | 158 | // 调用业务服务执行本页数据导入 |
| 130 | 159 | int currentPageCount = dataList.size(); |
| 131 | - //insertData(template, dataList, operator); | |
| 160 | + insertData(template, dataList, operator); | |
| 132 | 161 | totalImported += currentPageCount; |
| 133 | 162 | |
| 134 | 163 | // 打印分页处理日志(可选) |
| ... | ... | @@ -152,6 +181,243 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 152 | 181 | |
| 153 | 182 | return totalImported; |
| 154 | 183 | } |
| 184 | + /** | |
| 185 | + * @Author wangqian | |
| 186 | + * @Description 保存数据 | |
| 187 | + * @Date 2025/7/20 11:30 | |
| 188 | + * @Param template | |
| 189 | + * @param dataList | |
| 190 | + * @param operator | |
| 191 | + * @Return void | |
| 192 | + */ | |
| 193 | + private void insertData(TemplateEnum template, List<?> dataList, String operator) { | |
| 194 | + if (CollectionUtils.isEmpty(dataList)) { | |
| 195 | + log.info("数据列表为空,跳过插入操作"); | |
| 196 | + return; | |
| 197 | + } | |
| 198 | + //单位集合 | |
| 199 | + List<DeptRespDTO> companyList = deptApi.getSubDeptList(); | |
| 200 | + // 1. 预加载部门映射(循环外加载,避免重复查询) | |
| 201 | + List<Long> deptIds = companyList.stream().map(DeptRespDTO::getId).collect(Collectors.toList()); | |
| 202 | + Map<String, Long> nameToCompanyIdMap = CollectionUtils.isEmpty(companyList) ? Map.of() | |
| 203 | + : companyList.stream() | |
| 204 | + // 转 Map:key=companyId,value=companyName;key 冲突时保留最后一个(可调整) | |
| 205 | + .collect(Collectors.toMap( | |
| 206 | + dept -> dept.getName().trim(), // value 映射:取 companyName(去空格) | |
| 207 | + DeptRespDTO::getId, // key 映射:取 companyId | |
| 208 | + (oldValue, newValue) -> newValue | |
| 209 | + )); | |
| 210 | + | |
| 211 | + | |
| 212 | + // 模板类型校验 | |
| 213 | + Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch | |
| 214 | + // 根据不同模板类型执行不同的处理逻辑 | |
| 215 | + if (WaterFeeImport.class.isAssignableFrom(importClass)) { | |
| 216 | + Map<Long, String> companyIdToNamedMap = CollectionUtils.isEmpty(companyList) ? Map.of() | |
| 217 | + : companyList.stream() | |
| 218 | + // 转 Map:key=companyId,value=companyName;key 冲突时保留最后一个(可调整) | |
| 219 | + .collect(Collectors.toMap( | |
| 220 | + DeptRespDTO::getId, // key 映射:取 companyId | |
| 221 | + dept -> dept.getName().trim(), // value 映射:取 companyName(去空格) | |
| 222 | + (oldValue, newValue) -> newValue | |
| 223 | + )); | |
| 224 | + | |
| 225 | + // 处理水费数据 | |
| 226 | + List<WaterFeeDO> feeList = ((List<WaterFeeImport>) dataList).stream() | |
| 227 | + .map(importObj -> { | |
| 228 | + WaterFeeDO fee = new WaterFeeDO(); | |
| 229 | + BeanUtils.copyProperties(importObj, fee); | |
| 230 | + fee.setCompanyId(String.valueOf(getLoginUserDeptId())); | |
| 231 | + if (getLoginUserDeptId() == 100) { | |
| 232 | + fee.setCompanyName("蓟城山水"); | |
| 233 | + } else { | |
| 234 | + // 设置单位id | |
| 235 | + fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(fee.getCompanyId()))); | |
| 236 | + } | |
| 237 | + return fee; | |
| 238 | + }) | |
| 239 | + .collect(Collectors.toMap( | |
| 240 | + // 生成唯一键:feeMonth + 分隔符 + meterCode(避免不同组合拼接后重复) | |
| 241 | + fee -> fee.getFeeMonth() + "_" + fee.getMeterCode(), | |
| 242 | + // 值为对象本身 | |
| 243 | + Function.identity(), | |
| 244 | + // 当键重复时,保留第一个出现的对象(可根据需求改为保留最后一个:(existing, replacement) -> replacement) | |
| 245 | + (existing, replacement) -> replacement | |
| 246 | + )) | |
| 247 | + .values() | |
| 248 | + .stream() | |
| 249 | + .collect(Collectors.toList()); | |
| 250 | + | |
| 251 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 252 | + //查询重复项,进行删除 | |
| 253 | + List<Long> ids = waterFeeMapper.selectDuplicateIds(feeList); | |
| 254 | + if (!CollectionUtils.isEmpty(ids)) { | |
| 255 | + waterFeeMapper.deleteByIds(ids); | |
| 256 | + } | |
| 257 | + // 调用批量插入方法 | |
| 258 | + waterFeeMapper.insertBatch(feeList); | |
| 259 | + } | |
| 260 | + log.info("成功插入 {} 条水费数据", feeList.size()); | |
| 261 | + } else if (PersonalCostImport.class.isAssignableFrom(importClass)) { | |
| 262 | + //去重 | |
| 263 | + dataList = personalFeeReplacement((List<PersonalCostImport>) dataList); | |
| 264 | + //获取班组对象 | |
| 265 | + Map<String, Long> teamIdMap = this.getDeptListAll(deptIds); | |
| 266 | + | |
| 267 | + // 3. 转换导入数据为PersonalCost列表(Stream优化+空指针防护) | |
| 268 | + List<PersonalCostImport> feeList = (List<PersonalCostImport>)dataList; | |
| 269 | + List<PersonalCostDO> saveFeeList = new ArrayList<>(CollectionUtils.isEmpty(feeList) ? 0 : feeList.size()); | |
| 270 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 271 | + for (PersonalCostImport importObj : feeList) { | |
| 272 | + PersonalCostDO fee = new PersonalCostDO(); | |
| 273 | + BeanUtils.copyProperties(importObj, fee); | |
| 274 | + // 设置单位id | |
| 275 | + fee.setCompanyId(String.valueOf(nameToCompanyIdMap.get(fee.getCompanyName()))); | |
| 276 | + //设置班组id | |
| 277 | + fee.setDeptId(getDeptList(teamIdMap, importObj.getTeamIds())); | |
| 278 | + saveFeeList.add(fee); | |
| 279 | + } | |
| 280 | + } | |
| 281 | + // 4. 处理重复数据(删除+插入原子性) | |
| 282 | + if (!feeList.isEmpty()) { | |
| 283 | + // 4.1 查询并删除重复项 | |
| 284 | + | |
| 285 | +// List<Long> duplicateIds = personalCostMapper.selectDuplicateIds(saveFeeList); | |
| 286 | +// if (!duplicateIds.isEmpty()) { | |
| 287 | +// personalCostMapper.deleteByIds(duplicateIds); | |
| 288 | +// } | |
| 289 | + | |
| 290 | + // 4.2 批量插入主表 | |
| 291 | + personalCostMapper.insertBatch(saveFeeList); | |
| 292 | + } | |
| 293 | + log.info("成功插入 {} 人员费用数据", dataList.size()); | |
| 294 | + } else if (DepartmentCostImport.class.isAssignableFrom(importClass)) { | |
| 295 | + //去重 | |
| 296 | + dataList = deptFeeReplacement((List<DepartmentCostImport>)dataList); | |
| 297 | + List<DepartmentCostDO> feeList = ((List<DepartmentCostImport>) dataList).stream() | |
| 298 | + .map(importObj -> { | |
| 299 | + DepartmentCostDO fee = new DepartmentCostDO(); | |
| 300 | + BeanUtils.copyProperties(importObj, fee); | |
| 301 | + // 设置单位id | |
| 302 | + fee.setCompanyId(String.valueOf(nameToCompanyIdMap.get(fee.getCompanyName()))); | |
| 303 | + return fee; | |
| 304 | + }) | |
| 305 | + .collect(Collectors.toList()); | |
| 306 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 307 | + //查询重复项,进行删除 | |
| 308 | + List<Long> ids = departmentCostMapper.selectDuplicateIds(feeList); | |
| 309 | + if (!CollectionUtils.isEmpty(ids)) { | |
| 310 | + departmentCostMapper.deleteByIds(ids); | |
| 311 | + } | |
| 312 | + // 调用批量插入方法 | |
| 313 | + departmentCostMapper.insertBatch(feeList); | |
| 314 | + } | |
| 315 | + log.info("成功插入 {} 综合费用数据", feeList.size()); | |
| 316 | + } else if (MechanicalCostImport.class.isAssignableFrom(importClass)) { | |
| 317 | + List<MechanicalCostImport> feeList = (List<MechanicalCostImport>) dataList; | |
| 318 | + List<MechanicalCostDO> saveFeeList = new ArrayList<>(CollectionUtils.isEmpty(feeList) ? 0 : feeList.size()); | |
| 319 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 320 | + //获取班组对象 | |
| 321 | + Map<String, Long> teamIdMap = this.getDeptListAll(deptIds); | |
| 322 | + for (MechanicalCostImport importObj : feeList) { | |
| 323 | + MechanicalCostDO fee = new MechanicalCostDO(); | |
| 324 | + BeanUtils.copyProperties(importObj, fee); | |
| 325 | + // 设置单位id | |
| 326 | + fee.setCompanyId(String.valueOf(nameToCompanyIdMap.get(fee.getCompanyName()))); | |
| 327 | + //设置班组id | |
| 328 | + fee.setDeptId(getDeptList(teamIdMap, importObj.getTeamIds())); | |
| 329 | + // 3.3 计算结束时间(空指针防护) | |
| 330 | + Optional.ofNullable(fee.getStartUseTime()) | |
| 331 | + .ifPresent(startTime -> { | |
| 332 | + int useDuration = Optional.ofNullable(fee.getServiceLife()) | |
| 333 | + .map(Math::toIntExact) // 处理可能的溢出 | |
| 334 | + .orElse(0); | |
| 335 | + fee.setEndUseTime(this.getEndLocalDateForYears(startTime, useDuration)); | |
| 336 | + }); | |
| 337 | + | |
| 338 | + saveFeeList.add(fee); | |
| 339 | + } | |
| 340 | + } | |
| 341 | + // 4. 批量插入主表(空集合直接跳过) | |
| 342 | + if (!feeList.isEmpty()) { | |
| 343 | + //查询重复项,进行删除 | |
| 344 | + List<Long> ids = mechanicalCostMapper.selectDuplicateIds(saveFeeList); | |
| 345 | + if (!CollectionUtils.isEmpty(ids)) { | |
| 346 | + mechanicalCostMapper.deleteByIds(ids); | |
| 347 | + } | |
| 348 | + mechanicalCostMapper.insertBatch(saveFeeList); | |
| 349 | + } | |
| 350 | + log.info("成功插入 {} 自有机械费用数据", dataList.size()); | |
| 351 | + } else if (RentalMechanicalCostImport.class.isAssignableFrom(importClass)) { | |
| 352 | + List<RentalMechanicalCostImport> feeList = (List<RentalMechanicalCostImport>)dataList; | |
| 353 | + List<RentalMechanicalCostDO> saveFeeList = new ArrayList<>(CollectionUtils.isEmpty(feeList) ? 0 : feeList.size()); | |
| 354 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 355 | + //获取班组对象 | |
| 356 | + Map<String, Long> teamIdMap = this.getDeptListAll(deptIds); | |
| 357 | + for (RentalMechanicalCostImport importObj : feeList) { | |
| 358 | + RentalMechanicalCostDO fee = new RentalMechanicalCostDO(); | |
| 359 | + BeanUtils.copyProperties(importObj, fee); | |
| 360 | + // 设置单位id | |
| 361 | + fee.setCompanyId(String.valueOf(nameToCompanyIdMap.get(fee.getCompanyName()))); | |
| 362 | + //设置班组id | |
| 363 | + List<TeamBizdomainRelVo> teamRels = new ArrayList<>(); | |
| 364 | + String teamIdsStr = StringUtils.defaultString(importObj.getTeamIds()).replace(",", ","); | |
| 365 | + String weightsStr = StringUtils.defaultString(importObj.getWeight()).replace(",", ","); | |
| 366 | + | |
| 367 | + String[] teamIds = teamIdsStr.split(","); | |
| 368 | + String[] weights = weightsStr.split(","); | |
| 369 | + for (int i = 0; i < teamIds.length; i++) { | |
| 370 | + TeamBizdomainRelVo rel = new TeamBizdomainRelVo(); | |
| 371 | + rel.setTeamName(teamIds[i].trim()); | |
| 372 | + // 提前处理部门ID映射(复用deptMap) | |
| 373 | + rel.setTeamId(Optional.ofNullable(teamIdMap.get(teamIds[i].trim())).map(String::valueOf).orElse(null)); | |
| 374 | + rel.setWeight(Long.valueOf(weights[i].trim())); | |
| 375 | + teamRels.add(rel); | |
| 376 | + } | |
| 377 | + fee.setTeamIds(teamRels); | |
| 378 | + | |
| 379 | + // 3.3 计算结束时间(空指针防护) | |
| 380 | + Optional.ofNullable(fee.getStartUseTime()) | |
| 381 | + .ifPresent(startTime -> { | |
| 382 | + int useDuration = Optional.ofNullable(fee.getUseDuration()) | |
| 383 | + .map(Math::toIntExact) // 处理可能的溢出 | |
| 384 | + .orElse(0); | |
| 385 | + fee.setEndUseTime(getEndLocalDateForYears(startTime, useDuration)); | |
| 386 | + }); | |
| 387 | + | |
| 388 | + saveFeeList.add(fee); | |
| 389 | + } | |
| 390 | + } | |
| 391 | + if (!feeList.isEmpty()) { | |
| 392 | + rentalMechanicalCostMapper.insertBatch(saveFeeList); | |
| 393 | + } | |
| 394 | + log.info("成功插入 {} 租赁机械费用数据", dataList.size()); | |
| 395 | + } else if (GardenWasteRecordImport.class.isAssignableFrom(importClass)) { | |
| 396 | + //获取班组对象 | |
| 397 | + List<GardenWasteRecordImport> feeList = (List<GardenWasteRecordImport>)dataList; | |
| 398 | + List<WasteRecordDO> saveFeeList = new ArrayList<>(CollectionUtils.isEmpty(feeList) ? 0 : feeList.size()); | |
| 399 | + if (!CollectionUtils.isEmpty(feeList)) { | |
| 400 | + Map<String, Long> teamIdMap = this.getDeptListAll(deptIds); | |
| 401 | + for (GardenWasteRecordImport importObj : feeList) { | |
| 402 | + WasteRecordDO fee = new WasteRecordDO(); | |
| 403 | + BeanUtils.copyProperties(importObj, fee); | |
| 404 | + // 设置单位id | |
| 405 | + fee.setCompanyId(String.valueOf(nameToCompanyIdMap.get(fee.getCompanyName()))); | |
| 406 | + //设置班组id | |
| 407 | + fee.setDeptId(getDeptList(teamIdMap, importObj.getTeamIds())); | |
| 408 | + | |
| 409 | + saveFeeList.add(fee); | |
| 410 | + } | |
| 411 | + } | |
| 412 | + // 4. 批量插入主表(若主表插入失败,事务回滚) | |
| 413 | + if (!feeList.isEmpty()) { | |
| 414 | + wasteRecordMapper.insertBatch(saveFeeList); | |
| 415 | + } | |
| 416 | + | |
| 417 | + log.info("成功插入 {} 园林废弃物费用数据", dataList.size()); | |
| 418 | + } | |
| 419 | + | |
| 420 | + } | |
| 155 | 421 | |
| 156 | 422 | /** |
| 157 | 423 | * 从Redis获取分页数据 |
| ... | ... | @@ -309,6 +575,11 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 309 | 575 | // 抛出包含行号和所有错误的异常 |
| 310 | 576 | // throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); |
| 311 | 577 | } |
| 578 | + Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); | |
| 579 | + //单位校验 | |
| 580 | + validatecompany(rowNum, importBean.getCompanyName(), companyId, deptId); | |
| 581 | + //部门名称校验 | |
| 582 | + validateTeams(rowNum, deptList.get(companyId), importBean.getTeamIds()); | |
| 312 | 583 | |
| 313 | 584 | } catch (ConstraintViolationException ex) { |
| 314 | 585 | // 5. 包装异常,明确行号 + 真实校验错误( |
| ... | ... | @@ -339,7 +610,11 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 339 | 610 | // 抛出包含行号和所有错误的异常 |
| 340 | 611 | //throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); |
| 341 | 612 | } |
| 342 | - | |
| 613 | + Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); | |
| 614 | + //单位校验 | |
| 615 | + validatecompany(rowNum, importBean.getCompanyName(), companyId, deptId); | |
| 616 | + //部门名称校验 | |
| 617 | + validateTeams(rowNum, deptList.get(companyId), importBean.getTeamIds()); | |
| 343 | 618 | |
| 344 | 619 | } catch (ConstraintViolationException ex) { |
| 345 | 620 | throw exception0(BAD_REQUEST.getCode(), String.format("第%d条数据校验失败:%s", rowNum, ex.getMessage()), ex); |
| ... | ... | @@ -475,7 +750,9 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 475 | 750 | //throw new ConstraintViolationException(errorMsg.toString().trim(), violations); |
| 476 | 751 | } |
| 477 | 752 | |
| 478 | - | |
| 753 | + Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); | |
| 754 | + //单位校验 | |
| 755 | + validatecompany(rowNum, importBean.getCompanyName(), companyId, deptId); | |
| 479 | 756 | } catch (ConstraintViolationException ex) { |
| 480 | 757 | // 5. 包装异常,明确行号 + 真实校验错误( |
| 481 | 758 | throw exception0(BAD_REQUEST.getCode(), String.format("第%d条数据校验失败:%s", rowNum, ex.getMessage()), ex); |
| ... | ... | @@ -501,30 +778,32 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 501 | 778 | } |
| 502 | 779 | } |
| 503 | 780 | private void validateTeams(int rowNum, List<String> dept, String teamIds) { |
| 504 | - String[] teamNames = teamIds.split(","); | |
| 505 | - Set<String> checkedTeams = new HashSet<>(); // 用于存储已校验的团队名称,检测重复 | |
| 506 | - | |
| 507 | - for (String teamName : teamNames) { | |
| 508 | - String trimmedTeamName = teamName.trim(); // 处理前后空格 | |
| 781 | + if (StringUtils.isNotEmpty(teamIds)) { | |
| 782 | + String[] teamNames = teamIds.split(","); | |
| 783 | + Set<String> checkedTeams = new HashSet<>(); // 用于存储已校验的团队名称,检测重复 | |
| 784 | + | |
| 785 | + for (String teamName : teamNames) { | |
| 786 | + String trimmedTeamName = teamName.trim(); // 处理前后空格 | |
| 787 | + | |
| 788 | + // 重复校验:如果Set中已存在该团队名称,说明重复 | |
| 789 | + if (checkedTeams.contains(trimmedTeamName)) { | |
| 790 | + throw exception0(BAD_REQUEST.getCode(), String.format( | |
| 791 | + "第%d条数据:%s名称重复", | |
| 792 | + rowNum, teamName | |
| 793 | + )); | |
| 794 | + } | |
| 509 | 795 | |
| 510 | - // 重复校验:如果Set中已存在该团队名称,说明重复 | |
| 511 | - if (checkedTeams.contains(trimmedTeamName)) { | |
| 512 | - throw exception0(BAD_REQUEST.getCode(), String.format( | |
| 513 | - "第%d条数据:%s名称重复", | |
| 514 | - rowNum, teamName | |
| 515 | - )); | |
| 516 | - } | |
| 796 | + // 存在性校验:检查团队是否在dept中存在 | |
| 797 | + if (!dept.contains(trimmedTeamName)) { | |
| 798 | + throw exception0(BAD_REQUEST.getCode(), String.format( | |
| 799 | + "第%d条数据:%s名称不正确", | |
| 800 | + rowNum, teamName | |
| 801 | + )); | |
| 802 | + } | |
| 517 | 803 | |
| 518 | - // 存在性校验:检查团队是否在dept中存在 | |
| 519 | - if (!dept.contains(trimmedTeamName)) { | |
| 520 | - throw exception0(BAD_REQUEST.getCode(), String.format( | |
| 521 | - "第%d条数据:%s名称不正确", | |
| 522 | - rowNum, teamName | |
| 523 | - )); | |
| 804 | + // 将校验通过的团队名称加入Set,用于后续重复判断 | |
| 805 | + checkedTeams.add(trimmedTeamName); | |
| 524 | 806 | } |
| 525 | - | |
| 526 | - // 将校验通过的团队名称加入Set,用于后续重复判断 | |
| 527 | - checkedTeams.add(trimmedTeamName); | |
| 528 | 807 | } |
| 529 | 808 | } |
| 530 | 809 | |
| ... | ... | @@ -538,4 +817,167 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 538 | 817 | } |
| 539 | 818 | return listMap; |
| 540 | 819 | } |
| 820 | + | |
| 821 | + /** | |
| 822 | + * 按salaryMonth、expenseName、companyId三个字段去重 | |
| 823 | + * @param costList 原始部门成本列表 | |
| 824 | + * @return 去重后的列表 | |
| 825 | + */ | |
| 826 | + public List<DepartmentCostImport> deptFeeReplacement(List<DepartmentCostImport> costList) { | |
| 827 | + if (costList == null || costList.isEmpty()) { | |
| 828 | + return new ArrayList<>(); | |
| 829 | + } | |
| 830 | + | |
| 831 | + // 1. 以三个字段的组合作为键(使用分隔符避免不同组合产生相同键) | |
| 832 | + // 2. 遇到重复键时保留第一条记录 | |
| 833 | + Map<String, DepartmentCostImport> uniqueMap = costList.stream() | |
| 834 | + .collect(Collectors.toMap( | |
| 835 | + // 生成唯一键:salaryMonth|expenseName|companyId | |
| 836 | + cost -> buildUniqueKey(cost), | |
| 837 | + // 键不存在时存入当前对象 | |
| 838 | + cost -> cost, | |
| 839 | + // 键已存在时保留最后一个 | |
| 840 | + (existing, replacement) -> replacement | |
| 841 | + )); | |
| 842 | + | |
| 843 | + // 将去重后的结果转为List返回 | |
| 844 | + return new ArrayList<>(uniqueMap.values()); | |
| 845 | + } | |
| 846 | + | |
| 847 | + /** | |
| 848 | + * 构建三个字段的唯一组合键(处理null值) | |
| 849 | + */ | |
| 850 | + private String buildUniqueKey(DepartmentCostImport cost) { | |
| 851 | + // 使用Objects.toString处理可能的null值,避免NullPointerException | |
| 852 | + return Objects.toString(cost.getSalaryMonth(), "") + "|" + | |
| 853 | + Objects.toString(cost.getExpenseName(), "") + "|" + | |
| 854 | + Objects.toString(cost.getCompanyName(), ""); | |
| 855 | + } | |
| 856 | + | |
| 857 | + /** | |
| 858 | + * 按salaryMonth、name、companyId、teamIdList四个字段去重 | |
| 859 | + * @param costList 原始个人成本列表 | |
| 860 | + * @return 去重后的列表 | |
| 861 | + */ | |
| 862 | + public List<PersonalCostImport> personalFeeReplacement(List<PersonalCostImport> costList) { | |
| 863 | + if (costList == null || costList.isEmpty()) { | |
| 864 | + return new ArrayList<>(); | |
| 865 | + } | |
| 866 | + | |
| 867 | + // 1. 以四个字段的组合作为键(特别处理集合类型的teamIdList) | |
| 868 | + // 2. 遇到重复键时保留第一条记录 | |
| 869 | + Map<String, PersonalCostImport> uniqueMap = costList.stream() | |
| 870 | + .collect(Collectors.toMap( | |
| 871 | + // 生成唯一键:salaryMonth|name|companyId|teamIdListStr | |
| 872 | + this::buildUniqueKey, | |
| 873 | + // 键不存在时存入当前对象 | |
| 874 | + cost -> cost, | |
| 875 | + // 键已存在时保留第一个对象(可改为replacement保留最后一个) | |
| 876 | + (existing, replacement) -> replacement | |
| 877 | + )); | |
| 878 | + | |
| 879 | + // 将去重后的结果转为List返回 | |
| 880 | + return new ArrayList<>(uniqueMap.values()); | |
| 881 | + } | |
| 882 | + | |
| 883 | + /** | |
| 884 | + * 构建四个字段的唯一组合键(处理null值和集合类型) | |
| 885 | + */ | |
| 886 | + private String buildUniqueKey(PersonalCostImport cost) { | |
| 887 | + // 处理普通字段的null值 | |
| 888 | + String salaryMonth = Objects.toString(cost.getSalaryMonth(), ""); | |
| 889 | + String name = Objects.toString(cost.getName(), ""); | |
| 890 | + String companyId = Objects.toString(cost.getCompanyName(), ""); | |
| 891 | + String teamIds = Objects.toString(cost.getTeamIds(), ""); | |
| 892 | + // 拼接唯一键 | |
| 893 | + return salaryMonth + "|" + name + "|" + companyId + "|" + teamIds; | |
| 894 | + } | |
| 895 | + | |
| 896 | + | |
| 897 | + public static LocalDate getEndLocalDateForYears(LocalDate startDate, int years) { | |
| 898 | + if (startDate == null) { | |
| 899 | + throw new IllegalArgumentException("开始日期不能为null"); | |
| 900 | + } | |
| 901 | + if (years < 0) { | |
| 902 | + throw new IllegalArgumentException("年数不能为负数"); | |
| 903 | + } | |
| 904 | + return startDate.plusYears(years); | |
| 905 | + } | |
| 906 | + | |
| 907 | + /** | |
| 908 | + * @Author wangqian | |
| 909 | + * @Description 根据班组名称获取班组id | |
| 910 | + * @Date 2025/11/26 19:38 | |
| 911 | + */ | |
| 912 | + /** | |
| 913 | + * 根据部门ID列表获取「部门名称→部门ID」的映射(含空值防护) | |
| 914 | + */ | |
| 915 | + private Map<String, Long> getDeptListAll(List<Long> deptIds) { | |
| 916 | + Map<String, Long> deptNameMap = new HashMap<>(); | |
| 917 | + | |
| 918 | + // 1. 空值安全:避免 deptIds 为 null/空列表导致 NPE | |
| 919 | + if (CollectionUtils.isEmpty(deptIds)) { | |
| 920 | + return deptNameMap; | |
| 921 | + } | |
| 922 | + | |
| 923 | + for (Long deptId : deptIds) { | |
| 924 | + // 2. 跳过 null 的部门ID | |
| 925 | + if (deptId == null) { | |
| 926 | + continue; | |
| 927 | + } | |
| 928 | + | |
| 929 | + // 3. 获取子部门列表(防护接口返回 null) | |
| 930 | + List<DeptRespDTO> deptList = deptApi.getChildDeptList(deptId); | |
| 931 | + if (CollectionUtils.isEmpty(deptList)) { | |
| 932 | + continue; | |
| 933 | + } | |
| 934 | + | |
| 935 | + // 4. 遍历子部门:过滤无效名称,避免 Map 出现 null/空字符串键 | |
| 936 | + for (DeptRespDTO dept : deptList) { | |
| 937 | + if (dept == null) { | |
| 938 | + continue; | |
| 939 | + } | |
| 940 | + String deptName = dept.getName(); | |
| 941 | + // 过滤 null/空白名称(避免 Map 键为 null 或空字符串) | |
| 942 | + if (deptName == null || deptName.trim().isEmpty()) { | |
| 943 | + continue; | |
| 944 | + } | |
| 945 | + // 若名称重复,后遍历的部门会覆盖先遍历的(可根据业务调整规则) | |
| 946 | + deptNameMap.put(deptName.trim(), dept.getId()); | |
| 947 | + } | |
| 948 | + } | |
| 949 | + | |
| 950 | + return deptNameMap; | |
| 951 | + } | |
| 952 | + /** | |
| 953 | + * @Author wangqian | |
| 954 | + * @Description 根据班组名称获取班组id集合 | |
| 955 | + * @Date 2025/11/26 20:07 | |
| 956 | + */ | |
| 957 | + private List<String> getDeptList(Map<String, Long> teamIdMap, String teamId) { | |
| 958 | + List<String> list = new ArrayList<>(); | |
| 959 | + | |
| 960 | + // 1. 处理 teamId 为空的情况,直接返回空列表 | |
| 961 | + if (StringUtils.isEmpty(teamId)) { | |
| 962 | + return list; | |
| 963 | + } | |
| 964 | + | |
| 965 | + // 2. 分割字符串,处理空元素 | |
| 966 | + String[] teamArray = teamId.split(","); | |
| 967 | + for (String teamName : teamArray) { | |
| 968 | + // 3. 去除首尾空格,避免因空格导致匹配不到 | |
| 969 | + String trimTeamName = teamName.trim(); | |
| 970 | + if (StringUtils.isEmpty(trimTeamName)) { | |
| 971 | + continue; // 跳过空字符串元素 | |
| 972 | + } | |
| 973 | + | |
| 974 | + // 4. 从Map中获取ID,处理null值(避免添加null到列表) | |
| 975 | + Long deptId = teamIdMap.get(trimTeamName); | |
| 976 | + if (deptId != null) { | |
| 977 | + list.add(String.valueOf(deptId)); // 直接添加Long类型,修正原String类型错误 | |
| 978 | + } | |
| 979 | + } | |
| 980 | + | |
| 981 | + return list; | |
| 982 | + } | |
| 541 | 983 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/mechanicalcost/MechanicalCostServiceImpl.java
| ... | ... | @@ -4,12 +4,10 @@ import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 5 | 5 | import com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo.MechanicalCostPageReqVO; |
| 6 | 6 | import com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo.MechanicalCostSaveReqVO; |
| 7 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 7 | 8 | import com.zteits.urbanops.module.garden.dal.dataobject.mechanicalcost.MechanicalCostDO; |
| 8 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 9 | 9 | import com.zteits.urbanops.module.garden.dal.mysql.mechanicalcost.MechanicalCostMapper; |
| 10 | -import com.zteits.urbanops.module.garden.enums.CostFeeConstants; | |
| 11 | 10 | import com.zteits.urbanops.module.garden.service.mechanicaldepreciation.MechanicalDepreciationService; |
| 12 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 13 | 11 | import jakarta.annotation.Resource; |
| 14 | 12 | import org.apache.commons.collections4.CollectionUtils; |
| 15 | 13 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -43,7 +41,7 @@ public class MechanicalCostServiceImpl implements MechanicalCostService { |
| 43 | 41 | MechanicalCostDO mechanicalCost = BeanUtils.toBean(createReqVO, MechanicalCostDO.class); |
| 44 | 42 | |
| 45 | 43 | List<String> deptIds = createReqVO.getTeamIds().stream() |
| 46 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 44 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 47 | 45 | .collect(Collectors.toList()); |
| 48 | 46 | mechanicalCost.setDeptId(deptIds); |
| 49 | 47 | |
| ... | ... | @@ -60,7 +58,7 @@ public class MechanicalCostServiceImpl implements MechanicalCostService { |
| 60 | 58 | MechanicalCostDO updateObj = BeanUtils.toBean(updateReqVO, MechanicalCostDO.class); |
| 61 | 59 | |
| 62 | 60 | List<String> deptIds = updateReqVO.getTeamIds().stream() |
| 63 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 61 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 64 | 62 | .collect(Collectors.toList()); |
| 65 | 63 | updateObj.setDeptId(deptIds); |
| 66 | 64 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/mechanicaldepreciation/MechanicalDepreciationServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.mechanicaldepreciation; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 5 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 7 | -import org.apache.commons.lang3.StringUtils; | |
| 8 | -import org.springframework.stereotype.Service; | |
| 9 | -import jakarta.annotation.Resource; | |
| 10 | -import org.springframework.validation.annotation.Validated; | |
| 11 | -import org.springframework.transaction.annotation.Transactional; | |
| 12 | - | |
| 13 | -import java.util.*; | |
| 14 | -import com.zteits.urbanops.module.garden.controller.admin.mechanicaldepreciation.vo.*; | |
| 15 | -import com.zteits.urbanops.module.garden.dal.dataobject.mechanicaldepreciation.MechanicalDepreciationDO; | |
| 16 | 5 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 17 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | 6 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 19 | - | |
| 7 | +import com.zteits.urbanops.module.garden.controller.admin.mechanicaldepreciation.vo.MechanicalDepreciationPageReqVO; | |
| 8 | +import com.zteits.urbanops.module.garden.controller.admin.mechanicaldepreciation.vo.MechanicalDepreciationSaveReqVO; | |
| 9 | +import com.zteits.urbanops.module.garden.dal.dataobject.mechanicaldepreciation.MechanicalDepreciationDO; | |
| 20 | 10 | import com.zteits.urbanops.module.garden.dal.mysql.mechanicaldepreciation.MechanicalDepreciationMapper; |
| 11 | +import jakarta.annotation.Resource; | |
| 12 | +import org.springframework.stereotype.Service; | |
| 13 | +import org.springframework.validation.annotation.Validated; | |
| 14 | + | |
| 15 | +import java.util.List; | |
| 21 | 16 | |
| 22 | 17 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 23 | -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | |
| 24 | -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | |
| 25 | -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 18 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.MECHANICAL_DEPRECIATION_NOT_EXISTS; | |
| 19 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.MECHANICAL_DEPRECIATION_NOT_EXISTS_001; | |
| 26 | 20 | |
| 27 | 21 | /** |
| 28 | 22 | * 自有机械折旧子 Service 实现类 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/personalcost/PersonalCostServiceImpl.java
| ... | ... | @@ -5,8 +5,9 @@ import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 5 | 5 | import com.zteits.urbanops.module.garden.controller.admin.personalcost.vo.PersonalCostPageReqVO; |
| 6 | 6 | import com.zteits.urbanops.module.garden.controller.admin.personalcost.vo.PersonalCostSaveReqVO; |
| 7 | 7 | import com.zteits.urbanops.module.garden.dal.dataobject.personalcost.PersonalCostDO; |
| 8 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 9 | 8 | import com.zteits.urbanops.module.garden.dal.mysql.personalcost.PersonalCostMapper; |
| 9 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 10 | + | |
| 10 | 11 | import com.zteits.urbanops.module.system.api.dept.DeptApi; |
| 11 | 12 | import jakarta.annotation.Resource; |
| 12 | 13 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -40,7 +41,7 @@ public class PersonalCostServiceImpl implements PersonalCostService { |
| 40 | 41 | // 插入 |
| 41 | 42 | PersonalCostDO personalCost = BeanUtils.toBean(createReqVO, PersonalCostDO.class); |
| 42 | 43 | List<String> deptIds = createReqVO.getTeamIds().stream() |
| 43 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 44 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 44 | 45 | .collect(Collectors.toList()); |
| 45 | 46 | personalCost.setDeptId(deptIds); |
| 46 | 47 | personalCostMapper.insert(personalCost); |
| ... | ... | @@ -56,7 +57,7 @@ public class PersonalCostServiceImpl implements PersonalCostService { |
| 56 | 57 | // 更新 |
| 57 | 58 | PersonalCostDO updateObj = BeanUtils.toBean(updateReqVO, PersonalCostDO.class); |
| 58 | 59 | List<String> deptIds = updateReqVO.getTeamIds().stream() |
| 59 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 60 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 60 | 61 | .collect(Collectors.toList()); |
| 61 | 62 | updateObj.setDeptId(deptIds); |
| 62 | 63 | personalCostMapper.updateById(updateObj); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/rentalmechanicalcost/RentalMechanicalCostServiceImpl.java
| ... | ... | @@ -6,18 +6,14 @@ import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.v |
| 6 | 6 | import com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo.RentalMechanicalCostSaveReqVO; |
| 7 | 7 | import com.zteits.urbanops.module.garden.dal.dataobject.rentalmechanicalcost.RentalMechanicalCostDO; |
| 8 | 8 | import com.zteits.urbanops.module.garden.dal.mysql.rentalmechanicalcost.RentalMechanicalCostMapper; |
| 9 | -import com.zteits.urbanops.module.garden.enums.CostFeeConstants; | |
| 10 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 11 | 9 | import jakarta.annotation.Resource; |
| 12 | -import org.apache.commons.collections4.CollectionUtils; | |
| 13 | 10 | import org.springframework.stereotype.Service; |
| 14 | 11 | import org.springframework.validation.annotation.Validated; |
| 15 | 12 | |
| 16 | 13 | import java.util.List; |
| 17 | 14 | |
| 18 | - | |
| 19 | 15 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 16 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.RENTAL_MECHANICAL_COST_NOT_EXISTS; | |
| 21 | 17 | |
| 22 | 18 | /** |
| 23 | 19 | * 租赁机械费用录入 Service 实现类 |
| ... | ... | @@ -31,15 +27,11 @@ public class RentalMechanicalCostServiceImpl implements RentalMechanicalCostServ |
| 31 | 27 | @Resource |
| 32 | 28 | private RentalMechanicalCostMapper rentalMechanicalCostMapper; |
| 33 | 29 | |
| 34 | - @Resource | |
| 35 | - private TeamBizdomainRelService teamBizdomainRelService; | |
| 36 | - | |
| 37 | 30 | @Override |
| 38 | 31 | public Long createRentalMechanicalCost(RentalMechanicalCostSaveReqVO createReqVO) { |
| 39 | 32 | // 插入 |
| 40 | 33 | RentalMechanicalCostDO rentalMechanicalCost = BeanUtils.toBean(createReqVO, RentalMechanicalCostDO.class); |
| 41 | 34 | rentalMechanicalCostMapper.insert(rentalMechanicalCost); |
| 42 | - | |
| 43 | 35 | // 返回 |
| 44 | 36 | return rentalMechanicalCost.getId(); |
| 45 | 37 | } |
| ... | ... | @@ -51,10 +43,6 @@ public class RentalMechanicalCostServiceImpl implements RentalMechanicalCostServ |
| 51 | 43 | // 更新 |
| 52 | 44 | RentalMechanicalCostDO updateObj = BeanUtils.toBean(updateReqVO, RentalMechanicalCostDO.class); |
| 53 | 45 | rentalMechanicalCostMapper.updateById(updateObj); |
| 54 | - | |
| 55 | - //add by wq 保存班组信息关联表 | |
| 56 | - teamBizdomainRelService.deleteTeamBizdomainRel(updateObj.getId(), CostFeeConstants.COSTFEE_RENTALMECHANICAL); | |
| 57 | - //add by wq 保存班组信息关联表 | |
| 58 | 46 | } |
| 59 | 47 | |
| 60 | 48 | @Override | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/teambizdomainrel/TeamBizdomainRelService.java deleted
| 1 | -package com.zteits.urbanops.module.garden.service.teambizdomainrel; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import jakarta.validation.*; | |
| 5 | -import com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo.*; | |
| 6 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 7 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 8 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 班组关联 Service 接口 | |
| 12 | - * | |
| 13 | - * @author 超级管理员 | |
| 14 | - */ | |
| 15 | -public interface TeamBizdomainRelService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 创建班组关联 | |
| 19 | - * | |
| 20 | - * @param createReqVO 创建信息 | |
| 21 | - * @return 编号 | |
| 22 | - */ | |
| 23 | - Long createTeamBizdomainRel(@Valid TeamBizdomainRelSaveReqVO createReqVO); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 更新班组关联 | |
| 27 | - * | |
| 28 | - * @param updateReqVO 更新信息 | |
| 29 | - */ | |
| 30 | - void updateTeamBizdomainRel(@Valid TeamBizdomainRelSaveReqVO updateReqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 删除班组关联 | |
| 34 | - * | |
| 35 | - * @param id 编号 | |
| 36 | - */ | |
| 37 | - void deleteTeamBizdomainRel(Long id); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 批量删除班组关联 | |
| 41 | - * | |
| 42 | - * @param ids 编号 | |
| 43 | - */ | |
| 44 | - void deleteTeamBizdomainRelListByIds(List<Long> ids); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 获得班组关联 | |
| 48 | - * | |
| 49 | - * @param id 编号 | |
| 50 | - * @return 班组关联 | |
| 51 | - */ | |
| 52 | - TeamBizdomainRelDO getTeamBizdomainRel(Long id); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 获得班组关联分页 | |
| 56 | - * | |
| 57 | - * @param pageReqVO 分页查询 | |
| 58 | - * @return 班组关联分页 | |
| 59 | - */ | |
| 60 | - PageResult<TeamBizdomainRelDO> getTeamBizdomainRelPage(TeamBizdomainRelPageReqVO pageReqVO); | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * @Author wangqian | |
| 64 | - * @Description 获取费用关联信息 | |
| 65 | - * @Date 2025/11/19 20:47 | |
| 66 | - * @Param busiId | |
| 67 | - * @param busiType | |
| 68 | - * @Return java.util.List<com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO> | |
| 69 | - */ | |
| 70 | - public List<TeamBizdomainRelDO> getTeamBizdomainRelList(Long busiId, String busiType); | |
| 71 | - | |
| 72 | - public void saveTeamBizdomainRel(List<TeamBizdomainRelDO> teamList, Long busiId, String companyId, String companyName ,String busiType) ; | |
| 73 | - | |
| 74 | - public void deleteTeamBizdomainRel(Long id, String busiType); | |
| 75 | - | |
| 76 | - | |
| 77 | -} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/teambizdomainrel/TeamBizdomainRelServiceImpl.java deleted
| 1 | -package com.zteits.urbanops.module.garden.service.teambizdomainrel; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 5 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 6 | -import com.zteits.urbanops.module.garden.enums.CostFeeConstants; | |
| 7 | -import org.apache.commons.collections4.CollectionUtils; | |
| 8 | -import org.apache.commons.lang3.StringUtils; | |
| 9 | -import org.springframework.stereotype.Service; | |
| 10 | -import jakarta.annotation.Resource; | |
| 11 | -import org.springframework.validation.annotation.Validated; | |
| 12 | -import org.springframework.transaction.annotation.Transactional; | |
| 13 | - | |
| 14 | -import java.util.*; | |
| 15 | -import com.zteits.urbanops.module.garden.controller.admin.teambizdomainrel.vo.*; | |
| 16 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 17 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 18 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 19 | -import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 20 | - | |
| 21 | -import com.zteits.urbanops.module.garden.dal.mysql.teambizdomainrel.TeamBizdomainRelMapper; | |
| 22 | - | |
| 23 | -import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 24 | -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | |
| 25 | -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | |
| 26 | -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 27 | - | |
| 28 | -/** | |
| 29 | - * 班组关联 Service 实现类 | |
| 30 | - * | |
| 31 | - * @author 超级管理员 | |
| 32 | - */ | |
| 33 | -@Service | |
| 34 | -@Validated | |
| 35 | -public class TeamBizdomainRelServiceImpl implements TeamBizdomainRelService { | |
| 36 | - | |
| 37 | - @Resource | |
| 38 | - private TeamBizdomainRelMapper teamBizdomainRelMapper; | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public Long createTeamBizdomainRel(TeamBizdomainRelSaveReqVO createReqVO) { | |
| 42 | - // 插入 | |
| 43 | - TeamBizdomainRelDO teamBizdomainRel = BeanUtils.toBean(createReqVO, TeamBizdomainRelDO.class); | |
| 44 | - teamBizdomainRelMapper.insert(teamBizdomainRel); | |
| 45 | - | |
| 46 | - // 返回 | |
| 47 | - return teamBizdomainRel.getId(); | |
| 48 | - } | |
| 49 | - | |
| 50 | - @Override | |
| 51 | - public void updateTeamBizdomainRel(TeamBizdomainRelSaveReqVO updateReqVO) { | |
| 52 | - // 校验存在 | |
| 53 | - validateTeamBizdomainRelExists(updateReqVO.getId()); | |
| 54 | - // 更新 | |
| 55 | - TeamBizdomainRelDO updateObj = BeanUtils.toBean(updateReqVO, TeamBizdomainRelDO.class); | |
| 56 | - teamBizdomainRelMapper.updateById(updateObj); | |
| 57 | - } | |
| 58 | - | |
| 59 | - @Override | |
| 60 | - public void deleteTeamBizdomainRel(Long id) { | |
| 61 | - // 校验存在 | |
| 62 | - validateTeamBizdomainRelExists(id); | |
| 63 | - // 删除 | |
| 64 | - teamBizdomainRelMapper.deleteById(id); | |
| 65 | - } | |
| 66 | - | |
| 67 | - @Override | |
| 68 | - public void deleteTeamBizdomainRelListByIds(List<Long> ids) { | |
| 69 | - // 删除 | |
| 70 | - teamBizdomainRelMapper.deleteByIds(ids); | |
| 71 | - } | |
| 72 | - | |
| 73 | - | |
| 74 | - private void validateTeamBizdomainRelExists(Long id) { | |
| 75 | - if (teamBizdomainRelMapper.selectById(id) == null) { | |
| 76 | - //throw exception(TEAM_BIZDOMAIN_REL_NOT_EXISTS); | |
| 77 | - } | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | - public TeamBizdomainRelDO getTeamBizdomainRel(Long id) { | |
| 82 | - return teamBizdomainRelMapper.selectById(id); | |
| 83 | - } | |
| 84 | - | |
| 85 | - @Override | |
| 86 | - public PageResult<TeamBizdomainRelDO> getTeamBizdomainRelPage(TeamBizdomainRelPageReqVO pageReqVO) { | |
| 87 | - return teamBizdomainRelMapper.selectPage(pageReqVO); | |
| 88 | - } | |
| 89 | - | |
| 90 | - public List<TeamBizdomainRelDO> getTeamBizdomainRelList(Long busiId, String busiType) { | |
| 91 | - if (busiId == null && StringUtils.isEmpty(busiType)) { | |
| 92 | - throw exception(MECHANICAL_COST_NOT_EXISTS_001); | |
| 93 | - } | |
| 94 | - LambdaQueryWrapper<TeamBizdomainRelDO> queryWrapper = Wrappers.lambdaQuery(); | |
| 95 | - queryWrapper.eq(TeamBizdomainRelDO::getBusiId, busiId); | |
| 96 | - queryWrapper.eq(TeamBizdomainRelDO::getBusiType, busiType); | |
| 97 | - return teamBizdomainRelMapper.selectList(queryWrapper); | |
| 98 | - } | |
| 99 | - | |
| 100 | - @Override | |
| 101 | - public void saveTeamBizdomainRel(List<TeamBizdomainRelDO> teamList, Long busiId, String companyId, String companyName ,String busiType) { | |
| 102 | - if (CollectionUtils.isNotEmpty(teamList)) { | |
| 103 | - for (TeamBizdomainRelDO team : teamList) { | |
| 104 | - if (team != null && StringUtils.isNotEmpty(team.getTeamId())) { | |
| 105 | - TeamBizdomainRelDO teamBizdomainRel = new TeamBizdomainRelDO(); | |
| 106 | - teamBizdomainRel.setBusiId(String.valueOf(busiId)); | |
| 107 | - teamBizdomainRel.setCompanyId(companyId); | |
| 108 | - teamBizdomainRel.setCompanyName(companyName); | |
| 109 | - teamBizdomainRel.setTeamName(team.getTeamName()); | |
| 110 | - teamBizdomainRel.setTeamId(team.getTeamId()); | |
| 111 | - teamBizdomainRel.setBusiType(busiType); | |
| 112 | - teamBizdomainRelMapper.insert(teamBizdomainRel); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - } | |
| 116 | - } | |
| 117 | - | |
| 118 | - @Override | |
| 119 | - public void deleteTeamBizdomainRel(Long id, String busiType ) { | |
| 120 | - if (id == null && StringUtils.isEmpty(busiType)) { | |
| 121 | - throw exception(MECHANICAL_COST_NOT_EXISTS_001); | |
| 122 | - } | |
| 123 | - LambdaQueryWrapper<TeamBizdomainRelDO> queryWrapper = Wrappers.lambdaQuery(); | |
| 124 | - queryWrapper.eq(TeamBizdomainRelDO::getBusiId, String.valueOf(id)); | |
| 125 | - queryWrapper.eq(TeamBizdomainRelDO::getBusiType, busiType); | |
| 126 | - teamBizdomainRelMapper.delete(queryWrapper); | |
| 127 | - } | |
| 128 | -} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/wasterecord/WasteRecordServiceImpl.java
| ... | ... | @@ -4,10 +4,9 @@ import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 5 | 5 | import com.zteits.urbanops.module.garden.controller.admin.wasterecord.vo.WasteRecordPageReqVO; |
| 6 | 6 | import com.zteits.urbanops.module.garden.controller.admin.wasterecord.vo.WasteRecordSaveReqVO; |
| 7 | -import com.zteits.urbanops.module.garden.dal.dataobject.teambizdomainrel.TeamBizdomainRelDO; | |
| 7 | +import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.TeamBizdomainRelVo; | |
| 8 | 8 | import com.zteits.urbanops.module.garden.dal.dataobject.wasterecord.WasteRecordDO; |
| 9 | 9 | import com.zteits.urbanops.module.garden.dal.mysql.wasterecord.WasteRecordMapper; |
| 10 | -import com.zteits.urbanops.module.garden.service.teambizdomainrel.TeamBizdomainRelService; | |
| 11 | 10 | import jakarta.annotation.Resource; |
| 12 | 11 | import org.springframework.stereotype.Service; |
| 13 | 12 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -37,7 +36,7 @@ public class WasteRecordServiceImpl implements WasteRecordService { |
| 37 | 36 | // 插入 |
| 38 | 37 | WasteRecordDO wasteRecord = BeanUtils.toBean(createReqVO, WasteRecordDO.class); |
| 39 | 38 | List<String> deptIds = createReqVO.getTeamIds().stream() |
| 40 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 39 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 41 | 40 | .collect(Collectors.toList()); |
| 42 | 41 | wasteRecord.setDeptId(deptIds); |
| 43 | 42 | wasteRecordMapper.insert(wasteRecord); |
| ... | ... | @@ -54,7 +53,7 @@ public class WasteRecordServiceImpl implements WasteRecordService { |
| 54 | 53 | WasteRecordDO updateObj = BeanUtils.toBean(updateReqVO, WasteRecordDO.class); |
| 55 | 54 | |
| 56 | 55 | List<String> deptIds = updateReqVO.getTeamIds().stream() |
| 57 | - .map(TeamBizdomainRelDO::getTeamId) | |
| 56 | + .map(TeamBizdomainRelVo::getTeamId) | |
| 58 | 57 | .collect(Collectors.toList()); |
| 59 | 58 | updateObj.setDeptId(deptIds); |
| 60 | 59 | ... | ... |
urbanops-module-garden/src/main/resources/mapper/departmentcost/DepartmentCostMapper.xml
| ... | ... | @@ -2,11 +2,13 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.departmentcost.DepartmentCostMapper"> |
| 4 | 4 | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 5 | + <select id="selectDuplicateIds" resultType="java.lang.Long"> | |
| 6 | + SELECT id | |
| 7 | + FROM td_department_cost | |
| 8 | + WHERE | |
| 9 | + <foreach collection="keyList" item="key" separator="OR"> | |
| 10 | + (salary_month = #{key.salaryMonth} AND expense_name = #{key.expenseName} and company_id=#{key.companyId}) | |
| 11 | + </foreach> | |
| 12 | + </select> | |
| 11 | 13 | |
| 12 | -</mapper> | |
| 13 | 14 | \ No newline at end of file |
| 15 | +</mapper> | ... | ... |
urbanops-module-garden/src/main/resources/mapper/personalcost/PersonalCostMapper.xml
| ... | ... | @@ -2,11 +2,12 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.personalcost.PersonalCostMapper"> |
| 4 | 4 | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | - | |
| 12 | -</mapper> | |
| 13 | 5 | \ No newline at end of file |
| 6 | + <select id="selectDuplicateIds" resultType="java.lang.Long"> | |
| 7 | + SELECT id | |
| 8 | + FROM td_personal_cost | |
| 9 | + WHERE | |
| 10 | + <foreach collection="keyList" item="key" separator="OR"> | |
| 11 | + (salary_month = #{key.salaryMonth} AND name = #{key.name}) | |
| 12 | + </foreach> | |
| 13 | + </select> | |
| 14 | +</mapper> | ... | ... |
urbanops-module-garden/src/main/resources/mapper/waterfee/WaterFeeMapper.xml
| ... | ... | @@ -2,11 +2,14 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.waterfee.WaterFeeMapper"> |
| 4 | 4 | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | 5 | |
| 12 | -</mapper> | |
| 13 | 6 | \ No newline at end of file |
| 7 | + <select id="selectDuplicateIds" resultType="java.lang.Long"> | |
| 8 | + SELECT id | |
| 9 | + FROM td_water_fee | |
| 10 | + WHERE | |
| 11 | + <foreach collection="keyList" item="key" separator="OR"> | |
| 12 | + (fee_month = #{key.feeMonth} AND meter_code = #{key.meterCode}) | |
| 13 | + </foreach> | |
| 14 | + </select> | |
| 15 | + | |
| 16 | +</mapper> | ... | ... |
urbanops-module-gloabl/src/main/resources/mapper/mechanicalcost/MechanicalCostMapper.xml
| ... | ... | @@ -2,11 +2,13 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.mechanicalcost.MechanicalCostMapper"> |
| 4 | 4 | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 5 | + <select id="selectDuplicateIds" resultType="java.lang.Long"> | |
| 6 | + SELECT id | |
| 7 | + FROM td_mechanical_cost | |
| 8 | + WHERE | |
| 9 | + <foreach collection="keyList" item="key" separator="OR"> | |
| 10 | + mech_code =#{key.mechCode} | |
| 11 | + </foreach> | |
| 12 | + </select> | |
| 11 | 13 | |
| 12 | -</mapper> | |
| 13 | 14 | \ No newline at end of file |
| 15 | +</mapper> | ... | ... |