wangzhun il y a 1 an
Parent
commit
7285bacc6f
32 fichiers modifiés avec 695 ajouts et 106 suppressions
  1. 2 2
      gateway/src/main/resources/bootstrap-test.yml
  2. 1 1
      gateway/src/main/resources/bootstrap.yml
  3. 2 2
      system/src/main/resources/bootstrap-test.yml
  4. 1 1
      system/src/main/resources/bootstrap.yml
  5. 6 0
      workflow/pom.xml
  6. 40 1
      workflow/src/main/java/com/tofly/workflow/baseconf/controller/ContractConfigController.java
  7. 35 4
      workflow/src/main/java/com/tofly/workflow/baseconf/controller/ContractConfigFieldController.java
  8. 16 1
      workflow/src/main/java/com/tofly/workflow/baseconf/controller/TfBaseTypePController.java
  9. 9 1
      workflow/src/main/java/com/tofly/workflow/baseconf/controller/TfContractTemplatePController.java
  10. 2 0
      workflow/src/main/java/com/tofly/workflow/baseconf/entity/ContractConfig.java
  11. 5 0
      workflow/src/main/java/com/tofly/workflow/baseconf/entity/TfBaseTypeP.java
  12. 1 1
      workflow/src/main/java/com/tofly/workflow/baseconf/entity/TfMatterNumberP.java
  13. 5 1
      workflow/src/main/java/com/tofly/workflow/baseconf/entity/dto/QueryConfigDto.java
  14. 17 0
      workflow/src/main/java/com/tofly/workflow/baseconf/entity/vo/SingleDataVo.java
  15. 12 0
      workflow/src/main/java/com/tofly/workflow/baseconf/service/ContractConfigService.java
  16. 268 44
      workflow/src/main/java/com/tofly/workflow/baseconf/service/impl/ContractConfigServiceImpl.java
  17. 1 1
      workflow/src/main/java/com/tofly/workflow/processconfig/entity/TfProcessConfigStepL.java
  18. 80 6
      workflow/src/main/java/com/tofly/workflow/report/ReportController.java
  19. 10 10
      workflow/src/main/java/com/tofly/workflow/report/vo/ProjectDispatchVo.java
  20. 68 0
      workflow/src/main/java/com/tofly/workflow/utils/ExcelUtil.java
  21. 1 1
      workflow/src/main/java/com/tofly/workflow/utils/compute/MoneyToChineseUtils.java
  22. 3 1
      workflow/src/main/java/com/tofly/workflow/utils/compute/ScanFieldUtil.java
  23. 8 0
      workflow/src/main/java/com/tofly/workflow/wzyy/controller/MaterialBaseController.java
  24. 17 0
      workflow/src/main/java/com/tofly/workflow/wzyy/entity/dto/WzTypeOverOrg.java
  25. 14 0
      workflow/src/main/java/com/tofly/workflow/wzyy/entity/dto/WzTypeOverOrgDto.java
  26. 2 0
      workflow/src/main/java/com/tofly/workflow/wzyy/service/MaterialBaseService.java
  27. 42 3
      workflow/src/main/java/com/tofly/workflow/wzyy/service/impl/MaterialBaseServiceImpl.java
  28. 5 4
      workflow/src/main/resources/bootstrap-loc.yml
  29. 2 2
      workflow/src/main/resources/bootstrap-test.yml
  30. 1 1
      workflow/src/main/resources/bootstrap.yml
  31. 12 15
      workflow/src/main/resources/mapper/report/ReportMapper.xml
  32. 7 3
      workflow/src/test/java/com/tofly/test/TestCal.java

+ 2 - 2
gateway/src/main/resources/bootstrap-test.yml

@@ -5,7 +5,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
         # 配置后缀
         file-extension: yaml
         shared-configs[0]:
@@ -14,7 +14,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
   application:
     # 该应用在nacos配置中的名称
     name: tofly-gateway

+ 1 - 1
gateway/src/main/resources/bootstrap.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: loc
+    active: test
 

+ 2 - 2
system/src/main/resources/bootstrap-test.yml

@@ -5,7 +5,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
         # 配置后缀
         file-extension: yaml
         shared-configs[0]:
@@ -20,7 +20,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
   application:
     # 该应用在nacos配置中的名称
     name: tofly-auth

+ 1 - 1
system/src/main/resources/bootstrap.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: loc
+    active: test

+ 6 - 0
workflow/pom.xml

@@ -23,6 +23,12 @@
             <artifactId>common</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.1.2</version>
+        </dependency>
         <!--文档处理Excel-->
         <dependency>
             <groupId>com.haiqiu.tools</groupId>

+ 40 - 1
workflow/src/main/java/com/tofly/workflow/baseconf/controller/ContractConfigController.java

@@ -4,14 +4,18 @@
  */
 package com.tofly.workflow.baseconf.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.Assert;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.tofly.common.core.result.ResultData;
 import com.tofly.common.log.annotation.ToFlyAppLog;
+import com.tofly.common.oauth.exception.ToflyDeniedException;
 import com.tofly.workflow.baseconf.entity.ContractConfig;
 import com.tofly.workflow.baseconf.entity.ContractConfigField;
 import com.tofly.workflow.baseconf.entity.dto.QueryConfigDto;
 import com.tofly.workflow.baseconf.entity.vo.ContractConfigFieldBatchVo;
+import com.tofly.workflow.baseconf.menum.ContractConfigTypeEnum;
 import com.tofly.workflow.baseconf.service.ContractConfigFieldService;
 import com.tofly.workflow.baseconf.service.ContractConfigService;
 import com.tofly.workflow.buss.entity.TfProjectBaseW;
@@ -24,6 +28,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import org.springframework.web.bind.annotation.ModelAttribute;
 
 import javax.validation.Valid;
+import javax.xml.transform.Result;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -55,16 +60,50 @@ public class ContractConfigController {
       return ResultData.ok(contractConfigService.page(page, Wrappers.query(contractConfig)));
     }
 
+
+    @GetMapping("/copy" )
+    @ApiOperation(value = "模板配置复制")
+    public ResultData copyConfig(Long sourceConfigId,String targetTemplateIds ) {
+
+        if(sourceConfigId==null){
+            throw  new ToflyDeniedException("请传入源配置模板");
+        }
+        if(!StringUtils.isNotBlank(targetTemplateIds)){
+            throw  new ToflyDeniedException("请传入目标模板id");
+        }
+        contractConfigService.copyConfig(sourceConfigId,targetTemplateIds);
+        return  ResultData.ok();
+
+    }
+
+
     @PostMapping("/getConfigData" )
     @ApiOperation(value = "获取合同自动计算数据")
     public ResultData getConfigData(@RequestBody @Valid QueryConfigDto queryConfigDto ) {
+        if(queryConfigDto.getTemplateFieldId()==null ||queryConfigDto.getTemplateFieldId()==0){
+
+            return  ResultData.ok();
+        }
+
         ContractConfig contractConfig = new ContractConfig();
         contractConfig.setTenantId(queryConfigDto.getTenantId());
-        //暂时写死
         contractConfig.setTemplateFieldId(queryConfigDto.getTemplateFieldId());
         return ResultData.ok(contractConfigService.paraReplace(queryConfigDto.getProcessId(),
                 contractConfig,queryConfigDto.getTfProjectBaseW()));
     }
