Commit d270a747 authored by Fuzy's avatar Fuzy

修正

parent 5160186f
...@@ -47,4 +47,6 @@ public interface ActSuppliesCleaningRuleMapper ...@@ -47,4 +47,6 @@ public interface ActSuppliesCleaningRuleMapper
void deleteByMineIdAndDateColumn(@Param("mineId") String mineId, @Param("dateColumn") String dateColumn); void deleteByMineIdAndDateColumn(@Param("mineId") String mineId, @Param("dateColumn") String dateColumn);
List<SelActSuppliesDao> selActSupplies(); List<SelActSuppliesDao> selActSupplies();
List<SelActSuppliesDao> selActSuppliesOne();
} }
...@@ -80,35 +80,32 @@ public class ActSuppliesMaterialServiceImpl implements ActSuppliesMaterialServic ...@@ -80,35 +80,32 @@ public class ActSuppliesMaterialServiceImpl implements ActSuppliesMaterialServic
List<SelActSuppliesDao> list = actSuppliesCleaningRuleMapper.selActSupplies(); List<SelActSuppliesDao> list = actSuppliesCleaningRuleMapper.selActSupplies();
list.parallelStream().forEach(v -> { list.parallelStream().forEach(v -> {
v.setSuppliesName(v.getSuppliesName().replace("-", ""));
v.setSuppliesName(v.getSuppliesName().replace("研究费用", "研发费用")); v.setSuppliesName(v.getSuppliesName().replace("研究费用", "研发费用"));
v.setSuppliesName(v.getSuppliesName().replace("安全资金", "安全费用")); v.setSuppliesName(v.getSuppliesName().replace("安全资金", "安全费用"));
}); });
List<SelActSuppliesDao> listOne = actSuppliesCleaningRuleMapper.selActSuppliesOne();
materials.parallelStream().forEach(v -> v.getSourceColoumn().replace("-", ""));
for (ActSuppliesMaterialDetails material : materials) { for (ActSuppliesMaterialDetails material : materials) {
String codeColumn = material.getCodeColumn(); String codeColumn = material.getCodeColumn();
if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 6).equals(v.getCode()))) { if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 6).equals(v.getCode()))) {
SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 6).equals(v.getCode())).findFirst().get(); SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 6).equals(v.getCode())).findFirst().get();
extracted(material, selActSuppliesDao, list); extracted(material, selActSuppliesDao, listOne);
} else if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 4).equals(v.getCode()))) { } else if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 4).equals(v.getCode()))) {
SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 4).equals(v.getCode())).findFirst().get(); SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 4).equals(v.getCode())).findFirst().get();
extracted(material, selActSuppliesDao, list); extracted(material, selActSuppliesDao, listOne);
} else if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 2).equals(v.getCode()))) { } else if (list.parallelStream().anyMatch(v -> codeColumn.substring(0, 2).equals(v.getCode()))) {
SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 2).equals(v.getCode())).findFirst().get(); SelActSuppliesDao selActSuppliesDao = list.parallelStream().filter(v -> codeColumn.substring(0, 2).equals(v.getCode())).findFirst().get();
extracted(material, selActSuppliesDao, list); extracted(material, selActSuppliesDao, listOne);
} else { } else {
material.setGeneralLevel("其他"); material.setGeneralLevel("其他");
material.setGeneralTwoLevel("其他"); material.setGeneralTwoLevel("其他");
} }
} }
Boolean saved = actSuppliesMaterialMapper.save(materials); return actSuppliesMaterialMapper.save(materials);
if (!saved) {
return false;
}
return true;
} }
private void extracted(ActSuppliesMaterialDetails material, SelActSuppliesDao selActSuppliesDao, List<SelActSuppliesDao> list) { private void extracted(ActSuppliesMaterialDetails material, SelActSuppliesDao selActSuppliesDao, List<SelActSuppliesDao> listOne) {
if ((selActSuppliesDao.getTwoLevel() == null || selActSuppliesDao.getTwoLevel().equals("")) && (selActSuppliesDao.getOneLevel() != null && !selActSuppliesDao.getOneLevel().equals(""))) { if ((selActSuppliesDao.getTwoLevel() == null || selActSuppliesDao.getTwoLevel().equals("")) && (selActSuppliesDao.getOneLevel() != null && !selActSuppliesDao.getOneLevel().equals(""))) {
material.setGeneralLevel(selActSuppliesDao.getSuppliesName()); material.setGeneralLevel(selActSuppliesDao.getSuppliesName());
material.setGeneralTwoLevel("其他"); material.setGeneralTwoLevel("其他");
...@@ -116,7 +113,7 @@ public class ActSuppliesMaterialServiceImpl implements ActSuppliesMaterialServic ...@@ -116,7 +113,7 @@ public class ActSuppliesMaterialServiceImpl implements ActSuppliesMaterialServic
material.setGeneralLevel("其他"); material.setGeneralLevel("其他");
material.setGeneralTwoLevel("其他"); material.setGeneralTwoLevel("其他");
} else if ((selActSuppliesDao.getTwoLevel() != null && !selActSuppliesDao.getTwoLevel().equals("")) && (selActSuppliesDao.getOneLevel() != null && !selActSuppliesDao.getOneLevel().equals(""))) { } else if ((selActSuppliesDao.getTwoLevel() != null && !selActSuppliesDao.getTwoLevel().equals("")) && (selActSuppliesDao.getOneLevel() != null && !selActSuppliesDao.getOneLevel().equals(""))) {
SelActSuppliesDao dao = list.parallelStream().filter(v -> v.getOneLevel().equals(selActSuppliesDao.getOneLevel())).findFirst().get(); SelActSuppliesDao dao = listOne.parallelStream().filter(v -> v.getOneLevel().equals(selActSuppliesDao.getOneLevel())).findFirst().get();
material.setGeneralLevel(dao.getSuppliesName()); material.setGeneralLevel(dao.getSuppliesName());
material.setGeneralTwoLevel(selActSuppliesDao.getSuppliesName()); material.setGeneralTwoLevel(selActSuppliesDao.getSuppliesName());
} }
......
package com.ruoyi.system.service.impl.Conversion; package com.ruoyi.system.service.impl.Conversion;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -131,6 +132,7 @@ public class OtherMethod implements MineConversion { ...@@ -131,6 +132,7 @@ public class OtherMethod implements MineConversion {
acc.setId(StringUtils.remove(String.valueOf(UUID.randomUUID()), "-")); acc.setId(StringUtils.remove(String.valueOf(UUID.randomUUID()), "-"));
if (acc.getNumberColumn() != null && !"".equals(acc.getNumberColumn()) && acc.getMoneyColumn() != null && !"".equals(acc.getMoneyColumn())) { if (acc.getNumberColumn() != null && !"".equals(acc.getNumberColumn()) && acc.getMoneyColumn() != null && !"".equals(acc.getMoneyColumn())) {
BigDecimal num1 = new BigDecimal(acc.getNumberColumn()); BigDecimal num1 = new BigDecimal(acc.getNumberColumn());
if (acc.getMoneyColumn().equals("#DIV/0!")) continue;
BigDecimal money1 = new BigDecimal(acc.getMoneyColumn()); BigDecimal money1 = new BigDecimal(acc.getMoneyColumn());
acc.setMoneyColumns(num1.multiply(money1) + ""); acc.setMoneyColumns(num1.multiply(money1) + "");
} }
......
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
select ds.code code, act.one_level oneLevel, act.two_level twoLevel, act.supplies_name suppliesName select ds.code code, act.one_level oneLevel, act.two_level twoLevel, act.supplies_name suppliesName
from act_supplies_details ds left join act_supplies act on act.id = ds.sid; from act_supplies_details ds left join act_supplies act on act.id = ds.sid;
</select> </select>
<select id="selActSuppliesOne" resultType="com.ruoyi.system.model.SelActSuppliesDao">
select one_level oneLevel, supplies_name suppliesName from act_supplies where two_level is null or two_level = ''
</select>
<insert id="insertActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true" <insert id="insertActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true"
......
...@@ -6,8 +6,23 @@ import lombok.Data; ...@@ -6,8 +6,23 @@ import lombok.Data;
* 2024/8/26 * 2024/8/26
* 列与字段对照 * 列与字段对照
*/ */
@Data
public class PowerControlDao { public class PowerControlDao {
private String column; private String columnm;
private String field; private String field;
public String getColumn() {
return columnm;
}
public void setColumn(String columnm) {
this.columnm = columnm;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
} }
...@@ -16,8 +16,6 @@ public class RuleRequestModel implements Serializable { ...@@ -16,8 +16,6 @@ public class RuleRequestModel implements Serializable {
private JSONArray rules; private JSONArray rules;
private String summary;
private String type; private String type;
public String getType() { public String getType() {
...@@ -28,14 +26,6 @@ public class RuleRequestModel implements Serializable { ...@@ -28,14 +26,6 @@ public class RuleRequestModel implements Serializable {
this.type = type; this.type = type;
} }
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getId() { public String getId() {
return id; return id;
} }
......
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.PowerDisplayMapper; import com.ruoyi.system.mapper.PowerDisplayMapper;
import com.ruoyi.system.model.newrule.NewRuleRequestModel; import com.ruoyi.system.model.newrule.NewRuleRequestModel;
import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao; import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao;
...@@ -8,9 +10,13 @@ import com.ruoyi.system.model.power.dto.PowerDisplayDto; ...@@ -8,9 +10,13 @@ import com.ruoyi.system.model.power.dto.PowerDisplayDto;
import com.ruoyi.system.service.PowerDisplayService; import com.ruoyi.system.service.PowerDisplayService;
import com.ruoyi.system.service.impl.saveOnTheLargeScreenPower.*; import com.ruoyi.system.service.impl.saveOnTheLargeScreenPower.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -27,6 +33,15 @@ public class PowerDisplayServiceImpl implements PowerDisplayService { ...@@ -27,6 +33,15 @@ public class PowerDisplayServiceImpl implements PowerDisplayService {
@Override @Override
public void peek(List<NewRuleRequestModel> electricityIntoTheParameterDtoDtoList) { public void peek(List<NewRuleRequestModel> electricityIntoTheParameterDtoDtoList) {
Jedis redis = new Jedis("192.168.111.226", 6379);
SysUser user = SecurityUtils.getLoginUser().getUser();
if (redis.exists("电力导入" + user) && redis.get("电力导入" + user).equals("电力导入大屏")){
redis.close();
return;
}
redis.set("电力导入" + user, "电力导入大屏");
redis.expire("电力导入" + user, 5);
redis.close();
String mindId = electricityIntoTheParameterDtoDtoList.get(0).getMineid().replaceAll(" ", ""); String mindId = electricityIntoTheParameterDtoDtoList.get(0).getMineid().replaceAll(" ", "");
List<PowerControlDao> controlList = powerDisplayMapper.selControl(mindId); List<PowerControlDao> controlList = powerDisplayMapper.selControl(mindId);
List<PowerDisplayDto> powerDisplayDtoList = new ArrayList<>(); List<PowerDisplayDto> powerDisplayDtoList = new ArrayList<>();
...@@ -37,6 +52,7 @@ public class PowerDisplayServiceImpl implements PowerDisplayService { ...@@ -37,6 +52,7 @@ public class PowerDisplayServiceImpl implements PowerDisplayService {
if (mindId.equals("011704") && v.getRow().equals("电价(含税)")) return; if (mindId.equals("011704") && v.getRow().equals("电价(含税)")) return;
if (mindId.equals("010105") && (v.getRow().contains("(尖)") || v.getRow().contains("(峰)") || v.getRow().contains("(平)") || v.getRow().contains("(谷)") || v.getColoumn().equals("单价"))) if (mindId.equals("010105") && (v.getRow().contains("(尖)") || v.getRow().contains("(峰)") || v.getRow().contains("(平)") || v.getRow().contains("(谷)") || v.getColoumn().equals("单价")))
return; return;
if (mindId.equals("011701") && (v.getColoumn().equals("照明电价") || v.getColoumn().equals("动力电价") || v.getRow().contains("多经公司"))) return;
if (powerDisplayDtoList.size() > 0) { if (powerDisplayDtoList.size() > 0) {
b.set(powerDisplayDtoList.parallelStream().anyMatch(a -> a.getClassificationName().equals(v.getRow()))); b.set(powerDisplayDtoList.parallelStream().anyMatch(a -> a.getClassificationName().equals(v.getRow())));
} }
...@@ -66,6 +82,7 @@ public class PowerDisplayServiceImpl implements PowerDisplayService { ...@@ -66,6 +82,7 @@ public class PowerDisplayServiceImpl implements PowerDisplayService {
List<String> danHou = Collections.singletonList("011204"); List<String> danHou = Collections.singletonList("011204");
List<String> dongHuanTuo = Collections.singletonList("010102"); List<String> dongHuanTuo = Collections.singletonList("010102");
List<String> qianJiaYing = Collections.singletonList("010105"); List<String> qianJiaYing = Collections.singletonList("010105");
List<String> fanGeZhuang = Collections.singletonList("011701");
if (linXi.contains(mindId)) { if (linXi.contains(mindId)) {
List<NewRuleRequestModel> collect = electricityIntoTheParameterDtoDtoList.parallelStream().filter(v -> v.getRow().equals("电价(含税)")).collect(Collectors.toList()); List<NewRuleRequestModel> collect = electricityIntoTheParameterDtoDtoList.parallelStream().filter(v -> v.getRow().equals("电价(含税)")).collect(Collectors.toList());
if (collect.size() != 0) { if (collect.size() != 0) {
...@@ -115,18 +132,75 @@ public class PowerDisplayServiceImpl implements PowerDisplayService { ...@@ -115,18 +132,75 @@ public class PowerDisplayServiceImpl implements PowerDisplayService {
} }
} }
saveOnTheLargeScreen = new SaveOnTheLargeScreenImpl(new QianJiaYing()); saveOnTheLargeScreen = new SaveOnTheLargeScreenImpl(new QianJiaYing());
} else if (fanGeZhuang.contains(mindId)) {
List<NewRuleRequestModel> collect = electricityIntoTheParameterDtoDtoList.parallelStream().filter(v -> v.getRow().contains("多经公司")).collect(Collectors.toList());
if (collect.size() != 0) {
PowerDisplayDto dto = new PowerDisplayDto();
String[] split = collect.get(0).getRow().split("-");
dto.setClassificationName(split[0]);
for (NewRuleRequestModel model : collect) {
String[] strings = model.getRow().split("-");
switch (strings[1]){
case "峰":
dto.setPowerPeak(model.getValue());
break;
case "平":
dto.setPowerFlat(model.getValue());
break;
case "谷":
dto.setPowerValley(model.getValue());
break;
case "尖":
dto.setPowerTip(model.getValue());
break;
}
}
}
saveOnTheLargeScreen = new SaveOnTheLargeScreenImpl(new FanGeZhuang());
} }
if (saveOnTheLargeScreen != null) { if (saveOnTheLargeScreen != null) {
List<PowerDisplayDto> list = saveOnTheLargeScreen.save(mindId, powerDisplayDtoList, dao); List<PowerDisplayDto> list = saveOnTheLargeScreen.save(mindId, powerDisplayDtoList, dao);
if (mindId.equals("010105")) method(list, electricityIntoTheParameterDtoDtoList); if (mindId.equals("010105")) method(list, electricityIntoTheParameterDtoDtoList);
if (mindId.equals("011701")) methodFgz(list, electricityIntoTheParameterDtoDtoList);
list.parallelStream().forEach(v -> { list.parallelStream().forEach(v -> {
if (v.getLevelOneClassification() == null || "".equals(v.getLevelOneClassification())) if (v.getLevelOneClassification() == null || "".equals(v.getLevelOneClassification()))
v.setLevelOneClassification("其他"); v.setLevelOneClassification("其他");
v.setMindId(mindId);
v.setDateColumn(electricityIntoTheParameterDtoDtoList.get(0).getWageMonth());
}); });
powerDisplayMapper.insert(list); powerDisplayMapper.insert(list);
} }
} }
/**
* 011701电价的处理方法
*
* @param list
* @param electricityIntoTheParameterDtoDtoList
*/
private void methodFgz(List<PowerDisplayDto> list, List<NewRuleRequestModel> electricityIntoTheParameterDtoDtoList) {
String electricityPricesForLighting = electricityIntoTheParameterDtoDtoList.parallelStream().filter(v -> v.getColoumn().equals("照明电价")).findFirst().get().getValue();
String powerTariff = electricityIntoTheParameterDtoDtoList.parallelStream().filter(v -> v.getColoumn().equals("动力电价")).findFirst().get().getValue();
list.parallelStream().forEach(v -> {
if ((v.getElectricityPriceFlat() != null && !v.getElectricityPriceFlat().equals("")) ||
(v.getElectricityPricePeak() != null && !v.getElectricityPricePeak().equals("")) ||
(v.getElectricityPriceTip() != null && !v.getElectricityPriceTip().equals("")) ||
(v.getElectricityPriceValley() != null && !v.getElectricityPriceValley().equals(""))) return;
if (v.getLevelThreeClassification().equals("动力用电")) {
v.setElectricityPriceValley(powerTariff);
v.setElectricityPriceFlat(powerTariff);
v.setElectricityPricePeak(powerTariff);
v.setElectricityPriceTip(powerTariff);
}
if (v.getLevelThreeClassification().equals("照明用电")) {
v.setElectricityPriceValley(electricityPricesForLighting);
v.setElectricityPriceFlat(electricityPricesForLighting);
v.setElectricityPricePeak(electricityPricesForLighting);
v.setElectricityPriceTip(electricityPricesForLighting);
}
});
}
/** /**
* 010105电价的处理方法 * 010105电价的处理方法
* *
......
...@@ -30,40 +30,44 @@ public class DanHou implements SaveOnTheLargeScreen{ ...@@ -30,40 +30,44 @@ public class DanHou implements SaveOnTheLargeScreen{
Optional<PowerDisplayDto> first5 = powerDisplayDtoList.parallelStream().filter(v -> "南留庄供应".equals(v.getClassificationName()) && "辅助生产用电".equals(v.getLevelThreeClassification())).findFirst(); Optional<PowerDisplayDto> first5 = powerDisplayDtoList.parallelStream().filter(v -> "南留庄供应".equals(v.getClassificationName()) && "辅助生产用电".equals(v.getLevelThreeClassification())).findFirst();
Optional<PowerDisplayDto> first6 = powerDisplayDtoList.parallelStream().filter(v -> "污水处理场".equals(v.getClassificationName()) && "辅助生产用电".equals(v.getLevelThreeClassification())).findFirst(); Optional<PowerDisplayDto> first6 = powerDisplayDtoList.parallelStream().filter(v -> "污水处理场".equals(v.getClassificationName()) && "辅助生产用电".equals(v.getLevelThreeClassification())).findFirst();
// 减排风 // 减排风
sub(first, first1); sub(first, first1, powerDisplayDtoList);
// 加单侯矿供应 // 加单侯矿供应
add(first, first4); add(first, first4, powerDisplayDtoList);
add(first, first5); add(first, first5, powerDisplayDtoList);
add(first, first6); add(first, first6, powerDisplayDtoList);
Optional<PowerDisplayDto> first2 = powerDisplayDtoList.parallelStream().filter(v -> "原煤电量".equals(v.getClassificationName()) && "生产用电".equals(v.getLevelThreeClassification())).findFirst(); Optional<PowerDisplayDto> first2 = powerDisplayDtoList.parallelStream().filter(v -> "原煤电量".equals(v.getClassificationName()) && "生产用电".equals(v.getLevelThreeClassification())).findFirst();
Optional<PowerDisplayDto> first3 = powerDisplayDtoList.parallelStream().filter(v -> "各项小计".equals(v.getClassificationName()) && "排水用电".equals(v.getLevelThreeClassification())).findFirst(); Optional<PowerDisplayDto> first3 = powerDisplayDtoList.parallelStream().filter(v -> "各项小计".equals(v.getClassificationName()) && "排水用电".equals(v.getLevelThreeClassification())).findFirst();
List<PowerDisplayDto> collect = powerDisplayDtoList.parallelStream().filter(v -> "研发支出".equals(v.getLevelOneClassification())).collect(Collectors.toList()); List<PowerDisplayDto> collect = powerDisplayDtoList.parallelStream().filter(v -> "研发支出".equals(v.getLevelOneClassification())).collect(Collectors.toList());
// 减排水 // 减排水
sub(first2, first3); sub(first2, first3, powerDisplayDtoList);
// 减研发 // 减研发
if (first2.isPresent() && collect.size() != 0){ if (first2.isPresent() && collect.size() != 0){
for (PowerDisplayDto dto : collect) { for (PowerDisplayDto dto : collect) {
sub(first2, Optional.of(dto)); sub(first2, Optional.of(dto), powerDisplayDtoList);
} }
} }
return powerDisplayDtoList; return powerDisplayDtoList;
} }
private void sub(Optional<PowerDisplayDto> first, Optional<PowerDisplayDto> first1) { private void sub(Optional<PowerDisplayDto> first, Optional<PowerDisplayDto> first1, List<PowerDisplayDto> displayDto) {
if (first.isPresent() && first1.isPresent()) { if (first.isPresent() && first1.isPresent()) {
PowerDisplayDto dto = first.get(); PowerDisplayDto dto = first.get();
PowerDisplayDto dto1 = first1.get(); PowerDisplayDto dto1 = first1.get();
dto.setPowerTotal(new BigDecimal(dto.getPowerTotal()).subtract(new BigDecimal(dto1.getPowerTotal() != null && !"".equals(dto1.getPowerTotal()) ? dto1.getPowerTotal() : "0")) + ""); dto.setPowerTotal(new BigDecimal(dto.getPowerTotal() == null || "".equals(dto.getPowerTotal()) ? "0" : dto.getPowerTotal()).subtract(new BigDecimal(dto1.getPowerTotal() != null && !"".equals(dto1.getPowerTotal()) ? dto1.getPowerTotal() : "0")) + "");
dto.setElectricityTotal(new BigDecimal(dto.getElectricityTotal()).subtract(new BigDecimal(dto1.getElectricityTotal() != null && !"".equals(dto1.getElectricityTotal()) ? dto1.getElectricityTotal() : "0")) + ""); dto.setElectricityTotal(new BigDecimal(dto.getElectricityTotal() == null || "".equals(dto.getElectricityTotal()) ? "0" : dto.getElectricityTotal()).subtract(new BigDecimal(dto1.getElectricityTotal() != null && !"".equals(dto1.getElectricityTotal()) ? dto1.getElectricityTotal() : "0")) + "");
displayDto.remove(first.get());
displayDto.add(dto);
} }
} }
private void add(Optional<PowerDisplayDto> first, Optional<PowerDisplayDto> first4) { private void add(Optional<PowerDisplayDto> first, Optional<PowerDisplayDto> first4, List<PowerDisplayDto> displayDto) {
if (first.isPresent() && first4.isPresent()) { if (first.isPresent() && first4.isPresent()) {
PowerDisplayDto dto = first.get(); PowerDisplayDto dto = first.get();
PowerDisplayDto dto1 = first4.get(); PowerDisplayDto dto1 = first4.get();
dto.setPowerTotal(new BigDecimal(dto.getPowerTotal()).add(new BigDecimal(dto1.getPowerTotal() != null && !"".equals(dto1.getPowerTotal()) ? dto1.getPowerTotal() : "0")) + ""); dto.setPowerTotal(new BigDecimal(dto.getPowerTotal() == null || "".equals(dto.getPowerTotal()) ? "0" : dto.getPowerTotal()).add(new BigDecimal(dto1.getPowerTotal() != null && !"".equals(dto1.getPowerTotal()) ? dto1.getPowerTotal() : "0")) + "");
dto.setElectricityTotal(new BigDecimal(dto.getElectricityTotal()).add(new BigDecimal(dto1.getElectricityTotal() != null && !"".equals(dto1.getElectricityTotal()) ? dto1.getElectricityTotal() : "0")) + ""); dto.setElectricityTotal(new BigDecimal(dto.getElectricityTotal() == null || "".equals(dto.getElectricityTotal()) ? "0" : dto.getElectricityTotal()).add(new BigDecimal(dto1.getElectricityTotal() != null && !"".equals(dto1.getElectricityTotal()) ? dto1.getElectricityTotal() : "0")) + "");
displayDto.remove(first.get());
displayDto.add(dto);
} }
} }
} }
package com.ruoyi.system.service.impl.saveOnTheLargeScreenPower; package com.ruoyi.system.service.impl.saveOnTheLargeScreenPower;
import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao; import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao;
import com.ruoyi.system.model.power.dao.PowerControlDao;
import com.ruoyi.system.model.power.dto.PowerDisplayDto; import com.ruoyi.system.model.power.dto.PowerDisplayDto;
import java.util.List; import java.util.List;
......
package com.ruoyi.system.service.impl.saveOnTheLargeScreenPower;
import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao;
import com.ruoyi.system.model.power.dto.PowerDisplayDto;
import java.util.List;
/**
* 2024/9/3
*/
public class FanGeZhuang implements SaveOnTheLargeScreen{
@Override
public List<PowerDisplayDto> save(String mindId, List<PowerDisplayDto> powerDisplayDtoList, List<PowerClassificationQueryDao> dao) {
powerDisplayDtoList.parallelStream().forEach(v -> {
for (PowerClassificationQueryDao queryDao : dao) {
if (queryDao.getClassificationName().equals(v.getClassificationName())){
v.setLevelOneClassification(queryDao.getLevelOneClassification());
v.setLevelTwoClassification(queryDao.getLevelTwoClassification());
v.setLevelThreeClassification(queryDao.getLevelThreeClassification());
dao.remove(queryDao);
break;
}
}
});
powerDisplayDtoList.parallelStream()
.filter(v -> (v.getLevelOneClassification() == null || v.getLevelOneClassification().equals("")) && !v.getClassificationName().contains("多经公司") && !v.getClassificationName().contains("社区用电"))
.forEach(v -> {
v.setLevelOneClassification("生产成本");
v.setLevelTwoClassification("原煤");
v.setLevelThreeClassification("动力用电");
});
return powerDisplayDtoList;
}
}
...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl.saveOnTheLargeScreenPower; ...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl.saveOnTheLargeScreenPower;
import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao; import com.ruoyi.system.model.power.dao.PowerClassificationQueryDao;
import com.ruoyi.system.model.power.dto.PowerDisplayDto; import com.ruoyi.system.model.power.dto.PowerDisplayDto;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -24,16 +25,18 @@ public class LvJiaTuo implements SaveOnTheLargeScreen { ...@@ -24,16 +25,18 @@ public class LvJiaTuo implements SaveOnTheLargeScreen {
} }
} }
}); });
List<PowerDisplayDto> rDExpendituresOnRawCoal = powerDisplayDtoList.parallelStream().filter(v -> v.getLevelOneClassification().equals("研发支出") && "原煤".equals(v.getLevelThreeClassification())).collect(Collectors.toList()); List<PowerDisplayDto> rDExpendituresOnRawCoal = powerDisplayDtoList.parallelStream().filter(v -> "研发支出".equals(v.getLevelOneClassification()) && v.getLevelThreeClassification().equals("原煤")).collect(Collectors.toList());
List<PowerDisplayDto> rDSpendingWashesCoal = powerDisplayDtoList.parallelStream().filter(v -> v.getLevelOneClassification().equals("研发支出") && "洗煤".equals(v.getLevelThreeClassification())).collect(Collectors.toList()); List<PowerDisplayDto> rDSpendingWashesCoal = powerDisplayDtoList.parallelStream().filter(v -> StringUtils.equals(v.getLevelOneClassification(), "研发支出") && "洗煤".equals(v.getLevelThreeClassification())).collect(Collectors.toList());
Optional<PowerDisplayDto> onRawCoal = powerDisplayDtoList.parallelStream().filter(v -> v.getClassificationName().equals("生产成本原煤线电费")).findFirst(); Optional<PowerDisplayDto> onRawCoal = powerDisplayDtoList.parallelStream().filter(v -> StringUtils.equals(v.getClassificationName(), "生产成本原煤线电费")).findFirst();
Optional<PowerDisplayDto> washesCoal = powerDisplayDtoList.parallelStream().filter(v -> v.getClassificationName().equals("生产成本洗煤线电费")).findFirst(); Optional<PowerDisplayDto> washesCoal = powerDisplayDtoList.parallelStream().filter(v -> StringUtils.equals(v.getClassificationName(), "生产成本洗煤线电费")).findFirst();
if (onRawCoal.isPresent()) { if (onRawCoal.isPresent()) {
PowerDisplayDto displayDto = onRawCoal.get(); PowerDisplayDto displayDto = onRawCoal.get();
for (PowerDisplayDto dto : rDExpendituresOnRawCoal) { for (PowerDisplayDto dto : rDExpendituresOnRawCoal) {
displayDto.setElectricityTotal(new BigDecimal(displayDto.getElectricityTotal()).subtract(new BigDecimal(dto.getElectricityTotal() != null ? dto.getElectricityTotal() : "0")) + ""); displayDto.setElectricityTotal(new BigDecimal(displayDto.getElectricityTotal()).subtract(new BigDecimal(dto.getElectricityTotal() != null ? dto.getElectricityTotal() : "0")) + "");
displayDto.setPowerTotal(new BigDecimal(displayDto.getPowerTotal()).subtract(new BigDecimal(dto.getPowerTotal() != null ? dto.getPowerTotal() : "0")) + ""); displayDto.setPowerTotal(new BigDecimal(displayDto.getPowerTotal()).subtract(new BigDecimal(dto.getPowerTotal() != null ? dto.getPowerTotal() : "0")) + "");
} }
powerDisplayDtoList.remove(onRawCoal.get());
powerDisplayDtoList.add(displayDto);
} }
if (washesCoal.isPresent()) { if (washesCoal.isPresent()) {
PowerDisplayDto displayDto = washesCoal.get(); PowerDisplayDto displayDto = washesCoal.get();
...@@ -41,6 +44,8 @@ public class LvJiaTuo implements SaveOnTheLargeScreen { ...@@ -41,6 +44,8 @@ public class LvJiaTuo implements SaveOnTheLargeScreen {
displayDto.setElectricityTotal(new BigDecimal(displayDto.getElectricityTotal()).subtract(new BigDecimal(dto.getElectricityTotal() != null ? dto.getElectricityTotal() : "0")) + ""); displayDto.setElectricityTotal(new BigDecimal(displayDto.getElectricityTotal()).subtract(new BigDecimal(dto.getElectricityTotal() != null ? dto.getElectricityTotal() : "0")) + "");
displayDto.setPowerTotal(new BigDecimal(displayDto.getPowerTotal()).subtract(new BigDecimal(dto.getPowerTotal() != null ? dto.getPowerTotal() : "0")) + ""); displayDto.setPowerTotal(new BigDecimal(displayDto.getPowerTotal()).subtract(new BigDecimal(dto.getPowerTotal() != null ? dto.getPowerTotal() : "0")) + "");
} }
powerDisplayDtoList.remove(washesCoal.get());
powerDisplayDtoList.add(displayDto);
} }
return powerDisplayDtoList; return powerDisplayDtoList;
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
and a.whether_it_is_enabled = '0'; and a.whether_it_is_enabled = '0';
</select> </select>
<select id="selControl" resultType="com.ruoyi.system.model.power.dao.PowerControlDao"> <select id="selControl" resultType="com.ruoyi.system.model.power.dao.PowerControlDao">
select column_name column, field_name field select column_name columnm, field_name field
from wages_power_column_comparison from wages_power_column_comparison
where mind_id = #{id} and type = '1' where mind_id = #{id} and type = '1'
</select> </select>
......
...@@ -3,13 +3,15 @@ ...@@ -3,13 +3,15 @@
<mapper namespace="com.ruoyi.system.mapper.RuleMapper"> <mapper namespace="com.ruoyi.system.mapper.RuleMapper">
<insert id="save"> <insert id="save">
INSERT INTO rule_sheet(template_id, rules, first_rule, second_rule, summary_identification, type) INSERT INTO
values (#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule}, #{rule.summary}, #{rule.type}) rule_sheet(template_id, rules, first_rule, second_rule, type)
values
(#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule}, #{rule.type})
</insert> </insert>
<update id="updateToId"> <update id="updateToId">
update rule_sheet set update rule_sheet set
<if test="rule.templateId != null and rule.templateId != ''"> <if test="rule.templateId != null and rule.templateId != ''">
template_id = #{rule.templateId}, template_id = #{rule.templateId},
</if> </if>
<if test="rule.firstRule != null and rule.firstRule != ''"> <if test="rule.firstRule != null and rule.firstRule != ''">
first_rule = #{rule.firstRule}, first_rule = #{rule.firstRule},
...@@ -20,22 +22,14 @@ ...@@ -20,22 +22,14 @@
<if test="s != null and s != ''"> <if test="s != null and s != ''">
rules = #{s}, rules = #{s},
</if> </if>
<if test="rule.summary != null and rule.summary != ''">
summary_identification = #{rule.summary},
</if>
<if test="rule.type != null and rule.type != ''"> <if test="rule.type != null and rule.type != ''">
type = #{rule.type}, type = #{rule.type},
</if> </if>
id = #{rule.id} id = #{rule.id}
where id = #{rule.id}; where id = #{rule.id};
</update> </update>
<select id="query" resultType="com.ruoyi.system.model.rule.RuleRequestModel"> <select id="query" resultType="com.ruoyi.system.model.rule.RuleRequestModel">
select template_id as templateId, select template_id as templateId, first_rule as firstRule, second_rule as secondRule, type
first_rule as firstRule,
second_rule as secondRule,
summary_identification as summary,
type
from rule_sheet from rule_sheet
where template_id = #{id} where template_id = #{id}
</select> </select>
......
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