Browse Source

发票号码多次提交 则对收款日期进行更新

user5 2 năm trước cách đây
mục cha
commit
8b7b53d4f5
20 tập tin đã thay đổi với 506 bổ sung30 xóa
  1. 1 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementDTO.java
  2. 6 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementSysMapper.java
  3. 12 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementSysMapper.xml
  4. 82 6
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementSysServiceImpl.java
  5. 1 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/domain/dto/AssessReimbursementDTO.java
  6. 7 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/mapper/AssessReimbursementSysMapper.java
  7. 12 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/mapper/xml/AssessReimbursementSysMapper.xml
  8. 82 6
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/service/impl/AssessReimbursementSysServiceImpl.java
  9. 1 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/domain/dto/ProjectReimbursementDTO.java
  10. 7 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/mapper/ProjectReimbursementSysMapper.java
  11. 12 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/mapper/xml/ProjectReimbursementSysMapper.xml
  12. 81 6
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/service/impl/ProjectReimbursementSysServiceImpl.java
  13. 1 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/domain/dto/ReimbursementDTO.java
  14. 1 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/domain/dto/WuHanReimbursementDTO.java
  15. 6 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/ReimbursementSysMapper.java
  16. 6 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/WuHanReimbursementSysMapper.java
  17. 12 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/xml/ReimbursementSysMapper.xml
  18. 12 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/xml/WuHanReimbursementSysMapper.xml
  19. 83 6
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/service/impl/ReimbursementSysServiceImpl.java
  20. 81 6
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/service/impl/WuHanReimbursementSysServiceImpl.java

+ 1 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementDTO.java

@@ -68,6 +68,7 @@ public class AccountantReimbursementDTO extends TreeEntity<AccountantReimburseme
     private String randomType;    //随机状态(1:随机业务编码,0:指定业务编码)(默认为指定业务编码仅业务表中使用)
     private String year;    //业务编码年份(相同的业务编码根据年份不同生成不同的数据列)(仅业务表中使用)
     private String randomBusinessCodeIndex;    //随即业务编码序号
+    private String existence;   //存在状态(0:未存在;1:已存在)
 
     @Excel(name = "收款日期",importFormat = "yyyy-MM-dd",width = 30)
     private String gatheringTime;     //收款日期

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementSysMapper.java

@@ -236,4 +236,10 @@ public interface AccountantReimbursementSysMapper extends BaseMapper<AccountantR
      * @return
      */
     String getLastRandomBusinessCodeIndex(String year);
+
+    /**
+     * 修改发票收款日期
+     * @param reimbursement
+     */
+    int updateInvoiceGatheringTime(AccountantReimbursementDTO reimbursement);
 }

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementSysMapper.xml

@@ -564,4 +564,16 @@
             year = #{year}
         </where>
     </select>
+
+    <update id="updateInvoiceGatheringTime">
+        update zs_reimbursement_invoice_accountant_info
+        set
+        update_by = #{updateBy},
+        update_date = #{updateDate}
+        <if test="null != gatheringTime and '' != gatheringTime">
+            ,gathering_time = #{gatheringTime}
+        </if>
+        where
+        invoice_number = #{invoiceNumber} and del_flag = 0
+    </update>
 </mapper>

+ 82 - 6
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementSysServiceImpl.java

@@ -9,6 +9,7 @@ import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementSy
 import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementBusinessService;
 import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementSysService;
 import com.jeeplus.test.reimbursementAccountant.utils.MyBeanUtils;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
 import com.jeeplus.test.reimbursementsys.utils.PublicUtil;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -302,6 +303,7 @@ public class AccountantReimbursementSysServiceImpl implements AccountantReimburs
                 info.setBusinessCode("");
             }
             invoiceNumberSet.add(info.getInvoiceNumber());
+            info.setExistence("0");
         }
         //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
         if(invoiceNumberSet.size() != reimbursementList.size()){
@@ -314,10 +316,20 @@ public class AccountantReimbursementSysServiceImpl implements AccountantReimburs
         //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
         List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
         if(oldInvoiceNumberList.size()>0){
-            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+
+            //将查出来的已存在的发票号整理为字符串
+            String oldInvoiceNumberListStr = String.join(",", oldInvoiceNumberList);
+            //找到上传的发票信息中已存在的报告号 并对其存在状态进行修改
+            for (AccountantReimbursementDTO info : reimbursementList) {
+                if(oldInvoiceNumberListStr.contains(info.getInvoiceNumber())){
+                    info.setExistence("1");
+                }
+            }
+
+            /*String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
             map.put("success", false);
             map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
-            return map;
+            return map;*/
         }
 
         //业务编号对应的数据集合
@@ -376,11 +388,24 @@ public class AccountantReimbursementSysServiceImpl implements AccountantReimburs
                 iterator.remove();
             }
         }
-        if(businessCodeInfoList.size()>0){
-            mapper.insertBusinessCodeList(businessCodeInfoList);
+
+        //对数据进行分组
+        Map<String, List<AccountantReimbursementDTO>> existenceCodeListMap = dataDisposeOnSaveByExistence(businessCodeInfoList);
+        for (String key : existenceCodeListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<AccountantReimbursementDTO> noExistenceList = existenceCodeListMap.get(key);
+                    if(noExistenceList.size()>0){
+                        mapper.insertBusinessCodeList(noExistenceList);
+                    }
+                    break;
+                case "1":
+                    break;
+            }
         }
 
 
+
         //业务编号对应的数据集合
         List<AccountantReimbursementDTO> invoiceInfoList = Lists.newArrayList();
 
@@ -412,8 +437,28 @@ public class AccountantReimbursementSysServiceImpl implements AccountantReimburs
         for (AccountantReimbursementDTO childrenInfo : invoiceInfoList) {
             childrenInfo.preInsert();
         }
-        //新增
-        mapper.insertInvoiceList(invoiceInfoList);
+
+        //对发票数据进行分组(根据存在状态)
+        Map<String, List<AccountantReimbursementDTO>> existenceListMap = dataDisposeOnSaveByExistence(invoiceInfoList);
+        for (String key : existenceListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<AccountantReimbursementDTO> noExistenceList = existenceListMap.get(key);
+                    //新增
+                    mapper.insertInvoiceList(noExistenceList);
+                    break;
+                case "1":
+                    List<AccountantReimbursementDTO> existenceList = existenceListMap.get(key);
+                    for (AccountantReimbursementDTO info : existenceList) {
+                        //更新收款时间
+                        if(StringUtils.isNotBlank(info.getGatheringTime())){
+                            info.preUpdate();
+                            mapper.updateInvoiceGatheringTime(info);
+                        }
+                    }
+                    break;
+            }
+        }
 
         map.put("success", true);
         map.put("message", "数据上传成功");
