Pārlūkot izejas kodu

Merge branch 'master' of http://47.108.172.52:3000/dayou/item-management-1phase

# Conflicts:
#	sql/update_sql.sql
GouGengquan 11 mēneši atpakaļ
vecāks
revīzija
0f4039122d

+ 2 - 0
dao/src/main/java/com/dayou/mapper/DyoaHistoryMapper.java

@@ -41,4 +41,6 @@ public interface DyoaHistoryMapper {
     List<HisAssetsProduction> queryAssetsProduction(@Param("id") String id);
 
     List<String> getNewFinanceInvoice(@Param("max") Date max);
+
+    Map<String, Object> getInvoiceInfo(@Param("id") String id);
 }

+ 29 - 0
dao/src/main/resources/mapper/DyoaHistoryMapper.xml

@@ -355,4 +355,33 @@
             </if>
         </where>
     </select>
+
+    <select id="getInvoiceInfo" parameterType="java.lang.String" resultType="map">
+        select
+            id,
+            incomeId,
+            orderId,
+            address,
+            bankNO,
+            bankName,
+            companyNO,
+            companyName,
+            invoiceType,
+            project,
+            planMoney,
+            realMoney,
+            taxPoint,
+            planDate,
+            realDate,
+            unit,
+            taxAmount,
+            status,
+            reason,
+            description,
+            invoiceEmp,
+            ticketNo,
+            orderType
+            from dy_finance_invoice
+        where id = #{id}
+    </select>
 </mapper>

+ 16 - 9
dao/src/main/resources/mapper/PersonalMapper.xml

@@ -81,7 +81,8 @@
             u3.NAME AS pricingStaffName,
             u4.name as handlerName,
             u4.id as handlerId,
-            p.created
+            p.created,
+            c.comments
         FROM
             work_flow_node_instance wf
                 LEFT JOIN work_node wn ON wn.id = wf.node_id
@@ -96,15 +97,20 @@
                 LEFT JOIN user u1 ON u1.id = p.outward_staff
                 LEFT JOIN user u2 ON u2.id = p.inward_staff
                 LEFT JOIN user u3 ON u3.id = p.pricing_staff
+                left join (
+                select business_id,comments from work_flow_log where concat(business_id,created) in (
+                    select concat(business_id,max(created)) from work_flow_log where business_type = 'PERSONAL_BUSINESS' and comments is not null  group BY business_id
+                )
+            ) c on p.id = c.business_id
+        WHERE
+            wf.business_type = "PERSONAL_BUSINESS"
+          AND wf.state = 'PENDING'
+          AND wf.deleted = 0
+          AND wn.deleted = 0
+          AND p.deleted = 0
     </sql>
     <select id="xSelectPage" parameterType="com.dayou.vo.PersonalVO" resultType="com.dayou.vo.PersonalVO">
         <include refid="Common_query_sql" />
