diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/controller/MaTypeController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/controller/MaTypeController.java new file mode 100644 index 0000000..1c36f8b --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/controller/MaTypeController.java @@ -0,0 +1,309 @@ +package com.bonus.material.ma.controller; + +import cn.hutool.core.convert.Convert; +import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.ServletUtils; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.mapper.MaTypeMapper; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.vo.MaType; +import com.bonus.material.ma.vo.TreeSelect; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.java.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import static com.bonus.common.core.constant.Constants.PAGE_NUM; +import static com.bonus.common.core.constant.Constants.PAGE_SIZE; + +/** + * 工机具类型管理控制层 + */ +@RestController +@Api(value = "工机具类型管理控制层") +@RequestMapping("/type") +public class MaTypeController extends BaseController { + + @Autowired + private ITypeService iTypeService; + + @Resource + private MaTypeMapper maTypeMapper; + + + /** + * 根据类型名称查询类型 + * + * @return 结果 + */ + @ApiOperation(value = "根据类型名称查询类型") + @GetMapping("/getMaTypeList") + public AjaxResult getMaTypeList(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) { + List maTypeList = iTypeService.getMaTypeList(typeName, parentId); + return AjaxResult.success(maTypeList); + } + + + /** + * 工机具类型下拉树 + * + * @return 结果 + */ + @ApiOperation(value = "工机具类型下拉树") + @GetMapping("/getMaTypeSelect") + public AjaxResult getMaTypeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) { + List maTypeList = iTypeService.getMaTypeSelect(typeName, parentId); + return AjaxResult.success(maTypeList); + } + + @ApiOperation(value = "获取机具设备的具体规格") + @GetMapping(value = "/selectMaTypeTreeByLevel") + public AjaxResult selectMaTypeTreeByLevel(@RequestParam(value = "typeId") String typeId) { + List maTypeList = maTypeMapper.selectMaTypeTreeByLevel(typeId); + return AjaxResult.success(maTypeList); + } + + /** + * 根据左列表类型id查询右表格 + * + * @param typeId + * @return + */ + @ApiOperation(value = "工器具类型") + @GetMapping("/equipmentType") + public AjaxResult equipmentType(@RequestParam(required = false) Long typeId, + @RequestParam(required = false) String typeName) { + List listByMaType = iTypeService.getEquipmentType(typeId, typeName); + return success(listByMaType); + } + + /** + * 获取规格层级为3的设备列表 + * + * @return 结果 + */ + @ApiOperation(value = "获取规格层级的设备列表") + @GetMapping("/selectMaTypeListByLevelIndex") + public AjaxResult selectMaTypeListByLevelIndex(@RequestParam(value = "level", required = false) Integer level, @RequestParam(value = "type") Integer type, @RequestParam(value = "parentId", required = false) Integer parentId, @RequestParam(value = "keyword", required = false) String keyword) { + if (type == null) { + return AjaxResult.error("参数错误,类型不能为空"); + } + if (type == 0) { + // 查询全部机具类型 + if (level == 0 || level == 1) { + // 查询全部等级、一级 + List treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null)); + List children = treeSelectList.get(0).getChildren(); + TreeSelect zero = new TreeSelect(); + zero.setLevel(2); + zero.setId(0L); + zero.setLabel("全部"); + zero.setParentId(0L); + children.add(0, zero); + return AjaxResult.success(treeSelectList); + } + if (level == 2) { + // 查询二级 + if (parentId == 0) { + List maTypes = maTypeMapper.selectMaTypeListByLevelNotFour(null, keyword); + return AjaxResult.success(maTypes); + } else { + return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword)); + } + + + // List treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString())); + // + // // 遍历剔除不符合的三级规格 + // for (TreeSelect treeSelect : treeSelectList) { + // List children = treeSelect.getChildren(); + // if (children != null) { + // for (TreeSelect child : children) { + // List grandChildren = child.getChildren(); + // if (grandChildren!= null) { + // grandChildren.removeIf(obj -> !Objects.equals(obj.getParentId(), Long.valueOf(parentId))); + // } + // } + // } + // } + // return AjaxResult.success(treeSelectList); + } + } + if (type == 1) { + // 查询施工机具 + List treeSelectList; + if (level != 2) { + treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null)); +// treeSelectList.removeIf(item -> item.getId() == 1L); + //List treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList()); + return AjaxResult.success(treeSelectList); + } else { + return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword)); + // treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString())); + // // 先过滤出施工机具 + // treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList()); + // // 再过滤出不符合的三级规格 + // if (!treeSelectList.isEmpty()) { + // for (TreeSelect treeSelect : treeSelectList) { + // List children = treeSelect.getChildren(); + // if (children != null) { + // for (TreeSelect child : children) { + // List grandChildren = child.getChildren(); + // if (grandChildren != null) { + // grandChildren.removeIf(obj -> !Objects.equals(obj.getParentId(), Long.valueOf(parentId))); + // } + // + // } + // } + // } + // } + // return AjaxResult.success(treeSelectList); + } + } + if (type == 2) { + List treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null)); + //treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 2L)).collect(Collectors.toList()); + // 查询安全工器具 + if (level == 2) { + return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword)); + // if (!treeSelectList.isEmpty()) { + // for (TreeSelect treeSelect : treeSelectList) { + // List children = treeSelect.getChildren(); + // if (children != null) { + // for (TreeSelect child : children) { + // List grandChildren = child.getChildren(); + // if (grandChildren != null) { + // grandChildren.removeIf(obj -> !Objects.equals(obj.getParentId(), Long.valueOf(parentId))); + // } + // } + // } + // } + // } + } + return AjaxResult.success(treeSelectList); + } + return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null, null)); + } + + /** + * 根据左列表类型id查询右表格 + * + * @param typeId + * @return + */ + @ApiOperation(value = "根据左列表类型id查询右表格") + @GetMapping("/getListByMaType") + public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) { + List parentIds = iTypeService.selectParentId(typeId, level); + List listByMaType = new ArrayList<>(); + for (Integer parentId : parentIds) { + listByMaType.addAll(iTypeService.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)); + } + + + /** + * 根据左列表类型id查询右表格 + * + * @param typeId + * @return + */ + @ApiOperation(value = "根据左列表类型id查询右表格") + @GetMapping("/getListByMaTypePid") + public AjaxResult getListByMaTypePid(Long typeId, @RequestParam(required = false) String typeName) { + List listByParentId = iTypeService.getListByParentId(typeId, 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, listByParentId)); + } + + /** + * 根据左列表类型id查询右表格 + * @param typeId + * @return + */ +// @ApiOperation(value = "根据左列表类型id查询右表格") +// @GetMapping("/getListByMaType") +// public TableDataInfo getListByMaType(@RequestParam(required = false) Long typeId, +// @RequestParam(required = false) String typeName, +// @RequestParam(required = false) Integer pageSize, +// @RequestParam(required = false) Integer pageNum){ +// if(typeId==null){ +// return null; +// } +// List listByMaType = iTypeService.getListByMaType(typeId, typeName); +// TableDataInfo rspData = new TableDataInfo(); +// rspData.setTotal(listByMaType.size()); +// rspData.setCode(HttpStatus.SUCCESS); +// // listByMaType = listByMaType.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); +// rspData.setRows(listByMaType); +// rspData.setMsg("查询成功"); +// +// return rspData; +// } + + /** + * 获取机具类型管理ma_type详细信息 + */ + @ApiOperation(value = "获取机具类型管理ma_type详细信息") + @GetMapping(value = "/{typeId}") + public AjaxResult getInfo(@PathVariable("typeId") Long typeId) { + return success(iTypeService.selectMaTypeByTypeId(typeId)); + } + + /** + * 新增机具类型管理ma_type + */ + @ApiOperation(value = "新增机具类型管理ma_type") + //@Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MaType maType) { + int result = iTypeService.insertMaType(maType); + if (result > 0) { + return success("新增成功"); + } else { + return AjaxResult.error("未新增成功,请查看同一层级是否有重名的类型!"); + } + } + + /** + * 修改机具类型管理ma_type + */ + @ApiOperation(value = "修改机具类型管理ma_type") + //@Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MaType maType) { + Long parentId = maType.getParentId(); + List subMas = maTypeMapper.getListByParentId(parentId, null); + List filteredItems = subMas.stream().collect(Collectors.toList()); + if (Objects.nonNull(maType.getTypeId())) { + filteredItems = subMas.stream().filter(item -> !maType.getTypeId().equals(item.getTypeId())).collect(Collectors.toList()); + } + boolean containsSameBrother = filteredItems.stream().anyMatch(o -> o.getTypeName().equals(maType.getTypeName())); + if (containsSameBrother) { + return AjaxResult.error("修改失败,同级存在相同名称"); + } + return toAjax(iTypeService.updateMaType(maType)); + } + + /** + * 删除机具类型管理ma_type + */ + @ApiOperation(value = "删除机具类型管理ma_type") + //@Log(title = "机具类型管理ma_type", businessType = BusinessType.DELETE) + @DeleteMapping("/{typeId}") + public AjaxResult remove(@PathVariable Long typeId) throws Exception { + return toAjax(iTypeService.deleteMaTypeByTypeId(typeId)); + } + + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeFileMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeFileMapper.java new file mode 100644 index 0000000..b1302da --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeFileMapper.java @@ -0,0 +1,64 @@ +package com.bonus.material.ma.mapper; + +import com.bonus.material.ma.vo.MaTypeFile; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 机具类型文件ma_type_fileMapper接口 + * + * @author bonus + * @date 2023-12-11 + */ +@Mapper +public interface MaTypeFileMapper { + /** + * 查询机具类型文件ma_type_file + * + * @param typeId 机具类型文件ma_type_file主键 + * @return 机具类型文件ma_type_file + */ + public MaTypeFile selectMaTypeFileByTypeId(Long typeId); + + /** + * 查询机具类型文件ma_type_file列表 + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 机具类型文件ma_type_file集合 + */ + public List selectMaTypeFileList(MaTypeFile maTypeFile); + + /** + * 新增机具类型文件ma_type_file + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 结果 + */ + public int insertMaTypeFile(MaTypeFile maTypeFile); + + /** + * 修改机具类型文件ma_type_file + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 结果 + */ + public int updateMaTypeFile(MaTypeFile maTypeFile); + + /** + * 删除机具类型文件ma_type_file + * + * @param typeId 机具类型文件ma_type_file主键 + * @return 结果 + */ + public int deleteMaTypeFileByTypeId(@Param("typeId") Long typeId, @Param("fileType") String fileType); + + /** + * 批量删除机具类型文件ma_type_file + * + * @param typeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMaTypeFileByTypeIds(Long[] typeIds); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java new file mode 100644 index 0000000..0264eaa --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java @@ -0,0 +1,87 @@ +package com.bonus.material.ma.mapper; + +import com.bonus.material.ma.vo.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工机具类型管理 数据层 + * + * @author ruoyi + */ +@Mapper +public interface MaTypeMapper { + + List selectMaTypeList(String typeName); + + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ + public MaType selectMaTypeByTypeId(Long typeId); + + + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int insertType(MaType maType); + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int updateType(MaType maType); + + /** + * 删除机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + public int deleteTypeById(Long typeId); + + int insertKeeper(MaTypeKeeper typeKeeper); + + int insertRepair(MaTypeRepair typeRepair); + + int insertMaPropSet(MaPropSet propSet); + + int updateKeeperByTypeId(MaTypeKeeper typeKeeper); + + int updateRepairByTypeId(MaTypeRepair typeRepair); + + int updatePropSetByTypeId(MaPropSet propSet); + + MaType selectTypeByTypeId(long typeId); + + List selectMaTypeTree(String parentId); + + List getListByParentId(@Param("typeId") Long typeId, @Param("typeName") String typeName); + + List selectMaTypeTreeByLevel(String id); + + List selectMaTypeListByLevelNotFour(@Param("parentId") String parentId,@Param("keyword")String keyword); + + List getMaTypeSelect(String parentId); + + int deleteTypeByTypeId(Long typeId); + + int deleteKeeperByTypeId(Long typeId); + + int deletePropSetByTypeId(Long typeId); + + int updateTypeNum(MaMachine maMachine); + + List selectMaTypeByUserId(Long userId); + + List selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level); +} \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/ITypeService.java new file mode 100644 index 0000000..01a7358 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -0,0 +1,71 @@ +package com.bonus.material.ma.service; + +import com.bonus.material.ma.vo.MaType; +import com.bonus.material.ma.vo.TreeSelect; + +import java.util.List; + +public interface ITypeService { + + List getMaTypeList(String typeName, String parentId); + List getMaTypeSelect(String typeName, String parentId); + + List getListByMaType(Long typeId, String typeName); + + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ + public MaType selectMaTypeByTypeId(Long typeId); + + + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int insertMaType(MaType maType); + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int updateMaType(MaType maType); + + /** + * 删除机具类型管理ma_type信息 + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + public int deleteMaTypeByTypeId(Long typeId) throws Exception; + + /** + * 构建前端所需要树结构 + * + * @param maTypeList 状态列表 + * @return 树结构列表 + */ + public List buildDeptTree(List maTypeList); + + + /** + * 构建前端所需要下拉树结构 + * + * @param maTypeList 工机具列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List maTypeList); + + List getListByParentId(Long typeId, String typeName); + List selectParentId(Long typeId, Integer level); + + List getEquipmentType(Long typeId, String typeName); + + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java new file mode 100644 index 0000000..114c9ba --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java @@ -0,0 +1,432 @@ +package com.bonus.material.ma.service.impl; + +import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.ma.mapper.MaTypeFileMapper; +import com.bonus.material.ma.mapper.MaTypeMapper; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.vo.*; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 工机具类型管理实现层 + */ +@Service +public class MaTypeServiceImpl implements ITypeService { + + @Resource + private MaTypeMapper maTypeMapper; + + @Resource + private MaTypeFileMapper typeFileMapper; + + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ + @Override + public MaType selectMaTypeByTypeId(Long typeId) { + return maTypeMapper.selectMaTypeByTypeId(typeId); + } + + + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + @Override + @Transactional + public int insertMaType(MaType maType) { + Long parentId = maType.getParentId(); + List subMas = maTypeMapper.getListByParentId(parentId, null); + boolean containsSameBrother = subMas.stream().anyMatch(o -> o.getTypeName().equals(maType.getTypeName())); + if (containsSameBrother) { + return 0; + } + MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId); + String level; + if (maType1 == null) { + level = "0"; + } else { + level = maType1.getLevel(); + } + maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); + maType.setCreateTime(DateUtils.getNowDate()); + if (parentId == 0) { + maType.setCompanyId("101"); + } else { + maType.setCompanyId(maType1.getCompanyId()); + } + int i = maTypeMapper.insertType(maType); + Long typeId = maType.getTypeId(); + // 图片路径保存 + if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { + MaTypeFile typeFile = new MaTypeFile(); + typeFile.setTypeId(typeId); + typeFile.setFileName(maType.getPhotoName()); + typeFile.setFileUrl(maType.getPhotoUrl()); + typeFile.setFileType("1"); + typeFile.setCreateTime(DateUtils.getNowDate()); + typeFileMapper.insertMaTypeFile(typeFile); + } + // 文档路径保存 + if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) { + MaTypeFile typeFile1 = new MaTypeFile(); + typeFile1.setTypeId(typeId); + typeFile1.setFileName(maType.getDocumentName()); + typeFile1.setFileUrl(maType.getDocumentUrl()); + typeFile1.setFileType("2"); + typeFile1.setCreateTime(DateUtils.getNowDate()); + typeFileMapper.insertMaTypeFile(typeFile1); + } + // 库管员配置 + if (Objects.nonNull(maType.getKeeperUserId())) { + MaTypeKeeper typeKeeper = new MaTypeKeeper(); + typeKeeper.setUserId(maType.getKeeperUserId()); + typeKeeper.setTypeId(typeId); + typeKeeper.setCreateTime(DateUtils.getNowDate()); + maTypeMapper.insertKeeper(typeKeeper); + } + + // 维修员配置 + if (Objects.nonNull(maType.getRepairUserId())) { + MaTypeRepair typeRepair = new MaTypeRepair(); + typeRepair.setUserId(maType.getRepairUserId()); + typeRepair.setTypeId(typeId); + typeRepair.setCreateTime(DateUtils.getNowDate()); + maTypeMapper.insertRepair(typeRepair); + } + + // 资产属性配置 + if (maType.getPropId() > 0) { + MaPropSet propSet = new MaPropSet(); + propSet.setTypeId(typeId); + propSet.setPropId(maType.getPropId()); + propSet.setCreateTime(DateUtils.getNowDate()); + maTypeMapper.insertMaPropSet(propSet); + } + + return i; + } + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + @Override + public int updateMaType(MaType maType) { + Long typeId = maType.getTypeId(); + maType.setUpdateTime(DateUtils.getNowDate()); + int i = maTypeMapper.updateType(maType); + // 图片路径保存 + if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { + typeFileMapper.deleteMaTypeFileByTypeId(typeId, "1"); + MaTypeFile typeFile = new MaTypeFile(); + typeFile.setTypeId(typeId); + typeFile.setFileName(maType.getPhotoName()); + typeFile.setFileUrl(maType.getPhotoUrl()); + typeFile.setFileType("1"); + typeFile.setCreateTime(DateUtils.getNowDate()); + typeFile.setUpdateTime(DateUtils.getNowDate()); + typeFileMapper.insertMaTypeFile(typeFile); + } + // 文档路径保存 + if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) { + typeFileMapper.deleteMaTypeFileByTypeId(typeId, "2"); + MaTypeFile typeFile1 = new MaTypeFile(); + typeFile1.setTypeId(typeId); + typeFile1.setFileName(maType.getDocumentName()); + typeFile1.setFileUrl(maType.getDocumentUrl()); + typeFile1.setFileType("2"); + typeFile1.setCreateTime(DateUtils.getNowDate()); + typeFile1.setUpdateTime(DateUtils.getNowDate()); + typeFileMapper.insertMaTypeFile(typeFile1); + } + // 库管员配置 + if (maType.getKeeperUserId() != null) { + maTypeMapper.deleteKeeperByTypeId(typeId); + MaTypeKeeper typeKeeper = new MaTypeKeeper(); + typeKeeper.setUserId(maType.getKeeperUserId()); + typeKeeper.setTypeId(typeId); + typeKeeper.setCreateTime(DateUtils.getNowDate()); + typeKeeper.setUpdateTime(DateUtils.getNowDate()); + maTypeMapper.insertKeeper(typeKeeper); + } + + // 维修员配置 + if (maType.getRepairUserId() != null) { + maTypeMapper.deleteTypeByTypeId(typeId); + MaTypeRepair typeRepair = new MaTypeRepair(); + typeRepair.setUserId(maType.getRepairUserId()); + typeRepair.setTypeId(typeId); + maTypeMapper.insertRepair(typeRepair); + } + // 资产属性配置 + if (maType.getPropId() >= 0L) { + maTypeMapper.deletePropSetByTypeId(typeId); + MaPropSet propSet = new MaPropSet(); + propSet.setTypeId(typeId); + propSet.setPropId(maType.getPropId()); + propSet.setCreateTime(DateUtils.getNowDate()); + propSet.setUpdateTime(DateUtils.getNowDate()); + maTypeMapper.insertMaPropSet(propSet); + } + return i; + } + + /** + * 删除机具类型管理ma_type信息 + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + @Override + public int deleteMaTypeByTypeId(Long typeId) throws Exception { + List listByParentId = maTypeMapper.getListByParentId(typeId, ""); + if (listByParentId.size() > 0) { + throw new Exception("子级类型不为空!!!"); + } + return maTypeMapper.deleteTypeById(typeId); + } + + @Override + public List getMaTypeList(String typeName, String parentId) { + List maTypes = maTypeMapper.selectMaTypeTree(parentId); + List treeSelectList = buildDeptTreeSelect(maTypes); + //如果没有查询到那么返回空 + return treeSelectList; + } + + @Override + public List getMaTypeSelect(String typeName, String parentId) { + List maTypes = maTypeMapper.getMaTypeSelect(parentId); + List treeSelectList = buildDeptTreeSelect(maTypes); + //如果没有查询到那么返回空 + return treeSelectList; + } + + + /** + * 根据左列表类型id查询右表格 + * + * @param typeId + * @return + */ + @Override + public List getListByMaType(Long typeId, String typeName) { + List maTypes = maTypeMapper.selectMaTypeList(""); + MaType maType = new MaType(); + maType.setTypeId(typeId); + + List typeListByMaType = getTypeListByMaType(Collections.singletonList(maType), maTypes, new ArrayList<>()); + + if (StringUtils.isNotNull(typeName)) { + //根据类型名称过滤集合 + List types = typeListByMaType + .stream() + .filter(ma -> ma.getTypeName().contains(typeName)) + .collect(Collectors.toList()); + //如果没有查询到那么返回空 + return types; + } + return typeListByMaType; + } + + /** + * 根据父级类型递归获取树结构 + * + * @param + * @return + */ + private List getTypeListByMaType(List parentTypes, List oldMaTypes, List newMaTypes) { + //初始化新容器 + if (newMaTypes == null) { + newMaTypes = new ArrayList<>(); + //添加父级对象 左边需要添加因为需要显示 右边不需要添加因为不需要显示 + newMaTypes.addAll(parentTypes); + } + //递归父级容器 + List parentList = new ArrayList<>(); + //过滤相同数据,减少循环,性能优化 + oldMaTypes = oldMaTypes.stream().filter(oldMaType -> !parentTypes.contains(oldMaType)).collect(Collectors.toList()); + for (MaType maType : oldMaTypes) { + for (MaType parentType : parentTypes) { + if (maType.getParentId().equals(parentType.getTypeId())) { + + newMaTypes.add(maType); + parentList.add(maType); + } + } + } + //如果还有父级递归查询 + if (parentList.size() > 0) { + return getTypeListByMaType(parentList, oldMaTypes, newMaTypes); + } else { + List result = new ArrayList<>(); + for (MaType type : newMaTypes) { + boolean a = true; + Long typeId1 = type.getTypeId(); + for (MaType type1 : newMaTypes) { + Long pid = type1.getParentId(); + if (typeId1.equals(pid)) { + a = false; + } + } + if (a) { + result.add(type); + } + } + //返回 + return result; + } + } + + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 构建前端所需要树结构 + * + * @param maTypeList 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List maTypeList) { + List returnList = new ArrayList(); + List tempList = maTypeList.stream().map(MaType::getTypeId).collect(Collectors.toList()); + for (MaType maType : maTypeList) { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(maType.getParentId())) { + recursionFn(maTypeList, maType); + returnList.add(maType); + } + } + if (returnList.isEmpty()) { + returnList = maTypeList; + } + return returnList; + } + + /** + * 根据组织树parent_id查询结果 + * + * @param typeId 父级id + * @param typeName 名称筛选 + * @return + */ + @Override + public List getListByParentId(Long typeId, String typeName) { + return maTypeMapper.getListByParentId(typeId, typeName); + } + + @Override + public List selectParentId(Long typeId, Integer level) { + return maTypeMapper.selectParentId(typeId, level); + } + + /** + * 查询工器具类型四级组织树 + * + * @param typeId + * @param typeName + * @return + */ + @Override + public List getEquipmentType(Long typeId, String typeName) { + List maTypes = maTypeMapper.selectMaTypeList(""); + List list = new ArrayList<>(); + for (MaType maType : maTypes) { + if (maType.getParentId() == 0) { + list.add(maType); + } + } + List tree = new ArrayList<>(); + //根据父节点获取对应的儿子节点 + for (MaType maType : list) { + List child = getChild(maTypes, maType.getTypeId()); + maType.setChildren(child); + tree.add(maType); + } + + return list; + } + + /** + * @Author dingjie + * @Date 2023/12/14 + * @Description 递归调用获取儿子 + */ + public List getChild(List list, Long parentId) { + List childList = new ArrayList(); + for (MaType maType : list) { + Long typeId = maType.getTypeId(); + Long pid = maType.getParentId(); + if (parentId.equals(pid)) { + List childLists = getChild(list, typeId); + + maType.setChildren(childLists); + childList.add(maType); + } + } + return childList; + } + + + /** + * 递归列表 + */ + private void recursionFn(List list, MaType t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (MaType tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + + /** + * 得到子节点列表 + */ + private List getChildList(List list, MaType t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + MaType n = (MaType) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getTypeId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, MaType t) { + return getChildList(list, t).size() > 0 ? true : false; + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaMachine.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaMachine.java new file mode 100644 index 0000000..1215e5b --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaMachine.java @@ -0,0 +1,273 @@ +package com.bonus.material.ma.vo; + + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * + * @author Dingjie + * @date + */ +@ApiModel(value="com.bonus.sgzb.base.api.domain.MaMachine") +@Data +public class MaMachine extends BaseEntity { + /** + * 机具ID + */ + @ApiModelProperty(value = "机具ID") + private long maId; + /** + * 类型ID + */ + @ApiModelProperty(value = "类型ID") + private long typeId; + /** + * 类型ID + */ + @ApiModelProperty(value = "资产属性id") + private long propId; + /** + * 物品种类 + */ + @ApiModelProperty(value = "物品种类id") + private long itemId; + /** + * 设备类型 + */ + @ApiModelProperty(value = "设备类型id") + private long deviceId; + /** + * 物品种类 + */ + @ApiModelProperty(value = "物品种类") + @Excel(name = "物品种类", sort = 1) + private String itemType; + /** + * 设备类型 + */ + @ApiModelProperty(value = "设备类型") + @Excel(name = "设备类型", sort = 2) + private String deviceType; + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号", sort = 3) + private String specificationType; + /** + * 机具编号 + */ + @ApiModelProperty(value = "机具编号") + @Excel(name = "设备编码", sort = 4) + private String maCode; + /** + * 原编号 + */ + @ApiModelProperty(value = "原编号") + @Excel(name = "设备原编号", sort = 8) + private String preCode; + /** + * 机具状态(数据字典) + */ + @ApiModelProperty(value = "机具状态(数据字典)") + private String maStatus; + /** + * 机具状态(数据字典) + */ + @ApiModelProperty(value = "机具状态(数据字典)名称") + @Excel(name = "设备状态", sort = 6) + private String maStatusName; + /** + * 二维码 + */ + @ApiModelProperty(value = "二维码") + @Excel(name = "二维码", sort = 9) + private String qrCode; + /** + * 购置价 + */ + @ApiModelProperty(value = "购置价") + private String buyPrice; + /** + * 厂家 + */ + @ApiModelProperty(value = "厂家") + private String maVender; + /** + * 出厂日期 + */ + @ApiModelProperty(value = "出厂日期") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date outFacTime; + /** + * 出厂编号 + */ + @ApiModelProperty(value = "出厂编号") + private String outFacCode; + /** + * 固定资产编号 + */ + @ApiModelProperty(value = "固定资产编号") + @Excel(name = "固定资产编号", sort = 7) + private String assetsCode; + /** + * 本次检验人 + */ + @ApiModelProperty(value = "本次检验人") + private String checkMan; + /** + * 本次检验日期 + */ + @ApiModelProperty(value = "本次检验日期") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date thisCheckTime; + /** + * 下次检验日期 + */ + @ApiModelProperty(value = "下次检验日期") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date nextCheckTime; + /** + * gps编号 + */ + @ApiModelProperty(value = "gps编号") + private String gpsCode; + /** + * rfid编号 + */ + @ApiModelProperty(value = "rfid编号") + private String rfidCode; + /** + * erp编号 + */ + @ApiModelProperty(value = "erp编号") + private String erpCode; + /** + * 调拨编号 + */ + @ApiModelProperty(value = "调拨编号") + private String transferCode; + /** + * 出入库次数 + */ + @ApiModelProperty(value = "出入库次数") + private String inOutNum; + /** + * 购置批次 + */ + @ApiModelProperty(value = "购置批次") + @Excel(name = "采购单号", sort = 5) + private String buyTask; + /** + * 所在仓库 + */ + @ApiModelProperty(value = "所在仓库") + private String ownHouse; + /** + * 数据所属组织 + */ + @ApiModelProperty(value = "数据所属组织") + private String companyId; + + /** + * 绑定人 + */ + @ApiModelProperty(value = "绑定人") + private String binder; + /** + * 标签编号 + */ + @ApiModelProperty(value = "标签编号") + private String labelCode; + + + @ApiModelProperty(value = "筛选名称") + private String keyWord; + + @ApiModelProperty(value = "开始时间") + private String beginTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "仓库名称") + @Excel(name = "所在仓库", sort = 10) + private String ownHouseName; + @ApiModelProperty(value = "仓库id") + private Long houseId; + @ApiModelProperty(value = "厂家名称") + private String supplier; + /** + * 检验人员 + */ + private String inspectMan; + /** + * 检验结论 + */ + private String inspectStatus; + /** + * 联系电话 + */ + private String phone; + /** + * 领料单位 + */ + private String leaseUnit; + /** + * 领料工程 + */ + private String leasePro; + /** + * 领料时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date leaseTime; + /** + * 退料单位 + */ + private String backUnit; + /** + * 退料工程 + */ + private String backPro; + /** + * 退料时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date backTime; + + @ApiModelProperty(value = "1:二维码绑定标识 2:rfid绑定标识") + private Integer flag; + + @ApiModelProperty(value = "数据来源(0新购 1盘点 2数据推送)") + private Integer souceBy; + + @ApiModelProperty(value = "数据推送id") + private Integer dataReceiveId; + + /** 导出选中列表 */ + private List dataCondition; + + @ApiModelProperty(value = "绑定IOT设备数量") + private Integer IotNum; + + @ApiModelProperty(value = "Iot定位设备编号") + private String iotCode; + + @ApiModelProperty(value = "推送到租赁标识0:未推送 1:推送") + private Integer pushStatus; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaPropSet.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaPropSet.java new file mode 100644 index 0000000..bc76c86 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaPropSet.java @@ -0,0 +1,63 @@ +package com.bonus.material.ma.vo; + +import com.bonus.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class MaPropSet extends BaseEntity { + + private static final long serialVersionUID = 1L; + /** + * ID + */ + private long id; + /** + * 资产ID + */ + private long propId; + /** + * 类型ID + */ + private long typeId; + + @ApiModelProperty(value = "类型ids") + private String typeIds; + + /** + * 帐号状态(0正常 1停用) + */ + private String status; + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + /** + * 创建者 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新者 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 备注 + */ + private String remark; + /** + * 数据所属组织 + */ + private String companyId; + + private String propName; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java new file mode 100644 index 0000000..871a28e --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java @@ -0,0 +1,217 @@ +package com.bonus.material.ma.vo; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 工机具类型管理实体类 + */ + +/** + * + * @author rsyao + * @date + */ +@Data +public class MaType extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 类型ID */ + @ApiModelProperty(value = "类型ID") + private Long typeId; + + /** 类型名称 */ + @ApiModelProperty(value = "类型名称") + @Excel(name = "名称") + private String typeName; + + /** 类型ID */ + @ApiModelProperty(value = "类型ID,用作组织树筛选") + private Long id; + + /** 类型名称 */ + @ApiModelProperty(value = "类型名称,用作组织树筛选") + private String label; + + /** 上级ID */ + @ApiModelProperty(value = "上级ID") + private Long parentId; + + /** 帐号状态(0正常 1停用) */ + @ApiModelProperty(value = "帐号状态(0正常 1停用)") + private String status; + + /** 实时库存 */ + @ApiModelProperty(value = "实时库存") + private Integer storageNum; + + /** 计量单位id */ + @ApiModelProperty(value = "计量单位id") + private String unitId; + + /** 计量单位 */ + @ApiModelProperty(value = "计量单位") + @Excel(name = "计量单位") + private String unitName; + + /** 管理方式 */ + @ApiModelProperty(value = "管理方式") + private String manageType; + + /** 租赁单价 */ + @ApiModelProperty(value = "租赁单价") + @Excel(name = "租赁价格") + private BigDecimal leasePrice; + + /** 租赁单价 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "租赁单价") + private Date effTime; + + @ApiModelProperty(value = "外部价格") + private BigDecimal rentPrice; + private BigDecimal finalPrice; + + /** 原价 */ + @ApiModelProperty(value = "原价") + @Excel(name = "原值") + private BigDecimal buyPrice; + + /** 丢失赔偿价 */ + @ApiModelProperty(value = "丢失|赔偿价") + @Excel(name = "丢失赔偿价") + private BigDecimal payPrice; + + /** 层级 */ + @ApiModelProperty(value = "层级") + private String level; + + /** 额定载荷 */ + @ApiModelProperty(value = "额定载荷") + private String ratedLoad; + + /** 试验载荷 */ + @ApiModelProperty(value = "试验载荷") + private String testLoad; + + /** 持荷时间 */ + @ApiModelProperty(value = "持荷时间") + private String holdingTime; + + /** 库存预警数量 */ + @ApiModelProperty(value = "库存预警数量") + private Integer warnNum; + + /** 库存预警数量 */ + @ApiModelProperty(value = "是否计划管理(0代表否 1代表是)") + private String isPlan; + + /** 库存预警数量 */ + @ApiModelProperty(value = "是否安措费机具(0代表否1代表是)") + private String isAncuo; + + /** 删除标志(0代表存在 2代表删除) */ + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") + private String delFlag; + + /** 创建者 */ + @ApiModelProperty(value = "创建者") + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private Date createTime; + + /** 更新者 */ + @ApiModelProperty(value = "更新者") + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + /** 备注 */ + @ApiModelProperty(value = "备注") + @Excel(name = "备注信息") + private String remark; + + /** 数据所属组织 */ + @ApiModelProperty(value = "数据所属组织") + private String companyId; + + /** 图片名称 */ + @ApiModelProperty(value = "图片名称") + @Excel(name = "图片") + private String photoName; + + /** 图片路径 */ + @ApiModelProperty(value = "图片路径") + private String photoUrl; + private String childPhoto; + + /** 文档名称 */ + @ApiModelProperty(value = "文档名称") + @Excel(name = "文档资料") + private String documentName; + + /** 文档路径 */ + @ApiModelProperty(value = "文档路径") + private String documentUrl; + + /** 库管员id */ + @ApiModelProperty(value = "库管员id") + private Integer keeperUserId; + + /** 库管员名称 */ + @ApiModelProperty(value = "库管员名称") + @Excel(name = "库管员") + private String keeperUserName; + + /** 库管员id */ + @ApiModelProperty(value = "维修员id") + private Integer repairUserId; + + /** 维修员名称 */ + @ApiModelProperty(value = "维修员名称") + private String repairUserName; + + /** 资产属性id */ + @ApiModelProperty(value = "资产属性id") + private long propId; + + /** 资产属性名称 */ + @ApiModelProperty(value = "资产属性名称") + @Excel(name = "资产属性") + private String propName; + + /** 资产属性名称 */ + @ApiModelProperty(value = "类型编码") + private String code; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children = new ArrayList<>(); + + /** + * 厂家规格型号 + */ + @ApiModelProperty(value = "厂家规格型号") + private String facModel; + + /* + * 推送智慧工程定义的门类分类机具编码 + * */ + @ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码") + private String intelligentCode; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFile.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFile.java new file mode 100644 index 0000000..1869b89 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFile.java @@ -0,0 +1,108 @@ +package com.bonus.material.ma.vo; + + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; + +@SuppressWarnings("serial") +public class MaTypeFile extends BaseEntity { + + private static final long serialVersionUID = 1L; + + //类型ID + @Excel(name = "类型ID") + private Long typeId; + + //机具ID + @Excel(name = "机具ID") + private String maId; + + //文件名称 + @Excel(name = "文件名称") + private String fileName; + + //文件地址 + @Excel(name = "文件地址") + private String fileUrl; + + //上传文件类型(数据字典) + @Excel(name = "上传文件类型(数据字典)") + private String fileType; + + //上传人 + @Excel(name = "上传人") + private String userId; + + //帐号状态(0正常 1停用) + @Excel(name = "帐号状态(0正常 1停用)") + private String status; + + //数据所属组织 + @Excel(name = "数据所属组织") + private String companyId; + + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + public String getMaId() { + return maId; + } + + public void setMaId(String maId) { + this.maId = maId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } +} + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFileMapper.xml b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFileMapper.xml new file mode 100644 index 0000000..d55db9f --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeFileMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + select type_id, ma_id, file_name, file_url, file_type, user_id, status, company_id from ma_type_file + + + + + + + + insert into ma_type_file + + type_id, + ma_id, + file_name, + file_url, + file_type, + user_id, + create_time, + update_time, + status, + company_id, + + + #{typeId}, + #{maId}, + #{fileName}, + #{fileUrl}, + #{fileType}, + #{userId}, + #{createTime}, + #{updateTime}, + #{status}, + #{companyId}, + + + + + update ma_type_file + + ma_id = #{maId}, + file_name = #{fileName}, + file_url = #{fileUrl}, + user_id = #{userId}, + update_time = now(), + status = #{status}, + company_id = #{companyId}, + + where type_id = #{typeId} and file_type = #{fileType} + + + + delete from ma_type_file where type_id = #{typeId} and file_type = #{fileType} + + + + delete from ma_type_file where type_id in + + #{typeId} + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeKeeper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeKeeper.java new file mode 100644 index 0000000..d10474d --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeKeeper.java @@ -0,0 +1,47 @@ +package com.bonus.material.ma.vo; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; + +@SuppressWarnings("serial") +public class MaTypeKeeper extends BaseEntity { + + private static final long serialVersionUID = 1L; + + //类型ID + @Excel(name = "类型ID") + private Long typeId; + + //用户 + @Excel(name = "用户") + private Integer userId; + + //数据所属组织 + @Excel(name = "数据所属组织") + private String companyId; + + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } +} + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeRepair.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeRepair.java new file mode 100644 index 0000000..4b0b739 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeRepair.java @@ -0,0 +1,79 @@ +package com.bonus.material.ma.vo; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 维修班机具配置ma_type_repair对象 ma_type_repair + * + * @author bonus + * @date 2023-12-11 + */ +public class MaTypeRepair extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 类型ID */ + private Long typeId; + + /** 用户 */ + @Excel(name = "用户") + private Integer userId; + + /** 创建时间 */ + @Excel(name = "创建时间") + private String time; + + /** 数据所属组织 */ + @Excel(name = "数据所属组织") + private String companyId; + + public void setTypeId(Long typeId) + { + this.typeId = typeId; + } + + public Long getTypeId() + { + return typeId; + } + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public Integer getUserId() + { + return userId; + } + public void setTime(String time) + { + this.time = time; + } + + public String getTime() + { + return time; + } + public void setCompanyId(String companyId) + { + this.companyId = companyId; + } + + public String getCompanyId() + { + return companyId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("typeId", getTypeId()) + .append("userId", getUserId()) + .append("time", getTime()) + .append("companyId", getCompanyId()) + .toString(); + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java new file mode 100644 index 0000000..bf65755 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java @@ -0,0 +1,118 @@ +package com.bonus.material.ma.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelect implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private Long id; + + /** 节点名称 */ + private String label; + + private Integer level; + + private Long parentId; + + private String companyId; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelect() + { + + } + +// public TreeSelect(MaHouse maHouse) +// { +// this.level = maHouse.getLevel(); +// this.id = maHouse.getHouseId(); +// this.label = maHouse.getHouseName(); +// this.children = maHouse.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); +// } + + public TreeSelect(MaType maType) + { + this.parentId = maType.getParentId(); + this.level = Integer.valueOf(maType.getLevel()); + this.id = maType.getTypeId(); + this.label = maType.getTypeName(); + this.companyId = maType.getCompanyId(); + this.children = maType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } +// public TreeSelect(SysDept dept) +// { +// this.id = dept.getDeptId(); +// this.label = dept.getDeptName(); +// this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); +// } + + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Integer getLevel() { + return level; + } + + public void setLevel(Integer level) { + this.level = level; + } + + public String getLabel() + { + return label; + } + + public void setLabel(String label) + { + this.label = label; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml new file mode 100644 index 0000000..ce7e62a --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select type_id, type_name, parent_id, status, storage_num, company_id, code, unit_id, unit_name, manage_type, lease_price, eff_time, rent_price, buy_price, pay_price, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, update_by, update_time, is_plan, is_ancuo, remark,intelligent_code ,fac_model, child_photo from ma_type + + + + insert into ma_type + + type_name, + parent_id, + status, + storage_num, + company_id, + code, + unit_id, + unit_name, + manage_type, + lease_price, + eff_time, + rent_price, + buy_price, + pay_price, + level, + rated_load, + test_load, + holding_time, + warn_num, + del_flag, + create_by, + create_time, + update_by, + update_time, + is_plan, + is_ancuo, + remark, + fac_model, + intelligent_code, + + + #{typeName}, + #{parentId}, + #{status}, + #{storageNum}, + #{companyId}, + #{code}, + #{unitId}, + #{unitName}, + #{manageType}, + #{leasePrice}, + #{effTime}, + #{rentPrice}, + #{buyPrice}, + #{payPrice}, + #{level}, + #{ratedLoad}, + #{testLoad}, + #{holdingTime}, + #{warnNum}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{isPlan}, + #{isAncuo}, + #{remark}, + #{facModel}, + #{intelligentCode}, + + + + + insert into ma_type_file( + type_id, + ma_id, + file_name, + file_url, + file_type, + user_id, + status, + company_id, + create_time + )values( + #{typeId}, + #{maId}, + #{fileName}, + #{fileUrl}, + #{fileType}, + #{userId}, + #{status}, + #{companyId}, + sysdate() + ) + + + + update ma_type + + type_name = #{typeName}, + parent_id = #{parentId}, + status = #{status}, + storage_num = #{storageNum}, + unit_id = #{unitId}, + unit_name = #{unitName}, + manage_type = #{manageType}, + lease_price = #{leasePrice}, + rent_price = #{rentPrice}, + eff_time = #{effTime}, + buy_price = #{buyPrice}, + pay_price = #{payPrice}, + level = #{level}, + rated_load = #{ratedLoad}, + test_load = #{testLoad}, + holding_time = #{holdingTime}, + warn_num = #{warnNum}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + is_plan = #{isPlan}, + is_ancuo = #{isAncuo}, + remark = #{remark}, + company_id = #{companyId}, + fac_model = #{facModel}, + intelligent_code = #{intelligentCode}, + + where type_id = #{typeId} + + + + update ma_type set del_flag = '2' where type_id = #{typeId} + + + delete from ma_type_repair where type_id = #{typeId} + + + delete from ma_type_keeper where type_id = #{typeId} + + + delete from ma_prop_set where type_id = #{typeId} + + + + + + + + + + + + insert into ma_type_keeper + + type_id, + user_id, + create_time, + update_time, + company_id, + + + #{typeId}, + #{userId}, + #{createTime}, + #{updateTime}, + #{companyId}, + + + + + insert into ma_type_repair + + type_id, + user_id, + create_time, + update_time, + company_id, + + + #{typeId}, + #{userId}, + #{createTime}, + #{updateTime}, + #{companyId}, + + + + + insert into ma_prop_set + + prop_id, + type_id, + status, + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + company_id, + + + #{propId}, + #{typeId}, + #{status}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{companyId}, + + + + + + + update ma_type_keeper set user_id = #{userId},update_time = now() where type_id = #{typeId} + + + + update ma_type_repair set user_id = #{userId},update_time = now() where type_id = #{typeId} + + + + update ma_prop_set set prop_id = #{propId} where type_id = #{typeId} + + + + + + + + + + + + + + + + + update ma_type set storage_num = IFNULL( storage_num, 0 ) + 1 where type_id = #{typeId} + + \ No newline at end of file