Quellcode durchsuchen

解决同步老系统数据不全问题

wucl vor 6 Monaten
Ursprung
Commit
1c76b09d8d
24 geänderte Dateien mit 371 neuen und 34 gelöschten Zeilen
  1. 23 0
      biz-base/src/main/java/com/dayou/controller/DyoaController.java
  2. 2 2
      biz-base/src/main/java/com/dayou/controller/FinanceRealFundController.java
  3. 2 0
      biz-base/src/main/java/com/dayou/controller/ProductionFundController.java
  4. 2 0
      dao/src/main/java/com/dayou/mapper/DyoaHistoryMapper.java
  5. 3 0
      dao/src/main/java/com/dayou/mapper/FinanceClaimMapper.java
  6. 3 0
      dao/src/main/java/com/dayou/mapper/OrderFundMapper.java
  7. 54 0
      dao/src/main/resources/mapper/DyoaHistoryMapper.xml
  8. 30 9
      dao/src/main/resources/mapper/FinanceClaimMapper.xml
  9. 50 1
      dao/src/main/resources/mapper/FinanceRealFundMapper.xml
  10. 15 0
      dao/src/main/resources/mapper/OrderFundMapper.xml
  11. 16 0
      domain/src/main/java/com/dayou/dto/history/HisClaimProd.java
  12. 7 0
      domain/src/main/java/com/dayou/entity/OrderFund.java
  13. 81 0
      service/src/main/java/com/dayou/dyoa/DyoaHistoryServiceImpl.java
  14. 6 0
      service/src/main/java/com/dayou/dyoa/IDyoaHistoryService.java
  15. 22 0
      service/src/main/java/com/dayou/dyoa/task/FetchDyoaDataSchedule.java
  16. 3 0
      service/src/main/java/com/dayou/service/IFinanceClaimService.java
  17. 6 3
      service/src/main/java/com/dayou/service/IOrderFundService.java
  18. 2 0
      service/src/main/java/com/dayou/service/IProductionFundService.java
  19. 6 0
      service/src/main/java/com/dayou/service/impl/FinanceClaimServiceImpl.java
  20. 1 1
      service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java
  21. 9 2
      service/src/main/java/com/dayou/service/impl/MajorServiceImpl.java
  22. 3 1
      service/src/main/java/com/dayou/service/impl/MessageServiceImpl.java
  23. 17 15
      service/src/main/java/com/dayou/service/impl/OrderFundServiceImpl.java
  24. 8 0
      service/src/main/java/com/dayou/service/impl/ProductionFundServiceImpl.java

+ 23 - 0
biz-base/src/main/java/com/dayou/controller/DyoaController.java

@@ -1,6 +1,7 @@
 package com.dayou.controller;
 
 import com.dayou.annotation.IgnoreAuth;
+import com.dayou.common.RestResponse;
 import com.dayou.dyoa.IDyoaHistoryService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,4 +66,26 @@ public class DyoaController {
         dyoaHistoryService.fetchFinanceInvoiceRecord();
         log.info("同步财务开票数据完成");
     }
+
+
+    @IgnoreAuth
+    @GetMapping("/update/productionFundId")
+    public RestResponse<Boolean> updateProductionFund(){
+        Boolean ret = dyoaHistoryService.updateProductionFund();
+        return RestResponse.data(ret);
+    }
+
+    @IgnoreAuth
+    @GetMapping("/update/claimProductionId")
+    public RestResponse<Boolean> updateClaimProductionId(){
+        Boolean ret = dyoaHistoryService.updateClaimProductionId();
+        return RestResponse.data(ret);
+    }
+
+    @IgnoreAuth
+    @GetMapping("/update/majorProduction")
+    public RestResponse<Boolean> updateMajorProduction(){
+        Boolean ret = dyoaHistoryService.updateMajorProduction();
+        return RestResponse.data(ret);
+    }
 }

+ 2 - 2
biz-base/src/main/java/com/dayou/controller/FinanceRealFundController.java