@@ -699,4 +744,35 @@ public class AccountantReimbursementSysServiceImpl implements AccountantReimburs
         return userSignSerialMap;
     }
 
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<AccountantReimbursementDTO>> dataDisposeOnSaveByExistence(List<AccountantReimbursementDTO> dataList) {
+        Map<String, List<AccountantReimbursementDTO>> result = listMapOnSaveByExistence(dataList);
+        return result;
+    }
+
+    private Map<String, List<AccountantReimbursementDTO>> listMapOnSaveByExistence(List<AccountantReimbursementDTO> list) {
+        Map<String, List<AccountantReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (AccountantReimbursementDTO vo : list) {
+                List<AccountantReimbursementDTO> tempList = userSignSerialMap.get(vo.getExistence());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getExistence(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
 }

+ 1 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/domain/dto/AssessReimbursementDTO.java

@@ -66,6 +66,7 @@ public class AssessReimbursementDTO extends TreeEntity<AssessReimbursementDTO> {
     private String randomType;    //随机状态(1:随机业务编码,0:指定业务编码)(默认为指定业务编码仅业务表中使用)
     private String year;    //业务编码年份(相同的业务编码根据年份不同生成不同的数据列)(仅业务表中使用)
     private String randomBusinessCodeIndex;    //随即业务编码序号
+    private String existence;   //存在状态(0:未存在;1:已存在)
 
     @Excel(name = "收款日期",importFormat = "yyyy-MM-dd",width = 14)
     private String gatheringTime;     //收款日期

+ 7 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/mapper/AssessReimbursementSysMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.test.reimbursementAssess.domain.dto.AssessReimbursementDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -235,4 +236,10 @@ public interface AssessReimbursementSysMapper extends BaseMapper<AssessReimburse
      * @return
      */
     String getLastRandomBusinessCodeIndex(String year);
+
+    /**
+     * 修改发票收款日期
+     * @param reimbursement
+     */
+    int updateInvoiceGatheringTime(AssessReimbursementDTO reimbursement);
 }

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/mapper/xml/AssessReimbursementSysMapper.xml

@@ -564,4 +564,16 @@
             year = #{year}
         </where>
     </select>
+
+    <update id="updateInvoiceGatheringTime">
+        update zs_reimbursement_invoice_assess_info
+        set
+        update_by = #{updateBy},
+        update_date = #{updateDate}
+        <if test="null != gatheringTime and '' != gatheringTime">
+            ,gathering_time = #{gatheringTime}
+        </if>
+        where
+        invoice_number = #{invoiceNumber} and del_flag = 0
+    </update>
 </mapper>

+ 82 - 6
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/service/impl/AssessReimbursementSysServiceImpl.java

@@ -10,6 +10,7 @@ import com.jeeplus.test.reimbursementAssess.service.AssessReimbursementBusinessS
 import com.jeeplus.test.reimbursementAssess.service.AssessReimbursementSysService;
 import com.jeeplus.test.reimbursementAccountant.utils.MyBeanUtils;
 import com.jeeplus.test.reimbursementProject.domain.dto.ProjectReimbursementDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
 import com.jeeplus.test.reimbursementsys.utils.PublicUtil;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -303,6 +304,7 @@ public class AssessReimbursementSysServiceImpl implements AssessReimbursementSys
                 info.setBusinessCode("");
             }
             invoiceNumberSet.add(info.getInvoiceNumber());
+            info.setExistence("0");
         }
         //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
         if(invoiceNumberSet.size() != reimbursementList.size()){
@@ -315,10 +317,20 @@ public class AssessReimbursementSysServiceImpl implements AssessReimbursementSys
         //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
         List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
         if(oldInvoiceNumberList.size()>0){
-            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+
+            //将查出来的已存在的发票号整理为字符串
+            String oldInvoiceNumberListStr = String.join(",", oldInvoiceNumberList);
+            //找到上传的发票信息中已存在的报告号 并对其存在状态进行修改
+            for (AssessReimbursementDTO info : reimbursementList) {
+                if(oldInvoiceNumberListStr.contains(info.getInvoiceNumber())){
+                    info.setExistence("1");
+                }
+            }
+
+            /*String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
             map.put("success", false);
             map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
-            return map;
+            return map;*/
         }
 
         //业务编号对应的数据集合
@@ -377,11 +389,24 @@ public class AssessReimbursementSysServiceImpl implements AssessReimbursementSys
                 iterator.remove();
             }
         }
-        if(businessCodeInfoList.size()>0){
-            mapper.insertBusinessCodeList(businessCodeInfoList);
+
+        //对数据进行分组
+        Map<String, List<AssessReimbursementDTO>> existenceCodeListMap = dataDisposeOnSaveByExistence(businessCodeInfoList);
+        for (String key : existenceCodeListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<AssessReimbursementDTO> noExistenceList = existenceCodeListMap.get(key);
+                    if(noExistenceList.size()>0){
+                        mapper.insertBusinessCodeList(noExistenceList);
+                    }
+                    break;
+                case "1":
+                    break;
+            }
         }
 
 
