|
@@ -17,10 +17,12 @@
|
|
|
package org.springblade.meter.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.business.entity.Task;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
@@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -130,6 +133,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
vo.setPayRatio(new BigDecimal(0));
|
|
|
//设置其他计量总数
|
|
|
vo.setOtherMeterTotal(vo.getAllMeterTotal().subtract(vo.getCurrentMeterTotal()));
|
|
|
+ vo.setOtherPayRatio(vo.getOtherMeterTotal().divide(vo.getChangeTotal(), 4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
|
|
|
//设置施工图数量是否大于合同数量
|
|
|
vo.setIsBuildThanContract(vo.getChangeTotal().compareTo(vo.getContractChangeAllTotal()) == 1?1:0);
|
|
|
}
|
|
@@ -347,6 +351,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
MiddleMeterApply apply = new MiddleMeterApply();
|
|
|
BeanUtils.copyProperties(dto,apply);
|
|
|
apply.setMeterMoney(null);
|
|
|
+ apply.setIsLinkData(isLinkData);
|
|
|
//保存计量清单
|
|
|
List<MeterInventoryVO> formList = dto.getFormList();
|
|
|
//删除当前节点本期清单
|
|
@@ -516,6 +521,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
//计算分解数量是否超过合同数量
|
|
|
for (MeterInventoryVO form : formList) {
|
|
|
//设置施工图数量是否大于合同数量
|
|
|
+ form.setOtherPayRatio(form.getOtherMeterTotal().divide(form.getCurrentBuildChangeTotal(), 4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
|
|
|
form.setIsBuildThanContract(form.getChangeTotal().compareTo(form.getContractChangeAllTotal()) == 1?1:0);
|
|
|
}
|
|
|
vo.setFormList(formList);
|
|
@@ -842,7 +848,50 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
* 资料关联台账-关联质检资料
|
|
|
*/
|
|
|
@Override
|
|
|
- public void dataLinkFile(Long contractId, Long id, String fileIds) {
|
|
|
+ @Transactional
|
|
|
+ public void dataLinkFile(Long id, String fileIds) {
|
|
|
+ //获取中间计量申请信息
|
|
|
+ MiddleMeterApply apply = this.getById(id);
|
|
|
+ if (apply == null){
|
|
|
+ throw new ServiceException("未找到中间计量申请信息");
|
|
|
+ }
|
|
|
+ //根据文件id,查询出queryInfo数据
|
|
|
+ if (StringUtils.isBlank(fileIds)){
|
|
|
+ throw new ServiceException("请选择关联资料");
|
|
|
+ }
|
|
|
+ List<Long> ids = Func.toLongList(fileIds);
|
|
|
+ List<InformationQuery> list = baseMapper.getQueryDataByIds(ids);
|
|
|
+ if (list.size() == 0){
|
|
|
+ throw new ServiceException("未找到关联资料信息");
|
|
|
+ }
|
|
|
+ //构造附件
|
|
|
+ List<AttachmentForm> files = new ArrayList<>();
|
|
|
+ for (InformationQuery query : list) {
|
|
|
+ AttachmentForm form = new AttachmentForm();
|
|
|
+ form.setFileType(1);
|
|
|
+ form.setProjectId(apply.getProjectId());
|
|
|
+ form.setContractId(apply.getContractId());
|
|
|
+ form.setMasterId(id);
|
|
|
+ form.setFileName(query.getName());
|
|
|
+ String url;
|
|
|
+ if (StringUtils.isNotBlank(query.getEVisaPdfUrl())){
|
|
|
+ url = query.getEVisaPdfUrl();
|
|
|
+ }else if (StringUtils.isNotBlank(query.getPdfUrl())){
|
|
|
+ url = query.getPdfUrl();
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("未找到资料:"+query.getName()+",的pdf图片");
|
|
|
+ }
|
|
|
+ form.setFileUrl(url);
|
|
|
+ form.setFilePdfUrl(url);
|
|
|
+ form.setSelectId(query.getId());
|
|
|
+ files.add(form);
|
|
|
+ }
|
|
|
+ //保存附件
|
|
|
+ attachmentFormService.saveBatch(files);
|
|
|
+ //修改中间计量申请的关联状态
|
|
|
+ this.update(new LambdaUpdateWrapper<MiddleMeterApply>()
|
|
|
+ .eq(MiddleMeterApply::getId,id)
|
|
|
+ .set(MiddleMeterApply::getIsLinkData,1));
|
|
|
|
|
|
}
|
|
|
|