@@ -171,7 +171,7 @@ public class FinanceRealFundController extends BaseController {
      * @param vo
      * @return
      */
-    @DataPermission
+    @DataPermission(ignoreDepartment= {MANAGER_OFFICE,FINANCE_DEPARTMENT})
     @GetMapping("/commission/major/evaluator")
     public RestResponse<List<UserCommissionTotalAmountVO>> majorEvaluatorCommission(UserCommissionTotalAmountVO vo){
         List<UserCommissionTotalAmountVO> ret = financeRealFundService.majorEvaluatorCommission(vo);
@@ -237,7 +237,7 @@ public class FinanceRealFundController extends BaseController {
      * @param vo
      * @return
      */
-    @DataPermission
+    @DataPermission(postChild = false,ignoreDepartment = {MANAGER_OFFICE,FINANCE_DEPARTMENT})
     @GetMapping("/commission/major/market")
     public RestResponse<List<UserCommissionTotalAmountVO>> majorMarketCommission(UserCommissionTotalAmountVO vo){
         List<UserCommissionTotalAmountVO> ret = financeRealFundService.majorMarketCommission(vo);

+ 2 - 0
biz-base/src/main/java/com/dayou/controller/ProductionFundController.java

@@ -1,5 +1,6 @@
 package com.dayou.controller;
 
+import com.dayou.annotation.IgnoreAuth;
 import com.dayou.vo.ProductionFundVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import lombok.extern.slf4j.Slf4j;
@@ -90,5 +91,6 @@ public class ProductionFundController extends BaseController {
         ProductionFundVO pf = productionFundService.checkFund(productionFundVO);
         return RestResponse.data(pf);
     }
+
 }
 

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

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

+ 3 - 0
dao/src/main/java/com/dayou/mapper/FinanceClaimMapper.java

@@ -2,6 +2,7 @@ package com.dayou.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.dto.RealFundAssetsStatDTO;
+import com.dayou.dto.history.HisClaimProd;
 import com.dayou.entity.FinanceClaim;
 import com.dayou.dao.CustomBaseMapper;
 import com.dayou.entity.OrderFund;
@@ -57,4 +58,6 @@ public interface FinanceClaimMapper extends CustomBaseMapper<FinanceClaim> {
     Page<FinanceClaimsVO> financeClaimsList(Page page, @Param("vo") FinanceClaimsVO financeClaimVO,@Param("keyword") String keyword);
 
     List<FinanceClaimsVO> exportList(@Param("vo")FinanceClaimsVO financeClaimVO, @Param("keyword") String keyword);
+
+    List<HisClaimProd> updateClaimProductionId();
 }

+ 3 - 0
dao/src/main/java/com/dayou/mapper/OrderFundMapper.java

@@ -5,6 +5,7 @@ import com.dayou.dao.CustomBaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -27,4 +28,6 @@ public interface OrderFundMapper extends CustomBaseMapper<OrderFund> {
      * @param orderFundId 订单收款信息id
      */
     void updateDiscountByOrderIdAfter(@Param("orderFundId") Long orderFundId);
+
+    List<OrderFund> getAllOrderFund();
 }

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

@@ -404,4 +404,58 @@
             from dy_finance_invoice
         where id = #{id}
     </select>
+
+    <select id="findAllProductionNo" resultType="com.dayou.dto.history.HisMajorProduction">
+        select
+        d.id,
+        doth.id as tId,
+        dop.id as pId,
+        doth.type,<!--房屋用途 -->
+        doth.ownerName, <!--#权利人 -->
+        doth.ownerNo , <!--#权证号 -->
+        doth.houseName,<!--#项目名称 -->
+        doth.locations ,
+        doth.landOwnerName,  <!--#土地使用权人 -->
+        doth.landNo, <!--#土地证号 -->
+        doth.buildYear, <!--#竣工年代 -->
+        doth.buildArea, <!--#建筑面积 -->
+        doth.useType, <!--#使用权类型 -->
+        doth.landArea, <!--#土地面积 -->
+        doth.masterName,<!--#项目负责人 -->
+        doth.surveyName, <!--#实勘人 -->
+        doth.planUsage,<!--#规划用途 -->
+        doth.realUsage,<!--#实际用途 -->
+        doth.surveyAddress,<!--#实勘地址 -->
+        doth.description, <!--#备注 -->
+        doth.price, <!--#评估价格 -->
+        doth.approvedPrice, <!--#审核价格 -->
+        doth.measure, <!--#估价方法 -->
+        doth.surveyDate, <!--#实勘日期 -->
+        dop.printQuantity , <!--#打印份数 -->
+        dop.type AS pType, <!--#产品类型 -->
+        d.reportNo, <!--#产品号 -->
+        concat(d.signEmpName1,',',d.signEmpName2) as signEmpNames,<!--#签字人1 -->
+        d.name,<!--#项目名称 -->
+        d.principal, <!--#委托方名称 -->
+        d.principalAddress, <!--#委托方地址 -->
+        d.principalMobile ,<!--#委托方电话 -->
+        d.propertyName, <!--#产权人 -->
+        d.priceDate ,<!-- 价值时点-->
+        d.area,<!-- 评估面积-->
+        (d.money*10000)as money,<!-- 评估总价-->
+        d.price as xPrice,<!-- 评估单价-->
+        d.specDesc,<!-- 特殊情况说明-->
+        d.repo ,<!-- 库存状态-->
+        d.archiveTime, <!-- 归档时间-->
+        d.standardPrice ,<!-- 标准收费-->
+        d.confirmTime, <!-- 报告送达的确认时间-->
+        if(d.confirmTime is null,0,1) as deliveryState,
+        d.yjsInTime,<!-- 意见书入库时间-->
+        d.yjsOutTime,<!-- 意见书出库时间-->
+        d.bgInTime,<!-- 报告入库时间-->
+        d.bgOutTime<!-- 报告出库时间-->
+        from dy_order d left join dy_order_target_house doth on d.id = doth.orderId
+        left join dy_order_product dop on dop.orderId = d.id and d.deleted = 0 where d.reportNO is not null
+
+    </select>
 </mapper>

+ 30 - 9
dao/src/main/resources/mapper/FinanceClaimMapper.xml

@@ -72,8 +72,8 @@
         f.oId,
         f.pId,
         f.production_no as reportNo,
-        f.order_id,
-        f.should_amount as orderShouldAmount,
+        m.order_id,
+        f.shouldAmount as orderShouldAmount,
         m.financial,
         m.members,
         m.bailor,
@@ -81,7 +81,7 @@
         mp.NAME,
         mp.if_save_file,
         mp.evaluate_amount,
-        mp.production as productionType,
+        mp.production AS productionType,
         u.NAME AS clientManager,
         u1.NAME AS principal,
         cc1.NAME AS clientName,
@@ -104,21 +104,24 @@
         WHERE
         id IN ( SELECT post_id FROM user_post WHERE user_id = u.id ))) AS marketDepartment
         FROM
+
+        finance_claim fc  inner join
         (
         SELECT
         p.order_fund_id oId,
         p.id AS pId,
         p.business_id,
-        o.order_id,
+
         p.production_no,
-        o.should_amount
+        p.production_should_amount as shouldAmount
         FROM
-        production_fund p left join (select id,order_id,should_amount from order_fund where business_type='MAJOR_BUSINESS' and deleted = 0) o on o.id = p.order_fund_id
+        production_fund p
         WHERE
         p.business_type = 'MAJOR_BUSINESS'
+        and p.real_amount is not null
         AND p.deleted = 0
         ) f
-        INNER JOIN finance_claim fc ON
+        ON
 
         ( fc.order_fund_id = f.oId and fc.production_fund_id = f.pId)
 
@@ -130,9 +133,11 @@
         LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
         LEFT JOIN customer_linkman cl1 ON cl1.id = m.clientele_contact_id
         LEFT JOIN finance_real_fund frf ON frf.id = fc.real_fund_id
-        LEFT JOIN ( SELECT major_id, report_no,production, evaluate_amount, if_save_file, NAME FROM major_production WHERE deleted = 0 ) mp ON ( mp.major_id = m.id AND mp.report_no = f.production_no )
+        LEFT JOIN ( SELECT mpp.major_id, mpp.report_no,mpp.production, mpp.evaluate_amount, mpp.if_save_file, mpp.NAME FROM major_production
+        mpp left join ( select production_no , production_type,real_amount from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) ppf
+        on (mpp.report_no = ppf.production_no and mpp.production = ppf.production_type)
+        WHERE ppf.real_amount is not null ) mp ON ( mp.major_id = m.id AND mp.report_no = f.production_no )
         LEFT JOIN user u2 ON u2.id = fc.claim_user_id
-        where m.deleted = 0
         <if test="keyword!=null and keyword!='' ">
             and (
             f.order_id like concat ('%',#{keyword},'%')
@@ -421,4 +426,20 @@
     <select id="exportList" parameterType="com.dayou.vo.FinanceClaimsVO" resultType="com.dayou.vo.FinanceClaimsVO">
         <include refid="claimList" />
     </select>
+
+    <select id="updateClaimProductionId" resultType="com.dayou.dto.history.HisClaimProd">
+        SELECT
+            t.id,
+            p.id AS pid,
+            fc.id AS fcid,
+            fc.production_fund_id
+        FROM
+            ( SELECT id, created FROM order_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) t
+                LEFT JOIN ( SELECT id, order_fund_id FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) p ON t.id = p.order_fund_id
+                LEFT JOIN ( SELECT id, production_fund_id, order_fund_id FROM finance_claim WHERE deleted = 0 ) fc ON fc.order_fund_id = t.id
+        WHERE
+            fc.id IS NOT NULL  and p.id  is not null  and fc.production_fund_id is null
+        ORDER BY
+            t.created DESC
+    </select>
 </mapper>

+ 50 - 1
dao/src/main/resources/mapper/FinanceRealFundMapper.xml

@@ -153,7 +153,56 @@
     </select>
 
     <select id="claimPage" resultMap="realAmountClaimMap">
-        <include refid="pageListSql1" />
+        SELECT
+        #{userId} as userId,
+        frf.id,
+        frf.created,
+        frf.payer,
+        frf.payer_bank,
+        frf.payer_account,
+        frf.amount,
+        frf.pay_datetime,
+        frf.remark,
+        frf.creator_id,
+        u.name AS creator,
+        ifnull(t.ca,0) AS claimAmount,
+        ( frf.amount - ifnull(t.ca,0) ) AS notClaimAmount
+        FROM
+        finance_real_fund frf
+        LEFT JOIN user u ON u.id = frf.creator_id
+        LEFT JOIN ( SELECT real_fund_id, sum(ifnull(claim_amount,0)) ca FROM finance_claim WHERE deleted = 0 GROUP BY real_fund_id ) t ON t.real_fund_id = frf.id
+        WHERE
+        frf.deleted = 0
+        <if test="vo!=null and vo.notFinished">
+            and  ifnull(t.ca,0) &lt; frf.amount
+        </if>
+        <if test="vo!=null and !vo.notFinished">
+            and  ifnull(t.ca,0) &gt;= frf.amount
+        </if>
+        <if test="keyword!=null and keyword!='' ">
+            and (
+            frf.payer like concat ('%',#{keyword},'%')
+            or frf.payer_bank like concat('%',#{keyword},'%')
+            or u.name like concat('%',#{keyword},'%')
+            or frf.payer_account like concat('%',#{keyword},'%')
+            or frf.amount like concat('%',#{keyword},'%')
+            or frf.remark like concat('%',#{keyword},'%')
+            )
+        </if>
+        <if test="vo!=null and vo.startDate!=null and vo.startDate!=''">
+            and frf.pay_datetime &gt;= #{vo.startDate}
+        </if>
+        <if test="vo!=null and vo.endDate!=null and vo.endDate!=''">
+            and frf.pay_datetime &lt;= #{vo.endDate}
+        </if>
+        <if test="vo!=null and vo.xStartDate!=null and vo.xStartDate!=''">
+            and frf.created &gt;= #{vo.xStartDate}
+        </if>
+        <if test="vo!=null and vo.xEndDate!=null and vo.xEndDate!=''">
+            and frf.created &lt;= #{vo.xEndDate}
+        </if>
+        ORDER BY
+        frf.created DESC
     </select>
 
     <select id="findRecommends"  resultType="java.lang.String">

+ 15 - 0
dao/src/main/resources/mapper/OrderFundMapper.xml

@@ -49,4 +49,19 @@
         WHERE id = #{orderFundId}
     </update>
 
+    <select id="getAllOrderFund" resultType="com.dayou.entity.OrderFund">
+        SELECT
+            off.*,
+            mp.report_no,
+            mp.production,
+            mp.standard_amount
+        FROM
+            order_fund off
+                LEFT JOIN ( SELECT * FROM major_production WHERE deleted = 0 AND production = 'REPORT' ) mp ON mp.major_id = off.business_id
+        WHERE
+            off.business_type = 'MAJOR_BUSINESS'
+          AND off.real_amount IS NOT NULL
+          AND mp.report_no IS NOT NULL
+    </select>
+
 </mapper>

+ 16 - 0
domain/src/main/java/com/dayou/dto/history/HisClaimProd.java

@@ -0,0 +1,16 @@
+package com.dayou.dto.history;
+
+import lombok.Data;
+
+@Data
+public class HisClaimProd {
+
+    private Long id;
+
+    private Long pid;
+
+    private Long fcid;
+
+    private Long productionFundId;
+
+}

+ 7 - 0
domain/src/main/java/com/dayou/entity/OrderFund.java

@@ -1,5 +1,7 @@
 package com.dayou.entity;
 import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayou.common.BaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -70,5 +72,10 @@ public class OrderFund extends BaseEntity {
     @ExportCell(columnName = "应收款备注")
     private String remark;
 
+    @TableField(exist = false)
+    private String reportNo;
+    @TableField(exist = false)
+    private BigDecimal standardAmount;
+
 
 }

+ 81 - 0
service/src/main/java/com/dayou/dyoa/DyoaHistoryServiceImpl.java

@@ -31,6 +31,7 @@ import org.apache.http.client.methods.HttpPost;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
@@ -1559,4 +1560,84 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
 //        }
 //        return null;
 //    }
+
+    @Autowired
+    private OrderFundMapper orderFundMapper;
+
+
+
+    @Override
+    public Boolean updateMajorProduction() {
+        List<HisMajorProduction> allProductionNo = dyoaHistoryMapper.findAllProductionNo();
+        for (HisMajorProduction productionNo : allProductionNo){
+            List<MajorProduction> list = majorProductionService.list(new LambdaQueryWrapper<MajorProduction>().select(BaseEntity::getId).eq(MajorProduction::getReportNo, productionNo.getReportNo()));
+            if (CollectionUtil.isEmpty(list)){
+                DyoaRecord record = dyoaRecordService.getOne(new LambdaQueryWrapper<DyoaRecord>().eq(DyoaRecord::getDyoaId, productionNo.getId()).eq(DyoaRecord::getMbsType, "MAJOR_ORDER"));
+                if (record != null){
+                    MajorProduction majorProduction = new MajorProduction();
+                    majorProduction.setReportNo(productionNo.getReportNo());
+                    majorProduction.setMajorId(record.getMbsId());
+                    if (StrUtil.isNotBlank(productionNo.getPType())){
+                        majorProduction.setProduction(getProductionType(productionNo.getPType()));
+                    }else {
+                        majorProduction.setProduction("REPORT");
+                    }
+                    majorProduction.setName(productionNo.getName());
+                    majorProduction.setClientName(productionNo.getPrincipal());
+                    majorProduction.setClientTel(productionNo.getPrincipalMobile());
+                    majorProduction.setClientAddress(productionNo.getPrincipalAddress());
+                    if (productionNo.getPriceDate()!=null){
+                        majorProduction.setValueTiming(DateUtils.dateToLocalDate(productionNo.getPriceDate()));
+                    }
+                    majorProduction.setEvaluateAcreage(productionNo.getArea());
+                    majorProduction.setEvaluateAmount(productionNo.getMoney());
+                    majorProduction.setEvaluatePrice(productionNo.getXPrice());
+                    majorProduction.setRepertoryInTime(productionNo.getBgInTime());
+                    majorProduction.setRepertoryOutTime(productionNo.getBgOutTime());
+                    majorProduction.setDelivery(productionNo.getDeliveryState());
+                    if (productionNo.getConfirmTime()!=null){
+                        majorProduction.setDeliveryDate(DateUtils.dateToLocalDate(productionNo.getConfirmTime()));
+                    }
+                    if (productionNo.getArchiveTime()!=null){
+                        majorProduction.setSaveFileDate(DateUtils.dateToLocalDate(productionNo.getArchiveTime()));
+                    }
+                    majorProduction.setStandardAmount(productionNo.getStandardPrice());
+                    majorProductionService.save(majorProduction);
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public Boolean updateProductionFund() {
+        List<OrderFund> orderFunds = orderFundService.getAllOrderFund();
+        for (OrderFund orderFund : orderFunds) {
+            List<ProductionFund> list = productionFundService.list(new LambdaQueryWrapper<ProductionFund>().eq(ProductionFund::getOrderFundId, orderFund.getId()));
+            if (list.size()==0){
+                ProductionFund pf = new ProductionFund();
+                pf.setOrderFundId(orderFund.getId());
+                pf.setBusinessType(MainBusinessEnum.MAJOR_BUSINESS.name());
+                pf.setBusinessId(orderFund.getBusinessId());
+                pf.setRealAmount(orderFund.getRealAmount());
+                pf.setProductionShouldAmount(orderFund.getShouldAmount());
+                pf.setBusinessId(orderFund.getBusinessId());
+                pf.setStandardAmount(orderFund.getStandardAmount());
+                pf.setProductionNo(orderFund.getReportNo());
+                pf.setCreated(orderFund.getCreated());
+                productionFundService.save(pf);
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public Boolean updateClaimProductionId() {
+        List<HisClaimProd> list = financeClaimService.updateClaimProductionId();
+        for (HisClaimProd hisClaimProd : list){
+            financeClaimService.update(new LambdaUpdateWrapper<FinanceClaim>().eq(BaseEntity::getId,hisClaimProd.getFcid()).set(FinanceClaim::getProductionFundId,hisClaimProd.getPid()));
+        }
+        return true;
+    }
+
 }

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

@@ -35,4 +35,10 @@ public interface IDyoaHistoryService {
     void fetchRealAmountClaimData();
 
     void fetchFinanceInvoiceRecord();
+
+    Boolean updateProductionFund();
+
+    Boolean updateClaimProductionId();
+
+    Boolean updateMajorProduction();
 }

+ 22 - 0
service/src/main/java/com/dayou/dyoa/task/FetchDyoaDataSchedule.java

@@ -56,4 +56,26 @@ public class FetchDyoaDataSchedule {
         dyoaHistoryService.fetchFinanceInvoiceRecord();
         log.info("同步财务开票数据完成");
     }
+
+    //每天凌晨06:30触发
+    @Scheduled(cron = "0 30 6 * * ?")
+    public void updateMajorProduction(){
+        dyoaHistoryService.updateMajorProduction();
+        log.info("同步大中型产品信息完成");
+    }
+
+    //每天凌晨06:40触发
+    @Scheduled(cron = "0 40 6 * * ?")
+    public void updateProductionFund(){
+        dyoaHistoryService.updateProductionFund();
+        log.info("更新产品应收款记录");
+    }
+
+    //每天凌晨06:50触发
+    @Scheduled(cron = "0 50 6 * * ?")
+    public void updateClaimProductionId(){
+        dyoaHistoryService.updateClaimProductionId();
+        log.info("更新实收款认领记录的产品收款id");
+    }
+
 }

+ 3 - 0
service/src/main/java/com/dayou/service/IFinanceClaimService.java

@@ -1,6 +1,7 @@
 package com.dayou.service;
 import com.dayou.dto.PersonalClaimDTO;
 import com.dayou.dto.RealFundAssetsStatDTO;
+import com.dayou.dto.history.HisClaimProd;
 import com.dayou.entity.FinanceClaim;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -88,4 +89,6 @@ public interface IFinanceClaimService extends IService<FinanceClaim> {
     Page<FinanceClaimsVO> financeClaimsList(Page page, FinanceClaimsVO financeClaimVO,String keyword);
 
     List<FinanceClaimsVO> exportList(FinanceClaimsVO financeClaimVO, String keyword);
+
+    List<HisClaimProd> updateClaimProductionId();
 }

+ 6 - 3
service/src/main/java/com/dayou/service/IOrderFundService.java

@@ -2,11 +2,10 @@ package com.dayou.service;
 import com.dayou.entity.OrderFund;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.web.multipart.MultipartFile;
+import com.dayou.enums.MainBusinessEnum;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -32,4 +31,8 @@ public interface IOrderFundService extends IService<OrderFund> {
 
 
         void updateRealAmount(Long orderFundId);
+
+    void createOrderFundWhenOpeningOrder(Long id, String orderId, String name, MainBusinessEnum mainBusinessEnum);
+
+        List<OrderFund> getAllOrderFund();
 }

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

@@ -41,4 +41,6 @@ public interface IProductionFundService extends IService<ProductionFund> {
         List<ProductionFund> selectProductionFundIdByDyoaReportNo();
 
         List<ProductionFund> getProductionFundIdByOrderFundId();
+
+
 }

+ 6 - 0
service/src/main/java/com/dayou/service/impl/FinanceClaimServiceImpl.java

@@ -9,6 +9,7 @@ import com.dayou.common.BaseEntity;
 import com.dayou.dto.OrderReportDTO;
 import com.dayou.dto.PersonalClaimDTO;
 import com.dayou.dto.RealFundAssetsStatDTO;
+import com.dayou.dto.history.HisClaimProd;
 import com.dayou.entity.*;
 import com.dayou.enums.MainBusinessEnum;
 import com.dayou.exception.ErrorCode;
@@ -255,6 +256,11 @@ public class FinanceClaimServiceImpl extends ServiceImpl<FinanceClaimMapper, Fin
         return financeClaimMapper.exportList(financeClaimVO,keyword);
     }
 
+    @Override
+    public List<HisClaimProd> updateClaimProductionId() {
+        return financeClaimMapper.updateClaimProductionId();
+    }
+
 
     @Override
     public synchronized BigDecimal checkFinanceFound(Long financeFundId) {

+ 1 - 1
service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java

@@ -384,7 +384,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
                     productionFund.setOrderFundId(orderReportDTO.getOrderFundId());
                     productionFund.setBusinessId(production.getMajorId());
                     productionFund.setProductionNo(production.getReportNo());
-                    productionFund.setRealAmount(orderReportDTO.getThisTimeAmount());
+                    productionFund.setRealAmount(thisTimeAmount);
                     productionFund.setEvaluateAmount(production.getEvaluateAmount());
                     productionFund.setStandardAmount(production.getStandardAmount());
                     productionFundService.save(productionFund);

+ 9 - 2
service/src/main/java/com/dayou/service/impl/MajorServiceImpl.java

@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 import static com.dayou.common.Constants.BY_TURNS;
+import static com.dayou.enums.GlobalConfigEnum.DepartmentTurns.MAJOR_BUSINESS;
 
 /**
  * <p>
@@ -66,6 +67,9 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
     @Autowired
     private IBusinessNumberService businessNumberService;
 
+    @Autowired
+    private IOrderFundService orderFundService;
+
     @Override
     @SuppressWarnings("unchecked")
     public Page<MajorVO> selectPage(Page page, MajorVO major,String keyword){
@@ -97,7 +101,10 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
         //保存业务数据
         this.save(major);
         //业务下单
-        return workFlowService.openingOrder(MainBusinessEnum.MAJOR_BUSINESS,major.getId(),null, major.getRemark());
+        WorkNodeCommit commit = workFlowService.openingOrder(MainBusinessEnum.MAJOR_BUSINESS, major.getId(), null, major.getRemark());
+        //下单完成后创建订单应收款记录
+        orderFundService.createOrderFundWhenOpeningOrder(major.getId(),major.getOrderId(),major.getName(),MainBusinessEnum.MAJOR_BUSINESS);
+        return commit;
 
     }
 
@@ -253,7 +260,7 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
         }
 
 
-        GlobalConfig currentSorted = globalConfigService.getGlobalConfig(GlobalConfigEnum.DEPARTMENT_TURNS.name(), GlobalConfigEnum.DepartmentTurns.MAJOR_BUSINESS.name());
+        GlobalConfig currentSorted = globalConfigService.getGlobalConfig(GlobalConfigEnum.DEPARTMENT_TURNS.name(), MAJOR_BUSINESS.name());
 
         Integer currentSortedIndex = Integer.valueOf(StrUtil.isBlank(currentSorted.getValue())?"0":currentSorted.getValue());
 

+ 3 - 1
service/src/main/java/com/dayou/service/impl/MessageServiceImpl.java

@@ -275,10 +275,12 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
     @Override
     public void packagingNodeTodoReminder(WorkNodeCommit commit) {
         Long instanceNodeId = commit.getInstanceNodeId();
+        String businessSubId = commit.getBusinessSubId();
+        String businessMinId = commit.getBusinessMinId();
         //
         TaskReminderVO taskReminderVO = workTaskRecordService.getTaskReminderInfo(instanceNodeId);
         //根据处理人查询
-        Long handlerId = workTaskRecordService.getHandlerIdByLastNode(taskReminderVO.getBusiness(), taskReminderVO.getBusinessId(), taskReminderVO.getBusinessSubId(), taskReminderVO.getBusinessMinId());
+        Long handlerId = workTaskRecordService.getHandlerIdByLastNode(taskReminderVO.getBusiness(), taskReminderVO.getBusinessId(), businessSubId, businessMinId);
         if (handlerId != null){
             Message message = new Message();
             message.setTitle(NODE_TODO_REMINDER.getName());

+ 17 - 15
service/src/main/java/com/dayou/service/impl/OrderFundServiceImpl.java

@@ -3,33 +3,20 @@ package com.dayou.service.impl;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.dayou.common.BaseEntity;
 import com.dayou.entity.OrderFund;
-import com.dayou.mapper.FinanceClaimMapper;
+import com.dayou.enums.MainBusinessEnum;
 import com.dayou.mapper.OrderFundMapper;
 import com.dayou.service.IFinanceClaimService;
 import com.dayou.service.IOrderFundService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.dayou.utils.ExcelUtil;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
+import java.util.Collections;
 import java.util.List;
-import java.util.ArrayList;
-import org.springframework.transaction.annotation.Transactional;
-import com.dayou.enums.BatchTaskTypeEnum;
 
 /**
  * <p>
@@ -90,5 +77,20 @@ public class OrderFundServiceImpl extends ServiceImpl<OrderFundMapper, OrderFund
                 .eq(BaseEntity::getId,orderFundId));
     }
 
+    @Override
+    public void createOrderFundWhenOpeningOrder(Long id, String orderId, String name, MainBusinessEnum mainBusinessEnum) {
+        OrderFund orderFund = new OrderFund();
+        orderFund.setBusinessType(mainBusinessEnum.name());
+        orderFund.setOrderId(orderId);
+        orderFund.setBusinessId(id);
+        orderFund.setOrderName(name);
+        this.save(orderFund);
+    }
+
+    @Override
+    public List<OrderFund> getAllOrderFund() {
+        return orderFundMapper.getAllOrderFund();
+    }
+
 
 }

+ 8 - 0
service/src/main/java/com/dayou/service/impl/ProductionFundServiceImpl.java

@@ -1,11 +1,15 @@
 package com.dayou.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.dayou.common.BaseEntity;
 import com.dayou.entity.FinanceClaim;
 import com.dayou.entity.OrderFund;
 import com.dayou.entity.ProductionFund;
+import com.dayou.enums.MainBusinessEnum;
+import com.dayou.mapper.OrderFundMapper;
 import com.dayou.mapper.ProductionFundMapper;
 import com.dayou.service.IFinanceClaimService;
 import com.dayou.service.IOrderFundService;
@@ -69,6 +73,8 @@ public class ProductionFundServiceImpl extends ServiceImpl<ProductionFundMapper,
     private IOrderFundService orderFundService;
     @Autowired
     private ProductionFundMapper productionFundMapper;
+    @Autowired
+    private OrderFundMapper orderFundMapper;
 
     @Override
     @SuppressWarnings("unchecked")
@@ -201,4 +207,6 @@ public class ProductionFundServiceImpl extends ServiceImpl<ProductionFundMapper,
     public List<ProductionFund> getProductionFundIdByOrderFundId() {
         return productionFundMapper.getProductionFundIdByOrderFundId();
     }
+
+
 }