diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java index a40ee1f2..531bcfd6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java @@ -394,7 +394,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe try { int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId()); String code = genderTaskCode(thisMonthMaxOrder); - TmTask tmTask = new TmTask(); + TmTask tmTask; if (dto.getBackApplyInfo().getIsBack() == 1) { tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId(), BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(), diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index ec95ba2f..5b92f230 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -61,10 +61,10 @@ import javax.annotation.Resource; public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 来源1: 单位直接领用 - private static final Integer DIRECT_RESOURCE = 1; + private static final Integer DIRECT_RESOURCE = GlobalConstants.INT_1; // 来源2: 班组领用同步过来的数据 - private static final Integer SYNC_RESOURCE = 2; + private static final Integer SYNC_RESOURCE = GlobalConstants.INT_2; @Autowired LeaseApplyInfoMapper leaseApplyInfoMapper; @@ -272,7 +272,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(), LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(), - null, thisMonthMaxOrder + 1, taskCode); + null, thisMonthMaxOrder + GlobalConstants.INT_1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTask.setCreateBy(createBy); tmTask.setPreTaskId(Long.parseLong(record.getTaskId())); @@ -415,7 +415,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { record.setCreateTime(DateUtils.getNowDate()); record.setCreateBy(createBy); record.setParentId(id); - record.setIsFinished(1); + record.setIsFinished(GlobalConstants.INT_1); int res = materialLeaseInfoMapper.insertLeaseOutDetails(record); if (res == GlobalConstants.INT_0) { throw new RuntimeException("出库失败,插入结算记录失败"); @@ -467,7 +467,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { Date nowDate = DateUtils.getNowDate(); String format = dateFormat.format(nowDate); String result = format.replace("-", ""); - return MaterialConstants.MATERIAL_LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1); + return MaterialConstants.MATERIAL_LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + GlobalConstants.INT_1); } /** @@ -481,7 +481,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { String format = dateFormat.format(nowDate); String result = format.replace("-", ""); int num = bmAgreementInfoMapper.selectNumByMonthClz(nowDate); - return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + 1); + return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + GlobalConstants.INT_1); } /** @@ -556,7 +556,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } for (LeaseOutDetails leaseOutDetails : record.getMaCodeList()) { // 3、插入出库记录,修改库存,修改机具状态 - leaseOutDetails.setOutNum(BigDecimal.valueOf(1)); + leaseOutDetails.setOutNum(BigDecimal.valueOf(GlobalConstants.INT_1)); leaseOutDetails.setParentId(record.getParentId()); leaseOutDetails.setPublishTask(StringUtils.isNotBlank(record.getPublishTask()) ? record.getPublishTask() : null); leaseOutDetails.setLeaseUnit(record.getLeaseUnit()); @@ -753,7 +753,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } } } - return 1; + return GlobalConstants.INT_1; } private int insertRecords(LeaseOutDetails record) { @@ -780,11 +780,11 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = typeMapper.updateMaTypeStockNum(record); if (record.getMaId() != null) { - if (record.getJiJuType() == 1) { + if (record.getJiJuType() == GlobalConstants.INT_1) { record.setThisCheckTime(DateUtils.getNowDate()); LocalDate currentDate = LocalDate.now(); // 计算下一次检验日期:当前日期加一年减一天 - LocalDate nextCheckDate = currentDate.plusYears(1).minusDays(1); + LocalDate nextCheckDate = currentDate.plusYears(GlobalConstants.INT_1).minusDays(GlobalConstants.INT_1); record.setNextCheckTime(DateUtils.toDate(nextCheckDate)); } // 更新 (ma_machine 设备表)的状态 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index 374e2b0b..114ced1a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -56,10 +56,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { private static final String SAFETY_EQUIPMENT_COST_USERS = "safety_equipment_cost_users"; // 工器具结算类型settlement_type键值 - private static final Byte EQUIPMENT_SETTLEMENT_TYPE = 1; + private static final Byte EQUIPMENT_SETTLEMENT_TYPE = (byte) GlobalConstants.INT_1; // 安全工器具结算类型settlement_type键值 - private static final Byte SAFETY_EQUIPMENT_SETTLEMENT_TYPE = 2; + private static final Byte SAFETY_EQUIPMENT_SETTLEMENT_TYPE = (byte) GlobalConstants.INT_2; @Autowired private SltAgreementInfoMapper sltAgreementInfoMapper; @@ -110,11 +110,11 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { SltInfoVo sltInfoVo = new SltInfoVo(); sltInfoVo.setUnitName(info.getUnitName()); sltInfoVo.setProjectName(info.getProjectName()); - BigDecimal leaseCost = BigDecimal.valueOf(0.00); - BigDecimal repairCost = BigDecimal.valueOf(0.00); - BigDecimal scrapCost = BigDecimal.valueOf(0.00); - BigDecimal loseCost = BigDecimal.valueOf(0.00); - BigDecimal reducCost = BigDecimal.valueOf(0.00); + BigDecimal leaseCost = BigDecimal.ZERO; + BigDecimal repairCost = BigDecimal.ZERO; + BigDecimal scrapCost = BigDecimal.ZERO; + BigDecimal loseCost = BigDecimal.ZERO; + BigDecimal reducCost = BigDecimal.ZERO; //租赁费用列表 List leaseList = getLeaseList(info); //维修费用列表 @@ -235,7 +235,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { bean.setLeasePrice(bean.getLeasePrice().setScale(2, RoundingMode.HALF_UP)); } if (null == bean.getNum()) { - bean.setNum(BigDecimal.valueOf(0L)); + bean.setNum(BigDecimal.ZERO); } if (null == bean.getLeaseDays()) { bean.setLeaseDay(0L); @@ -243,7 +243,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { BigDecimal leasePrice = bean.getLeasePrice(); BigDecimal num = bean.getNum(); BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays()); - BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, RoundingMode.HALF_UP); + BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.HALF_UP); bean.setCosts(costs); } return leaseList; @@ -275,10 +275,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { - bean.setNum(BigDecimal.valueOf(0L)); + bean.setNum(BigDecimal.ZERO); } BigDecimal buyPrice = bean.getBuyPrice(); BigDecimal num = bean.getNum(); @@ -293,8 +293,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { private List getReductionList(SltAgreementInfo info) { SltAgreementReduce bean =new SltAgreementReduce(); bean.setAgreementId(info.getAgreementId()); - List reductionList = sltAgreementRecudceMapper.getReductionList(bean); - return reductionList; + return sltAgreementRecudceMapper.getReductionList(bean); } private List getRelations(List leaseList, List repairList, @@ -308,7 +307,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { BigDecimal scrapCost = BigDecimal.ZERO; BigDecimal repairCost = BigDecimal.ZERO; for (SltAgreementInfo lease : leaseList) { - if (lease.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + if (lease.getAgreementId().equals(sltInfo.getAgreementId())) { relation.setAgreementId(String.valueOf(lease.getAgreementId())); relation.setProjectName(lease.getProjectName()); relation.setUnitName(lease.getUnitName()); @@ -318,19 +317,19 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } } for (SltAgreementInfo repair : repairList) { - if (repair.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + if (repair.getAgreementId().equals(sltInfo.getAgreementId())) { BigDecimal cost = repair.getCosts(); repairCost = repairCost.add(cost); } } for (SltAgreementInfo scrap : scrapList) { - if (scrap.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + if (scrap.getAgreementId().equals(sltInfo.getAgreementId())) { BigDecimal cost = scrap.getCosts(); scrapCost = scrapCost.add(cost); } } for (SltAgreementInfo lose : loseList) { - if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + if (lose.getAgreementId().equals(sltInfo.getAgreementId())) { relation.setAgreementId(String.valueOf(lose.getAgreementId())); relation.setProjectName(lose.getProjectName()); relation.setUnitName(lose.getUnitName()); @@ -509,13 +508,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { if (equipmentConfigUsers != null && equipmentConfigUsers.getItemValue() != null) { boolean isContains = containsExactValue(equipmentConfigUsers.getItemValue(), String.valueOf(theLoginUserId)); if (isContains) { - return 1; + return GlobalConstants.INT_1; } } if (safetyEquipmentConfigUsers != null && safetyEquipmentConfigUsers.getItemValue() != null) { boolean isContains = containsExactValue(safetyEquipmentConfigUsers.getItemValue(), String.valueOf(theLoginUserId)); if (isContains) { - return 2; + return GlobalConstants.INT_2; } } throw new ServiceException("没有权限进行系统结算!");