车辆管理,修改物资出入库逻辑
This commit is contained in:
		| @ -66,27 +66,27 @@ spring: | |||||||
|           #          username: xinnengyuan |           #          username: xinnengyuan | ||||||
|           #          password: mEZPC5Sdf3r2HENi |           #          password: mEZPC5Sdf3r2HENi | ||||||
|           # 从库数据源 |           # 从库数据源 | ||||||
|         slave: | #        slave: | ||||||
|           lazy: true |       #          lazy: true | ||||||
|           type: ${spring.datasource.type} |       #          type: ${spring.datasource.type} | ||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |       #          driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           url: jdbc:mysql://192.168.110.2:13386/zmkgc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |       #          url: jdbc:mysql://192.168.110.2:13386/zmkgc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true | ||||||
|           username: zmkgc |       #          username: zmkgc | ||||||
|           password: nWKDKRNRT48tFBdh |       #          password: nWKDKRNRT48tFBdh | ||||||
|         slave1: |       #        slave1: | ||||||
|           lazy: true |       #          lazy: true | ||||||
|           type: ${spring.datasource.type} |       #          type: ${spring.datasource.type} | ||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |       #          driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           url: jdbc:mysql://192.168.110.2:13386/zmkgprod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |       #          url: jdbc:mysql://192.168.110.2:13386/zmkgprod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true | ||||||
|           username: zmkgprod |       #          username: zmkgprod | ||||||
|           password: MaY8nehwWkJriWPm |       #          password: MaY8nehwWkJriWPm | ||||||
|         slave2: |       #        slave2: | ||||||
|           lazy: true |       #          lazy: true | ||||||
|           type: ${spring.datasource.type} |       #          type: ${spring.datasource.type} | ||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |       #          driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           url: jdbc:mysql://192.168.110.2:13386/zmkgc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |       #          url: jdbc:mysql://192.168.110.2:13386/zmkgc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true | ||||||
|           username: zmkgc |       #          username: zmkgc | ||||||
|           password: nWKDKRNRT48tFBdh |       #          password: nWKDKRNRT48tFBdh | ||||||
|       #        slave: |       #        slave: | ||||||
|       #          lazy: true |       #          lazy: true | ||||||
|       #          type: ${spring.datasource.type} |       #          type: ${spring.datasource.type} | ||||||
|  | |||||||
| @ -0,0 +1,106 @@ | |||||||
|  | package org.dromara.materials.controller; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import jakarta.servlet.http.HttpServletResponse; | ||||||
|  | import jakarta.validation.constraints.NotEmpty; | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.dromara.common.core.domain.R; | ||||||
|  | import org.dromara.common.core.validate.AddGroup; | ||||||
|  | import org.dromara.common.core.validate.EditGroup; | ||||||
|  | import org.dromara.common.excel.utils.ExcelUtil; | ||||||
|  | import org.dromara.common.idempotent.annotation.RepeatSubmit; | ||||||
|  | import org.dromara.common.log.annotation.Log; | ||||||
|  | import org.dromara.common.log.enums.BusinessType; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.common.web.core.BaseController; | ||||||
|  | import org.dromara.materials.domain.bo.MatWarehouseBo; | ||||||
|  | import org.dromara.materials.domain.vo.MatWarehouseVo; | ||||||
|  | import org.dromara.materials.service.IMatWarehouseService; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库 | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/materials/warehouse") | ||||||
|  | public class MatWarehouseController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final IMatWarehouseService matWarehouseService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询物资仓库列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:list") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo<MatWarehouseVo> list(MatWarehouseBo bo, PageQuery pageQuery) { | ||||||
|  |         return matWarehouseService.queryPageList(bo, pageQuery); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导出物资仓库列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:export") | ||||||
|  |     @Log(title = "物资仓库", businessType = BusinessType.EXPORT) | ||||||
|  |     @PostMapping("/export") | ||||||
|  |     public void export(MatWarehouseBo bo, HttpServletResponse response) { | ||||||
|  |         List<MatWarehouseVo> list = matWarehouseService.queryList(bo); | ||||||
|  |         ExcelUtil.exportExcel(list, "物资仓库", MatWarehouseVo.class, response); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取物资仓库详细信息 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:query") | ||||||
|  |     @GetMapping("/{id}") | ||||||
|  |     public R<MatWarehouseVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|  |                                      @PathVariable Long id) { | ||||||
|  |         return R.ok(matWarehouseService.queryById(id)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增物资仓库 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:add") | ||||||
|  |     @Log(title = "物资仓库", businessType = BusinessType.INSERT) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PostMapping() | ||||||
|  |     public R<Void> add(@Validated(AddGroup.class) @RequestBody MatWarehouseBo bo) { | ||||||
|  |         return toAjax(matWarehouseService.insertByBo(bo)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改物资仓库 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:edit") | ||||||
|  |     @Log(title = "物资仓库", businessType = BusinessType.UPDATE) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PutMapping() | ||||||
|  |     public R<Void> edit(@Validated(EditGroup.class) @RequestBody MatWarehouseBo bo) { | ||||||
|  |         return toAjax(matWarehouseService.updateByBo(bo)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param ids 主键串 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("materials:warehouse:remove") | ||||||
|  |     @Log(title = "物资仓库", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{ids}") | ||||||
|  |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|  |                           @PathVariable Long[] ids) { | ||||||
|  |         return toAjax(matWarehouseService.deleteWithValidByIds(List.of(ids), true)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -68,6 +68,11 @@ public class MatMaterialIssue extends BaseEntity { | |||||||
|      */ |      */ | ||||||
|     private String issueUnit; |     private String issueUnit; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 领用人 | ||||||
|  |      */ | ||||||
|  |     private String shipper; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 保管单位 |      * 保管单位 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -38,6 +38,11 @@ public class MatMaterials extends BaseEntity { | |||||||
|      */ |      */ | ||||||
|     private Long companyId; |     private Long companyId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 项目id |      * 项目id | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -0,0 +1,91 @@ | |||||||
|  | package org.dromara.materials.domain; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import org.dromara.common.mybatis.core.domain.BaseEntity; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库对象 mat_warehouse | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @TableName("mat_warehouse") | ||||||
|  | public class MatWarehouse extends BaseEntity { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键id | ||||||
|  |      */ | ||||||
|  |     @TableId(value = "id") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 项目id | ||||||
|  |      */ | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库编号 | ||||||
|  |      */ | ||||||
|  |     private String warehouseCode; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库名称 | ||||||
|  |      */ | ||||||
|  |     private String warehouseName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库类型 | ||||||
|  |      */ | ||||||
|  |     private String warehouseType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库地址 | ||||||
|  |      */ | ||||||
|  |     private String address; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 经度 | ||||||
|  |      */ | ||||||
|  |     private String lng; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 纬度 | ||||||
|  |      */ | ||||||
|  |     private String lat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库面积 | ||||||
|  |      */ | ||||||
|  |     private Long area; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 存放容量 | ||||||
|  |      */ | ||||||
|  |     private Long capacity; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人 | ||||||
|  |      */ | ||||||
|  |     private String manager; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人电话 | ||||||
|  |      */ | ||||||
|  |     private String managerPhone; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 备注 | ||||||
|  |      */ | ||||||
|  |     private String remark; | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,94 @@ | |||||||
|  | package org.dromara.materials.domain.bo; | ||||||
|  |  | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import jakarta.validation.constraints.NotBlank; | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import org.dromara.common.core.validate.AddGroup; | ||||||
|  | import org.dromara.common.core.validate.EditGroup; | ||||||
|  | import org.dromara.common.mybatis.core.domain.BaseEntity; | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库业务对象 mat_warehouse | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @AutoMapper(target = MatWarehouse.class, reverseConvertGenerate = false) | ||||||
|  | public class MatWarehouseBo extends BaseEntity { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键id | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "主键id不能为空", groups = {EditGroup.class}) | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 项目id | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "项目id不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库编号 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "仓库编号不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|  |     private String warehouseCode; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库名称 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "仓库名称不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|  |     private String warehouseName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库类型 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "仓库类型不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|  |     private String warehouseType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库地址 | ||||||
|  |      */ | ||||||
|  |     private String address; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 经度 | ||||||
|  |      */ | ||||||
|  |     private String lng; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 纬度 | ||||||
|  |      */ | ||||||
|  |     private String lat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库面积 | ||||||
|  |      */ | ||||||
|  |     private Long area; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 存放容量 | ||||||
|  |      */ | ||||||
|  |     private Long capacity; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人 | ||||||
|  |      */ | ||||||
|  |     private String manager; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人电话 | ||||||
|  |      */ | ||||||
|  |     private String managerPhone; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 备注 | ||||||
|  |      */ | ||||||
|  |     private String remark; | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -63,6 +63,12 @@ public class MatMaterialIssueCreateReq implements Serializable { | |||||||
|     @NotBlank(message = "领料单位不能为空") |     @NotBlank(message = "领料单位不能为空") | ||||||
|     private String issueUnit; |     private String issueUnit; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 领用人 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "领用人不能为空") | ||||||
|  |     private String shipper; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 保管单位 |      * 保管单位 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -57,6 +57,11 @@ public class MatMaterialIssueUpdateReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private String issueUnit; |     private String issueUnit; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 领用人 | ||||||
|  |      */ | ||||||
|  |     private String shipper; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 保管单位 |      * 保管单位 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -61,4 +61,9 @@ public class MatMaterialReceiveItemDto { | |||||||
|      */ |      */ | ||||||
|     private Long planId; |     private Long planId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -26,6 +26,11 @@ public class MatMaterialsCreateReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private Long companyId; |     private Long companyId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 项目id |      * 项目id | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -25,6 +25,11 @@ public class MatMaterialsQueryReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private Long companyId; |     private Long companyId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 项目id |      * 项目id | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -31,6 +31,11 @@ public class MatMaterialsUpdateReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private Long companyId; |     private Long companyId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 项目id |      * 项目id | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -0,0 +1,108 @@ | |||||||
|  | package org.dromara.materials.domain.vo; | ||||||
|  |  | ||||||
|  | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||||
|  | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import lombok.Data; | ||||||
|  | import org.dromara.common.excel.annotation.ExcelDictFormat; | ||||||
|  | import org.dromara.common.excel.convert.ExcelDictConvert; | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库视图对象 mat_warehouse | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @ExcelIgnoreUnannotated | ||||||
|  | @AutoMapper(target = MatWarehouse.class) | ||||||
|  | public class MatWarehouseVo implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键id | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "主键id") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 项目id | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "项目id") | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库编号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "仓库编号") | ||||||
|  |     private String warehouseCode; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库名称 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "仓库名称") | ||||||
|  |     private String warehouseName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库类型 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "仓库类型", converter = ExcelDictConvert.class) | ||||||
|  |     @ExcelDictFormat(dictType = "mat_warehouse_type") | ||||||
|  |     private String warehouseType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库地址 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "仓库地址") | ||||||
|  |     private String address; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 经度 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "经度") | ||||||
|  |     private String lng; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 纬度 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "纬度") | ||||||
|  |     private String lat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库面积 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "仓库面积") | ||||||
|  |     private Long area; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 存放容量 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "存放容量") | ||||||
|  |     private Long capacity; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "负责人") | ||||||
|  |     private String manager; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 负责人电话 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "负责人电话") | ||||||
|  |     private String managerPhone; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 备注 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "备注") | ||||||
|  |     private String remark; | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -69,6 +69,11 @@ public class MatMaterialIssueVo implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private String issueUnit; |     private String issueUnit; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 领用人 | ||||||
|  |      */ | ||||||
|  |     private String shipper; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 保管单位 |      * 保管单位 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -1,13 +1,11 @@ | |||||||
| package org.dromara.materials.domain.vo.materials; | package org.dromara.materials.domain.vo.materials; | ||||||
|  |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryOutVo; |  | ||||||
|  |  | ||||||
| import java.io.Serial; | import java.io.Serial; | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @author lilemy |  * @author lilemy | ||||||
| @ -48,9 +46,4 @@ public class MatMaterialsNumberVo implements Serializable { | |||||||
|      * 创建时间 |      * 创建时间 | ||||||
|      */ |      */ | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 出库列表 |  | ||||||
|      */ |  | ||||||
|     private List<MatMaterialsInventoryOutVo> outList; |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -28,6 +28,16 @@ public class MatMaterialsUseDetailVo implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private String materialsName; |     private String materialsName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库名称 | ||||||
|  |      */ | ||||||
|  |     private String warehouseName; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 计划数量 |      * 计划数量 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -47,6 +47,11 @@ public class MatMaterialsVo implements Serializable { | |||||||
|     @ExcelProperty(value = "公司id") |     @ExcelProperty(value = "公司id") | ||||||
|     private Long companyId; |     private Long companyId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 仓库id | ||||||
|  |      */ | ||||||
|  |     private Long warehouseId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 公司信息 |      * 公司信息 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package org.dromara.materials.mapper; | ||||||
|  |  | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
|  | import org.dromara.materials.domain.vo.MatWarehouseVo; | ||||||
|  | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库Mapper接口 | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | public interface MatWarehouseMapper extends BaseMapperPlus<MatWarehouse, MatWarehouseVo> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; | |||||||
| import org.dromara.materials.domain.MatMaterials; | import org.dromara.materials.domain.MatMaterials; | ||||||
| import org.dromara.materials.domain.MatMaterialsInventory; | import org.dromara.materials.domain.MatMaterialsInventory; | ||||||
| import org.dromara.materials.domain.MatMaterialsUseRecord; | import org.dromara.materials.domain.MatMaterialsUseRecord; | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
| import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; | import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; | ||||||
| import org.dromara.materials.domain.dto.materials.MatMaterialsCreateReq; | import org.dromara.materials.domain.dto.materials.MatMaterialsCreateReq; | ||||||
| import org.dromara.materials.domain.dto.materials.MatMaterialsGisReq; | import org.dromara.materials.domain.dto.materials.MatMaterialsGisReq; | ||||||
| @ -117,11 +118,8 @@ public interface IMatMaterialsService extends IService<MatMaterials> { | |||||||
|      * @param supplierUnit 供应商单位 |      * @param supplierUnit 供应商单位 | ||||||
|      * @param nickname     操作用户昵称 |      * @param nickname     操作用户昵称 | ||||||
|      */ |      */ | ||||||
|     void create(Long projectId, |     void create(Long projectId, List<MatMaterialReceiveItemDto> itemList, | ||||||
|                 List<MatMaterialReceiveItemDto> itemList, |                 String formCode, String supplierUnit, String nickname | ||||||
|                 String formCode, |  | ||||||
|                 String supplierUnit, |  | ||||||
|                 String nickname |  | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @ -169,16 +167,18 @@ public interface IMatMaterialsService extends IService<MatMaterials> { | |||||||
|     /** |     /** | ||||||
|      * 获取材料使用详情列表 |      * 获取材料使用详情列表 | ||||||
|      * |      * | ||||||
|      * @param materials 材料 |      * @param materials     材料 | ||||||
|      * @param putList   材料入库列表 |      * @param putList       材料入库列表 | ||||||
|      * @param outList   材料出库列表 |      * @param outList       材料出库列表 | ||||||
|      * @param useList   材料使用列表 |      * @param useList       材料使用列表 | ||||||
|  |      * @param warehouseList 仓库列表 | ||||||
|      * @return 材料使用详情列表 |      * @return 材料使用详情列表 | ||||||
|      */ |      */ | ||||||
|     List<MatMaterialsUseDetailVo> getUseDetailList(List<MatMaterials> materials, |     List<MatMaterialsUseDetailVo> getUseDetailList(List<MatMaterials> materials, | ||||||
|                                                    List<MatMaterialsInventory> putList, |                                                    List<MatMaterialsInventory> putList, | ||||||
|                                                    List<MatMaterialsInventory> outList, |                                                    List<MatMaterialsInventory> outList, | ||||||
|                                                    List<MatMaterialsUseRecord> useList); |                                                    List<MatMaterialsUseRecord> useList, | ||||||
|  |                                                    List<MatWarehouse> warehouseList); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取材料库存数据列表 |      * 获取材料库存数据列表 | ||||||
|  | |||||||
| @ -0,0 +1,70 @@ | |||||||
|  | package org.dromara.materials.service; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.extension.service.IService; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
|  | import org.dromara.materials.domain.bo.MatWarehouseBo; | ||||||
|  | import org.dromara.materials.domain.vo.MatWarehouseVo; | ||||||
|  |  | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库Service接口 | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | public interface IMatWarehouseService extends IService<MatWarehouse> { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 物资仓库 | ||||||
|  |      */ | ||||||
|  |     MatWarehouseVo queryById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询物资仓库列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 物资仓库分页列表 | ||||||
|  |      */ | ||||||
|  |     TableDataInfo<MatWarehouseVo> queryPageList(MatWarehouseBo bo, PageQuery pageQuery); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的物资仓库列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 物资仓库列表 | ||||||
|  |      */ | ||||||
|  |     List<MatWarehouseVo> queryList(MatWarehouseBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param bo 物资仓库 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     Boolean insertByBo(MatWarehouseBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param bo 物资仓库 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     Boolean updateByBo(MatWarehouseBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除物资仓库信息 | ||||||
|  |      * | ||||||
|  |      * @param ids     待删除的主键集合 | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); | ||||||
|  | } | ||||||
| @ -23,6 +23,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; | |||||||
| import org.dromara.common.oss.core.OssClient; | import org.dromara.common.oss.core.OssClient; | ||||||
| import org.dromara.common.oss.exception.OssException; | import org.dromara.common.oss.exception.OssException; | ||||||
| import org.dromara.common.oss.factory.OssFactory; | import org.dromara.common.oss.factory.OssFactory; | ||||||
|  | import org.dromara.common.satoken.utils.LoginHelper; | ||||||
| import org.dromara.common.utils.DocumentUtil; | import org.dromara.common.utils.DocumentUtil; | ||||||
| import org.dromara.materials.constants.MatMaterialsConstant; | import org.dromara.materials.constants.MatMaterialsConstant; | ||||||
| import org.dromara.materials.domain.MatMaterialIssue; | import org.dromara.materials.domain.MatMaterialIssue; | ||||||
| @ -35,6 +36,7 @@ import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq; | |||||||
| import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto; | import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto; | ||||||
| import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; | import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; | ||||||
| import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto; | import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto; | ||||||
|  | import org.dromara.materials.domain.enums.MatMaterialsInventoryOutPutEnum; | ||||||
| import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; | import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; | ||||||
| import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo; | import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo; | ||||||
| import org.dromara.materials.mapper.MatMaterialIssueMapper; | import org.dromara.materials.mapper.MatMaterialIssueMapper; | ||||||
| @ -238,14 +240,12 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|     @Override |     @Override | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     public Boolean insertByBo(MatMaterialIssueCreateReq req) { |     public Boolean insertByBo(MatMaterialIssueCreateReq req) { | ||||||
|  |         String nickname = Objects.requireNonNull(LoginHelper.getLoginUser()).getNickname(); | ||||||
|         MatMaterialIssue materialIssue = new MatMaterialIssue(); |         MatMaterialIssue materialIssue = new MatMaterialIssue(); | ||||||
|         BeanUtils.copyProperties(req, materialIssue); |         BeanUtils.copyProperties(req, materialIssue); | ||||||
|         validEntityBeforeSave(materialIssue, true); |         validEntityBeforeSave(materialIssue); | ||||||
|         getFileSize(materialIssue, |         getFileSize(materialIssue, req.getLicenseCountFileId(), | ||||||
|             req.getLicenseCountFileId(), |             req.getReportCountFileId(), req.getTechDocCountFileId(), req.getCertCountFileId()); | ||||||
|             req.getReportCountFileId(), |  | ||||||
|             req.getTechDocCountFileId(), |  | ||||||
|             req.getCertCountFileId()); |  | ||||||
|         boolean save = this.save(materialIssue); |         boolean save = this.save(materialIssue); | ||||||
|         if (!save) { |         if (!save) { | ||||||
|             throw new ServiceException("物料领料单新增失败", HttpStatus.ERROR); |             throw new ServiceException("物料领料单新增失败", HttpStatus.ERROR); | ||||||
| @ -263,7 +263,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|             if (!result) { |             if (!result) { | ||||||
|                 throw new ServiceException("物料领料单明细项新增失败", HttpStatus.ERROR); |                 throw new ServiceException("物料领料单明细项新增失败", HttpStatus.ERROR); | ||||||
|             } |             } | ||||||
| /*            // 创建设备材料出库记录 |             // 创建设备材料出库记录 | ||||||
|             List<MatMaterialsInventory> inventoryList = itemList.stream().map(item -> { |             List<MatMaterialsInventory> inventoryList = itemList.stream().map(item -> { | ||||||
|                 MatMaterialsInventory inventory = new MatMaterialsInventory(); |                 MatMaterialsInventory inventory = new MatMaterialsInventory(); | ||||||
|                 inventory.setNumber(item.getIssuedQuantity().longValue()); |                 inventory.setNumber(item.getIssuedQuantity().longValue()); | ||||||
| @ -271,7 +271,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|                 inventory.setResidue(item.getRemainingQuantity().longValue()); |                 inventory.setResidue(item.getRemainingQuantity().longValue()); | ||||||
|                 inventory.setOperator(nickname); |                 inventory.setOperator(nickname); | ||||||
|                 inventory.setRecipient(materialIssue.getIssueUnit()); |                 inventory.setRecipient(materialIssue.getIssueUnit()); | ||||||
|                 inventory.setShipper(nickname); |                 inventory.setShipper(materialIssue.getShipper()); | ||||||
|                 inventory.setMaterialsId(item.getMaterialsId()); |                 inventory.setMaterialsId(item.getMaterialsId()); | ||||||
|                 inventory.setProjectId(materialIssue.getProjectId()); |                 inventory.setProjectId(materialIssue.getProjectId()); | ||||||
|                 inventory.setOutPut(MatMaterialsInventoryOutPutEnum.OUT.getValue()); |                 inventory.setOutPut(MatMaterialsInventoryOutPutEnum.OUT.getValue()); | ||||||
| @ -281,7 +281,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|             boolean saved = materialsInventoryService.saveBatch(inventoryList); |             boolean saved = materialsInventoryService.saveBatch(inventoryList); | ||||||
|             if (!saved) { |             if (!saved) { | ||||||
|                 throw new ServiceException("物料出库记录新增失败", HttpStatus.ERROR); |                 throw new ServiceException("物料出库记录新增失败", HttpStatus.ERROR); | ||||||
|             }*/ |             } | ||||||
|         } |         } | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| @ -302,7 +302,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|         } |         } | ||||||
|         MatMaterialIssue materialIssue = new MatMaterialIssue(); |         MatMaterialIssue materialIssue = new MatMaterialIssue(); | ||||||
|         BeanUtils.copyProperties(req, materialIssue); |         BeanUtils.copyProperties(req, materialIssue); | ||||||
|         validEntityBeforeSave(materialIssue, false); |         validEntityBeforeSave(materialIssue); | ||||||
|         getFileSize(materialIssue, |         getFileSize(materialIssue, | ||||||
|             req.getLicenseCountFileId(), |             req.getLicenseCountFileId(), | ||||||
|             req.getReportCountFileId(), |             req.getReportCountFileId(), | ||||||
| @ -341,18 +341,9 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap | |||||||
|     /** |     /** | ||||||
|      * 保存前的数据校验 |      * 保存前的数据校验 | ||||||
|      */ |      */ | ||||||
|     private void validEntityBeforeSave(MatMaterialIssue entity, Boolean create) { |     private void validEntityBeforeSave(MatMaterialIssue entity) { | ||||||
|         // 做一些数据校验,如唯一约束 |         // 做一些数据校验,如唯一约束 | ||||||
|         Long projectId = entity.getProjectId(); |         Long projectId = entity.getProjectId(); | ||||||
|         String materialSource = entity.getMaterialSource(); |  | ||||||
|         if (create) { |  | ||||||
|             if (projectId == null) { |  | ||||||
|                 throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); |  | ||||||
|             } |  | ||||||
|             if (StringUtils.isEmpty(materialSource)) { |  | ||||||
|                 throw new ServiceException("物料来源不能为空", HttpStatus.BAD_REQUEST); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         // 查询项目是否存在 |         // 查询项目是否存在 | ||||||
|         if (projectId != null && projectService.getById(projectId) == null) { |         if (projectId != null && projectService.getById(projectId) == null) { | ||||||
|             throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); |             throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); | ||||||
|  | |||||||
| @ -241,7 +241,7 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv | |||||||
|     @Override |     @Override | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     public Boolean insertByBo(MatMaterialReceiveCreateReq req) { |     public Boolean insertByBo(MatMaterialReceiveCreateReq req) { | ||||||
|         String nickname = LoginHelper.getLoginUser().getNickname(); |         String nickname = Objects.requireNonNull(LoginHelper.getLoginUser()).getNickname(); | ||||||
|         MatMaterialReceive materialReceive = new MatMaterialReceive(); |         MatMaterialReceive materialReceive = new MatMaterialReceive(); | ||||||
|         BeanUtils.copyProperties(req, materialReceive); |         BeanUtils.copyProperties(req, materialReceive); | ||||||
|         validEntityBeforeSave(materialReceive, true); |         validEntityBeforeSave(materialReceive, true); | ||||||
| @ -282,11 +282,8 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv | |||||||
|             } |             } | ||||||
|             //生成库存 |             //生成库存 | ||||||
|             materialsService.create( |             materialsService.create( | ||||||
|                 materialReceive.getProjectId(), |                 materialReceive.getProjectId(), itemList, materialReceive.getFormCode(), | ||||||
|                 itemList, |                 materialReceive.getSupplierUnit(), nickname | ||||||
|                 materialReceive.getFormCode(), |  | ||||||
|                 materialReceive.getSupplierUnit(), |  | ||||||
|                 nickname |  | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|         return true; |         return true; | ||||||
| @ -517,7 +514,7 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv | |||||||
|      * @param reportCountFileId  报表文件id |      * @param reportCountFileId  报表文件id | ||||||
|      * @param techDocCountFileId 技术文档文件id |      * @param techDocCountFileId 技术文档文件id | ||||||
|      * @param certCountFileId    证书文件id |      * @param certCountFileId    证书文件id | ||||||
|      * @param attachmentId |      * @param attachmentId       附件id | ||||||
|      */ |      */ | ||||||
|     private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId, |     private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId, | ||||||
|                              String reportCountFileId, String techDocCountFileId, String certCountFileId, String attachmentId) { |                              String reportCountFileId, String techDocCountFileId, String certCountFileId, String attachmentId) { | ||||||
|  | |||||||
| @ -1,7 +1,6 @@ | |||||||
| package org.dromara.materials.service.impl; | package org.dromara.materials.service.impl; | ||||||
|  |  | ||||||
| import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||||
| import cn.hutool.core.collection.CollectionUtil; |  | ||||||
| import cn.hutool.json.JSONObject; | import cn.hutool.json.JSONObject; | ||||||
| import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
| @ -18,10 +17,7 @@ import org.dromara.common.core.utils.StringUtils; | |||||||
| import org.dromara.common.json.utils.JsonUtils; | import org.dromara.common.json.utils.JsonUtils; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.materials.domain.MatMaterialReceive; | import org.dromara.materials.domain.*; | ||||||
| import org.dromara.materials.domain.MatMaterials; |  | ||||||
| import org.dromara.materials.domain.MatMaterialsInventory; |  | ||||||
| import org.dromara.materials.domain.MatMaterialsUseRecord; |  | ||||||
| import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; | import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; | ||||||
| import org.dromara.materials.domain.dto.materials.MatMaterialsCreateReq; | import org.dromara.materials.domain.dto.materials.MatMaterialsCreateReq; | ||||||
| import org.dromara.materials.domain.dto.materials.MatMaterialsGisReq; | import org.dromara.materials.domain.dto.materials.MatMaterialsGisReq; | ||||||
| @ -29,10 +25,8 @@ import org.dromara.materials.domain.dto.materials.MatMaterialsQueryReq; | |||||||
| import org.dromara.materials.domain.dto.materials.MatMaterialsUpdateReq; | import org.dromara.materials.domain.dto.materials.MatMaterialsUpdateReq; | ||||||
| import org.dromara.materials.domain.dto.materialsinventory.MatMaterialsInventoryCreateReq; | import org.dromara.materials.domain.dto.materialsinventory.MatMaterialsInventoryCreateReq; | ||||||
| import org.dromara.materials.domain.enums.MatMaterialsInventoryOutPutEnum; | import org.dromara.materials.domain.enums.MatMaterialsInventoryOutPutEnum; | ||||||
| import org.dromara.materials.domain.enums.MatMaterialsInventoryReceiveStatusEnum; |  | ||||||
| import org.dromara.materials.domain.vo.materials.*; | import org.dromara.materials.domain.vo.materials.*; | ||||||
| import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryOutUseVo; | import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryOutUseVo; | ||||||
| import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryOutVo; |  | ||||||
| import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryVo; | import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryVo; | ||||||
| import org.dromara.materials.domain.vo.materialsuserecord.MatMaterialsUseRecordByOutVo; | import org.dromara.materials.domain.vo.materialsuserecord.MatMaterialsUseRecordByOutVo; | ||||||
| import org.dromara.materials.mapper.MatMaterialsMapper; | import org.dromara.materials.mapper.MatMaterialsMapper; | ||||||
| @ -81,6 +75,9 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|     @Resource |     @Resource | ||||||
|     private IMatCompanyService companyService; |     private IMatCompanyService companyService; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private IMatWarehouseService warehouseService; | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询材料名称 |      * 查询材料名称 | ||||||
| @ -317,6 +314,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|         // 从对象中取值 |         // 从对象中取值 | ||||||
|         String materialsName = req.getMaterialsName(); |         String materialsName = req.getMaterialsName(); | ||||||
|         Long companyId = req.getCompanyId(); |         Long companyId = req.getCompanyId(); | ||||||
|  |         Long warehouseId = req.getWarehouseId(); | ||||||
|         Long projectId = req.getProjectId(); |         Long projectId = req.getProjectId(); | ||||||
|         String typeSpecificationName = req.getTypeSpecificationName(); |         String typeSpecificationName = req.getTypeSpecificationName(); | ||||||
|         String weightId = req.getWeightId(); |         String weightId = req.getWeightId(); | ||||||
| @ -331,7 +329,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|         lqw.eq(ObjectUtils.isNotEmpty(status), MatMaterials::getStatus, status); |         lqw.eq(ObjectUtils.isNotEmpty(status), MatMaterials::getStatus, status); | ||||||
|         lqw.eq(ObjectUtils.isNotEmpty(projectId), MatMaterials::getProjectId, projectId); |         lqw.eq(ObjectUtils.isNotEmpty(projectId), MatMaterials::getProjectId, projectId); | ||||||
|         lqw.eq(ObjectUtils.isNotEmpty(companyId), MatMaterials::getCompanyId, companyId); |         lqw.eq(ObjectUtils.isNotEmpty(companyId), MatMaterials::getCompanyId, companyId); | ||||||
|  |         lqw.eq(ObjectUtils.isNotEmpty(warehouseId), MatMaterials::getWarehouseId, warehouseId); | ||||||
|         lqw.orderByDesc(MatMaterials::getCreateTime); |         lqw.orderByDesc(MatMaterials::getCreateTime); | ||||||
|         return lqw; |         return lqw; | ||||||
|     } |     } | ||||||
| @ -368,9 +366,10 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|      */ |      */ | ||||||
|     @Async |     @Async | ||||||
|     @Override |     @Override | ||||||
|     public void create(Long projectId, List<MatMaterialReceiveItemDto> itemList, String formCode, String supplierUnit, String nickname) { |     public void create(Long projectId, List<MatMaterialReceiveItemDto> itemList, | ||||||
|  |                        String formCode, String supplierUnit, String nickname) { | ||||||
|         for (MatMaterialReceiveItemDto item : itemList) { |         for (MatMaterialReceiveItemDto item : itemList) { | ||||||
|             if(item.getAcceptedQuantity().compareTo(BigDecimal.ZERO) <= 0){ |             if (item.getAcceptedQuantity().compareTo(BigDecimal.ZERO) <= 0) { | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|             MatMaterials matMaterials = new MatMaterials(); |             MatMaterials matMaterials = new MatMaterials(); | ||||||
| @ -380,6 +379,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|             matMaterials.setWeightId(item.getUnit()); |             matMaterials.setWeightId(item.getUnit()); | ||||||
|             matMaterials.setQuantityCount(item.getQuantity().toString()); |             matMaterials.setQuantityCount(item.getQuantity().toString()); | ||||||
|             matMaterials.setFormCode(formCode); |             matMaterials.setFormCode(formCode); | ||||||
|  |             matMaterials.setWarehouseId(item.getWarehouseId()); | ||||||
|             save(matMaterials); |             save(matMaterials); | ||||||
|             Long materialsId = matMaterials.getId(); |             Long materialsId = matMaterials.getId(); | ||||||
|             MatMaterialsInventoryCreateReq req = new MatMaterialsInventoryCreateReq(); |             MatMaterialsInventoryCreateReq req = new MatMaterialsInventoryCreateReq(); | ||||||
| @ -448,18 +448,6 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|             .selectLatestByMaterialIds(materialIds) |             .selectLatestByMaterialIds(materialIds) | ||||||
|             .stream() |             .stream() | ||||||
|             .collect(Collectors.toMap(MatMaterialsInventory::getMaterialsId, Function.identity(), (a, b) -> a)); |             .collect(Collectors.toMap(MatMaterialsInventory::getMaterialsId, Function.identity(), (a, b) -> a)); | ||||||
|         // 查询出库记录 |  | ||||||
|         List<MatMaterialsInventory> outList = materialsInventoryService.lambdaQuery() |  | ||||||
|             .in(MatMaterialsInventory::getMaterialsId, materialIds) |  | ||||||
|             .eq(MatMaterialsInventory::getOutPut, MatMaterialsInventoryOutPutEnum.OUT.getValue()) |  | ||||||
|             .eq(MatMaterialsInventory::getIsReceive, MatMaterialsInventoryReceiveStatusEnum.NOT.getValue()) |  | ||||||
|             .list(); |  | ||||||
|         Map<Long, List<MatMaterialsInventory>> outMap = new HashMap<>(); |  | ||||||
|         if (CollUtil.isNotEmpty(outList)) { |  | ||||||
|             outMap = outList.stream() |  | ||||||
|                 .collect(Collectors.groupingBy(MatMaterialsInventory::getMaterialsId)); |  | ||||||
|         } |  | ||||||
|         Map<Long, List<MatMaterialsInventory>> finalOutMap = outMap; |  | ||||||
|         // 按 formCode 分组 |         // 按 formCode 分组 | ||||||
|         Map<String, List<MatMaterials>> formCodeMap = materials.stream() |         Map<String, List<MatMaterials>> formCodeMap = materials.stream() | ||||||
|             .collect(Collectors.groupingBy(MatMaterials::getFormCode)); |             .collect(Collectors.groupingBy(MatMaterials::getFormCode)); | ||||||
| @ -474,11 +462,18 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|         for (Map.Entry<String, List<MatMaterials>> entry : formCodeMap.entrySet()) { |         for (Map.Entry<String, List<MatMaterials>> entry : formCodeMap.entrySet()) { | ||||||
|             String formCode = entry.getKey(); |             String formCode = entry.getKey(); | ||||||
|             // 过滤库存为 0 的材料 |             // 过滤库存为 0 的材料 | ||||||
|             List<MatMaterials> validMaterials = entry.getValue().stream() |             List<MatMaterialsNumberVo> validMaterials = entry.getValue().stream().map(m -> { | ||||||
|                 .filter(m -> { |                     MatMaterialsNumberVo numberVo = new MatMaterialsNumberVo(); | ||||||
|                     MatMaterialsInventory inv = inventoryMap.get(m.getId()); |                     MatMaterialsInventory inv = inventoryMap.get(m.getId()); | ||||||
|                     return inv != null && inv.getResidue() > 0; |                     if (inv == null) { | ||||||
|  |                         return null; | ||||||
|  |                     } | ||||||
|  |                     BeanUtils.copyProperties(m, numberVo); | ||||||
|  |                     numberVo.setInventoryNumber(BigDecimal.valueOf(inv.getResidue())); | ||||||
|  |                     return numberVo; | ||||||
|                 }) |                 }) | ||||||
|  |                 .filter(Objects::nonNull) | ||||||
|  |                 .filter(m -> m.getInventoryNumber().compareTo(BigDecimal.ZERO) > 0) | ||||||
|                 .toList(); |                 .toList(); | ||||||
|             if (CollUtil.isEmpty(validMaterials)) { |             if (CollUtil.isEmpty(validMaterials)) { | ||||||
|                 continue; |                 continue; | ||||||
| @ -490,29 +485,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|             if (receive != null) { |             if (receive != null) { | ||||||
|                 BeanUtils.copyProperties(receive, vo); |                 BeanUtils.copyProperties(receive, vo); | ||||||
|             } |             } | ||||||
|  |             vo.setMaterials(validMaterials); | ||||||
|             List<MatMaterialsNumberVo> numberVos = new ArrayList<>(); |  | ||||||
|  |  | ||||||
|             for (MatMaterials m : validMaterials) { |  | ||||||
|                 MatMaterialsNumberVo numberVo = new MatMaterialsNumberVo(); |  | ||||||
|                 BeanUtils.copyProperties(m, numberVo); |  | ||||||
|                 MatMaterialsInventory inv = inventoryMap.get(m.getId()); |  | ||||||
|                 if (inv != null) { |  | ||||||
|                     numberVo.setInventoryNumber(BigDecimal.valueOf(inv.getNumber())); |  | ||||||
|                 } |  | ||||||
|                 if (CollUtil.isNotEmpty(finalOutMap) && finalOutMap.containsKey(m.getId())) { |  | ||||||
|                     List<MatMaterialsInventory> outs = finalOutMap.get(m.getId()); |  | ||||||
|                     numberVo.setOutList(outs.stream().map(out -> { |  | ||||||
|                         MatMaterialsInventoryOutVo outVo = new MatMaterialsInventoryOutVo(); |  | ||||||
|                         BeanUtils.copyProperties(out, outVo); |  | ||||||
|                         return outVo; |  | ||||||
|                     }).toList()); |  | ||||||
|                 } |  | ||||||
|                 if(CollectionUtil.isNotEmpty(numberVo.getOutList())){ |  | ||||||
|                     numberVos.add(numberVo); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             vo.setMaterials(numberVos); |  | ||||||
|             resultList.add(vo); |             resultList.add(vo); | ||||||
|         } |         } | ||||||
|         return resultList; |         return resultList; | ||||||
| @ -641,7 +614,15 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|                 .in(MatMaterialsUseRecord::getInventoryId, outIds) |                 .in(MatMaterialsUseRecord::getInventoryId, outIds) | ||||||
|                 .list(); |                 .list(); | ||||||
|         } |         } | ||||||
|         List<MatMaterialsUseDetailVo> useDetailList = this.getUseDetailList(materialsList, putList, outList, useList); |         // 查询仓库列表 | ||||||
|  |         Set<Long> warehouseIds = materialsList.stream().map(MatMaterials::getWarehouseId).collect(Collectors.toSet()); | ||||||
|  |         List<MatWarehouse> warehouseList = new ArrayList<>(); | ||||||
|  |         if (CollUtil.isNotEmpty(warehouseIds)) { | ||||||
|  |             warehouseList = warehouseService.lambdaQuery() | ||||||
|  |                 .in(MatWarehouse::getId, warehouseIds) | ||||||
|  |                 .list(); | ||||||
|  |         } | ||||||
|  |         List<MatMaterialsUseDetailVo> useDetailList = this.getUseDetailList(materialsList, putList, outList, useList, warehouseList); | ||||||
|         materialsVoPage.setRecords(useDetailList); |         materialsVoPage.setRecords(useDetailList); | ||||||
|         return TableDataInfo.build(materialsVoPage); |         return TableDataInfo.build(materialsVoPage); | ||||||
|     } |     } | ||||||
| @ -649,17 +630,19 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|     /** |     /** | ||||||
|      * 获取材料使用详情列表 |      * 获取材料使用详情列表 | ||||||
|      * |      * | ||||||
|      * @param materials 材料 |      * @param materials     材料 | ||||||
|      * @param putList   材料入库列表 |      * @param putList       材料入库列表 | ||||||
|      * @param outList   材料出库列表 |      * @param outList       材料出库列表 | ||||||
|      * @param useList   材料使用列表 |      * @param useList       材料使用列表 | ||||||
|  |      * @param warehouseList 仓库列表 | ||||||
|      * @return 材料使用详情列表 |      * @return 材料使用详情列表 | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
|     public List<MatMaterialsUseDetailVo> getUseDetailList(List<MatMaterials> materials, |     public List<MatMaterialsUseDetailVo> getUseDetailList(List<MatMaterials> materials, | ||||||
|                                                           List<MatMaterialsInventory> putList, |                                                           List<MatMaterialsInventory> putList, | ||||||
|                                                           List<MatMaterialsInventory> outList, |                                                           List<MatMaterialsInventory> outList, | ||||||
|                                                           List<MatMaterialsUseRecord> useList) { |                                                           List<MatMaterialsUseRecord> useList, | ||||||
|  |                                                           List<MatWarehouse> warehouseList) { | ||||||
|         Map<Long, MatMaterialsInventory> putMap = putList.stream() |         Map<Long, MatMaterialsInventory> putMap = putList.stream() | ||||||
|             .collect(Collectors.toMap(MatMaterialsInventory::getMaterialsId, inventory -> inventory, |             .collect(Collectors.toMap(MatMaterialsInventory::getMaterialsId, inventory -> inventory, | ||||||
|                 (existing, replacement) -> replacement)); |                 (existing, replacement) -> replacement)); | ||||||
| @ -700,6 +683,15 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             } |             } | ||||||
|  |             // 获取仓库名称 | ||||||
|  |             Long warehouseId = material.getWarehouseId(); | ||||||
|  |             if (CollUtil.isNotEmpty(warehouseList) && warehouseId != null) { | ||||||
|  |                 MatWarehouse warehouse = warehouseList.stream() | ||||||
|  |                     .filter(w -> w.getId().equals(warehouseId)) | ||||||
|  |                     .findFirst() | ||||||
|  |                     .orElse(null); | ||||||
|  |                 vo.setWarehouseName(warehouse != null ? warehouse.getWarehouseName() : null); | ||||||
|  |             } | ||||||
|             return vo; |             return vo; | ||||||
|         }).toList(); |         }).toList(); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -0,0 +1,140 @@ | |||||||
|  | package org.dromara.materials.service.impl; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
|  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
|  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.dromara.common.core.utils.MapstructUtils; | ||||||
|  | import org.dromara.common.core.utils.StringUtils; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.materials.domain.MatWarehouse; | ||||||
|  | import org.dromara.materials.domain.bo.MatWarehouseBo; | ||||||
|  | import org.dromara.materials.domain.vo.MatWarehouseVo; | ||||||
|  | import org.dromara.materials.mapper.MatWarehouseMapper; | ||||||
|  | import org.dromara.materials.service.IMatWarehouseService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 物资仓库Service业务层处理 | ||||||
|  |  * | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-29 | ||||||
|  |  */ | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @Service | ||||||
|  | public class MatWarehouseServiceImpl extends ServiceImpl<MatWarehouseMapper, MatWarehouse> | ||||||
|  |     implements IMatWarehouseService { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 物资仓库 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public MatWarehouseVo queryById(Long id) { | ||||||
|  |         return baseMapper.selectVoById(id); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询物资仓库列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 物资仓库分页列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public TableDataInfo<MatWarehouseVo> queryPageList(MatWarehouseBo bo, PageQuery pageQuery) { | ||||||
|  |         LambdaQueryWrapper<MatWarehouse> lqw = buildQueryWrapper(bo); | ||||||
|  |         Page<MatWarehouseVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); | ||||||
|  |         return TableDataInfo.build(result); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的物资仓库列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 物资仓库列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<MatWarehouseVo> queryList(MatWarehouseBo bo) { | ||||||
|  |         LambdaQueryWrapper<MatWarehouse> lqw = buildQueryWrapper(bo); | ||||||
|  |         return baseMapper.selectVoList(lqw); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private LambdaQueryWrapper<MatWarehouse> buildQueryWrapper(MatWarehouseBo bo) { | ||||||
|  |         Map<String, Object> params = bo.getParams(); | ||||||
|  |         LambdaQueryWrapper<MatWarehouse> lqw = Wrappers.lambdaQuery(); | ||||||
|  |         lqw.orderByDesc(MatWarehouse::getId); | ||||||
|  |         lqw.eq(bo.getProjectId() != null, MatWarehouse::getProjectId, bo.getProjectId()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getWarehouseCode()), MatWarehouse::getWarehouseCode, bo.getWarehouseCode()); | ||||||
|  |         lqw.like(StringUtils.isNotBlank(bo.getWarehouseName()), MatWarehouse::getWarehouseName, bo.getWarehouseName()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getWarehouseType()), MatWarehouse::getWarehouseType, bo.getWarehouseType()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getAddress()), MatWarehouse::getAddress, bo.getAddress()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getLng()), MatWarehouse::getLng, bo.getLng()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getLat()), MatWarehouse::getLat, bo.getLat()); | ||||||
|  |         lqw.eq(bo.getArea() != null, MatWarehouse::getArea, bo.getArea()); | ||||||
|  |         lqw.eq(bo.getCapacity() != null, MatWarehouse::getCapacity, bo.getCapacity()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getManager()), MatWarehouse::getManager, bo.getManager()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getManagerPhone()), MatWarehouse::getManagerPhone, bo.getManagerPhone()); | ||||||
|  |         return lqw; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param bo 物资仓库 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean insertByBo(MatWarehouseBo bo) { | ||||||
|  |         MatWarehouse add = MapstructUtils.convert(bo, MatWarehouse.class); | ||||||
|  |         validEntityBeforeSave(add); | ||||||
|  |         boolean flag = baseMapper.insert(add) > 0; | ||||||
|  |         if (flag) { | ||||||
|  |             bo.setId(add.getId()); | ||||||
|  |         } | ||||||
|  |         return flag; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改物资仓库 | ||||||
|  |      * | ||||||
|  |      * @param bo 物资仓库 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean updateByBo(MatWarehouseBo bo) { | ||||||
|  |         MatWarehouse update = MapstructUtils.convert(bo, MatWarehouse.class); | ||||||
|  |         validEntityBeforeSave(update); | ||||||
|  |         return baseMapper.updateById(update) > 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 保存前的数据校验 | ||||||
|  |      */ | ||||||
|  |     private void validEntityBeforeSave(MatWarehouse entity) { | ||||||
|  |         //TODO 做一些数据校验,如唯一约束 | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除物资仓库信息 | ||||||
|  |      * | ||||||
|  |      * @param ids     待删除的主键集合 | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||||
|  |         if (isValid) { | ||||||
|  |             //TODO 做一些业务上的校验,判断是否需要校验 | ||||||
|  |         } | ||||||
|  |         return baseMapper.deleteByIds(ids) > 0; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -13,10 +13,8 @@ import org.dromara.common.log.enums.BusinessType; | |||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.common.web.core.BaseController; | import org.dromara.common.web.core.BaseController; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCancelReq; | import org.dromara.vehicle.domain.dto.vehicletrip.*; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCreateReq; | import org.dromara.vehicle.domain.vo.VehVehicleTripMyVo; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripQueryReq; |  | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripUpdateReq; |  | ||||||
| import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | ||||||
| import org.dromara.vehicle.service.IVehVehicleTripService; | import org.dromara.vehicle.service.IVehVehicleTripService; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| @ -47,6 +45,15 @@ public class VehVehicleTripController extends BaseController { | |||||||
|         return vehVehicleTripService.queryPageList(req, pageQuery); |         return vehVehicleTripService.queryPageList(req, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询当前用户车辆出行记录列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("vehicle:vehicleTrip:list") | ||||||
|  |     @GetMapping("/myList") | ||||||
|  |     public R<List<VehVehicleTripMyVo>> queryMyList(VehVehicleTripMyQueryReq req) { | ||||||
|  |         return R.ok(vehVehicleTripService.queryMyList(req)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 导出车辆出行记录列表 |      * 导出车辆出行记录列表 | ||||||
|      */ |      */ | ||||||
| @ -92,6 +99,17 @@ public class VehVehicleTripController extends BaseController { | |||||||
|         return toAjax(vehVehicleTripService.updateByBo(req)); |         return toAjax(vehVehicleTripService.updateByBo(req)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改车辆出行记录状态 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("vehicle:vehicleTrip:edit") | ||||||
|  |     @Log(title = "车辆出行记录", businessType = BusinessType.UPDATE) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PutMapping("/changeStatus") | ||||||
|  |     public R<Void> changeStatus(@Validated @RequestBody VehVehicleTripChangeStatusReq req) { | ||||||
|  |         return toAjax(vehVehicleTripService.changeStatus(req)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 取消车辆出行记录 |      * 取消车辆出行记录 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -10,10 +10,8 @@ import org.dromara.common.log.enums.BusinessType; | |||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.common.web.core.BaseController; | import org.dromara.common.web.core.BaseController; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCancelReq; | import org.dromara.vehicle.domain.dto.vehicletrip.*; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCreateReq; | import org.dromara.vehicle.domain.vo.VehVehicleTripMyVo; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripQueryReq; |  | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripUpdateReq; |  | ||||||
| import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | ||||||
| import org.dromara.vehicle.service.IVehVehicleTripService; | import org.dromara.vehicle.service.IVehVehicleTripService; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| @ -43,6 +41,15 @@ public class VehVehicleTripAppController extends BaseController { | |||||||
|         return vehicleTripService.queryPageList(req, pageQuery); |         return vehicleTripService.queryPageList(req, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询当前用户车辆出行记录列表 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/myList") | ||||||
|  |     public R<List<VehVehicleTripMyVo>> queryMyList(VehVehicleTripMyQueryReq req) { | ||||||
|  |         return R.ok(vehicleTripService.queryMyList(req)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取车辆出行记录详细信息 |      * 获取车辆出行记录详细信息 | ||||||
|      * |      * | ||||||
|  | |||||||
| @ -0,0 +1,31 @@ | |||||||
|  | package org.dromara.vehicle.domain.dto.vehicletrip; | ||||||
|  |  | ||||||
|  | import jakarta.validation.constraints.NotBlank; | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-28 18:47 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class VehVehicleTripChangeStatusReq implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = -1139979225623034249L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "主键不能为空") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 状态 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "状态不能为空") | ||||||
|  |     private String tripStatus; | ||||||
|  | } | ||||||
| @ -0,0 +1,24 @@ | |||||||
|  | package org.dromara.vehicle.domain.dto.vehicletrip; | ||||||
|  |  | ||||||
|  | import jakarta.validation.constraints.NotBlank; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-28 16:53 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class VehVehicleTripMyQueryReq implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 4251601419123102085L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询类型(1待出行 2预约中 3已完成) | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "查询类型不能为空") | ||||||
|  |     private String type; | ||||||
|  | } | ||||||
| @ -4,7 +4,7 @@ import lombok.Data; | |||||||
|  |  | ||||||
| import java.io.Serial; | import java.io.Serial; | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| import java.util.Date; | import java.time.LocalDateTime; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @author lilemy |  * @author lilemy | ||||||
| @ -39,7 +39,7 @@ public class VehVehicleTripQueryReq implements Serializable { | |||||||
|     /** |     /** | ||||||
|      * 计划出发时间 |      * 计划出发时间 | ||||||
|      */ |      */ | ||||||
|     private Date startTime; |     private LocalDateTime startTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 出行人数 |      * 出行人数 | ||||||
| @ -51,4 +51,9 @@ public class VehVehicleTripQueryReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private String reviewStatus; |     private String reviewStatus; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 状态 | ||||||
|  |      */ | ||||||
|  |     private String tripStatus; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,19 +1,20 @@ | |||||||
| package org.dromara.vehicle.domain.vo; | package org.dromara.vehicle.domain.vo; | ||||||
|  |  | ||||||
| import org.dromara.vehicle.domain.VehVehicleApply; |  | ||||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||||
| import com.alibaba.excel.annotation.ExcelProperty; | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import org.dromara.common.excel.annotation.ExcelDictFormat; |  | ||||||
| import org.dromara.common.excel.convert.ExcelDictConvert; |  | ||||||
| import io.github.linpeilie.annotations.AutoMapper; | import io.github.linpeilie.annotations.AutoMapper; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  | import org.dromara.common.excel.annotation.ExcelDictFormat; | ||||||
|  | import org.dromara.common.excel.convert.ExcelDictConvert; | ||||||
|  | import org.dromara.common.translation.annotation.Translation; | ||||||
|  | import org.dromara.common.translation.constant.TransConstant; | ||||||
|  | import org.dromara.vehicle.domain.VehVehicleApply; | ||||||
|  |  | ||||||
| import java.io.Serial; | import java.io.Serial; | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 乘车申请视图对象 veh_vehicle_apply |  * 乘车申请视图对象 veh_vehicle_apply | ||||||
|  * |  * | ||||||
| @ -107,5 +108,20 @@ public class VehVehicleApplyVo implements Serializable { | |||||||
|     @ExcelProperty(value = "备注") |     @ExcelProperty(value = "备注") | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建者 | ||||||
|  |      */ | ||||||
|  |     private Long createBy; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建者名称 | ||||||
|  |      */ | ||||||
|  |     @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy") | ||||||
|  |     private String createByName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建时间 | ||||||
|  |      */ | ||||||
|  |     private Date createTime; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,142 @@ | |||||||
|  | package org.dromara.vehicle.domain.vo; | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  | import org.dromara.common.translation.annotation.Translation; | ||||||
|  | import org.dromara.common.translation.constant.TransConstant; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @author lilemy | ||||||
|  |  * @date 2025-10-28 16:45 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class VehVehicleTripMyVo implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 8905520529338036288L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键ID | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 项目ID | ||||||
|  |      */ | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 车辆ID | ||||||
|  |      */ | ||||||
|  |     private Long vehicleId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 车牌号 | ||||||
|  |      */ | ||||||
|  |     private String plateNumber; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 联系电话 | ||||||
|  |      */ | ||||||
|  |     private String passengerPhone; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 出行事由 | ||||||
|  |      */ | ||||||
|  |     private String tripReason; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 出发地 | ||||||
|  |      */ | ||||||
|  |     private String startPlace; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 目的地 | ||||||
|  |      */ | ||||||
|  |     private String endPlace; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 出发地经度 | ||||||
|  |      */ | ||||||
|  |     private String startLat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 出发地纬度 | ||||||
|  |      */ | ||||||
|  |     private String startLng; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 目的地经度 | ||||||
|  |      */ | ||||||
|  |     private String endLat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 目的地纬度 | ||||||
|  |      */ | ||||||
|  |     private String endLng; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 计划出发时间 | ||||||
|  |      */ | ||||||
|  |     private Date startTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 计划到达时间 | ||||||
|  |      */ | ||||||
|  |     private Date endTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 申请人数 | ||||||
|  |      */ | ||||||
|  |     private Integer peopleNum; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 剩余座位数 | ||||||
|  |      */ | ||||||
|  |     private Integer leftSeat; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 审核状态 | ||||||
|  |      */ | ||||||
|  |     private String reviewStatus; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 状态 | ||||||
|  |      */ | ||||||
|  |     private String tripStatus; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 备注 | ||||||
|  |      */ | ||||||
|  |     private String remark; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建者 | ||||||
|  |      */ | ||||||
|  |     private Long createBy; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建者名称 | ||||||
|  |      */ | ||||||
|  |     @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy") | ||||||
|  |     private String createByName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建时间 | ||||||
|  |      */ | ||||||
|  |     private Date createTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 是否为车主(0不是 1是) | ||||||
|  |      */ | ||||||
|  |     private Integer isVehicleOwner; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 申请列表 | ||||||
|  |      */ | ||||||
|  |     private List<VehVehicleApplyVo> applyList; | ||||||
|  | } | ||||||
| @ -4,10 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.vehicle.domain.VehVehicleTrip; | import org.dromara.vehicle.domain.VehVehicleTrip; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCancelReq; | import org.dromara.vehicle.domain.dto.vehicletrip.*; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCreateReq; | import org.dromara.vehicle.domain.vo.VehVehicleTripMyVo; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripQueryReq; |  | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripUpdateReq; |  | ||||||
| import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | ||||||
|  |  | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| @ -38,6 +36,14 @@ public interface IVehVehicleTripService extends IService<VehVehicleTrip> { | |||||||
|      */ |      */ | ||||||
|     TableDataInfo<VehVehicleTripVo> queryPageList(VehVehicleTripQueryReq req, PageQuery pageQuery); |     TableDataInfo<VehVehicleTripVo> queryPageList(VehVehicleTripQueryReq req, PageQuery pageQuery); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询当前用户车辆出行记录列表 | ||||||
|  |      * | ||||||
|  |      * @param req 列表查询条件 | ||||||
|  |      * @return 当前用户车辆出行记录列表 | ||||||
|  |      */ | ||||||
|  |     List<VehVehicleTripMyVo> queryMyList(VehVehicleTripMyQueryReq req); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询符合条件的车辆出行记录列表 |      * 查询符合条件的车辆出行记录列表 | ||||||
|      * |      * | ||||||
| @ -62,6 +68,14 @@ public interface IVehVehicleTripService extends IService<VehVehicleTrip> { | |||||||
|      */ |      */ | ||||||
|     Boolean updateByBo(VehVehicleTripUpdateReq req); |     Boolean updateByBo(VehVehicleTripUpdateReq req); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改车辆出行记录状态 | ||||||
|  |      * | ||||||
|  |      * @param req 车辆出行记录 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     Boolean changeStatus(VehVehicleTripChangeStatusReq req); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 取消车辆出行记录 |      * 取消车辆出行记录 | ||||||
|      * |      * | ||||||
|  | |||||||
| @ -8,11 +8,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.dromara.common.core.constant.HttpStatus; | import org.dromara.common.core.constant.HttpStatus; | ||||||
|  | import org.dromara.common.core.enums.BusinessStatusEnum; | ||||||
| import org.dromara.common.core.exception.ServiceException; | import org.dromara.common.core.exception.ServiceException; | ||||||
| import org.dromara.common.core.utils.StringUtils; | import org.dromara.common.core.utils.StringUtils; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; | import org.dromara.common.satoken.utils.LoginHelper; | ||||||
|  | import org.dromara.system.domain.vo.SysUserVo; | ||||||
|  | import org.dromara.system.service.ISysUserService; | ||||||
| import org.dromara.vehicle.domain.VehVehicleApply; | import org.dromara.vehicle.domain.VehVehicleApply; | ||||||
| import org.dromara.vehicle.domain.VehVehicleTrip; | import org.dromara.vehicle.domain.VehVehicleTrip; | ||||||
| import org.dromara.vehicle.domain.dto.vehicleapply.*; | import org.dromara.vehicle.domain.dto.vehicleapply.*; | ||||||
| @ -48,6 +51,8 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe | |||||||
|  |  | ||||||
|     private final ChatServerHandler chatServerHandler; |     private final ChatServerHandler chatServerHandler; | ||||||
|  |  | ||||||
|  |     private final ISysUserService userService; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询乘车申请 |      * 查询乘车申请 | ||||||
|      * |      * | ||||||
| @ -113,6 +118,15 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe | |||||||
|         if (vehicleTrip == null) { |         if (vehicleTrip == null) { | ||||||
|             throw new ServiceException("行程不存在", HttpStatus.NOT_FOUND); |             throw new ServiceException("行程不存在", HttpStatus.NOT_FOUND); | ||||||
|         } |         } | ||||||
|  |         if (vehicleTrip.getTripStatus().equals(VehTripStatusEnum.CANCELED.getValue())) { | ||||||
|  |             throw new ServiceException("行程已取消,请重新选择行程", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|  |         if (vehicleTrip.getTripStatus().equals(VehTripStatusEnum.COMPLETED.getValue())) { | ||||||
|  |             throw new ServiceException("行程已结束,请重新选择行程", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|  |         if (!vehicleTrip.getReviewStatus().equals(BusinessStatusEnum.FINISH.getStatus())) { | ||||||
|  |             throw new ServiceException("行程未通过审核,请重新选择行程", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|         boolean save = this.save(apply); |         boolean save = this.save(apply); | ||||||
|         if (!save) { |         if (!save) { | ||||||
|             throw new ServiceException("新增失败"); |             throw new ServiceException("新增失败"); | ||||||
| @ -342,7 +356,13 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe | |||||||
|     private void validEntityBeforeSave(VehVehicleApply entity) { |     private void validEntityBeforeSave(VehVehicleApply entity) { | ||||||
|         //TODO 做一些数据校验,如唯一约束 |         //TODO 做一些数据校验,如唯一约束 | ||||||
|         String passengerPhone = entity.getPassengerPhone(); |         String passengerPhone = entity.getPassengerPhone(); | ||||||
|         if (!PhoneUtil.isPhone(passengerPhone)) { |         // 如果手机号为空,则使用用户手机号 | ||||||
|  |         if (StringUtils.isBlank(passengerPhone)) { | ||||||
|  |             Long userId = LoginHelper.getUserId(); | ||||||
|  |             SysUserVo userVo = userService.selectUserById(userId); | ||||||
|  |             passengerPhone = userVo.getPhonenumber(); | ||||||
|  |         } | ||||||
|  |         if (StringUtils.isNotBlank(passengerPhone) && !PhoneUtil.isPhone(passengerPhone)) { | ||||||
|             throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST); |             throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -24,13 +24,12 @@ import org.dromara.system.service.ISysUserService; | |||||||
| import org.dromara.vehicle.domain.VehVehicleApply; | import org.dromara.vehicle.domain.VehVehicleApply; | ||||||
| import org.dromara.vehicle.domain.VehVehicleInfo; | import org.dromara.vehicle.domain.VehVehicleInfo; | ||||||
| import org.dromara.vehicle.domain.VehVehicleTrip; | import org.dromara.vehicle.domain.VehVehicleTrip; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCancelReq; | import org.dromara.vehicle.domain.dto.vehicletrip.*; | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripCreateReq; |  | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripQueryReq; |  | ||||||
| import org.dromara.vehicle.domain.dto.vehicletrip.VehVehicleTripUpdateReq; |  | ||||||
| import org.dromara.vehicle.domain.enums.VehApplyStatusEnum; | import org.dromara.vehicle.domain.enums.VehApplyStatusEnum; | ||||||
| import org.dromara.vehicle.domain.enums.VehTripStatusEnum; | import org.dromara.vehicle.domain.enums.VehTripStatusEnum; | ||||||
| import org.dromara.vehicle.domain.enums.VehVehicleInfoStatusEnum; | import org.dromara.vehicle.domain.enums.VehVehicleInfoStatusEnum; | ||||||
|  | import org.dromara.vehicle.domain.vo.VehVehicleApplyVo; | ||||||
|  | import org.dromara.vehicle.domain.vo.VehVehicleTripMyVo; | ||||||
| import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | import org.dromara.vehicle.domain.vo.VehVehicleTripVo; | ||||||
| import org.dromara.vehicle.mapper.VehVehicleTripMapper; | import org.dromara.vehicle.mapper.VehVehicleTripMapper; | ||||||
| import org.dromara.vehicle.service.IVehVehicleApplyService; | import org.dromara.vehicle.service.IVehVehicleApplyService; | ||||||
| @ -43,10 +42,7 @@ import org.springframework.context.event.EventListener; | |||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
|  |  | ||||||
| import java.util.Collection; | import java.util.*; | ||||||
| import java.util.List; |  | ||||||
| import java.util.Objects; |  | ||||||
| import java.util.Set; |  | ||||||
| import java.util.concurrent.CompletableFuture; | import java.util.concurrent.CompletableFuture; | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
| @ -97,7 +93,8 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|     public TableDataInfo<VehVehicleTripVo> queryPageList(VehVehicleTripQueryReq req, PageQuery pageQuery) { |     public TableDataInfo<VehVehicleTripVo> queryPageList(VehVehicleTripQueryReq req, PageQuery pageQuery) { | ||||||
|         Page<VehVehicleTripVo> result; |         Page<VehVehicleTripVo> result; | ||||||
|         if (StringUtils.isNotBlank(req.getEndLat()) && StringUtils.isNotBlank(req.getEndLng()) |         if (StringUtils.isNotBlank(req.getEndLat()) && StringUtils.isNotBlank(req.getEndLng()) | ||||||
|             && ObjectUtils.isNotNull(req.getEndLat()) && ObjectUtils.isNotNull(req.getEndLng())) { |             && ObjectUtils.isNotNull(req.getStartTime()) && ObjectUtils.isNotNull(req.getPeopleNum()) | ||||||
|  |             && req.getPeopleNum() >= 1) { | ||||||
|             result = baseMapper.selectVehicleTripPage(pageQuery.build(), req); |             result = baseMapper.selectVehicleTripPage(pageQuery.build(), req); | ||||||
|         } else { |         } else { | ||||||
|             result = baseMapper.selectVoPage(pageQuery.build(), buildQueryWrapper(req)); |             result = baseMapper.selectVoPage(pageQuery.build(), buildQueryWrapper(req)); | ||||||
| @ -105,6 +102,93 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|         return TableDataInfo.build(result); |         return TableDataInfo.build(result); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询当前用户车辆出行记录列表 | ||||||
|  |      * | ||||||
|  |      * @param req 列表查询条件 | ||||||
|  |      * @return 当前用户车辆出行记录列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<VehVehicleTripMyVo> queryMyList(VehVehicleTripMyQueryReq req) { | ||||||
|  |         String type = req.getType(); | ||||||
|  |         Long userId = LoginHelper.getUserId(); | ||||||
|  |         if (userId == null) { | ||||||
|  |             throw new ServiceException("请先登录", HttpStatus.UNAUTHORIZED); | ||||||
|  |         } | ||||||
|  |         // 查询数据 | ||||||
|  |         List<VehVehicleTrip> tripList = new ArrayList<>(); | ||||||
|  |         // --- 一、查询当前用户创建的行程 --- | ||||||
|  |         List<VehVehicleTrip> createdTrips = this.lambdaQuery() | ||||||
|  |             .eq(VehVehicleTrip::getCreateBy, userId) | ||||||
|  |             .eq(!"3".equals(type), VehVehicleTrip::getTripStatus, VehTripStatusEnum.READY_DEPART.getValue()) | ||||||
|  |             .eq("1".equals(type), VehVehicleTrip::getReviewStatus, BusinessStatusEnum.FINISH.getStatus()) | ||||||
|  |             .ne("2".equals(type), VehVehicleTrip::getReviewStatus, BusinessStatusEnum.FINISH.getStatus()) | ||||||
|  |             .eq("3".equals(type), VehVehicleTrip::getTripStatus, VehTripStatusEnum.COMPLETED.getValue()) | ||||||
|  |             .list(); | ||||||
|  |         // 收集行程id | ||||||
|  |         Set<Long> tripIds = createdTrips.stream() | ||||||
|  |             .map(VehVehicleTrip::getId) | ||||||
|  |             .collect(Collectors.toSet()); | ||||||
|  |         // --- 二、查询当前用户作为乘客的申请 --- | ||||||
|  |         List<VehVehicleApply> userApplies = vehicleApplyService.lambdaQuery() | ||||||
|  |             .eq(VehVehicleApply::getCreateBy, userId) | ||||||
|  |             .eq("1".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.getValue()) | ||||||
|  |             .notIn("2".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue(), VehApplyStatusEnum.ALREADY.getValue()) | ||||||
|  |             .eq("3".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue()) | ||||||
|  |             .list(); | ||||||
|  |         List<VehVehicleApply> applyList = new ArrayList<>(userApplies); | ||||||
|  |         // 收集申请对应的行程id | ||||||
|  |         tripIds.addAll(userApplies.stream() | ||||||
|  |             .map(VehVehicleApply::getTripId) | ||||||
|  |             .collect(Collectors.toSet())); | ||||||
|  |         // 收集申请id | ||||||
|  |         Set<Long> applyIds = userApplies.stream() | ||||||
|  |             .map(VehVehicleApply::getId) | ||||||
|  |             .collect(Collectors.toSet()); | ||||||
|  |         // --- 三、查询这些行程Id对应的行程(合并创建的与乘坐的) --- | ||||||
|  |         if (CollUtil.isNotEmpty(tripIds)) { | ||||||
|  |             List<VehVehicleTrip> trips = this.lambdaQuery() | ||||||
|  |                 .in(VehVehicleTrip::getId, tripIds) | ||||||
|  |                 .list(); | ||||||
|  |             tripList.addAll(trips); | ||||||
|  |         } | ||||||
|  |         // --- 四、查询这些行程对应的有效申请 --- | ||||||
|  |         if (CollUtil.isNotEmpty(tripIds)) { | ||||||
|  |             List<VehVehicleApply> applies = vehicleApplyService.lambdaQuery() | ||||||
|  |                 .in(VehVehicleApply::getTripId, tripIds) | ||||||
|  |                 .notIn(CollUtil.isNotEmpty(applyIds), VehVehicleApply::getId, applyIds) | ||||||
|  |                 .ne(VehVehicleApply::getStatus, VehApplyStatusEnum.CANCELED.getValue()) | ||||||
|  |                 .list(); | ||||||
|  |             applyList.addAll(applies); | ||||||
|  |         } | ||||||
|  |         // 整合数据 | ||||||
|  |         List<VehVehicleTripMyVo> result = new ArrayList<>(); | ||||||
|  |         if (CollUtil.isEmpty(tripList)) { | ||||||
|  |             return result; | ||||||
|  |         } | ||||||
|  |         List<VehVehicleTripMyVo> tripMyVos = new ArrayList<>(tripList.stream().map(trip -> { | ||||||
|  |             VehVehicleTripMyVo tripMyVo = new VehVehicleTripMyVo(); | ||||||
|  |             BeanUtils.copyProperties(trip, tripMyVo); | ||||||
|  |             List<VehVehicleApply> list = applyList.stream() | ||||||
|  |                 .filter(apply -> apply.getTripId().equals(trip.getId())) | ||||||
|  |                 .toList(); | ||||||
|  |             if (CollUtil.isNotEmpty(list)) { | ||||||
|  |                 // 封装数据 | ||||||
|  |                 List<VehVehicleApplyVo> applyVoList = list.stream().map(apply -> { | ||||||
|  |                     VehVehicleApplyVo applyVo = new VehVehicleApplyVo(); | ||||||
|  |                     BeanUtils.copyProperties(apply, applyVo); | ||||||
|  |                     return applyVo; | ||||||
|  |                 }).toList(); | ||||||
|  |                 tripMyVo.setApplyList(applyVoList); | ||||||
|  |             } | ||||||
|  |             tripMyVo.setIsVehicleOwner(trip.getCreateBy().equals(userId) ? 1 : 0); | ||||||
|  |             return tripMyVo; | ||||||
|  |         }).toList()); | ||||||
|  |         // 根据出行时间排序 | ||||||
|  |         tripMyVos.sort(Comparator.comparing(VehVehicleTripMyVo::getStartTime)); | ||||||
|  |         return tripMyVos; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询符合条件的车辆出行记录列表 |      * 查询符合条件的车辆出行记录列表 | ||||||
|      * |      * | ||||||
| @ -120,12 +204,10 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|     private LambdaQueryWrapper<VehVehicleTrip> buildQueryWrapper(VehVehicleTripQueryReq req) { |     private LambdaQueryWrapper<VehVehicleTrip> buildQueryWrapper(VehVehicleTripQueryReq req) { | ||||||
|         LambdaQueryWrapper<VehVehicleTrip> lqw = Wrappers.lambdaQuery(); |         LambdaQueryWrapper<VehVehicleTrip> lqw = Wrappers.lambdaQuery(); | ||||||
|         lqw.eq(req.getProjectId() != null, VehVehicleTrip::getProjectId, req.getProjectId()); |         lqw.eq(req.getProjectId() != null, VehVehicleTrip::getProjectId, req.getProjectId()); | ||||||
|         lqw.eq(StringUtils.isNotBlank(req.getEndPlace()), VehVehicleTrip::getEndPlace, req.getEndPlace()); |         lqw.like(StringUtils.isNotBlank(req.getEndPlace()), VehVehicleTrip::getEndPlace, req.getEndPlace()); | ||||||
|         lqw.eq(StringUtils.isNotBlank(req.getEndLat()), VehVehicleTrip::getEndLat, req.getEndLat()); |         lqw.ge(req.getPeopleNum() != null, VehVehicleTrip::getPeopleNum, req.getPeopleNum()); | ||||||
|         lqw.eq(StringUtils.isNotBlank(req.getEndLng()), VehVehicleTrip::getEndLng, req.getEndLng()); |  | ||||||
|         lqw.eq(req.getStartTime() != null, VehVehicleTrip::getStartTime, req.getStartTime()); |  | ||||||
|         lqw.eq(req.getPeopleNum() != null, VehVehicleTrip::getPeopleNum, req.getPeopleNum()); |  | ||||||
|         lqw.eq(req.getReviewStatus() != null, VehVehicleTrip::getReviewStatus, req.getReviewStatus()); |         lqw.eq(req.getReviewStatus() != null, VehVehicleTrip::getReviewStatus, req.getReviewStatus()); | ||||||
|  |         lqw.eq(req.getTripStatus() != null, VehVehicleTrip::getTripStatus, req.getTripStatus()); | ||||||
|         return lqw; |         return lqw; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @ -195,6 +277,72 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|         return this.updateById(trip); |         return this.updateById(trip); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改车辆出行记录状态 | ||||||
|  |      * | ||||||
|  |      * @param req 车辆出行记录 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean changeStatus(VehVehicleTripChangeStatusReq req) { | ||||||
|  |         Long id = req.getId(); | ||||||
|  |         String tripStatus = req.getTripStatus(); | ||||||
|  |         // 获取数据 | ||||||
|  |         VehVehicleTrip trip = this.getById(id); | ||||||
|  |         if (trip == null) { | ||||||
|  |             throw new ServiceException("数据不存在", HttpStatus.NOT_FOUND); | ||||||
|  |         } | ||||||
|  |         // 判断是否为申请人 | ||||||
|  |         if (!Objects.equals(trip.getCreateBy(), LoginHelper.getUserId())) { | ||||||
|  |             throw new ServiceException("您没有权限修改该申请", HttpStatus.FORBIDDEN); | ||||||
|  |         } | ||||||
|  |         String reviewStatus = trip.getReviewStatus(); | ||||||
|  |         // 判断是否通过审核 | ||||||
|  |         if (!Objects.equals(reviewStatus, BusinessStatusEnum.FINISH.getStatus())) { | ||||||
|  |             throw new ServiceException("该申请未通过审核,无法修改", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|  |         String status = trip.getTripStatus(); | ||||||
|  |         // 状态校验 | ||||||
|  |         if (Objects.equals(status, VehTripStatusEnum.CANCELED.getValue())) { | ||||||
|  |             throw new ServiceException("该申请已取消,无法修改", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|  |         if (Objects.equals(tripStatus, VehTripStatusEnum.COMPLETED.getValue()) | ||||||
|  |             && !Objects.equals(status, VehTripStatusEnum.UNDERWAY.getValue())) { | ||||||
|  |             throw new ServiceException("请先确认上车后再确认到达目的地", HttpStatus.BAD_REQUEST); | ||||||
|  |         } | ||||||
|  |         trip.setTripStatus(tripStatus); | ||||||
|  |         boolean updateApply = this.updateById(trip); | ||||||
|  |         if (!updateApply) { | ||||||
|  |             throw new ServiceException("行程信息更新失败", HttpStatus.ERROR); | ||||||
|  |         } | ||||||
|  |         // 同步修改乘客状态 | ||||||
|  |         if (Objects.equals(status, VehTripStatusEnum.COMPLETED.getValue())) { | ||||||
|  |             List<VehVehicleApply> applies = vehicleApplyService.lambdaQuery() | ||||||
|  |                 .eq(VehVehicleApply::getTripId, id) | ||||||
|  |                 .in(VehVehicleApply::getStatus, VehApplyStatusEnum.ALREADY.getValue(), VehApplyStatusEnum.CONFIRMED.getValue()) | ||||||
|  |                 .list(); | ||||||
|  |             if (CollUtil.isNotEmpty(applies)) { | ||||||
|  |                 applies.forEach(apply -> apply.setStatus(VehApplyStatusEnum.ARRIVED.getValue())); | ||||||
|  |                 boolean b = vehicleApplyService.updateBatchById(applies); | ||||||
|  |                 if (!b) { | ||||||
|  |                     throw new ServiceException("修改乘客状态失败"); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // 修改对应车辆状态 | ||||||
|  |         Long vehicleId = trip.getVehicleId(); | ||||||
|  |         if (vehicleId != null) { | ||||||
|  |             VehVehicleInfo info = new VehVehicleInfo(); | ||||||
|  |             info.setId(vehicleId); | ||||||
|  |             info.setVehicleStatus(VehVehicleInfoStatusEnum.AVAILABLE.getValue()); | ||||||
|  |             boolean update = vehicleInfoService.updateById(info); | ||||||
|  |             if (!update) { | ||||||
|  |                 throw new ServiceException("修改车辆状态失败"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 取消车辆出行记录 |      * 取消车辆出行记录 | ||||||
|      * |      * | ||||||
| @ -272,6 +420,10 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|         if (vehicleId == null && StringUtils.isBlank(plateNumber)) { |         if (vehicleId == null && StringUtils.isBlank(plateNumber)) { | ||||||
|             throw new ServiceException("车辆不能为空"); |             throw new ServiceException("车辆不能为空"); | ||||||
|         } |         } | ||||||
|  |         // 如果车辆为私有车,则审核通过 | ||||||
|  |         if (vehicleId == null) { | ||||||
|  |             entity.setReviewStatus(BusinessStatusEnum.FINISH.getStatus()); | ||||||
|  |         } | ||||||
|         // 如果手机号为空,则使用用户手机号 |         // 如果手机号为空,则使用用户手机号 | ||||||
|         if (StringUtils.isBlank(passengerPhone)) { |         if (StringUtils.isBlank(passengerPhone)) { | ||||||
|             Long userId = LoginHelper.getUserId(); |             Long userId = LoginHelper.getUserId(); | ||||||
| @ -342,9 +494,9 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper, | |||||||
|         vehicleTrip.setReviewStatus(processEvent.getStatus()); |         vehicleTrip.setReviewStatus(processEvent.getStatus()); | ||||||
|         this.updateById(vehicleTrip); |         this.updateById(vehicleTrip); | ||||||
|         if (processEvent.getStatus().equals(BusinessStatusEnum.FINISH.getStatus()) |         if (processEvent.getStatus().equals(BusinessStatusEnum.FINISH.getStatus()) | ||||||
|         || processEvent.getStatus().equals(BusinessStatusEnum.TERMINATION.getStatus()) |             || processEvent.getStatus().equals(BusinessStatusEnum.TERMINATION.getStatus()) | ||||||
|         || processEvent.getStatus().equals(BusinessStatusEnum.INVALID.getStatus()) |             || processEvent.getStatus().equals(BusinessStatusEnum.INVALID.getStatus()) | ||||||
|         || processEvent.getStatus().equals(BusinessStatusEnum.CANCEL.getStatus())) { |             || processEvent.getStatus().equals(BusinessStatusEnum.CANCEL.getStatus())) { | ||||||
|             // 获取车辆申请列表 |             // 获取车辆申请列表 | ||||||
|             VehVehicleInfo vehicleInfo = new VehVehicleInfo(); |             VehVehicleInfo vehicleInfo = new VehVehicleInfo(); | ||||||
|             vehicleInfo.setId(vehicleTrip.getVehicleId()); |             vehicleInfo.setId(vehicleTrip.getVehicleId()); | ||||||
|  | |||||||
| @ -0,0 +1,7 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" ?> | ||||||
|  | <!DOCTYPE mapper | ||||||
|  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||||
|  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||||
|  | <mapper namespace="org.dromara.materials.mapper.MatWarehouseMapper"> | ||||||
|  |  | ||||||
|  | </mapper> | ||||||
| @ -25,6 +25,10 @@ | |||||||
|         review_status, |         review_status, | ||||||
|         trip_status, |         trip_status, | ||||||
|         remark, |         remark, | ||||||
|  |         create_by, | ||||||
|  |         create_time, | ||||||
|  |         update_by, | ||||||
|  |         update_time, | ||||||
|  |  | ||||||
|         -- 1. 终点距离(米) |         -- 1. 终点距离(米) | ||||||
|         ROUND( |         ROUND( | ||||||
| @ -47,7 +51,7 @@ | |||||||
|         -- 3. 时间评分(0-100) |         -- 3. 时间评分(0-100) | ||||||
|         ROUND( |         ROUND( | ||||||
|         GREATEST(0, LEAST(100, |         GREATEST(0, LEAST(100, | ||||||
|         100 - ABS(TIMESTAMPDIFF(MINUTE, start_time, #{req.startTime})) / (30 / 100) |         100 - ABS(TIMESTAMPDIFF(MINUTE, start_time, #{req.startTime})) / (60 / 100) | ||||||
|         )), 2 |         )), 2 | ||||||
|         ) AS time_score, |         ) AS time_score, | ||||||
|  |  | ||||||
| @ -69,7 +73,7 @@ | |||||||
|         )) * 0.5) |         )) * 0.5) | ||||||
|         + |         + | ||||||
|         (GREATEST(0, LEAST(100, |         (GREATEST(0, LEAST(100, | ||||||
|         100 - ABS(TIMESTAMPDIFF(MINUTE, start_time, #{req.startTime})) / (30 / 100) |         100 - ABS(TIMESTAMPDIFF(MINUTE, start_time, #{req.startTime})) / (60 / 100) | ||||||
|         )) * 0.2) |         )) * 0.2) | ||||||
|         + |         + | ||||||
|         (CASE |         (CASE | ||||||
| @ -84,8 +88,17 @@ | |||||||
|             <if test="req.projectId != null"> |             <if test="req.projectId != null"> | ||||||
|                 AND project_id = #{req.projectId} |                 AND project_id = #{req.projectId} | ||||||
|             </if> |             </if> | ||||||
|  |             <if test="req.reviewStatus != null"> | ||||||
|  |                 AND review_status = #{req.reviewStatus} | ||||||
|  |             </if> | ||||||
|  |             <if test="req.tripStatus != null"> | ||||||
|  |                 AND trip_status = #{req.tripStatus} | ||||||
|  |             </if> | ||||||
|         </where> |         </where> | ||||||
|  |  | ||||||
|  |         -- 只保留总评分 >= 60 的数据 | ||||||
|  |         HAVING total_score >= 60 | ||||||
|  |  | ||||||
|         ORDER BY total_score DESC |         ORDER BY total_score DESC | ||||||
|     </select> |     </select> | ||||||
|  |  | ||||||
|  | |||||||
| @ -1875,3 +1875,50 @@ create table sub_user_salary_period | |||||||
|     index `idx_project_id` (`project_id` asc) using btree comment '项目ID', |     index `idx_project_id` (`project_id` asc) using btree comment '项目ID', | ||||||
|     index `idx_period_id` (`period_id` asc) using btree comment '工资周期ID' |     index `idx_period_id` (`period_id` asc) using btree comment '工资周期ID' | ||||||
| ) comment '员工工资周期表' collate = utf8mb4_unicode_ci; | ) comment '员工工资周期表' collate = utf8mb4_unicode_ci; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | drop table if exists mat_warehouse; | ||||||
|  | create table mat_warehouse | ||||||
|  | ( | ||||||
|  |     `id`             bigint                             not null auto_increment comment '主键id', | ||||||
|  |     `project_id`     bigint                             not null comment '项目id', | ||||||
|  |     `warehouse_code` varchar(64)                        not null comment '仓库编号', | ||||||
|  |     `warehouse_name` varchar(128)                       not null comment '仓库名称', | ||||||
|  |     `warehouse_type` varchar(16)                        not null comment '仓库类型', | ||||||
|  |     `address`        varchar(256)                       null comment '仓库地址', | ||||||
|  |     `lng`            varchar(32)                        null comment '经度', | ||||||
|  |     `lat`            varchar(32)                        null comment '纬度', | ||||||
|  |     `area`           decimal(12, 2)                     null comment '仓库面积', | ||||||
|  |     `capacity`       decimal(12, 2)                     null comment '存放容量', | ||||||
|  |     `manager`        varchar(64)                        null comment '负责人', | ||||||
|  |     `manager_phone`  varchar(32)                        null comment '负责人电话', | ||||||
|  |     `remark`         varchar(512)                       null comment '备注', | ||||||
|  |     `create_by`      bigint                             null comment '创建者', | ||||||
|  |     `update_by`      bigint                             null comment '更新者', | ||||||
|  |     `create_dept`    bigint                             null comment '创建部门', | ||||||
|  |     `create_time`    datetime default CURRENT_TIMESTAMP null comment '创建时间', | ||||||
|  |     `update_time`    datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', | ||||||
|  |     primary key (`id`) using btree, | ||||||
|  |     index `idx_project_id` (`project_id` asc) using btree comment '项目ID' | ||||||
|  | ) comment '物资仓库'; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | -- 菜单 SQL | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939905, '物资仓库', '1953994827229114369', '1', 'warehouse', 'materials/warehouse/index', 1, 0, 'C', '0', '0', 'materials:warehouse:list', '#', 103, 1, sysdate(), null, null, '物资仓库菜单'); | ||||||
|  |  | ||||||
|  | -- 按钮 SQL | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939906, '物资仓库查询', 1983374316882939905, '1',  '#', '', 1, 0, 'F', '0', '0', 'materials:warehouse:query',        '#', 103, 1, sysdate(), null, null, ''); | ||||||
|  |  | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939907, '物资仓库新增', 1983374316882939905, '2',  '#', '', 1, 0, 'F', '0', '0', 'materials:warehouse:add',          '#', 103, 1, sysdate(), null, null, ''); | ||||||
|  |  | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939908, '物资仓库修改', 1983374316882939905, '3',  '#', '', 1, 0, 'F', '0', '0', 'materials:warehouse:edit',         '#', 103, 1, sysdate(), null, null, ''); | ||||||
|  |  | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939909, '物资仓库删除', 1983374316882939905, '4',  '#', '', 1, 0, 'F', '0', '0', 'materials:warehouse:remove',       '#', 103, 1, sysdate(), null, null, ''); | ||||||
|  |  | ||||||
|  | insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) | ||||||
|  | values(1983374316882939910, '物资仓库导出', 1983374316882939905, '5',  '#', '', 1, 0, 'F', '0', '0', 'materials:warehouse:export',       '#', 103, 1, sysdate(), null, null, ''); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user