-        WHERE
-            wf.business_type = "PERSONAL_BUSINESS"
-            AND wf.state = 'PENDING'
-            AND wf.deleted = 0
-            AND wn.deleted = 0
-            AND p.deleted = 0
         <if test="keyword!=null and keyword!='' ">
             and (
             p.location like concat ('%',#{keyword},'%')
@@ -329,7 +335,8 @@
             p.created,
             o.real_amount,
             o.should_amount,
-            p.save_file_date
+            p.save_file_date,
+            o.id as orderFundId
         from
             personal p
                 LEFT JOIN personal_target pt ON pt.personal_id =  p.id
@@ -339,7 +346,7 @@
                 LEFT JOIN user u1 ON u1.id = p.outward_staff
                 LEFT JOIN user u2 ON u2.id = p.inward_staff
                 LEFT JOIN user u3 ON u3.id = p.pricing_staff
-                left join (select business_id,real_amount,should_amount from order_fund where business_type='PERSONAL_BUSINESS' and deleted = 0) o on o.business_id = p.id
+                left join (select id,business_id,real_amount,should_amount from order_fund where business_type='PERSONAL_BUSINESS' and deleted = 0) o on o.business_id = p.id
         where
             p.deleted = 0  and p.client_manager_id = #{personal.clientManagerId}
         <if test="keyword!=null and keyword!='' ">

+ 1 - 0
dao/src/main/resources/mapper/UserMapper.xml

@@ -126,6 +126,7 @@
           AND p.deleted = 0
           AND up.deleted = 0
           and u.deleted =0
+            and resign_state = 0
             order by u.id
     </select>
 

+ 7 - 1
dao/src/main/resources/mapper/WorkTaskRecordMapper.xml

@@ -274,7 +274,8 @@
         pt.acreage,
         pt.amount,
         pt.price,
-        pt.is_online
+        pt.is_online,
+        c.comments
         FROM
         work_task_record wtr
         LEFT JOIN work_node_task wnt ON wnt.id = wtr.task_id
@@ -305,6 +306,11 @@
         LEFT JOIN user u3 ON u3.id = p.inward_staff
         LEFT JOIN user u4 ON u4.id = p.pricing_staff
         LEFT JOIN personal_target pt ON pt.personal_id = p.id
+        left join (
+            select business_id,comments from work_flow_log where concat(business_id,created) in (
+            select concat(business_id,max(created)) from work_flow_log where business_type = 'PERSONAL_BUSINESS' and comments is not null  group BY business_id
+            )
+        ) c on c.business_id = p.id
         WHERE
         wtr.handler_id = #{personal.handlerId}
         AND u.deleted = 0

+ 12 - 0
domain/src/main/java/com/dayou/entity/FinanceInvoice.java

@@ -27,6 +27,11 @@ public class FinanceInvoice extends BaseEntity {
     private static final long serialVersionUID=1L;
 
     /**
+     * 实收款id
+     */
+    private Long realFundId;
+
+    /**
      * 订单收款id
      */
     private Long orderFundId;
@@ -180,6 +185,13 @@ public class FinanceInvoice extends BaseEntity {
     private BigDecimal taxAmount;
 
     /**
+     * 发票号码
+     */
+    @ImportCell
+    @ExportCell(columnName = "发票号码")
+    private String ticketNo;
+
+    /**
      * 备注
      */
     @ImportCell

+ 3 - 1
domain/src/main/java/com/dayou/enums/MainBusinessEnum.java

@@ -39,7 +39,9 @@ public enum MainBusinessEnum implements CodeMsgEnumInterface<String,String> {
 
     REAL_AMOUNT_CLAIM("REAL_AMOUNT_CLAIM","实收款认领"),
 
-    ASSETS_ORDER("ASSETS_ORDER","资产订单")
+    ASSETS_ORDER("ASSETS_ORDER","资产订单"),
+
+    FINANCE_INVOICE("FINANCE_INVOICE","财务开票")
     ;
 
    MainBusinessEnum(String code, String name) {

+ 4 - 2
domain/src/main/java/com/dayou/vo/PersonalTodoVO.java

@@ -40,7 +40,7 @@ public class PersonalTodoVO {
 
     private Boolean taskFinished;
 
-    private LocalDateTime created;
+    private Date created;
 
     private String clientName;
 
@@ -66,7 +66,7 @@ public class PersonalTodoVO {
 
     private String pricingStaffName;
 
-    private LocalDateTime nodeCreated;
+    private Date nodeCreated;
 
     private BigDecimal acreage;
 
@@ -82,4 +82,6 @@ public class PersonalTodoVO {
 
     private Boolean isOnline;
 
+    private String comments;
+
 }

+ 3 - 0
domain/src/main/java/com/dayou/vo/PersonalVO.java

@@ -142,4 +142,7 @@ public class PersonalVO extends Personal {
 
     private String nodeCode;
 
+    private String comments;
+
+    private Long orderFundId;
 }

+ 90 - 21
service/src/main/java/com/dayou/dyoa/DyoaHistoryServiceImpl.java

@@ -37,6 +37,9 @@ import org.springframework.stereotype.Service;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -83,7 +86,7 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
 
     private static final Map<String,String> ASSETS_PRODUCTION_COLUM = new HashMap<>();
 
-    private static final Map<String,String> FINANCE_CLAIM_COLUM = new HashMap<>();
+    private static final Map<String,String> FINANCE_INVOICE_COLUM = new HashMap<>();
 
 
 
@@ -135,6 +138,10 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
 
     @Autowired
     private IAssetsProductionService assetsProductionService;
+
+    @Autowired
+    private IFinanceInvoiceService financeInvoiceService;
+
     static {
 //        MAJOR_ORDER_COLUM.put("id","id");
         MAJOR_ORDER_COLUM.put("name","name");
@@ -286,25 +293,27 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
         ASSETS_PRODUCTION_COLUM.put("type","productionType");
 
         //财务开票字段
-        FINANCE_CLAIM_COLUM.put("companyName","title");
-        FINANCE_CLAIM_COLUM.put("companyNO","taxNo");
-        FINANCE_CLAIM_COLUM.put("bankName","bankName");
-        FINANCE_CLAIM_COLUM.put("bankNO","bankAccount");
-        FINANCE_CLAIM_COLUM.put("address","bankAddress");
-        FINANCE_CLAIM_COLUM.put("invoiceType","type");
-        FINANCE_CLAIM_COLUM.put("project","makeItem");
-        FINANCE_CLAIM_COLUM.put("planMoney","planAmount");
-        FINANCE_CLAIM_COLUM.put("realMoney","realAmount");
-        FINANCE_CLAIM_COLUM.put("taxPoint","taxRate");
-        FINANCE_CLAIM_COLUM.put("planDate","planMakeDate");
-        FINANCE_CLAIM_COLUM.put("realDate","realMakeDate");
-        FINANCE_CLAIM_COLUM.put("unit","itemUnit");
-        FINANCE_CLAIM_COLUM.put("number","itemQuantity");
-        FINANCE_CLAIM_COLUM.put("taxAmount","taxAmount");
-        FINANCE_CLAIM_COLUM.put("status","state");
-        FINANCE_CLAIM_COLUM.put("reason","reason");
-        FINANCE_CLAIM_COLUM.put("description","remark");
-        FINANCE_CLAIM_COLUM.put("invoiceEmp","makerId");
+        FINANCE_INVOICE_COLUM.put("orderId","orderFundId");
+        FINANCE_INVOICE_COLUM.put("incomeId","realFundId");
+        FINANCE_INVOICE_COLUM.put("companyName","title");
+        FINANCE_INVOICE_COLUM.put("companyNO","taxNo");
+        FINANCE_INVOICE_COLUM.put("bankName","bankName");
+        FINANCE_INVOICE_COLUM.put("bankNO","bankAccount");
+        FINANCE_INVOICE_COLUM.put("address","bankAddress");
+        FINANCE_INVOICE_COLUM.put("invoiceType","type");
+        FINANCE_INVOICE_COLUM.put("project","makeItem");
+        FINANCE_INVOICE_COLUM.put("planMoney","planAmount");
+        FINANCE_INVOICE_COLUM.put("realMoney","realAmount");
+        FINANCE_INVOICE_COLUM.put("taxPoint","taxRate");
+        FINANCE_INVOICE_COLUM.put("planDate","planMakeDate");
+        FINANCE_INVOICE_COLUM.put("realDate","realMakeDate");
+        FINANCE_INVOICE_COLUM.put("unit","itemUnit");
+        FINANCE_INVOICE_COLUM.put("taxAmount","taxAmount");
+        FINANCE_INVOICE_COLUM.put("status","state");
+        FINANCE_INVOICE_COLUM.put("reason","reason");
+        FINANCE_INVOICE_COLUM.put("description","remark");
+        FINANCE_INVOICE_COLUM.put("invoiceEmp","makerId");
+        FINANCE_INVOICE_COLUM.put("ticketNo","ticketNo");
     }
 
 
@@ -590,10 +599,70 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
         Date max = dyoaRecordService.getMaxFinanceInvoiceCreatedTime();
         List<String> newInvoice = dyoaHistoryMapper.getNewFinanceInvoice(max);
         newInvoice.stream().forEach(x-> {
-            //todo
+            fetchFinanceInvoiceDetail(x);
         });
     }
 
+    private void fetchFinanceInvoiceDetail(String id) {
+        try{
+            Map<String,Object> resultMap = dyoaHistoryMapper.getInvoiceInfo(id);
+            FinanceInvoice invoice = new FinanceInvoice();
+            Class<FinanceInvoice> fClass = FinanceInvoice.class;
+            String dyoaId = (String) resultMap.get("id");
+            for (Map.Entry<String, String> entry : FINANCE_INVOICE_COLUM.entrySet()){
+                Object columValue = resultMap.get(entry.getKey());
+                if (columValue!=null){
+                    String mbsColum = entry.getValue();
+                    Field field = fClass.getDeclaredField(mbsColum);
+                    field.setAccessible(true);
+                    switch (mbsColum){
+                        case "orderFundId":
+                            Long orderFundMbsId = findOrderFundId((String) columValue);
+                            if (orderFundMbsId==null){
+                                return;
+                            }
+                            field.set(invoice, orderFundMbsId);
+                            break;
+                        case "realFundId":
+                            Long realFundId = findRealAmountMbsId((String) columValue);
+                            if (realFundId==null){
+                                return;
+                            }
+                            field.set(invoice, realFundId);
+                            break;
+                        case "planAmount":
+                        case "realAmount":
+                        case "taxAmount":
+                        case "taxRate":
+                            field.set(invoice,BigDecimal.valueOf((Double) columValue));
+                            break;
+                        case "planMakeDate":
+                        case "realMakeDate":
+                            Timestamp ts = (Timestamp) columValue;
+                            field.set(invoice, DateUtils.dateToLocalDate(new Date(ts.getTime())));
+                            break;
+                        case "makerId":
+                            field.set(invoice,getMbsUserId((String) columValue));
+                            break;
+                        default:
+                            field.set(invoice,columValue);
+                    }
+
+                }
+            }
+            Date createdDatetime = (Date) resultMap.get("createdDatetime");
+            invoice.setCreated(createdDatetime);
+            financeInvoiceService.save(invoice);
+            //插入同步记录表
+            Long mbsId = invoice.getId();
+            dyoaRecordService.insert(MainBusinessEnum.FINANCE_INVOICE, mbsId, dyoaId,createdDatetime);
+        }catch (NoSuchFieldException e) {
+            throw new RuntimeException(e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     @DSTransactional
     @Override
     public void fetchAssetsOrderProduction() {

+ 2 - 2
service/src/main/java/com/dayou/dyoa/IDyoaHistoryService.java

@@ -28,11 +28,11 @@ public interface IDyoaHistoryService {
 
     void fetchDyoaPersonalOrder();
 
-    void fetchRealAmountClaimData();
+    void fetchAssetsOrderProduction();
 
     void fetchRealAmount();
 
-     void fetchAssetsOrderProduction();
+    void fetchRealAmountClaimData();
 
     void fetchFinanceInvoiceRecord();
 }

+ 30 - 8
service/src/main/java/com/dayou/dyoa/task/FetchDyoaDataSchedule.java

@@ -13,25 +13,47 @@ public class FetchDyoaDataSchedule {
     @Autowired
     private IDyoaHistoryService dyoaHistoryService;
 
-
 //    //每天凌晨01:30触发
 //    @Scheduled(cron = "0 30 1 * * ?")
-//    public void syncRealAmountDate(){
-//        dyoaHistoryService.fetchRealAmount();
-//        log.info("同步实收款数据完成");
+//    public void syncDyoaPersonalData(){
+//        dyoaHistoryService.fetchDyoaPersonalOrder();
+//        log.info("同步个贷数据完成");
 //    }
 //
 //    //每天凌晨02:00触发
 //    @Scheduled(cron = "0 0 2 * * ?")
-//    public void syncDyoaMajorDate(){
+//    public void syncDyoaMajorData(){
 //        dyoaHistoryService.fetchDyoaMajorOrderProduction();
 //        log.info("同步大中型数据完成");
 //    }
 //
+
+
 //    //每天凌晨02:30触发
 //    @Scheduled(cron = "0 30 2 * * ?")
-//    public void syncDyoaPersonalDate(){
-//        dyoaHistoryService.fetchDyoaPersonalOrder();
-//        log.info("同步个贷数据完成");
+//    public void syncAssetsData(){
+//        dyoaHistoryService.fetchAssetsOrderProduction();
+//        log.info("同步资产数据完成");
+//    }
+
+//    //每天凌晨03:00触发
+//    @Scheduled(cron = "0 0 3 * * ?")
+//    public void syncRealAmountData(){
+//        dyoaHistoryService.fetchRealAmount();
+//        log.info("同步实收款数据完成");
+//    }
+//
+//    //每天凌晨03:30触发
+//    @Scheduled(cron = "0 30 3 * * ?")
+//    public void syncRealClaimData(){
+//        dyoaHistoryService.fetchRealAmountClaimData();
+//        log.info("同步实收款认领数据完成");
+//    }
+
+//    //每天凌晨04:00触发
+//    @Scheduled(cron = "0 0 4 * * ?")
+//    public void syncFinanceInvoiceData(){
+//        dyoaHistoryService.fetchFinanceInvoiceRecord();
+//        log.info("同步财务开票数据完成");
 //    }
 }

+ 2 - 0
service/src/main/java/com/dayou/service/impl/FinanceInvoiceServiceImpl.java

@@ -2,6 +2,7 @@ package com.dayou.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.dayou.common.BaseEntity;
 import com.dayou.dto.MajorProductionSimpleDTO;
 import com.dayou.entity.FinanceInvoice;
@@ -48,6 +49,7 @@ import com.dayou.enums.BatchTaskTypeEnum;
  * @author wucl
  * @since 2023-12-08
  */
+@DS("mbs")
 @Service
 public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper, FinanceInvoice> implements IFinanceInvoiceService {
 

+ 10 - 0
sql/update_sql.sql

@@ -637,6 +637,16 @@ ALTER TABLE `personal_target` ADD qr_code varchar(255) NULL COMMENT '出入库
  */
 
 /**
+   日期:2024-08-15
+   修改人:吴长林
+   未更新到test-env
+*/
+ALTER TABLE `finance_invoice` ADD ticket_no varchar(100) NULL COMMENT '发票号码';
+ALTER TABLE `finance_invoice` MODIFY COLUMN apply_id bigint(32) NULL COMMENT '申请人id';
+ALTER TABLE major MODIFY COLUMN terminal_clientele_type varchar(100) NULL COMMENT '终端客户类型(企业,个人)';
+ALTER TABLE major MODIFY COLUMN clientele_type varchar(100) NULL COMMENT '客户类型(企业,个人)';
+ALTER TABLE finance_invoice ADD COLUMN real_fund_id bigint NULL COMMENT '实收款id';
+/**
   日期:2024-07-09
   修改人:苟耕铨
  */