diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java index 4d1755c9..8cd65ec3 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java @@ -171,7 +171,7 @@ public class MaType extends BaseEntity { /** 库管员id */ @ApiModelProperty(value = "库管员id") - private long keeperUserId; + private List keeperUserId; /** 库管员名称 */ @ApiModelProperty(value = "库管员名称") @@ -453,11 +453,11 @@ public class MaType extends BaseEntity { this.isAncuo = isAncuo; } - public long getKeeperUserId() { + public List getKeeperUserId() { return keeperUserId; } - public void setKeeperUserId(long keeperUserId) { + public void setKeeperUserIdList(List keeperUserId) { this.keeperUserId = keeperUserId; } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java index d22163dc..eb870230 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java @@ -81,4 +81,6 @@ public interface MaTypeMapper { int deleteKeeperByTypeId(Long typeId); int deletePropSetByTypeId(Long typeId); + + int getMaType(MaType maType); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java index 9e8e6343..891bc555 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java @@ -6,8 +6,10 @@ import com.bonus.sgzb.base.domain.vo.TreeSelect; import com.bonus.sgzb.base.mapper.MaTypeFileMapper; import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.base.service.ITypeService; +import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.StringUtils; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -53,6 +55,13 @@ public class MaTypeServiceImpl implements ITypeService { String level = maType1.getLevel(); maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); maType.setCreateTime(DateUtils.getNowDate()); + //根据类型名称判重 + if (maType.getTypeName() != null && maType.getParentId() != null) { + int num = maTypeMapper.getMaType(maType); + if (num > 0) { + throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!"); + } + } int i = maTypeMapper.insertType(maType); Long typeId = maType.getTypeId(); // 图片路径保存 @@ -74,10 +83,14 @@ public class MaTypeServiceImpl implements ITypeService { typeFileMapper.insertMaTypeFile(typeFile1); } // 库管员配置 - MaTypeKeeper typeKeeper = new MaTypeKeeper(); - typeKeeper.setUserId(maType.getKeeperUserId()); - typeKeeper.setTypeId(typeId); - maTypeMapper.insertKeeper(typeKeeper); + if (CollectionUtils.isNotEmpty(maType.getKeeperUserId())) { + for (Long keeperUserId : maType.getKeeperUserId()) { + MaTypeKeeper typeKeeper = new MaTypeKeeper(); + typeKeeper.setUserId(keeperUserId); + typeKeeper.setTypeId(typeId); + maTypeMapper.insertKeeper(typeKeeper); + } + } // 维修员配置 MaTypeRepair typeRepair = new MaTypeRepair(); @@ -102,6 +115,13 @@ public class MaTypeServiceImpl implements ITypeService { public int updateMaType(MaType maType) { Long typeId = maType.getTypeId(); maType.setUpdateTime(DateUtils.getNowDate()); + //根据类型名称判重 + if (maType.getTypeName() != null && maType.getParentId() != null) { + int num = maTypeMapper.getMaType(maType); + if (num > 0) { + throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!"); + } + } int i = maTypeMapper.updateType(maType); // 图片路径保存 if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { @@ -124,14 +144,15 @@ public class MaTypeServiceImpl implements ITypeService { typeFileMapper.insertMaTypeFile(typeFile1); } // 库管员配置 - if (maType.getKeeperUserId() >= 0L) { + if (CollectionUtils.isNotEmpty(maType.getKeeperUserId())) { maTypeMapper.deleteKeeperByTypeId(typeId); - MaTypeKeeper typeKeeper = new MaTypeKeeper(); - typeKeeper.setUserId(maType.getKeeperUserId()); - typeKeeper.setTypeId(typeId); - maTypeMapper.insertKeeper(typeKeeper); + for (Long keeperUserId : maType.getKeeperUserId()) { + MaTypeKeeper typeKeeper = new MaTypeKeeper(); + typeKeeper.setUserId(keeperUserId); + typeKeeper.setTypeId(typeId); + maTypeMapper.insertKeeper(typeKeeper); + } } - // 维修员配置 if (maType.getRepairUserId() >= 0L) { maTypeMapper.deleteTypeByTypeId(typeId); diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml index 0678b2a9..5e5349e8 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml @@ -280,7 +280,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id,m.unit_name, m.manage_type, m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl, - mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId, + mtf2.file_name documentName, mtf2.file_url documentUrl, GROUP_CONCAT(mtk.user_id) keeperUserId, GROUP_CONCAT(su.nick_name) as keeperUserName, mtr.user_id repairUserId, su1.nick_name repairUserName,mpi.prop_id as propId, mpi.prop_name as propName, m.del_flag, m.create_by, m.create_time, m.remark, m.company_id,m.fac_model as facModel @@ -337,8 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type, m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl, - mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId, - su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time, + mtf2.file_name documentName, mtf2.file_url documentUrl, GROUP_CONCAT(mtk.user_id) keeperUserId, + GROUP_CONCAT(su.nick_name) keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time, m.remark, m.company_id,m.fac_model as facModel from ma_type m left join ma_prop_set mps on m.type_id = mps.type_id @@ -351,6 +351,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND type_name like concat('%',#{typeName},'%') + GROUP BY m.type_id + \ No newline at end of file diff --git a/sgzb-ui/src/views/claimAndreturn/picking/auditing/component/auditingPage.vue b/sgzb-ui/src/views/claimAndreturn/picking/auditing/component/auditingPage.vue index 3994c93d..eefaa36b 100644 --- a/sgzb-ui/src/views/claimAndreturn/picking/auditing/component/auditingPage.vue +++ b/sgzb-ui/src/views/claimAndreturn/picking/auditing/component/auditingPage.vue @@ -617,7 +617,7 @@ export default { this.queryParams.leaseApplyDetails.forEach((v) => { this.$set(v, 'applyFor', this.queryParams.applyFor) this.$set(v, 'updateTimes', this.queryParams.updateTimes) - if (!res.rows[0].directAuditRemark) { + if (!res.rows[0].directAuditBy) { this.$set(v, 'taskName', this.queryParams.taskName) } else { this.$set(v, 'taskName', v.statusName)