+    /**
+     * 单一字段值获取
+     */
+    @PostMapping("/getFieldTarget" )
+    @ApiOperation(value = "获取单个字段自动计算")
+    public ResultData getFieldTarget(@RequestBody @Valid QueryConfigDto queryConfigDto ) {
+
+
+
+            return ResultData.ok(contractConfigService.singleData( queryConfigDto));
+    }
+
+
     /**
      * 通过id查询合同计算配置信息
      * @param id id

+ 35 - 4
workflow/src/main/java/com/tofly/workflow/baseconf/controller/ContractConfigFieldController.java

@@ -4,15 +4,19 @@
  */
 package com.tofly.workflow.baseconf.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.tofly.common.core.result.ResultData;
 import com.tofly.common.log.annotation.ToFlyAppLog;
 import com.tofly.workflow.baseconf.entity.ContractConfig;
 import com.tofly.workflow.baseconf.entity.ContractConfigField;
+import com.tofly.workflow.baseconf.entity.TfContractFieldP;
+import com.tofly.workflow.baseconf.entity.TfTemplateFieldP;
 import com.tofly.workflow.baseconf.entity.dto.ContractConfigFieldBatchDto;
-import com.tofly.workflow.baseconf.service.ContractConfigFieldService;
-import com.tofly.workflow.baseconf.service.ContractConfigService;
+import com.tofly.workflow.baseconf.service.*;
+import com.tofly.workflow.buss.entity.vo.ContractConfigFieldVo;
 import com.tofly.workflow.buss.entity.vo.ContractConfigTableVo;
 import com.tofly.workflow.utils.compute.ScanFieldUtil;
 import lombok.AllArgsConstructor;
@@ -44,6 +48,10 @@ public class ContractConfigFieldController {
     private final  ContractConfigFieldService contractConfigFieldService;
 
     private final ContractConfigService contractConfigService;
+
+    private final TfContractFieldPService tfContractFieldPService;
+    private final TfTemplateFieldPService templateFieldPService;
+    private final TfContractTemplatePService tfContractTemplatePService;
     /**
     * 分页查询
     * @param page 分页对象
@@ -57,6 +65,8 @@ public class ContractConfigFieldController {
     }
 
 
+
+
     /**
      * 通过id查询合同字段取值配置表
      * @param id id
@@ -147,10 +157,31 @@ public class ContractConfigFieldController {
     }
     @GetMapping("/getTableAndFields" )
     @ApiOperation(value = "获取所有的业务数据属性")
-    public  ResultData getTableAndFields(){
-
+    public  ResultData getTableAndFields( Long templateId){
+        Assert.notNull(templateId,"请传入使用的模板id");
         final Map<String, ContractConfigTableVo> stringContractConfigTableVoMap
                 = ScanFieldUtil.scanTableAndField("");
+        //查找合同模板配置的对应字段
+        List<TfTemplateFieldP> templateFieldList = templateFieldPService.list(new QueryWrapper<TfTemplateFieldP>()
+                .eq("TEMPLATE_ID",templateId));
+        List<Long> idList = templateFieldList.stream().map(TfTemplateFieldP::getFieldId).collect(Collectors.toList());
+        if(idList.size() >0){
+            List<TfContractFieldP> contractFieldList = tfContractFieldPService.listByIds(idList);
+            ContractConfigTableVo contractConfigTableVo = new ContractConfigTableVo();
+            contractConfigTableVo.setTableName("合同配置模板");
+            contractConfigTableVo.setNote("合同配置模板");
+           final   List<ContractConfigFieldVo> fields = new ArrayList<>();
+            contractFieldList.forEach(field->{
+                ContractConfigFieldVo contractConfigFieldVo = new ContractConfigFieldVo();
+                contractConfigFieldVo.setFieldName(field.getFieldName());
+                contractConfigFieldVo.setFieldText(field.getName());
+                fields.add(contractConfigFieldVo);
+            });
+            contractConfigTableVo.setFields(fields);
+            stringContractConfigTableVoMap.put("合同配置模板",contractConfigTableVo);
+
+        }
+
 
         return  ResultData.ok(stringContractConfigTableVoMap);
 

+ 16 - 1
workflow/src/main/java/com/tofly/workflow/baseconf/controller/TfBaseTypePController.java

@@ -10,11 +10,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.tofly.common.core.result.BaseController;
 import com.tofly.common.core.result.ResultData;
 import com.tofly.common.log.annotation.ToFlyAppLog;
+import com.tofly.common.oauth.util.SecurityUtils;
 import com.tofly.workflow.baseconf.entity.TfBaseTypeP;
 import com.tofly.workflow.baseconf.entity.dto.BaseTypeDto;
 import com.tofly.workflow.baseconf.entity.dto.UpdateBaseTypeDto;
 import com.tofly.workflow.baseconf.service.TfBaseTypePService;
 import com.tofly.workflow.common.FlowConstant;
+import com.tofly.workflow.wzyy.entity.YyOrgUnit;
+import com.tofly.workflow.wzyy.service.YyOrgUnitService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -38,7 +41,7 @@ import java.util.List;
 public class TfBaseTypePController extends BaseController {
 
     private final  TfBaseTypePService tfBaseTypePService;
-
+    private final YyOrgUnitService yyOrgUnitService;
     /**
     * 分页查询
     * @param page 分页对象
@@ -49,6 +52,18 @@ public class TfBaseTypePController extends BaseController {
     @GetMapping("/page" )
     @ApiOperation(value = "分页查询")
     public ResultData getBaseTypePage(Page page, @ModelAttribute TfBaseTypeP baseType) {
+        //查询材料类型
+        if("1570692286170427394".equals(baseType.getDataType())) {
+            final Long tenantId = SecurityUtils.getTenantId();
+            final YyOrgUnit one = yyOrgUnitService.getOne(Wrappers.<YyOrgUnit>lambdaQuery()
+                    .eq(YyOrgUnit::getTenantId, tenantId));
+
+
+            return ResultData.ok(tfBaseTypePService.page(page, Wrappers.query(baseType).lambda()
+                    .eq(TfBaseTypeP::getOrgCode,"global00").or().eq(TfBaseTypeP::getOrgCode,one.getOrgCode())
+                    .eq(TfBaseTypeP::getIsDel, FlowConstant.SHORT_ZERO).orderByAsc(TfBaseTypeP::getId)));
+
+        }
         return ResultData.ok(tfBaseTypePService.page(page, Wrappers.query(baseType).lambda()
                 .eq(TfBaseTypeP::getIsDel, FlowConstant.SHORT_ZERO).orderByAsc(TfBaseTypeP::getId)));
     }

+ 9 - 1
workflow/src/main/java/com/tofly/workflow/baseconf/controller/TfContractTemplatePController.java

@@ -11,6 +11,8 @@ import com.tofly.common.constant.Constant;
 import com.tofly.common.core.result.BaseController;
 import com.tofly.common.core.result.ResultData;
 import com.tofly.common.log.annotation.ToFlyAppLog;
+import com.tofly.common.oauth.auth.ToflyUser;
+import com.tofly.common.oauth.util.SecurityUtils;
 import com.tofly.common.utils.POIUtil;
 import com.tofly.workflow.baseconf.entity.TfContractFieldP;
 import com.tofly.workflow.baseconf.entity.TfContractTemplateP;
@@ -48,7 +50,6 @@ public class TfContractTemplatePController extends BaseController {
     private final  TfContractTemplatePService tfContractTemplatePService;
     private final TfTemplateFieldPService templateFieldPService;
     private final TfContractFieldPService tfContractFieldPService;
-
     /**
     * 分页查询
     * @param page 分页对象
@@ -59,6 +60,13 @@ public class TfContractTemplatePController extends BaseController {
     @GetMapping("/page" )
     @ApiOperation(value = "分页查询")
     public ResultData getTfContractTemplatePPage(Page page, @ModelAttribute TfContractTemplateP tfContractTemplateP) {
+        //添加默认租户id
+        final Long tenantId = SecurityUtils.getTenantId();
+
+        if(tenantId!=1){
+            tfContractTemplateP.setTenantId(tenantId);
+        }
+
         Page<TfContractTemplateP> contractTemplatePPage = tfContractTemplatePService.page(page, Wrappers.query(tfContractTemplateP));
         for(TfContractTemplateP contractTemplateP : contractTemplatePPage.getRecords()){
             List<TfTemplateFieldP> templateFieldList = templateFieldPService.list(new QueryWrapper<TfTemplateFieldP>()

+ 2 - 0
workflow/src/main/java/com/tofly/workflow/baseconf/entity/ContractConfig.java

@@ -79,6 +79,7 @@ public class ContractConfig extends Model<ContractConfig> {
             @TableField(value = "CREATE_USER",fill = FieldFill.INSERT)
             private Long createUser;
             @ApiModelProperty(hidden = true)
+            @TableField(exist = false)
     private String createUserName;
             /**
      * 创建时间
@@ -95,6 +96,7 @@ public class ContractConfig extends Model<ContractConfig> {
             @TableField(value = "UPDATE_USER",fill = FieldFill.INSERT_UPDATE)
             private Long updateUser;
             @ApiModelProperty(hidden = true)
+            @TableField(exist = false)
     private String updateUserName;
             /**
      * 修改时间

+ 5 - 0
workflow/src/main/java/com/tofly/workflow/baseconf/entity/TfBaseTypeP.java

@@ -146,4 +146,9 @@ public class TfBaseTypeP extends Model<TfBaseTypeP> {
     @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE)
     private Date updateTime;
 
+
+    /**
+     * 区域公司编码  global00  为通用
+     */
+    private String orgCode;
 }

