维修代码规范修改
This commit is contained in:
parent
5198fea5d4
commit
074ae903cb
|
|
@ -243,7 +243,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult submitRepairApply(@NotNull(message = "参数不能为空") RepairApplyRecord bean) {
|
public AjaxResult submitRepairApply(@NotNull(message = "参数不能为空") RepairApplyRecord bean) {
|
||||||
if (bean == null || bean.getRepairType() == null) {
|
if (null == bean || null == bean.getRepairType()) {
|
||||||
return AjaxResult.error("维修方式参数不能为空");
|
return AjaxResult.error("维修方式参数不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +280,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
case TO_SCRAP: {
|
case TO_SCRAP: {
|
||||||
BigDecimal scrapNum = details.getScrapNum().add(bean.getScrapNum());
|
BigDecimal scrapNum = details.getScrapNum().add(bean.getScrapNum());
|
||||||
BigDecimal totalNum = scrapNum.add(details.getRepairedNum());
|
BigDecimal totalNum = scrapNum.add(details.getRepairedNum());
|
||||||
if (totalNum.compareTo(details.getRepairNum()) > 0) {
|
if (0 < totalNum.compareTo(details.getRepairNum())) {
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
}
|
}
|
||||||
// 更新报废数量
|
// 更新报废数量
|
||||||
|
|
@ -297,9 +297,9 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (Objects.equals(RepairTypeEnum.INNER_REPAIR.getTypeId(), bean.getRepairType())) {
|
if (Objects.equals(RepairTypeEnum.INNER_REPAIR.getTypeId(), bean.getRepairType())) {
|
||||||
// 遍历配件列表,判断配件类型,收费还是不收费
|
// 遍历配件列表,判断配件类型,收费还是不收费
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (partDetails.getPartId() != null) {
|
if (null != partDetails.getPartId()) {
|
||||||
// 有维修配件时,如果价格为空,设置为0
|
// 有维修配件时,如果价格为空,设置为0
|
||||||
if (partDetails.getPartCost() == null) {
|
if (null == partDetails.getPartCost()) {
|
||||||
partDetails.setPartCost(BigDecimal.ZERO);
|
partDetails.setPartCost(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
partDetails.setTaskId(bean.getTaskId())
|
partDetails.setTaskId(bean.getTaskId())
|
||||||
|
|
@ -334,12 +334,12 @@ public class RepairServiceImpl implements RepairService {
|
||||||
bean.setPartName(partList.get(0).getPartName());
|
bean.setPartName(partList.get(0).getPartName());
|
||||||
bean.setPartType(partList.get(0).getPartType());
|
bean.setPartType(partList.get(0).getPartType());
|
||||||
bean.setRepairContent(partList.get(0).getRepairContent());
|
bean.setRepairContent(partList.get(0).getRepairContent());
|
||||||
if (partList.get(0).getSupplierId() == null) {
|
if (null == partList.get(0).getSupplierId()) {
|
||||||
throw new ServiceException("请选择返厂厂家");
|
throw new ServiceException("请选择返厂厂家");
|
||||||
} else {
|
} else {
|
||||||
bean.setSupplierId(partList.get(0).getSupplierId());
|
bean.setSupplierId(partList.get(0).getSupplierId());
|
||||||
}
|
}
|
||||||
bean.setPartPrice(partList.get(0).getPartPrice() == null ? BigDecimal.ZERO : partList.get(0).getPartPrice());
|
bean.setPartPrice(null == partList.get(0).getPartPrice() ? BigDecimal.ZERO : partList.get(0).getPartPrice());
|
||||||
bean.setPartNum(partList.get(0).getPartNum());
|
bean.setPartNum(partList.get(0).getPartNum());
|
||||||
// 新增【维修记录表】
|
// 新增【维修记录表】
|
||||||
repairMapper.addRecord(bean);
|
repairMapper.addRecord(bean);
|
||||||
|
|
@ -363,16 +363,16 @@ public class RepairServiceImpl implements RepairService {
|
||||||
* 校验维修数量
|
* 校验维修数量
|
||||||
*/
|
*/
|
||||||
private static BigDecimal verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) {
|
private static BigDecimal verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) {
|
||||||
if (bean == null || bean.getRepairNum() == null) {
|
if (null == bean || null == bean.getRepairNum()) {
|
||||||
throw new ServiceException("维修数量不能为空");
|
throw new ServiceException("维修数量不能为空");
|
||||||
}
|
}
|
||||||
if (details.getRepairedNum() == null) {
|
if (null == details.getRepairedNum()) {
|
||||||
details.setRepairedNum(BigDecimal.ZERO);
|
details.setRepairedNum(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if (details.getScrapNum() == null) {
|
if (null == details.getScrapNum()) {
|
||||||
details.setScrapNum(BigDecimal.ZERO);
|
details.setScrapNum(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if (details.getRepairNum() == null) {
|
if (null == details.getRepairNum()) {
|
||||||
details.setRepairNum(BigDecimal.ZERO);
|
details.setRepairNum(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ;
|
BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ;
|
||||||
|
|
@ -822,7 +822,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId);
|
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId);
|
||||||
BigDecimal thisRepairedNum = detailsList.stream().map(RepairTaskDetails::getRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal thisRepairedNum = detailsList.stream().map(RepairTaskDetails::getRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
BigDecimal thisScrapNum = detailsList.stream().map(RepairTaskDetails::getScrapNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal thisScrapNum = detailsList.stream().map(RepairTaskDetails::getScrapNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
if (!CollectionUtils.isEmpty(detailsList) && (thisRepairedNum.add(thisScrapNum)).compareTo(BigDecimal.ZERO) > 0) {
|
if (!CollectionUtils.isEmpty(detailsList) && 0 < (thisRepairedNum.add(thisScrapNum)).compareTo(BigDecimal.ZERO)) {
|
||||||
task.setCreateBy(loginUser.getUserid());
|
task.setCreateBy(loginUser.getUserid());
|
||||||
Long agreementId = repairMapper.getAgreementId(task);
|
Long agreementId = repairMapper.getAgreementId(task);
|
||||||
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue