diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index 3af8b0d..6ef904f 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -36,7 +36,8 @@ import java.util.stream.Collectors; public class SysDeptServiceImpl implements ISysDeptService { private static final Logger log = LoggerFactory.getLogger(SysDeptServiceImpl.class); - @Autowired + + @Resource private SysDeptMapper mapper; @Resource @@ -126,7 +127,6 @@ public class SysDeptServiceImpl implements ISysDeptService { for (DeptConfigRateSummary config : configList) { String company = config.getCompanyName(); String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 - String maName = config.getDeptName(); String typeId = config.getTypeId(); BigDecimal orderCount = config.getOrderCount(); Long configCompanyId = config.getCompanyId(); @@ -231,19 +231,13 @@ public class SysDeptServiceImpl implements ISysDeptService { // 构造"临时配置项"用于计算 DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary(); - dummyConfig.setFullScore(matchDev.map(NewOwnerdomin::getFullScore) - .filter(Objects::nonNull) - .orElse(BigDecimal.TEN)); + dummyConfig.setFullScore(matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN)); dummyConfig.setOrderCount(orderCount); dummyConfig.setDeptName(maName); dummyConfig.setCompanyId(companyId); dummyConfig.setCompanyName(companyName); - dummyConfig.setConfigValue(matchDev.map(NewOwnerdomin::getBaseNum) - .filter(Objects::nonNull) - .orElse(BigDecimal.ONE)); - dummyConfig.setConfigRate(matchDev.map(NewOwnerdomin::getFullScore) - .filter(Objects::nonNull) - .orElse(BigDecimal.TEN)); + dummyConfig.setConfigValue(matchDev.map(NewOwnerdomin::getBaseNum).orElse(BigDecimal.ONE)); + dummyConfig.setConfigRate(matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN)); // 计算得分 BigDecimal score = computeScoreByMaName(orderCount, devices, dummyConfig, "0"); @@ -325,16 +319,16 @@ public class SysDeptServiceImpl implements ISysDeptService { } -// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量 + // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量 BigDecimal rate = ownedTotal .add(leasedTotal.multiply(new BigDecimal("0.6"))) .add(ordercount.multiply(new BigDecimal("0.9"))) .divide(base, 4, RoundingMode.HALF_UP); -// 计算原始得分 + // 计算原始得分 BigDecimal result = rate.multiply(score).setScale(2, RoundingMode.HALF_UP); -// 限制得分不超过满分,且如果是 3/4/5 类型,不能超过 20 + // 限制得分不超过满分,且如果是 3/4/5 类型,不能超过 20 if (rate.compareTo(BigDecimal.ONE) > 0) { result = score.setScale(2, RoundingMode.HALF_UP); } @@ -424,6 +418,7 @@ public class SysDeptServiceImpl implements ISysDeptService { BaseEntity entity = CommonDataPermissionInfo.backMissionInfo(dept.getParams().get("dataScope").toString()); BeanUtils.copyProperties(entity, dept); } catch (Exception e) { + log.error("类型转换失败:", e); e.printStackTrace(); } if (dept.getDeptName() != null) { @@ -470,7 +465,7 @@ public class SysDeptServiceImpl implements ISysDeptService { List tlist = new ArrayList<>(); for (SysDept n : list) { if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { - tlist.add((SysDeptVO) n); + tlist.add(n); } } return tlist; 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 index baf24fa..a4ffa85 100644 --- 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 @@ -216,8 +216,8 @@ public class MaTypeController extends BaseController { @ApiOperation(value = "根据左列表类型id查询右表格") @GetMapping("/getList") - public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level) { - List listByMaType = iTypeService.getList(typeName,level); + public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level, @RequestParam(value = "typeId", required = false) Integer parentId) { + List listByMaType = iTypeService.getList(typeName,level,parentId); 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)); 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 index 389d59a..1b3e56c 100644 --- 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 @@ -95,7 +95,7 @@ public interface MaTypeMapper { int insertMaTypePropertyNames(@Param("typeId") Long typeId, @Param("list") List properties); - List getList(@Param("typeName") String typeName, @Param("level") Integer level); + List getList(@Param("typeName") String typeName, @Param("level") Integer level, @Param("parentId") Integer parentId); List selectMaTypeTreeBy5Level(Integer type); 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 index 842894d..337189a 100644 --- 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 @@ -75,5 +75,5 @@ public interface ITypeService { AjaxResult updateProperties(MaType maType); - List getList(String typeName,Integer level); + List getList(String typeName,Integer level, Integer parentId); } 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 index 726e476..e9f0bda 100644 --- 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 @@ -65,11 +65,6 @@ public class MaTypeServiceImpl implements ITypeService { } 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(); // 图片路径保存 @@ -93,22 +88,22 @@ public class MaTypeServiceImpl implements ITypeService { 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.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 (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) { @@ -165,24 +160,24 @@ public class MaTypeServiceImpl implements ITypeService { 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.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.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); @@ -205,7 +200,7 @@ public class MaTypeServiceImpl implements ITypeService { @Override public int deleteMaTypeByTypeId(Long typeId) throws Exception { List listByParentId = maTypeMapper.getListByParentId(typeId, ""); - if (listByParentId.size() > 0) { + if (!listByParentId.isEmpty()) { throw new Exception("子级类型不为空!!!"); } return maTypeMapper.deleteTypeById(typeId); @@ -215,9 +210,8 @@ public class MaTypeServiceImpl implements ITypeService { public List getMaTypeList(String typeName, String parentId) { List maTypes = maTypeMapper.selectMaTypeTree(parentId); //填充自定义属性 - List treeSelectList = buildDeptTreeSelect(fillProperties(maTypes)); //如果没有查询到那么返回空 - return treeSelectList; + return buildDeptTreeSelect(fillProperties(maTypes)); } private List fillProperties(List maTypes) { @@ -235,9 +229,8 @@ public class MaTypeServiceImpl implements ITypeService { @Override public List getMaTypeSelect(String typeName, String parentId) { List maTypes = maTypeMapper.getMaTypeSelect(parentId); - List treeSelectList = buildDeptTreeSelect(maTypes); //如果没有查询到那么返回空 - return treeSelectList; + return buildDeptTreeSelect(maTypes); } @@ -294,7 +287,7 @@ public class MaTypeServiceImpl implements ITypeService { } } //如果还有父级递归查询 - if (parentList.size() > 0) { + if (!parentList.isEmpty()) { return getTypeListByMaType(parentList, oldMaTypes, newMaTypes); } else { List result = new ArrayList<>(); @@ -481,8 +474,8 @@ public class MaTypeServiceImpl implements ITypeService { } @Override - public List getList(String typeName, Integer level) { - List list = maTypeMapper.getList(typeName, level); + public List getList(String typeName, Integer level, Integer parentId) { + List list = maTypeMapper.getList(typeName, level, parentId); return fillProperties(list); } 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 index 9f1152f..ae4be6a 100644 --- 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 @@ -69,12 +69,6 @@ public class MaType extends BaseEntity { @ApiModelProperty(value = "实时库存") private Integer storageNum; - /** - * 计量单位id - */ - @ApiModelProperty(value = "计量单位id") - private String unitId; - /** * 计量单位 */ @@ -259,6 +253,12 @@ public class MaType extends BaseEntity { @ApiModelProperty(value = "维修员名称") private String repairUserName; + /** + * 是否国网体系 + */ + @ApiModelProperty(value = "0否 1是") + private Boolean isStateGrid; + /** * 资产属性id */ 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 index 73f2394..6c8f776 100644 --- 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 @@ -8,9 +8,7 @@ - - @@ -43,7 +41,6 @@ storage_num, company_id, code, - unit_id, unit_name, manage_type, lease_price, @@ -71,16 +68,13 @@ from ma_type - + insert into ma_type type_name, parent_id, storage_num, - company_id, - code, - unit_id, + `code`, unit_name, manage_type, lease_price, @@ -88,7 +82,7 @@ rent_price, buy_price, pay_price, - level, + `level`, rated_load, test_load, holding_time, @@ -99,6 +93,7 @@ update_by, update_time, is_plan, + is_state_grid, is_ancuo, remark, fac_model, @@ -109,9 +104,7 @@ #{typeName}, #{parentId}, #{storageNum}, - #{companyId}, #{code}, - #{unitId}, #{unitName}, #{manageType}, #{leasePrice}, @@ -130,6 +123,7 @@ #{updateBy}, #{updateTime}, #{isPlan}, + #{isStateGrid}, #{isAncuo}, #{remark}, #{facModel}, @@ -148,7 +142,6 @@ file_type, user_id, status, - company_id, create_time )values( #{typeId}, @@ -158,7 +151,6 @@ #{fileType}, #{userId}, #{status}, - #{companyId}, sysdate() ) @@ -169,7 +161,6 @@ type_name = #{typeName}, parent_id = #{parentId}, storage_num = #{storageNum}, - unit_id = #{unitId}, unit_name = #{unitName}, manage_type = #{manageType}, lease_price = #{leasePrice}, @@ -190,7 +181,6 @@ is_plan = #{isPlan}, is_ancuo = #{isAncuo}, remark = #{remark}, - company_id = #{companyId}, fac_model = #{facModel}, intelligent_code = #{intelligentCode}, maintenance_alarm_day = #{maintenanceAlarmDay}, @@ -220,12 +210,12 @@ +