diff --git a/sgzb-modules/sgzb-machine/pom.xml b/sgzb-modules/sgzb-machine/pom.xml index 5bd341d9..507aca75 100644 --- a/sgzb-modules/sgzb-machine/pom.xml +++ b/sgzb-modules/sgzb-machine/pom.xml @@ -33,6 +33,10 @@ 3.6.3 compile + + com.bonus.sgzb + sgzb-common-core + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaLabelBindController.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaLabelBindController.java new file mode 100644 index 00000000..6175a44c --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaLabelBindController.java @@ -0,0 +1,123 @@ +package com.bonus.sgzb.machine.controller; + +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.machine.damain.MaPropInfo; +import com.bonus.sgzb.machine.damain.MaType; +import com.bonus.sgzb.machine.service.IMaLabelBindService; +import com.bonus.sgzb.machine.vo.MaLabelBindVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 机具设备标签ma_label_bind(MaLabelBind)表控制层 + * + * @author makejava + * @since 2023-11-28 16:37:43 + */ +@RestController +@RequestMapping("maLabelBind") +public class MaLabelBindController extends BaseController { + /** + * 服务对象 + */ + @Autowired + private IMaLabelBindService maLabelBindService; + + /** + * 查询标签绑定管理列表 + * @param typeName + * @return + */ + @GetMapping("/list") + public TableDataInfo list(String typeName) + { + startPage(); + List list = maLabelBindService.selectMaLabelList(typeName); + return getDataTable(list); + } + + /** + * 标签绑定管理列表数据导出 + * @param response + * @param typeName + */ + @PostMapping("/export") + public void export(HttpServletResponse response, String typeName) + { + List list = maLabelBindService.selectMaLabelList(typeName); + ExcelUtil util = new ExcelUtil(MaLabelBindVO.class); + util.exportExcel(response, list, "标签绑定管理列表数据"); + } + + /** + * 标签批量绑定 + * @param labelIds + * @return + */ + @PutMapping("/{labelIds}") + public AjaxResult batchBind(@PathVariable Long[] labelIds) + { + return toAjax(maLabelBindService.batchBindByIds(labelIds)); + } + + /** + * 标签解绑 + * @param labelId + * @return + */ + @PutMapping("/{labelId}") + public AjaxResult batchNoBind(@PathVariable Long labelId) + { + return toAjax(maLabelBindService.batchNoBindByIds(labelId)); + } + + /** + * 导入标签管理数据 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + String fileName = file.getOriginalFilename(); + if (fileName != null) { + String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); + long fileSize = file.getSize(); + if (!fileExtension.equalsIgnoreCase("xls") && !fileExtension.equalsIgnoreCase("xlsx")) { + // 文件后缀名不符合要求 + return error("文件后缀名不符合要求"); + } else if (fileSize > 10 * 1024 * 1024) { + // 文件大小超过10M + return error("文件大小超过10M"); + } + } + ExcelUtil util = new ExcelUtil(MaLabelBindVO.class); + List maLabelBindList = util.importExcel(file.getInputStream()); + String operName = SecurityUtils.getUsername(); + String message = maLabelBindService.importMaLabel(maLabelBindList, updateSupport, operName); + return success(message); + } + + /** + * 修改标签管理数据 + * @param maLabelBindVO + * @return + */ + @PutMapping + public AjaxResult update(@Validated @RequestBody MaLabelBindVO maLabelBindVO){ + maLabelBindService.updatetMaLabel(maLabelBindVO); + return success(); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPartTypeController.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPartTypeController.java new file mode 100644 index 00000000..09226cb3 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPartTypeController.java @@ -0,0 +1,90 @@ +package com.bonus.sgzb.machine.controller;; + +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.machine.damain.MaHouse; +import com.bonus.sgzb.machine.damain.MaPartType; +import com.bonus.sgzb.machine.damain.MaType; +import com.bonus.sgzb.machine.service.IPartTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +import static com.bonus.sgzb.common.core.web.domain.AjaxResult.error; + +/** + * 配件类型管理ma_part_type(MaPartType)表控制层 + * + * @author makejava + * @since 2023-11-27 16:44:02 + */ +@RestController +@RequestMapping("maPartType") +public class MaPartTypeController extends BaseController { + /** + * 服务对象 + */ + @Autowired + private IPartTypeService maPartTypeService; + + /** + * 查询配件类型列表 + * @param maPartType + * @return + */ + @GetMapping("/list") + public TableDataInfo list(MaPartType maPartType) + { + startPage(); + List list = maPartTypeService.selectMaPartList(maPartType); + return getDataTable(list); + } + + /** + * 新增配件管理 + * @param maPartType + * @return + */ + @PostMapping + public AjaxResult add(@Validated @RequestBody MaPartType maPartType){ + if (!maPartTypeService.checkPaNameUnique(maPartType)) { + return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在"); + } + maPartType.setCreateBy(SecurityUtils.getUsername()); + return toAjax(maPartTypeService.insertMaPart(maPartType)); + } + + /** + * 导出配件类型管理 + * @param response + * @param maPartType + */ + @PostMapping("/export") + public void export(HttpServletResponse response, MaPartType maPartType) + { + List list = maPartTypeService.selectMyPartTypeList(maPartType); + ExcelUtil util = new ExcelUtil(MaPartType.class); + util.exportExcel(response, list, "配件类型管理数据"); + } + + /** + * 删除配件管理类型 + * @param paId + * @return + */ + @DeleteMapping("/{paId}") + public AjaxResult delete(@PathVariable("paId") Long paId){ + if (maPartTypeService.hasChildBypaId(paId)) + { + return warn("存在下级仓库列表,不允许删除"); + } + return toAjax(maPartTypeService.deletePaById(paId)); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPropInfoController.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPropInfoController.java new file mode 100644 index 00000000..9e63270e --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaPropInfoController.java @@ -0,0 +1,130 @@ +package com.bonus.sgzb.machine.controller; + +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.machine.damain.MaHouse; +import com.bonus.sgzb.machine.damain.MaPropInfo; +import com.bonus.sgzb.machine.damain.MaType; +import com.bonus.sgzb.machine.service.IMaPropInfoService; +import com.bonus.sgzb.system.api.domain.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 资产管理ma_prop_info(MaPropInfo)表控制层 + * + * @author makejava + * @since 2023-11-28 10:18:05 + */ +@RestController +@RequestMapping("maPropInfo") +public class MaPropInfoController extends BaseController { + /** + * 服务对象 + */ + @Autowired + private IMaPropInfoService maPropInfoService; + + /** + * 查询资产属性列表 + * @param propName + * @return + */ + @GetMapping("/list") + public TableDataInfo list(String propName) + { + startPage(); + List list = maPropInfoService.selectMaPropInfoList(propName); + return getDataTable(list); + } + + /** + * 新建资产属性 + * @param maPropInfo + * @return + */ + @PostMapping + public AjaxResult add(@Validated @RequestBody MaPropInfo maPropInfo){ + if (!maPropInfoService.checkPropNameUnique(maPropInfo)) { + return error("新增资产名称'" + maPropInfo.getPropName() + "'失败,资产名称已存在"); + } + maPropInfo.setCreateBy(SecurityUtils.getUsername()); + return toAjax(maPropInfoService.insertMaPropInfo(maPropInfo)); + } + + /** + * 删除资产管理 + * @param propId + * @return + */ + @DeleteMapping("/{propId}") + public AjaxResult delete(@PathVariable("propId") Long propId){ + return toAjax(maPropInfoService.deleteMaPropById(propId)); + } + + /** + * 修改资产管理 + * @param maPropInfo + * @return + */ + @PutMapping + public AjaxResult update(@Validated @RequestBody MaPropInfo maPropInfo){ + if (!maPropInfoService.checkPropNameUnique(maPropInfo)) { + return error("新增资产名称'" + maPropInfo.getPropName() + "'失败,资产名称已存在"); + } + maPropInfo.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(maPropInfoService.updatetMaProp(maPropInfo)); + } + + /** + * 资产属性导出 + * @param response + * @param propName + */ + @PostMapping("/export") + public void export(HttpServletResponse response, String propName) + { + List list = maPropInfoService.selectMaPropInfoList(propName); + ExcelUtil util = new ExcelUtil(MaPropInfo.class); + util.exportExcel(response, list, "资产属性类型数据"); + } + + /** + * 资产属性管理导入 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + String fileName = file.getOriginalFilename(); + if (fileName != null) { + String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); + long fileSize = file.getSize(); + if (!fileExtension.equalsIgnoreCase("xls") && !fileExtension.equalsIgnoreCase("xlsx")) { + // 文件后缀名不符合要求 + return error("文件后缀名不符合要求"); + } else if (fileSize > 10 * 1024 * 1024) { + // 文件大小超过10M + return error("文件大小超过10M"); + } + } + ExcelUtil util = new ExcelUtil(MaPropInfo.class); + List maPropInfoList = util.importExcel(file.getInputStream()); + String operName = SecurityUtils.getUsername(); + String message = maPropInfoService.importMaProp(maPropInfoList, updateSupport, operName); + return success(message); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaTypeKeeperController.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaTypeKeeperController.java new file mode 100644 index 00000000..541da98f --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/controller/MaTypeKeeperController.java @@ -0,0 +1,53 @@ +package com.bonus.sgzb.machine.controller; + +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.machine.service.IMaTypeKeeperService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 库管员配置ma_type_keeper(MaTypeKeeper)表控制层 + * + * @author makejava + * @since 2023-11-28 15:34:00 + */ +@RestController +@RequestMapping("maTypeKeeper") +public class MaTypeKeeperController extends BaseController { + /** + * 服务对象 + */ + @Autowired + private IMaTypeKeeperService maTypeKeeperService; + + /** + * 根据人员名称查询左侧列表 + * @param userName + * @return + */ + @GetMapping("/getMaUserList") + public AjaxResult getMaUserList(String userName){ + + return AjaxResult.success(maTypeKeeperService.getMaUserList(userName)); + } + + /** + * 根据userId查询右侧列表 + * @param userId + * @param typeName + * @return + */ + @GetMapping("/getListByMaType/{userId}/{typeName}") + public TableDataInfo getListByMaType(@PathVariable("userId") Long userId, @PathVariable("typeName") String typeName) { + + if (userId == null) { + return null; + } + startPage(); + return getDataTable(maTypeKeeperService.getListByMaType(userId, typeName)); + } + +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaLabelBind.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaLabelBind.java new file mode 100644 index 00000000..063d7178 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaLabelBind.java @@ -0,0 +1,51 @@ +package com.bonus.sgzb.machine.damain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 机具设备标签ma_label_bind(MaLabelBind)表实体类 + * + * @author makejava + * @since 2023-11-28 16:37:46 + */ +@Data +@SuppressWarnings("serial") +public class MaLabelBind { + + //机具ID + @Excel(name = "机具ID") + private Long maId; + + //标签编号 + @Excel(name = "标签编号") + private String labelCode; + + //类型ID + @Excel(name = "类型ID") + private Long typeId; + + //绑定时间 + @Excel(name = "绑定时间") + private Date bindTime; + + //绑定人 + @Excel(name = "绑定人") + private String binder; + + //是否绑定(0 是, 1 否) + @Excel(name = "是否绑定") + private String isBind; + + //标签类型(数据字典) + @Excel(name = "标签类型(数据字典)") + private Long labelType; + + //数据所属组织 + @Excel(name = "数据所属组织") + private String companyId; + +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaPartType.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaPartType.java new file mode 100644 index 00000000..a674fd22 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaPartType.java @@ -0,0 +1,221 @@ +package com.bonus.sgzb.machine.damain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; + +import java.util.Date; + +/** + * 配件类型管理ma_part_type(MaPartType)表实体类 + * + * @author makejava + * @since 2023-11-27 16:44:09 + */ +@SuppressWarnings("serial") +public class MaPartType extends BaseEntity { + + private static final long serialVersionUID = 1L; + + //类型ID + @Excel(name = "类型ID") + private Long paId; + + //类型名称 + @Excel(name = "类型名称") + private String paName; + + //上级ID + @Excel(name = "上级ID") + private Long parentId; + + //帐号状态(0正常 1停用) + @Excel(name = "帐号状态(0正常 1停用)") + private String status; + + //实时库存 + @Excel(name = "实时库存") + private String num; + + //计量单位ID + @Excel(name = "计量单位ID") + private String unitId; + + //原值 + @Excel(name = "原值") + private String buyPrice; + + //层级 + @Excel(name = "层级") + private String level; + + //库存预警数量 + @Excel(name = "库存预警数量") + private String warnNum; + + //删除标志(0代表存在 2代表删除) + @Excel(name = "删除标志(0代表存在 2代表删除)") + private String delFlag; + + //创建者 + @Excel(name = "创建者") + private String createBy; + + //创建时间 + @Excel(name = "创建时间") + private Date createTime; + + //更新者 + @Excel(name = "更新者") + private String updateBy; + + //更新时间 + @Excel(name = "更新时间") + private Date updateTime; + + //备注 + @Excel(name = "备注") + private String remark; + + //数据所属组织 + @Excel(name = "数据所属组织") + private String companyId; + + public Long getPaId() { + return paId; + } + + public void setPaId(Long paId) { + this.paId = paId; + } + + public String getPaName() { + return paName; + } + + public void setPaName(String paName) { + this.paName = paName; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getUnitId() { + return unitId; + } + + public void setUnitId(String unitId) { + this.unitId = unitId; + } + + public String getBuyPrice() { + return buyPrice; + } + + public void setBuyPrice(String buyPrice) { + this.buyPrice = buyPrice; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getWarnNum() { + return warnNum; + } + + public void setWarnNum(String warnNum) { + this.warnNum = warnNum; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + @Override + public String getCreateBy() { + return createBy; + } + + @Override + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public String getUpdateBy() { + return updateBy; + } + + @Override + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + @Override + public Date getUpdateTime() { + return updateTime; + } + + @Override + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeFile.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeFile.java new file mode 100644 index 00000000..d05bdea8 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeFile.java @@ -0,0 +1,126 @@ +package com.bonus.sgzb.machine.damain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; + +/** + * 机具类型文件ma_type_file(MaTypeFile)表实体类 + * + * @author makejava + * @since 2023-11-28 11:08:29 + */ + +@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; + + //上传时间 + @Excel(name = "上传时间") + private String time; + + //帐号状态(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 getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + 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/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeKeeper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeKeeper.java new file mode 100644 index 00000000..e006a3a6 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/damain/MaTypeKeeper.java @@ -0,0 +1,34 @@ +package com.bonus.sgzb.machine.damain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; + +/** + * 库管员配置ma_type_keeper(MaTypeKeeper)表实体类 + * + * @author makejava + * @since 2023-11-28 11:07:34 + */ +@SuppressWarnings("serial") +public class MaTypeKeeper extends BaseEntity { + + private static final long serialVersionUID = 1L; + + //类型ID + @Excel(name = "类型ID") + private Long typeId; + + //用户 + @Excel(name = "用户") + private Long userId; + + //创建时间 + @Excel(name = "创建时间") + private String time; + + //数据所属组织 + @Excel(name = "数据所属组织") + private String companyId; + +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaLabelBindMapper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaLabelBindMapper.java new file mode 100644 index 00000000..3880b406 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaLabelBindMapper.java @@ -0,0 +1,67 @@ +package com.bonus.sgzb.machine.mapper; + +import com.bonus.sgzb.machine.vo.MaLabelBindVO; + +import java.util.List; + +/** + * 机具设备标签ma_label_bind(MaLabelBind)表数据库访问层 + * + * @author makejava + * @since 2023-11-28 16:37:45 + */ +public interface MaLabelBindMapper { + + /** + * 查询标签绑定管理列表 + * @param typeName + * @return + */ + List selectMaLabelList(String typeName); + + /** + * 批量绑定 + * @param labelIds + * @return + */ + int updateBind(Long[] labelIds); + + /** + * 标签解绑 + * @param labelId + * @return + */ + int updateNoBind(Long labelId); + + /** + * 验证类型名称唯一性 + * @param typeName + * @return + */ + MaLabelBindVO checkLabelNameUnique(String typeName); + + /** + * 新增标签类型数据 + * @param maLabelBindVO + */ + void insertLabel(MaLabelBindVO maLabelBindVO); + + /** + * 新增类型 + * @param maLabelBindVO + */ + void insertType(MaLabelBindVO maLabelBindVO); + + /** + * 更新标签类型数据 + * @param maLabelBindVO + */ + void updateMaLabel(MaLabelBindVO maLabelBindVO); + + /** + * 修改类型 + * @param maLabelBindVO + */ + void updateMaType(MaLabelBindVO maLabelBindVO); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPartTypeMapper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPartTypeMapper.java new file mode 100644 index 00000000..125c31b9 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPartTypeMapper.java @@ -0,0 +1,50 @@ +package com.bonus.sgzb.machine.mapper; + +import com.bonus.sgzb.machine.damain.MaPartType; + +import java.util.List; + +/** + * 配件类型管理ma_part_type(MaPartType)表数据库访问层 + * + * @author makejava + * @since 2023-11-27 16:44:07 + */ +public interface MaPartTypeMapper { + + /** + * 校验配件类型唯一性 + * @param paId + * @return + */ + MaPartType checkPartNameUnique(Long paId); + + /** + * 新增配件类型 + * @param maPartType + * @return + */ + int insertMaPartType(MaPartType maPartType); + + /** + * 查询配件类型列表 + * @param maPartType + * @return + */ + List selectMaPartType(MaPartType maPartType); + + /** + * 查询是否含有子集 + * @param paId + * @return + */ + int hasChildByPaId(Long paId); + + /** + * 删除配件类型 + * @param paId + * @return + */ + int deletePaById(Long paId); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPropInfoMapper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPropInfoMapper.java new file mode 100644 index 00000000..8382c0f2 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaPropInfoMapper.java @@ -0,0 +1,50 @@ +package com.bonus.sgzb.machine.mapper; + +import com.bonus.sgzb.machine.damain.MaPropInfo; + +import java.util.List; + +/** + * 资产管理ma_prop_info(MaPropInfo)表数据库访问层 + * + * @author makejava + * @since 2023-11-28 10:18:07 + */ +public interface MaPropInfoMapper { + + /** + * 根据资产名称查询资产属性列表 + * @param propName + * @return + */ + List selectMaPropSet(String propName); + + /** + * 校验资产项目名称唯一性 + * @param propName + * @return + */ + MaPropInfo checkPropNameUnique(String propName); + + /** + * 新增资产项目 + * @param maPropInfo + * @return + */ + int insertProp(MaPropInfo maPropInfo); + + /** + * 删除资产项目 + * @param propId + * @return + */ + int deleteMaProp(Long propId); + + /** + * 修改资产属性 + * @param maPropInfo + * @return + */ + int updateMaProp(MaPropInfo maPropInfo); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeFileMapper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeFileMapper.java new file mode 100644 index 00000000..952c31b8 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeFileMapper.java @@ -0,0 +1,15 @@ +package mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import .pojo.MaTypeFile; + +/** + * 机具类型文件ma_type_file(MaTypeFile)表数据库访问层 + * + * @author makejava + * @since 2023-11-28 11:08:28 + */ +public interface MaTypeFileMapper extends BaseMapper { + +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeKeeperMapper.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeKeeperMapper.java new file mode 100644 index 00000000..c5d54add --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/mapper/MaTypeKeeperMapper.java @@ -0,0 +1,31 @@ +package com.bonus.sgzb.machine.mapper; + +import com.bonus.sgzb.machine.vo.DeptUser; +import com.bonus.sgzb.machine.vo.MaTypeKeeperVO; + +import java.util.List; + +/** + * 库管员配置ma_type_keeper(MaTypeKeeper)表数据库访问层 + * + * @author makejava + * @since 2023-11-28 11:07:26 + */ +public interface MaTypeKeeperMapper { + + /** + * 根据人员名称查询左侧列表 + * @param userName + * @return + */ + List selectUserList(String userName); + + /** + * 根据userId查询右侧列表 + * @param userId + * @param typeName + * @return + */ + List selectListByUserId(Long userId, String typeName); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaLabelBindService.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaLabelBindService.java new file mode 100644 index 00000000..12be6357 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaLabelBindService.java @@ -0,0 +1,53 @@ +package com.bonus.sgzb.machine.service; + +import com.bonus.sgzb.machine.damain.MaHouse; +import com.bonus.sgzb.machine.vo.MaLabelBindVO; + +import java.util.List; + +/** + * 机具设备标签ma_label_bind(MaLabelBind)表服务接口 + * + * @author makejava + * @since 2023-11-28 16:37:51 + */ +public interface IMaLabelBindService { + + /** + * 查询标签绑定管理列表 + * @param typeName + * @return + */ + List selectMaLabelList(String typeName); + + /** + * 批量绑定 + * @param labelIds + * @return + */ + int batchBindByIds(Long[] labelIds); + + /** + * 标签解绑 + * @param labelId + * @return + */ + int batchNoBindByIds(Long labelId); + + /** + * 导入标签管理数据 + * @param maLabelBindList 导入数据 + * @param updateSupport 存在是否更新 + * @param operName 操作人 + * @return + */ + String importMaLabel(List maLabelBindList, boolean updateSupport, String operName); + + /** + * 修改标签管理数据 + * @param maLabelBindVO + * @return + */ + void updatetMaLabel(MaLabelBindVO maLabelBindVO); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaPropInfoService.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaPropInfoService.java new file mode 100644 index 00000000..541fa59d --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaPropInfoService.java @@ -0,0 +1,60 @@ +package com.bonus.sgzb.machine.service; + +import com.bonus.sgzb.machine.damain.MaPropInfo; + +import java.util.List; + +/** + * 资产管理ma_prop_info(MaPropInfo)表服务接口 + * + * @author makejava + * @since 2023-11-28 10:18:10 + */ +public interface IMaPropInfoService { + + /** + * 查询资产属性列表 + * @param propName + * @return + */ + List selectMaPropInfoList(String propName); + + /** + * 校验资产项目名称唯一性 + * @param maPropInfo + * @return + */ + boolean checkPropNameUnique(MaPropInfo maPropInfo); + + /** + * 新增资产项目 + * @param maPropInfo + * @return + */ + int insertMaPropInfo(MaPropInfo maPropInfo); + + /** + * 删除资产管理 + * @param propId + * @return + */ + int deleteMaPropById(Long propId); + + /** + * 修改资产管理 + * @param maPropInfo + * @return + */ + int updatetMaProp(MaPropInfo maPropInfo); + + /** + * 导入资产管理数据 + * + * @param maPropInfoList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + String importMaProp(List maPropInfoList, boolean isUpdateSupport, String operName); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaTypeKeeperService.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaTypeKeeperService.java new file mode 100644 index 00000000..85539a9b --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IMaTypeKeeperService.java @@ -0,0 +1,31 @@ +package com.bonus.sgzb.machine.service; + +import com.bonus.sgzb.machine.vo.DeptUser; +import com.bonus.sgzb.machine.vo.MaTypeKeeperVO; + +import java.util.List; + +/** + * 库管员配置ma_type_keeper(MaTypeKeeper)表服务接口 + * + * @author makejava + * @since 2023-11-28 15:34:02 + */ +public interface IMaTypeKeeperService { + + /** + * 根据人员名称查询左侧列表 + * @param userName + * @return + */ + List getMaUserList(String userName); + + /** + * 根据userId查询右侧列表 + * @param userId + * @param typeName + * @return + */ + List getListByMaType(Long userId, String typeName); +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IPartTypeService.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IPartTypeService.java new file mode 100644 index 00000000..bd864cae --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/IPartTypeService.java @@ -0,0 +1,59 @@ +package com.bonus.sgzb.machine.service; + + +import com.bonus.sgzb.machine.damain.MaPartType; + +import java.util.List; + +/** + * 配件类型管理ma_part_type(MaPartType)表服务接口 + * + * @author makejava + * @since 2023-11-27 16:44:19 + */ +public interface IPartTypeService { + + /** + * 校验配件名称唯一性 + * @param maPartType + * @return + */ + boolean checkPaNameUnique(MaPartType maPartType); + + /** + * 新增配件类型 + * @param maPartType + * @return + */ + int insertMaPart(MaPartType maPartType); + + /** + * 查询配件类型列表 + * @param maPartType + * @return + */ + List selectMaPartList(MaPartType maPartType); + + /** + * 导出配件管理 + * @param maPartType + * @return + */ + List selectMyPartTypeList(MaPartType maPartType); + + /** + * 查询是否含有子集 + * @param paId + * @return + */ + boolean hasChildBypaId(Long paId); + + /** + * 删除配件类型 + * @param paId + * @return + */ + int deletePaById(Long paId); +} + + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaLabelBindServiceImpl.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaLabelBindServiceImpl.java new file mode 100644 index 00000000..eda91cf3 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaLabelBindServiceImpl.java @@ -0,0 +1,141 @@ +package com.bonus.sgzb.machine.service.impl; + +import com.bonus.sgzb.common.core.exception.ServiceException; +import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.common.core.utils.bean.BeanValidators; +import com.bonus.sgzb.machine.damain.MaPropInfo; +import com.bonus.sgzb.machine.mapper.MaLabelBindMapper; +import com.bonus.sgzb.machine.service.IMaLabelBindService; +import com.bonus.sgzb.machine.vo.MaLabelBindVO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.validation.Validator; +import java.util.List; + +/** + * 机具设备标签ma_label_bind(MaLabelBind)表服务实现类 + * + * @author makejava + * @since 2023-11-28 16:37:53 + */ +@Service("maLabelBindService") +@Slf4j +public class MaLabelBindServiceImpl implements IMaLabelBindService { + + @Autowired + private MaLabelBindMapper maLabelBindMapper; + + @Autowired + protected Validator validator; + /** + * 查询标签绑定管理列表 + * @param typeName + * @return + */ + @Override + public List selectMaLabelList(String typeName) { + return maLabelBindMapper.selectMaLabelList(typeName); + } + + /** + * 批量绑定 + * @param labelIds + * @return + */ + @Override + public int batchBindByIds(Long[] labelIds) { + return maLabelBindMapper.updateBind(labelIds); + } + + /** + * 标签解绑 + * @param labelId + * @return + */ + @Override + public int batchNoBindByIds(Long labelId) { + return maLabelBindMapper.updateNoBind(labelId); + } + + /** + * 导入标签管理数据 + * @param maLabelBindList 导入数据 + * @param updateSupport 存在是否更新 + * @param operName 操作人 + * @return + */ + @Override + public String importMaLabel(List maLabelBindList, boolean updateSupport, String operName) { + if (StringUtils.isNull(maLabelBindList) || maLabelBindList.size() == 0) + { + throw new ServiceException("导入的数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (MaLabelBindVO maLabelBindVO : maLabelBindList) + { + try + { + // 验证是否存在这个类型名称 + MaLabelBindVO m = maLabelBindMapper.checkLabelNameUnique(maLabelBindVO.getTypeName()); + if (StringUtils.isNull(m)) + { + BeanValidators.validateWithException(validator, maLabelBindVO); + maLabelBindMapper.insertLabel(maLabelBindVO); + maLabelBindMapper.insertType(maLabelBindVO); + successNum++; + successMsg.append("
" + successNum + "、类型名称 " + maLabelBindVO.getTypeName() + " 导入成功"); + } + else if (updateSupport) + { + BeanValidators.validateWithException(validator, maLabelBindVO); + maLabelBindVO.setLabelId(m.getLabelId()); + maLabelBindMapper.updateMaLabel(maLabelBindVO); + maLabelBindMapper.updateMaType(maLabelBindVO); + successNum++; + successMsg.append("
" + successNum + "、类型名称 " + maLabelBindVO.getTypeName() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、类型名称 " + maLabelBindVO.getTypeName() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、类型名称 " + maLabelBindVO.getTypeName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } + + /** + * 修改标签管理数据 + * @param maLabelBindVO + * @return + */ + @Override + public void updatetMaLabel(MaLabelBindVO maLabelBindVO) { + //修改标签列表数据 + maLabelBindMapper.updateMaLabel(maLabelBindVO); + //修改类型数据 + maLabelBindMapper.updateMaType(maLabelBindVO); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPartTypeServiceImpl.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPartTypeServiceImpl.java new file mode 100644 index 00000000..dfd9c382 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPartTypeServiceImpl.java @@ -0,0 +1,93 @@ +package com.bonus.sgzb.machine.service.impl; + +import com.bonus.sgzb.common.core.constant.UserConstants; +import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.machine.damain.MaPartType; +import com.bonus.sgzb.machine.damain.MaType; +import com.bonus.sgzb.machine.mapper.MaPartTypeMapper; +import com.bonus.sgzb.machine.service.IPartTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 配件类型管理ma_part_type(MaPartType)表服务实现类 + * + * @author makejava + * @since 2023-11-27 16:44:20 + */ +@Service("maPartTypeService") +public class MaPartTypeServiceImpl implements IPartTypeService { + + @Autowired + private MaPartTypeMapper maPartTypeMapper; + /** + * 校验配件名称唯一性 + * @param maPartType + * @return + */ + @Override + public boolean checkPaNameUnique(MaPartType maPartType) { + Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId(); + MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId()); + if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增配件管理 + * @param maPartType + * @return + */ + @Override + public int insertMaPart(MaPartType maPartType) { + + return maPartTypeMapper.insertMaPartType(maPartType); + } + + /** + * 查询配件类型列表 + * @param maPartType + * @return + */ + @Override + public List selectMaPartList(MaPartType maPartType) { + return maPartTypeMapper.selectMaPartType(maPartType); + } + + /** + * 导出配件管理类型 + * @param maPartType + * @return + */ + @Override + public List selectMyPartTypeList(MaPartType maPartType) { + return maPartTypeMapper.selectMaPartType(maPartType); + } + + /** + * 查询是否含有子集 + * @param paId + * @return + */ + @Override + public boolean hasChildBypaId(Long paId) { + int result = maPartTypeMapper.hasChildByPaId(paId); + return result > 0; + } + + /** + * 删除配件类型 + * @param paId + * @return + */ + @Override + public int deletePaById(Long paId) { + return maPartTypeMapper.deletePaById(paId); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPropInfoServiceImpl.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPropInfoServiceImpl.java new file mode 100644 index 00000000..411c0fdd --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaPropInfoServiceImpl.java @@ -0,0 +1,159 @@ +package com.bonus.sgzb.machine.service.impl; + +import com.bonus.sgzb.common.core.constant.UserConstants; +import com.bonus.sgzb.common.core.exception.ServiceException; +import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.common.core.utils.bean.BeanValidators; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.machine.damain.MaHouse; +import com.bonus.sgzb.machine.damain.MaPropInfo; +import com.bonus.sgzb.machine.mapper.MaPropInfoMapper; +import com.bonus.sgzb.machine.service.IMaPropInfoService; +import com.bonus.sgzb.system.api.domain.SysUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.validation.Validator; +import java.util.List; + +/** + * 资产管理ma_prop_info(MaPropInfo)表服务实现类 + * + * @author makejava + * @since 2023-11-28 10:18:12 + */ +@Service("maPropInfoService") +@Slf4j +public class MaPropInfoServiceImpl implements IMaPropInfoService { + + @Autowired + private MaPropInfoMapper maPropInfoMapper; + + @Autowired + protected Validator validator; + + /** + * 查询资产属性列表 + * @param propName + * @return + */ + @Override + public List selectMaPropInfoList(String propName) { + return maPropInfoMapper.selectMaPropSet(propName); + } + + /** + * 校验资产项目名称唯一性 + * @param maPropInfo + * @return + */ + @Override + public boolean checkPropNameUnique(MaPropInfo maPropInfo) { + Long propId = StringUtils.isNull(maPropInfo.getPropId()) ? -1L : maPropInfo.getPropId(); + MaPropInfo info = maPropInfoMapper.checkPropNameUnique(maPropInfo.getPropName()); + if (StringUtils.isNotNull(info) && info.getPropId().longValue() != propId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增资产项目 + * @param maPropInfo + * @return + */ + @Override + public int insertMaPropInfo(MaPropInfo maPropInfo) { + return maPropInfoMapper.insertProp(maPropInfo); + } + + /** + * 删除资产管理 + * @param propId + * @return + */ + @Override + public int deleteMaPropById(Long propId) { + return maPropInfoMapper.deleteMaProp(propId); + } + + /** + * 修改资产管理 + * @param maPropInfo + * @return + */ + @Override + public int updatetMaProp(MaPropInfo maPropInfo) { + return maPropInfoMapper.updateMaProp(maPropInfo); + } + + /** + * 导入资产管理数据 + * + * @param maPropInfoList 资产管理数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + @Override + public String importMaProp(List maPropInfoList, boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(maPropInfoList) || maPropInfoList.size() == 0) + { + throw new ServiceException("导入的数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (MaPropInfo maPropInfo : maPropInfoList) + { + try + { + // 验证是否存在这个资产名称 + MaPropInfo m = maPropInfoMapper.checkPropNameUnique(maPropInfo.getPropName()); + if (StringUtils.isNull(m)) + { + BeanValidators.validateWithException(validator, maPropInfo); + maPropInfo.setCreateBy(operName); + maPropInfoMapper.insertProp(maPropInfo); + successNum++; + successMsg.append("
" + successNum + "、资产名称 " + maPropInfo.getPropName() + " 导入成功"); + } + else if (isUpdateSupport) + { + BeanValidators.validateWithException(validator, maPropInfo); + maPropInfo.setPropId(m.getPropId()); + maPropInfo.setUpdateBy(operName); + maPropInfoMapper.updateMaProp(maPropInfo); + successNum++; + successMsg.append("
" + successNum + "、资产名称 " + maPropInfo.getPropName() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、资产名称 " + maPropInfo.getPropName() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、资产名称 " + maPropInfo.getPropName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaTypeKeeperServiceImpl.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaTypeKeeperServiceImpl.java new file mode 100644 index 00000000..bc5255f2 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/service/impl/MaTypeKeeperServiceImpl.java @@ -0,0 +1,47 @@ +package com.bonus.sgzb.machine.service.impl; + +import com.bonus.sgzb.machine.mapper.MaTypeKeeperMapper; +import com.bonus.sgzb.machine.service.IMaTypeKeeperService; +import com.bonus.sgzb.machine.vo.DeptUser; +import com.bonus.sgzb.machine.vo.MaTypeKeeperVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 库管员配置ma_type_keeper(MaTypeKeeper)表服务实现类 + * + * @author makejava + * @since 2023-11-28 15:34:03 + */ +@Service("maTypeKeeperService") +public class MaTypeKeeperServiceImpl implements IMaTypeKeeperService { + + @Autowired + private MaTypeKeeperMapper maTypeKeeperMapper; + + /** + * 根据人员名称查询左侧列表 + * @param userName + * @return + */ + @Override + public List getMaUserList(String userName) { + + return maTypeKeeperMapper.selectUserList(userName); + } + + /** + * 根据userId查询右侧列表 + * @param userId + * @param typeName + * @return + */ + @Override + public List getListByMaType(Long userId, String typeName) { + + return maTypeKeeperMapper.selectListByUserId(userId, typeName); + } +} + diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/DeptUser.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/DeptUser.java new file mode 100644 index 00000000..6e3a2753 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/DeptUser.java @@ -0,0 +1,16 @@ +package com.bonus.sgzb.machine.vo; + +import com.bonus.sgzb.common.core.annotation.Excel; +import lombok.Data; + +@Data +public class DeptUser { + + //部门名称 + @Excel(name = "部门名称") + private String deptName; + + //用户名称 + @Excel(name = "用户名称") + private String userName; +} diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaLabelBindVO.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaLabelBindVO.java new file mode 100644 index 00000000..2ebc813e --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaLabelBindVO.java @@ -0,0 +1,37 @@ +package com.bonus.sgzb.machine.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MaLabelBindVO { + + //标签id + private Long labelId; + + //类型id + private Long typeId; + + //标签类型(数据字典) + private Long labelType; + + //标签编号 + private String labelCode; + + //绑定人 + private String binder; + + //绑定时间 + private Date bindTime; + + //是否绑定(0 是, 1 否) + private String isBind; + + //类型名称 + private String typeName; +} diff --git a/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaTypeKeeperVO.java b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaTypeKeeperVO.java new file mode 100644 index 00000000..ef2d94d5 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/java/com.bonus.sgzb.machine/vo/MaTypeKeeperVO.java @@ -0,0 +1,14 @@ +package com.bonus.sgzb.machine.vo; + +import lombok.Data; + +@Data +public class MaTypeKeeperVO { + + //类型名称 + private String typeName; + + //用户名称 + private String userName; + +} diff --git a/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaLabelBindMapper.xml b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaLabelBindMapper.xml new file mode 100644 index 00000000..c4f55abf --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaLabelBindMapper.xml @@ -0,0 +1,94 @@ + + + + + + select mml.label_id, mml.label_type, mml.label_code, mml.bind_time, mml.binder, mml.is_bind, mt.type_name + from ma_machine_label mml + left join ma_type mt on mml.type_id = mt.type_id + + + + + insert into ma_machine_label( + label_id, + label_type, + label_code, + binder, + is_bind, + )values( + #{labelId}, + #{labelType}, + #{labelCode}, + #{binder}, + #{isBind}, + ) + + + + insert into ma_type( + type_name, + )values( + #{typeName}, + ) + + + + update ma_machine_label + set is_bind = '0' + where label_id in + + #{labelId} + + + + + update ma_machine_label set is_bind = '1' where label_id = #{labelId} + + + + update ma_machine_label + + label_type = #{labelType}, + label_code = #{labelCode}, + binder = #{binder}, + is_bind = #{isBind}, + company_id = #{companyId}, + + where label_id = #{labelId} + + + + update ma_type + + type_name = #{typeName}, + + where type_id = #{typeId} + + + + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaMachineTypeMapper.xml b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaMachineTypeMapper.xml new file mode 100644 index 00000000..c045bd44 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaMachineTypeMapper.xml @@ -0,0 +1,122 @@ + + + + + + select type_id, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, remark, company_id + from ma_type + + + + insert into ma_type( + type_id, + type_name, + parent_id, + status, + num, + unit_id, + manage_type, + lease_price, + buy_price, + pay_price, + remark, + create_by, + company_id, + create_time + )values( + #{typeId}, + #{typeName}, + #{parentId}, + #{status}, + #{num}, + #{unitId}, + #{manageType}, + #{leasePrice}, + #{buyPrice}, + #{payPrice}, + #{remark}, + #{createBy}, + #{companyId}, + sysdate() + ) + + + + insert into ma_type_file( + type_id, + ma_id, + file_name, + file_url, + file_type, + user_id, + status, + company_id, + time + )values( + #{typeId}, + #{maId}, + #{fileName}, + #{fileUrl}, + #{fileType}, + #{userId}, + #{status}, + #{companyId}, + sysdate() + ) + + + + update ma_type + + type_name = #{typeName}, + parent_id = #{parentId}, + status = #{status}, + num = #{num}, + unit_id = #{unitId}, + manage_type = #{manageType}, + lease_price = #{leasePrice}, + buy_price = #{buyPrice}, + pay_price = #{payPrice}, + remark = #{remark}, + update_by = #{updateBy}, + company_id = #{companyId}, + update_time = sysdate() + + where type_id = #{typeId} + + + + update ma_type set del_flag = '2' where type_id = #{typeId} + + + + + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPartTypeMapper.xml b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPartTypeMapper.xml new file mode 100644 index 00000000..93231d2e --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPartTypeMapper.xml @@ -0,0 +1,67 @@ + + + + + + select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id + from ma_part_type + + + + + insert into ma_part_type( + pa_id, + pa_name, + parent_id, + status, + num, + unit_id, + buy_price, + level, + warn_num, + remark, + create_by, + company_id, + create_time + )values( + #{paId}, + #{paName}, + #{parentId}, + #{status}, + #{num}, + #{unitId}, + #{buyPrice}, + #{level}, + #{warnNum}, + #{remark}, + #{createBy}, + #{companyId}, + sysdate() + ) + + + + update ma_part_type set del_flag = '2' where pa_id = #{paId} + + + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPropInfoMapper.xml b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPropInfoMapper.xml new file mode 100644 index 00000000..a4262a69 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaPropInfoMapper.xml @@ -0,0 +1,70 @@ + + + + + + select prop_id, prop_name, status, dept_id, del_flag, create_by, create_time, remark, company_id + from ma_prop_info + + + + + insert into ma_prop_info( + prop_id, + prop_name, + status, + dept_id, + del_flag, + create_by, + remark, + company_id, + create_time + )values( + #{propId}, + #{paName}, + #{status}, + #{deptId}, + #{delFlag}, + #{createBy}, + #{remark}, + #{companyId}, + sysdate() + ) + + + + update ma_prop_info + + prop_name = #{propName}, + status = #{status}, + dept_id = #{deptId}, + del_flag = #{delFlag}, + remark = #{remark}, + update_by = #{updateBy}, + company_id = #{companyId}, + update_time = sysdate() + + where prop_id = #{propId} + + + + update ma_prop_info set del_flag = '2' where prop_id = #{propId} + + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaTypeKeeperMapper.xml b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaTypeKeeperMapper.xml new file mode 100644 index 00000000..161f9f75 --- /dev/null +++ b/sgzb-modules/sgzb-machine/src/main/resources/mapper.machine/MaTypeKeeperMapper.xml @@ -0,0 +1,30 @@ + + + + + + select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id + from ma_house_info + + + + + + + + \ No newline at end of file