+
         //业务编号对应的数据集合
         List<AssessReimbursementDTO> invoiceInfoList = Lists.newArrayList();
 
@@ -413,8 +438,28 @@ public class AssessReimbursementSysServiceImpl implements AssessReimbursementSys
         for (AssessReimbursementDTO childrenInfo : invoiceInfoList) {
             childrenInfo.preInsert();
         }
-        //新增
-        mapper.insertInvoiceList(invoiceInfoList);
+
+        //对发票数据进行分组(根据存在状态)
+        Map<String, List<AssessReimbursementDTO>> existenceListMap = dataDisposeOnSaveByExistence(invoiceInfoList);
+        for (String key : existenceListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<AssessReimbursementDTO> noExistenceList = existenceListMap.get(key);
+                    //新增
+                    mapper.insertInvoiceList(noExistenceList);
+                    break;
+                case "1":
+                    List<AssessReimbursementDTO> existenceList = existenceListMap.get(key);
+                    for (AssessReimbursementDTO info : existenceList) {
+                        //更新收款时间
+                        if(StringUtils.isNotBlank(info.getGatheringTime())){
+                            info.preUpdate();
+                            mapper.updateInvoiceGatheringTime(info);
+                        }
+                    }
+                    break;
+            }
+        }
 
         map.put("success", true);
         map.put("message", "数据上传成功");
@@ -700,4 +745,35 @@ public class AssessReimbursementSysServiceImpl implements AssessReimbursementSys
         return userSignSerialMap;
     }
 
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<AssessReimbursementDTO>> dataDisposeOnSaveByExistence(List<AssessReimbursementDTO> dataList) {
+        Map<String, List<AssessReimbursementDTO>> result = listMapOnSaveByExistence(dataList);
+        return result;
+    }
+
+    private Map<String, List<AssessReimbursementDTO>> listMapOnSaveByExistence(List<AssessReimbursementDTO> list) {
+        Map<String, List<AssessReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (AssessReimbursementDTO vo : list) {
+                List<AssessReimbursementDTO> tempList = userSignSerialMap.get(vo.getExistence());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getExistence(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
 }

+ 1 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/domain/dto/ProjectReimbursementDTO.java

@@ -66,6 +66,7 @@ public class ProjectReimbursementDTO extends TreeEntity<ProjectReimbursementDTO>
     private String randomType;    //随机状态(1:随机业务编码,0:指定业务编码)(默认为指定业务编码仅业务表中使用)
     private String year;    //业务编码年份(相同的业务编码根据年份不同生成不同的数据列)(仅业务表中使用)
     private String randomBusinessCodeIndex;    //随即业务编码序号
+    private String existence;   //存在状态(0:未存在;1:已存在)
 
     @Excel(name = "收款日期",importFormat = "yyyy-MM-dd",width = 14)
     private String gatheringTime;     //收款日期

+ 7 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/mapper/ProjectReimbursementSysMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.test.reimbursementProject.domain.dto.ProjectReimbursementDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -235,4 +236,10 @@ public interface ProjectReimbursementSysMapper extends BaseMapper<ProjectReimbur
      * @return
      */
     String getLastRandomBusinessCodeIndex(String year);
+
+    /**
+     * 修改发票收款日期
+     * @param reimbursement
+     */
+    int updateInvoiceGatheringTime(ProjectReimbursementDTO reimbursement);
 }

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/mapper/xml/ProjectReimbursementSysMapper.xml

@@ -564,4 +564,16 @@
             year = #{year}
         </where>
     </select>
+
+    <update id="updateInvoiceGatheringTime">
+        update zs_reimbursement_invoice_project_info
+        set
+        update_by = #{updateBy},
+        update_date = #{updateDate}
+        <if test="null != gatheringTime and '' != gatheringTime">
+            ,gathering_time = #{gatheringTime}
+        </if>
+        where
+        invoice_number = #{invoiceNumber} and del_flag = 0
+    </update>
 </mapper>

+ 81 - 6
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/service/impl/ProjectReimbursementSysServiceImpl.java

@@ -303,6 +303,7 @@ public class ProjectReimbursementSysServiceImpl implements ProjectReimbursementS
                 info.setBusinessCode("");
             }
             invoiceNumberSet.add(info.getInvoiceNumber());
+            info.setExistence("0");
         }
         //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
         if(invoiceNumberSet.size() != reimbursementList.size()){
@@ -315,10 +316,20 @@ public class ProjectReimbursementSysServiceImpl implements ProjectReimbursementS
         //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
         List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
         if(oldInvoiceNumberList.size()>0){
-            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+
+            //将查出来的已存在的发票号整理为字符串
+            String oldInvoiceNumberListStr = String.join(",", oldInvoiceNumberList);
+            //找到上传的发票信息中已存在的报告号 并对其存在状态进行修改
+            for (ProjectReimbursementDTO info : reimbursementList) {
+                if(oldInvoiceNumberListStr.contains(info.getInvoiceNumber())){
+                    info.setExistence("1");
+                }
+            }
+
+            /*String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
             map.put("success", false);
             map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
-            return map;
+            return map;*/
         }
 
         //业务编号对应的数据集合
@@ -377,8 +388,20 @@ public class ProjectReimbursementSysServiceImpl implements ProjectReimbursementS
                 iterator.remove();
             }
         }
-        if(businessCodeInfoList.size()>0){
-            mapper.insertBusinessCodeList(businessCodeInfoList);
+
+        //对数据进行分组
+        Map<String, List<ProjectReimbursementDTO>> existenceCodeListMap = dataDisposeOnSaveByExistence(businessCodeInfoList);
+        for (String key : existenceCodeListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<ProjectReimbursementDTO> noExistenceList = existenceCodeListMap.get(key);
+                    if(noExistenceList.size()>0){
+                        mapper.insertBusinessCodeList(noExistenceList);
+                    }
+                    break;
+                case "1":
+                    break;
+            }
         }
 
 
@@ -413,8 +436,29 @@ public class ProjectReimbursementSysServiceImpl implements ProjectReimbursementS
         for (ProjectReimbursementDTO childrenInfo : invoiceInfoList) {
             childrenInfo.preInsert();
         }
-        //新增
-        mapper.insertInvoiceList(invoiceInfoList);
+
+        //对发票数据进行分组(根据存在状态)
+        Map<String, List<ProjectReimbursementDTO>> existenceListMap = dataDisposeOnSaveByExistence(invoiceInfoList);
+        for (String key : existenceListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<ProjectReimbursementDTO> noExistenceList = existenceListMap.get(key);
+                    //新增
+                    mapper.insertInvoiceList(noExistenceList);
+                    break;
+                case "1":
+                    List<ProjectReimbursementDTO> existenceList = existenceListMap.get(key);
+                    for (ProjectReimbursementDTO info : existenceList) {
+                        //更新收款时间
+                        if(StringUtils.isNotBlank(info.getGatheringTime())){
+                            info.preUpdate();
+                            mapper.updateInvoiceGatheringTime(info);
+                        }
+                    }
+                    break;
+            }
+        }
+
 
         map.put("success", true);
         map.put("message", "数据上传成功");
