|
@@ -27,6 +27,7 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.meter.dto.MiddleMeterApplyDTO;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
import org.springblade.meter.mapper.MiddleMeterApplyMapper;
|
|
@@ -162,9 +163,25 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
//保存计量清单
|
|
|
List<MeterInventoryVO> formList = dto.getFormList();
|
|
|
if (formList.size() != 0){
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo info = baseMapper.getContractInfo(dto.getContractId());
|
|
|
+ if (info == null || info.getIsOverMeter() == null){
|
|
|
+ throw new ServiceException("未获取到合同段信息,保存失败");
|
|
|
+ }
|
|
|
+ //如果没有则
|
|
|
BigDecimal big = new BigDecimal(0);
|
|
|
//保存清单
|
|
|
List<InventoryFormApply> formApplies = formList.stream().map(l -> {
|
|
|
+ //校验数据
|
|
|
+ if (l.getIsBuildThanContract() == 1){
|
|
|
+ if (info.getIsOverMeter() == 0 || l.getIsCreateDivide() == 0){
|
|
|
+ throw new ServiceException("施工图数量未大于合同数量,保存失败");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (l.getAllMeterTotal().compareTo(l.getChangeTotal()) == 1 && info.getIsOverMeter() == 0){
|
|
|
+ throw new ServiceException("计量量超出施工图数量,保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
InventoryFormApply formApply = new InventoryFormApply();
|
|
|
formApply.setBusinessDate(dto.getBusinessDate());
|
|
|
formApply.setProjectId(dto.getProjectId());
|
|
@@ -294,9 +311,24 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
//删除当前节点本期清单
|
|
|
inventoryFormApplyService.deleteByMiddleId(dto.getId());
|
|
|
if (formList.size() != 0){
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo info = baseMapper.getContractInfo(dto.getContractId());
|
|
|
+ if (info == null || info.getIsOverMeter() == null){
|
|
|
+ throw new ServiceException("未获取到合同段信息,保存失败");
|
|
|
+ }
|
|
|
BigDecimal big = new BigDecimal(0);
|
|
|
//保存清单
|
|
|
List<InventoryFormApply> formApplies = formList.stream().map(l -> {
|
|
|
+ //校验数据
|
|
|
+ if (l.getIsBuildThanContract() == 1){
|
|
|
+ if (info.getIsOverMeter() == 0 || l.getIsCreateDivide() == 0){
|
|
|
+ throw new ServiceException("施工图数量未大于合同数量,保存失败");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (l.getAllMeterTotal().compareTo(l.getChangeTotal()) == 1 && info.getIsOverMeter() == 0){
|
|
|
+ throw new ServiceException("计量量超出施工图数量,保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
InventoryFormApply formApply = new InventoryFormApply();
|
|
|
formApply.setBusinessDate(dto.getBusinessDate());
|
|
|
formApply.setProjectId(dto.getProjectId());
|
|
@@ -458,7 +490,8 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
public String getMeterNumber(MiddleMeterApply apply) {
|
|
|
StringBuilder str = new StringBuilder();
|
|
|
//获取合同信息
|
|
|
- String contractNumber = baseMapper.getContractInfo(apply.getContractId());
|
|
|
+ ContractInfo info = baseMapper.getContractInfo(apply.getContractId());
|
|
|
+ String contractNumber = info.getContractNumber();
|
|
|
if (StringUtils.isBlank(contractNumber)){
|
|
|
throw new ServiceException("未获取到当前合同段编号信息");
|
|
|
}
|