wang_xy 1 vuosi sitten
vanhempi
commit
272511186d

+ 17 - 14
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java

@@ -17,9 +17,7 @@ import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.zdsz.domain.*;
 import com.ruoyi.zdsz.domain.bo.*;
 import com.ruoyi.zdsz.domain.vo.*;
-import com.ruoyi.zdsz.mapper.ZAreaMapper;
-import com.ruoyi.zdsz.mapper.ZEngineeringNodeMapper;
-import com.ruoyi.zdsz.mapper.ZHouseMapper;
+import com.ruoyi.zdsz.mapper.*;
 import com.ruoyi.zdsz.service.*;
 import com.ruoyi.zdsz.task.RiewTask;
 import com.ruoyi.zdsz.task.photoTask;
@@ -28,11 +26,11 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
-import com.ruoyi.zdsz.mapper.ZEngineeringCivilMapper;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.*;
@@ -60,6 +58,8 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
     @Resource
     private IZMaterialStatisticsService izMaterialStatisticsService;
     @Resource
+    private ZMaterialStatisticsMapper zMaterialStatisticsMapper;
+    @Resource
     private final ZEngineeringNodeMapper zEngineeringNodeMapper;
     @Resource
     private IZEngineeringReviewService izEngineeringReviewService;
@@ -175,15 +175,7 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
         lqw.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZEngineeringCivil::getBuildingId, bo.getBuildingId());
         lqw.eq(StringUtils.isNotBlank(bo.getUnitId()), ZEngineeringCivil::getUnitId, bo.getUnitId());
         lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), ZEngineeringCivil::getDistrict, bo.getDistrict());
-        //lqw.last("limit "+(pageQuery.getPageNum() - 1)+","+(pageQuery.getPageNum()*pageQuery.getPageSize()));
-        LambdaQueryWrapper<ZEngineeringCivil> lqw2 = Wrappers.lambdaQuery();
-        lqw2.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringCivil::getEnginType, bo.getEnginType());
-        lqw2.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringCivil::getEnginClassification, bo.getEnginClassification());
-        lqw2.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZEngineeringCivil::getEnginCycle, bo.getEnginCycle());
-        lqw2.eq(StringUtils.isNotBlank(bo.getAreaId()), ZEngineeringCivil::getAreaId, bo.getAreaId());
-        lqw2.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZEngineeringCivil::getBuildingId, bo.getBuildingId());
-        lqw2.eq(StringUtils.isNotBlank(bo.getUnitId()), ZEngineeringCivil::getUnitId, bo.getUnitId());
-        lqw2.eq(StringUtils.isNotBlank(bo.getDistrict()), ZEngineeringCivil::getDistrict, bo.getDistrict());
+        lqw.eq(StringUtils.isNotBlank(bo.getHouseId()), ZEngineeringCivil::getHouseId, bo.getHouseId());
         Page<ZEngineeringCivilVo> result=new Page<>();
         if (!"".equals(bo.getType())&&!ObjectUtils.isEmpty(bo.getType()))
         {
@@ -441,7 +433,18 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
                 zEngineeringNodeBo.setCreateTime(zEngineeringCivilVo.getCreateTime());
                 zEngineeringNodeBo.setCivliId(zEngineeringCivilVo.getId());
                 List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
-                zEngineeringNodeBos.forEach(ite -> zEngineeringNodeService.delete(ite));
+                zEngineeringNodeBos.forEach(ite -> {
+                    LambdaQueryWrapper<ZMaterialStatistics> lqw = Wrappers.lambdaQuery();
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getAreaId()), ZMaterialStatistics::getAreaId, zEngineeringCivilVo.getAreaId());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getBuildingId()), ZMaterialStatistics::getBuildingId, zEngineeringCivilVo.getBuildingId());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getUnitId()), ZMaterialStatistics::getUnitId, zEngineeringCivilVo.getUnitId());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getHouseId()), ZMaterialStatistics::getHouseId, zEngineeringCivilVo.getHouseId());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getEnginCycle()), ZMaterialStatistics::getEnginCycle, zEngineeringCivilVo.getEnginCycle());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getEnginClassification()), ZMaterialStatistics::getEnginClassification, zEngineeringCivilVo.getEnginClassification());
+                    lqw.eq(StringUtils.isNotBlank(zEngineeringCivilVo.getEnginType()), ZMaterialStatistics::getEnginType, zEngineeringCivilVo.getEnginType());
+                    zMaterialStatisticsMapper.delete(lqw);
+                    zEngineeringNodeService.delete(ite);
+                });
             });
         }
         return baseMapper.deleteBatchIds(ids) > 0;

+ 48 - 11
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringInfoServiceImpl.java

@@ -14,6 +14,7 @@ import com.ruoyi.framework.handler.MonthTableNameHandler;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
 import com.ruoyi.zdsz.domain.ZEngineeringInfo;
