Переглянути джерело

Merge remote-tracking branch 'origin/master'

huangguoce 2 місяців тому
батько
коміт
05fe4ff073

+ 6 - 2
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java

@@ -1158,7 +1158,11 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
         queryWrapper.eq("fib.del_flag", '0');
         queryWrapper.eq("fi.del_flag", '0');
         queryWrapper.eq("fi.status", cwFinanceInvoiceDTO.getStatus());
-        queryWrapper.eq("fib.program_id", cwFinanceInvoiceDTO.getProgramId()).or().eq("fib.program_id", cwFinanceInvoiceDTO.getId());
+        queryWrapper.nested(wrapper -> {
+            wrapper.eq("fib.program_id", cwFinanceInvoiceDTO.getProgramId())  // 条件1:创建人是当前用户
+                    .or()                                   // 逻辑OR
+                    .eq("fib.program_id", cwFinanceInvoiceDTO.getId());      // 条件2:项目成员是当前用户(b是关联表别名)
+        });
         if (StringUtils.isNotBlank(cwFinanceInvoiceDTO.getReconciliationPeopleName())) {
             queryWrapper.eq("fi.reconciliation_people", cwFinanceInvoiceDTO.getReconciliationPeopleName());
         }
@@ -1202,7 +1206,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
 
         // 将filteredList设置回原来的list.getRecords()
         list.setRecords(filteredList);
-        list.setTotal(filteredList.size());
+        //list.setTotal(filteredList.size());
         return list;
     }
 

+ 3 - 3
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/projectRecords/mapper/xml/CwProjectRecordsMapper.xml

@@ -332,7 +332,7 @@
         left join cw_work_contract_info cw_wci on cw_wci.id = a.contract_id and cw_wci.del_flag = '0'
         left join cw_work_client_base cw_wcb on cw_wci.client_contacts = cw_wcb.id and cw_wcb.del_flag = '0'
         left join cw_project_business_type cw_pbt on cw_pbt.id = a.business_type and cw_pbt.del_flag = '0'