+ 1 - 1
workflow/src/main/java/com/tofly/workflow/baseconf/entity/TfMatterNumberP.java

@@ -85,7 +85,7 @@ public class TfMatterNumberP extends Model<TfMatterNumberP> {
     @TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
     private Long createUser;
     @ApiModelProperty(hidden = true)
-    @TableField(exist = false)
+    @TableField(exist = false)
     private String createUserName;
     /**
      * 创建时间

+ 5 - 1
workflow/src/main/java/com/tofly/workflow/baseconf/entity/dto/QueryConfigDto.java

@@ -20,11 +20,15 @@ public class QueryConfigDto {
     private Long processId;
 
     @ApiModelProperty(value = "合同模板id ")
-    @NotNull(message = "templateFieldId 不能为空")
     private Long templateFieldId;
 
     @ApiModelProperty(value = "tenantId ")
     @NotNull(message = "tenantId 不能为空")
     private Long tenantId;
+    @ApiModelProperty(value = "当前字段 ")
+    private String sourceField;
+
+    @ApiModelProperty(value = "当前字段值 ")
+    private String sourceValue;
 
 }

+ 17 - 0
workflow/src/main/java/com/tofly/workflow/baseconf/entity/vo/SingleDataVo.java

@@ -0,0 +1,17 @@
+package com.tofly.workflow.baseconf.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SingleDataVo {
+    @ApiModelProperty(value = "目标字段id")
+    private Long targetFieldId;
+    @ApiModelProperty(value = "目标字段")
+    private String targetField;
+    @ApiModelProperty(value = "目标字段值")
+    private  String targetValue;
+    @ApiModelProperty(value = "是否有值")
+    private Boolean hasValue;
+
+}

+ 12 - 0
workflow/src/main/java/com/tofly/workflow/baseconf/service/ContractConfigService.java

@@ -6,6 +6,8 @@ package com.tofly.workflow.baseconf.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.tofly.workflow.baseconf.entity.ContractConfig;
+import com.tofly.workflow.baseconf.entity.dto.QueryConfigDto;
+import com.tofly.workflow.baseconf.entity.vo.SingleDataVo;
 import com.tofly.workflow.buss.entity.TfProjectBaseW;
 import com.tofly.workflow.buss.entity.vo.ContractConfigFieldVo;
 
@@ -24,4 +26,14 @@ public interface ContractConfigService extends IService<ContractConfig> {
      */
     public List<ContractConfigFieldVo> paraReplace(Long processId,ContractConfig contractConfig, TfProjectBaseW tfProjectBaseW );
 
+    /**
+     * 和同配置复制功能
+     * @param sourceConfigId
+     * @param targetConfigIds
+     */
+    public void copyConfig(Long sourceConfigId,String targetConfigIds );
+
+
+    public List<SingleDataVo> singleData(QueryConfigDto queryConfigDto);
+
 }

+ 268 - 44
workflow/src/main/java/com/tofly/workflow/baseconf/service/impl/ContractConfigServiceImpl.java

@@ -6,17 +6,21 @@ package com.tofly.workflow.baseconf.service.impl;
 
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.tofly.common.oauth.exception.ToflyDeniedException;
 import com.tofly.workflow.baseconf.entity.ContractConfig;
 import com.tofly.workflow.baseconf.entity.ContractConfigField;
 import com.tofly.workflow.baseconf.entity.TfContractFieldP;
+import com.tofly.workflow.baseconf.entity.TfContractTemplateP;
+import com.tofly.workflow.baseconf.entity.dto.QueryConfigDto;
+import com.tofly.workflow.baseconf.entity.vo.SingleDataVo;
 import com.tofly.workflow.baseconf.menum.ContractConfigTypeEnum;
 import com.tofly.workflow.baseconf.service.ContractConfigFieldService;
 import com.tofly.workflow.baseconf.service.ContractConfigService;
 import com.tofly.workflow.baseconf.service.TfContractFieldPService;
+import com.tofly.workflow.baseconf.service.TfContractTemplatePService;
 import com.tofly.workflow.buss.entity.TfProjectBaseW;
 import com.tofly.workflow.buss.entity.vo.ContractConfigFieldVo;
 import com.tofly.workflow.buss.entity.vo.ContractConfigTableVo;
@@ -27,15 +31,13 @@ import com.tofly.workflow.utils.compute.StrParaReplace;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import com.tofly.workflow.baseconf.mapper.ContractConfigMapper;
 
 import java.lang.reflect.Field;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 合同计算配置信息
@@ -51,27 +53,155 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
     private  final ContractConfigFieldService contractConfigFieldService;
 
     private final TfContractFieldPService tfContractFieldPService;