+import com.ruoyi.zdsz.domain.ZMaterialStatistics;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringMaterialBo;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringNodeBo;
@@ -21,17 +22,16 @@ import com.ruoyi.zdsz.domain.bo.ZEngineeringReviewBo;
 import com.ruoyi.zdsz.domain.vo.ZEngineeringInfoVo;
 import com.ruoyi.zdsz.enums.photoType;
 import com.ruoyi.zdsz.mapper.ZEngineeringInfoMapper;
-import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
-import com.ruoyi.zdsz.service.IZEngineeringInfoService;
-import com.ruoyi.zdsz.service.IZEngineeringMaterialService;
-import com.ruoyi.zdsz.service.IZEngineeringReviewService;
+import com.ruoyi.zdsz.service.*;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -47,6 +47,8 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
 
     private final ZEngineeringInfoMapper baseMapper;
     @Resource
+    private IZEngineeringCivilService izEngineeringCivilService;
+    @Resource
     private IZEngineeringMaterialService izEngineeringMaterialService;
     @Resource
     private IZEngiineeringPhotoService izEngiineeringPhotoService;
@@ -581,18 +583,53 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
     @DynamicName(spel = "#bo.createTime")
     @Transactional(rollbackFor = Exception.class)
     public Boolean deleteById(ZEngineeringInfoBo bo) {
+
+        izEngineeringCivilService.queryById(zEngineeringInfo.getEngInfoId());
+
+        LambdaQueryWrapper<ZMaterialStatistics> lqwstatis = Wrappers.lambdaQuery();
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getAreaId()), ZMaterialStatistics::getAreaId, bo.getAreaId());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZMaterialStatistics::getBuildingId, bo.getBuildingId());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getUnitId()), ZMaterialStatistics::getUnitId, bo.getUnitId());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getHouseId()), ZMaterialStatistics::getHouseId, bo.getHouseId());
+        lqwstatis.eq(StringUtils.isNotBlank(item.getMaterialQuality()), ZMaterialStatistics::getRealityQuality, item.getMaterialQuality());
+        lqwstatis.eq(StringUtils.isNotBlank(item.getSpecifications()), ZMaterialStatistics::getRealitySpecifications, item.getSpecifications());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZMaterialStatistics::getEnginCycle, bo.getEnginCycle());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZMaterialStatistics::getEnginClassification, bo.getEnginClassification());
+        lqwstatis.eq(StringUtils.isNotBlank(bo.getEnginType()), ZMaterialStatistics::getEnginType, bo.getEnginType());
+        lqwstatis.eq(StringUtils.isNotBlank(item2.getType()), ZMaterialStatistics::getNodeType, item2.getType());
+        ZMaterialStatistics zMaterialStatistics = baseMapper.selectOne(lqwstatis);
+        if (!ObjectUtils.isEmpty(zMaterialStatistics)) {
+            zMaterialStatistics.setRealitySize(BigDecimal.valueOf(zMaterialStatistics.getRealitySize()).add(BigDecimal.valueOf(item.getNumber())).doubleValue());
+            baseMapper.updateById(zMaterialStatistics);
+        } else {
+            if (!ObjectUtils.isEmpty(item.getMaterialQuality()) && !ObjectUtils.isEmpty(item.getSpecifications())) {
+                ZMaterialStatistics zMaterialStatistics1 = new ZMaterialStatistics();
+                BeanUtils.copyProperties(bo, zMaterialStatistics1);
+                zMaterialStatistics1.setRealityQuality(item.getMaterialQuality());
+                zMaterialStatistics1.setRealitySpecifications(item.getSpecifications());
+                zMaterialStatistics1.setRealitySize(item.getNumber());
+                zMaterialStatistics1.setEnginCycle(bo.getEnginCycle());
+                zMaterialStatistics1.setNodeType(item2.getType());
+                baseMapper.insert(zMaterialStatistics1);
+            }
+        }
+
+
+
+
+
         LambdaQueryWrapper<ZEngineeringInfo> lqw = Wrappers.lambdaQuery();
         lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringInfo::getId, bo.getId());
         ZEngineeringInfo zEngineeringInfo = baseMapper.selectOne(lqw);
         SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy_MM");
-            ZEngineeringInfoBo zEngineeringInfobo =new ZEngineeringInfoBo();
-        zEngineeringInfobo= BeanUtil.toBean(zEngineeringInfo, ZEngineeringInfoBo.class);
-            //zEngineeringInfobo.setCreateTime(bo.getCreateTime());
-            izEngiineeringPhotoService.delete(zEngineeringInfobo);
-            izEngineeringMaterialService.delete(zEngineeringInfobo);
+        ZEngineeringInfoBo zEngineeringInfobo = new ZEngineeringInfoBo();
+        zEngineeringInfobo = BeanUtil.toBean(zEngineeringInfo, ZEngineeringInfoBo.class);
+        izEngiineeringPhotoService.delete(zEngineeringInfobo);
+        izEngineeringMaterialService.delete(zEngineeringInfobo);
+
+        MonthTableNameHandler.setData(simpleDateFormat.format(bo.getCreateTime()));
+        baseMapper.deleteById(bo.getId());
 