-        left join (select rec.id,count(cw_pm.id) as member_count
+        left join (select rec.id,count(cw_pm.id) as member_count,cw_pm.user_id AS user_id
         from cw_project_records rec
         left join cw_project_members cw_pm on cw_pm.project_id = rec.id and cw_pm.del_flag = '0'
         group by rec.id
@@ -341,8 +341,8 @@
         left join sys_user sub on cpm.user_id = sub.id
         left join sys_user_manage_office sumo on sumo.office_id = sub.office_id
         ${ew.customSqlSegment}
-        and ((a.create_time >=(SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv on dt.id = dv.dict_type_id where dt.type='new_project_time')
-        and a.is_have_report = '1') or a.create_time &lt; (SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv on dt.id = dv.dict_type_id where dt.type='new_project_time'))
+        /*and ((a.create_time >=(SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv on dt.id = dv.dict_type_id where dt.type='new_project_time')
+        and a.is_have_report = '1') or a.create_time &lt; (SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv on dt.id = dv.dict_type_id where dt.type='new_project_time'))*/
         ORDER BY a.create_time DESC
     </select>
 

+ 5 - 1
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/projectRecords/service/CwProjectRecordsService.java

@@ -231,7 +231,11 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
         UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
         QueryWrapper<CwProjectRecords> queryWrapper = QueryWrapperGenerator.buildQueryCondition(CwProjectRecordsWrapper.INSTANCE.toEntity(cwProjectRecordsDTO), CwProjectRecords.class);
         queryWrapper.eq("a.del_flag", "0");
-        queryWrapper.eq("a.create_by_id", userDTO.getId());
+        queryWrapper.nested(wrapper -> {
+            wrapper.eq("a.create_by_id", userDTO.getId())  // 条件1:创建人是当前用户
+                    .or()                                   // 逻辑OR
+                    .eq("b.user_id", userDTO.getId());      // 条件2:项目成员是当前用户(b是关联表别名)
+        });
         if (ObjectUtil.isNotEmpty(cwProjectRecordsDTO)) {
             if (ArrayUtil.isNotEmpty(cwProjectRecordsDTO.getCreateDates())) {
                 queryWrapper.between("a.create_time", cwProjectRecordsDTO.getCreateDates()[0], cwProjectRecordsDTO.getCreateDates()[1]);

+ 55 - 1
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/workClientInfo/mapper/xml/CwWorkClientBaseMapper.xml

@@ -53,6 +53,60 @@
             <result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
             <result property="requestUserId" column="request_user_id" jdbcType="VARCHAR"/>
             <result property="taskId" column="task_id" jdbcType="VARCHAR"/>
+            <!--<association property="cwWorkClientTypeDTO" column="id" select="getType" javaType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientTypeDTO"></association>
+            <collection property="workAttachmentDtoList" ofType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO" column="id" select="getFileList"></collection>
+            <collection property="cwWorkClientBillingDTOList" ofType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBillingDTO" column="id" select="getBilling"></collection>
+            <collection property="cwWorkClientContactDTOList" ofType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientContactDTO" column="id" select="getContact"></collection>-->
+    </resultMap>
+    <resultMap id="BaseResultByIdMap" type="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBaseDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by_id" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="no" column="no" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="abbreviation" column="abbreviation" jdbcType="VARCHAR"/>
+            <result property="englishName" column="english_name" jdbcType="VARCHAR"/>
+            <result property="type" column="type" jdbcType="VARCHAR"/>
+            <result property="uscCode" column="usc_code" jdbcType="VARCHAR"/>
+            <result property="scType" column="sc_type" jdbcType="VARCHAR"/>
+            <result property="manageLevelType" column="manage_level_type" jdbcType="VARCHAR"/>
+            <result property="oneUpCompany" column="one_up_company" jdbcType="VARCHAR"/>
+            <result property="companyLevel" column="company_level" jdbcType="VARCHAR"/>
+            <result property="businessScope" column="business_scope" jdbcType="VARCHAR"/>
+            <result property="keyResponsibilities" column="key_responsibilities" jdbcType="VARCHAR"/>
+            <result property="industry" column="industry" jdbcType="VARCHAR"/>
+            <result property="affiliation" column="affiliation" jdbcType="VARCHAR"/>
+            <result property="organizationType" column="organization_type" jdbcType="VARCHAR"/>
+            <result property="reportType" column="report_type" jdbcType="VARCHAR"/>
+            <result property="oneUpOffice" column="one_up_office" jdbcType="VARCHAR"/>
+            <result property="registrationCert" column="registration_cert" jdbcType="VARCHAR"/>
+            <result property="approvingBodies" column="approving_bodies" jdbcType="VARCHAR"/>
+            <result property="officeId" column="office_id" jdbcType="VARCHAR"/>
+            <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
+            <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
+            <result property="status" column="status" jdbcType="VARCHAR"/>
+            <result property="agreeDate" column="agree_date" jdbcType="TIMESTAMP"/>
+            <result property="agreeUserId" column="agree_user_id" jdbcType="VARCHAR"/>
+            <result property="createBy.name" column="user_name" jdbcType="VARCHAR"/>
+            <result property="createName" column="user_name" jdbcType="VARCHAR"/>
+            <result property="createDateT" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="isListed" column="is_listed" jdbcType="VARCHAR"/>
+            <result property="ownershipType" column="ownership_type" jdbcType="VARCHAR"/>
+            <result property="finalStatusType" column="final_status_type" jdbcType="VARCHAR"/>
+            <result property="address" column="address" jdbcType="VARCHAR"/>
+            <result property="mobile" column="mobile" jdbcType="VARCHAR"/>
+            <result property="isUscCode" column="is_usc_code" jdbcType="VARCHAR"/>
+            <result property="manageLevelTypeName" column="manage_level_type_name" jdbcType="VARCHAR"/>
+            <result property="organizationTypeName" column="organization_type_name" jdbcType="VARCHAR"/>
+            <result property="updateRequestId" column="update_request_id" jdbcType="VARCHAR"/>
+            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
+            <result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
+            <result property="requestUserId" column="request_user_id" jdbcType="VARCHAR"/>
+            <result property="taskId" column="task_id" jdbcType="VARCHAR"/>
             <association property="cwWorkClientTypeDTO" column="id" select="getType" javaType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientTypeDTO"></association>
             <collection property="workAttachmentDtoList" ofType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO" column="id" select="getFileList"></collection>
             <collection property="cwWorkClientBillingDTOList" ofType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBillingDTO" column="id" select="getBilling"></collection>
@@ -249,7 +303,7 @@
         ${ew.customSqlSegment}
     </select>
 
-    <select id="queryById" resultMap="BaseResultMap">
+    <select id="queryById" resultMap="BaseResultByIdMap">
         select
         <include refid="Base_Column_List"></include>,
         wcb.name as one_up_company_name,

+ 79 - 38
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/controller/OssFileController.java

@@ -636,15 +636,13 @@ public class OssFileController {
      */
     public Map<String,String> xmlNodeListDataDispose(NodeList nodeList,Document document){
         Map<String,String> map = new HashMap<>();
+        Map<String, Integer> keyCounter = new HashMap<>(); // 同名节点计数器
         if(null != nodeList && nodeList.getLength()>0){
-            //遍历每一个header节点
             for (int i = 0; i < nodeList.getLength(); i++) {
-                //通过 item(i)方法 获取一个header节点,nodelist的索引值从0开始
-                Node header = nodeList.item(i);
-                //解析定义节点的子节点
-                NodeList childNodes = header.getChildNodes();
-                //节点数据处理
-                Map<String,String> map1 = xmlDataDispose(childNodes, document);
+                Node topNode = nodeList.item(i); // 0层:Header/EInvoiceData/TaxSupervisionInfo
+                NodeList childNodes = topNode.getChildNodes();
+                // 初始化层级为1(顶层直接子节点),父前缀为空
+                Map<String,String> map1 = xmlDataDispose(childNodes, document, "", 1, keyCounter);
                 map.putAll(map1);
             }
         }
@@ -652,42 +650,47 @@ public class OssFileController {
     }
 
     /**
-     * 子节点遍历获取参数,若其下还有子节点,则循环调用 xmlNodeListDataDispose 方法
-     * @param childNodes
-     * @param document
-     * @return
+     * 修复同名节点重复拼接问题:第2层与第1层同名时,仅保留1次节点名
+     * 规则:0/1层不拼接,2层若与1层同名则不重复拼接,3层及以下正常拼接
      */
-    public Map<String,String> xmlDataDispose(NodeList childNodes,Document document){
+    public Map<String,String> xmlDataDispose(NodeList childNodes,Document document, String parentPrefix, int currentLevel, Map<String, Integer> keyCounter){
         Map<String,String> map = new HashMap<>();
         for (int k = 0; k < childNodes.getLength(); k++) {
-            // 区分出text类型的node以及element类型的node
             if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {
-                Node firstChild = childNodes.item(k).getFirstChild();
-                if(null != firstChild){
-                    if(StringUtils.isBlank(childNodes.item(k).getFirstChild().getNodeValue())){
-                        // 获取所有header节点的集合
-                        NodeList childList = document.getElementsByTagName(childNodes.item(k).getNodeName());
-
-                        String parentName = childNodes.item(k).getNodeName();
-                        //循环调用,获取最低级节点数据信息
-                        Map<String,String> map1 = xmlNodeListDataDispose(childList, document);
-                        Map<String,String> map2 = new HashMap<>();
-                        if(map1.size()>0){
-                            //将获取到的数据进行遍历,添加父节点的参数信息,防止子节点key键相同,导致数据被覆盖
-                            for (String key : map1.keySet()) {
-                                if(key.contains("-")){
-                                    String newKey = key.replaceAll("-","");
-                                    map2.put(parentName + newKey,map1.get(key));
-                                }else{
-                                    map2.put(parentName + key,map1.get(key));
-                                }
-                            }
-                        }
-                        map.putAll(map2);
+                Node currentNode = childNodes.item(k);
+                String nodeName = currentNode.getNodeName();
+                // 【核心新增:去除节点名中的 `-` 字符】
+                String cleanNodeName = nodeName.replaceAll("-", ""); // 关键步骤:替换所有 `-` 为空
+                NodeList grandChildNodes = currentNode.getChildNodes();
+
+                // 拼接逻辑(改用处理后的 cleanNodeName)
+                String currentKeyPrefix;
+                if (currentLevel == 1) {
+                    // 第1层:用处理后的节点名作为前缀
+                    currentKeyPrefix = cleanNodeName;
+                } else if (currentLevel == 2) {
+                    // 第2层:判断是否与第1层前缀同名(基于处理后的名称)
+                    if (cleanNodeName.equals(parentPrefix)) {
+                        currentKeyPrefix = parentPrefix;
+                    } else {
+                        currentKeyPrefix = parentPrefix + cleanNodeName;
                     }
-                    //判定key 和value 值均存在,则进行储存,否则不进行储存
-                    if(StringUtils.isNotBlank(childNodes.item(k).getNodeName()) && StringUtils.isNotBlank(childNodes.item(k).getFirstChild().getNodeValue())){
-                        map.put(childNodes.item(k).getNodeName(),childNodes.item(k).getFirstChild().getNodeValue());
+                } else {
+                    // 第3层及以上:正常拼接处理后的节点名
+                    currentKeyPrefix = parentPrefix + cleanNodeName;
+                }
+
+                // 获取节点文本值
+                String textValue = getNodeTextValue(grandChildNodes);
+                if (StringUtils.isNotBlank(textValue)) {
+                    // 生成不重复的最终key(基于处理后的前缀)
+                    String finalKey = generateUniqueKey(currentKeyPrefix, keyCounter);
+                    map.put(finalKey, textValue);
+                } else {
+                    // 无文本值,递归时传递处理后的前缀
+                    if (hasChildElements(grandChildNodes)) {
+                        Map<String,String> childMap = xmlDataDispose(grandChildNodes, document, currentKeyPrefix, currentLevel + 1, keyCounter);
+                        map.putAll(childMap);
                     }
                 }
             }
@@ -695,6 +698,44 @@ public class OssFileController {
         return map;
     }
 
+    /**
+     * 提取节点有效文本值(仅保留非空白文本)
+     */
+    private String getNodeTextValue(NodeList childNodes) {
+        StringBuilder text = new StringBuilder();
+        for (int i = 0; i < childNodes.getLength(); i++) {
+            Node child = childNodes.item(i);
+            if (child.getNodeType() == Node.TEXT_NODE) {
+                String trimText = StringUtils.trim(child.getNodeValue());
+                if (StringUtils.isNotBlank(trimText)) {
+                    text.append(trimText);
+                }
+            }
+        }
+        return text.toString();
+    }
+
+    /**
+     * 判断是否有子元素节点
+     */
+    private boolean hasChildElements(NodeList childNodes) {
+        for (int i = 0; i < childNodes.getLength(); i++) {
+            if (childNodes.item(i).getNodeType() == Node.ELEMENT_NODE) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 生成不重复key(同名节点加序号,避免覆盖)
+     */
+    private String generateUniqueKey(String keyPrefix, Map<String, Integer> keyCounter) {
+        int count = keyCounter.getOrDefault(keyPrefix, 0) + 1;
+        keyCounter.put(keyPrefix, count);
+        return count == 1 ? keyPrefix : keyPrefix + count;
+    }
+
     @ApiOperation("处理数电发票数据中的购买方名称信息")
     @GetMapping("/disposeElectronicEngineeringInvoice")
     public Map<String,String> disposeElectronicEngineeringInvoice(@RequestParam List<String> attachmentIdList, @RequestParam String type){