+    private final TfContractTemplatePService tfContractTemplatePService;
 
     @Override
     public List<ContractConfigFieldVo>  paraReplace(Long processId,ContractConfig contractConfig, TfProjectBaseW tfProjectBaseW ) {
         List<ContractConfigFieldVo> list = new ArrayList<>();
         final Map<String, ContractConfigFieldVo> stringObjectMap = obtainParaAndValue(contractConfig, processId, tfProjectBaseW);
-        for (ContractConfigFieldVo value : stringObjectMap.values()) {
-            list.add(value);
+        //整理数据格式
+        if(stringObjectMap!=null){
+            for (ContractConfigFieldVo value : stringObjectMap.values()) {
+                list.add(value);
+            }
+            return list;
+        }else {
+            return Collections.emptyList();
+        }
+
+    }
+
+    @Override
+    public void copyConfig(Long sourceConfigId, String targetTempletIds) {
+        final String[] templeteIds = targetTempletIds.split(",");
+        final ContractConfig contractConfig = this.getById(sourceConfigId);
+        final List<ContractConfigField> list = contractConfigFieldService.list(Wrappers.
+                <ContractConfigField>lambdaQuery()
+                .eq(ContractConfigField::getContractConfigId, contractConfig.getId()));
+
+        //复制 ContractConfig
+
+        for (String templeteId : templeteIds) {
+
+            ContractConfig contractConfigCopy = new ContractConfig();
+
+            BeanUtils.copyProperties(contractConfig,contractConfigCopy);
+            final TfContractTemplateP byId = tfContractTemplatePService.getById(templeteId);
+            contractConfigCopy.setId(null);
+            contractConfigCopy.setContractType(byId.getContractType());
+            contractConfigCopy.setTemplateFieldId(Long.valueOf(templeteId));
+            this.saveOrUpdate(contractConfigCopy);
+            //保存模板配置的参数
+            for (ContractConfigField contractConfigField : list) {
+                contractConfigField.setContractConfigId(contractConfigCopy.getId());
+                contractConfigField.setId(null);
+                contractConfigFieldService.saveOrUpdate(contractConfigField);
+            }
         }
-        return list;
+
+
+
     }
 
+    @Override
+    public  List<SingleDataVo> singleData(QueryConfigDto queryConfigDto) {
+        List<SingleDataVo> list = new ArrayList<>();
+
+        if(StringUtils.isBlank(queryConfigDto.getSourceValue())){
+
+            return  Collections.emptyList();
+        }
+        ContractConfig contractConfig = new ContractConfig();
+        contractConfig.setTenantId(queryConfigDto.getTenantId());
+        contractConfig.setTemplateFieldId(queryConfigDto.getTemplateFieldId());
+        ContractConfig contractConfig1 = this.getOne(Wrappers.query(contractConfig));
+        if(contractConfig1==null){
+            log.info("该合同未配置对应的模板");
+            return  Collections.emptyList();
+        }
+        //获取该配置的所有字段数据
+        final List<ContractConfigField> datas = contractConfigFieldService.list(Wrappers.
+                <ContractConfigField>lambdaQuery()
+                .eq(ContractConfigField::getContractConfigId, contractConfig1.getId())
+                .eq(ContractConfigField::getSourceFieldName, queryConfigDto.getSourceField()));
+
+        if(datas!=null  && datas.size()>0){
+            for (ContractConfigField data : datas) {
+                SingleDataVo singleDataVo = new SingleDataVo();
+                //默认无值
+                singleDataVo.setHasValue(Boolean.TRUE);
+                final TfContractFieldP targetField = tfContractFieldPService.getById(data.getTargetFieldId());
+                    if(targetField==null){
+                        continue;
+                    }
+                    //获取该字段的目标字段值
+                    final Short type = data.getType();
+                    String    targetValue=null;
+                    if(type== ContractConfigTypeEnum.one.getCode()){
+
+
+                        //定值默认值  一般不会用到
+                    }else  if(type== ContractConfigTypeEnum.two.getCode()){
+                        //获取固定字段
+                        targetValue = queryConfigDto.getSourceValue();
+                    }else   if(type== ContractConfigTypeEnum.three.getCode()){
+                        singleDataVo.setHasValue(Boolean.TRUE);
+                        targetValue= MoneyToChineseUtils.convert(Double.valueOf(queryConfigDto.getSourceValue()));
+
+                    }else if(type== ContractConfigTypeEnum.four.getCode()){
+                        //自定义公式计算
+
+                    }
+                singleDataVo.setTargetFieldId(data.getTargetFieldId());
+                singleDataVo.setTargetField(targetField.getFieldName());
+                singleDataVo.setTargetValue(targetValue);
+                list.add(singleDataVo);
+                }
+            }
+
+    return  list;
+    }
+
+    /**
+     * 通过前端传入的填写数据  以及配置 生成  参数列表
+     * @param contractConfig
+     * @param processId
+     * @param tfProjectBaseW   由前端页传入的 一些基础数据
+     * @return
+     */
     private Map<String,ContractConfigFieldVo> obtainParaAndValue(ContractConfig contractConfig,Long processId,TfProjectBaseW tfProjectBaseW ){
 
      ContractConfig contractConfig1 = this.getOne(Wrappers.query(contractConfig));
+     if(contractConfig1==null){
 
+         log.info("该合同未配置对应的模板");
+         return  null;
+     }
+     //获取该配置的所有字段数据
         final List<ContractConfigField> list = contractConfigFieldService.list(Wrappers.
                 <ContractConfigField>lambdaQuery()
                 .eq(ContractConfigField::getContractConfigId, contractConfig1.getId()));
-        //获取
 
-     return   resolverConfig(list,processId,tfProjectBaseW);
+
+        //返回的结果数据
+         Map<String, ContractConfigFieldVo> dataMap= new HashMap<>();
+
+
+        Map<String,Object> configFieldMap=new HashMap<>();
+        //标识数据是否有变更
+
+        Boolean hasChanged = null;
+        while (hasChanged==null||hasChanged){
+            if(hasChanged==null){
+                hasChanged=Boolean.FALSE;
+            }
+            //循环调用
+            hasChanged =   resolverConfig(dataMap,list, processId, tfProjectBaseW, hasChanged,configFieldMap);
+            log.info("获取到的hasChanged值为{}",hasChanged);
+        }
+        log.info("configFieldMap:"+JSON.toJSONString(configFieldMap));
+        //获取配置填充数据
+     return   dataMap;
     }
 
     /**
@@ -79,26 +209,47 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
      * @param list
      */
 
-    private  Map<String,ContractConfigFieldVo>  resolverConfig(List<ContractConfigField> list,Long processId,TfProjectBaseW tfProjectBaseW ) {
-
-        Map<String,Object> configFieldMap = new HashMap<>();
+    private Boolean resolverConfig(Map<String, ContractConfigFieldVo> targetMap,
+            List<ContractConfigField> list,Long processId,TfProjectBaseW tfProjectBaseW,Boolean hasChanged , Map<String,Object> configFieldMap) {
         //将tfProjectBaseW 中的属性放入 map  后续可以用使用
         try {
-            putParaIn(configFieldMap,tfProjectBaseW);
+            //只有第一次需要将前端传入的参数处理
+            if(!hasChanged){
+                putParaIn(configFieldMap,tfProjectBaseW);
+
+            }
+            hasChanged = Boolean.FALSE;
         } catch (IllegalAccessException e) {
             e.printStackTrace();
         }
-        Map<String,ContractConfigFieldVo> targetMap = new HashMap<>();
+        if(targetMap==null){
+            targetMap = new HashMap<>();
+        }
+
 
         List<ContractConfigField> needCal = new ArrayList<>();
         for (ContractConfigField contractConfigField : list) {
+
             final Short type = contractConfigField.getType();
             //获取目标字段
             final Long targetFieldId = contractConfigField.getTargetFieldId();
             final TfContractFieldP targetField = tfContractFieldPService.getById(targetFieldId);
+            //如果该字段已经处理过 则跳过
+            if(targetMap.containsKey(targetField.getFieldName())){
+                final ContractConfigFieldVo contractConfigFieldVo
+                        = targetMap.get(targetField.getFieldName());
+                if(contractConfigFieldVo!=null&&contractConfigFieldVo.getFieldValue() !=null){
+
 
+                    log.info("跳过处理"+contractConfigFieldVo.getFieldName());
+                    continue;
+                }
 
+            }else{
+                log.info("当前处理参数"+targetField.getFieldName());
+            }
 
+            //
             final String sourceFieldName = contractConfigField.getSourceFieldName();
             final String sourceTable = contractConfigField.getSourceTable();
             ContractConfigFieldVo contractConfigFieldVo = new ContractConfigFieldVo();
@@ -112,6 +263,8 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
             //获取固定字段
             }else if(type==ContractConfigTypeEnum.two.getCode()){
                 if(( targetValue=configFieldMap.get(sourceFieldName))!=null){
+
+
                 }else{
 
                     if(StringUtils.isEmpty(sourceTable)||StringUtils.isEmpty(sourceFieldName)){
@@ -120,45 +273,77 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
                     }
 
                     final ConditionSqlVo conditionSqlVo = generateConditionSql(sourceTable);
+                    if(!"合同配置模板".equals(sourceTable)){
+                        targetValue
+                                = baseMapper.getValueByTableNameAndProcessId(sourceTable, StrUtil.toUnderlineCase(sourceFieldName), processId,conditionSqlVo.getJoinSql(),conditionSqlVo.getWhereSql());
+                    }else{
+                        log.info("合同配置获取字段");
+                    }
+              }
+                //大写转换
+            }else if(type==ContractConfigTypeEnum.three.getCode()){
 
-                    targetValue
-                            = baseMapper.getValueByTableNameAndProcessId(sourceTable, StrUtil.toUnderlineCase(sourceFieldName), processId,conditionSqlVo.getJoinSql(),conditionSqlVo.getWhereSql());
 
 
-                }
-                //大写转换
-            }else if(type==ContractConfigTypeEnum.three.getCode()){
                 if(StringUtils.isEmpty(sourceTable)||StringUtils.isEmpty(sourceFieldName)){
                     log.info("该大小写转换数据未配置源字段sourceTable或者sourceFieldName:"+ JSON.toJSONString(contractConfigField));
                     throw new RuntimeException("该大小写转换数据未配置源字段sourceTable或者sourceFieldName:"+ JSON.toJSONString(contractConfigField));
                 }
-                final ConditionSqlVo conditionSqlVo = generateConditionSql(sourceTable);
-                targetValue    = baseMapper.getValueByTableNameAndProcessId(sourceTable, StrUtil.toUnderlineCase(sourceFieldName), processId,conditionSqlVo.getJoinSql(),conditionSqlVo.getWhereSql());
-                if(StringUtils.isNotBlank((String)targetValue)){
-                    targetValue  = MoneyToChineseUtils.convert(Double.valueOf((String)targetValue ));
-                }else {
-                    targetValue= MoneyToChineseUtils.convert(0d);
-                }
+                //入宫
+                    if(( targetValue=configFieldMap.get(sourceFieldName))!=null){
+
+                        log.info("通过{}获取到的大写转换的源数据为{}",sourceFieldName,targetValue);
+                        Double aDouble=null;
+                        if(targetValue instanceof  String){
+                             aDouble = Double.valueOf((String)targetValue);
+                        }else if(targetValue instanceof  Double){
+                            aDouble = (Double) targetValue;
+                        }
+                        if(aDouble!=null){
+                            targetValue= MoneyToChineseUtils.convert(aDouble);
+                        }
+                    }else{
+                        if(!"合同配置模板".equals(sourceTable)){
+                            final ConditionSqlVo conditionSqlVo = generateConditionSql(sourceTable);
+                            targetValue    = baseMapper.getValueByTableNameAndProcessId(sourceTable, StrUtil.toUnderlineCase(sourceFieldName), processId,conditionSqlVo.getJoinSql(),conditionSqlVo.getWhereSql());
+                            if(StringUtils.isNotBlank((String)targetValue)){
+                                targetValue  = MoneyToChineseUtils.convert(Double.valueOf((String)targetValue ));
+                            }else {
+                                targetValue= MoneyToChineseUtils.convert(0d);
+                            }
+                        }else{
+                            log.info("未获取到大写需要的源数据{}",contractConfigFieldVo.getFieldName());
+
+                        }
+
+
+                    }
 
                 //计算
             }
+
+
             if(type == ContractConfigTypeEnum.four.getCode()){
                 needCal.add(contractConfigField);
             }else{
-                configFieldMap.put(targetField.getFieldName(),targetValue);
-                contractConfigFieldVo.setFieldValue(targetValue);
-                targetMap.put(targetField.getFieldName(),contractConfigFieldVo);
+                if(targetValue==null){
+                    continue;
+                }
+                    configFieldMap.put(targetField.getFieldName(),targetValue);
+                    contractConfigFieldVo.setFieldValue(targetValue);
+                    targetMap.put(targetField.getFieldName(),contractConfigFieldVo);
+                    //设置标记字段为true
+                    hasChanged = Boolean.TRUE;
+
             }
 
 
         }
         //公式计算 在上述赋值流程完成后  进行
 
-        fillValueByMath(configFieldMap,targetMap,needCal,processId);
-
-
-    return  targetMap;
-
+        hasChanged =  fillValueByMath(configFieldMap,targetMap,needCal,processId,hasChanged);
+        log.info("计算后的hasChanged值为{}",hasChanged);
+            return  hasChanged;
     }
 
     private ConditionSqlVo generateConditionSql(String sourceTable) {
@@ -182,6 +367,12 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
         return  conditionSqlVo;
     }
 
+    /**
+     * 将前端传入的参数  放入
+     * @param configFieldMap
+     * @param tfProjectBaseW
+     * @throws IllegalAccessException
+     */
     private void putParaIn(Map<String, Object> configFieldMap, TfProjectBaseW tfProjectBaseW) throws IllegalAccessException {
 
         final Field[] declaredFields = tfProjectBaseW.getClass().getDeclaredFields();
@@ -200,11 +391,17 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
     }
 
     //填充需要计算的数据
-    public  void  fillValueByMath(Map<String, Object> configFieldMap,Map<String,ContractConfigFieldVo> targetMap ,
-            List<ContractConfigField> needCal,Long processId) {
+    public  Boolean  fillValueByMath(Map<String, Object> configFieldMap,Map<String,ContractConfigFieldVo> targetMap ,
+            List<ContractConfigField> needCal,Long processId,Boolean hasChanged ) {
+
         for (ContractConfigField contractConfigField : needCal) {
+
             final Long targetFieldId = contractConfigField.getTargetFieldId();
             final TfContractFieldP targetField = tfContractFieldPService.getById(targetFieldId);
+            if(targetMap.get(targetField.getFieldName())!=null){
+                continue;
+            }
+
             ContractConfigFieldVo contractConfigFieldVo = new ContractConfigFieldVo();
             contractConfigFieldVo.setFieldName(targetField.getFieldName());
             contractConfigFieldVo.setFieldType(targetField.getFieldType());
@@ -215,15 +412,25 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
             //参数来源
 
             String formulaFilledPara =  fillValue(formula,configFieldMap,paraByCalStr,processId);
+
+            if(formulaFilledPara==null){
+                continue;
+            }
+
             //计算值
             String outSum = new EvaluateExpression(formulaFilledPara)
                     .doEvaluateExpression()
                     .getOutSum();
-            contractConfigFieldVo.setFieldValue(outSum);
-            configFieldMap.put(targetField.getFieldName(),outSum);
-            targetMap.put(targetField.getFieldName(),contractConfigFieldVo);
-        }
+            if(outSum!=null){
+                contractConfigFieldVo.setFieldValue(outSum);
+                configFieldMap.put(targetField.getFieldName(),outSum);
+                targetMap.put(targetField.getFieldName(),contractConfigFieldVo);
+                hasChanged = true;
+            }
 
+
+        }
+        return  hasChanged;
     }
 
     /**
@@ -236,21 +443,38 @@ public class ContractConfigServiceImpl extends ServiceImpl<ContractConfigMapper,
     public  String fillValue(String formula, Map<String, Object> configFieldMap, List<String> paraByCalStr,Long processId) {
 
         for (String para : paraByCalStr) {
+                    try {
+                        Double.parseDouble(para);
+                        continue;
+                    }catch (Exception e){
+
+                    }
+
 
             if(configFieldMap.containsKey(para)){
-                formula =  formula.replaceAll(para, String.valueOf(configFieldMap.get(para)));
 
+                formula =  formula.replace(para, String.valueOf(configFieldMap.get(para)));
                 log.debug("填充参数{},设置值为{}",configFieldMap.get(para));
             }else{
                 //没找到值 直接从数据库查询
                 //暂时未处理
                 final String tableByField = ScanFieldUtil.getTableByField(para);
-
+                if(StringUtils.isBlank(tableByField)){
+                    log.info("未找到字段"+para+"对应的表");
+                    return  null;
+                }
+                String joinSql = "";
+                String conditionSql = "";
+                if(ScanFieldUtil.existFieldByTableName(tableByField,"nodeId")){
+                    joinSql = " left join tf_process_node_l n on a.node_id = n.id ";
+                    conditionSql =  "and n.IS_VALID=1 ";
+                }
                 Object value
-                        = baseMapper.getValueByTableNameAndProcessId(tableByField, StrUtil.toUnderlineCase(para), processId,null,null);
+                        = baseMapper.getValueByTableNameAndProcessId(tableByField, StrUtil.toUnderlineCase(para), processId,joinSql,conditionSql);
                 if(value!=null){
                     formula =  formula.replaceAll(para, String.valueOf(value));
                 }else{
+                    formula =  formula.replaceAll(para, String.valueOf("0"));
                     log.error("未能找到参数:{}的值",para);
                 }
             }

+ 1 - 1
workflow/src/main/java/com/tofly/workflow/processconfig/entity/TfProcessConfigStepL.java

@@ -21,7 +21,7 @@ import java.util.Date;
  * 流程配置步骤
  *
  * @author JF
- * @date Wed Aug 03 00:00:00 CST 2022
+ * @date Wed Aug 03 00:00:00 CST 2022-
  */
 @Data
 @EqualsAndHashCode(callSuper = true)

