Merge branch 'master' into branch_basic

This commit is contained in:
mashuai 2024-10-23 13:59:53 +08:00
commit 2c3ee99151
29 changed files with 1139 additions and 413 deletions

View File

@ -21,7 +21,7 @@ public class BonusMaterialApplication
public static void main(String[] args)
{
SpringApplication.run(BonusMaterialApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 仓储模块启动成功 ლ(´ڡ`ლ)゙ \n" +
System.out.println("(♥◠‿◠)ノ゙ 2024机具大融合系统启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +

View File

@ -1,124 +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<TreeSelect> 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);
}
}
//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<TreeSelect> 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);
// }
//
//}

View File

@ -49,6 +49,17 @@ public class SupplierInfoController extends BaseController {
return getDataTable(list);
}
/**
* 查询物资厂家--下拉框--不分页
*/
@ApiOperation(value = "查询物资厂家下拉框--不分页")
@RequiresPermissions("ma:info:list")
@GetMapping("/select")
public TableDataInfo select(SupplierInfo supplierInfo) {
List<SupplierInfo> list = supplierInfoService.selectSupplierInfoList(supplierInfo);
return getDataTable(list);
}
/**
* 导出物资厂家管理列表
*/

View File

@ -9,6 +9,7 @@ import javax.validation.constraints.NotNull;
import com.bonus.common.biz.domain.TreeSelect;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.ma.MaTypeConfigDto;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
import com.bonus.material.warehouse.domain.WhHouseSet;
@ -37,9 +38,6 @@ public class TypeController extends BaseController {
@Resource
private ITypeService typeService;
@Resource
private IWhHouseSetService houseSetService;
/**
* 查询物资类型管理列表
*/
@ -75,24 +73,18 @@ public class TypeController extends BaseController {
}
/**
* 根据左列表类型id查询右表格 --- 暂未启用代码有问题!!
* TODO: 待完善
* @param typeId 左列表类型id
* 查询物资类型4级规格型号--前端联动式下拉框
*
* @param typeId 规格型号
*/
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) {
List<Integer> parentIds = typeService.selectParentId(typeId, level);
List<Type> listByMaType = new ArrayList<>();
for (Integer parentId : parentIds) {
listByMaType.addAll(typeService.getListByParentId(parentId.longValue(), typeName));
}
// Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
// Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
// return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));
return null;
@ApiOperation(value = "获取物资类型连动式下拉框")
@GetMapping("/equipmentType")
public AjaxResult equipmentType(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName) {
List<Type> listByMaType = typeService.getEquipmentType(typeId, typeName);
return success(listByMaType);
}
/**
* TODO : 后续优化代码逻辑
* 物资类型下拉树
@ -100,32 +92,9 @@ public class TypeController extends BaseController {
@ApiOperation(value = "物资类型下拉树")
@RequiresPermissions("ma:type:list")
@GetMapping("/getMaTypeTreeSelect")
public AjaxResult getMaTypeTreeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) {
// 1.顶级节点及子节点数据全部查询完毕
List<TreeSelect> maTypeList = typeService.getMaTypeTree(typeName, parentId);
// 2.查询所有的仓库配置
List<WhHouseSet> whHouseSets = houseSetService.selectListByMaType(null);
// 2.1 定义最终接口返回集合
List<TreeSelect> treeSelectResultList = new ArrayList<>();
// 3.遍历所有配置关联
for (WhHouseSet whHouseSet : whHouseSets) {
Long typeId = whHouseSet.getTypeId();
if (typeId == null) {continue;}
// 构造函数定义0级Tree对象
TreeSelect thisTree = new TreeSelect(whHouseSet.getId(),whHouseSet.getHouseName(),0,null);
// 定义1级列表并循环push相应的1级节点
List<TreeSelect> oneLevelTreeList = new ArrayList<>();
for (TreeSelect treeSelect : maTypeList) {
if (treeSelect.getId().equals(typeId)) {
oneLevelTreeList.add(treeSelect);
}
}
// 把处理后对应上的1级列表当作child存入0级Tree对象中
thisTree.setChildren(!oneLevelTreeList.isEmpty() ? oneLevelTreeList : null);
// 最后把0级Tree对象存入Result返回集合中返回给前端
treeSelectResultList.add(thisTree);
}
return AjaxResult.success(treeSelectResultList);
public AjaxResult getMaTypeTreeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName,
@RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) {
return typeService.getMaTypeTreeSelect(typeName, parentId);
}
/**
@ -187,4 +156,32 @@ public class TypeController extends BaseController {
public AjaxResult remove(@PathVariable Long[] typeIds) {
return toAjax(typeService.deleteTypeByTypeIds(typeIds));
}
/**
* 查询物资类型配置右侧列表
*/
@ApiOperation(value = "查询物资类型配置右侧列表")
@RequiresPermissions("ma:typeConfig:list")
@GetMapping("/getMaTypeConfigList")
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
// 调用service处理业务逻辑
return typeService.getMaTypeConfigList(maTypeConfigDto);
}
/**
* 根据左列表类型id查询右表格 --- 暂未启用代码有问题!!
* TODO: 待完善
* @param typeId 左列表类型id
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) {
List<Integer> parentIds = typeService.selectParentId(typeId, level);
List<Type> listByMaType = new ArrayList<>();
for (Integer parentId : parentIds) {
listByMaType.addAll(typeService.getListByParentId(parentId.longValue(), typeName));
}
return null;
}*/
}

View File

@ -14,6 +14,9 @@ import org.apache.ibatis.annotations.Param;
*/
@Mapper
public interface TypeMapper {
List<Type> selectMaTypeList(String typeName);
/**
* 查询物资类型
*

View File

@ -3,6 +3,8 @@ package com.bonus.material.ma.service;
import java.util.List;
import com.bonus.common.biz.domain.TreeSelect;
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.vo.MaTypeConfigVo;
import com.bonus.material.ma.vo.MaTypeListVo;
@ -23,6 +25,8 @@ public interface ITypeService {
List<Integer> selectParentId(Long typeId, Integer level);
List<Type> getEquipmentType(Long typeId, String typeName);
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
List<Type> getListByParentId(Long typeId, String typeName);
@ -84,6 +88,8 @@ public interface ITypeService {
List<TreeSelect> getMaTypeTree(String typeName, String parentId);
AjaxResult getMaTypeTreeSelect(String typeName,String parentId);
/**
* 构建前端所需要树结构
*
@ -91,4 +97,6 @@ public interface ITypeService {
* @return 树结构列表
*/
List<Type> buildMaTypeTree(List<Type> maTypeList);
AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto);
}

View File

@ -1,18 +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);
}
//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);
//}

View File

@ -1,187 +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<MaTypeConfigVo> list = typeService.selectThreeFourLevelTypeListAndParent(new Type());
// 2.把维修配置信息查出来
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
// 3.把库管配置信息查出来
List<TypeKeeper> 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<MaTypeConfigVo> 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);
}
}
}
//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<MaTypeConfigVo> list = typeService.selectThreeFourLevelTypeListAndParent(new Type());
// // 2.把维修配置信息查出来
// List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
// // 3.把库管配置信息查出来
// List<TypeKeeper> 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<MaTypeConfigVo> 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);
// }
// }
//}

View File

@ -8,9 +8,17 @@ 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.common.core.web.domain.AjaxResult;
import com.bonus.material.ma.MaTypeConfigDto;
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.vo.MaTypeConfigVo;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
import com.bonus.material.warehouse.domain.WhHouseSet;
import com.bonus.material.warehouse.service.IWhHouseSetService;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.ma.domain.Type;
@ -33,6 +41,15 @@ public class TypeServiceImpl implements ITypeService {
@Resource
private TypeMapper typeMapper;
@Resource
private ITypeKeeperService typeKeeperService;
@Resource
private ITypeRepairService typeRepairService;
@Resource
private IWhHouseSetService houseSetService;
/**
* 查询物资类型 -- 根据id
*
@ -48,6 +65,29 @@ public class TypeServiceImpl implements ITypeService {
return typeMapper.selectParentId(typeId, level);
}
/**
* 查询物资类型四级树--前端联动式下拉框
* @param typeId 类型id
* @param typeName 类型名称
*/
@Override
public List<Type> getEquipmentType(Long typeId, String typeName) {
List<Type> maTypes = typeMapper.selectMaTypeList("");
List<Type> list = new ArrayList<>();
for (Type maType : maTypes) {
if (maType.getParentId() == 0) {
list.add(maType);
}
}
//根据父节点获取对应的儿子节点
for (Type maType : list) {
List<Type> child = getChild(maTypes, maType.getTypeId());
maType.setChildren(child);
}
return list;
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
return typeMapper.selectMaTypeListByHouseId(houseId);
@ -78,7 +118,7 @@ public class TypeServiceImpl implements ITypeService {
@Override
public List<Type> selectTypeList(Type type) {
if (type != null ) {
if (type.getDelFlag() == null || type.getDelFlag().isEmpty()) {
if (StringUtils.isEmpty(type.getDelFlag())) {
// 如果没赋值则默认查询正常数据状态
type.setDelFlag(String.valueOf(DataCodeEnum.NORMAL.getCode()));
}
@ -249,15 +289,44 @@ public class TypeServiceImpl implements ITypeService {
List<Type> maTypes = typeMapper.selectMaTypeTree(TYPE_MIN_LEVEL);
List<Type> builtMaTypeList = buildMaTypeTree(maTypes);
List<TreeSelect> treeSelectList = builtMaTypeList.stream()
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
// 查询顶级节点的仓库配置信息
// 如果没有查询到那么返回空
return treeSelectList;
return builtMaTypeList.stream()
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
}
@Override
public AjaxResult getMaTypeTreeSelect(String typeName, String parentId) {
// 1.顶级节点及子节点数据全部查询完毕
List<TreeSelect> maTypeList = this.getMaTypeTree(typeName, parentId);
// 2.查询所有的仓库配置
List<WhHouseSet> whHouseSets = houseSetService.selectListByMaType(null);
// 2.1 定义最终接口返回集合
List<TreeSelect> treeSelectResultList = new ArrayList<>();
// 使用HashMap来存储maTypeList以便快速查找
Map<Long, TreeSelect> maTypeMap = new HashMap<>();
for (TreeSelect treeSelect : maTypeList) {
maTypeMap.put(treeSelect.getId(), treeSelect);
}
// 3.遍历所有配置关联
for (WhHouseSet whHouseSet : whHouseSets) {
// --- 数据校验 ----
if (whHouseSet == null || whHouseSet.getTypeId() == null) { continue; }
// 构造函数定义0级Tree对象
TreeSelect thisTree = new TreeSelect(whHouseSet.getId(),whHouseSet.getHouseName(),0,null);
// 从Map中直接获取对应的1级节点
TreeSelect oneLevelTree = maTypeMap.get(whHouseSet.getTypeId());
// 转换为集合存入0级Tree对象中
thisTree.setChildren(oneLevelTree != null ? Collections.singletonList(oneLevelTree) : null);
// 最后把0级Tree对象存入Result结果集合返回给前端
treeSelectResultList.add(thisTree);
}
return AjaxResult.success(treeSelectResultList);
}
/**
@ -272,6 +341,25 @@ public class TypeServiceImpl implements ITypeService {
return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children);
}
/**
* 递归调用获取子级
* @param list 集合
* @param parentId 父级id
*/
public List<Type> getChild(List<Type> list, Long parentId) {
List<Type> childList = new ArrayList<Type>();
for (Type maType : list) {
Long typeId = maType.getTypeId();
Long pid = maType.getParentId();
if (parentId.equals(pid)) {
List<Type> childLists = getChild(list, typeId);
maType.setChildren(childLists);
childList.add(maType);
}
}
return childList;
}
/**
* 构建前端所需要树结构
*
@ -329,4 +417,96 @@ public class TypeServiceImpl implements ITypeService {
return !getChildList(list, t).isEmpty();
}
@Override
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
// 1.把所有物资类型查出来
List<MaTypeConfigVo> list = selectThreeFourLevelTypeListAndParent(new Type());
// 2.把维修配置信息查出来
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
// 3.把库管配置信息查出来
List<TypeKeeper> 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<MaTypeConfigVo> 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);
}
}

View File

@ -0,0 +1,44 @@
package com.bonus.material.purchase.config;
import lombok.Getter;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.purchase.config
* @CreateTime: 2024-10-21 16:13
* @Description: 新购模块阶段枚举
*/
@Getter
public enum PurchaseModelEnum {
PURCHASE_MODEL_MANAGE("新购管理"),
PURCHASE_MODEL_CONFIRM("新购确认"),
PURCHASE_MODEL_CHECK("新购验收"),
PURCHASE_MODEL_BIND("新购绑定"),
PURCHASE_MODEL_STORE("新购入库");
private final String modelName;
/**
* 定义构造函数
* @param modelName 模块名称
*/
PurchaseModelEnum(String modelName) {
this.modelName = modelName;
}
/**
* 判断传入的参数是否存在于枚举类中
* @return 如果存在返回 true否则返回 false
*/
public static boolean containsModelName(String modelName) {
for (PurchaseModelEnum model : PurchaseModelEnum.values()) {
if (model.getModelName().equals(modelName)) {
return true;
}
}
return false;
}
}

View File

@ -1,12 +1,16 @@
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.PurchaseCheckFileDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -26,15 +30,14 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 新购验收任务详细Controller
*
* @author xsheng
* @date 2024-10-16
* @author syruan
*/
@Api(tags = "新购验收任务详细接口")
@RestController
@RequestMapping("/purchase_check_details")
public class PurchaseCheckDetailsController extends BaseController {
@Autowired
@Resource
private IPurchaseCheckDetailsService purchaseCheckDetailsService;
/**
@ -55,7 +58,7 @@ public class PurchaseCheckDetailsController extends BaseController {
@ApiOperation(value = "导出新购验收任务详细列表")
@PreventRepeatSubmit
@RequiresPermissions("purchase:details:export")
@SysLog(title = "新购验收任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收任务详细")
@SysLog(title = "新购验收任务详细", businessType = OperaType.EXPORT, logType = 1,module = "物资新购->导出新购验收任务详细")
@PostMapping("/export")
public void export(HttpServletResponse response, PurchaseCheckDetails purchaseCheckDetails) {
List<PurchaseCheckDetails> list = purchaseCheckDetailsService.selectPurchaseCheckDetailsList(purchaseCheckDetails);
@ -79,7 +82,7 @@ public class PurchaseCheckDetailsController extends BaseController {
@ApiOperation(value = "新增新购验收任务详细")
@PreventRepeatSubmit
@RequiresPermissions("purchase:details:add")
@SysLog(title = "新购验收任务详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收任务详细")
@SysLog(title = "新购验收任务详细", businessType = OperaType.INSERT, logType = 1,module = "物资新购->新增新购验收任务详细")
@PostMapping
public AjaxResult add(@RequestBody PurchaseCheckDetails purchaseCheckDetails) {
try {
@ -95,7 +98,7 @@ public class PurchaseCheckDetailsController extends BaseController {
@ApiOperation(value = "修改新购验收任务详细")
@PreventRepeatSubmit
@RequiresPermissions("purchase:details:edit")
@SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务详细")
@SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, module = "物资新购->修改新购验收任务详细")
@PutMapping
public AjaxResult edit(@RequestBody PurchaseCheckDetails purchaseCheckDetails) {
try {
@ -111,9 +114,32 @@ public class PurchaseCheckDetailsController extends BaseController {
@ApiOperation(value = "删除新购验收任务详细")
@PreventRepeatSubmit
@RequiresPermissions("purchase:details: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(purchaseCheckDetailsService.deletePurchaseCheckDetailsByIds(ids));
}
/**
* 根据任务id查询报告附件
*/
@ApiOperation(value = "根据任务id查询报告附件")
@RequiresPermissions("purchase:details:query")
@GetMapping("/fileList/{taskId}")
@SysLog(title = "新购验收任务明细报告查询", businessType = OperaType.QUERY, module = "物资新购->根据任务id查询物资报告附件")
public AjaxResult getFileList(@PathVariable("taskId") Long taskId) {
return success(purchaseCheckDetailsService.selectPurchaseCheckFileListByTaskId(taskId));
}
@ApiOperation(value = "上传文件")
@PreventRepeatSubmit
@RequiresPermissions("purchase:details:add")
@SysLog(title = "上传文件", businessType = OperaType.INSERT, logType = 1,module = "物资新购->上传物资报告附件")
@PostMapping("/uploadFile")
public AjaxResult uploadFile(@RequestBody @NotNull @Valid PurchaseCheckFileDto purchaseCheckFileDto) {
return purchaseCheckDetailsService.insertPurchaseCheckFile(purchaseCheckFileDto);
}
}

View File

@ -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.PurchaseNoticePersonDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,15 +31,15 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 新购短信通知人员Controller
*
* @author xsheng
* @date 2024-10-16
*
* @author syruan
*/
@Api(tags = "新购短信通知人员接口")
@RestController
@RequestMapping("/purchase_notice_person")
public class PurchaseNoticePersonController extends BaseController {
@Autowired
@Resource
private IPurchaseNoticePersonService purchaseNoticePersonService;
/**
@ -44,7 +49,6 @@ public class PurchaseNoticePersonController extends BaseController {
@RequiresPermissions("purchase:person:list")
@GetMapping("/list")
public TableDataInfo list(PurchaseNoticePerson purchaseNoticePerson) {
startPage();
List<PurchaseNoticePerson> list = purchaseNoticePersonService.selectPurchaseNoticePersonList(purchaseNoticePerson);
return getDataTable(list);
}
@ -89,13 +93,41 @@ public class PurchaseNoticePersonController extends BaseController {
}
}
/**
* 批量新增--新购短信通知人员
*/
@ApiOperation(value = "批量新增新购短信通知人员")
@PreventRepeatSubmit
@RequiresPermissions("purchase:person:add")
@SysLog(title = "批量新增新购短信通知人员", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->批量新增新购短信通知人员")
@PostMapping("/batchAddNoticePerson")
public AjaxResult batchAddNoticePerson(@RequestBody List<PurchaseNoticePerson> purchaseNoticePersonList) {
try {
return toAjax(purchaseNoticePersonService.insertBatchPurchaseNoticePerson(purchaseNoticePersonList));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 批量发送短信
*/
@ApiOperation(value = "批量发送短信")
@PreventRepeatSubmit
@RequiresPermissions("purchase:person:edit")
@SysLog(title = "批量发送短信", businessType = OperaType.UPDATE, module = "仓储管理->批量发送短信")
@PutMapping("/batchSendSms")
public AjaxResult batchSendSms(@NotNull @Valid @RequestBody PurchaseNoticePersonDto purchaseNoticePersonDto) {
return purchaseNoticePersonService.batchSendSms(purchaseNoticePersonDto);
}
/**
* 修改新购短信通知人员
*/
@ApiOperation(value = "修改新购短信通知人员")
@PreventRepeatSubmit
@RequiresPermissions("purchase:person:edit")
@SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购短信通知人员")
@SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, module = "仓储管理->修改新购短信通知人员")
@PutMapping
public AjaxResult edit(@RequestBody PurchaseNoticePerson purchaseNoticePerson) {
try {

View File

@ -37,6 +37,9 @@ public class PurchaseCheckDetails extends BaseEntity {
@ApiModelProperty(value = "规格名称")
private String typeName;
@ApiModelProperty(value = "物资单位名称")
private String unitName;
@ApiModelProperty(value = "物资名称--规格parent类型")
private String maTypeName;

View File

@ -1,6 +1,8 @@
package com.bonus.material.purchase.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@ -9,6 +11,8 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import javax.validation.constraints.Size;
/**
* 新购验收任务对象 purchase_check_info
* @author syruan
@ -17,7 +21,8 @@ import com.bonus.common.core.web.domain.BaseEntity;
@Data
@ToString
public class PurchaseCheckInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1335730477657434485L;
/** 主键id */
private Long id;
@ -30,6 +35,9 @@ public class PurchaseCheckInfo extends BaseEntity {
@ApiModelProperty(value = "任务状态")
private String taskStatus;
@ApiModelProperty(value = "采购单号")
private String code;
/** 采购日期 */
@ApiModelProperty(value = "采购日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@ -62,6 +70,31 @@ public class PurchaseCheckInfo extends BaseEntity {
* 采购数量
*/
@ApiModelProperty(value = "采购数量--外层Table字段")
private String purchaseMaNumber;
private Long purchaseMaNumber;
/**
* 采购含税价格
*/
@ApiModelProperty(value = "采购含税价格--外层Table字段")
private BigDecimal purchaseTaxPrice;
/**
* 采购不含税价格
*/
@ApiModelProperty(value = "采购不含税价格--外层Table字段")
private BigDecimal purchaseNoTaxPrice;
/**
* 税率
*/
@ApiModelProperty(value = "税率--Int整形 0~100")
@Size(max = 100, message = "税率长度必须介于 0 和 100 之间")
private Integer taxRate;
@ApiModelProperty(value = "操作人名称")
private String createUserName;
@ApiModelProperty(value = "新购模块阶段名称")
private String modelName;
}

View File

@ -32,10 +32,17 @@ public class PurchaseNoticePerson extends BaseEntity {
@ApiModelProperty(value = "用户名")
private String userName;
/** 用户角色名 */
@ApiModelProperty(value = "用户角色名")
private String userRoleName;
/** 联系电话 */
@Excel(name = "联系电话")
@ApiModelProperty(value = "联系电话")
private String telphone;
/** 任务id */
@ApiModelProperty("任务id")
private String taskId;
}

View File

@ -0,0 +1,46 @@
package com.bonus.material.purchase.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
/**
* @author : 阮世耀
* @version : 1.0
* @CreateTime: 2024-10-22 10:36
* @Description: 新购验收报告附件DTO
*/
@Data
public class PurchaseCheckFileDto {
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "附件名称")
@NotBlank(message = "附件名称不能为空")
private String fileName;
@ApiModelProperty(value = "附件地址url")
@NotBlank(message = "附件地址url不能为空")
private String fileUrl;
@ApiModelProperty(value = "任务ID")
@NotBlank(message = "任务ID不能为空")
private String taskId;
@ApiModelProperty(value = "字典编码")
@NotEmpty(message = "字典编码不能为空")
private Integer dictCode;
@ApiModelProperty(value = "字典标签")
private String dictLabel;
@ApiModelProperty(value = "新购模块ID,无需传值,后台定义")
private Integer modelId;
@ApiModelProperty(value = "创建人,无需传值后台通过TOKEN获取")
private String createBy;
}

View File

@ -0,0 +1,35 @@
package com.bonus.material.purchase.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.purchase.dto
* @CreateTime: 2024-10-21 14:37
* @Description: 新购验收任务通知人员Dto
*/
@Data
@ToString
public class PurchaseNoticePersonDto {
/**
* 电话号码
*/
@NotEmpty(message = "电话号码不能为空")
@ApiModelProperty(value = "电话号码")
private List<String> phoneNumbers;
/**
* 短信内容
*/
@NotNull(message = "短信内容不能为空")
@ApiModelProperty(value = "短信内容")
private String content;
}

View File

@ -0,0 +1,32 @@
package com.bonus.material.purchase.mapper;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
import java.util.List;
/**
* 新购验收任务报告附件Mapper接口
*
* @author syruan
*/
public interface PurchaseCheckFileMapper {
/**
* 根据任务id查询新购验收任务详细报告列表--Join查询
* @param taskId 任务id
*/
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId);
/**
* 新增新购验收任务详细报告附件
*
* @param purchaseCheckFileDto 新购验收任务详细
* @return 结果
*/
int insertPurchaseCheckFiles(PurchaseCheckFileDto purchaseCheckFileDto);
}

View File

@ -34,6 +34,14 @@ public interface PurchaseNoticePersonMapper {
*/
public int insertPurchaseNoticePerson(PurchaseNoticePerson purchaseNoticePerson);
/**
* 批量新购短信通知人员
*
* @param purchaseNoticePersonList 新购短信通知人员集合
* @return 结果
*/
int insertBatchPurchaseNoticePerson(List<PurchaseNoticePerson> purchaseNoticePersonList);
/**
* 修改新购短信通知人员
*

View File

@ -1,7 +1,10 @@
package com.bonus.material.purchase.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
/**
* 新购验收任务详细Service接口
@ -16,7 +19,7 @@ public interface IPurchaseCheckDetailsService {
* @param id 新购验收任务详细主键
* @return 新购验收任务详细
*/
public PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id);
PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id);
/**
* 查询新购验收任务详细列表
@ -24,7 +27,19 @@ public interface IPurchaseCheckDetailsService {
* @param purchaseCheckDetails 新购验收任务详细
* @return 新购验收任务详细集合
*/
public List<PurchaseCheckDetails> selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails);
List<PurchaseCheckDetails> selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails);
/**
* 根据任务ID查询报告附件列表
* @param taskId 任务id
*/
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId);
/**
* 新增报告附件
* @param purchaseCheckFileDto 附件信息
*/
AjaxResult insertPurchaseCheckFile(PurchaseCheckFileDto purchaseCheckFileDto);
/**
* 新增新购验收任务详细
@ -32,7 +47,7 @@ public interface IPurchaseCheckDetailsService {
* @param purchaseCheckDetails 新购验收任务详细
* @return 结果
*/
public int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
/**
* 修改新购验收任务详细
@ -40,7 +55,7 @@ public interface IPurchaseCheckDetailsService {
* @param purchaseCheckDetails 新购验收任务详细
* @return 结果
*/
public int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
/**
* 批量删除新购验收任务详细
@ -48,7 +63,7 @@ public interface IPurchaseCheckDetailsService {
* @param ids 需要删除的新购验收任务详细主键集合
* @return 结果
*/
public int deletePurchaseCheckDetailsByIds(Long[] ids);
int deletePurchaseCheckDetailsByIds(Long[] ids);
/**
* 删除新购验收任务详细信息
@ -56,5 +71,5 @@ public interface IPurchaseCheckDetailsService {
* @param id 新购验收任务详细主键
* @return 结果
*/
public int deletePurchaseCheckDetailsById(Long id);
int deletePurchaseCheckDetailsById(Long id);
}

View File

@ -1,7 +1,10 @@
package com.bonus.material.purchase.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
/**
* 新购短信通知人员Service接口
@ -26,6 +29,12 @@ public interface IPurchaseNoticePersonService {
*/
public List<PurchaseNoticePerson> selectPurchaseNoticePersonList(PurchaseNoticePerson purchaseNoticePerson);
/**
* 批量发送短信
* @param purchaseNoticePersonDto 短信发送信息dto
*/
AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto);
/**
* 新增新购短信通知人员
*
@ -34,6 +43,14 @@ public interface IPurchaseNoticePersonService {
*/
public int insertPurchaseNoticePerson(PurchaseNoticePerson purchaseNoticePerson);
/**
* 批量新增新购短信通知人员
*
* @param purchaseNoticePersonList 新购短信通知人员集合
* @return 结果
*/
int insertBatchPurchaseNoticePerson(List<PurchaseNoticePerson> purchaseNoticePersonList);
/**
* 修改新购短信通知人员
*

View File

@ -3,12 +3,19 @@ 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.common.security.utils.SecurityUtils;
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
import com.bonus.material.purchase.mapper.PurchaseCheckFileMapper;
import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.service.IPurchaseCheckDetailsService;
import javax.annotation.Resource;
/**
* 新购验收任务详细Service业务层处理
*
@ -17,9 +24,13 @@ import com.bonus.material.purchase.service.IPurchaseCheckDetailsService;
*/
@Service
public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsService {
@Autowired
@Resource
private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper;
@Resource
private PurchaseCheckFileMapper purchaseCheckFileMapper;
/**
* 查询新购验收任务详细
*
@ -42,6 +53,39 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
return purchaseCheckDetailsMapper.selectPurchaseCheckDetailsList(purchaseCheckDetails);
}
/**
* 根据任务ID查询报告附件列表
*
* @param taskId 任务id
*/
@Override
public List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId) {
try {
return purchaseCheckFileMapper.selectPurchaseCheckFileListByTaskId(taskId);
} catch (Exception e) {
throw new RuntimeException("SQL执行错误:" + e.getMessage());
}
}
/**
* 新增报告附件
*
* @param purchaseCheckFileDto 附件信息
*/
@Override
public AjaxResult insertPurchaseCheckFile(PurchaseCheckFileDto purchaseCheckFileDto) {
try {
if (purchaseCheckFileDto != null) {
// TODO: 暂定魔法值字典表为26后续抽出定义为常量
purchaseCheckFileDto.setModelId(26);
purchaseCheckFileDto.setCreateBy(SecurityUtils.getLoginUser().getUsername());
}
return purchaseCheckFileMapper.insertPurchaseCheckFiles(purchaseCheckFileDto) > 0 ? AjaxResult.success() : AjaxResult.error("SQL插入0条");
} catch (Exception e) {
return AjaxResult.error("SQL执行错误:" + e.getMessage());
}
}
/**
* 新增新购验收任务详细
*

View File

@ -1,6 +1,16 @@
package com.bonus.material.purchase.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import cn.hutool.core.map.MapUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
@ -9,6 +19,7 @@ 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.apache.ibatis.reflection.ArrayUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper;
@ -63,19 +74,74 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
*/
@Override
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfoDto) {
// 查询新购info列表
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfoDto);
// 过滤info列表中空的对象
purchaseCheckInfos.removeIf(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() == null);
// 查询新购info列表并用stream流过滤掉info列表中空的对象 taskId为空的对象
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoJoinList(purchaseCheckInfoDto)
.stream()
.filter(Objects::nonNull)
.filter(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() != null)
.collect(Collectors.toList());
// 查询details表获取详细的采购物资名称
// ----------- for循环开始 -------------
for (PurchaseCheckInfo purchaseCheckInfo : purchaseCheckInfos) {
// 查询details表获取详细的采购物资名称
String purchaseMaName = purchaseCheckDetailsMapper.selectMaTypeNameByTaskId(purchaseCheckInfo.getTaskId(), null);
purchaseCheckInfo.setPurchaseMaTypeName(purchaseMaName != null ? purchaseMaName : "");
// 查询details表获取详细的采购物资数量价格
List<PurchaseCheckDetails> purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByTaskId(purchaseCheckInfo.getTaskId())
.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 定义初始化统计变量,使用 AtomicLong AtomicBigDecimal 来替代同步块提高性能
// 采购物资数量
AtomicLong purchaseMaTotalNumber = new AtomicLong(0L);
// 采购物资不含税价格
AtomicReference<BigDecimal> purchaseMaTotalNoTaxPrice = new AtomicReference<>(BigDecimal.ZERO);
// 执行for循环统计采购物资数量价格
for (PurchaseCheckDetails detail : purchaseCheckDetails) {
if (detail.getPurchaseNum() == null || detail.getPurchasePrice() == null) {
continue;
}
if (detail.getPurchaseNum() < 0 || detail.getPurchasePrice().compareTo(BigDecimal.ZERO) < 0) {
throw new IllegalArgumentException("采购数量和价格必须为非负数");
}
// 原代码块使用sync确保线程安全现更改为AtomicLong来替代同步块
// 统计采购数量
purchaseMaTotalNumber.addAndGet(detail.getPurchaseNum());
// 采购物资数量乘以采购不含税价格
purchaseMaTotalNoTaxPrice.updateAndGet(v -> v.add(new BigDecimal(detail.getPurchaseNum()).multiply(detail.getPurchasePrice())));
}
// 赋值统计出来的采购物资数量不含税价格
purchaseCheckInfo.setPurchaseMaNumber(purchaseMaTotalNumber.get());
purchaseCheckInfo.setPurchaseNoTaxPrice(purchaseMaTotalNoTaxPrice.get());
// 通过不含税价格及税率计算出含税价格并赋值
if (purchaseCheckInfo.getTaxRate() != null && purchaseCheckInfo.getPurchaseNoTaxPrice() != null) {
purchaseCheckInfo.setPurchaseTaxPrice(
calculateTaxPrice(purchaseMaTotalNoTaxPrice.get(), new BigDecimal(purchaseCheckInfo.getTaxRate()))
);
}
}
// ------------- for循环结束 -------------
return purchaseCheckInfos;
}
/**
* 含税价格计算
* @param purchaseNoTaxPrice 不含税价格
* @param taxRate 税率0~100 例如13%税率 值应该是整形:13
* @return 不含税价格100 税率为13%结果为 113.00
*/
public static BigDecimal calculateTaxPrice(BigDecimal purchaseNoTaxPrice, BigDecimal taxRate) {
BigDecimal one = BigDecimal.ONE;
return purchaseNoTaxPrice.multiply(one.add(taxRate)).setScale(2, RoundingMode.HALF_UP);
}
/**
* 新增新购验收任务
*

View File

@ -3,12 +3,17 @@ 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.utils.sms.SmsUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.purchase.mapper.PurchaseNoticePersonMapper;
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
import javax.annotation.Resource;
/**
* 新购短信通知人员Service业务层处理
*
@ -17,7 +22,8 @@ import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
*/
@Service
public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonService {
@Autowired
@Resource
private PurchaseNoticePersonMapper purchaseNoticePersonMapper;
/**
@ -42,6 +48,17 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
return purchaseNoticePersonMapper.selectPurchaseNoticePersonList(purchaseNoticePerson);
}
@Override
public AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto) {
String splitPhoneNumber = String.join(",", purchaseNoticePersonDto.getPhoneNumbers());
try {
String sendResult = SmsUtils.smsToken(splitPhoneNumber, purchaseNoticePersonDto.getContent(), null);
return AjaxResult.success(sendResult);
} catch (Exception e) {
throw new RuntimeException("短信发送异常:" + e.getMessage());
}
}
/**
* 新增新购短信通知人员
*
@ -58,6 +75,21 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
}
}
/**
* 批量新增新购短信通知人员
*
* @param purchaseNoticePersonList 新购短信通知人员集合
* @return 结果
*/
@Override
public int insertBatchPurchaseNoticePerson(List<PurchaseNoticePerson> purchaseNoticePersonList) {
try {
return purchaseNoticePersonMapper.insertBatchPurchaseNoticePerson(purchaseNoticePersonList);
} catch (Exception e) {
throw new RuntimeException("批量新增执行SQL错误:" + e.getMessage());
}
}
/**
* 修改新购短信通知人员
*

View File

@ -408,4 +408,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
a.del_flag = 0 AND a.`level` = '3'
</select>
<select id="selectMaTypeList" resultMap="TypeResult">
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num,
mtk.user_id keeperUserId,
su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark,m.type_id id , m.type_name label
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0'
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0'
left join ma_type_keeper mtk on m.type_id = mtk.type_id
left join sys_user su on mtk.user_id = su.user_id
<where>
m.del_flag = '0'
<if test="typeName != null and typeName !=''">
AND m.type_name like concat('%',#{typeName},'%')
</if>
</where>
</select>
</mapper>

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taskId" column="task_id" />
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
<result property="unitName" column="unit_name" />
<result property="maTypeName" column="ma_type_name" />
<result property="purchasePrice" column="purchase_price" />
<result property="purchaseNum" column="purchase_num" />
@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
pcd.file_url, pcd.company_id, mt.type_name, mt.unit_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

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.purchase.mapper.PurchaseCheckFileMapper">
<resultMap type="com.bonus.material.purchase.dto.PurchaseCheckFileDto" id="PurchaseCheckFileResult">
<result property="id" column="id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="taskId" column="task_id" />
<result property="dictCode" column="dict_code" />
<result property="dictLabel" column="dict_label" />
</resultMap>
<sql id="selectPurchaseCheckFileJoinVo">
SELECT
sdd.dict_code,sdd.dict_label,
bfi.id,bfi.file_name,bfi.file_url
FROM
sys_dict_data sdd
LEFT JOIN
bm_file_info bfi ON bfi.dic_id = sdd.dict_code
WHERE
sdd.dict_type = 'purchase_check_report_type'
</sql>
<select id="selectPurchaseCheckFileListByTaskId" parameterType="Long" resultMap="PurchaseCheckFileResult">
<include refid="selectPurchaseCheckFileJoinVo"/>
and bfi.task_id = #{taskId}
</select>
<insert id="insertPurchaseCheckFiles" parameterType="com.bonus.material.purchase.dto.PurchaseCheckFileDto" useGeneratedKeys="true" keyProperty="id">
insert into bm_file_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelId != null">model_id,</if>
<if test="fileName != null">file_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="dictCode != null">dic_id,</if>
<if test="createBy != null">create_by,</if>
create_time,
<if test="taskId != null">task_id</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId,jdbcType=INTEGER},</if>
<if test="fileName != null">#{fileName,jdbcType=VARCHAR},</if>
<if test="fileUrl != null">#{fileUrl,jdbcType=VARCHAR},</if>
<if test="dictCode != null">#{dictCode},</if>
<if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
now(),
<if test="taskId != null">#{taskId}</if>
</trim>
</insert>
</mapper>

View File

@ -6,10 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.bonus.material.purchase.domain.PurchaseCheckInfo" id="PurchaseCheckInfoResult">
<result property="id" column="id" />
<result property="taskId" column="task_id" />
<result property="code" column="code" />
<result property="purchaseTime" column="purchase_time" />
<result property="arrivalTime" column="arrival_time" />
<result property="purchaser" column="purchaser" />
<result property="createBy" column="create_by" />
<result property="createUserName" column="purchaser_name" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
@ -30,10 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
t.task_status, t.task_type, t.code, su.user_name as create_user_name
from
purchase_check_info pci
left join tm_task t on t.task_id = pci.task_id
left join sys_user su ON pci.create_by = su.user_id
</sql>
<select id="selectPurchaseCheckInfoList" parameterType="com.bonus.material.purchase.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult">

View File

@ -70,4 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<insert id="insertBatchPurchaseNoticePerson">
insert into purchase_notice_person(user_id,user_name,telphone,create_time) values
<foreach collection="list" item="item" separator=",">
(#{item.userId},#{item.userName},#{item.telphone},now())
</foreach>
</insert>
</mapper>