Commit bb544a88 authored by 朱晨阳's avatar 朱晨阳

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents 398c0542 51134736
...@@ -166,4 +166,7 @@ public class PreparationMoney extends BaseEntity { ...@@ -166,4 +166,7 @@ public class PreparationMoney extends BaseEntity {
private String delFile; private String delFile;
@TableField(exist = false) @TableField(exist = false)
private String arrFile; private String arrFile;
@TableField(exist = false)
private List<HygfReplenishment> hygfReplenishments; //补货单
} }
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
IFNULL(SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END),0)AS '未通过', IFNULL(SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END),0)AS '未通过',
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND ps.business_status = '通过' AND next_node_name = '设计上传典型图库' THEN 1 ELSE 0 END),0) AS '已完成(法务审核)', IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND ps.business_status = '通过' AND next_node_name = '设计上传典型图库' THEN 1 ELSE 0 END),0) AS '已完成(法务审核)',
IFNULL(SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END),0) AS completeTotal, IFNULL(SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END),0) AS completeTotal,
ROUND(COALESCE(SUM( CASE WHEN ps.process_status = '完成' THEN ei.real_scale ELSE 0 END ), 0), 2) AS completeTotalrl,
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND (ps.business_status IS NULL OR ps.design_status IS NULL OR ps.technology_status IS NULL or ps.business_status = '' OR ps.design_status = '' OR ps.technology_status = '') THEN 1 ELSE 0 END),0) AS '进行中(审核)' IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND (ps.business_status IS NULL OR ps.design_status IS NULL OR ps.technology_status IS NULL or ps.business_status = '' OR ps.design_status = '' OR ps.technology_status = '') THEN 1 ELSE 0 END),0) AS '进行中(审核)'
FROM FROM hygf_power_station ps
hygf_power_station ps LEFT JOIN hygf_peasant_household ph ON ps.peasant_household_id = ph.sequence_nbr
LEFT JOIN LEFT JOIN hygf_work_order_power_station wps ON wps.peasant_household_id = ph.sequence_nbr
hygf_peasant_household ph ON ps.peasant_household_id = ph.sequence_nbr LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wps.sequence_nbr
WHERE WHERE
ps.is_delete = 0 ps.is_delete = 0
<if test="developerCode != null and developerCode != ''"> <if test="developerCode != null and developerCode != ''">
...@@ -56,11 +57,14 @@ ...@@ -56,11 +57,14 @@
SELECT SELECT
SUM(CASE WHEN status = '未签署' THEN 1 ELSE 0 END) AS '未签署', SUM(CASE WHEN status = '未签署' THEN 1 ELSE 0 END) AS '未签署',
SUM(CASE WHEN status = '双方已签署' THEN 1 ELSE 0 END) AS '双方已签署', SUM(CASE WHEN status = '双方已签署' THEN 1 ELSE 0 END) AS '双方已签署',
ROUND(COALESCE( SUM(CASE WHEN status = '双方已签署' THEN ei.real_scale ELSE 0 END) , 0), 2) AS sfyqsrl,
SUM(CASE WHEN status = '农户已签署' THEN 1 ELSE 0 END) AS '农户已签署', SUM(CASE WHEN status = '农户已签署' THEN 1 ELSE 0 END) AS '农户已签署',
SUM(CASE WHEN status = '已作废' THEN 1 ELSE 0 END) AS '已作废' SUM(CASE WHEN status = '已作废' THEN 1 ELSE 0 END) AS '已作废'
FROM FROM
( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq ( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq
LEFT JOIN hygf_peasant_household ph ON ph.SEQUENCE_NBR = subq.peasant_household_id LEFT JOIN hygf_peasant_household ph ON ph.SEQUENCE_NBR = subq.peasant_household_id
LEFT JOIN hygf_work_order_power_station wps ON wps.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wps.sequence_nbr
WHERE WHERE
subq.rn = 1 subq.rn = 1
<if test="developerCode != null and developerCode != ''"> <if test="developerCode != null and developerCode != ''">
...@@ -113,9 +117,12 @@ ...@@ -113,9 +117,12 @@
SELECT SELECT
SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货'or preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS '待发货', SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货'or preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS '待发货',
SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN 1 ELSE 0 END ) AS '已收货', SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN 1 ELSE 0 END ) AS '已收货',
ROUND(COALESCE(SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN ei.real_scale ELSE 0 END ), 0), 2) AS yshrl,
SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ) AS '已发货' SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ) AS '已发货'
FROM FROM
hygf_peasant_household hygf_peasant_household
LEFT JOIN hygf_work_order_power_station ps ON ps.peasant_household_id = hygf_peasant_household.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
WHERE WHERE
preparation_money_state IS NOT NULL preparation_money_state IS NOT NULL
<if test="developerCode != null and developerCode != ''"> <if test="developerCode != null and developerCode != ''">
......
...@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapBuilder; ...@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
...@@ -91,7 +92,8 @@ public class CommonServiceImpl { ...@@ -91,7 +92,8 @@ public class CommonServiceImpl {
private Resource urlInfo; private Resource urlInfo;
@Autowired @Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl; SurveyInformationServiceImpl surveyInformationServiceImpl;
@Autowired
DocumentStationMapper documentStationMapper;
private static final String regionRedis = "app_region_redis"; private static final String regionRedis = "app_region_redis";
@Autowired @Autowired
RedisUtils redisUtil; RedisUtils redisUtil;
...@@ -118,6 +120,8 @@ public class CommonServiceImpl { ...@@ -118,6 +120,8 @@ public class CommonServiceImpl {
@Autowired @Autowired
PreparationMoneyLogMapper preparationMoneyLogMapper; PreparationMoneyLogMapper preparationMoneyLogMapper;
@Autowired @Autowired
DesignInformationMapper designInformationMapper;
@Autowired
HygfPreparationMoneyAuditingMapper preparationMoneyAuditingMapper; HygfPreparationMoneyAuditingMapper preparationMoneyAuditingMapper;
@Autowired @Autowired
ConstructionGirdRecordsMapper constructionGirdRecordsMapper; ConstructionGirdRecordsMapper constructionGirdRecordsMapper;
...@@ -602,6 +606,7 @@ public class CommonServiceImpl { ...@@ -602,6 +606,7 @@ public class CommonServiceImpl {
List<Map> hygfReplenishmentFiles = new ArrayList<>(); List<Map> hygfReplenishmentFiles = new ArrayList<>();
if (CollectionUtil.isNotEmpty(hygfReplenishments)){ if (CollectionUtil.isNotEmpty(hygfReplenishments)){
preparationMoneyDto.setHygfReplenishments(hygfReplenishments);
for (HygfReplenishment hygfReplenishment : hygfReplenishments) { for (HygfReplenishment hygfReplenishment : hygfReplenishments) {
hygfReplenishmentFiles.addAll(hygfReplenishment.getFile()); hygfReplenishmentFiles.addAll(hygfReplenishment.getFile());
} }
...@@ -683,7 +688,7 @@ public class CommonServiceImpl { ...@@ -683,7 +688,7 @@ public class CommonServiceImpl {
Sheet secondSheet7 = workbook.getSheetAt(7); Sheet secondSheet7 = workbook.getSheetAt(7);
fillSheet(secondSheet7, preparationMoneyDto); fillSheet(secondSheet7, preparationMoneyDto);
fillSheetFH(secondSheet7, preparationMoneyDto);
Sheet secondSheet8 = workbook.getSheetAt(8); Sheet secondSheet8 = workbook.getSheetAt(8);
fillSheet(secondSheet8, returnDto.getPowerStationConstructionData()); fillSheet(secondSheet8, returnDto.getPowerStationConstructionData());
...@@ -986,11 +991,137 @@ public class CommonServiceImpl { ...@@ -986,11 +991,137 @@ public class CommonServiceImpl {
} }
} }
} }
private void fillSheetFH(Sheet sheet, PreparationMoney preparationMoney){
LambdaQueryWrapper<DocumentStation> q = new LambdaQueryWrapper<>();
q.eq(DocumentStation::getPreparationMoneyId, preparationMoney.getSequenceNbr());
List<DocumentStation> lih = documentStationMapper.selectList(q);
List<Long> ids = new ArrayList<>();
for (DocumentStation documentStation : lih) {
ids.add(documentStation.getStationId());
}
//获取所有电站Bom,分组合并,暂时不相加
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
DesignInformation designInformation = new DesignInformation();
//组件
List<Object> assembly = new ArrayList<>();
//逆变器
List<Object> inverter = new ArrayList<>();
//电表箱
List<Object> electricityMeter = new ArrayList<>();
//电缆
List<Object> cable = new ArrayList<>();
for (DesignInformation des : li) {
if (des.getAssembly() != null && !des.getAssembly().isEmpty()) {
assembly.addAll(des.getAssembly());
}
if (des.getInverter() != null && !des.getInverter().isEmpty()) {
inverter.addAll(des.getInverter());
}
if (des.getElectricityMeter() != null && !des.getElectricityMeter().isEmpty()) {
electricityMeter.addAll(des.getElectricityMeter());
}
if (des.getCable() != null && !des.getCable().isEmpty()) {
cable.addAll(des.getCable());
}
}
designInformation.setAssembly(assembly);
designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable);
// 添加对发货单信息页面的特殊处理
if ("发货单信息".equals(sheet.getSheetName())) {
int startRowNum = 5;
if (null != designInformation.getAssembly()){
List<Map<String, Object>> maps = convertList(designInformation.getAssembly());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "组件";
String[] headersNames = {"物联编码", "物料名称", "电池片规格", "功率", "类型", "边框", "总功率(W)", "单/双面", "配置数量(块)", "金额(元)"};
String[] headers = {"wlbm", "wlmc", "dcpgg", "gl", "lx", "bk", "zgl", "dsm", "pzsl", "price"};
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getInverter()){
List<Map<String, Object>> maps = convertList(designInformation.getInverter());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "逆变器";
String[] headersNames = {"物联编码", "物料名称", "功率", "系列", "相位", "配置数量(块)", "金额(元)"};
String[] headers = {"wlbm", "wlmc", "gl", "xl", "xw", "pzsl", "price"};
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getElectricityMeter()){
List<Map<String, Object>> maps = convertList(designInformation.getElectricityMeter());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "并网箱";
String[] headersNames = {"物联编码", "物料名称","材质", "功率", "类型", "功能", "相位", "上网模式", "配置数量", "金额(元)"};
String[] headers = {"wlbm", "wlmc","cz", "gl", "lx", "gn", "xw", "swms","pzsl", "price"};
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getCable()){
List<Map<String, Object>> maps = convertList(designInformation.getCable());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "电缆";
String[] headersNames = {"物联编码", "物料名称", "型号", "规格", "配置数量(米)"};
String[] headers = {"wlbm", "wlmc", "xh", "gg", "pzsl"};
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getCable()){
List<Map<String, Object>> maps = convertList(preparationMoney.getHygfReplenishments());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "补货单";
String[] headersNames = {"备注", "日期"};
String[] headers = {"comment", "recDate"};
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
}
}
private void fillSheet(Sheet sheet, Object data) { private void fillSheet(Sheet sheet, Object data) {
if (Objects.isNull(data)){ if (Objects.isNull(data)){
return; return;
} }
autoSizeColumns(sheet);
int startRow = 1; int startRow = 1;
for (int i = 0; i < sheet.getLastRowNum() + 1; i++) { for (int i = 0; i < sheet.getLastRowNum() + 1; i++) {
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
...@@ -1393,6 +1524,7 @@ public class CommonServiceImpl { ...@@ -1393,6 +1524,7 @@ public class CommonServiceImpl {
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne, maps); documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne, maps);
} }
} }
autoSizeColumns(sheet);
} }
private String removePlaceholders(String fieldValue) { private String removePlaceholders(String fieldValue) {
...@@ -1863,16 +1995,24 @@ public class CommonServiceImpl { ...@@ -1863,16 +1995,24 @@ public class CommonServiceImpl {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static List<Map<String, Object>> convertList(List<Object> objectList) { public static List<Map<String, Object>> convertList(List<?> objectList) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
for (Object obj : objectList) { for (Object obj : objectList) {
if (obj != null) { if (obj != null) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Field[] fields = obj.getClass().getDeclaredFields(); getAllFields(obj, map);
result.add(map);
}
}
return result;
}
for (Field field : fields) { private static void getAllFields(Object obj, Map<String, Object> map) {
field.setAccessible(true); // 允许访问私有字段(如果需要) Class<?> clazz = obj.getClass();
while (clazz != null) {
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true); // 允许访问私有字段
try { try {
map.put(field.getName(), field.get(obj)); map.put(field.getName(), field.get(obj));
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
...@@ -1880,11 +2020,8 @@ public class CommonServiceImpl { ...@@ -1880,11 +2020,8 @@ public class CommonServiceImpl {
// 可以选择记录日志或抛出异常 // 可以选择记录日志或抛出异常
} }
} }
clazz = clazz.getSuperclass(); // 获取父类
result.add(map);
}
} }
return result;
} }
List<Map<String, Object>> convertListToMap(List<?> objects){ List<Map<String, Object>> convertListToMap(List<?> objects){
......
...@@ -126,12 +126,13 @@ public class StatisticsHomepageServiceImpl { ...@@ -126,12 +126,13 @@ public class StatisticsHomepageServiceImpl {
if (!e.equals("completeTotal")){ if (!e.equals("completeTotal")){
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build()); list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build());
} }
if (!e.equals("未勘察")){ if (!e.equals("未勘察") && !e.equals("completeTotalrl") ){
sureyNum += new BigDecimal(surey.get(e).toString()).longValue(); sureyNum += new BigDecimal(surey.get(e).toString()).longValue();
} }
} }
list = this.nullDataBuildResult(list,surveKeys); list = this.nullDataBuildResult(list,surveKeys);
resultMap.put("sureyComplete",surey.containsKey("completeTotal")?surey.get("completeTotal"):0); resultMap.put("sureyComplete",surey.containsKey("completeTotal")?surey.get("completeTotal"):0);
resultMap.put("completeTotalrl",surey.containsKey("completeTotalrl")?surey.get("completeTotalrl"):0);
} }
li.put("surveNum",sureyNum); li.put("surveNum",sureyNum);
...@@ -152,8 +153,9 @@ public class StatisticsHomepageServiceImpl { ...@@ -152,8 +153,9 @@ public class StatisticsHomepageServiceImpl {
li.put("surveNum",surveNum); li.put("surveNum",surveNum);
list = this.nullDataBuildResult(list,desionKeys); list = this.nullDataBuildResult(list,desionKeys);
if (resultMap.containsKey("sureyComplete")){ if (resultMap.containsKey("sureyComplete")){
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).build()); list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).put("realScale",resultMap.get("completeTotalrl")).build());
resultMap.remove("sureyComplete"); resultMap.remove("sureyComplete");
resultMap.remove("completeTotalrl");
}else { }else {
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build()); list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build());
} }
...@@ -168,8 +170,11 @@ public class StatisticsHomepageServiceImpl { ...@@ -168,8 +170,11 @@ public class StatisticsHomepageServiceImpl {
Map<String, Object> contract = maps.get(0); Map<String, Object> contract = maps.get(0);
contractKeys.removeAll(contract.keySet()); contractKeys.removeAll(contract.keySet());
for (String e : contract.keySet()) { for (String e : contract.keySet()) {
if (!e.equals("sfyqsrl") && !e.equals("双方已签署")){
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", contract.get(e)).build()); list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", contract.get(e)).build());
} }
}
list.add(MapBuilder.<String, Object>create().put("statusText","双方已签署" ).put("total", contract.get("双方已签署")).put("realScale",contract.get("sfyqsrl")).build());
list = this.nullDataBuildResult(list,contractKeys); list = this.nullDataBuildResult(list,contractKeys);
} }
resultMap.put("contract",list); resultMap.put("contract",list);
...@@ -181,9 +186,12 @@ public class StatisticsHomepageServiceImpl { ...@@ -181,9 +186,12 @@ public class StatisticsHomepageServiceImpl {
Map<String, Object> preparationMoney = maps.get(0); Map<String, Object> preparationMoney = maps.get(0);
preparationMoneyKeys.removeAll(preparationMoney.keySet()); preparationMoneyKeys.removeAll(preparationMoney.keySet());
for (String e : preparationMoney.keySet()) { for (String e : preparationMoney.keySet()) {
if (!e.equals("已收货") &&!e.equals("yshrl")){
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", preparationMoney.get(e)).build()); list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", preparationMoney.get(e)).build());
}
preparationNum += new BigDecimal(preparationMoney.get(e).toString()).longValue(); preparationNum += new BigDecimal(preparationMoney.get(e).toString()).longValue();
} }
list.add(MapBuilder.<String, Object>create().put("statusText", "已收货").put("total", preparationMoney.get("已收货")).put("realScale", preparationMoney.get("yshrl")).build());
list = this.nullDataBuildResult(list,preparationMoneyKeys); list = this.nullDataBuildResult(list,preparationMoneyKeys);
} }
resultMap.put("preparationMoney",list); resultMap.put("preparationMoney",list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment