Bläddra i källkod

大中型提成申报

wucl 1 år sedan
förälder
incheckning
a2365f6943
40 ändrade filer med 1602 tillägg och 99 borttagningar
  1. 87 0
      biz-base/src/main/java/com/dayou/controller/BusinessCommissionRateController.java
  2. 3 3
      biz-base/src/main/java/com/dayou/controller/BusinessProductionController.java
  3. 82 0
      biz-base/src/main/java/com/dayou/controller/CommissionDeclareController.java
  4. 19 0
      biz-base/src/main/java/com/dayou/controller/FinanceClaimController.java
  5. 51 51
      biz-base/src/test/java/TestAssets.java
  6. 107 0
      biz-base/src/test/java/history/SyncHistoryTest.java
  7. 24 0
      dao/src/main/java/com/dayou/mapper/BusinessCommissionRateMapper.java
  8. 22 0
      dao/src/main/java/com/dayou/mapper/CommissionDeclareMapper.java
  9. 6 0
      dao/src/main/java/com/dayou/mapper/FinanceClaimMapper.java
  10. 1 1
      dao/src/main/java/com/dayou/mapper/MajorProductionMapper.java
  11. 58 0
      dao/src/main/resources/mapper/BusinessCommissionRateMapper.xml
  12. 170 0
      dao/src/main/resources/mapper/CommissionDeclareMapper.xml
  13. 87 0
      dao/src/main/resources/mapper/FinanceClaimMapper.xml
  14. 1 1
      dao/src/main/resources/mapper/FinanceRealFundMapper.xml
  15. 9 10
      dao/src/main/resources/mapper/MajorProductionMapper.xml
  16. 3 3
      dao/src/main/resources/mapper/ProductionFundMapper.xml
  17. 33 0
      domain/src/main/java/com/dayou/dto/CommissionDeclareDTO.java
  18. 5 0
      domain/src/main/java/com/dayou/dto/ReportDTO.java
  19. 24 0
      domain/src/main/java/com/dayou/dto/UserShareRate.java
  20. 81 0
      domain/src/main/java/com/dayou/entity/BusinessCommissionRate.java
  21. 58 0
      domain/src/main/java/com/dayou/entity/CommissionDeclare.java
  22. 12 0
      domain/src/main/java/com/dayou/entity/MajorProductionAllot.java
  23. 5 0
      domain/src/main/java/com/dayou/entity/ProductionFund.java
  24. 4 0
      domain/src/main/java/com/dayou/enums/MainBusinessEnum.java
  25. 3 1
      domain/src/main/java/com/dayou/enums/UserTypeEnum.java
  26. 8 1
      domain/src/main/java/com/dayou/enums/workflow/WorkflowNodeEnum.java
  27. 104 0
      domain/src/main/java/com/dayou/vo/CommissionDeclareVO.java
  28. 158 0
      domain/src/main/java/com/dayou/vo/RealFundMajorStatVO.java
  29. 33 0
      service/src/main/java/com/dayou/service/IBusinessCommissionRateService.java
  30. 28 0
      service/src/main/java/com/dayou/service/ICommissionDeclareService.java
  31. 4 0
      service/src/main/java/com/dayou/service/IFinanceClaimService.java
  32. 1 1
      service/src/main/java/com/dayou/service/IMajorProductionService.java
  33. 76 0
      service/src/main/java/com/dayou/service/impl/BusinessCommissionRateServiceImpl.java
  34. 96 0
      service/src/main/java/com/dayou/service/impl/CommissionDeclareServiceImpl.java
  35. 12 1
      service/src/main/java/com/dayou/service/impl/FinanceClaimServiceImpl.java
  36. 30 24
      service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java
  37. 2 0
      service/src/main/java/com/dayou/service/workflow/IWorkFlowService.java
  38. 40 0
      service/src/main/java/com/dayou/service/workflow/WorkFlowServiceImpl.java
  39. 17 1
      service/src/main/java/com/dayou/workflow/config/WorkNodeProcessable.java
  40. 38 1
      sql/update_sql.sql

+ 87 - 0
biz-base/src/main/java/com/dayou/controller/BusinessCommissionRateController.java

@@ -0,0 +1,87 @@
+package com.dayou.controller;
+
+import com.dayou.common.PullDownModel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.web.bind.annotation.RestController;
+import com.dayou.service.IBusinessCommissionRateService;
+import com.dayou.entity.BusinessCommissionRate;
+import com.dayou.common.RestResponse;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 非土规业务提成比例
+ *
+ * @author wucl
+ * @since 2024-05-11
+ */
+@RestController
+@RequestMapping("businessCommissionRate")
+@Slf4j
+public class BusinessCommissionRateController extends BaseController {
+    @Autowired
+    private IBusinessCommissionRateService businessCommissionRateService;
+
+    /**
+    * 非土规业务提成比例列表
+    */
+    @GetMapping("")
+    public RestResponse<Page<BusinessCommissionRate>> page(BusinessCommissionRate businessCommissionRate, Page page){
+        Page<BusinessCommissionRate> pages=businessCommissionRateService.selectPage(page,businessCommissionRate);
+        return RestResponse.data(pages);
+    }
+
+    /**
+     * 非土规业务提成比例详情
+     */
+    @GetMapping("/{id}")
+    public RestResponse<BusinessCommissionRate> detail(@PathVariable Long id){
+        BusinessCommissionRate xBusinessCommissionRate =businessCommissionRateService.detail(id);
+        return RestResponse.data(xBusinessCommissionRate);
+     }
+
+    /**
+     * 非土规业务提成比例新增
+     */
+    @PostMapping("")
+    public RestResponse<Boolean> save(@RequestBody BusinessCommissionRate businessCommissionRate) {
+        Boolean ret = businessCommissionRateService.add(businessCommissionRate);
+        return RestResponse.data(ret);
+    }
+
+    /**
+     * 非土规业务提成比例更新
+     */
+    @PutMapping("")
+    public RestResponse<Boolean> update(@RequestBody BusinessCommissionRate businessCommissionRate) {
+        Boolean ret = businessCommissionRateService.update(businessCommissionRate);
+        return RestResponse.data(ret);
+    }
+
+    /**
+     * 非土规业务提成比例删除
+     */
+    @DeleteMapping("/{id}")
+    public RestResponse<Boolean> delete(@PathVariable Long id) {
+        Boolean ret = businessCommissionRateService.delete(id);
+        return RestResponse.data(ret);
+    }
+
+    /**
+     * 获取申报业务子类
+     * @param businessType
+     * @param userType
+     * @return
+     */
+    @GetMapping("/cate/{businessType}/{userType}")
+    public RestResponse<List<PullDownModel>> getBusinessCate(@PathVariable("businessType") String businessType,@PathVariable("userType")String userType){
+        List<PullDownModel> cate =   businessCommissionRateService.getBusinessCate(businessType,userType);
+        return RestResponse.data(cate);
+    }
+
+}
+

+ 3 - 3
biz-base/src/main/java/com/dayou/controller/BusinessProductionController.java

