|
@@ -8,9 +8,11 @@ import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.jfireel.expression.Expression;
|
|
|
import com.mixsmart.utils.*;
|
|
|
+import jdk.nashorn.internal.ir.WhileNode;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.jsoup.Jsoup;
|
|
@@ -43,7 +45,9 @@ import org.springblade.meter.feign.CertificateItemClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
@@ -76,7 +80,6 @@ import java.util.stream.Stream;
|
|
|
@RequiredArgsConstructor
|
|
|
@Lazy
|
|
|
public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula> implements IFormulaService {
|
|
|
-
|
|
|
private final IWbsParamService wpService;
|
|
|
private final FormulaStrategyFactory formulaStrategyFactory;
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
@@ -91,6 +94,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
|
private final IFormulaDao formulaDao;
|
|
|
private final CertificateItemClient certificateItemClient;
|
|
|
+ @Autowired
|
|
|
+ @Lazy
|
|
|
+ private IExcelTabService excelTabService;
|
|
|
+
|
|
|
|
|
|
|
|
|
public final static String WP="WP";
|
|
@@ -105,7 +112,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
public final static String E="E";
|
|
|
/**公式参数*/
|
|
|
public final static String FMOT="OP";
|
|
|
-
|
|
|
+
|
|
|
/**是否使用表单公式*/
|
|
|
public final static boolean isForm=true;
|
|
|
|
|
@@ -3377,9 +3384,463 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return reData;
|
|
|
}
|
|
|
|
|
|
+ //递归查询 子节点
|
|
|
+ private List<WbsTreeContract> getAllChildNodes(WbsTreeContract fatherNode,List<WbsTreeContract>childrenNodes) {
|
|
|
+
|
|
|
+ String sql="SELECT * FROM m_wbs_tree_contract WHERE parent_id="+fatherNode.getId()+" AND is_deleted=0";
|
|
|
+ List<WbsTreeContract> childs = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(childs.size()>0){
|
|
|
+ childrenNodes.addAll(childs);
|
|
|
+ }
|
|
|
+ for (WbsTreeContract child : childs) {
|
|
|
+ getAllChildNodes(child,childrenNodes);
|
|
|
+ }
|
|
|
+ return childrenNodes;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String findUnitName(Integer unitName){
|
|
|
+ String sql="SELECT unit_name from m_classifcation where id="+unitName;
|
|
|
+ return jdbcTemplate.queryForObject(sql, String.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据ID获取父节点,判断是否是自定义数字化节点
|
|
|
+ public Boolean findFatherNode(Long id){
|
|
|
+ String sql="SELECT node_class from m_wbs_tree_contract WHERE id="+id;
|
|
|
+ Integer nodeClass = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
+ if(ObjectUtil.isNotEmpty(nodeClass)){
|
|
|
+ if(nodeClass.equals(2)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public R<Object> newEvaluate(Long tablePkeyId) {
|
|
|
+ //先根据表单查出节点 然后查出父节点
|
|
|
+ if(StringUtils.isNumber(tablePkeyId)){
|
|
|
+ String queryParentNodeID="SELECT * from m_wbs_tree_contract WHERE p_key_id="+tablePkeyId;
|
|
|
+ WbsTreeContract wbsTreeContract1= jdbcTemplate.queryForObject(queryParentNodeID, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(ObjectUtil.isEmpty(wbsTreeContract1)){
|
|
|
+ return R.fail("表单不存在");
|
|
|
+ }
|
|
|
+ if(wbsTreeContract1.getIsCopeTab()==Integer.valueOf(2)){
|
|
|
+ return R.fail("该表不能评定汇总");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String biaodan="SELECT id from "+wbsTreeContract1.getInitTableName()+" where p_key_id="+wbsTreeContract1.getPKeyId();
|
|
|
+ Long l = jdbcTemplate.queryForObject(biaodan, Long.class);
|
|
|
+ }catch (EmptyResultDataAccessException e){
|
|
|
+ return R.fail("请先保存本表后再评定汇总");
|
|
|
+ }
|
|
|
+
|
|
|
+ String queryParentNode="SELECT * FROM m_wbs_tree_contract WHERE id="+wbsTreeContract1.getParentId();
|
|
|
+ WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(queryParentNode, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(ObjectUtil.isEmpty(wbsTreeContract)){
|
|
|
+ return R.fail("节点不存在");
|
|
|
+ }else {
|
|
|
+ if(!wbsTreeContract.getNodeName().contains("评定")){
|
|
|
+ return R.fail("该节点不能评定");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String queryProjectInfo="SELECT project_grade FROM m_project_info WHERE id="+wbsTreeContract.getProjectId();
|
|
|
+ String projectGrade = jdbcTemplate.queryForObject(queryProjectInfo, String.class);
|
|
|
+ if(StringUtils.isEmpty(projectGrade)){
|
|
|
+ return R.fail("该项目不为水利项目");
|
|
|
+ }else {
|
|
|
+ if(!projectGrade.equals("6")){
|
|
|
+ return R.fail("该项目不为水利项目");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果已评定并且有复制表,先删除所有的复制表
|
|
|
+ String queryNode="SELECT * from m_wbs_tree_contract where parent_id="+wbsTreeContract1.getParentId();
|
|
|
+ List<WbsTreeContract> queryNodes = jdbcTemplate.query(queryNode, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(queryNodes.size()>1){
|
|
|
+ for (WbsTreeContract node : queryNodes) {
|
|
|
+ if(node.getNodeName().indexOf("分部工程施工质量评定表_")>=0){
|
|
|
+ excelTabService.removeBussTabInfoById(node.getPKeyId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前节点的父节点
|
|
|
+ String queryFatherNodes="SELECT * from m_wbs_tree_contract where id="+wbsTreeContract.getParentId();
|
|
|
+ WbsTreeContract fatherNode = jdbcTemplate.queryForObject(queryFatherNodes, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ //当前节点的父节点所有的子节点
|
|
|
+ List<WbsTreeContract> childrenNodes=new ArrayList<>();
|
|
|
+ childrenNodes = getAllChildNodes(fatherNode,childrenNodes);
|
|
|
+ List<WbsTreeContract> list=new ArrayList<>();
|
|
|
+ //筛选出所有包含单元评定的节点
|
|
|
+ if(childrenNodes.size()>0){
|
|
|
+ for (WbsTreeContract childrenNode : childrenNodes) {
|
|
|
+ if(ObjectUtil.isNotEmpty(childrenNode.getIsClassifition())){
|
|
|
+ if(childrenNode.getIsClassifition()==Integer.valueOf(1)){
|
|
|
+ list.add(childrenNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(list.size()==0){
|
|
|
+ return R.success("成功");
|
|
|
+ }
|
|
|
+ //单元工程种类 <单元名称,个数>
|
|
|
+ Map<String,Integer> maps=new HashMap<>();
|
|
|
+ for (WbsTreeContract treeContract : list) {
|
|
|
+ String unitName = findUnitName(treeContract.getUnitName());
|
|
|
+ //如果包含单元名称就在原来的数量上加1,同时判断如果是自定义的节点就加自定义节点的单元数量
|
|
|
+ if(maps.containsKey(unitName)){
|
|
|
+ if(treeContract.getNodeClass()==Integer.valueOf(2)){
|
|
|
+ if(ObjectUtil.isNotEmpty(treeContract.getUnitNum())){
|
|
|
+ maps.put(unitName,maps.get(unitName)+treeContract.getUnitNum());
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ maps.put(unitName,maps.get(unitName)+1);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //不包含就放进map 同时判断是否是自定义的节点
|
|
|
+ if(treeContract.getNodeClass()==Integer.valueOf(2)){
|
|
|
+ if(ObjectUtil.isNotEmpty(treeContract.getUnitNum())){
|
|
|
+ maps.put(unitName,treeContract.getUnitNum());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ maps.put(unitName, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //筛选出自定义数字化节点包含单元评定的节点
|
|
|
+ List<WbsTreeContract>list1=new ArrayList<>();
|
|
|
+ for (WbsTreeContract childrenNode : childrenNodes) {
|
|
|
+ if(childrenNode.getStatus()==Integer.valueOf(1)){
|
|
|
+ if(ObjectUtil.isNotEmpty(childrenNode.getNodeClass())){
|
|
|
+ if(childrenNode.getNodeClass()==Integer.valueOf(2)){
|
|
|
+ if(ObjectUtil.isNotEmpty(childrenNode.getIsClassifition())){
|
|
|
+ if(childrenNode.getIsClassifition()==Integer.valueOf(1)){
|
|
|
+ list1.add(childrenNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //自定义数字化节点 <单元名称,优良个数>
|
|
|
+ Map<String,Integer>maps1=new HashMap<>();
|
|
|
+ if(list1.size()>0){
|
|
|
+ for (WbsTreeContract treeContract : list1) {
|
|
|
+ String unitName = findUnitName(treeContract.getUnitName());
|
|
|
+ if(maps1.containsKey(unitName)){
|
|
|
+ maps1.put(unitName,maps1.get(unitName)+treeContract.getExcellentNum());
|
|
|
+ }else {
|
|
|
+ maps1.put(unitName,treeContract.getExcellentNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //水利工程 拿到除了自定义数字化上传节点以外的其他所有节点的表单
|
|
|
+ List<WbsTreeContract>list2=new ArrayList<>();
|
|
|
+ for (WbsTreeContract childrenNode : childrenNodes) {
|
|
|
+ if(childrenNode.getStatus()==Integer.valueOf(1)){
|
|
|
+ if(ObjectUtil.isNotEmpty(childrenNode.getInitTableName())){
|
|
|
+ //判断表单父节点是否是自定义数字化节点
|
|
|
+ if(!findFatherNode(childrenNode.getParentId())){
|
|
|
+ list2.add(childrenNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //拿到所有水利工程的表单,去循环查找表单中的元素,包含了评定等级的个数
|
|
|
+ Map<String,Integer>maps2=new HashMap<>();
|
|
|
+ if(list2.size()>0){
|
|
|
+ for (WbsTreeContract treeContract : list2) {
|
|
|
+ String tableInfoSql="SELECT id from m_table_info Where tab_en_name="+ "'"+treeContract.getInitTableName()+"'";
|
|
|
+ Long id = jdbcTemplate.queryForObject(tableInfoSql, Long.class);
|
|
|
+ if(ObjectUtil.isEmpty(id)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String elementSql="SELECT * from m_wbs_form_element where f_id="+id;
|
|
|
+ List<WbsFormElement> elements = jdbcTemplate.query(elementSql, new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
+ List<String>keys=new ArrayList<>();
|
|
|
+ //筛选出所有表单配置了评定等级的key
|
|
|
+ if(elements!=null&&elements.size()>0){
|
|
|
+ for (WbsFormElement element : elements) {
|
|
|
+ if(element.getDynamicDict()==Integer.valueOf(600)){
|
|
|
+ keys.add(element.getEKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(keys!=null&&keys.size()>0){
|
|
|
+ //将拿到的key 去表单中查找元素 优良个数
|
|
|
+ String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + treeContract.getPKeyId();
|
|
|
+ List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
+ if(dataIn != null && dataIn.size() >= 1){
|
|
|
+ Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ for (String key : mysqlData.keySet()) {
|
|
|
+ for (String s : keys) {
|
|
|
+ if(s.equals(key)){
|
|
|
+ String tabVal = mysqlData.get(key) + "";
|
|
|
+ if(tabVal.indexOf("优良")>=0){
|
|
|
+ String sql="Select unit_name from m_wbs_tree_contract where id="+treeContract.getParentId();
|
|
|
+ Integer unitName = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
+ String unitName1 = findUnitName(unitName);
|
|
|
+ if(maps2.containsKey(unitName1)){
|
|
|
+ maps2.put(unitName1,maps2.get(unitName1)+1);
|
|
|
+ }else {
|
|
|
+ maps2.put(unitName1,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 合并两个Map <单元名称,优良个数>
|
|
|
+ Map<String, Integer> result = mergeMaps(maps1, maps2);
|
|
|
+ List<EvaluateDate> evaluateDates=new ArrayList<>();
|
|
|
+ for(String unitName:maps.keySet()){
|
|
|
+ EvaluateDate e = new EvaluateDate();
|
|
|
+ e.setUnitName(unitName);
|
|
|
+ e.setUnitNum(maps.get(unitName));
|
|
|
+ e.setQualifiedNum(maps.get(unitName));
|
|
|
+ evaluateDates.add(e);
|
|
|
+ }
|
|
|
+ if(evaluateDates.size()>0){
|
|
|
+ for (EvaluateDate evaluateDate : evaluateDates) {
|
|
|
+ for (String unitName : result.keySet()) {
|
|
|
+ if(unitName.equals(evaluateDate.getUnitName())){
|
|
|
+ evaluateDate.setExcellentNum(result.get(unitName));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Document document = null;
|
|
|
+ InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract1.getHtmlUrl());
|
|
|
+ String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ document = doc;
|
|
|
+ Elements unitNames = doc.select("el-input[placeholder~=单元工程种类]");
|
|
|
+ Elements unitNums = doc.select("el-input[placeholder~=单元工程个数]");
|
|
|
+ Elements qualifiedNums = doc.select("el-input[placeholder~=合格个数]");
|
|
|
+ Elements excellentNums = doc.select("el-input[placeholder~=其中优良个数]");
|
|
|
+
|
|
|
+ Map<String, Object> reData=new HashMap<>();
|
|
|
+ List<String[]>unitNamesString=new ArrayList<>();
|
|
|
+ List<String[]>unitNumsString=new ArrayList<>();
|
|
|
+ List<String[]>qualifiedNumsString=new ArrayList<>();
|
|
|
+ List<String[]>excellentNumString=new ArrayList<>();
|
|
|
+ for (Element unitName : unitNames) {
|
|
|
+ String keyName = unitName.attr("keyName");
|
|
|
+ String[] s = keyName.split("__");
|
|
|
+ unitNamesString.add(s);
|
|
|
+ }
|
|
|
+ for (Element unitNum : unitNums) {
|
|
|
+ String keyName = unitNum.attr("keyName");
|
|
|
+ String[] s = keyName.split("__");
|
|
|
+ unitNumsString.add(s);
|
|
|
+ }
|
|
|
+ for (Element qualifiedNum : qualifiedNums) {
|
|
|
+ String keyName = qualifiedNum.attr("keyName");
|
|
|
+ String[] s = keyName.split("__");
|
|
|
+ qualifiedNumsString.add(s);
|
|
|
+ }
|
|
|
+ for (Element excellentNum : excellentNums) {
|
|
|
+ String keyName = excellentNum.attr("keyName");
|
|
|
+ String[] s = keyName.split("__");
|
|
|
+ excellentNumString.add(s);
|
|
|
+ }
|
|
|
+ StringBuilder unitNameResult= new StringBuilder();
|
|
|
+ StringBuilder unitNumResult= new StringBuilder();
|
|
|
+ StringBuilder qualifiedNumResult= new StringBuilder();
|
|
|
+ StringBuilder excellentNumResult= new StringBuilder();
|
|
|
+ for(int i=0;i<evaluateDates.size();i++){
|
|
|
+ if(i>=8){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ String[] strings1 = unitNamesString.get(i);
|
|
|
+ unitNameResult.append("☆").append(evaluateDates.get(i).getUnitName()).append("_^_").append(strings1[1]);
|
|
|
+ String[] strings2=unitNumsString.get(i);
|
|
|
+ unitNumResult.append("☆").append(evaluateDates.get(i).getUnitNum()).append("_^_").append(strings2[1]);
|
|
|
+ String[] strings3=qualifiedNumsString.get(i);
|
|
|
+ qualifiedNumResult.append("☆").append(evaluateDates.get(i).getQualifiedNum()).append("_^_").append(strings3[1]);
|
|
|
+ String[] strings4=excellentNumString.get(i);
|
|
|
+ if(ObjectUtil.isNotEmpty(evaluateDates.get(i).getExcellentNum())){
|
|
|
+ excellentNumResult.append("☆").append(evaluateDates.get(i).getExcellentNum()).append("_^_").append(strings4[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] strings1 = unitNamesString.get(0);
|
|
|
+ String[] strings2=unitNumsString.get(0);
|
|
|
+ String[] strings3=qualifiedNumsString.get(0);
|
|
|
+ String[] strings4=excellentNumString.get(0);
|
|
|
+ unitNameResult.deleteCharAt(0);
|
|
|
+ unitNumResult.deleteCharAt(0);
|
|
|
+ qualifiedNumResult.deleteCharAt(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(excellentNumResult)){
|
|
|
+ excellentNumResult.deleteCharAt(0);
|
|
|
+ }
|
|
|
+ reData.put(strings1[0],unitNameResult);
|
|
|
+ reData.put(strings2[0],unitNumResult);
|
|
|
+ reData.put(strings3[0],qualifiedNumResult);
|
|
|
+ if(excellentNumResult.length()>0){
|
|
|
+ reData.put(strings4[0],excellentNumResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String key : reData.keySet()) {
|
|
|
+ String sql1="Update "+wbsTreeContract1.getInitTableName()+" SET "+key+"="+ "'"+reData.get(key)+"'"+" WHERE p_key_id="+wbsTreeContract1.getPKeyId();
|
|
|
+ jdbcTemplate.update(sql1);
|
|
|
+ }
|
|
|
+ if(evaluateDates.size()<=8){
|
|
|
+ return R.success("成功");
|
|
|
+ }else {
|
|
|
+ int j;
|
|
|
+ if(evaluateDates.size()%8==0){
|
|
|
+ j=evaluateDates.size()/8;
|
|
|
+ }else {
|
|
|
+ j=evaluateDates.size()/8+1;
|
|
|
+ }
|
|
|
+ j=j-1;
|
|
|
+ for (int x=0;x<j;x++){
|
|
|
+ WbsTreeContract wbsTreeContract2 = this.copeBussTab(wbsTreeContract1.getPKeyId());
|
|
|
+ evaluateDates.subList(0, 8).clear();
|
|
|
+ unitNameResult. setLength(0);
|
|
|
+ unitNumResult.setLength(0);
|
|
|
+ qualifiedNumResult.setLength(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(excellentNumResult)){
|
|
|
+ excellentNumResult.setLength(0);
|
|
|
+ }
|
|
|
+ for(int i=0;i<evaluateDates.size();i++){
|
|
|
+ if(i>=8){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ String[] strings11 = unitNamesString.get(i);
|
|
|
+ unitNameResult.append("☆").append(evaluateDates.get(i).getUnitName()).append("_^_").append(strings11[1]);
|
|
|
+ String[] strings22=unitNumsString.get(i);
|
|
|
+ unitNumResult.append("☆").append(evaluateDates.get(i).getUnitNum()).append("_^_").append(strings22[1]);
|
|
|
+ String[] strings33=qualifiedNumsString.get(i);
|
|
|
+ qualifiedNumResult.append("☆").append(evaluateDates.get(i).getQualifiedNum()).append("_^_").append(strings33[1]);
|
|
|
+ String[] strings44=excellentNumString.get(i);
|
|
|
+ if(ObjectUtil.isNotEmpty(evaluateDates.get(i).getExcellentNum())){
|
|
|
+ excellentNumResult.append("☆").append(evaluateDates.get(i).getExcellentNum()).append("_^_").append(strings44[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] strings11 = unitNamesString.get(0);
|
|
|
+ String[] strings22=unitNumsString.get(0);
|
|
|
+ String[] strings33=qualifiedNumsString.get(0);
|
|
|
+ String[] strings44=excellentNumString.get(0);
|
|
|
+ unitNameResult.deleteCharAt(0);
|
|
|
+ unitNumResult.deleteCharAt(0);
|
|
|
+ qualifiedNumResult.deleteCharAt(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(excellentNumResult)){
|
|
|
+ excellentNumResult.deleteCharAt(0);
|
|
|
+ }
|
|
|
+ reData.put(strings11[0],unitNameResult);
|
|
|
+ reData.put(strings22[0],unitNumResult);
|
|
|
+ reData.put(strings33[0],qualifiedNumResult);
|
|
|
+ if(excellentNumResult.length()>0){
|
|
|
+ reData.put(strings44[0],excellentNumResult);
|
|
|
+ }
|
|
|
+ for (String key : reData.keySet()) {
|
|
|
+ String sql1="Update "+wbsTreeContract2.getInitTableName()+" SET "+key+"="+ "'"+reData.get(key)+"'"+" WHERE p_key_id="+wbsTreeContract2.getPKeyId();
|
|
|
+ jdbcTemplate.update(sql1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.success("成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.fail("失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Integer> mergeMaps(Map<String, Integer> map1, Map<String, Integer> map2) {
|
|
|
+ Map<String, Integer> result = new HashMap<>();
|
|
|
|
|
|
+ // 将map1的所有键值对添加到result中
|
|
|
+ for (Map.Entry<String, Integer> entry : map1.entrySet()) {
|
|
|
+ result.put(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
|
|
|
+ // 遍历map2,对于每个键
|
|
|
+ for (Map.Entry<String, Integer> entry : map2.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ Integer value = entry.getValue();
|
|
|
|
|
|
+ // 如果键在result中已经存在,则将值相加
|
|
|
+ if (result.containsKey(key)) {
|
|
|
+ result.put(key, result.get(key) + value);
|
|
|
+ } else {
|
|
|
+ // 如果键在result中不存在,则直接添加
|
|
|
+ result.put(key, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ public Boolean isWaterProject(Long projectId) {
|
|
|
+ String queryProjectInfo="SELECT project_grade FROM m_project_info WHERE id="+projectId;
|
|
|
+ String projectGrade = jdbcTemplate.queryForObject(queryProjectInfo, String.class);
|
|
|
+ if(StringUtils.isEmpty(projectGrade)){
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ if(!projectGrade.equals("6")){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public WbsTreeContract copeBussTab(Long pkeyId) {
|
|
|
+ WbsTreeContract wbsInfo = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+
|
|
|
+ List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getId, wbsInfo.getId())
|
|
|
+ .eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
|
|
|
+ .eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
|
|
|
+ List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
|
|
|
+ long tabGroupId = SnowFlakeUtil.getId();
|
|
|
+
|
|
|
+ long newPkId = SnowFlakeUtil.getId();
|
|
|
+ WbsTreeContract wbsTreeContract = new WbsTreeContract();
|
|
|
+ BeanUtil.copy(wbsInfo, wbsTreeContract);
|
|
|
+ wbsTreeContract.setPKeyId(newPkId);
|
|
|
+ wbsTreeContract.setCreateTime(new Date());
|
|
|
+ wbsTreeContract.setTabGroupId(tabGroupId);
|
|
|
+ String nodeName = wbsTreeContractList2.get(0).getNodeName();
|
|
|
+
|
|
|
+ if (nodeName.indexOf("__") >= 0) {
|
|
|
+ String[] oldName = nodeName.split("__");
|
|
|
+ nodeName = oldName[0] + "__" + (Integer.parseInt(oldName[1]) + 1);
|
|
|
+ } else {
|
|
|
+ nodeName = nodeName + "__" + 1;
|
|
|
+ }
|
|
|
+ System.out.println("cr");
|
|
|
+ wbsTreeContract.setNodeName(nodeName);
|
|
|
+ wbsTreeContract.setIsCopeTab(2);
|
|
|
+ wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
|
|
|
+ wbsTreeContract.setIsBussShow(1); // 是否隐藏表
|
|
|
+ wbsTreeContract.setTabFileType(1);//没有上传附件
|
|
|
+ wbsTreeContract.setPdfUrl("");
|
|
|
+
|
|
|
+ String tabName = wbsTreeContract.getInitTableName();
|
|
|
+ // 字段查询 并去掉公式字段
|
|
|
+
|
|
|
+ String colkeys = "SELECT GROUP_CONCAT(COLUMN_NAME) as colkeys from information_schema.COLUMNS c where c.table_name='" + tabName + "' and COLUMN_NAME not in('id','p_key_id')";
|
|
|
+ Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(colkeys);
|
|
|
+ colkeys = stringObjectMap.get("colkeys") + "";
|
|
|
+ // 复制表数据
|
|
|
+
|
|
|
+ String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
|
|
|
+ jdbcTemplate.execute(querySql);
|
|
|
+ wbsTreeContractService.save(wbsTreeContract);
|
|
|
+ for (WbsTreeContract wbsTreeCont : wbsTreeContractList2) {
|
|
|
+ UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
|
|
|
+ updateWrapper.set("tab_group_id", tabGroupId);
|
|
|
+ wbsTreeContractService.update(updateWrapper);
|
|
|
+ }
|
|
|
+ return wbsTreeContract;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|