diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java index b7ad19e7..0b2f14aa 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java @@ -1,10 +1,14 @@ package com.bonus.common.biz.constant; /** - * 仓储站点配置项 + * 机具站点配置项 * * @author bonus */ public class BmConfigItems { public static final String LEASE_TASK_AUDIT_ROLE_KEYS = "LeaseTaskAuditRoleKeys"; + public static final String BACK_TASK_AUDIT_ROLE_KEYS = "BackTaskAuditRoleKeys"; + + + } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java index bac92021..5e82349d 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java @@ -5,20 +5,27 @@ package com.bonus.common.biz.constant; * * @author bonus */ -public class MaterialConstants -{ - private MaterialConstants(){} +public class MaterialConstants { + + private MaterialConstants() { + + } + /** * UTF-8 字符集 */ public static final String UTF8 = "UTF-8"; /** -<<<<<<< HEAD * 领料任务类型 */ public static final Long LEASE_TASK_TYPE = 2L; + /** + * 退料任务类型 + */ + public static final Long BACK_TASK_TYPE = 3L; + /** * XLS */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java index 77cddc54..1e5c4ac5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java @@ -45,7 +45,7 @@ public class BmUnitController extends BaseController * 查询往来单位管理列表 */ @ApiOperation(value = "查询往来单位管理列表") - @RequiresPermissions("basic:unit:list") + //@RequiresPermissions("basic:unit:list") @GetMapping("/list") public TableDataInfo list(BmUnit bmUnit) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java index d9ca7f77..92e79f81 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java @@ -4,65 +4,49 @@ import java.util.List; import com.bonus.material.basic.domain.BmFileInfo; /** - * 附件 -Mapper接口 - * + * 附件Mapper接口 * @author xsheng - * @date 2024-09-26 */ -public interface BmFileInfoMapper -{ +public interface BmFileInfoMapper { /** * 查询附件 - - * - * @param id 附件 -主键 + * + * @param id 附件主键 * @return 附件 - */ - public BmFileInfo selectBmFileInfoById(Long id); + BmFileInfo selectBmFileInfoById(Long id); /** - * 查询附件 -列表 - * + * 查询附件列表 + * * @param bmFileInfo 附件 - - * @return 附件 -集合 + * @return 附件集合 */ - public List selectBmFileInfoList(BmFileInfo bmFileInfo); + List selectBmFileInfoList(BmFileInfo bmFileInfo); /** * 新增附件 - - * + * * @param bmFileInfo 附件 - * @return 结果 */ - public int insertBmFileInfo(BmFileInfo bmFileInfo); + int insertBmFileInfo(BmFileInfo bmFileInfo); /** * 修改附件 - - * + * * @param bmFileInfo 附件 - * @return 结果 */ - public int updateBmFileInfo(BmFileInfo bmFileInfo); + int updateBmFileInfo(BmFileInfo bmFileInfo); /** * 删除附件 - - * - * @param id 附件 -主键 + * + * @param id 附件主键 * @return 结果 */ - public int deleteBmFileInfoById(Long id); + int deleteBmFileInfoById(Long id); /** * 批量删除附件 @@ -71,5 +55,5 @@ public interface BmFileInfoMapper * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deleteBmFileInfoByIds(Long[] ids); + int deleteBmFileInfoByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java index 08ebcb88..d7eef2cd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java @@ -69,4 +69,6 @@ public interface IBmConfigService public int deleteBmConfigById(Long id); public List getLeaseTaskAuditRoleKeys(); + + public List getBackTaskAuditRoleKeys(); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java index 625dcf7e..81cd0bac 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java @@ -131,4 +131,16 @@ public class BmConfigServiceImpl implements IBmConfigService } return list; } + + public List getBackTaskAuditRoleKeys() { + List list = new ArrayList(); + BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_KEYS); + if (Objects.nonNull(bmConfig)) { + String value = getValueWithDefault(bmConfig.getItemValue(), ""); + if (StringUtils.isNotEmpty(value)) { + list = Arrays.asList(value.split(",")); + } + } + return list; + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java index 869d60f5..497ed2c1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java @@ -98,7 +98,7 @@ public class BmUnitServiceImpl implements IBmUnitService } } } catch (Exception e) { - log.error("远程调用查询失败:", e.getMessage()); + log.error("远程服务调用查询失败:", e.getMessage()); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java new file mode 100644 index 00000000..4919a6cf --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java @@ -0,0 +1,51 @@ +package com.bonus.material.ma; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma + * @CreateTime: 2024-10-16 15:50 + * @Description: 物资类型配置请求封装DTO + */ +@Data +@ToString +public class MaTypeConfigDto implements java.io.Serializable { + + /** + * 配置id + */ + private Long id; + + /** + * 物资类型id + */ + @NotNull(message = "物资类型id不能为空") + private Long typeId; + + /** + * 左侧Tree层级用户id + */ + @NotNull(message = "用户id不能为空") + private Long userId; + + /** + * 绑定标识 1:绑定, 2:解绑 + */ + @ApiModelProperty(value = "绑定标识 1:绑定, 2:解绑") + @NotNull(message = "绑定标识不能为空") + private Integer bindFlag; + + /** + * 绑定角色类型: 1:库管员,2:维修员 + */ + @ApiModelProperty(value = "绑定角色类型: 1:库管员,2:维修员") + @NotNull(message = "绑定角色类型不能为空") + private Integer bindRoleType; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java new file mode 100644 index 00000000..975aa8de --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -0,0 +1,124 @@ +package com.bonus.material.ma.controller; + +import com.bonus.common.biz.domain.TreeSelect; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.annotation.PreventRepeatSubmit; +import com.bonus.common.security.annotation.RequiresPermissions; +import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.domain.TypeKeeper; +import com.bonus.material.ma.domain.TypeRepair; +import com.bonus.material.ma.service.ITypeKeeperService; +import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.service.MaTypeConfigService; +import com.bonus.material.ma.vo.MaTypeConfigVo; +import com.google.common.collect.ImmutableList; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.*; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.controller + * @CreateTime: 2024-10-16 10:52 + * @Description: 物资类型配置API + */ +@Api(tags = "物资类型配置API") +@RestController +@RequestMapping("/ma_type_config") +public class MaTypeConfigController extends BaseController { + + @Resource + private MaTypeConfigService maTypeConfigService; + + @ApiOperation(value = "配置物资类型绑定信息") + @PreventRepeatSubmit + @RequiresPermissions("ma:typeConfig:edit") + @PostMapping("/updateMaTypeBindInfo") + public AjaxResult updateMaTypeBindInfo(@RequestBody @Valid @NotNull MaTypeConfigDto maTypeConfigDto) { + // -------------------- 数据校验开始 --------------------- + + // 1.判断绑定标识是否为空 + if (maTypeConfigDto.getBindFlag() == null) { + return error("绑定标识不能为空"); + } + // 2.判断绑定角色类型是否为空 + if (maTypeConfigDto.getBindRoleType() == null) { + return error("绑定角色类型不能为空"); + } + // 3.判断用户id是否为空 + if (maTypeConfigDto.getUserId() == null) { + return error("用户id不能为空"); + } + + // ---------------- 数据校验结束 --------------------- + + // 执行业务逻辑 + return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); + } + + + + /** + * 查询物资类型配置右侧列表 + */ + @ApiOperation(value = "查询物资类型配置右侧列表") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getMaTypeConfigList") + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 调用service处理业务逻辑 + return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); + } + + + /** + * 查询物资配置左侧组织人员树-tree + */ + @ApiOperation(value = "查询物资配置左侧组织人员树") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getDeptUserTree") + public AjaxResult getDeptUserTree() { + + // ---------- 模拟人员Tree数据 --------------- + + // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 + List treeSelectList1 = new ArrayList<>(); + TreeSelect treeSelect1 = new TreeSelect(1L, "机具设备分公司", 1, null); + TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); + TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); + + // 2. 给公司级部门添加子部门 ,创建TreeSelect集合,存放组织部门--部门级 + TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); + TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); + TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); + + // 3. 创建部门人员 + TreeSelect treeSelect001 = new TreeSelect(117L, "袁泷", 3, 11L); + TreeSelect treeSelect002 = new TreeSelect(133L, "喵喵喵", 3, 11L); + TreeSelect treeSelect003 = new TreeSelect(129L, "村上春树", 3, 12L); + + // 4. 把子部门人员添加到子部门中 + treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); + treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); + treeSelect03.setChildren(ImmutableList.of(treeSelect003)); + treeSelect3.setChildren(Collections.singletonList(treeSelect03)); + + // 3.把根节点添加到集合中 + treeSelectList1.add(treeSelect1); + treeSelectList1.add(treeSelect2); + treeSelectList1.add(treeSelect3); + + // -------------- 模拟人员Tree数据结束 ------------------ + + return success(treeSelectList1); + } + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java index ea8163fe..b4a50319 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java @@ -82,7 +82,7 @@ public class SupplierInfoController extends BaseController { @SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理") @PostMapping public AjaxResult add(@RequestBody SupplierInfo supplierInfo) { - return toAjax(supplierInfoService.insertSupplierInfo(supplierInfo)); + return supplierInfoService.insertSupplierInfo(supplierInfo); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index 9589a5da..e8571ea0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -48,7 +48,7 @@ public class TypeController extends BaseController { @GetMapping("/list") public TableDataInfo list(MaTypeListVo type) { startPage(); - List list = typeService.selectTypeListAndParent(type); + List list = typeService.selectTypeListAndParentInfo(type); return getDataTable(list); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java index b328de4f..7b3b00e5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java @@ -28,7 +28,7 @@ import com.bonus.common.core.web.page.TableDataInfo; * 库管员配置Controller * @author bonus */ -@Api(tags = "库管员配置接口") +@Api(tags = "库管员配置API") @RestController @RequestMapping("/ma_type_keeper") public class TypeKeeperController extends BaseController { @@ -54,7 +54,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "导出库管员配置列表") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:export") - @SysLog(title = "库管员配置", businessType = OperaType.EXPORT, module = "仓储管理->导出库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.EXPORT, module = "物资管理->导出库管员配置") @PostMapping("/export") public void export(HttpServletResponse response, TypeKeeper typeKeeper) { List list = typeKeeperService.selectTypeKeeperList(typeKeeper); @@ -78,7 +78,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "新增库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:add") - @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "仓储管理->新增库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "物资管理->新增库管员配置") @PostMapping public AjaxResult add(@RequestBody TypeKeeper typeKeeper) { return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper)); @@ -90,22 +90,35 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "修改库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:edit") - @SysLog(title = "库管员配置", businessType = OperaType.UPDATE, module = "仓储管理->修改库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.UPDATE, module = "物资管理->修改库管员配置") @PutMapping public AjaxResult edit(@RequestBody TypeKeeper typeKeeper) { return toAjax(typeKeeperService.updateTypeKeeper(typeKeeper)); } /** - * 删除库管员配置 + * 批量删除库管员配置 */ - @ApiOperation(value = "删除库管员配置") + @ApiOperation(value = "批量删除库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:remove") - @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "仓储管理->删除库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "物资管理->批量删除库管员配置") @DeleteMapping("/{IDs}") public AjaxResult remove(@PathVariable Long[] IDs) { return toAjax(typeKeeperService.deleteTypeKeeperByIDs(IDs)); } + + /** + * 删除单个库管员配置 + */ + @ApiOperation(value = "删除单个库管员配置") + @PreventRepeatSubmit + @RequiresPermissions("ma:keeper:remove") + @SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "物资管理->删除单个库管员配置") + @DeleteMapping + public AjaxResult remove(@RequestBody TypeKeeper typeKeeper) + { + return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeeper)); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java index 024021af..fb6286d2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java @@ -104,15 +104,28 @@ public class TypeRepairController extends BaseController } /** - * 删除维修班机具配置 + * 批量删除维修班机具配置 */ - @ApiOperation(value = "删除维修班机具配置") + @ApiOperation(value = "批量删除维修班机具配置") @PreventRepeatSubmit @RequiresPermissions("ma:repair:remove") - @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除维修班机具配置") + @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->批量删除维修班机具配置") @DeleteMapping("/{IDs}") public AjaxResult remove(@PathVariable Long[] IDs) { return toAjax(typeRepairService.deleteTypeRepairByIDs(IDs)); } + + /** + * 删除单个维修班机具配置 + */ + @ApiOperation(value = "删除单个维修班机具配置") + @PreventRepeatSubmit + @RequiresPermissions("ma:repair:remove") + @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除单个维修班机具配置") + @DeleteMapping + public AjaxResult remove(@RequestBody TypeRepair typeRepair) + { + return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepair)); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java index 71f67ca1..9252b4ce 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java @@ -1,11 +1,15 @@ package com.bonus.material.ma.domain; import com.bonus.common.core.annotation.Excel; +import com.bonus.system.api.domain.SysFile; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; /** * 物资厂家管理对象 ma_supplier_info @@ -54,8 +58,8 @@ public class SupplierInfo extends BaseEntity { private String businessScope; /** 营业执照 */ - @Excel(name = "营业执照") - @ApiModelProperty(value = "营业执照") + @Excel(name = "营业执照URL") + @ApiModelProperty(value = "营业执照URL") private String businessLicense; /** 删除标志(0代表存在 2代表删除) */ @@ -71,5 +75,10 @@ public class SupplierInfo extends BaseEntity { @ApiModelProperty(value = "状态(0开 1关)") private Long status; + /** + * 营业执照文件列表 + */ + @ApiModelProperty(value = "营业执照文件列表") + List businessLicenseFileList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java index 6de6e0c2..922d9bdd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java @@ -33,6 +33,10 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "类型名称") private String typeName; + /** 仓库名称 */ + @ApiModelProperty(value = "物资仓库名称") + private String houseName; + /** 上级ID */ @Excel(name = "上级ID") @ApiModelProperty(value = "上级ID") @@ -41,7 +45,15 @@ public class Type extends BaseEntity { /** 实时库存 */ @Excel(name = "实时库存") @ApiModelProperty(value = "实时库存") - private Long storageNum; + private Long storageNum = 0L; + + /** 是否扣费 */ + @ApiModelProperty(value = "是否扣费,0:扣费, 1:不扣费") + private Byte isCharging = 1; + + /** 检验周期 */ + @ApiModelProperty(value = "检验周期,单位:月") + private Integer testCycle = 0; /** 类型编号 */ @Excel(name = "类型编号") @@ -58,6 +70,10 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "计量单位ID") private Long unitId; + /** 计量单位名称 */ + @ApiModelProperty(value = "计量单位名称") + private String unitName; + /** 管理方式(0编号 1计数) */ @Excel(name = "管理方式(0编号 1计数)") @ApiModelProperty(value = "管理方式(0编号 1计数)") @@ -89,6 +105,14 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "丢失赔偿比率") private BigDecimal payRatio; + /** 丢失赔偿价 */ + @ApiModelProperty(value = "丢失赔偿价") + private BigDecimal payPrice; + + /** 税率 */ + @ApiModelProperty(value = "税率") + private BigDecimal taxRatio; + /** 层级 */ @Excel(name = "层级") @ApiModelProperty(value = "层级") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java index 660b4187..b16a3bfc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java @@ -41,5 +41,10 @@ public class TypeKeeper extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private String companyId; + public TypeKeeper(Long typeId, Long userId) { + this.typeId = typeId; + this.userId = userId; + } + public TypeKeeper() {} } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java index ba7fe586..7b0b44dc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java @@ -3,21 +3,20 @@ package com.bonus.material.ma.domain; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 维修班机具配置对象 ma_type_repair - * - * @author xsheng - * @date 2024-09-27 + * + * @author syruan */ - +@EqualsAndHashCode(callSuper = false) @Data @ToString -public class TypeRepair extends BaseEntity -{ +public class TypeRepair extends BaseEntity { private static final long serialVersionUID = 1L; /** ID */ @@ -31,10 +30,19 @@ public class TypeRepair extends BaseEntity @ApiModelProperty(value = "用户") private Long userId; + @ApiModelProperty(value = "用户姓名") + private String userName; + /** 数据所属组织 */ @Excel(name = "数据所属组织") @ApiModelProperty(value = "数据所属组织") private Long companyId; + public TypeRepair() {} + + public TypeRepair(Long typeId, Long userId) { + this.typeId = typeId; + this.userId = userId; + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java index 4dc372fd..c5c195a9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java @@ -17,6 +17,11 @@ public interface TypeKeeperMapper { */ TypeKeeper selectTypeKeeperByID(Long ID); + /** + * 根据用户ID和物资类型ID查询库管员配置 + */ + TypeKeeper selectTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); + /** * 查询库管员配置列表 * @@ -25,6 +30,11 @@ public interface TypeKeeperMapper { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * @@ -49,6 +59,11 @@ public interface TypeKeeperMapper { */ int deleteTypeKeeperByID(Long ID); + /** + * 根据用户ID和物资类型ID删除库管员配置 + */ + int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); + /** * 批量删除库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java index 30af360e..95d81f94 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper; import java.util.List; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.apache.ibatis.annotations.Mapper; @@ -66,6 +67,20 @@ public interface TypeMapper { List selectTypeListAndParent(Type typeListVo); + /** + * 查询四级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectFourLevelTypeListAndParent(Type type); + + /** + * 查询三级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectThreeLevelTypeListAndParent(Type type); + /** * 新增物资类型 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java index e2a2fd4f..ff7b9088 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java @@ -9,15 +9,14 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface TypeRepairMapper -{ +public interface TypeRepairMapper { /** * 查询维修班机具配置 * * @param ID 维修班机具配置主键 * @return 维修班机具配置 */ - public TypeRepair selectTypeRepairByID(Long ID); + TypeRepair selectTypeRepairByID(Long ID); /** * 查询维修班机具配置列表 @@ -25,7 +24,12 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 维修班机具配置集合 */ - public List selectTypeRepairList(TypeRepair typeRepair); + List selectTypeRepairList(TypeRepair typeRepair); + + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); /** * 新增维修班机具配置 @@ -33,7 +37,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int insertTypeRepair(TypeRepair typeRepair); + int insertTypeRepair(TypeRepair typeRepair); /** * 修改维修班机具配置 @@ -41,7 +45,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int updateTypeRepair(TypeRepair typeRepair); + int updateTypeRepair(TypeRepair typeRepair); /** * 删除维修班机具配置 @@ -49,7 +53,7 @@ public interface TypeRepairMapper * @param ID 维修班机具配置主键 * @return 结果 */ - public int deleteTypeRepairByID(Long ID); + int deleteTypeRepairByID(Long ID); /** * 批量删除维修班机具配置 @@ -57,5 +61,12 @@ public interface TypeRepairMapper * @param IDs 需要删除的数据主键集合 * @return 结果 */ - public int deleteTypeRepairByIDs(Long[] IDs); + int deleteTypeRepairByIDs(Long[] IDs); + + /** + * 根据用户id和类型id删除配置记录 + * @param typeRepair + * @return + */ + int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java index 3226fe8d..61b02eb3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java @@ -1,6 +1,8 @@ package com.bonus.material.ma.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.ma.domain.SupplierInfo; /** @@ -31,7 +33,7 @@ public interface ISupplierInfoService { * @param supplierInfo 物资厂家管理 * @return 结果 */ - int insertSupplierInfo(SupplierInfo supplierInfo); + AjaxResult insertSupplierInfo(SupplierInfo supplierInfo); /** * 修改物资厂家管理 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java index 701e600f..6a129bda 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java @@ -23,6 +23,11 @@ public interface ITypeKeeperService { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * @@ -54,4 +59,12 @@ public interface ITypeKeeperService { * @return 结果 */ int deleteTypeKeeperByID(Long ID); + + /** + * 根据用户ID和物资类型ID删除库管员配置信息 + * + * @param typeKeeper + * @return + */ + int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java index 53bd6412..8c7382da 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java @@ -9,8 +9,7 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface ITypeRepairService -{ +public interface ITypeRepairService { /** * 查询维修班机具配置 * @@ -27,6 +26,11 @@ public interface ITypeRepairService */ public List selectTypeRepairList(TypeRepair typeRepair); + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); + /** * 新增维修班机具配置 * @@ -58,4 +62,9 @@ public interface ITypeRepairService * @return 结果 */ public int deleteTypeRepairByID(Long ID); + + /** + * 根据用户id和类型id删除配置信息 + */ + int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index 6ea729cc..79548d23 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -4,6 +4,7 @@ import java.util.List; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; @@ -40,7 +41,14 @@ public interface ITypeService { */ List selectTypeList(Type type); - List selectTypeListAndParent(Type type); + List selectTypeListAndParentInfo(Type type); + + + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * @param type 参数 + */ + List selectThreeFourLevelTypeListAndParent(Type type); /** * 新增物资类型 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java new file mode 100644 index 00000000..029e5026 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java @@ -0,0 +1,18 @@ +package com.bonus.material.ma.service; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.MaTypeConfigDto; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.service + * @CreateTime: 2024-10-16 18:50 + * @Description: 物资类型配置Service + */ +public interface MaTypeConfigService{ + + AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto); + + AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java new file mode 100644 index 00000000..37d1f000 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java @@ -0,0 +1,187 @@ +package com.bonus.material.ma.service.impl; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.domain.TypeKeeper; +import com.bonus.material.ma.domain.TypeRepair; +import com.bonus.material.ma.service.ITypeKeeperService; +import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.service.MaTypeConfigService; +import com.bonus.material.ma.vo.MaTypeConfigVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.service.impl + * @CreateTime: 2024-10-16 18:50 + * @Description: 描述 + */ +@Service +public class MaTypeConfigServiceImpl implements MaTypeConfigService { + + /** + * 物资类型库管员配置Service + */ + @Resource + private ITypeKeeperService typeKeeperService; + + /** + * 物资类型维修员配置Service + */ + @Resource + private ITypeRepairService typeRepairService; + + // 物资类型Service + @Resource + private ITypeService typeService; + + + @Override + public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { + int result; + switch (maTypeConfigDto.getBindFlag()) { + case 1: + result = handleBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); + case 2: + result = handleUnBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); + default: + // 处理其他情况或抛出异常 + return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); + } + } + + @Override + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 1.把所有物资类型查出来 + List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); + // 2.把维修配置信息查出来 + List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); + // 3.把库管配置信息查出来 + List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); + + // ------------------- 开启数据处理 --------------------- + + // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 + for (MaTypeConfigVo typeConfigVo1 : list) { + // 1.外层 先对比维修班组 + for (TypeRepair typeRepair : typeRepairList) { + // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把维修员信息设置到物资类型配置信息中 + typeConfigVo1.setRepairUserId(typeRepair.getUserId()); + typeConfigVo1.setRepairUserName(typeRepair.getUserName()); + break; + } + } + // 1.外层 再对比库管班组 + for (TypeKeeper typeKeeper : typeKeeperList) { + // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把库管员信息设置到物资类型配置信息中 + typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); + } + } + + // 5.判断当前物资类型配置信息是否有子节点 + if (typeConfigVo1.getChildren() != null) { + // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 + for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { + // 7.有维修配置信息,把维修员信息设置到子节点中 + for (TypeRepair typeRepair : typeRepairList) { + if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { + typeConfigVo2.setRepairUserId(typeRepair.getUserId()); + typeConfigVo2.setRepairUserName(typeRepair.getUserName()); + } + } + } + + // 8.有子节点,继续循环子节点, + for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { + // 9.判断子节点是否有库管配置信息 + for (TypeKeeper typeKeeper : typeKeeperList) { + if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { + typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + } + + } + + // -------------------- 数据处理结束 --------------------- + + // TODO: 先暂时取消后续过滤流程 + if (true) { + return AjaxResult.success(list); + } + + + // ------------------- 数据过滤开始 --------------------- + if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { + // 如果参数无效,则返回原始列表 + return AjaxResult.success(list); + } + + List filteredList = new ArrayList<>(); + + for (MaTypeConfigVo maTypeConfigVo : list) { + if ( + maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || + maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) + ) + { + filteredList.add(maTypeConfigVo); + } + } + + // ------------------- 数据过滤结束 --------------------- + + + // 返回前端 + return AjaxResult.success(filteredList); + } + + + private int handleBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } + + private int handleUnBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java index ba057dfe..e5dd6512 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java @@ -1,8 +1,13 @@ package com.bonus.material.ma.service.impl; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + import com.bonus.common.core.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.basic.domain.BmFileInfo; +import com.bonus.material.basic.mapper.BmFileInfoMapper; +import com.bonus.system.api.RemoteFileService; import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.SupplierInfoMapper; import com.bonus.material.ma.domain.SupplierInfo; @@ -17,9 +22,17 @@ import javax.annotation.Resource; */ @Service public class SupplierInfoServiceImpl implements ISupplierInfoService { + public static final long MODEL_ID = 16L; + @Resource private SupplierInfoMapper supplierInfoMapper; + @Resource + private RemoteFileService remoteFileService; + + @Resource + private BmFileInfoMapper bmFileInfoMapper; + /** * 查询物资厂家管理 * @@ -49,9 +62,45 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService { * @return 结果 */ @Override - public int insertSupplierInfo(SupplierInfo supplierInfo) { + public AjaxResult insertSupplierInfo(SupplierInfo supplierInfo) { supplierInfo.setCreateTime(DateUtils.getNowDate()); - return supplierInfoMapper.insertSupplierInfo(supplierInfo); + int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo); + if (insertedSupplierInfoResult > 0) { + if (supplierInfo.getBusinessLicenseFileList() == null) { + return AjaxResult.success("新增任务成功,无营业执照附件"); + } + AtomicBoolean addFileInfoResult = new AtomicBoolean(false); + supplierInfo.getBusinessLicenseFileList().forEach(file -> { + BmFileInfo bmFileInfo = new BmFileInfo(); + if (file.getName() != null) { + bmFileInfo.setFileName(file.getName()); + } + bmFileInfo.setFileUrl(file.getUrl()); + // TODO: 此处需要修改为字典表中定义的Model模块id + bmFileInfo.setModelId(MODEL_ID); + addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0); + }); + return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,附件表插入0条"); + } else { + return AjaxResult.error("新增任务失败,info表插入0条"); + } + + + + +// if (insertedSupplierInfoResult > 0 && ArrayUtil.isNotEmpty(supplierInfo.getFiles())) { +// AjaxResult uploadedFilesResult = remoteFileService.uploadFile(supplierInfo.getFiles()); +// if (uploadedFilesResult.isSuccess()) { +// Object uploadFilesResultData = uploadedFilesResult.get("data"); +// if (uploadFilesResultData != null) { +// if (uploadFilesResultData instanceof List) { +// +// } +// } +// } else { +// return AjaxResult.error("新增任务失败,文件上传失败:" + uploadedFilesResult.get("msg")); +// } +// } } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java index 0da9dd02..dc6b184b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java @@ -11,8 +11,7 @@ import com.bonus.material.ma.service.ITypeKeeperService; /** * 库管员配置Service业务层处理 * - * @author xsheng - * @date 2024-09-27 + * @author syruan */ @Service public class TypeKeeperServiceImpl implements ITypeKeeperService { @@ -42,6 +41,16 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { return typeKeeperMapper.selectTypeKeeperList(typeKeeper); } + /** + * 查询库管员配置列表-并关联查询用户名称 + * + * @param typeKeeper 查询条件 + */ + @Override + public List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper) { + return typeKeeperMapper.selectTypeKeeperListAndUserName(typeKeeper); + } + /** * 新增库管员配置 * @@ -78,7 +87,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { } /** - * 删除库管员配置信息 + * 根据主键id删除库管员配置信息 * * @param ID 库管员配置主键 * @return 结果 @@ -88,4 +97,15 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { { return typeKeeperMapper.deleteTypeKeeperByID(ID); } + + /** + * 根据用户ID和物资类型ID删除库管员配置信息 + * + * @param typeKeeper + * @return + */ + @Override + public int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper) { + return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeeper); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java index 83d43a8a..be717e8a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java @@ -15,8 +15,8 @@ import com.bonus.material.ma.service.ITypeRepairService; * @date 2024-09-27 */ @Service -public class TypeRepairServiceImpl implements ITypeRepairService -{ +public class TypeRepairServiceImpl implements ITypeRepairService { + @Autowired private TypeRepairMapper typeRepairMapper; @@ -44,6 +44,16 @@ public class TypeRepairServiceImpl implements ITypeRepairService return typeRepairMapper.selectTypeRepairList(typeRepair); } + /** + * 查询配置列表并关联查询用户姓名 + * + * @param typeRepair + */ + @Override + public List selectTypeRepairListAndUserName(TypeRepair typeRepair) { + return typeRepairMapper.selectTypeRepairListAndUserName(typeRepair); + } + /** * 新增维修班机具配置 * @@ -93,4 +103,14 @@ public class TypeRepairServiceImpl implements ITypeRepairService { return typeRepairMapper.deleteTypeRepairByID(ID); } + + /** + * 根据用户id和类型id删除配置信息 + * + * @param typeRepair + */ + @Override + public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { + return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index 2057fa68..9224ab63 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -1,14 +1,14 @@ package com.bonus.material.ma.service.impl; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; +import cn.hutool.core.util.ArrayUtil; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.biz.enums.DataCodeEnum; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.springframework.stereotype.Service; @@ -97,7 +97,7 @@ public class TypeServiceImpl implements ITypeService { * @return 物资类型管理 */ @Override - public List selectTypeListAndParent(Type type) { + public List selectTypeListAndParentInfo(Type type) { // 如果是顶级节点,则查询所有子节点 if (type != null && type.getLevel() != null && "0".equals(type.getLevel())) { type.setLevel(null); @@ -156,6 +156,47 @@ public class TypeServiceImpl implements ITypeService { return maTypeListVos; } + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * + * @param type 参数 + */ + @Override + public List selectThreeFourLevelTypeListAndParent(Type type) { + // 查询四级节点列表 + List fourLevelTypeList = typeMapper.selectFourLevelTypeListAndParent(type); + List threeLevelTypeList = null; + + if (ArrayUtil.isNotEmpty(fourLevelTypeList)) { + // 查询三级节点列表 + threeLevelTypeList = typeMapper.selectThreeLevelTypeListAndParent(type); + if (ArrayUtil.isNotEmpty(threeLevelTypeList)) { + + // 使用 HashMap 存储三级节点,以便快速查找 + Map threeLevelTypeMap = new HashMap<>(); + for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { + threeLevelTypeMap.put(threeLevelType.getTypeId(), threeLevelType); + } + + // 外层循环四级节点列表 + for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { + // 对4级节点进行必要性检查 + if (fourLevelType == null || fourLevelType.getParentId() == null) { + continue; + } + // 拿到4级节点的父级id + Long fourLevelTypeParentId = fourLevelType.getParentId(); + // 查找对应的三级节点 + MaTypeConfigVo threeLevelType = threeLevelTypeMap.get(fourLevelTypeParentId); + if (threeLevelType != null) { + threeLevelType.getChildren().add(fourLevelType); + } + } + } + } + return threeLevelTypeList; + } + /** * 新增物资类型管理 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java new file mode 100644 index 00000000..19fe1fa2 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java @@ -0,0 +1,72 @@ +package com.bonus.material.ma.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.vo + * @CreateTime: 2024-10-16 10:57 + * @Description: 物资类型配置vo + */ +@Data +@ToString +public class MaTypeConfigVo implements java.io.Serializable { + + @ApiModelProperty(value = "配置id") + private Long id; + + @ApiModelProperty(value = "物资类型id") + private Long typeId; + + @ApiModelProperty(value = "物资类型名称") + private String typeName; + + @ApiModelProperty(value = "父级id") + private Long parentId; + + @ApiModelProperty(value = "物资仓库id") + private Long houseId; + + @ApiModelProperty(value = "物资仓库名称") + private String houseName; + + @ApiModelProperty(value = "库管员id") + private Long keeperUserId; + + @ApiModelProperty(value = "库管员姓名") + private String keeperUserName; + + @ApiModelProperty(value = "维修员id") + private Long repairUserId; + + @ApiModelProperty(value = "维修员姓名") + private String repairUserName; + + + private String parentOneLevelName; + + private String parentTwoLevelName; + + private String parentThreeLevelName; + + private String parentFourLevelName; + + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree用户ID") + private Long userId; + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree层级") + private String level; + + @ApiModelProperty(value = "是否选中") + private Boolean isCheck = false; + + @ApiModelProperty(value = "子节点") + private List children = new ArrayList<>(); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java index 3d70bc41..b1acb0f2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java @@ -95,7 +95,7 @@ public class PurchaseCheckDetailsController extends BaseController { @ApiOperation(value = "修改新购验收任务详细") @PreventRepeatSubmit @RequiresPermissions("purchase:details:edit") - @SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收任务详细") + @SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务详细") @PutMapping public AjaxResult edit(@RequestBody PurchaseCheckDetails purchaseCheckDetails) { try { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java index c2f35bdd..9f4195a4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java @@ -1,9 +1,14 @@ package com.bonus.material.purchase.controller; import java.util.List; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.purchase.dto.PurchaseCheckDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -34,7 +39,8 @@ import com.bonus.common.core.web.page.TableDataInfo; @RestController @RequestMapping("/purchase_check_info") public class PurchaseCheckInfoController extends BaseController { - @Autowired + + @Resource private IPurchaseCheckInfoService purchaseCheckInfoService; /** @@ -49,19 +55,6 @@ public class PurchaseCheckInfoController extends BaseController { return getDataTable(list); } - /** - * 导出新购验收任务列表 - */ - @ApiOperation(value = "导出新购验收任务列表") - @PreventRepeatSubmit - @RequiresPermissions("purchase:info:export") - @SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收任务") - @PostMapping("/export") - public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) { - List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo); - ExcelUtil util = new ExcelUtil(PurchaseCheckInfo.class); - util.exportExcel(response, list, "新购验收任务数据"); - } /** * 获取新购验收任务详细信息 @@ -79,11 +72,11 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "新增新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:add") - @SysLog(title = "新购验收任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.INSERT, module = "仓储管理->新增新购验收任务") @PostMapping - public AjaxResult add(@RequestBody PurchaseCheckInfo purchaseCheckInfo) { + public AjaxResult add(@Valid @NotNull @RequestBody PurchaseCheckDto purchaseCheckDto) { try { - return toAjax(purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckInfo)); + return purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckDto); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } @@ -95,7 +88,7 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "修改新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:edit") - @SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务") @PutMapping public AjaxResult edit(@RequestBody PurchaseCheckInfo purchaseCheckInfo) { try { @@ -111,9 +104,25 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "删除新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:remove") - @SysLog(title = "新购验收任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.DELETE, module = "仓储管理->删除新购验收任务") @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByIds(ids)); } + + + + /** + * 导出新购验收任务列表 + */ + @ApiOperation(value = "导出新购验收任务列表") + @PreventRepeatSubmit + @RequiresPermissions("purchase:info:export") + @SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, module = "仓储管理->导出新购验收任务") + @PostMapping("/export") + public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) { + List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo); + ExcelUtil util = new ExcelUtil(PurchaseCheckInfo.class); + util.exportExcel(response, list, "新购验收任务数据"); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseMacodeInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseMacodeInfoController.java index 055a0eff..447cd849 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseMacodeInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseMacodeInfoController.java @@ -3,6 +3,7 @@ package com.bonus.material.purchase.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.bonus.common.log.enums.OperaType; +import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -16,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.purchase.domain.PurchaseMacodeInfo; import com.bonus.material.purchase.service.IPurchaseMacodeInfoService; import com.bonus.common.core.web.controller.BaseController; @@ -34,6 +34,7 @@ import com.bonus.common.core.web.page.TableDataInfo; @RestController @RequestMapping("/purchase_macode_info") public class PurchaseMacodeInfoController extends BaseController { + @Autowired private IPurchaseMacodeInfoService purchaseMacodeInfoService; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java index 199361b4..1b2c64a4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java @@ -6,20 +6,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 新购验收任务详细对象 purchase_check_details - * * @author xsheng - * @date 2024-10-16 */ - - +@EqualsAndHashCode(callSuper = false) @Data @ToString public class PurchaseCheckDetails extends BaseEntity { + private static final long serialVersionUID = 1L; /** 主键id */ @@ -35,6 +34,12 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "规格id") private Long typeId; + @ApiModelProperty(value = "规格名称") + private String typeName; + + @ApiModelProperty(value = "物资名称--规格parent类型") + private String maTypeName; + /** 采购单价 */ @Excel(name = "采购单价") @ApiModelProperty(value = "采购单价") @@ -60,11 +65,15 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "验收结论") private String checkResult; - /** 供应商id */ - @Excel(name = "供应商id") - @ApiModelProperty(value = "供应商id") + /** 物资厂家id */ + @Excel(name = "物资厂家id") + @ApiModelProperty(value = "物资厂家id") private Long supplierId; + /** 物资厂家名称 */ + @ApiModelProperty(value = "物资厂家名称") + private String supplierName; + /** 0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过 */ @Excel(name = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过") @ApiModelProperty(value = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java index ffd8a5aa..96498bb7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java @@ -5,17 +5,15 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 新购验收任务对象 purchase_check_info - * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ - - +@EqualsAndHashCode(callSuper = false) @Data @ToString public class PurchaseCheckInfo extends BaseEntity { @@ -29,6 +27,9 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "任务ID") private Long taskId; + @ApiModelProperty(value = "任务状态") + private String taskStatus; + /** 采购日期 */ @ApiModelProperty(value = "采购日期") @JsonFormat(pattern = "yyyy-MM-dd") @@ -51,5 +52,16 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; + /** + * 采购物资 + */ + @ApiModelProperty(value = "采购物资--外层Table字段") + private String purchaseMaTypeName; + + /** + * 采购数量 + */ + @ApiModelProperty(value = "采购数量--外层Table字段") + private String purchaseMaNumber; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java new file mode 100644 index 00000000..c8c65134 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java @@ -0,0 +1,35 @@ +package com.bonus.material.purchase.dto; + +import com.bonus.material.purchase.domain.PurchaseCheckDetails; +import com.bonus.material.purchase.domain.PurchaseCheckInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.purchase + * @CreateTime: 2024-10-18 09:52 + * @Description: 新购任务新增-请求参数封装DTO + */ +@Data +public class PurchaseCheckDto { + + /** + * 采购验收任务info + */ + @ApiModelProperty(value = "采购验收任务info") + @NotNull(message = "采购验收任务info对象不能为空") + private PurchaseCheckInfo purchaseCheckInfo; + + /** + * 采购验收任务详情集合 + */ + @ApiModelProperty(value = "采购验收任务详情集合") + private List purchaseCheckDetailsList; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java index 2d24d913..3eebe2de 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper; import java.util.List; import com.bonus.material.purchase.domain.PurchaseCheckDetails; +import org.apache.ibatis.annotations.Param; /** * 新购验收任务详细Mapper接口 @@ -10,13 +11,29 @@ import com.bonus.material.purchase.domain.PurchaseCheckDetails; * @date 2024-10-16 */ public interface PurchaseCheckDetailsMapper { + + /** + * 根据任务id查询物资类型名称,1-验收,2-入库 + * + * @param taskId * @param type 1-验收,2-入库 + * @return String类型,多个物资类型根据逗号分割 + */ + String selectMaTypeNameByTaskId(@Param("taskId") Long taskId, @Param("type") String type); + + /** * 查询新购验收任务详细 * * @param id 新购验收任务详细主键 * @return 新购验收任务详细 */ - public PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id); + PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id); + + /** + * 根据任务id查询新购验收任务详细列表--Join查询 + * @param taskId 任务id + */ + List selectPurchaseCheckDetailsListByTaskId(Long taskId); /** * 查询新购验收任务详细列表 @@ -24,7 +41,7 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 新购验收任务详细集合 */ - public List selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails); + List selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails); /** * 新增新购验收任务详细 @@ -32,7 +49,13 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 结果 */ - public int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + + /** + * 批量新增新购验收任务详细 + * @param purchaseCheckDetailsList 新购验收任务详细集合 + */ + int insertPurchaseCheckDetailsList(List purchaseCheckDetailsList); /** * 修改新购验收任务详细 @@ -40,7 +63,7 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 结果 */ - public int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); /** * 删除新购验收任务详细 @@ -48,7 +71,7 @@ public interface PurchaseCheckDetailsMapper { * @param id 新购验收任务详细主键 * @return 结果 */ - public int deletePurchaseCheckDetailsById(Long id); + int deletePurchaseCheckDetailsById(Long id); /** * 批量删除新购验收任务详细 @@ -56,5 +79,5 @@ public interface PurchaseCheckDetailsMapper { * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deletePurchaseCheckDetailsByIds(Long[] ids); + int deletePurchaseCheckDetailsByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java index 94cfe84c..c59d67e9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java @@ -16,15 +16,24 @@ public interface PurchaseCheckInfoMapper { * @param id 新购验收任务主键 * @return 新购验收任务 */ - public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); + PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); /** - * 查询新购验收任务列表 + * 查询新购验收任务列表--单表基础查询 * * @param purchaseCheckInfo 新购验收任务 * @return 新购验收任务集合 */ - public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); + List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); + + /** + * 查询新购验收任务列表--多表关联查询 + * + * @param purchaseCheckInfo 新购验收任务 + * @return 新购验收任务集合 + */ + List selectPurchaseCheckInfoJoinList(PurchaseCheckInfo purchaseCheckInfo); + /** * 新增新购验收任务 @@ -32,7 +41,7 @@ public interface PurchaseCheckInfoMapper { * @param purchaseCheckInfo 新购验收任务 * @return 结果 */ - public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); /** * 修改新购验收任务 @@ -40,7 +49,7 @@ public interface PurchaseCheckInfoMapper { * @param purchaseCheckInfo 新购验收任务 * @return 结果 */ - public int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); /** * 删除新购验收任务 @@ -48,7 +57,7 @@ public interface PurchaseCheckInfoMapper { * @param id 新购验收任务主键 * @return 结果 */ - public int deletePurchaseCheckInfoById(Long id); + int deletePurchaseCheckInfoById(Long id); /** * 批量删除新购验收任务 @@ -56,5 +65,5 @@ public interface PurchaseCheckInfoMapper { * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deletePurchaseCheckInfoByIds(Long[] ids); + int deletePurchaseCheckInfoByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java index 18ec7c26..1648944e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java @@ -1,13 +1,15 @@ package com.bonus.material.purchase.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.purchase.domain.PurchaseCheckInfo; +import com.bonus.material.purchase.dto.PurchaseCheckDto; /** * 新购验收任务Service接口 * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ public interface IPurchaseCheckInfoService { /** @@ -16,7 +18,7 @@ public interface IPurchaseCheckInfoService { * @param id 新购验收任务主键 * @return 新购验收任务 */ - public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); + PurchaseCheckDto selectPurchaseCheckInfoById(Long id); /** * 查询新购验收任务列表 @@ -24,15 +26,15 @@ public interface IPurchaseCheckInfoService { * @param purchaseCheckInfo 新购验收任务 * @return 新购验收任务集合 */ - public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); + List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); /** * 新增新购验收任务 * - * @param purchaseCheckInfo 新购验收任务 + * @param purchaseCheckDto 新购验收任务dto * @return 结果 */ - public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckDto); /** * 修改新购验收任务 @@ -40,7 +42,7 @@ public interface IPurchaseCheckInfoService { * @param purchaseCheckInfo 新购验收任务 * @return 结果 */ - public int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); /** * 批量删除新购验收任务 @@ -48,7 +50,7 @@ public interface IPurchaseCheckInfoService { * @param ids 需要删除的新购验收任务主键集合 * @return 结果 */ - public int deletePurchaseCheckInfoByIds(Long[] ids); + int deletePurchaseCheckInfoByIds(Long[] ids); /** * 删除新购验收任务信息 @@ -56,5 +58,5 @@ public interface IPurchaseCheckInfoService { * @param id 新购验收任务主键 * @return 结果 */ - public int deletePurchaseCheckInfoById(Long id); + int deletePurchaseCheckInfoById(Long id); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 9df2258a..6270cf0e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -3,23 +3,38 @@ package com.bonus.material.purchase.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.purchase.domain.PurchaseCheckDetails; +import com.bonus.material.purchase.dto.PurchaseCheckDto; +import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper; +import com.bonus.material.task.domain.TmTask; +import com.bonus.material.task.mapper.TmTaskMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper; import com.bonus.material.purchase.domain.PurchaseCheckInfo; import com.bonus.material.purchase.service.IPurchaseCheckInfoService; +import javax.annotation.Resource; +import javax.validation.constraints.NotNull; + /** * 新购验收任务Service业务层处理 * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ @Service public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { - @Autowired + + @Resource private PurchaseCheckInfoMapper purchaseCheckInfoMapper; + @Resource + private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper; + + @Resource + private TmTaskMapper tmTaskMapper; + /** * 查询新购验收任务 * @@ -27,19 +42,38 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { * @return 新购验收任务 */ @Override - public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id) { - return purchaseCheckInfoMapper.selectPurchaseCheckInfoById(id); + public PurchaseCheckDto selectPurchaseCheckInfoById(Long id) { + PurchaseCheckDto purchaseCheckDtoResult = new PurchaseCheckDto(); + PurchaseCheckInfo purchaseCheckInfo = purchaseCheckInfoMapper.selectPurchaseCheckInfoById(id); + if (purchaseCheckInfo != null) { + purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo); + List purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByTaskId(purchaseCheckInfo.getTaskId()); + if (purchaseCheckDetails != null) { + purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); + } + } + return purchaseCheckDtoResult; } /** * 查询新购验收任务列表 * - * @param purchaseCheckInfo 新购验收任务 + * @param purchaseCheckInfoDto 新购验收任务请求参数 * @return 新购验收任务 */ @Override - public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo) { - return purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfo); + public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfoDto) { + // 查询新购info列表 + List purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfoDto); + // 过滤info列表中空的对象 + purchaseCheckInfos.removeIf(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() == null); + + // 查询details表,获取详细的采购物资名称 + for (PurchaseCheckInfo purchaseCheckInfo : purchaseCheckInfos) { + String purchaseMaName = purchaseCheckDetailsMapper.selectMaTypeNameByTaskId(purchaseCheckInfo.getTaskId(), null); + purchaseCheckInfo.setPurchaseMaTypeName(purchaseMaName != null ? purchaseMaName : ""); + } + return purchaseCheckInfos; } /** @@ -49,12 +83,49 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { * @return 结果 */ @Override - public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo) { - purchaseCheckInfo.setCreateTime(DateUtils.getNowDate()); + public AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckInfo) { + // 赋值创建时间 + purchaseCheckInfo.getPurchaseCheckInfo().setCreateTime(DateUtils.getNowDate()); try { - return purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo); + // TODO: 任务类型、XG 待完善,先定义死,后期修改至配置中心 + + // 查询新购任务当月最大单号 + Integer thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), 16L); + // 查询出的单号值,进行必要性校正 + if (thisMonthMaxOrder == null || thisMonthMaxOrder == 0) { + thisMonthMaxOrder = 1; + } else { + thisMonthMaxOrder = thisMonthMaxOrder + 1; + } + // 生成单号 + String taskCode = "XG" + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder); + + // 先往tm_task任务表中创建任务 + TmTask tmTask = new TmTask(null, 16L, 55L, taskCode, purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1); + Long taskId = 0L; + if (tmTaskMapper.insertTmTask(tmTask) > 0) { + taskId = tmTask.getTaskId(); + } else { + return AjaxResult.error("新增任务失败_task表插入0条"); + } + + // tm_task 插入成功后,再往新购验收info表中插入数据 + purchaseCheckInfo.getPurchaseCheckInfo().setTaskId(taskId); + if (purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo.getPurchaseCheckInfo()) > 0) { + Long finalTaskId = taskId; + purchaseCheckInfo.getPurchaseCheckDetailsList().forEach( + details -> { + details.setTaskId(finalTaskId); + details.setInputStatus("0"); + }); + // 批量插入详情数据 + boolean purchaseCheckDetailsListAddResult = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckInfo.getPurchaseCheckDetailsList()) > 0; + return purchaseCheckDetailsListAddResult ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条"); + } else { + return AjaxResult.error("新增任务失败,info表插入0条"); + } } catch (Exception e) { - throw new ServiceException("错误信息描述"); + return AjaxResult.error("新增任务失败:" + e.getMessage()); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java index 4a535d8b..dc021f41 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java @@ -3,20 +3,19 @@ package com.bonus.material.task.domain; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 任务对象 tm_task - * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ - - +@EqualsAndHashCode(callSuper = true) @Data @ToString public class TmTask extends BaseEntity { + private static final long serialVersionUID = 1L; /** 任务ID */ @@ -47,5 +46,18 @@ public class TmTask extends BaseEntity { @ApiModelProperty(value = "0不启用 1启用") private String status; + @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") + private Integer monthOrder; + public TmTask(Long taskId, Long taskType, Long taskStatus, String code, Long companyId, String status, Integer monthOrder) { + this.taskId = taskId; + this.taskType = taskType; + this.taskStatus = taskStatus; + this.code = code; + this.companyId = companyId; + this.status = status; + this.monthOrder = monthOrder; + } + + public TmTask() {} } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index a33d450e..73aa4615 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.task.mapper; import java.util.List; import com.bonus.material.task.domain.TmTask; +import org.apache.ibatis.annotations.Param; /** * 任务Mapper接口 @@ -16,7 +17,15 @@ public interface TmTaskMapper { * @param taskId 任务主键 * @return 任务 */ - public TmTask selectTmTaskByTaskId(Long taskId); + TmTask selectTmTaskByTaskId(Long taskId); + + /** + * 查询当年当月最大任务序号,用于生成任务编号 by 分类型查询 + * @param year 年 + * @param month 月 + * @param type 任务类型(字典表中获取,例如新购是:16) + */ + Integer getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("type") Long type); /** * 查询任务列表 @@ -24,7 +33,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 任务集合 */ - public List selectTmTaskList(TmTask tmTask); + List selectTmTaskList(TmTask tmTask); /** * 新增任务 @@ -32,7 +41,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 结果 */ - public int insertTmTask(TmTask tmTask); + int insertTmTask(TmTask tmTask); /** * 修改任务 @@ -40,7 +49,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 结果 */ - public int updateTmTask(TmTask tmTask); + int updateTmTask(TmTask tmTask); /** * 删除任务 @@ -48,7 +57,7 @@ public interface TmTaskMapper { * @param taskId 任务主键 * @return 结果 */ - public int deleteTmTaskByTaskId(Long taskId); + int deleteTmTaskByTaskId(Long taskId); /** * 批量删除任务 @@ -56,5 +65,5 @@ public interface TmTaskMapper { * @param taskIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteTmTaskByTaskIds(Long[] taskIds); + int deleteTmTaskByTaskIds(Long[] taskIds); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java index 3efa54c7..d270c615 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java @@ -119,8 +119,10 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService { List needRoles = new ArrayList<>(); if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { needRoles = bmConfigService.getLeaseTaskAuditRoleKeys(); - } - //TODO, add more tasks logic to get needRoles + } else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { + needRoles = bmConfigService.getBackTaskAuditRoleKeys(); + } //TODO, add more tasks logic to get needRoles + if (CollectionUtils.isEmpty(needRoles)) { return new TmTaskAuditResult(true); } else { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java index 82976b74..3b7af9d0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java @@ -17,7 +17,7 @@ public interface WhHouseInfoMapper * @param houseId 仓库管理主键 * @return 仓库管理 */ - public WhHouseInfo selectWhHouseInfoByHouseId(Long houseId); + WhHouseInfo selectWhHouseInfoByHouseId(Long houseId); /** * 查询仓库管理列表 @@ -33,7 +33,7 @@ public interface WhHouseInfoMapper * @param whHouseInfo 仓库管理 * @return 结果 */ - public int insertWhHouseInfo(WhHouseInfo whHouseInfo); + int insertWhHouseInfo(WhHouseInfo whHouseInfo); /** * 修改仓库管理 @@ -41,7 +41,7 @@ public interface WhHouseInfoMapper * @param whHouseInfo 仓库管理 * @return 结果 */ - public int updateWhHouseInfo(WhHouseInfo whHouseInfo); + int updateWhHouseInfo(WhHouseInfo whHouseInfo); /** * 删除仓库管理 @@ -49,7 +49,7 @@ public interface WhHouseInfoMapper * @param houseId 仓库管理主键 * @return 结果 */ - public int deleteWhHouseInfoByHouseId(Long houseId); + int deleteWhHouseInfoByHouseId(Long houseId); /** * 批量删除仓库管理 @@ -57,5 +57,5 @@ public interface WhHouseInfoMapper * @param houseIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteWhHouseInfoByHouseIds(Long[] houseIds); + int deleteWhHouseInfoByHouseIds(Long[] houseIds); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml index cc2cae3c..05e30bb2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml @@ -23,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select supplier_id, supplier, address, legal_person, primary_contact, phone, business_scope, business_license, del_flag, create_by, create_time, update_by, update_time, remark, company_id, status from ma_supplier_info + select supplier_id, supplier, address, legal_person, primary_contact, phone, business_scope, business_license, + del_flag, create_by, create_time, update_by, update_time, remark, company_id, status + from ma_supplier_info + + insert into ma_type_keeper @@ -68,4 +75,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + + + + delete from ma_type_keeper where user_id = #{userId} and type_id = #{typeId} + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index be58065a..022953d4 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -12,12 +12,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -43,12 +46,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -68,12 +74,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + select - type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, - eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num, + type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, unit_name, manage_type, lease_price, + eff_time, rent_price, buy_price, pay_ratio, pay_price, tax_ratio, level, rated_load, test_load, holding_time, warn_num, create_by, create_time, update_by, update_time, is_plan,is_ancuo, remark, fac_model, intelligent_code from ma_type @@ -145,12 +165,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type_code, model_code, unit_id, + unit_name, manage_type, lease_price, eff_time, rent_price, buy_price, pay_ratio, + pay_price, + tax_ratio, `level`, rated_load, test_load, @@ -173,12 +196,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{typeCode}, #{modelCode}, #{unitId}, + #{unitName}, #{manageType}, #{leasePrice}, #{effTime}, #{rentPrice}, #{buyPrice}, #{payRatio}, + #{payPrice}, + #{taxRatio}, #{level}, #{ratedLoad}, #{testLoad}, @@ -205,12 +231,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type_code = #{typeCode}, model_code = #{modelCode}, unit_id = #{unitId}, + unit_name = #{unitName}, manage_type = #{manageType}, lease_price = #{leasePrice}, eff_time = #{effTime}, rent_price = #{rentPrice}, buy_price = #{buyPrice}, pay_ratio = #{payRatio}, + pay_price = #{payPrice}, + tax_ratio = #{taxRatio}, `level` = #{level}, rated_load = #{ratedLoad}, test_load = #{testLoad}, @@ -251,11 +280,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT a.*, -- 当前层级的所有字段 b.type_name AS parentThreeLevelName, -- 父层级名称 - c.type_name AS parentTwoLevelName, -- 祖父层级名称 - d.type_name AS parentOneLevelName -- 曾祖父层级名称 + d.type_name AS parentOneLevelName, -- 曾祖父层级名称 + whi.house_name FROM ma_type a + LEFT JOIN + wh_house_set whs ON a.type_id = whs.type_id AND whs.del_flag = '0' + LEFT JOIN + wh_house_info whi ON whi.house_id = whs.house_id AND whs.del_flag = '0' LEFT JOIN ma_type b ON a.parent_id = b.type_id and b.del_flag = '0' -- 第一层,父类型 LEFT JOIN @@ -325,10 +358,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index 672ddded..926cbf2f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -69,4 +70,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + + + + delete from ma_type_repair where user_id = #{userId} and type_id = #{typeId} + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index cfb3c508..e947e915 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -34,6 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, task_id, type_id, purchase_price, purchase_num, check_num, bind_num, check_result, supplier_id, status, create_by, production_time, create_time, update_by, update_time, remark, check_url_name, check_url, input_num, input_status, input_time, file_name, file_url, company_id from purchase_check_details + + select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result, + pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time, + pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name, + pcd.file_url, pcd.company_id, mt.type_name, mtp.type_name as ma_type_name + from purchase_check_details pcd + left join ma_type mt on pcd.type_id = mt.type_id + left join ma_type mtp on mt.parent_id = mtp.type_id + + + + insert into purchase_check_details @@ -157,4 +174,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + + + insert into purchase_check_details(task_id,type_id,purchase_price,purchase_num,check_num,bind_num,check_result,supplier_id,status,production_time,create_by,create_time,update_by,update_time,remark,check_url_name,check_url,input_num,input_status,input_time,file_name,file_url,company_id) + values(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId}) + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml index e11c9b51..03042160 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml @@ -15,14 +15,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - - select id, task_id, purchase_time, arrival_time, purchaser, create_by, create_time, update_by, update_time, remark, company_id from purchase_check_info + + select + id, task_id, purchase_time, arrival_time, purchaser, create_by, + create_time, update_by, update_time, remark, company_id + from + purchase_check_info + + + + select + pci.id, pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, + pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id, + t.task_status, t.task_type + from + purchase_check_info pci + left join tm_task t on t.task_id = pci.task_id @@ -92,4 +107,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index 5c69b852..f6ded252 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -15,10 +15,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id, status from tm_task + select task_id, task_type, task_status, code, create_by, create_time, + update_by, update_time, remark, company_id, status , month_order + from tm_task + select max(month_order) from tm_task + where + month(create_time) = #{month} and year(create_time) = #{year} + + and task_type = #{type} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml index 5c41eadc..5c99f87a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml @@ -24,7 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select house_id, house_name, physical_name, geo_location, parent_id, status, dept_id, del_flag, create_by, create_time, update_by, update_time, remark, company_id, sort, concat, phone from wh_house_info + select house_id, house_name, physical_name, geo_location, parent_id, status, dept_id, + del_flag, create_by, create_time, update_by, update_time, remark, + company_id, sort, concat, phone + from wh_house_info @@ -59,8 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" del_flag, create_by, create_time, - update_by, - update_time, remark, company_id, sort, @@ -77,8 +79,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{delFlag}, #{createBy}, #{createTime}, - #{updateBy}, - #{updateTime}, #{remark}, #{companyId}, #{sort}, @@ -97,8 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status = #{status}, dept_id = #{deptId}, del_flag = #{delFlag}, - create_by = #{createBy}, - create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, diff --git a/scripts_244/deploy_material.sh b/scripts_244/deploy_material.sh index e60518d5..157e1cb4 100644 --- a/scripts_244/deploy_material.sh +++ b/scripts_244/deploy_material.sh @@ -1,12 +1,6 @@ #!/bin/bash -#jar_version="24.10.0-SNAPSHOT" export deploy_path=/opt/webapps/bonus-material -#export app_workspace=/opt/builds/releases/Bonus-Cloud/${jar_version} -#export biz_workspace=/opt/install/jenkins_home/workspace/Bonus-Cloud-Material - -#cp -f ${biz_workspace}/"bonus-modules/bonus-material/target/bonus-material.jar" $deploy_path -#echo "copied ${app_workspace}/${source_jar} to $deploy_path" # Define an array of JAR files to run jars=("bonus-material.jar --spring.config.location=file:material_bootstrap.yml") @@ -43,5 +37,4 @@ for jar in "${jars[@]}"; do nohup /usr/local/jdk1.8.0/bin/java -jar $jar >/dev/null 2>&1 & done -echo "All JARs have been run successfully." - +echo "All JARs have been run successfully." \ No newline at end of file