|
@@ -1,13 +1,20 @@
|
|
|
package com.ruoyi.zdsz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.ruoyi.common.utils.BeanCopyUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.ruoyi.zdsz.domain.ZEngineeringCivil;
|
|
|
+import com.ruoyi.zdsz.domain.bo.ZEngineeringCivilBo;
|
|
|
+import com.ruoyi.zdsz.domain.bo.ZEngineeringNodeBo;
|
|
|
+import com.ruoyi.zdsz.service.IZEngineeringInfoService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.zdsz.domain.bo.ZMaterialStatisticsBo;
|
|
|
import com.ruoyi.zdsz.domain.vo.ZMaterialStatisticsVo;
|
|
@@ -15,9 +22,11 @@ import com.ruoyi.zdsz.domain.ZMaterialStatistics;
|
|
|
import com.ruoyi.zdsz.mapper.ZMaterialStatisticsMapper;
|
|
|
import com.ruoyi.zdsz.service.IZMaterialStatisticsService;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Collection;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
|
* 用料统计Service业务层处理
|
|
@@ -30,6 +39,8 @@ import java.util.Collection;
|
|
|
public class ZMaterialStatisticsServiceImpl implements IZMaterialStatisticsService {
|
|
|
|
|
|
private final ZMaterialStatisticsMapper baseMapper;
|
|
|
+ @Resource
|
|
|
+ private IZEngineeringInfoService izEngineeringInfoService;
|
|
|
|
|
|
/**
|
|
|
* 查询用料统计
|
|
@@ -86,6 +97,41 @@ public class ZMaterialStatisticsServiceImpl implements IZMaterialStatisticsServi
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Async("threadPoolTaskExecutor")
|
|
|
+ public Boolean insert(ZEngineeringCivilBo bo) {
|
|
|
+// List<ZEngineeringMaterialBo> zMaterialStatisticsList= izEngineeringInfoService.getzEngineeringMaterialBoList(bo);
|
|
|
+ if (bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getzEngineeringMaterialBo().size()>0)
|
|
|
+ {
|
|
|
+ bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getzEngineeringMaterialBo().stream().forEach(item->{
|
|
|
+ LambdaQueryWrapper<ZMaterialStatistics> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getAreaId()), ZMaterialStatistics::getAreaId, bo.getAreaId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZMaterialStatistics::getBuildingId, bo.getBuildingId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getUnitId()), ZMaterialStatistics::getUnitId, bo.getUnitId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getHouseId()), ZMaterialStatistics::getHouseId, bo.getHouseId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(item.getMaterialQuality()), ZMaterialStatistics::getRealityQuality, item.getMaterialQuality());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(item.getSpecifications()), ZMaterialStatistics::getRealitySpecifications, item.getSpecifications());
|
|
|
+ ZMaterialStatistics zMaterialStatistics= baseMapper.selectOne(lqw);
|
|
|
+
|
|
|
+ if (zMaterialStatistics!=null)
|
|
|
+ {
|
|
|
+ zMaterialStatistics.setRealityQuality(String.valueOf(Math.toIntExact(zMaterialStatistics.getRealitySize())+item.getNumber()));
|
|
|
+ baseMapper.updateById(zMaterialStatistics);
|
|
|
+ }else {
|
|
|
+ ZMaterialStatistics zMaterialStatistics1=new ZMaterialStatistics();
|
|
|
+ BeanUtils.copyProperties(item,zMaterialStatistics1);
|
|
|
+ zMaterialStatistics1.setRealityQuality(item.getMaterialQuality());
|
|
|
+ zMaterialStatistics1.setRealitySpecifications(item.getMaterialQuality());
|
|
|
+ zMaterialStatistics1.setRealitySize(item.getNumber());
|
|
|
+ zMaterialStatistics1.setEnginCycle(bo.getEnginCycle());
|
|
|
+ baseMapper.insert(zMaterialStatistics1);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改用料统计
|
|
|
*/
|