-            MonthTableNameHandler.setData(simpleDateFormat.format(bo.getCreateTime()));
-            baseMapper.deleteById(bo.getId());
         LambdaQueryWrapper<ZEngineeringInfo> lqw2 = Wrappers.lambdaQuery();
         lqw2.eq(StringUtils.isNotBlank(bo.getEngInfoId()), ZEngineeringInfo::getEngInfoId, bo.getEngInfoId());
         List<ZEngineeringInfo> zEngineeringInfoList = baseMapper.selectList(lqw2);

+ 4 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZMaterialStatisticsServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.zdsz.service.IZMaterialStatisticsService;
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.Collection;
@@ -121,7 +122,7 @@ public class ZMaterialStatisticsServiceImpl implements IZMaterialStatisticsServi
                             lqw.eq(StringUtils.isNotBlank(item2.getType()), ZMaterialStatistics::getNodeType, item2.getType());
                             ZMaterialStatistics zMaterialStatistics = baseMapper.selectOne(lqw);
                             if (!ObjectUtils.isEmpty(zMaterialStatistics)) {
-                                zMaterialStatistics.setRealitySize(zMaterialStatistics.getRealitySize() + item.getNumber());
+                                zMaterialStatistics.setRealitySize(BigDecimal.valueOf(zMaterialStatistics.getRealitySize()).add(BigDecimal.valueOf(item.getNumber())).doubleValue());
                                 baseMapper.updateById(zMaterialStatistics);
                             } else {
                                 if (!ObjectUtils.isEmpty(item.getMaterialQuality()) && !ObjectUtils.isEmpty(item.getSpecifications())) {
@@ -155,7 +156,7 @@ public class ZMaterialStatisticsServiceImpl implements IZMaterialStatisticsServi
                     lqw.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZMaterialStatistics::getEnginCycle, bo.getEnginCycle());
                     ZMaterialStatistics zMaterialStatistics = baseMapper.selectOne(lqw);
                     if (zMaterialStatistics != null) {
-                        zMaterialStatistics.setRealitySize(zMaterialStatistics.getRealitySize() + item.getNumber());
+                        zMaterialStatistics.setRealitySize(BigDecimal.valueOf(zMaterialStatistics.getRealitySize()).add(BigDecimal.valueOf(item.getNumber())).doubleValue());
                         baseMapper.updateById(zMaterialStatistics);
                     } else {
                         if (!ObjectUtils.isEmpty(item.getMaterialQuality()) && !ObjectUtils.isEmpty(item.getSpecifications())) {
@@ -201,4 +202,5 @@ public class ZMaterialStatisticsServiceImpl implements IZMaterialStatisticsServi
         }
         return baseMapper.deleteBatchIds(ids) > 0;
     }
+
 }

+ 6 - 0
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringCivilMapper.xml

@@ -56,6 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="p.unitId != null and p.unitId != ''">
             and unit_id = #{p.unitId}
         </if>
+        <if test="p.houseId != null and p.houseId != ''">
+            and house_id = #{p.houseId}
+        </if>
         <if test="p.enginType != null and p.enginType != ''">
             and engin_type = #{p.enginType}
         </if>
@@ -92,6 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="p.unitId != null and p.unitId != ''">
             and a.unit_id = #{p.unitId}
         </if>
+        <if test="p.houseId != null and p.houseId != ''">
+            and house_id = #{p.houseId}
+        </if>
         <if test="p.enginType != null and p.enginType != ''">
             and engin_type = #{p.enginType}
         </if>

+ 6 - 10
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZMaterialStatisticsMapper.xml

@@ -56,19 +56,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         e.district AS district,
         c.NAME AS reality_specifications,
         d.NAME AS reality_quality,
-        a.reality_size,
-        d.NAME AS material_quality,
-        c.NAME AS estimated_specifications,
+        sum(a.reality_size) reality_size,
         b.estimated_size,
-        f.dict_label AS engin_cycle,
         g.dict_label AS engin_classification,
-        CASE a.engin_type
+        CASE
+        a.engin_type
         WHEN 'old_renovation' THEN
-        '旧改'
-        ELSE
-        '新建'
-        END  as  engin_type,
-            a.node_type
+        '旧改' ELSE '新建'
+        END AS engin_type
         FROM
         z_material_statistics a
         LEFT JOIN z_engineering_materials_resets b ON a.reality_specifications = b.estimated_specifications
@@ -106,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and a.engin_type = #{enginType}
         </if>
         AND  !ISNULL(b.material_quality)
+        group by reality_quality,reality_specifications
     </select>
 
 </mapper>