+ 80 - 6
workflow/src/main/java/com/tofly/workflow/report/ReportController.java

@@ -43,7 +43,7 @@ private final ReportService reportService;
     //        ExcelUtils.getListToExcel(TfSafetyMonitorW.class,pageData.getRecords(),"TfSafetyMonitorW安全监护 (单独填报)");
 
     @GetMapping("/signAndApplyExport" )
-    @ApiOperation(value = "等级申请导出")
+    @ApiOperation(value = "登记申请导出")
     public void getTfNowHandleLPageExport(@ModelAttribute ReportDto reportDto) {
         Page page =new Page();
         page.setSize(999999l);
@@ -55,11 +55,48 @@ private final ReportService reportService;
     @GetMapping("/dispatchCount" )
     @ApiOperation(value = "工程分派台账")
     public ResultData getDispatchCount(Page page, @ModelAttribute ReportDto reportDto) {
-
-
-
-
-        return ResultData.ok(reportService.getDispatchCount(page,reportDto));
+        final Page<ProjectDispatchVo> dispatchCount = reportService.getDispatchCount(page, reportDto);
+        final List<ProjectDispatchVo> records = dispatchCount.getRecords();
+
+        ProjectDispatchVo projectDispatchVo = new ProjectDispatchVo();
+        projectDispatchVo.setDutyUser("合计");
+        double syslTotal=0;
+        double gyslTotal =0;
+        double  gfslTotal=0;
+        double jzxqslTotal=0;
+        double myslTotal=0;
+        double fjxqslTotal=0;
+        double jzxqHsTotal=0;
+        double myHsTotal=0;
+        double projectNumberTotal=0;
+        double householdTotal =0;
+        for (ProjectDispatchVo record : records) {
+            syslTotal+=record.getSysl();
+            gyslTotal+=record.getGysl();
+            gfslTotal+=record.getGfsl();
+            jzxqslTotal+=record.getJzxqsl();
+            myslTotal +=record.getMysl();
+            fjxqslTotal +=record.getFjxqsl();
+            jzxqHsTotal +=record.getJzxqHs();
+            myHsTotal +=record.getMyHs();
+            projectNumberTotal +=record.getProjectNumber();
+            householdTotal +=record.getHouseholdTotal();
+        }
+        projectDispatchVo.setSysl(syslTotal);
+       projectDispatchVo.setGysl(gyslTotal);
+        projectDispatchVo.setGfsl(gfslTotal);
+        projectDispatchVo.setJzxqsl(jzxqslTotal);
+        projectDispatchVo.setMysl(myslTotal);
+        projectDispatchVo.setFjxqsl(fjxqslTotal);
+        projectDispatchVo.setJzxqHs(jzxqHsTotal);
+        projectDispatchVo.setMyHs(myHsTotal);
+        projectDispatchVo.setProjectNumber(projectNumberTotal);
+        projectDispatchVo.setHouseholdTotal(householdTotal);
+        records.add(projectDispatchVo);
+
+
+        dispatchCount.setRecords(records);
+        return ResultData.ok(dispatchCount);
     }
 
 
@@ -70,6 +107,43 @@ private final ReportService reportService;
 
         page.setSize(999999l);
         final Page<ProjectDispatchVo> data = reportService.getDispatchCount(page, reportDto);
+        final List<ProjectDispatchVo> records = data.getRecords();
+
+        ProjectDispatchVo projectDispatchVo = new ProjectDispatchVo();
+        projectDispatchVo.setDutyUser("合计");
+        double syslTotal=0;
+        double gyslTotal =0;
+        double  gfslTotal=0;
+        double jzxqslTotal=0;
+        double myslTotal=0;
+        double fjxqslTotal=0;
+        double jzxqHsTotal=0;
+        double myHsTotal=0;
+        double projectNumberTotal=0;
+        double householdTotal =0;
+        for (ProjectDispatchVo record : records) {
+            syslTotal+=record.getSysl();
+            gyslTotal+=record.getGysl();
+            gfslTotal+=record.getGfsl();
+            jzxqslTotal+=record.getJzxqsl();
+            myslTotal +=record.getMysl();
+            fjxqslTotal +=record.getFjxqsl();
+            jzxqHsTotal +=record.getJzxqHs();
+            myHsTotal +=record.getMyHs();
+            projectNumberTotal +=record.getProjectNumber();
+            householdTotal +=record.getHouseholdTotal();
+        }
+        projectDispatchVo.setSysl(syslTotal);
+        projectDispatchVo.setGysl(gyslTotal);
+        projectDispatchVo.setGfsl(gfslTotal);
+        projectDispatchVo.setJzxqsl(jzxqslTotal);
+        projectDispatchVo.setMysl(myslTotal);
+        projectDispatchVo.setFjxqsl(fjxqslTotal);
+        projectDispatchVo.setJzxqHs(jzxqHsTotal);
+        projectDispatchVo.setMyHs(myHsTotal);
+        projectDispatchVo.setProjectNumber(projectNumberTotal);
+        projectDispatchVo.setHouseholdTotal(householdTotal);
+        records.add(projectDispatchVo);
 
         ExcelUtils.getListToExcel(ProjectDispatchVo.class,data.getRecords(),"工程分派台账");
 

+ 10 - 10
workflow/src/main/java/com/tofly/workflow/report/vo/ProjectDispatchVo.java

@@ -16,33 +16,33 @@ public class ProjectDispatchVo {
     private String dutyUser;
     @ApiModelProperty(value = "商业")
     @Excel(name = "商业", column = "C")
-    private String sysl;
+    private Double sysl;
     @ApiModelProperty(value = "工业")
     @Excel(name = "工业", column = "D")
-    private String gysl;
+    private Double gysl;
     @ApiModelProperty(value = "公服")
     @Excel(name = "公服", column = "E")
-    private String gfsl;
+    private Double gfsl;
     @ApiModelProperty(value = "集中小区")
     @Excel(name = "集中小区", column = "F")
-    private String jzxqsl;
+    private Double jzxqsl;
     @ApiModelProperty(value = "民用")
     @Excel(name = "民用", column = "G")
-    private String mysl;
+    private Double mysl;
     @ApiModelProperty(value = "非居用户小计")
     @Excel(name = "非居用户小计", column = "H")
-    private String fjxqsl;
+    private Double fjxqsl;
     @ApiModelProperty(value = "集中小区户数")
     @Excel(name = "集中小区户数", column = "I")
-    private String jzxqHs;
+    private Double jzxqHs;
     @ApiModelProperty(value = "居民用户小计")
     @Excel(name = "居民用户小计", column = "J")
-    private String myHs;
+    private Double myHs;
     @ApiModelProperty(value = "项目总数")
     @Excel(name = "项目总数", column = "K")
-    private String projectNumber;
+    private Double projectNumber;
     @ApiModelProperty(value = "总户数")
     @Excel(name = "总户数", column = "L")
-    private String householdTotal;
+    private Double householdTotal;
 
 }

+ 68 - 0
workflow/src/main/java/com/tofly/workflow/utils/ExcelUtil.java

@@ -0,0 +1,68 @@
+package com.tofly.workflow.utils;
+
+import org.apache.poi.hssf.usermodel.*;
+
+public class ExcelUtil {
+
+    /**
+     * 导出Excel
+     * @param sheetName sheet名称
+     * @param title 标题
+     * @param values 内容
+     * @param wb HSSFWorkbook对象
+     * @return
+     */
+    public static HSSFWorkbook getHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){
+
+        // 第一步,创建一个HSSFWorkbook,对应一个Excel文件
+        if(wb == null){
+            wb = new HSSFWorkbook();
+        }
+
+        // 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet
+        HSSFSheet sheet = wb.createSheet(sheetName);
+
+        // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
+        HSSFRow row = sheet.createRow(0);
+
+        // 第四步,创建单元格,并设置值表头 设置表头居中
+        HSSFCellStyle style = wb.createCellStyle();
+        //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+        // 设置字体
+        HSSFFont font = wb.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short) 13);// 字体大小
+        // 设置单元格格式
+        HSSFDataFormat format = wb.createDataFormat();
+        style.setDataFormat(format.getFormat("@"));
+        style.setFont(font);
+        style.setWrapText(true);// 自动换行
+
+        //声明列对象
+        HSSFCell cell = null;
+
+        //创建标题
+        for(int i=0;i<title.length;i++){
+            cell = row.createCell(i);
+            cell.setCellValue(title[i]);
+            cell.setCellStyle(style);
+        }
+
+        //创建内容
+        for(int i=0;i<values.length;i++){
+            row = sheet.createRow(i + 1);
+            for(int j=0;j<values[i].length;j++){
+                //将内容按顺序赋给对应的列对象
+                HSSFCell cellBody = row.createCell(j);
+                cellBody.setCellValue(values[i][j]);
+                cellBody.setCellStyle(style);
+            }
+        }
+
+        //自动调整列宽
+        for(int i=0;i<title.length;i++){
+            sheet.autoSizeColumn((short)i); //调整第一列宽度
+        }
+        return wb;
+    }
+}