@@ -700,4 +744,35 @@ public class ProjectReimbursementSysServiceImpl implements ProjectReimbursementS
         return userSignSerialMap;
     }
 
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<ProjectReimbursementDTO>> dataDisposeOnSaveByExistence(List<ProjectReimbursementDTO> dataList) {
+        Map<String, List<ProjectReimbursementDTO>> result = listMapOnSaveByExistence(dataList);
+        return result;
+    }
+
+    private Map<String, List<ProjectReimbursementDTO>> listMapOnSaveByExistence(List<ProjectReimbursementDTO> list) {
+        Map<String, List<ProjectReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (ProjectReimbursementDTO vo : list) {
+                List<ProjectReimbursementDTO> tempList = userSignSerialMap.get(vo.getExistence());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getExistence(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
 }

+ 1 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/domain/dto/ReimbursementDTO.java

@@ -71,6 +71,7 @@ public class ReimbursementDTO extends TreeEntity<ReimbursementDTO> {
     private String batchFlag;    //批量报销状态(1:批量报销)(仅业务表中使用)
     private String randomBusinessCodeIndex;    //随即业务编码序号
     private List<String> idList;
+    private String existence;   //存在状态(0:未存在;1:已存在)
 
     @Excel(name = "收款日期",importFormat = "yyyy-MM-dd")
     private String gatheringTime;     //收款日期

+ 1 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/domain/dto/WuHanReimbursementDTO.java

@@ -68,6 +68,7 @@ public class WuHanReimbursementDTO extends TreeEntity<WuHanReimbursementDTO> {
     private String batchFlag;    //批量报销状态(1:批量报销)(仅业务表中使用)
     private String randomBusinessCodeIndex;    //随即业务编码序号
     private List<String> idList;
+    private String existence;   //存在状态(0:未存在;1:已存在)
 
     @Excel(name = "收款日期",importFormat = "yyyy-MM-dd",width = 14)
     private String gatheringTime;     //收款日期

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/ReimbursementSysMapper.java

@@ -254,4 +254,10 @@ public interface ReimbursementSysMapper  extends BaseMapper<ReimbursementDTO> {
      * @return
      */
     String getReimbursementRatioByBindingReimbursementId(@Param("id")String id,@Param("reimbursementAddress")String reimbursementAddress);
+
+    /**
+     * 修改发票收款日期
+     * @param reimbursement
+     */
+    int updateInvoiceGatheringTime(ReimbursementDTO reimbursement);
 }

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/WuHanReimbursementSysMapper.java

@@ -238,4 +238,10 @@ public interface WuHanReimbursementSysMapper extends BaseMapper<WuHanReimburseme
      * @param id
      */
     void removeBusinessById(String id);
+
+    /**
+     * 修改发票收款日期
+     * @param reimbursement
+     */
+    int updateInvoiceGatheringTime(WuHanReimbursementDTO reimbursement);
 }

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/xml/ReimbursementSysMapper.xml

@@ -611,4 +611,16 @@
         order by a.business_code asc ,a.sort asc
     </select>
 
+    <update id="updateInvoiceGatheringTime">
+        update zs_reimbursement_invoice_info
+        set
+            update_by = #{updateBy},
+            update_date = #{updateDate}
+            <if test="null != gatheringTime and '' != gatheringTime">
+                ,gathering_time = #{gatheringTime}
+            </if>
+        where
+            invoice_number = #{invoiceNumber} and del_flag = 0
+    </update>
+
 </mapper>

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/xml/WuHanReimbursementSysMapper.xml

@@ -569,4 +569,16 @@
         where id = (select parent_id from zs_wuhan_reimbursement_invoice_info where id = #{id})
     </update>
 
+    <update id="updateInvoiceGatheringTime">
+        update zs_wuhan_reimbursement_invoice_info
+        set
+        update_by = #{updateBy},
+        update_date = #{updateDate}
+        <if test="null != gatheringTime and '' != gatheringTime">
+            ,gathering_time = #{gatheringTime}
+        </if>
+        where
+        invoice_number = #{invoiceNumber} and del_flag = 0
+    </update>
+
 </mapper>

+ 83 - 6
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/service/impl/ReimbursementSysServiceImpl.java

@@ -299,6 +299,7 @@ public class ReimbursementSysServiceImpl implements ReimbursementSysService {
                 info.setBusinessCode("");
             }
             invoiceNumberSet.add(info.getInvoiceNumber());
+            info.setExistence("0");
         }
         //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
         if(invoiceNumberSet.size() != reimbursementList.size()){
@@ -311,10 +312,20 @@ public class ReimbursementSysServiceImpl implements ReimbursementSysService {
         //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
         List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
         if(oldInvoiceNumberList.size()>0){
-            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+
+            //将查出来的已存在的发票号整理为字符串
+            String oldInvoiceNumberListStr = String.join(",", oldInvoiceNumberList);
+            //找到上传的发票信息中已存在的报告号 并对其存在状态进行修改
+            for (ReimbursementDTO info : reimbursementList) {
+                if(oldInvoiceNumberListStr.contains(info.getInvoiceNumber())){
+                    info.setExistence("1");
+                }
+            }
+
+            /*String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
             map.put("success", false);
             map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
-            return map;
+            return map;*/
         }
 
         //业务编号对应的数据集合
@@ -373,11 +384,25 @@ public class ReimbursementSysServiceImpl implements ReimbursementSysService {
                 iterator.remove();
             }
         }
-        if(businessCodeInfoList.size()>0){
-            mapper.insertBusinessCodeList(businessCodeInfoList);
+
+        //对数据进行分组
+        Map<String, List<ReimbursementDTO>> existenceCodeListMap = dataDisposeOnSaveByExistence(businessCodeInfoList);
+        for (String key : existenceCodeListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<ReimbursementDTO> noExistenceList = existenceCodeListMap.get(key);
+                    if(noExistenceList.size()>0){
+                        mapper.insertBusinessCodeList(noExistenceList);
+                    }
+                    break;
+                case "1":
+                    break;
+            }
         }
 
 
+
+
         //报销批次对应的数据集合
         List<ReimbursementDTO> invoiceInfoList = Lists.newArrayList();
 
@@ -409,8 +434,29 @@ public class ReimbursementSysServiceImpl implements ReimbursementSysService {
         for (ReimbursementDTO childrenInfo : invoiceInfoList) {
             childrenInfo.preInsert();
         }
-        //新增
-        mapper.insertInvoiceList(invoiceInfoList);
+
+        //对发票数据进行分组(根据存在状态)
+        Map<String, List<ReimbursementDTO>> existenceListMap = dataDisposeOnSaveByExistence(invoiceInfoList);
+        for (String key : existenceListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<ReimbursementDTO> noExistenceList = existenceListMap.get(key);
+                    //新增
+                    mapper.insertInvoiceList(noExistenceList);
+                    break;
+                case "1":
+                    List<ReimbursementDTO> existenceList = existenceListMap.get(key);
+                    for (ReimbursementDTO info : existenceList) {
+                        //更新收款时间
+                        if(StringUtils.isNotBlank(info.getGatheringTime())){
+                            info.preUpdate();
+                            mapper.updateInvoiceGatheringTime(info);
+                        }
+                    }
+                    break;
+            }
+        }
+
 
         map.put("success", true);
         map.put("message", "数据上传成功");
@@ -680,4 +726,35 @@ public class ReimbursementSysServiceImpl implements ReimbursementSysService {
         return userSignSerialMap;
     }
 
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<ReimbursementDTO>> dataDisposeOnSaveByExistence(List<ReimbursementDTO> dataList) {
+        Map<String, List<ReimbursementDTO>> result = listMapOnSaveByExistence(dataList);
+        return result;
+    }
+
+    private Map<String, List<ReimbursementDTO>> listMapOnSaveByExistence(List<ReimbursementDTO> list) {
+        Map<String, List<ReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (ReimbursementDTO vo : list) {
+                List<ReimbursementDTO> tempList = userSignSerialMap.get(vo.getExistence());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getExistence(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
 }

+ 81 - 6
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/service/impl/WuHanReimbursementSysServiceImpl.java

@@ -297,6 +297,7 @@ public class WuHanReimbursementSysServiceImpl implements WuHanReimbursementSysSe
                 info.setBusinessCode("");
             }
             invoiceNumberSet.add(info.getInvoiceNumber());
+            info.setExistence("0");
         }
         //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
         if(invoiceNumberSet.size() != reimbursementList.size()){
@@ -309,10 +310,20 @@ public class WuHanReimbursementSysServiceImpl implements WuHanReimbursementSysSe
         //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
         List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
         if(oldInvoiceNumberList.size()>0){
-            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+
+            //将查出来的已存在的发票号整理为字符串
+            String oldInvoiceNumberListStr = String.join(",", oldInvoiceNumberList);
+            //找到上传的发票信息中已存在的报告号 并对其存在状态进行修改
+            for (WuHanReimbursementDTO info : reimbursementList) {
+                if(oldInvoiceNumberListStr.contains(info.getInvoiceNumber())){
+                    info.setExistence("1");
+                }
+            }
+
+            /*String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
             map.put("success", false);
             map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
-            return map;
+            return map;*/
         }
 
         //业务编号对应的数据集合
@@ -371,11 +382,24 @@ public class WuHanReimbursementSysServiceImpl implements WuHanReimbursementSysSe
                 iterator.remove();
             }
         }
-        if(businessCodeInfoList.size()>0){
-            mapper.insertBusinessCodeList(businessCodeInfoList);
+
+        //对数据进行分组
+        Map<String, List<WuHanReimbursementDTO>> existenceCodeListMap = dataDisposeOnSaveByExistence(businessCodeInfoList);
+        for (String key : existenceCodeListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<WuHanReimbursementDTO> noExistenceList = existenceCodeListMap.get(key);
+                    if(noExistenceList.size()>0){
+                        mapper.insertBusinessCodeList(noExistenceList);
+                    }
+                    break;
+                case "1":
+                    break;
+            }
         }
 
 
+
         //业务编号对应的数据集合
         List<WuHanReimbursementDTO> invoiceInfoList = Lists.newArrayList();
 
@@ -407,8 +431,28 @@ public class WuHanReimbursementSysServiceImpl implements WuHanReimbursementSysSe
         for (WuHanReimbursementDTO childrenInfo : invoiceInfoList) {
             childrenInfo.preInsert();
         }
-        //新增
-        mapper.insertInvoiceList(invoiceInfoList);
+
+        //对发票数据进行分组(根据存在状态)
+        Map<String, List<WuHanReimbursementDTO>> existenceListMap = dataDisposeOnSaveByExistence(invoiceInfoList);
+        for (String key : existenceListMap.keySet()) {
+            switch(key){
+                case "0":
+                    List<WuHanReimbursementDTO> noExistenceList = existenceListMap.get(key);
+                    //新增
+                    mapper.insertInvoiceList(noExistenceList);
+                    break;
+                case "1":
+                    List<WuHanReimbursementDTO> existenceList = existenceListMap.get(key);
+                    for (WuHanReimbursementDTO info : existenceList) {
+                        //更新收款时间
+                        if(StringUtils.isNotBlank(info.getGatheringTime())){
+                            info.preUpdate();
+                            mapper.updateInvoiceGatheringTime(info);
+                        }
+                    }
+                    break;
+            }
+        }
 
         map.put("success", true);
         map.put("message", "数据上传成功");
@@ -677,4 +721,35 @@ public class WuHanReimbursementSysServiceImpl implements WuHanReimbursementSysSe
         return userSignSerialMap;
     }
 
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<WuHanReimbursementDTO>> dataDisposeOnSaveByExistence(List<WuHanReimbursementDTO> dataList) {
+        Map<String, List<WuHanReimbursementDTO>> result = listMapOnSaveByExistence(dataList);
+        return result;
+    }
+
+    private Map<String, List<WuHanReimbursementDTO>> listMapOnSaveByExistence(List<WuHanReimbursementDTO> list) {
+        Map<String, List<WuHanReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (WuHanReimbursementDTO vo : list) {
+                List<WuHanReimbursementDTO> tempList = userSignSerialMap.get(vo.getExistence());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getExistence(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
 }