@@ -44,9 +44,9 @@ public class BusinessProductionController{
     /**
      * 大中型产品包
      */
-    @GetMapping("/bag/major/{id}/{reportNo}")
-    public RestResponse<OrderProductionsBag> productionBag(@PathVariable("id") Long id,@PathVariable("reportNo") String reportNo){
-        OrderProductionsBag bag = majorProductionService.productionBag(id,reportNo);
+    @GetMapping("/bag/major/{id}")
+    public RestResponse<OrderProductionsBag> productionBag(@PathVariable("id") Long id){
+        OrderProductionsBag bag = majorProductionService.productionBag(id);
         return RestResponse.data(bag);
     }
 

+ 82 - 0
biz-base/src/main/java/com/dayou/controller/CommissionDeclareController.java

@@ -0,0 +1,82 @@
+package com.dayou.controller;
+
+import com.dayou.dto.CommissionDeclareDTO;
+import com.dayou.vo.CommissionDeclareVO;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.web.bind.annotation.RestController;
+import com.dayou.controller.BaseController;
+import com.dayou.service.ICommissionDeclareService;
+import com.dayou.entity.CommissionDeclare;
+import com.dayou.common.RestResponse;
+import org.springframework.web.bind.annotation.*;
+import com.dayou.utils.ConvertUtil;
+import com.dayou.utils.HttpKit;
+import com.dayou.exception.ErrorCode;
+import java.util.Date;
+import java.util.List;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springframework.http.MediaType;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+
+/**
+ * 提成申报
+ *
+ * @author wucl
+ * @since 2024-05-15
+ */
+@RestController
+@RequestMapping("commissionDeclare")
+@Slf4j
+public class CommissionDeclareController extends BaseController {
+    @Autowired
+    private ICommissionDeclareService commissionDeclareService;
+
+    /**
+    * 大中型市场人员提成申报列表
+    */
+    @GetMapping("/major/market")
+    public RestResponse<Page<CommissionDeclareVO>> majorMarketDeclarePage(CommissionDeclareVO commissionDeclare, Page page){
+        Page<CommissionDeclareVO> pages=commissionDeclareService.majorMarketDeclarePage(page,commissionDeclare);
+        return RestResponse.data(pages);
+    }
+
+    /**
+     * 大中型评估人员提成申报列表
+     */
+    @GetMapping("/major/evaluate")
+    public RestResponse<Page<CommissionDeclareVO>> majorEvaluateDeclarePage(CommissionDeclareVO commissionDeclare, Page page){
+        Page<CommissionDeclareVO> pages=commissionDeclareService.majorEvaluateDeclarePage(page,commissionDeclare);
+        return RestResponse.data(pages);
+    }
+
+
+    /**
+     * 大中型提成申报
+     * @param declareDTO
+     * @return
+     */
+    @PostMapping("/major")
+    public RestResponse<Boolean> commissionDeclare(@RequestBody @Valid CommissionDeclareDTO declareDTO){
+        Boolean ret = commissionDeclareService.commissionDeclare(declareDTO);
+        return RestResponse.data(ret);
+    }
+
+    /**
+     * 提成申报删除
+     */
+    @DeleteMapping("/{id}")
+    public RestResponse<Boolean> delete(@PathVariable Long id) {
+        Boolean ret = commissionDeclareService.delete(id);
+        return RestResponse.data(ret);
+    }
+
+
+}
+

+ 19 - 0
biz-base/src/main/java/com/dayou/controller/FinanceClaimController.java

@@ -2,6 +2,7 @@ package com.dayou.controller;
 
 import com.dayou.annotation.IgnoreAuth;
 import com.dayou.vo.FinanceClaimVO;
+import com.dayou.vo.RealFundMajorStatVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -115,5 +116,23 @@ public class FinanceClaimController extends BaseController {
         Boolean ret = financeClaimService.personalClaimByTemplate(file,financeFundId);
         return RestResponse.data(ret);
     }
+
+    /**
+     * 大中型实收款统计列表
+     */
+    @GetMapping("/major/stat")
+    public RestResponse<Page<RealFundMajorStatVO>> majorStat(RealFundMajorStatVO majorStat, Page page){
+        Page<RealFundMajorStatVO> pages=financeClaimService.majorStat(page,majorStat);
+        return RestResponse.data(pages);
+    }
+
+    /**
+     * 大中型实收款统计列表 导出
+     */
+    @GetMapping("/major/stat/export")
+    public void majorStatExport(RealFundMajorStatVO majorStat, HttpServletResponse response) throws IOException {
+        List<RealFundMajorStatVO> list = financeClaimService.majorStatExport(majorStat);
+        exportPlus(response,"大中型实收款列表",list,RealFundMajorStatVO.class);
+    }
 }
 

+ 51 - 51
biz-base/src/test/java/TestAssets.java

@@ -1,51 +1,51 @@
-import com.dayou.BaseApplication;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-@Slf4j
-@SpringBootTest(classes = BaseApplication.class)
-@RunWith(value = SpringJUnit4ClassRunner.class)
-public class TestAssets {
-
-    @Test
-    public void test1(){
-        // 示例字符串列表,包含被短横线-后面的数字
-        List<String> stringList = Arrays.asList("item-123", "product-45号", "sample-6789号", "code-109898号");
-
-        // 初始化最大数字为Integer.MIN_VALUE
-        int maxNumber = Integer.MIN_VALUE;
-
-        // 正则表达式,用于匹配短横线-后面的数字
-        Pattern pattern = Pattern.compile("-(\\d+)");
-
-        // 遍历字符串列表
-        for (String str : stringList) {
-            // 创建匹配器
-            Matcher matcher = pattern.matcher(str);
-            // 在字符串中查找短横线后面的数字
-            while (matcher.find()) {
-                // 将找到的数字字符串转换为整数
-                int number = Integer.parseInt(matcher.group(1));
-                // 更新最大数字
-                if (number > maxNumber) {
-                    maxNumber = number;
-                }
-            }
-        }
-
-        // 输出最大数字
-        if (maxNumber == Integer.MIN_VALUE) {
-            System.out.println("没有找到数字或者输入的列表为空。");
-        } else {
-            System.out.println("最大的数字是: " + maxNumber);
-        }
-    }
-}
+//import com.dayou.BaseApplication;
+//import lombok.extern.slf4j.Slf4j;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+//
+//import java.util.Arrays;
+//import java.util.List;
+//import java.util.regex.Matcher;
+//import java.util.regex.Pattern;
+//
+//@Slf4j
+//@SpringBootTest(classes = BaseApplication.class)
+//@RunWith(value = SpringJUnit4ClassRunner.class)
+//public class TestAssets {
+//
+//    @Test
+//    public void test1(){
+//        // 示例字符串列表,包含被短横线-后面的数字
+//        List<String> stringList = Arrays.asList("item-123", "product-45号", "sample-6789号", "code-109898号");
+//
+//        // 初始化最大数字为Integer.MIN_VALUE
+//        int maxNumber = Integer.MIN_VALUE;
+//
+//        // 正则表达式,用于匹配短横线-后面的数字
+//        Pattern pattern = Pattern.compile("-(\\d+)");
+//
+//        // 遍历字符串列表
+//        for (String str : stringList) {
+//            // 创建匹配器
+//            Matcher matcher = pattern.matcher(str);
+//            // 在字符串中查找短横线后面的数字
+//            while (matcher.find()) {
+//                // 将找到的数字字符串转换为整数
+//                int number = Integer.parseInt(matcher.group(1));
+//                // 更新最大数字
+//                if (number > maxNumber) {
+//                    maxNumber = number;
+//                }
+//            }
+//        }
+//
+//        // 输出最大数字
+//        if (maxNumber == Integer.MIN_VALUE) {
+//            System.out.println("没有找到数字或者输入的列表为空。");
+//        } else {
+//            System.out.println("最大的数字是: " + maxNumber);
+//        }
+//    }
+//}

+ 107 - 0
biz-base/src/test/java/history/SyncHistoryTest.java

@@ -0,0 +1,107 @@
+//package history;
+//
+//import com.alibaba.fastjson.JSON;
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONException;
+//import com.alibaba.fastjson.JSONObject;
+//import com.dayou.BaseApplication;
+//import com.dayou.dto.history.HisMajorOrder;
+//import com.dayou.utils.HttpKit;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.http.HttpEntity;
+//import org.apache.http.HttpResponse;
+//import org.apache.http.client.HttpClient;
+//import org.apache.http.client.methods.HttpGet;
+//import org.apache.http.client.methods.HttpPost;
+//import org.apache.http.impl.client.DefaultHttpClient;
+//import org.junit.runner.RunWith;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+//
+//import java.io.BufferedReader;
+//import java.io.IOException;
+//import java.io.InputStreamReader;
+//import java.io.PrintWriter;
+//import java.net.HttpURLConnection;
+//import java.net.URL;
+//import java.net.URLConnection;
+//import java.util.Arrays;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.regex.Matcher;
+//import java.util.regex.Pattern;
+//
+///**
+// * 类说明:
+// *
+// * @author: wucl
+// * @since: 2024/5/7
+// * created with IntelliJ IDEA.
+// */
+//@Slf4j
+//@SpringBootTest(classes = BaseApplication.class)
+//@RunWith(value = SpringJUnit4ClassRunner.class)
+//public class SyncHistoryTest {
+//
+//    private static final String HISTORY_MAJOR_ORDER_URL = "http://noa.scdayou.com/dyoa/order/pageQuery";
+//
+//    private static final String HISTORY_LOGIN_URL = "http://noa.scdayou.com/login";
+//
+//    private static String COOKIE ;
+//
+//
+//    public static void main(String[] args) {
+//        COOKIE = historySystemLogin();
+//        syncMajorOrderTest();
+////        try {
+////            JSONObject jsonObject = JSON.parseObject("<!DOCTYPE html>\n" +"<html>");
+////        } catch (JSONException e) {
+////            log.error("JSONException");
+////        }
+//    }
+//
+//    public static void syncMajorOrderTest(){
+//        Map<String,Object> params = new HashMap<>();
+//        params.put("limit","15");
+//        params.put("orderBy","-createdDatetime");
+//        params.put("start","0");
+//        String respond = HttpKit.sendPost(HISTORY_MAJOR_ORDER_URL, params,COOKIE);
+//        JSONObject jsonObject = JSON.parseObject(respond);
+//        JSONObject data = jsonObject.getJSONObject("data");
+//        JSONArray data1 = data.getJSONArray("data");
+//        List<HisMajorOrder> hisMajorOrders = data1.toJavaList(HisMajorOrder.class);
+//        log.info(hisMajorOrders.toString());
+//    }
+//
+//    public static String historySystemLogin(){
+//
+//        try {
+//            // 创建HttpClient对象
+//            HttpClient httpClient = new DefaultHttpClient();
+//
+//            // 创建HttpGet请求对象
+//            HttpPost httpPost = new HttpPost(HISTORY_LOGIN_URL+"?loginName=admin&password=ABC666000");
+//
+//            // 发送请求并获取响应
+//            HttpResponse response = httpClient.execute(httpPost);
+//
+//            // 获取cookie
+//            String cookies = Arrays.toString(response.getHeaders("Set-Cookie"));
+//            if (cookies != null) {
+//                String pattern = "(JSESSIONID)(.*?)( )";
+//                Pattern r = Pattern.compile(pattern);
+//                // 创建 matcher 对象
+//                Matcher m = r.matcher(cookies);
+//                if (m.find()) {
+//                    return m.group(0);
+//                }
+//            }
+//            // 关闭连接
+//            httpClient.getConnectionManager().shutdown();
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        return null;
+//    }
+//}

+ 24 - 0
dao/src/main/java/com/dayou/mapper/BusinessCommissionRateMapper.java

@@ -0,0 +1,24 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.common.PullDownModel;
+import com.dayou.entity.BusinessCommissionRate;
+import com.dayou.dao.CustomBaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 非土规业务提成比例 Mapper 接口
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-11
+ */
+public interface BusinessCommissionRateMapper extends CustomBaseMapper<BusinessCommissionRate> {
+
+    Page<BusinessCommissionRate> page(Page page, @Param("rate") BusinessCommissionRate businessCommissionRate);
+
+    List<PullDownModel> getBusinessCate(@Param("businessType")String businessType, @Param("userType")String userType);
+}

+ 22 - 0
dao/src/main/java/com/dayou/mapper/CommissionDeclareMapper.java

@@ -0,0 +1,22 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.entity.CommissionDeclare;
+import com.dayou.dao.CustomBaseMapper;
+import com.dayou.vo.CommissionDeclareVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 提成申报 Mapper 接口
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-15
+ */
+public interface CommissionDeclareMapper extends CustomBaseMapper<CommissionDeclare> {
+
+    Page<CommissionDeclareVO> majorMarketDeclarePage(Page page, @Param("declare") CommissionDeclareVO commissionDeclare,@Param("marketUserId") Long marketUserId);
+
+    Page<CommissionDeclareVO> majorEvaluateDeclarePage(Page page, @Param("declare")CommissionDeclareVO commissionDeclare, @Param("evaluateUserId")Long currentEvaluateUserId);
+}

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

@@ -1,8 +1,10 @@
 package com.dayou.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.entity.FinanceClaim;
 import com.dayou.dao.CustomBaseMapper;
 import com.dayou.vo.FinanceClaimVO;
+import com.dayou.vo.RealFundMajorStatVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
@@ -23,4 +25,8 @@ public interface FinanceClaimMapper extends CustomBaseMapper<FinanceClaim> {
     BigDecimal getTotalClaimAmountByProductionFundId(@Param("productionFundId") Long productionFundId);
 
     BigDecimal residueAmount(@Param("financeFundId") Long financeFundId);
+
+    Page<RealFundMajorStatVO> majorStat(Page page,@Param("majorStat")  RealFundMajorStatVO majorStat);
+
+    List<RealFundMajorStatVO> majorStatExport(@Param("majorStat") RealFundMajorStatVO majorStat);
 }

+ 1 - 1
dao/src/main/java/com/dayou/mapper/MajorProductionMapper.java

@@ -28,7 +28,7 @@ public interface MajorProductionMapper extends CustomBaseMapper<MajorProduction>
 
     Page<MajorOrderVO> waitingClaim(Page page, @Param("vo") MajorOrderVO myOrder);
 
-    List<MajorProduction> getMajorProductionAboutFundId(@Param("majorId") Long majorId,@Param("reportNo") String reportNo);
+    List<MajorProduction> getMajorProductionAboutFundId(@Param("majorId") Long majorId);
 
     Page<TaskTodoVO> todoSaveFilePage(Page page, @Param("todoVO") TaskTodoVO todoVO,@Param("keyword") String keyword);
 

+ 58 - 0
dao/src/main/resources/mapper/BusinessCommissionRateMapper.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dayou.mapper.BusinessCommissionRateMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dayou.entity.BusinessCommissionRate">
+        <result column="id" property="id" />
+        <result column="deleted" property="deleted" />
+        <result column="created" property="created" />
+        <result column="modified" property="modified" />
+        <result column="business_type" property="businessType" />
+        <result column="user_type" property="userType" />
+        <result column="business_cate_id" property="businessCateId" />
+        <result column="min_ratio" property="minRatio" />
+        <result column="max_ratio" property="maxRatio" />
+        <result column="low_limit_amount" property="lowLimitAmount" />
+        <result column="top_limit_amount" property="topLimitAmount" />
+        <result column="quarter_ratio" property="quarterRatio" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id,
+        deleted,
+        created,
+        modified,
+        business_type, user_type, business_cate_id, min_ratio, max_ratio, low_limit_amount, top_limit_amount, quarter_ratio
+    </sql>
+
+    <select id="page" parameterType="com.dayou.entity.BusinessCommissionRate" resultType="com.dayou.entity.BusinessCommissionRate">
+        SELECT
+            bcr.id,
+            bcr.business_type, bcr.user_type, bcr.business_cate_id, bcr.min_ratio, bcr.max_ratio, bcr.low_limit_amount, bcr.top_limit_amount, bcr.quarter_ratio
+            ,dd.name as businessCateName FROM `business_commission_rate` bcr left join dict_data dd on bcr.business_cate_id = dd.id
+        where bcr.deleted = 0 and dd.deleted = 0 and bcr.business_type = #{rate.businessType} and bcr.user_type = #{rate.userType}
+        <if test="rate.businessCateId!=null">
+            and bcr.business_cate_id = #{rate.businessCateId}
+        </if>
+        order by bcr.created DESC
+    </select>
+
+    <select id="getBusinessCate" resultType="com.dayou.common.PullDownModel">
+        SELECT
+            bcr.id,
+            dd.name
+        FROM
+            business_commission_rate bcr
+                LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
+        WHERE
+            bcr.deleted = 0
+          AND dd.deleted = 0
+          AND bcr.business_type = #{businessType}
+          AND bcr.user_type = #{userType}
+        ORDER BY
+            bcr.id DESC
+    </select>
+
+</mapper>

+ 170 - 0
dao/src/main/resources/mapper/CommissionDeclareMapper.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dayou.mapper.CommissionDeclareMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dayou.entity.CommissionDeclare">
+        <result column="id" property="id" />
+        <result column="deleted" property="deleted" />
+        <result column="created" property="created" />
+        <result column="modified" property="modified" />
+        <result column="business_type" property="businessType" />
+        <result column="commission_rate_id" property="commissionRateId" />
+        <result column="business_id" property="businessId" />
+        <result column="production_id" property="productionId" />
+        <result column="declare_user_id" property="declareUserId" />
+        <result column="declare_result" property="declareResult" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id,
+        deleted,
+        created,
+        modified,
+        business_type, commission_rate_id, business_id, production_id, declare_user_id, declare_result
+    </sql>
+
+    <select id="majorMarketDeclarePage" parameterType="com.dayou.vo.CommissionDeclareVO" resultType="com.dayou.vo.CommissionDeclareVO">
+        select bus.*,dd.name as commissionType from (SELECT
+                                       IFNULL(cd.id,(SELECT id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) id,
+                                       IFNULL(cd.commission_rate_id,(SELECT commission_rate_id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) commission_rate_id,
+                                        IFNULL(cd.declare_result,(SELECT declare_result from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) declare_result,
+                                       major.*
+                                   FROM
+                                       (
+                                           SELECT
+                                               m.id AS businessId,
+                                               mp.id AS productionId,
+                                               ifnull( mp.id, m.id ) AS mId,
+                                               m.NAME AS orderName,
+                                               m.order_id,
+                                               m.business_object_type,
+                                               m.bailor_contact_name,
+                                               m.bailor_contact_tel,
+                                               m.bailor,
+                                               m.created AS orderCreated,
+                                               u.NAME AS clientManager,
+                                               u1.NAME AS principal,
+                                               cc1.NAME AS clienteleName,
+                                               cc2.NAME AS clienteleSubName,
+                                               mp.NAME,
+                                               mp.report_no ,
+                                               mp.created
+                                           FROM
+                                               major m
+                                                   LEFT JOIN ( SELECT id, NAME, major_id, report_no,created FROM major_production WHERE deleted = 0 ) mp ON m.id = mp.major_id
+                                                   LEFT JOIN USER u ON u.id = m.client_manager_id
+                                                   LEFT JOIN USER u1 ON u1.id = m.principal_id
+                                                   LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
+                                                   LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
+                                           WHERE
+                                               m.deleted = 0
+                                             AND m.client_manager_id = #{marketUserId}
+                                       ) major
+                                           LEFT JOIN ( SELECT id, ifnull( production_id, business_id ) AS xId, commission_rate_id,declare_result FROM commission_declare WHERE deleted = 0 ) cd ON major.mId = cd.xId) bus left join business_commission_rate bcr on
+            bus.commission_rate_id = bcr.id left join dict_data dd on dd.id = bcr.business_cate_id
+                            <where>
+                                <if test="declare!=null and declare.orderId!=null and declare.orderId!=''">
+                                        and bus.order_id like concat ('%',#{declare.orderId},'%')
+                                </if>
+                                <if test="declare!=null and declare.name!=null and declare.name!=''">
+                                    and (bus.orderName like concat ('%',#{declare.name},'%') or bus.name like concat ('%',#{declare.name},'%') )
+                                </if>
+                                <if test="declare!=null and declare.reportNo!=null and declare.reportNo!=''">
+                                    and bus.report_no like concat ('%',#{declare.reportNo},'%')
+                                </if>
+                                <if test="declare!=null and declare.commissionRateId!=null ">
+                                    and bus.commission_rate_id = #{declare.commissionRateId}
+                                </if>
+                                <if test="declare!=null and declare.declareType!=null and declare.declareType==true">
+                                    and bus.productionId is not null
+                                </if>
+                                <if test="declare!=null and declare.declareType!=null and declare.declareType==false">
+                                    and bus.productionId is null
+                                </if>
+                                <if test="declare!=null and declare.result!=null and declare.result==0">
+                                    and bus.declare_result is null
+                                </if>
+                                <if test="declare!=null and declare.result!=null and declare.result==1">
+                                    and bus.declare_result=1
+                                </if>
+                                <if test="declare!=null and declare.result!=null and declare.result==2">
+                                    and  bus.declare_result=0
+                                </if>
+                            </where>
+        order by bus.created DESC ,bus.orderCreated DESC
+    </select>
+
+
+    <select id="majorEvaluateDeclarePage" parameterType="com.dayou.vo.CommissionDeclareVO" resultType="com.dayou.vo.CommissionDeclareVO">
+        select bus.*,dd.name as commissionType from (SELECT
+        IFNULL(cd.id,(SELECT id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) id,
+        IFNULL(cd.commission_rate_id,(SELECT commission_rate_id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) commission_rate_id,
+        IFNULL(cd.declare_result,(SELECT declare_result from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null) ) declare_result,
+        major.*
+        FROM
+        (
+        SELECT
+        m.id AS businessId,
+        mp.id AS productionId,
+        ifnull( mp.id, m.id ) AS mId,
+        m.NAME AS orderName,
+        m.order_id,
+        m.business_object_type,
+        m.bailor_contact_name,
+        m.bailor_contact_tel,
+        m.bailor,
+        m.created AS orderCreated,
+        u.NAME AS clientManager,
+        u1.NAME AS principal,
+        cc1.NAME AS clienteleName,
+        cc2.NAME AS clienteleSubName,
+        mp.NAME,
+        mp.report_no ,
+        mp.created
+        FROM
+        major m
+        LEFT JOIN ( SELECT id, NAME, major_id, report_no,created FROM major_production WHERE deleted = 0 ) mp ON m.id = mp.major_id
+        LEFT JOIN USER u ON u.id = m.client_manager_id
+        LEFT JOIN USER u1 ON u1.id = m.principal_id
+        LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
+        LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
+        WHERE
+        m.deleted = 0
+        AND m.principal_id = #{evaluateUserId}
+        ) major
+        LEFT JOIN ( SELECT id, ifnull( production_id, business_id ) AS xId, commission_rate_id,declare_result FROM commission_declare WHERE deleted = 0 ) cd ON major.mId = cd.xId) bus left join business_commission_rate bcr on
+        bus.commission_rate_id = bcr.id left join dict_data dd on dd.id = bcr.business_cate_id
+        <where>
+            <if test="declare!=null and declare.orderId!=null and declare.orderId!=''">
+                and bus.order_id like concat ('%',#{declare.orderId},'%')
+            </if>
+            <if test="declare!=null and declare.name!=null and declare.name!=''">
+                and (bus.orderName like concat ('%',#{declare.name},'%') or bus.name like concat ('%',#{declare.name},'%') )
+            </if>
+            <if test="declare!=null and declare.reportNo!=null and declare.reportNo!=''">
+                and bus.report_no like concat ('%',#{declare.reportNo},'%')
+            </if>
+            <if test="declare!=null and declare.commissionRateId!=null ">
+                and bus.commission_rate_id = #{declare.commissionRateId}
+            </if>
+            <if test="declare!=null and declare.declareType!=null and declare.declareType==true">
+                and bus.productionId is not null
+            </if>
+            <if test="declare!=null and declare.declareType!=null and declare.declareType==false">
+                and bus.productionId is null
+            </if>
+            <if test="declare!=null and declare.result!=null and declare.result==0">
+                and bus.declare_result is null
+            </if>
+            <if test="declare!=null and declare.result!=null and declare.result==1">
+                and bus.declare_result=1
+            </if>
+            <if test="declare!=null and declare.result!=null and declare.result==2">
+                and  bus.declare_result=0
+            </if>
+        </where>
+        order by bus.created DESC ,bus.orderCreated DESC
+    </select>
+</mapper>

+ 87 - 0
dao/src/main/resources/mapper/FinanceClaimMapper.xml

@@ -58,4 +58,91 @@
         WHERE
             id = #{financeFundId} and deleted = 0
     </select>
+
+    <sql id="majorStatQuery">
+        SELECT
+        f.*,
+        mp.NAME,
+        m.financial,
+        m.members,
+        mp.if_save_file,
+        mp.evaluate_amount,
+        u.NAME AS clientManager,
+        u1.NAME AS principal,
+        cc1.NAME AS clientName,
+        cc2.NAME AS clientSubName,
+        m.bailor,
+        frf.pay_datetime,
+        frf.payer,
+        u2.NAME AS claimUser,
+        d.name as evaluateDepartment,
+        (select GROUP_CONCAT(name SEPARATOR '、') from department where id in (select department_id from post where id in (select post_id from user_post where user_id = u.id))) as marketDepartment
+        FROM
+        (
+        SELECT
+        of.order_id,
+        pf.real_amount AS claimAmount,
+        pf.production_no as reportNo,
+        pf.production_type,
+        pf.created as claimDatetime,
+        pf.claim_id,
+        of.business_id
+        FROM
+        ( SELECT id, real_amount, production_no, production_type, order_fund_id, claim_id, created FROM production_fund WHERE business_type = "MAJOR_BUSINESS" AND deleted = 0 ) pf
+        LEFT JOIN order_fund of ON pf.order_fund_id = of.id
+        WHERE
+        of.business_type = 'MAJOR_BUSINESS'
+        AND of.deleted = 0
+        AND pf.real_amount != 0
+        ) f
+        LEFT JOIN major m ON f.business_id = m.id
+        LEFT JOIN USER u ON u.id = m.client_manager_id
+        LEFT JOIN USER u1 ON u1.id = m.principal_id
+        LEFT JOIN department d ON d.id = m.department_id
+        LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
+        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_claim fc ON fc.id = f.claim_id
+        LEFT JOIN finance_real_fund frf ON frf.id = fc.real_fund_id
+        LEFT JOIN ( SELECT major_id, report_no, evaluate_amount, if_save_file, NAME FROM major_production WHERE deleted = 0 ) mp ON ( mp.major_id = m.id AND mp.report_no = f.reportNo )
+        LEFT JOIN USER u2 ON u2.id = fc.claim_id
+        WHERE
+        m.deleted = 0
+        <if test="majorStat!=null and majorStat.orderId!=null and majorStat.orderId!='' ">
+            and f.order_id like concat ('%',#{majorStat.orderId},'%')
+        </if>
+        <if test="majorStat!=null and majorStat.reportNo!=null and majorStat.reportNo!='' ">
+            and f.reportNo like concat ('%',#{majorStat.reportNo},'%')
+        </if>
+        <if test="majorStat!=null and majorStat.startDate!=null and majorStat.startDate!='' ">
+            and f.claimDatetime &gt;= #{majorStat.startDate}
+        </if>
+        <if test="majorStat!=null and majorStat.endDate!=null and majorStat.endDate!='' ">
+            and f.claimDatetime &lt;= #{majorStat.endDate}
+        </if>
+        <if test="majorStat!=null and majorStat.principal!=null and majorStat.principal!='' ">
+            and u1.NAME like concat ('%',#{majorStat.principal},'%')
+        </if>
+        <if test="majorStat!=null and majorStat.claimAmount!=null and majorStat.claimAmount!='' ">
+            and f.claimAmount = #{majorStat.claimAmount}
+        </if>
+        <if test="majorStat!=null and majorStat.ifSaveFile!=null ">
+            and mp.if_save_file = #{majorStat.ifSaveFile}
+        </if>
+        <if test="majorStat!=null and majorStat.financial!=null ">
+            and m.financial = #{majorStat.financial}
+        </if>
+        <if test="majorStat!=null and majorStat.claimUser!=null and majorStat.claimUser!='' ">
+            and u2.NAME like concat ('%',#{majorStat.claimUser},'%')
+        </if>
+        ORDER BY
+        f.claimDatetime DESC
+    </sql>
+    <select id="majorStat" parameterType="com.dayou.vo.RealFundMajorStatVO" resultType="com.dayou.vo.RealFundMajorStatVO">
+        <include refid="majorStatQuery" />
+    </select>
+
+    <select id="majorStatExport" parameterType="com.dayou.vo.RealFundMajorStatVO" resultType="com.dayou.vo.RealFundMajorStatVO">
+        <include refid="majorStatQuery" />
+    </select>
 </mapper>

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

@@ -78,7 +78,7 @@
             ( frf.amount - ifnull(t.ca,0) ) AS notClaimAmount
         FROM
             finance_real_fund frf
-                LEFT JOIN ( SELECT real_fund_id,ifnull(sum(claim_amount),0) as ca  FROM finance_claim WHERE deleted = 0 and real_fund_id = #{realFundId} ) t ON t.real_fund_id = frf.id
+                INNER JOIN ( SELECT real_fund_id,ifnull(sum(claim_amount),0) as ca  FROM finance_claim WHERE deleted = 0 and real_fund_id = #{realFundId} ) t ON t.real_fund_id = frf.id
         WHERE
             frf.deleted = 0
     </select>

+ 9 - 10
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -246,8 +246,8 @@
     <select id="getMajorProductionAboutFundId" parameterType="java.lang.Long" resultType="com.dayou.entity.MajorProduction">
         SELECT
             mp.id,
-            pf.id as productionFundId,
-            pf.real_amount,
+            pf.id AS productionFundId,
+            sum(pf.real_amount) as realAmount,
             mp.production,
             mp.NAME,
             mp.client_name,
@@ -264,14 +264,13 @@
             mp.delivery
         FROM
             major_production mp
-                LEFT JOIN ( SELECT id, business_id, production_no,real_amount,production_type  FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON (
-                        mp.major_id = pf.business_id
-                    AND mp.report_no = pf.production_no and mp.production = pf.production_type) where mp.major_id = #{majorId} and mp.deleted = 0
-                and mp.name is not null
-                <if test="reportNo!=null and reportNo!=''">
-                    and mp.report_no = #{reportNo}
-                </if>
-                order by mp.id DESC
+                LEFT JOIN ( SELECT id, business_id, production_no, real_amount, production_type FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( mp.major_id = pf.business_id AND mp.report_no = pf.production_no AND mp.production = pf.production_type )
+        WHERE
+            mp.major_id = #{majorId} and mp.deleted = 0
+
+          AND mp.NAME IS NOT NULL
+        GROUP BY mp.id
+        ORDER BY mp.id DESC
     </select>
 
     <select id="todoSaveFilePage" parameterType="com.dayou.vo.TaskTodoVO" resultType="com.dayou.vo.TaskTodoVO">

+ 3 - 3
dao/src/main/resources/mapper/ProductionFundMapper.xml

@@ -36,19 +36,19 @@
 
     <select id="getProductionFundByOrderFundId" parameterType="java.lang.Long" resultType="com.dayou.dto.ReportDTO">
         SELECT
-            pf.id AS productionFundId,
             mp.id ,
             (case mp.production when 'STATEMENT' THEN '价值意见书' when 'REPORT' THEN '报告' else '复评函' end ) as productionType,
             mp.evaluate_amount,
-            pf.real_amount,
+            sum(pf.real_amount) as claimedAmount,
             pf.standard_amount,
             mp.report_no as businessSubId
         FROM
             ( SELECT id, business_id FROM order_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 AND id = #{orderFundId} ) orf
-                LEFT JOIN ( SELECT id, major_id, report_no, production, evaluate_amount FROM major_production WHERE  deleted = 0 and name is not null ) mp ON orf.business_id = mp.major_id
+                INNER JOIN ( SELECT id, major_id, report_no, production, evaluate_amount FROM major_production WHERE  deleted = 0 and name is not null ) mp ON orf.business_id = mp.major_id
                 LEFT JOIN ( SELECT id, business_id, production_no, order_fund_id, real_amount, standard_amount,production_type FROM production_fund WHERE deleted = 0 ) pf ON (
                         pf.business_id = mp.major_id
                     AND pf.production_no = mp.report_no and pf.production_type = mp.production)
+        GROUP BY mp.id
         order by  mp.report_no
     </select>
 </mapper>

+ 33 - 0
domain/src/main/java/com/dayou/dto/CommissionDeclareDTO.java

@@ -0,0 +1,33 @@
+package com.dayou.dto;
+
+import com.github.liangbaika.validate.annations.AbcValidate;
+import com.github.liangbaika.validate.enums.Check;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2024/5/15
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class CommissionDeclareDTO {
+
+    @AbcValidate(required = true,message = "主业务id不能为空",fun = Check.NotNull)
+    private Long businessId;
+
+    private Long productionId;
+
+    @AbcValidate(required = true,message = "业务类型不能为空",fun = Check.NotEmpty)
+    private String businessType;
+
+    @AbcValidate(required = true,message = "业务分类不能为空",fun = Check.NotNull)
+    private Long commissionRateId;
+
+    private List<UserShareRate> userShareRates;
+
+}

+ 5 - 0
domain/src/main/java/com/dayou/dto/ReportDTO.java

@@ -40,4 +40,9 @@ public class ReportDTO {
 
     private List<ProductionDTO> productions;
 
+    /**
+     * 已分配金额
+     */
+    private BigDecimal claimedAmount;
+
 }

+ 24 - 0
domain/src/main/java/com/dayou/dto/UserShareRate.java

@@ -0,0 +1,24 @@
+package com.dayou.dto;
+
+import com.github.liangbaika.validate.annations.AbcValidate;
+import com.github.liangbaika.validate.enums.Check;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2024/5/15
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class UserShareRate {
+
+    @AbcValidate(required = true,message = "用户不能为空",fun = Check.NotNull)
+    private Long userId;
+
+    @AbcValidate(required = true,message = "提成比例不能为空",fun = Check.NotNull)
+    private BigDecimal rate;
+}

+ 81 - 0
domain/src/main/java/com/dayou/entity/BusinessCommissionRate.java

@@ -0,0 +1,81 @@
+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;
+import com.dayou.annotation.ExcelSheet;
+import com.dayou.annotation.ExportCell;
+import com.dayou.annotation.ImportCell;
+/**
+ * <p>
+ * 非土规业务提成比例
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ExcelSheet(sheetName = "非土规业务提成比例")
+public class BusinessCommissionRate extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 字典数据表业务类型id
+     */
+    private String businessType;
+
+    /**
+     * 字典数据表人员类型id
+     */
+    private String userType;
+
+    /**
+     * 字典数据表业务子类id
+     */
+    private Long businessCateId;
+
+    /**
+     * 最小提成比例
+     */
+    @ImportCell
+    @ExportCell(columnName = "最小提成比例")
+    private BigDecimal minRatio;
+
+    /**
+     * 最大提成比例
+     */
+    @ImportCell
+    @ExportCell(columnName = "最大提成比例")
+    private BigDecimal maxRatio;
+
+    /**
+     * 提成下线金额
+     */
+    @ImportCell
+    @ExportCell(columnName = "提成下线金额")
+    private BigDecimal lowLimitAmount;
+
+    /**
+     * 提成上线金额
+     */
+    @ImportCell
+    @ExportCell(columnName = "提成上线金额")
+    private BigDecimal topLimitAmount;
+
+    /**
+     * 季度业绩提成比例
+     */
+    @ImportCell
+    @ExportCell(columnName = "季度业绩提成比例")
+    private BigDecimal quarterRatio;
+
+    /**
+     * 业务子类名称
+     */
+    @TableField(exist = false)
+    private String businessCateName;
+}

+ 58 - 0
domain/src/main/java/com/dayou/entity/CommissionDeclare.java

@@ -0,0 +1,58 @@
+package com.dayou.entity;
+import com.dayou.common.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import com.dayou.annotation.ExcelSheet;
+import com.dayou.annotation.ExportCell;
+import com.dayou.annotation.ImportCell;
+/**
+ * <p>
+ * 提成申报
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ExcelSheet(sheetName = "提成申报")
+public class CommissionDeclare extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 业务类型
+     */
+    @ImportCell
+    @ExportCell(columnName = "业务类型")
+    private String businessType;
+
+    /**
+     * business_commission_rate 表id
+     */
+    private Long commissionRateId;
+
+    /**
+     * 业务id
+     */
+    private Long businessId;
+
+    /**
+     * 产品id
+     */
+    private Long productionId;
+
+    /**
+     * 申报人id
+     */
+    private Long declareUserId;
+
+    /**
+     * 审批结果(0:驳回,1:通过)
+     */
+    @ImportCell
+    @ExportCell(columnName = "审批结果(0:驳回,1:通过)")
+    private Boolean declareResult;
+
+
+}

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

@@ -24,6 +24,11 @@ public class MajorProductionAllot extends BaseEntity {
     private static final long serialVersionUID=1L;
 
     /**
+     * 大中型业务id
+     */
+    private Long majorId;
+
+    /**
      * 大中型产品id
      */
     private Long majorProductionId;
@@ -47,7 +52,14 @@ public class MajorProductionAllot extends BaseEntity {
     @ExportCell(columnName = "项目负责人")
     private Boolean isPrincipal;
 
+    /**
+     * 人员类型
+     */
+    private String userType;
+
     @TableField(exist = false)
     private String userName;
 
+
+
 }

+ 5 - 0
domain/src/main/java/com/dayou/entity/ProductionFund.java

@@ -48,6 +48,11 @@ public class ProductionFund extends BaseEntity {
     private String productionType;
 
     /**
+     * 认领记录id
+     */
+    private Long claimId;
+
+    /**
      * 订单收款id
      */
     private Long orderFundId;

+ 4 - 0
domain/src/main/java/com/dayou/enums/MainBusinessEnum.java

@@ -14,8 +14,12 @@ public enum MainBusinessEnum implements CodeMsgEnumInterface<String,String> {
     MAJOR_BUSINESS("MAJOR_BUSINESS","大中型业务"),
 
     PERSONAL_BUSINESS("PERSONAL_BUSINESS","个贷业务"),
+
     ASSET_BUSINESS("ASSET_BUSINESS","资产业务"),
 
+    COMMISSION_DECLARE_MAJOR_MARKET("COMMISSION_DECLARE_MAJOR_MARKET","大中型-提成申报-市场人员"),
+
+    COMMISSION_DECLARE_MAJOR_EVALUATE("COMMISSION_DECLARE_MAJOR_EVALUATE","大中型-提成申报-评估人员"),
     FINANCE_MANAGEMENT("FINANCE_MANAGEMENT","财务管理"),
 
     SETTING_MANAGEMENT("SETTING_MANAGEMENT","综合设置"),

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

@@ -11,7 +11,9 @@ public enum UserTypeEnum implements CodeMsgEnumInterface<String,String>{
 
     NORMAL("正式员工"),
     TRIAL("试用期员工"),
-    PRACTICE("实习员工")
+    PRACTICE("实习员工"),
+    MARKET("市场人员"),
+    EVALUATE("评估人员")
         ;
 
     public String getUserType() {

+ 8 - 1
domain/src/main/java/com/dayou/enums/workflow/WorkflowNodeEnum.java

@@ -66,7 +66,14 @@ public enum WorkflowNodeEnum implements CodeMsgEnumInterface<String,String>{
         PRODUCT_CHOICE("产品选择","PRODUCT_CHOICE"),
         SPOT_RECONNAISSANCE_DETERMINE_PRICE("勘察定价","SPOT_RECONNAISSANCE_DETERMINE_PRICE"),
         REPORT_CHOICE("报告选择","REPORT_CHOICE"),
-        ASSET_REPORT_TAKE_NO("资产报告取号","ASSET_REPORT_TAKE_NO");
+        ASSET_REPORT_TAKE_NO("资产报告取号","ASSET_REPORT_TAKE_NO"),
+
+        DEPARTMENT_LEADER_CHECK("部门经理审批","DEPARTMENT_LEADER_CHECK"),
+
+        VICE_MANAGER_CHECK("分管副总审批","VICE_MANAGER_CHECK"),
+
+        TOP_MANAGER_CHECK("总经理审批","TOP_MANAGER_CHECK"),
+
         ;
 
 

+ 104 - 0
domain/src/main/java/com/dayou/vo/CommissionDeclareVO.java

@@ -0,0 +1,104 @@
+package com.dayou.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 类说明:提成申报VO
+ *
+ * @author: wucl
+ * @since: 2024/5/14
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class CommissionDeclareVO {
+
+    /**
+     * 申报id
+     */
+    private Long id;
+
+    /**
+     * 主营业务id
+     */
+    private Long businessId;
+
+    /**
+     * 产品id
+     */
+    private Long productionId;
+
+    /**
+     * 订单号
+     */
+    private String orderId;
+
+    /**
+     * 订单名称
+     */
+    private String orderName;
+    /**
+     *项目名称
+     */
+    private String name;
+    /**
+     *报告号
+     */
+    private String reportNo;
+    /**
+     *评估对象类别
+     */
+    private String businessObjectType;
+    /**
+     *委托人
+     */
+    private String bailor;
+    /**
+     *委托联系人
+     */
+    private String bailorContactName;
+    /**
+     *委托人电话
+     */
+    private String bailorContactTel;
+    /**
+     *客户名称
+     */
+    private String clienteleName;
+    /**
+     *业务来源
+     */
+    private String clienteleSubName;
+    /**
+     *负责人
+     */
+    private String principal;
+    /**
+     *客户经理
+     */
+    private String clientManager;
+    /**
+     *下单时间
+     */
+    private Date orderCreated;
+    /**
+     *提成类型
+     */
+    private String commissionType;
+    /**
+     *审核状态
+     */
+    private Boolean declareResult;
+
+    private Long commissionRateId;
+
+    private Boolean declareType;
+
+    /**
+     * 查询用 审核状态
+     */
+    private Integer result;
+
+
+}

+ 158 - 0
domain/src/main/java/com/dayou/vo/RealFundMajorStatVO.java

@@ -0,0 +1,158 @@
+package com.dayou.vo;
+
+import com.dayou.annotation.Excel;
+import com.dayou.annotation.ExportCell;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 类说明:大中型实收款统计页VO
+ *
+ * @author: wucl
+ * @since: 2024/5/13
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class RealFundMajorStatVO {
+
+    /**
+     * 是否金融
+     */
+    @Excel(name = "分类",readConverterExp="true=金融,false=非金融")
+    private Boolean financial;
+
+    /**
+     *是否归档
+     */
+    @Excel(name = "是否归档",readConverterExp="true=已归档,false=未归档")
+    private Boolean ifSaveFile;
+
+    /**
+     * 项目编号
+     */
+    @Excel(name = "项目编号")
+    private String orderId;
+
+    /**
+     * 报告号
+     */
+    @Excel(name = "报告号")
+    private String reportNo;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称")
+    private String name;
+
+    /**
+     * 市场部门
+     */
+    @Excel(name = "市场部门")
+    private String marketDepartment;
+
+    /**
+     * 评估部门
+     */
+    @Excel(name = "评估部门")
+    private String evaluateDepartment;
+
+    /**
+     * 客户经理
+     */
+    @Excel(name = "客户经理")
+    private String clientManager;
+
+    /**
+     * 负责人
+     */
+    @Excel(name = "负责人")
+    private String principal;
+
+    /**
+     * 成员姓名集合
+     */
+    private List<String> membersName;
+
+    private String members;
+
+    /**
+     * 分配产值
+     */
+    private BigDecimal prodValue;
+
+    /**
+     * 入账时间
+     */
+    @Excel(name = "入账时间")
+    private LocalDate payDateTime;
+
+    /**
+     * 认领时间
+     */
+    @Excel(name = "认领时间",dateFormat="yyyy-MM-dd HH:mm:ss")
+    private Date claimDatetime;
+
+    /**
+     * 订单应收款
+     */
+    private BigDecimal orderShouldAmount;
+
+    /**
+     * 产品应收款
+     */
+    @Excel(name = "应收款(元)")
+    private BigDecimal prodShouldAmount;
+
+    /**
+     * 认领金额
+     */
+    @Excel(name = "认领金额(元)")
+    private BigDecimal claimAmount;
+    /**
+     * 认领人
+     */
+    @Excel(name = "认领人")
+    private String claimUser;
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String clientName;
+    /**
+     * 业务来源
+     */
+    @Excel(name = "业务来源")
+    private String clientSubName;
+    /**
+     * 委托人
+     */
+    @Excel(name = "委托人")
+    private String bailor;
+    /**
+     * 评估价值
+     */
+    @Excel(name = "评估价值(元)")
+    private BigDecimal evaluateAmount;
+    /**
+     * 付款方
+     */
+    @Excel(name = "付款方")
+    private String payer;
+    /**
+     * 产品类型
+     */
+    @Excel(name = "产品类型",readConverterExp="REPORT=报告,STATEMENT=意见书,LETTER=复评函")
+    private String productionType;
+
+    private String startDate;
+
+    private String endDate;
+
+
+
+}

+ 33 - 0
service/src/main/java/com/dayou/service/IBusinessCommissionRateService.java

@@ -0,0 +1,33 @@
+package com.dayou.service;
+import com.dayou.common.PullDownModel;
+import com.dayou.entity.BusinessCommissionRate;
+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 java.util.List;
+
+/**
+ * <p>
+ * 非土规业务提成比例 服务类
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-11
+ */
+public interface IBusinessCommissionRateService extends IService<BusinessCommissionRate> {
+
+        Page<BusinessCommissionRate> selectPage(Page page,BusinessCommissionRate businessCommissionRate);
+
+        BusinessCommissionRate detail(Long id);
+
+        Boolean add(BusinessCommissionRate businessCommissionRate);
+
+        Boolean update(BusinessCommissionRate businessCommissionRate);
+
+        Boolean delete(Long id);
+
+    List<PullDownModel> getBusinessCate(String businessType, String userType);
+}

+ 28 - 0
service/src/main/java/com/dayou/service/ICommissionDeclareService.java

@@ -0,0 +1,28 @@
+package com.dayou.service;
+import com.dayou.dto.CommissionDeclareDTO;
+import com.dayou.entity.CommissionDeclare;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.dayou.vo.CommissionDeclareVO;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.web.multipart.MultipartFile;
+/**
+ * <p>
+ * 提成申报 服务类
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-15
+ */
+public interface ICommissionDeclareService extends IService<CommissionDeclare> {
+
+
+    Boolean delete(Long id);
+
+    Page<CommissionDeclareVO> majorMarketDeclarePage(Page page, CommissionDeclareVO commissionDeclare);
+
+    Page<CommissionDeclareVO> majorEvaluateDeclarePage(Page page, CommissionDeclareVO commissionDeclare);
+
+    Boolean commissionDeclare(CommissionDeclareDTO declareDTO);
+}

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.dayou.vo.FinanceClaimVO;
+import com.dayou.vo.RealFundMajorStatVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -59,4 +60,7 @@ public interface IFinanceClaimService extends IService<FinanceClaim> {
     BigDecimal residueAmount(Long financeFundId);
 
 
+    Page<RealFundMajorStatVO> majorStat(Page page, RealFundMajorStatVO majorStat);
+
+    List<RealFundMajorStatVO> majorStatExport(RealFundMajorStatVO majorStat);
 }

+ 1 - 1
service/src/main/java/com/dayou/service/IMajorProductionService.java

@@ -58,7 +58,7 @@ public interface IMajorProductionService extends IService<MajorProduction> {
 
     Page<MajorOrderVO> waitingClaim(Page page, MajorOrderVO myOrder);
 
-    OrderProductionsBag productionBag(Long id,String reportNo);
+    OrderProductionsBag productionBag(Long id);
 
     Boolean confirmDelivery(TaskRecordDTO<Long> taskRecordDTO);
 

+ 76 - 0
service/src/main/java/com/dayou/service/impl/BusinessCommissionRateServiceImpl.java

@@ -0,0 +1,76 @@
+package com.dayou.service.impl;
+
+import com.dayou.common.PullDownModel;
+import com.dayou.entity.BusinessCommissionRate;
+import com.dayou.mapper.BusinessCommissionRateMapper;
+import com.dayou.service.IBusinessCommissionRateService;
+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.util.List;
+import java.util.ArrayList;
+import org.springframework.transaction.annotation.Transactional;
+import com.dayou.enums.BatchTaskTypeEnum;
+
+/**
+ * <p>
+ * 非土规业务提成比例 服务实现类
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-11
+ */
+@Service
+public class BusinessCommissionRateServiceImpl extends ServiceImpl<BusinessCommissionRateMapper, BusinessCommissionRate> implements IBusinessCommissionRateService {
+
+    @Autowired
+    private BusinessCommissionRateMapper businessCommissionRateMapper;
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Page<BusinessCommissionRate> selectPage(Page page,BusinessCommissionRate businessCommissionRate){
+        return businessCommissionRateMapper.page(page,businessCommissionRate);
+    }
+
+
+    @Override
+    public BusinessCommissionRate detail(Long id){
+        return this.getById(id);
+    }
+
+    @Override
+    public Boolean add(BusinessCommissionRate businessCommissionRate){
+        return  this.save(businessCommissionRate);
+    }
+
+    @Override
+    public Boolean update(BusinessCommissionRate businessCommissionRate){
+        return  this.updateById(businessCommissionRate);
+    }
+
+    @Override
+    public Boolean delete(Long id){
+        //逻辑删除
+        return this.removeById(id);
+    }
+
+    @Override
+    public List<PullDownModel> getBusinessCate(String businessType, String userType) {
+        List<PullDownModel> cate = businessCommissionRateMapper.getBusinessCate(businessType,userType);
+        return cate;
+    }
+}

+ 96 - 0
service/src/main/java/com/dayou/service/impl/CommissionDeclareServiceImpl.java

@@ -0,0 +1,96 @@
+package com.dayou.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.dayou.dto.CommissionDeclareDTO;
+import com.dayou.dto.UserShareRate;
+import com.dayou.entity.CommissionDeclare;
+import com.dayou.entity.MajorProductionAllot;
+import com.dayou.enums.MainBusinessEnum;
+import com.dayou.enums.UserTypeEnum;
+import com.dayou.mapper.CommissionDeclareMapper;
+import com.dayou.service.ICommissionDeclareService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.service.IMajorProductionAllotService;
+import com.dayou.service.workflow.IWorkFlowService;
+import com.dayou.utils.LoginContext;
+import com.dayou.vo.CommissionDeclareVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 提成申报 服务实现类
+ * </p>
+ *
+ * @author wucl
+ * @since 2024-05-15
+ */
+@Service
+public class CommissionDeclareServiceImpl extends ServiceImpl<CommissionDeclareMapper, CommissionDeclare> implements ICommissionDeclareService {
+
+
+    @Autowired
+    private CommissionDeclareMapper commissionDeclareMapper;
+
+    @Autowired
+    private IMajorProductionAllotService majorProductionAllotService;
+
+    @Autowired
+    private IWorkFlowService workFlowService;
+
+
+
+    @Override
+    public Boolean delete(Long id){
+        //逻辑删除
+        return this.removeById(id);
+    }
+
+    @Override
+    public Page<CommissionDeclareVO> majorMarketDeclarePage(Page page, CommissionDeclareVO commissionDeclare) {
+        Long currentMarketUserId = LoginContext.getCurrentUserId();
+        return commissionDeclareMapper.majorMarketDeclarePage(page,commissionDeclare,currentMarketUserId);
+    }
+
+    @Override
+    public Page<CommissionDeclareVO> majorEvaluateDeclarePage(Page page, CommissionDeclareVO commissionDeclare) {
+        Long currentEvaluateUserId = LoginContext.getCurrentUserId();
+        return commissionDeclareMapper.majorEvaluateDeclarePage(page,commissionDeclare,currentEvaluateUserId);
+    }
+
+    @Override
+    @Transactional
+    public Boolean commissionDeclare(CommissionDeclareDTO declareDTO) {
+        //保存申报记录
+        CommissionDeclare commissionDeclare = BeanUtil.copyProperties(declareDTO, CommissionDeclare.class);
+        commissionDeclare.setDeclareUserId(LoginContext.getCurrentUserId());
+        this.save(commissionDeclare);
+        //设置提成比例
+        List<UserShareRate> userShareRates = declareDTO.getUserShareRates();
+        List<MajorProductionAllot> collect = userShareRates.stream().map(x -> {
+            MajorProductionAllot majorProductionAllot = new MajorProductionAllot();
+            majorProductionAllot.setMajorId(declareDTO.getBusinessId());
+            majorProductionAllot.setMajorProductionId(declareDTO.getProductionId());
+            majorProductionAllot.setUserId(x.getUserId());
+            majorProductionAllot.setRatio(x.getRate());
+            majorProductionAllot.setUserType(UserTypeEnum.MARKET.name());
+            return majorProductionAllot;
+        }).collect(Collectors.toList());
+        majorProductionAllotService.saveBatch(collect);
+        //提交审核流程
+
+        Long businessId = declareDTO.getBusinessId();
+        Long productionId = declareDTO.getProductionId();
+        if (productionId==null){
+            productionId = businessId;
+        }
+        workFlowService.openingDeclare(MainBusinessEnum.COMMISSION_DECLARE_MAJOR_MARKET,productionId);
+        return null;
+    }
+}

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

@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.utils.ExcelUtil;
 import com.dayou.utils.LoginContext;
 import com.dayou.vo.FinanceClaimVO;
+import com.dayou.vo.RealFundMajorStatVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -92,7 +93,7 @@ public class FinanceClaimServiceImpl extends ServiceImpl<FinanceClaimMapper, Fin
         if (financeClaim.getClaimAmount().compareTo(notClaimAmount)<=0){
             financeClaim.setClaimId(LoginContext.getCurrentUserId());
             this.save(financeClaim);
-            productionFundService.updateRealFundForProduction(financeClaim.getOrderFundId());
+            //productionFundService.updateRealFundForProduction(financeClaim.getOrderFundId());
             return Boolean.TRUE;
         }else{
             ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"认领金额已超过实收款剩余金额,请检查!");
@@ -169,6 +170,16 @@ public class FinanceClaimServiceImpl extends ServiceImpl<FinanceClaimMapper, Fin
         return financeClaimMapper.residueAmount(financeFundId);
     }
 
+    @Override
+    public Page<RealFundMajorStatVO> majorStat(Page page, RealFundMajorStatVO majorStat) {
+        return financeClaimMapper.majorStat(page,majorStat);
+    }
+
+    @Override
+    public List<RealFundMajorStatVO> majorStatExport(RealFundMajorStatVO majorStat) {
+        return financeClaimMapper.majorStatExport(majorStat);
+    }
+
 
     @Override
     public synchronized BigDecimal checkFinanceFound(Long financeFundId) {

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

@@ -327,11 +327,11 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
     }
 
     @Override
-    public OrderProductionsBag productionBag(Long id,String reportNo) {
+    public OrderProductionsBag productionBag(Long id) {
         OrderProductionsBag orderProductionsBag = new OrderProductionsBag();
         orderProductionsBag.setBusinessId(id);
         orderProductionsBag.setBusinessType(MainBusinessEnum.MAJOR_BUSINESS.name());
-        List<MajorProduction> list = majorProductionMapper.getMajorProductionAboutFundId(id,reportNo);
+        List<MajorProduction> list = majorProductionMapper.getMajorProductionAboutFundId(id);
         List<ProductionDTO> productions = new ArrayList<>();
         if (CollectionUtil.isNotEmpty(list)){
             for(MajorProduction production : list ){
@@ -386,15 +386,33 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
             }
 
             //再校验产品分配金额是否大于订单认领金额
-            List<FinanceClaim> financeClaims = new ArrayList<>();
+//            List<FinanceClaim> financeClaims = new ArrayList<>();
             for (OrderReportDTO orderReportDTO : claimOrders){
                 BigDecimal thisTimeAmount = orderReportDTO.getThisTimeAmount();
                 BigDecimal realAmount = orderFundMapper.selectById(orderReportDTO.getOrderFundId()).getRealAmount();
                 if (realAmount ==null){
                     realAmount = BigDecimal.ZERO;
                 }
+
+                Long orderFundId = orderReportDTO.getOrderFundId();
+
+                //插入订单认领流水表
+                FinanceClaim financeClaim = new FinanceClaim();
+                if (thisTimeAmount.compareTo(BigDecimal.ZERO)>0){
+                    Long claimId = LoginContext.getCurrentUserId();
+                    financeClaim.setClaimId(claimId);
+                    financeClaim.setRealFundId(financeFundId);
+                    financeClaim.setOrderFundId(orderFundId);
+                    financeClaim.setClaimAmount(thisTimeAmount);
+                    financeClaim.setClaimDatetime(LocalDateTime.now());
+                    //financeClaims.add(financeClaim);
+                    financeClaimService.add(financeClaim);
+                }
+
                 BigDecimal targetAmount = realAmount.add(thisTimeAmount);
+
                 List<ReportDTO> reports = orderReportDTO.getReports();
+
                 if (CollectionUtil.isNotEmpty(reports)){
                     BigDecimal reduce = reports.stream().filter(x->x.getRealAmount()!=null).map(ReportDTO::getRealAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                     if (reduce.compareTo(targetAmount)>0){
@@ -403,7 +421,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
                     }
                     //创建产品收款记录
                     for (ReportDTO reportDTO : reports){
-                        if (reportDTO.getProductionFundId()==null){
+                     //   if (reportDTO.getProductionFundId()==null){
                             MajorProduction production = majorProductionMapper.selectOne(new LambdaQueryWrapper<MajorProduction>().eq(BaseEntity::getId,reportDTO.getId()).eq(BaseEntity::getDeleted, Boolean.FALSE)
                                     .select(MajorProduction::getReportNo, MajorProduction::getMajorId, MajorProduction::getProduction, MajorProduction::getEvaluateAmount));
                             ProductionFund productionFund = new ProductionFund();
@@ -414,33 +432,21 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
                             productionFund.setProductionNo(production.getReportNo());
                             productionFund.setRealAmount(reportDTO.getRealAmount());
                             productionFund.setEvaluateAmount(reportDTO.getEvaluateAmount());
+                            productionFund.setClaimId(financeClaim.getId());
                             productionFundService.add(productionFund);
-                        }
-                        else {
-                            productionFundService.update(new LambdaUpdateWrapper<ProductionFund>().set(ProductionFund::getRealAmount,reportDTO.getRealAmount()).eq(BaseEntity::getId,reportDTO.getProductionFundId()));
-                        }
+                  //      }
+//                        else {
+//                            productionFundService.update(new LambdaUpdateWrapper<ProductionFund>().set(ProductionFund::getRealAmount,reportDTO.getRealAmount()).eq(BaseEntity::getId,reportDTO.getProductionFundId()));
+//                        }
                     }
 
                 }
-
-                Long orderFundId = orderReportDTO.getOrderFundId();
-                //插入订单认领流水表
-                if (thisTimeAmount.compareTo(BigDecimal.ZERO)>0){
-                    FinanceClaim financeClaim = new FinanceClaim();
-                    Long claimId = LoginContext.getCurrentUserId();
-                    financeClaim.setClaimId(claimId);
-                    financeClaim.setRealFundId(financeFundId);
-                    financeClaim.setOrderFundId(orderFundId);
-                    financeClaim.setClaimAmount(thisTimeAmount);
-                    financeClaim.setClaimDatetime(LocalDateTime.now());
-                    financeClaims.add(financeClaim);
-                }
                 //更新订单收款变实收款金额
                 orderFundMapper.updateRealAmount(orderFundId, thisTimeAmount);
             }
-            if (CollectionUtil.isNotEmpty(financeClaims)){
-                financeClaimService.saveBatch(financeClaims);
-            }
+//            if (CollectionUtil.isNotEmpty(financeClaims)){
+//                financeClaimService.saveBatch(financeClaims);
+//            }
             return Boolean.TRUE;
         }
         return Boolean.FALSE;

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

@@ -39,4 +39,6 @@ public interface IWorkFlowService extends IService<WorkFlow> {
 
     WorkNodeCommit openingOrder(MainBusinessEnum mainBusinessEnum, Long businessId, String businessSubId,String remark);
 
+    WorkNodeCommit openingDeclare(MainBusinessEnum mainBusinessEnum, Long businessId);
+
 }

+ 40 - 0
service/src/main/java/com/dayou/service/workflow/WorkFlowServiceImpl.java

@@ -189,6 +189,46 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
         commit.setState(NodeLogEnum.PASS);
         return commit;
     }
+
+    @Override
+    public WorkNodeCommit openingDeclare(MainBusinessEnum mainBusinessEnum, Long businessId) {
+        WorkFlow majorBusinessFlow = this.getOne(new LambdaQueryWrapper<WorkFlow>()
+                .eq(WorkFlow::getCode, mainBusinessEnum.getCode())
+                .eq(WorkFlow::getState, Boolean.FALSE)
+                .eq(BaseEntity::getDeleted, Boolean.FALSE));
+
+        if (majorBusinessFlow == null){
+            ErrorCode.throwBusinessException(ErrorCode.WORKFLOW_NOT_EXISTS,mainBusinessEnum.getMsg());
+        }
+
+        WorkNodeDTO firstNode = workNodeService.getOpeningOrderNode(majorBusinessFlow.getId());
+        if (firstNode == null){
+            ErrorCode.throwBusinessException(ErrorCode.OPENING_NODE_NOT_EXISTS,mainBusinessEnum.getMsg());
+        }
+
+        WorkFlowNodeInstance instance = new WorkFlowNodeInstance();
+        instance.setFlowId(majorBusinessFlow.getId());
+        instance.setNodeId(firstNode.getId());
+        instance.setBusinessId(businessId);
+        instance.setBusinessType(mainBusinessEnum.getCode());
+        instance.setSequence(0);
+        instance.setState(NodeStateEnum.FINISHED.name());
+        workFlowNodeInstanceService.save(instance);
+
+        List<WorkNodeTask> tasks = firstNode.getTasks();
+
+        if (CollectionUtil.isNotEmpty(tasks)){
+
+
+        }
+
+        //构造下单提交对象
+        WorkNodeCommit commit = new WorkNodeCommit();
+        commit.setInstanceNodeId(instance.getId());
+        commit.setState(NodeLogEnum.PASS);
+        return commit;
+    }
+
     private Boolean handleByState(WorkNodeProcessable workNodeProcessable,WorkNodeCommit workNodeCommit){
         NodeLogEnum state = workNodeCommit.getState();
         if (state == null){

+ 17 - 1
service/src/main/java/com/dayou/workflow/config/WorkNodeProcessable.java

@@ -64,6 +64,9 @@ public class WorkNodeProcessable {
     @Autowired
     private IWorkNodeService workNodeService;
 
+    @Autowired
+    private IUserPostService userPostService;
+
 
     /**
      * 提交流程前置处理
@@ -187,7 +190,20 @@ public class WorkNodeProcessable {
 
 
     public Long searchHandlerId(WorkFlowNodeInstance instanceNode, HandlerPermissionDTO handlerPermissionDTO){
-        return 0L;
+        HandlerPermissionEnum handlerPermissionEnum = handlerPermissionDTO.getName();
+
+        switch (handlerPermissionEnum){
+            case EMPLOYEE:
+                return handlerPermissionDTO.getPowerId();
+            case POST:
+                return userPostService.getUniqueHandlerByPostForWorkNode(handlerPermissionDTO.getPowerId());
+            case SYSTEM:
+                //暂无程序处理逻辑
+                return 0L;
+            default:
+                //实在找不到审批人 交由部门领导处理
+                return 0L;
+        }
     }
 
     /**

+ 38 - 1
sql/update_sql.sql

@@ -358,4 +358,41 @@ CREATE TABLE `business_performance_distribution`  (
 PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '绩效分配比例信息' ROW_FORMAT = Dynamic;
 
-SET FOREIGN_KEY_CHECKS = 1;
+SET FOREIGN_KEY_CHECKS = 1;
+
+/**
+  日期:2024-04-30
+  修改人:吴长林
+ */
+ALTER TABLE major_production_allot ADD COLUMN major_id bigint(20) NULL COMMENT '大中型业务id';
+ALTER TABLE major_production_allot ADD COLUMN user_type varchar(255) NULL COMMENT '人员类型(市场人员/评估人员)';
+DROP TABLE IF EXISTS `business_commission_rate`;
+CREATE TABLE `business_commission_rate` (
+                                            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+                                            `business_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL COMMENT '业务类型',
+                                            `user_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL COMMENT '人员类型',
+                                            `business_cate_id` bigint(20) NOT NULL COMMENT '字典数据表业务子类id',
+                                            `min_ratio` decimal(16,2) NOT NULL COMMENT '最小提成比例',
+                                            `max_ratio` decimal(16,2) DEFAULT NULL COMMENT '最大提成比例',
+                                            `low_limit_amount` decimal(16,2) DEFAULT NULL COMMENT '提成下线金额',
+                                            `top_limit_amount` decimal(16,2) DEFAULT NULL COMMENT '提成上线金额',
+                                            `quarter_ratio` decimal(16,2) DEFAULT NULL COMMENT '季度业绩提成比例',
+                                            `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '逻辑删除标识:1:删除 0:未删除',
+                                            `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                            `modified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '修改时间',
+                                            PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='非土规业务提成比例';
+DROP TABLE IF EXISTS `commission_declare`;
+CREATE TABLE `commission_declare` (
+                                      `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+                                      `business_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '业务类型',
+                                      `commission_rate_id` bigint(20) NOT NULL COMMENT 'business_commission_rate 表id',
+                                      `business_id` bigint(20) DEFAULT NULL COMMENT '业务id',
+                                      `production_id` bigint(20) DEFAULT NULL COMMENT '产品id',
+                                      `declare_user_id` bigint(20) NOT NULL COMMENT '申报人id',
+                                      `declare_result` bit(1) DEFAULT NULL COMMENT '审批结果(0:驳回,1:通过)',
+                                      `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '逻辑删除标识:1:删除 0:未删除',
+                                      `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                      `modified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '修改时间',
+                                      PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='提成申报';