+ 1 - 1
workflow/src/main/java/com/tofly/workflow/utils/compute/MoneyToChineseUtils.java

@@ -70,7 +70,7 @@ public class MoneyToChineseUtils {
         char jiao = fraction.charAt(0);
         // 分
         char fen = fraction.charAt(1);
-        return (RMB_NUMS[jiao - '0'] + (jiao > '0' ? UNITS[1] : "")) + (fen > '0' ? RMB_NUMS[fen - '0'] + UNITS[2] : "");
+        return (RMB_NUMS[jiao - '0'] + (jiao > '0' ? UNITS[1] : "")) + (fen > '0' ? RMB_NUMS[fen - '0'] + UNITS[2] : UNITS[3]);
     }
  
     /**

+ 3 - 1
workflow/src/main/java/com/tofly/workflow/utils/compute/ScanFieldUtil.java

@@ -258,7 +258,9 @@ static final Map<String,String> fieldToTable = new HashMap<>();
             scanTableAndField(null);
         }
         final ContractConfigTableVo contractConfigTableVo = map.get(tableName);
-
+        if(contractConfigTableVo==null){
+            return  Boolean.FALSE;
+        }
         final List<ContractConfigFieldVo> fields = contractConfigTableVo.getFields();
 
         for (ContractConfigFieldVo field : fields) {

+ 8 - 0
workflow/src/main/java/com/tofly/workflow/wzyy/controller/MaterialBaseController.java

@@ -92,4 +92,12 @@ public class MaterialBaseController {
         return ResultData.ok("");
     }
 
+
+    @GetMapping("/testTypeOrg")
+    @ApiOperation(value = "测试材料绑定公司")
+    public  ResultData pullWzTypeOverOrg(){
+
+        materialBaseService.pullWzTypeOverOrg(0);
+        return ResultData.ok("");
+    }
 }

+ 17 - 0
workflow/src/main/java/com/tofly/workflow/wzyy/entity/dto/WzTypeOverOrg.java

@@ -0,0 +1,17 @@
+package com.tofly.workflow.wzyy.entity.dto;
+
+import lombok.Data;
+
+@Data
+public class WzTypeOverOrg {
+    /**
+     * 区域公司编码
+     */
+    private  String  orgCode;
+    /**
+     * 材料类型编码
+     */
+    private String code;
+
+
+}

+ 14 - 0
workflow/src/main/java/com/tofly/workflow/wzyy/entity/dto/WzTypeOverOrgDto.java

@@ -0,0 +1,14 @@
+package com.tofly.workflow.wzyy.entity.dto;
+
+import com.tofly.workflow.wzyy.entity.RespDto;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class WzTypeOverOrgDto  extends RespDto {
+
+    List<WzTypeOverOrg> data;
+
+
+}

+ 2 - 0
workflow/src/main/java/com/tofly/workflow/wzyy/service/MaterialBaseService.java

@@ -46,4 +46,6 @@ public interface MaterialBaseService {
 
     public void getYyMatterTenant(String accessToken,  List<TfMatterP> tms);
 
+    Object pullWzTypeOverOrg(int i);
+
 }

+ 42 - 3
workflow/src/main/java/com/tofly/workflow/wzyy/service/impl/MaterialBaseServiceImpl.java

@@ -62,7 +62,8 @@ public class MaterialBaseServiceImpl implements MaterialBaseService {
 
     @Value("${zmrq.flow.wzyy.api.wztypeapi}")
     private String wztypeapi;
-
+    @Value("${zmrq.flow.wzyy.api.wztypeorgapi}")
+    private String wztypeorgapi;
     @Value("${zmrq.flow.wzyy.api.orgapi}")
     private String orgapi;
 
@@ -367,6 +368,7 @@ public class MaterialBaseServiceImpl implements MaterialBaseService {
         if (accessToken == null || "".equals(accessToken)) {
             return "获取accessToken失败,请稍后在试";
         }
+
         Map<String,Object> paramMap = new HashMap<>();
         String url = openApiUrl+wztypeapi+"?access_token="+accessToken;
         String parentJson = HttpClientUtil.doPost(url,paramMap);
@@ -384,6 +386,43 @@ public class MaterialBaseServiceImpl implements MaterialBaseService {
         }
         return true;
     }
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public Object  pullWzTypeOverOrg(int i){
+        String accessToken = accessTokenService.getAccessToken();
+        if (accessToken == null || "".equals(accessToken)) {
+            return "获取accessToken失败,请稍后在试";
+        }
+
+        Map<String,Object> paramMap = new HashMap<>();
+        paramMap.put("pageIndex",1);
+        paramMap.put("pageSize",999);
+        String url = openApiUrl+wztypeorgapi+"?access_token="+accessToken;
+        String parentJson = HttpClientUtil.doPost(url,paramMap);
+        log.info("物资类型信息查询结果:{}",parentJson);
+        WzTypeOverOrgDto dto = JSON.parseObject(parentJson, WzTypeOverOrgDto.class);
+        if("200".equals(dto.getCode())){
+            if(CollUtil.isNotEmpty(dto.getData())){
+                 List<WzTypeOverOrg> data = dto.getData();
+                 //TODO 更新物资类型里面的org
+                for (WzTypeOverOrg datum : data) {
+                    final TfBaseTypeP one =
+                            bTypeService.getOne(Wrappers.<TfBaseTypeP>lambdaQuery().eq(TfBaseTypeP::getTypeCode, datum.getCode()));
+                    if(one !=null){
+                        one.setOrgCode(datum.getOrgCode());
+                        //更新物资类型的区域编码
+                        bTypeService.updateById(one);
+                    }
+
+
+                }
+            }
+        }else if(FlowConstant.TOKEN_ERROR.equals(dto.getCode())&&i<2){
+            accessTokenService.delToken();
+            pullWzTypeOverOrg(i++);
+        }
+        return true;
+    }
 
     /**
      * 拉取用友物料档案信息
@@ -423,9 +462,9 @@ public class MaterialBaseServiceImpl implements MaterialBaseService {
                     .select(YyOrgUnit::getOrgId), r -> Long.valueOf(String.valueOf(r)));
             paramMap.put("org",orgId);
         }
-        if(dto.getWarehouse()!=null){
+      /*  if(dto.getWarehouse()!=null){
             paramMap.put("warehouse",dto.getWarehouse());
-        }
+        }*/
         if(dto.getProduct()!=null){
             paramMap.put("product",dto.getProduct());
         }

+ 5 - 4
workflow/src/main/resources/bootstrap-loc.yml

@@ -5,7 +5,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: localhost:8848
+        server-addr: 192.168.2.235:8848
         # 配置后缀
         file-extension: yaml
         shared-configs[0]:
@@ -18,11 +18,12 @@ spring:
           dataId: public_config_redis.yaml
       discovery:
         namespace: tofly-zmrq
-        server-addr: localhost:8848
+        server-addr: 192.168.2.235:8848
   application:
     # 该应用在nacos配置中的名称
-    name: tofly-flow
+    name: tofly-flow-wz
 
 logging:
   level:
-    com.alibaba.nacos.client.config.impl: WARN
+    com.alibaba.nacos.client.config.impl: WARN
+

+ 2 - 2
workflow/src/main/resources/bootstrap-test.yml

@@ -5,7 +5,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
         # 配置后缀
         file-extension: yaml
         shared-configs[0]:
@@ -20,7 +20,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: tofly-nacos:10081
+        server-addr: 192.168.2.235:8848
   application:
     # 该应用在nacos配置中的名称
     name: tofly-flow

+ 1 - 1
workflow/src/main/resources/bootstrap.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: loc
+    active: pro

+ 12 - 15
workflow/src/main/resources/mapper/report/ReportMapper.xml

@@ -5,21 +5,21 @@
 
 
     <select id="getSignAndApplyData" resultType="com.tofly.workflow.report.vo.SignApplyVo">
-        select  PROJECT_NAME,
-        APPLY_USER_NAME,
+        select  b.PROJECT_NAME,
+        b. APPLY_USER_NAME,
         (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
-        REGISTER_TIME,
-        REGION_NAME || ' ' || ADDRE  address,
-        USER_PHONE,
+        b.REGISTER_TIME,
+        b.REGION_NAME || ' ' || ADDRE  address,
+        b.USER_PHONE,
         (select REAL_NAME from sys_user where id =duty_user) duty_user,-- 勘察人,
-        SURVEY_DATE  SURVEY_DATE,-- 勘察日期
-        HOUSEHOLD_NUMBER ,--申请户数
+        b.SURVEY_DATE  SURVEY_DATE,-- 勘察日期
+        b.HOUSEHOLD_NUMBER ,--申请户数
         (select name from SYS_DICT where  id = user_type) PROJECT_NATURE,--工程性质
-        INSTALL_CONTENT, --安装内容
-        process_id
+        b.INSTALL_CONTENT, --安装内容
+        b.process_id
 
-        from TF_PROJECT_BASE_W b
-        where 1=1
+        from TF_PROJECT_BASE_W b left join tf_process_l c on b.process_id = c.id
+        where 1=1  and c.is_del=0
 
         <if test="reportDto !=null">
             <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
@@ -58,9 +58,6 @@
                 </foreach>
             </if>
 
-
-
-
         </if>
 
 
@@ -77,7 +74,7 @@
                sum(case when user_type='集中小区' then HOUSEHOLD_NUMBER else 0 end  ) jzxq_hs,
                sum(case when user_type='民用' then HOUSEHOLD_NUMBER else 0 end  ) my_hs,
                count(1) project_number,
-               sum(HOUSEHOLD_NUMBER) household_total
+               nvl(sum(HOUSEHOLD_NUMBER),0) household_total
         from(
                 select ( select name from SYS_POST where id = a.duty_post and DELETED != 1 ) duty_post_name,
             (select REAL_NAME from sys_user where id =DUTY_USER ) DUTY_USER,

+ 7 - 3
workflow/src/test/java/com/tofly/test/TestCal.java

@@ -8,6 +8,7 @@ import com.tofly.workflow.common.ContractConfigInfo;
 import com.tofly.workflow.utils.compute.EvaluateExpression;
 import com.tofly.workflow.utils.compute.MoneyToChineseUtils;
 import com.tofly.workflow.utils.compute.ScanFieldUtil;
+import com.tofly.workflow.utils.compute.StrParaReplace;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.StringUtils;
 
@@ -21,11 +22,14 @@ import java.util.Set;
 
 public class TestCal {
     public static void main(String[] args) {
-        test22();
+
+        System.out.println(MoneyToChineseUtils.convert(172.3));
     }
 
-    static void test22(){
-        System.out.println(MoneyToChineseUtils.convert(234.5));
+    static void test22()
+
+    {
+        System.out.println(JSON.toJSONString(StrParaReplace.getParaByCalStr("taxperHouseholdend-notaxperHouseholdend")));
     }
     static void test11(){
         ScanFieldUtil.scanTableAndField("com.tofly.workflow.buss.entity");