Ver Fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java
#	ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemListMapper.java
zhaoxian há 1 ano atrás
pai
commit
c7c509150b
36 ficheiros alterados com 1720 adições e 127 exclusões
  1. 5 1
      ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java
  2. 48 0
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java
  3. 151 0
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouRuleSettlementCheckController.java
  4. 147 4
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouRuleSettlementDataController.java
  5. 3 3
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouSettlementRulesController.java
  6. 0 1
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemCollectSamples.java
  7. 281 0
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRuleSettlementCheck.java
  8. 15 1
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRuleSettlementData.java
  9. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java
  10. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemListMapper.java
  11. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java
  12. 79 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRuleSettlementCheckMapper.java
  13. 3 1
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRuleSettlementDataMapper.java
  14. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java
  15. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemListService.java
  16. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java
  17. 79 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRuleSettlementCheckService.java
  18. 3 1
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRuleSettlementDataService.java
  19. 5 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java
  20. 5 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemListServiceImpl.java
  21. 5 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java
  22. 124 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRuleSettlementCheckServiceImpl.java
  23. 14 11
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRuleSettlementDataServiceImpl.java
  24. 117 18
      ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JiaoYangReportController.java
  25. 3 0
      ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JyMaterialListController.java
  26. 8 0
      ruixuan-live/src/main/java/com/ruixuan/jiaoyang/mapper/JiaoYangReportMapper.java
  27. 8 0
      ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/IJiaoYangReportService.java
  28. 20 0
      ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/impl/JiaoYangReportServiceImpl.java
  29. 8 8
      ruixuan-live/src/main/resources/mapper/bytedance/BytedancePromoterOrderListMapper.xml
  30. 11 0
      ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml
  31. 12 0
      ruixuan-live/src/main/resources/mapper/isc/KuaishouItemListMapper.xml
  32. 19 2
      ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml
  33. 267 0
      ruixuan-live/src/main/resources/mapper/isc/KuaishouRuleSettlementCheckMapper.xml
  34. 73 42
      ruixuan-live/src/main/resources/mapper/isc/KuaishouRuleSettlementDataMapper.xml
  35. 75 29
      ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml
  36. 120 5
      ruixuan-live/src/main/resources/mapper/jiaoyang/JiaoYangReportMapper.xml

+ 5 - 1
ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java

@@ -49,7 +49,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     public static Date getNowDate() {
         return new Date();
     }
-
+    public static String getNowDate(String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        Date date = new Date();
+        return sdf.format(date);
+    }
 
     public static String getNowDateStr() {
         SimpleDateFormat simp = new SimpleDateFormat("yyyy-MM-dd");

+ 48 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -302,6 +302,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 sampleLog.setCollectSampleStatus(4);
                 kuaishouItemCollectSamples.setCollectSampleStatus(4);
                 kuaishouItemCollectSamples.setCollectSampleDesc("商品已发货");
+                kuaishouItemCollectSamples.setCompanyCode(kuaishouItemCollectSamples.getCompanyCode());
                 kuaishouItemCollectSamples.setCourierNumberTime(new Date());
                 // 调用快递接口
                 kuaishouItemCollectSamplesService.subscribe(id, courierNumber, kuaishouItemCollectSamples.getCompanyCode());
@@ -416,6 +417,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
             kuaishouItemCollectSamples.setId(id);
             kuaishouItemCollectSamples.setCollectSampleDesc("商品已发货");
             kuaishouItemCollectSamples.setCourierNumber(courierNumber);
+            kuaishouItemCollectSamples.setCompanyCode(companyCode);
             kuaishouItemCollectSamples.setCourierNumberTime(new Date());
             int i = kuaishouItemCollectSamplesService.updateKuaishouItemCollectSamples(kuaishouItemCollectSamples);
             if (i > 0) {
@@ -432,6 +434,44 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     }
 
 
+    @GetMapping("/refreshCourierNumber")
+    public JSONObject refreshCourierNumber(Long id, String courierNumber, String companyCode) {
+        log.info("刷新快递单号,id:{},courierNumber:{},companyCode:{}", id, courierNumber, companyCode);
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("id不能为空");
+            }
+            if (Check.isNull(courierNumber)) {
+                throw new Exception("快递单号不能为空");
+            }
+            if (Check.isNull(companyCode)) {
+                throw new Exception("公司编号不能为空");
+            }
+
+            if (courierNumber.contains(" ") || courierNumber.contains(".") || courierNumber.contains("、") || courierNumber.contains(",") || courierNumber.contains("@") || courierNumber.contains("#")) {
+                throw new Exception("快递单号不能包含空格及特殊字符");
+            }
+            KuaishouItemCollectSamples kuaishouItemCollectSamples = new KuaishouItemCollectSamples();
+            kuaishouItemCollectSamples.setId(id);
+            kuaishouItemCollectSamples.setCollectSampleDesc("商品已发货");
+            //  kuaishouItemCollectSamples.setCourierNumber(courierNumber);
+            // kuaishouItemCollectSamples.setCourierNumberTime(new Date());
+            int i = kuaishouItemCollectSamplesService.updateKuaishouItemCollectSamples(kuaishouItemCollectSamples);
+            if (i > 0) {
+                kuaishouItemCollectSamplesService.subscribe(id, courierNumber, companyCode);
+            }
+            returnJson.put("code", 0);
+            returnJson.put("message", "修改成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", 500);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
     @GetMapping("/detail")
     public JSONObject detail(Long id) {
         JSONObject returnJson = new JSONObject();
@@ -532,6 +572,14 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                     updateSample.setCourierNumber(nu);
                     updateSample.setCollectSampleDesc("单号异常");
                     kuaishouItemCollectSamplesService.updateByNum(updateSample);
+                } else {
+                    String statusString = kuaishouItemCollectSamplesService.getStatusStringByCourierNumbe(nu);
+                    if (!Check.isNull(statusString) && "单号异常".equals(statusString)) {
+                        KuaishouItemCollectSamples updateSample = new KuaishouItemCollectSamples();
+                        updateSample.setCourierNumber(nu);
+                        updateSample.setCollectSampleDesc("商品已发货");
+                        kuaishouItemCollectSamplesService.updateByNum(updateSample);
+                    }
                 }
                 JSONArray data = lastResult.getJSONArray("data");
                 KuaishouItemCollectSampleExpress express = new KuaishouItemCollectSampleExpress();

+ 151 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouRuleSettlementCheckController.java

@@ -0,0 +1,151 @@
+package com.ruixuan.isc.controller;
+
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.annotation.Log;
+import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.core.domain.AjaxResult;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.enums.BusinessType;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.poi.ExcelUtil;
+import com.ruixuan.isc.entity.KuaishouRuleSettlementCheck;
+import com.ruixuan.isc.service.IKuaishouRuleSettlementCheckService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 【请填写功能名称】Controller
+ *
+ * @author ruoyi
+ * @date 2023-12-28
+ */
+@RestController
+@RequestMapping("/financialReview")
+public class KuaishouRuleSettlementCheckController extends BaseController {
+    @Autowired
+    private IKuaishouRuleSettlementCheckService kuaishouRuleSettlementCheckService;
+
+    /**
+     * 查询【请填写功能名称】列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(String statDate, Long promoterId, String promoterName) {
+        Long date = Long.valueOf(statDate.replace("-", ""));
+        startPage();
+        List<JSONObject> list = kuaishouRuleSettlementCheckService.getTotalList(date, promoterId, promoterName);
+        return getDataTable(list);
+    }
+
+
+    @GetMapping("/detailList")
+    public TableDataInfo detailList(String statDate, Long promoterId, Long itemId) {
+        Long date = Long.valueOf(statDate.replace("-", ""));
+        startPage();
+        List<JSONObject> list = kuaishouRuleSettlementCheckService.detailList(date, promoterId, itemId);
+        return getDataTable(list);
+
+    }
+
+    @GetMapping("/updateFinancialReviewStatusTotal")
+    public JSONObject updateFinancialReviewStatusTotal(String statDate, Long promoterId, Integer status, String promoterInfo) {
+
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (!Check.isNull(promoterInfo)) {
+                kuaishouRuleSettlementCheckService.replacePromoterInfo(promoterId, promoterInfo);
+            }
+            Long date = Long.valueOf(statDate.replace("-", ""));
+            kuaishouRuleSettlementCheckService.updateFinancialReviewStatusTotal(date, promoterId, status);
+            returnJson.put("code", 200);
+            returnJson.put("message", "修改成功");
+        } catch (Exception e) {
+            returnJson.put("code", 500);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    @GetMapping("/updateFinancialReviewDetails")
+    public JSONObject updateFinancialReviewDetails(Long id, Integer status, Long promoterId, String promoterInfo) {
+
+        JSONObject returnJson = new JSONObject();
+        try {
+            KuaishouRuleSettlementCheck update = new KuaishouRuleSettlementCheck();
+            update.setId(id);
+            update.setSettlementStatus(status);
+            kuaishouRuleSettlementCheckService.updateKuaishouRuleSettlementCheck(update);
+            if (!Check.isNull(promoterInfo)) {
+                kuaishouRuleSettlementCheckService.replacePromoterInfo(promoterId, promoterInfo);
+            }
+            returnJson.put("code", 200);
+            returnJson.put("message", "修改成功");
+        } catch (Exception e) {
+            returnJson.put("code", 500);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    /**
+     * 导出【请填写功能名称】列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:check:export')")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        List<KuaishouRuleSettlementCheck> list = kuaishouRuleSettlementCheckService.selectKuaishouRuleSettlementCheckList(kuaishouRuleSettlementCheck);
+        ExcelUtil<KuaishouRuleSettlementCheck> util = new ExcelUtil<KuaishouRuleSettlementCheck>(KuaishouRuleSettlementCheck.class);
+        util.exportExcel(response, list, "【请填写功能名称】数据");
+    }
+
+    /**
+     * 获取【请填写功能名称】详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:check:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(kuaishouRuleSettlementCheckService.selectKuaishouRuleSettlementCheckById(id));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     */
+    @PreAuthorize("@ss.hasPermi('system:check:add')")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        return toAjax(kuaishouRuleSettlementCheckService.insertKuaishouRuleSettlementCheck(kuaishouRuleSettlementCheck));
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     */
+    @PreAuthorize("@ss.hasPermi('system:check:edit')")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        return toAjax(kuaishouRuleSettlementCheckService.updateKuaishouRuleSettlementCheck(kuaishouRuleSettlementCheck));
+    }
+
+    /**
+     * 删除【请填写功能名称】
+     */
+    @PreAuthorize("@ss.hasPermi('system:check:remove')")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(kuaishouRuleSettlementCheckService.deleteKuaishouRuleSettlementCheckByIds(ids));
+    }
+}

+ 147 - 4
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouRuleSettlementDataController.java

@@ -9,6 +9,7 @@ import java.util.concurrent.Executors;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.extra.ssh.JschRuntimeException;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.annotation.Log;
@@ -19,7 +20,11 @@ import com.ruixuan.common.enums.BusinessType;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.poi.ExcelUtil;
 import com.ruixuan.data.utils.ExportExcelUtils;
+import com.ruixuan.isc.entity.KuaishouRuleSettlementCheck;
 import com.ruixuan.isc.entity.KuaishouRuleSettlementData;
+import com.ruixuan.isc.service.IKuaishouItemListService;
+import com.ruixuan.isc.service.IKuaishouPromoterService;
+import com.ruixuan.isc.service.IKuaishouRuleSettlementCheckService;
 import com.ruixuan.isc.service.IKuaishouRuleSettlementDataService;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -101,6 +106,13 @@ public class KuaishouRuleSettlementDataController extends BaseController {
         return getDataTable(list);
     }
 
+    @GetMapping("/getSettlementListV2")
+    public TableDataInfo getSettlementListV2(String statDate, Long promoterId, String promoterName) {
+        Long date = Long.valueOf(statDate.replace("-", ""));
+        startPage();
+        List<JSONObject> list = kuaishouRuleSettlementDataService.getSettlementDataV2(date, promoterId, promoterName);
+        return getDataTable(list);
+    }
 
     @RequestMapping(value = "/exportSettlementList")
     @ResponseBody
@@ -139,6 +151,13 @@ public class KuaishouRuleSettlementDataController extends BaseController {
         os.close();
     }
 
+    @Autowired
+    private IKuaishouRuleSettlementCheckService kuaishouRuleSettlementCheckService;
+    @Autowired
+    private IKuaishouPromoterService promoterService;
+    @Autowired
+    private IKuaishouItemListService itemListService;
+
     @GetMapping("/updatePromoterStatus")
     public JSONObject updatePromoterStatus(String statDate, Long promoterId, Integer status) {
         JSONObject returnJson = new JSONObject();
@@ -154,7 +173,48 @@ public class KuaishouRuleSettlementDataController extends BaseController {
                 throw new Exception("请输入状态");
             }
             Long date = Long.valueOf(statDate.replace("-", ""));
+
+            KuaishouRuleSettlementData selectKuaishouRuleSettlementData = new KuaishouRuleSettlementData();
+            selectKuaishouRuleSettlementData.setPromoterId(promoterId);
+            selectKuaishouRuleSettlementData.setSettlementStatus(2);
+            selectKuaishouRuleSettlementData.setStatDate(date);
+            List<KuaishouRuleSettlementData> kuaishouRuleSettlementData = kuaishouRuleSettlementDataService.selectKuaishouRuleSettlementDataList(selectKuaishouRuleSettlementData);
+
+            List<KuaishouRuleSettlementCheck> checks = new ArrayList<>();
+            for (KuaishouRuleSettlementData settlementData : kuaishouRuleSettlementData) {
+                KuaishouRuleSettlementCheck check = new KuaishouRuleSettlementCheck();
+                check.setRelateId(settlementData.getRelateId());
+                check.setItemIds(settlementData.getItemIds());
+                check.setPromoterId(settlementData.getPromoterId());
+                JSONObject promoterJson = promoterService.selectKuaishouRulePromoterById(settlementData.getPromoterId());
+                if (!Check.isNull(promoterJson)) {
+                    check.setPromoterName(promoterJson.getString("promoterName"));
+                    check.setPromoterCreateId(promoterJson.getLong("userId"));
+                    check.setPromoterCreateName(promoterJson.getString("userName"));
+                }
+                check.setItemIds(settlementData.getItemIds());
+                String[] split = settlementData.getItemIds().split(",");
+                Long itemId = Long.valueOf(split[0]);
+                JSONObject itemJson = itemListService.selectRuleItemByItemId(itemId);
+                if (!Check.isNull(itemJson)) {
+                    check.setItemTitle(itemJson.getString("itemTitle"));
+                    check.setItemCreateId(itemJson.getLong("userId"));
+                    check.setItemCreateName(itemJson.getString("userName"));
+                }
+                check.setStatDate(date);
+                check.setAnchorAmount(settlementData.getAnchorAmount());
+                check.setShouldAnchorAmount(settlementData.getAnchorAmount());
+                check.setReferenceAmount(settlementData.getReferenceAmount());
+                check.setShouldReferenceAmount(settlementData.getReferenceAmount());
+                check.setSettlementStatus(1);
+                check.setRemarks(settlementData.getRemarks());
+                check.setValidOrderNum(settlementData.getValidOrderNum());
+                checks.add(check);
+            }
             kuaishouRuleSettlementDataService.updatePromoterStatus(date, promoterId, status);
+            kuaishouRuleSettlementCheckService.adds(checks);
+
+
         } catch (Exception e) {
             e.printStackTrace();
             returnJson.put("code", 500);
@@ -165,11 +225,93 @@ public class KuaishouRuleSettlementDataController extends BaseController {
     }
 
 
+    @PutMapping("/update")
+    public AjaxResult update(@RequestBody KuaishouRuleSettlementData kuaishouRuleSettlementData) {
+        KuaishouRuleSettlementData updateKuaishouRuleSettlementData = new KuaishouRuleSettlementData();
+        updateKuaishouRuleSettlementData.setId(kuaishouRuleSettlementData.getId());
+        updateKuaishouRuleSettlementData.setSettlementStatus(kuaishouRuleSettlementData.getSettlementStatus());
+        updateKuaishouRuleSettlementData.setAnchorAmount(kuaishouRuleSettlementData.getAnchorAmount());
+        updateKuaishouRuleSettlementData.setReferenceAmount(kuaishouRuleSettlementData.getReferenceAmount());
+        updateKuaishouRuleSettlementData.setRemarks(kuaishouRuleSettlementData.getRemarks());
+        KuaishouRuleSettlementData selectData = kuaishouRuleSettlementDataService.selectKuaishouRuleSettlementDataById(kuaishouRuleSettlementData.getId());
+        List<KuaishouRuleSettlementCheck> checks = new ArrayList<>();
+        KuaishouRuleSettlementCheck check = new KuaishouRuleSettlementCheck();
+        check.setRelateId(selectData.getRelateId());
+        check.setItemIds(selectData.getItemIds());
+        check.setPromoterId(selectData.getPromoterId());
+        JSONObject promoterJson = promoterService.selectKuaishouRulePromoterById(selectData.getPromoterId());
+        if (!Check.isNull(promoterJson)) {
+            check.setPromoterName(promoterJson.getString("promoterName"));
+            check.setPromoterCreateId(promoterJson.getLong("userId"));
+            check.setPromoterCreateName(promoterJson.getString("userName"));
+        }
+        check.setItemIds(selectData.getItemIds());
+        String[] split = selectData.getItemIds().split(",");
+        Long itemId = Long.valueOf(split[0]);
+        JSONObject itemJson = itemListService.selectRuleItemByItemId(itemId);
+        if (!Check.isNull(itemJson)) {
+            check.setItemTitle(itemJson.getString("itemTitle"));
+            check.setItemCreateId(itemJson.getLong("userId"));
+            check.setItemCreateName(itemJson.getString("userName"));
+        }
+        check.setStatDate(selectData.getStatDate());
+        check.setAnchorAmount(kuaishouRuleSettlementData.getAnchorAmount());
+        check.setShouldAnchorAmount(selectData.getAnchorAmount());
+        check.setReferenceAmount(kuaishouRuleSettlementData.getReferenceAmount());
+        check.setShouldReferenceAmount(selectData.getReferenceAmount());
+        check.setSettlementStatus(1);
+        check.setRemarks(kuaishouRuleSettlementData.getRemarks());
+        check.setValidOrderNum(selectData.getValidOrderNum());
+        checks.add(check);
+        kuaishouRuleSettlementCheckService.adds(checks);
+        return toAjax(kuaishouRuleSettlementDataService.updateKuaishouRuleSettlementData(updateKuaishouRuleSettlementData));
+    }
+
+
+    @PutMapping("/updateSettlement")
+    public AjaxResult updateSettlement(@RequestBody KuaishouRuleSettlementData kuaishouRuleSettlementData) {
+        KuaishouRuleSettlementData updateKuaishouRuleSettlementData = new KuaishouRuleSettlementData();
+        updateKuaishouRuleSettlementData.setId(kuaishouRuleSettlementData.getId());
+        if (!Check.isNull(kuaishouRuleSettlementData.getAnchorAmount())) {
+            updateKuaishouRuleSettlementData.setAnchorAmount(kuaishouRuleSettlementData.getAnchorAmount());
+        }
+        if (!Check.isNull(kuaishouRuleSettlementData.getReferenceAmount())) {
+            updateKuaishouRuleSettlementData.setReferenceAmount(kuaishouRuleSettlementData.getReferenceAmount());
+        }
+        if (!Check.isNull(kuaishouRuleSettlementData.getRemarks())) {
+            updateKuaishouRuleSettlementData.setRemarks(kuaishouRuleSettlementData.getRemarks());
+
+        }
+        KuaishouRuleSettlementData selectData = kuaishouRuleSettlementDataService.selectKuaishouRuleSettlementDataById(kuaishouRuleSettlementData.getId());
+        KuaishouRuleSettlementCheck check = new KuaishouRuleSettlementCheck();
+        //  kuaishouRuleSettlementCheckService
+        Long relateId = selectData.getRelateId();
+        Long promoterId = selectData.getPromoterId();
+        Long statDate = selectData.getStatDate();
+        check.setRelateId(relateId);
+        check.setPromoterId(promoterId);
+        check.setStatDate(statDate);
+        if (!Check.isNull(kuaishouRuleSettlementData.getAnchorAmount())) {
+            check.setAnchorAmount(kuaishouRuleSettlementData.getAnchorAmount());
+        }
+        if (!Check.isNull(kuaishouRuleSettlementData.getReferenceAmount())) {
+            check.setReferenceAmount(kuaishouRuleSettlementData.getReferenceAmount());
+        }
+        if (!Check.isNull(kuaishouRuleSettlementData.getRemarks())) {
+            check.setRemarks(kuaishouRuleSettlementData.getRemarks());
+        }
+
+        kuaishouRuleSettlementCheckService.updateCheck(check);
+
+        return toAjax(kuaishouRuleSettlementDataService.updateKuaishouRuleSettlementData(updateKuaishouRuleSettlementData));
+    }
+
+
     @GetMapping("/getPromoterSettlementDetail")
-    public TableDataInfo getPromoterSettlementDetail(String statDate, Long promoterId, Integer settlementStatus) {
+    public TableDataInfo getPromoterSettlementDetail(String statDate, Long promoterId, Integer settlementStatus, Long itemId) {
         Long date = Long.valueOf(statDate.replace("-", ""));
         startPage();
-        List<JSONObject> list = kuaishouRuleSettlementDataService.getPromoterSettlementDetail(date, promoterId, settlementStatus);
+        List<JSONObject> list = kuaishouRuleSettlementDataService.getPromoterSettlementDetail(date, promoterId, settlementStatus, itemId);
         return getDataTable(list);
     }
 
@@ -178,8 +320,8 @@ public class KuaishouRuleSettlementDataController extends BaseController {
     public void exportPromoterSettlementDetail(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws Exception {
         Long date = Long.valueOf(requestJson.getString("statDate").replace("-", ""));
         Long promoterId = requestJson.getLong("promoterId");
-
-        List<JSONObject> list = kuaishouRuleSettlementDataService.getPromoterSettlementDetail(date, promoterId, null);
+        Long itemId = requestJson.getLong("itemId");
+        List<JSONObject> list = kuaishouRuleSettlementDataService.getPromoterSettlementDetail(date, promoterId, null, itemId);
         List<List<Object>> exportList = new ArrayList<>();
         if (!Check.isNull(list)) {
             for (int i = 0; i < list.size(); i++) {
@@ -252,6 +394,7 @@ public class KuaishouRuleSettlementDataController extends BaseController {
         return toAjax(kuaishouRuleSettlementDataService.updateKuaishouRuleSettlementData(kuaishouRuleSettlementData));
     }
 
+
     /**
      * 删除【请填写功能名称】
      */

+ 3 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouSettlementRulesController.java

@@ -35,7 +35,7 @@ public class KuaishouSettlementRulesController extends BaseController {
         if (userId == 1) {
             userId = null;
         }
-        List<JSONObject> list = kuaishouSettlementRulesService.getAllRuleList(userId, ruleName);
+        List<JSONObject> list = kuaishouSettlementRulesService.getAllRuleList(null, ruleName);
         return getDataTable(list);
     }
 
@@ -46,7 +46,7 @@ public class KuaishouSettlementRulesController extends BaseController {
         if (userId == 1) {
             userId = null;
         }
-        List<JSONObject> list = kuaishouSettlementRulesService.getRuleList(userId, ruleName);
+        List<JSONObject> list = kuaishouSettlementRulesService.getRuleList(null, ruleName);
         return getDataTable(list);
     }
 
@@ -56,7 +56,7 @@ public class KuaishouSettlementRulesController extends BaseController {
         if (userId == 1) {
             userId = null;
         }
-        List<JSONObject> data = kuaishouSettlementRulesService.getRuleList(userId, ruleNam);
+        List<JSONObject> data = kuaishouSettlementRulesService.getRuleList(null, ruleNam);
         returnJson.put("code", 0);
         returnJson.put("message", "true");
         returnJson.put("data", data);

+ 0 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemCollectSamples.java

@@ -160,7 +160,6 @@ public class KuaishouItemCollectSamples extends BaseEntity {
     private String collectSampleDesc;
 
 
-    @Transient
     private String companyCode;
     @Transient
     private Long userId;

+ 281 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRuleSettlementCheck.java

@@ -0,0 +1,281 @@
+package com.ruixuan.isc.entity;
+
+
+import java.math.BigDecimal;
+
+import com.ruixuan.common.annotation.Excel;
+import com.ruixuan.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+
+/**
+ * 【请填写功能名称】对象 kuaishou_rule_settlement_check
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+
+public class KuaishouRuleSettlementCheck extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private Long id;
+
+    /**
+     * 关联商品ID
+     */
+    @Excel(name = "关联商品ID")
+    private Long relateId;
+
+    /**
+     * 商品id
+     */
+    @Excel(name = "商品id")
+    private String itemIds;
+    private String itemTitle;
+
+    /**
+     * 达人ID
+     */
+    @Excel(name = "达人ID")
+    private Long promoterId;
+
+    /**
+     * 达人名称
+     */
+    @Excel(name = "达人名称")
+    private String promoterName;
+
+    /**
+     * 商品创建人ID
+     */
+    @Excel(name = "商品创建人ID")
+    private Long itemCreateId;
+
+    /**
+     * 商品创建人姓名
+     */
+    @Excel(name = "商品创建人姓名")
+    private String itemCreateName;
+
+    /**
+     * 达人创建人ID
+     */
+    @Excel(name = "达人创建人ID")
+    private Long promoterCreateId;
+
+    /**
+     * 达人创建人姓名
+     */
+    @Excel(name = "达人创建人姓名")
+    private String promoterCreateName;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private Long statDate;
+
+    /**
+     * 主播奖励金额
+     */
+    @Excel(name = "主播奖励金额")
+    private BigDecimal anchorAmount;
+    private BigDecimal shouldAnchorAmount;
+
+    /**
+     * 推荐人奖励金额
+     */
+    @Excel(name = "推荐人奖励金额")
+    private BigDecimal referenceAmount;
+    private BigDecimal shouldReferenceAmount;
+
+    /**
+     * 结算状态 1:待付款 2:已付款
+     */
+    @Excel(name = "结算状态 1:待付款 2:已付款")
+    private Integer settlementStatus;
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remarks;
+    private Long validOrderNum;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getRelateId() {
+        return relateId;
+    }
+
+    public void setRelateId(Long relateId) {
+        this.relateId = relateId;
+    }
+
+    public String getItemIds() {
+        return itemIds;
+    }
+
+    public void setItemIds(String itemIds) {
+        this.itemIds = itemIds;
+    }
+
+    public String getItemTitle() {
+        return itemTitle;
+    }
+
+    public void setItemTitle(String itemTitle) {
+        this.itemTitle = itemTitle;
+    }
+
+    public Long getPromoterId() {
+        return promoterId;
+    }
+
+    public void setPromoterId(Long promoterId) {
+        this.promoterId = promoterId;
+    }
+
+    public String getPromoterName() {
+        return promoterName;
+    }
+
+    public void setPromoterName(String promoterName) {
+        this.promoterName = promoterName;
+    }
+
+    public Long getItemCreateId() {
+        return itemCreateId;
+    }
+
+    public void setItemCreateId(Long itemCreateId) {
+        this.itemCreateId = itemCreateId;
+    }
+
+    public String getItemCreateName() {
+        return itemCreateName;
+    }
+
+    public void setItemCreateName(String itemCreateName) {
+        this.itemCreateName = itemCreateName;
+    }
+
+    public Long getPromoterCreateId() {
+        return promoterCreateId;
+    }
+
+    public void setPromoterCreateId(Long promoterCreateId) {
+        this.promoterCreateId = promoterCreateId;
+    }
+
+    public String getPromoterCreateName() {
+        return promoterCreateName;
+    }
+
+    public void setPromoterCreateName(String promoterCreateName) {
+        this.promoterCreateName = promoterCreateName;
+    }
+
+    public Long getStatDate() {
+        return statDate;
+    }
+
+    public void setStatDate(Long statDate) {
+        this.statDate = statDate;
+    }
+
+    public BigDecimal getAnchorAmount() {
+        return anchorAmount;
+    }
+
+    public void setAnchorAmount(BigDecimal anchorAmount) {
+        this.anchorAmount = anchorAmount;
+    }
+
+    public BigDecimal getShouldAnchorAmount() {
+        return shouldAnchorAmount;
+    }
+
+    public void setShouldAnchorAmount(BigDecimal shouldAnchorAmount) {
+        this.shouldAnchorAmount = shouldAnchorAmount;
+    }
+
+    public BigDecimal getReferenceAmount() {
+        return referenceAmount;
+    }
+
+    public void setReferenceAmount(BigDecimal referenceAmount) {
+        this.referenceAmount = referenceAmount;
+    }
+
+    public BigDecimal getShouldReferenceAmount() {
+        return shouldReferenceAmount;
+    }
+
+    public void setShouldReferenceAmount(BigDecimal shouldReferenceAmount) {
+        this.shouldReferenceAmount = shouldReferenceAmount;
+    }
+
+    public Integer getSettlementStatus() {
+        return settlementStatus;
+    }
+
+    public void setSettlementStatus(Integer settlementStatus) {
+        this.settlementStatus = settlementStatus;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public Long getValidOrderNum() {
+        return validOrderNum;
+    }
+
+    public void setValidOrderNum(Long validOrderNum) {
+        this.validOrderNum = validOrderNum;
+    }
+
+    @Override
+    public String toString() {
+        return "KuaishouRuleSettlementCheck{" +
+                "id=" + id +
+                ", relateId=" + relateId +
+                ", itemIds='" + itemIds + '\'' +
+                ", itemTitle='" + itemTitle + '\'' +
+                ", promoterId=" + promoterId +
+                ", promoterName='" + promoterName + '\'' +
+                ", itemCreateId=" + itemCreateId +
+                ", itemCreateName='" + itemCreateName + '\'' +
+                ", promoterCreateId=" + promoterCreateId +
+                ", promoterCreateName='" + promoterCreateName + '\'' +
+                ", statDate=" + statDate +
+                ", anchorAmount=" + anchorAmount +
+                ", shouldAnchorAmount=" + shouldAnchorAmount +
+                ", referenceAmount=" + referenceAmount +
+                ", shouldReferenceAmount=" + shouldReferenceAmount +
+                ", settlementStatus=" + settlementStatus +
+                ", remarks='" + remarks + '\'' +
+                ", validOrderNum=" + validOrderNum +
+                '}';
+    }
+}
+

+ 15 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRuleSettlementData.java

@@ -5,6 +5,8 @@ import java.math.BigDecimal;
 
 import com.ruixuan.common.annotation.Excel;
 import com.ruixuan.common.core.domain.BaseEntity;
+import org.springframework.data.annotation.Transient;
+
 /**
  * 【请填写功能名称】对象 kuaishou_rule_settlement_data
  *
@@ -114,7 +116,7 @@ public class KuaishouRuleSettlementData extends BaseEntity {
      * 日期
      */
     @Excel(name = "日期")
-    private Long  statDate;
+    private Long statDate;
 
     /**
      * 主播奖励金额
@@ -136,6 +138,9 @@ public class KuaishouRuleSettlementData extends BaseEntity {
 
     private Long lastSettlementOrderNum;
 
+
+    private String remarks;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -316,6 +321,14 @@ public class KuaishouRuleSettlementData extends BaseEntity {
         this.lastSettlementOrderNum = lastSettlementOrderNum;
     }
 
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
     @Override
     public String toString() {
         return "KuaishouRuleSettlementData{" +
@@ -341,6 +354,7 @@ public class KuaishouRuleSettlementData extends BaseEntity {
                 ", referenceAmount=" + referenceAmount +
                 ", settlementStatus=" + settlementStatus +
                 ", lastSettlementOrderNum=" + lastSettlementOrderNum +
+                ", remarks='" + remarks + '\'' +
                 '}';
     }
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java

@@ -121,5 +121,7 @@ public interface KuaishouItemCollectSamplesMapper {
     List<Long> getAccordWithOrderQuantityList();
 
     void updateByIds(@Param("ids") List<Long> ids);
+
+    String getStatusStringByCourierNumbe(String nu);
 }
 

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemListMapper.java

@@ -59,5 +59,7 @@ public interface KuaishouItemListMapper {
     String getItemImgUrl(Long itemId);
 
     List<JSONObject> itemList();
+
+    JSONObject selectRuleItemByItemId(@Param("itemId") Long itemId);
 }
 

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -125,4 +125,6 @@ public interface KuaishouPromoterMapper {
     void deleteKuaishouPromoterById3(Long id);
 
     List<JYKuaishouPromoter> getFailInfo3();
+
+    JSONObject selectKuaishouRulePromoterById(@Param("promoterId") Long promoterId);
 }

+ 79 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRuleSettlementCheckMapper.java

@@ -0,0 +1,79 @@
+package com.ruixuan.isc.mapper;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.isc.entity.KuaishouRuleSettlementCheck;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+public interface KuaishouRuleSettlementCheckMapper
+{
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public KuaishouRuleSettlementCheck selectKuaishouRuleSettlementCheckById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<KuaishouRuleSettlementCheck> selectKuaishouRuleSettlementCheckList(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 删除【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteKuaishouRuleSettlementCheckById(Long id);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouRuleSettlementCheckByIds(Long[] ids);
+
+    void adds(@Param("adds") List<KuaishouRuleSettlementCheck> adds);
+
+    List<JSONObject> getTotalList(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("promoterName") String promoterName);
+
+    void updateFinancialReviewStatusTotal(@Param("statDate") Long statDate, @Param("promoterId") Long promoterId, @Param("status") Integer status);
+
+    List<JSONObject> detailList(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("itemId") Long itemId);
+
+    void replacePromoterInfo(@Param("promoterId") Long promoterId, @Param("promoterInfo") String promoterInfo);
+
+    void updateCheck(KuaishouRuleSettlementCheck check);
+}
+

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRuleSettlementDataMapper.java

@@ -84,7 +84,7 @@ public interface KuaishouRuleSettlementDataMapper {
 
     void updatePromoterStatus(@Param("statDate") Long statDate, @Param("promoterId") Long promoterId, @Param("status") Integer status);
 
-    List<JSONObject> getPromoterSettlementDetail(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("settlementStatus") Integer settlementStatus);
+    List<JSONObject> getPromoterSettlementDetail(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("settlementStatus") Integer settlementStatus, @Param("itemId") Long itemId);
 
     JSONObject getRuleJson(Long ruleId);
 
@@ -94,4 +94,6 @@ public interface KuaishouRuleSettlementDataMapper {
     Integer selectPromoterIncentiveLog(Long promoterId);
 
     void replacePromoterIncentiveLog(@Param("promoterId") Long promoterId, @Param("ruleId") Long ruleId, @Param("incentivizedCount") Integer incentivizedCount, @Param("lastIncentivizedCount") Integer lastIncentivizedCount);
+
+    List<JSONObject> getSettlementDataV2(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("promoterName") String promoterName);
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -111,5 +111,7 @@ public interface IKuaishouItemCollectSamplesService {
     List<KuaishouItemCollectSamples> getListByPromoterId(String promoterId, Long userId);
 
     void checkAndUpdateStatus();
+
+    String getStatusStringByCourierNumbe(String nu);
 }
 

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemListService.java

@@ -50,5 +50,7 @@ public interface IKuaishouItemListService {
     List<JSONObject> getListByRelateId(Long relateId);
 
     Long selectMaxRelateId();
+
+    JSONObject selectRuleItemByItemId(Long itemId);
 }
 

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -92,4 +92,6 @@ public interface IKuaishouPromoterService {
     int updateKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
 
     Result deleteKuaishouPromoterById3(Long id, Long userId);
+
+    JSONObject selectKuaishouRulePromoterById(Long promoterId);
 }

+ 79 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRuleSettlementCheckService.java

@@ -0,0 +1,79 @@
+package com.ruixuan.isc.service;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.isc.entity.KuaishouRuleSettlementCheck;
+
+import java.util.List;
+
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+public interface IKuaishouRuleSettlementCheckService
+{
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+
+    public KuaishouRuleSettlementCheck selectKuaishouRuleSettlementCheckById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<KuaishouRuleSettlementCheck> selectKuaishouRuleSettlementCheckList(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouRuleSettlementCheckByIds(Long[] ids);
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteKuaishouRuleSettlementCheckById(Long id);
+
+    void adds(List<KuaishouRuleSettlementCheck> checks);
+
+    List<JSONObject> getTotalList(Long date, Long promoterId, String promoterName);
+
+    void updateFinancialReviewStatusTotal(Long statDate, Long promoterId, Integer status);
+
+    List<JSONObject> detailList(Long date, Long promoterId, Long itemId);
+
+    void replacePromoterInfo(Long promoterId, String promoterInfo);
+
+    void updateCheck(KuaishouRuleSettlementCheck check);
+}
+

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRuleSettlementDataService.java

@@ -73,10 +73,12 @@ public interface IKuaishouRuleSettlementDataService {
 
     void updatePromoterStatus(Long statDate, Long promoterId, Integer status);
 
-    List<JSONObject> getPromoterSettlementDetail(Long date, Long promoterId,Integer settlementStatus);
+    List<JSONObject> getPromoterSettlementDetail(Long date, Long promoterId,Integer settlementStatus,Long itemId);
 
     JSONObject getData();
 
     void promoterData(Long statDate, JSONArray data);
+
+    List<JSONObject> getSettlementDataV2(Long date, Long promoterId, String promoterName);
 }
 

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -717,6 +717,11 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         }
     }
 
+    @Override
+    public String getStatusStringByCourierNumbe(String nu) {
+        return kuaishouItemCollectSamplesMapper.getStatusStringByCourierNumbe(nu);
+    }
+
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemListServiceImpl.java

@@ -418,6 +418,11 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
         return kuaishouItemListMapper.selectMaxRelateId();
     }
 
+    @Override
+    public JSONObject selectRuleItemByItemId(Long itemId) {
+        return kuaishouItemListMapper.selectRuleItemByItemId(itemId);
+    }
+
 
 }
 

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -634,6 +634,11 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
+    public JSONObject selectKuaishouRulePromoterById(Long promoterId) {
+        return kuaishouPromoterMapper.selectKuaishouRulePromoterById(promoterId);
+    }
+
+    @Override
     public AjaxResult getPromoterInfo(String promoterId) {
         AjaxResult ajaxResult = null;
         try {

+ 124 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRuleSettlementCheckServiceImpl.java

@@ -0,0 +1,124 @@
+package com.ruixuan.isc.service.impl;
+
+
+import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.isc.entity.KuaishouRuleSettlementCheck;
+import com.ruixuan.isc.mapper.KuaishouRuleSettlementCheckMapper;
+import com.ruixuan.isc.service.IKuaishouRuleSettlementCheckService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+@Service
+public class KuaishouRuleSettlementCheckServiceImpl implements IKuaishouRuleSettlementCheckService {
+    @Autowired
+    private KuaishouRuleSettlementCheckMapper kuaishouRuleSettlementCheckMapper;
+
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public KuaishouRuleSettlementCheck selectKuaishouRuleSettlementCheckById(Long id) {
+        return kuaishouRuleSettlementCheckMapper.selectKuaishouRuleSettlementCheckById(id);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<KuaishouRuleSettlementCheck> selectKuaishouRuleSettlementCheckList(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        return kuaishouRuleSettlementCheckMapper.selectKuaishouRuleSettlementCheckList(kuaishouRuleSettlementCheck);
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int insertKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        kuaishouRuleSettlementCheck.setCreateTime(DateUtils.getNowDate());
+        return kuaishouRuleSettlementCheckMapper.insertKuaishouRuleSettlementCheck(kuaishouRuleSettlementCheck);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param kuaishouRuleSettlementCheck 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouRuleSettlementCheck(KuaishouRuleSettlementCheck kuaishouRuleSettlementCheck) {
+        kuaishouRuleSettlementCheck.setUpdateTime(DateUtils.getNowDate());
+        return kuaishouRuleSettlementCheckMapper.updateKuaishouRuleSettlementCheck(kuaishouRuleSettlementCheck);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouRuleSettlementCheckByIds(Long[] ids) {
+        return kuaishouRuleSettlementCheckMapper.deleteKuaishouRuleSettlementCheckByIds(ids);
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouRuleSettlementCheckById(Long id) {
+        return kuaishouRuleSettlementCheckMapper.deleteKuaishouRuleSettlementCheckById(id);
+    }
+
+    @Override
+    public void adds(List<KuaishouRuleSettlementCheck> checks) {
+        kuaishouRuleSettlementCheckMapper.adds(checks);
+    }
+
+    @Override
+    public List<JSONObject> getTotalList(Long date, Long promoterId, String promoterName) {
+        return kuaishouRuleSettlementCheckMapper.getTotalList(date, promoterId, promoterName);
+    }
+
+    @Override
+    public void updateFinancialReviewStatusTotal(Long statDate, Long promoterId, Integer status) {
+        kuaishouRuleSettlementCheckMapper.updateFinancialReviewStatusTotal(statDate, promoterId, status);
+    }
+
+    @Override
+    public List<JSONObject> detailList(Long date, Long promoterId, Long itemId) {
+        return kuaishouRuleSettlementCheckMapper.detailList(date, promoterId, itemId);
+    }
+
+    @Override
+    public void replacePromoterInfo(Long promoterId, String promoterInfo) {
+        kuaishouRuleSettlementCheckMapper.replacePromoterInfo(promoterId, promoterInfo);
+    }
+
+    @Override
+    public void updateCheck(KuaishouRuleSettlementCheck check) {
+        kuaishouRuleSettlementCheckMapper.updateCheck(check);
+    }
+}
+

+ 14 - 11
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRuleSettlementDataServiceImpl.java

@@ -126,7 +126,7 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
                 Integer rule_type = dataJson.getInteger("rule_type");
                 JSONObject ruleData = new JSONObject();
                 if (rule_type == 1) {
-                    ruleData = getRuleData(relateId, promoterId, ruleId,  validOrderNum);
+                    ruleData = getRuleData(relateId, promoterId, ruleId, validOrderNum);
 
                 } else if (rule_type == 2) {
                     ruleData = getOrderRuleData(relateId, promoterId, ruleId, validOrderNum);
@@ -184,9 +184,9 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
                 Integer rule_type = dataJson.getInteger("rule_type");
                 JSONObject ruleData = new JSONObject();
                 if (rule_type == 3) {
-                    ruleData = getPromoterRuleData(relateId, promoterId, ruleId,  validOrderNum);
+                    ruleData = getPromoterRuleData(relateId, promoterId, ruleId, validOrderNum);
 
-                } else  {
+                } else {
                     continue;
                 }
                 settlementData.setRuleId(ruleId);
@@ -214,7 +214,10 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
         }
     }
 
-
+    @Override
+    public List<JSONObject> getSettlementDataV2(Long date, Long promoterId, String promoterName) {
+        return kuaishouRuleSettlementDataMapper.getSettlementDataV2(date, promoterId, promoterName);
+    }
 
 
     // 按区间结算
@@ -500,11 +503,11 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
         }
         Integer itemCount = ruleJson.getInteger("startItemCount"); // 规则单数
         BigDecimal ruleAnchorAmount = ruleJson.getBigDecimal("anchorAmount"); // 规则达人激励金额
-        if(Check.isNull(ruleAnchorAmount)){
+        if (Check.isNull(ruleAnchorAmount)) {
             ruleAnchorAmount = new BigDecimal(0);
         }
         BigDecimal ruleReferenceAmount = ruleJson.getBigDecimal("referenceAmount"); // 规则达人激励金额
-        if(Check.isNull(ruleReferenceAmount)){
+        if (Check.isNull(ruleReferenceAmount)) {
             ruleReferenceAmount = new BigDecimal(0);
         }
 
@@ -577,11 +580,11 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
         }
         Integer itemCount = ruleJson.getInteger("startItemCount"); // 规则单数
         BigDecimal ruleAnchorAmount = ruleJson.getBigDecimal("anchorAmount"); // 规则达人激励金额
-        if(Check.isNull(ruleAnchorAmount)){
+        if (Check.isNull(ruleAnchorAmount)) {
             ruleAnchorAmount = new BigDecimal(0);
         }
         BigDecimal ruleReferenceAmount = ruleJson.getBigDecimal("referenceAmount"); // 规则达人激励金额
-        if(Check.isNull(ruleReferenceAmount)){
+        if (Check.isNull(ruleReferenceAmount)) {
             ruleReferenceAmount = new BigDecimal(0);
         }
 
@@ -607,7 +610,7 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
             BigDecimal referenceIncentiveAmount = count.multiply(ruleReferenceAmount); // 推荐人奖励
             anchorAmount = anchorAmount.add(promoterIncentiveAmount);
             referenceAmount = referenceAmount.add(referenceIncentiveAmount);
-            kuaishouRuleSettlementDataMapper.replacePromoterIncentiveLog( promoterId, ruleId, incentivizedCount, lastIncentivizedCount);
+            kuaishouRuleSettlementDataMapper.replacePromoterIncentiveLog(promoterId, ruleId, incentivizedCount, lastIncentivizedCount);
             returnJson.put("sonRuleId", ruleJson.getLong("id"));
             returnJson.put("ruleName", kuaishouSettlementRules.getRuleName());
             returnJson.put("anchorAmount", anchorAmount);
@@ -639,8 +642,8 @@ public class KuaishouRuleSettlementDataServiceImpl implements IKuaishouRuleSettl
     }
 
     @Override
-    public List<JSONObject> getPromoterSettlementDetail(Long date, Long promoterId, Integer settlementStatus) {
-        return kuaishouRuleSettlementDataMapper.getPromoterSettlementDetail(date, promoterId, settlementStatus);
+    public List<JSONObject> getPromoterSettlementDetail(Long date, Long promoterId, Integer settlementStatus,Long itemId) {
+        return kuaishouRuleSettlementDataMapper.getPromoterSettlementDetail(date, promoterId, settlementStatus,itemId);
     }
 
     @Override

+ 117 - 18
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JiaoYangReportController.java

@@ -1,5 +1,6 @@
 package com.ruixuan.jiaoyang.controller;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.page.TableDataInfo;
@@ -25,7 +26,9 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
 import java.util.*;
 
 @RestController
@@ -40,6 +43,104 @@ public class JiaoYangReportController extends BaseController {
     @Autowired
     private ISysUserService sysUserService;
 
+
+    /**
+     * 商品数据
+     *
+     * @return
+     */
+    @GetMapping("/profitData")
+    @ApiOperation(value = "商品列表")
+    public JSONObject profitData(String date) throws ParseException {
+
+        JSONObject returnJson = new JSONObject();
+
+        try {
+            String lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);  //  日期 -1
+            String firstDateByMonth = DateUtils.getFirstDayByMonth(); // 本月第一天
+            // date 为本月结束时间
+            String lastMonthFirstDate = DateUtils.getLastMonthFirstDay();// 上个月开始时间
+            String lastMonthEndDate = DateUtils.getLastMonthNowDay(date);// 上个月结束时间
+            JSONObject dayData = jiaoYangReportService.dayData(DateUtils.strDateTimsToInt(date), DateUtils.strDateTimsToInt(lastDate));
+            JSONArray dayArray = new JSONArray();
+            JSONObject obj1 = new JSONObject();
+            obj1.put("date", dayData.getString("date"));
+            obj1.put("gmv", dayData.getString("gmv"));
+            obj1.put("orderNum", dayData.getString("orderNum"));
+            obj1.put("validGmv", dayData.getString("validGmv"));
+            obj1.put("validOrderNum", dayData.getString("validOrderNum"));
+            obj1.put("mcnPromotionAmount", dayData.getString("mcnPromotionAmount"));
+            obj1.put("grossMargin", dayData.getString("grossMargin"));
+
+
+            JSONObject obj2 = new JSONObject();
+            obj2.put("date", dayData.getString("lastDate"));
+            obj2.put("gmv", dayData.getString("lastGmv"));
+            obj2.put("orderNum", dayData.getString("lastOrderNum"));
+            obj2.put("validGmv", dayData.getString("lastValidGmv"));
+            obj2.put("validOrderNum", dayData.getString("lastValidOrderNum"));
+            obj2.put("mcnPromotionAmount", dayData.getString("lastMcnPromotionAmount"));
+            obj2.put("grossMargin", dayData.getString("lastGrossMargin"));
+
+
+            JSONObject obj3 = new JSONObject();
+            obj3.put("date", "Gap");
+            obj3.put("gmv", dayData.getString("gvmGap"));
+            obj3.put("orderNum", dayData.getString("orderNumGap"));
+            obj3.put("validGmv", dayData.getString("validGmvGap"));
+            obj3.put("validOrderNum", dayData.getString("validOrderNumGap"));
+            obj3.put("mcnPromotionAmount", dayData.getString("mcnPromotionAmountGap"));
+            obj3.put("grossMargin", dayData.getString("grossMarginGap"));
+            dayArray.add(obj1);
+            dayArray.add(obj2);
+            dayArray.add(obj3);
+            dayArray.add(new JSONObject());
+
+            JSONObject monthData = jiaoYangReportService.monthData(DateUtils.strDateTimsToInt(firstDateByMonth), DateUtils.strDateTimsToInt(date), DateUtils.strDateTimsToInt(lastMonthFirstDate), DateUtils.strDateTimsToInt(lastMonthEndDate));
+
+
+            JSONObject obj4 = new JSONObject();
+            obj4.put("date", monthData.getString("date"));
+            obj4.put("gmv", monthData.getString("gmv"));
+            obj4.put("orderNum", monthData.getString("orderNum"));
+            obj4.put("validGmv", monthData.getString("validGmv"));
+            obj4.put("validOrderNum", monthData.getString("validOrderNum"));
+            obj4.put("mcnPromotionAmount", monthData.getString("mcnPromotionAmount"));
+            obj4.put("grossMargin", monthData.getString("grossMargin"));
+
+            JSONObject obj5 = new JSONObject();
+            obj5.put("date", monthData.getString("lastDate"));
+            obj5.put("gmv", monthData.getString("lastGmv"));
+            obj5.put("orderNum", monthData.getString("lastOrderNum"));
+            obj5.put("validGmv", monthData.getString("lastValidGmv"));
+            obj5.put("validOrderNum", monthData.getString("lastValidOrderNum"));
+            obj5.put("mcnPromotionAmount", monthData.getString("lastMcnPromotionAmount"));
+            obj5.put("grossMargin", monthData.getString("lastGrossMargin"));
+
+            JSONObject obj6 = new JSONObject();
+            obj6.put("date", "环比");
+            obj6.put("gmv", monthData.getString("gvmRadio"));
+            obj6.put("orderNum", monthData.getString("orderNumRadio"));
+            obj6.put("validGmv", monthData.getString("validGmvRadio"));
+            obj6.put("validOrderNum", monthData.getString("validOrderNumRadio"));
+            obj6.put("mcnPromotionAmount", monthData.getString("mcnPromotionAmountRadio"));
+            obj6.put("grossMargin", monthData.getString("grossMarginRadio"));
+
+            dayArray.add(obj4);
+            dayArray.add(obj5);
+            dayArray.add(obj6);
+            returnJson.put("code", 200);
+            returnJson.put("dayArray", dayArray);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", 500);
+            returnJson.put("message", e.getMessage());
+        }
+
+        return returnJson;
+    }
+
+
     /**
      * 商品数据
      *
@@ -367,6 +468,22 @@ public class JiaoYangReportController extends BaseController {
     }
 
 
+
+    @GetMapping("/getTopItem")
+    public TableDataInfo getTopItem(String statDate, Long promoterId,String  fieId,String sort) {
+        Long date = Long.valueOf(statDate.replace("-", ""));
+        startPage();
+        List<JSONObject> list = jiaoYangReportService.getTopItem(date, promoterId,fieId,sort);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/getTopItemUser")
+    public List<JSONObject> getTopItemUser() {
+        List<JSONObject> list = jiaoYangReportService.getTopItemUser();
+
+        return list;
+    }
+
     @GetMapping("/indexOrderInfo")
     @ApiOperation(value = "首页-订单数据")
     public JSONObject orderTotal(
@@ -576,24 +693,6 @@ public class JiaoYangReportController extends BaseController {
     ) {
 
         Map<String, Object> requestMap = new HashMap<>();
-
-        /*String roleId = sysRoleService.getRoleBYUserId(userId);
-        if ("jy_bd".equals(roleId) || "jy_bd_manage".equals(roleId) || "jy_scissors_manage".equals(roleId) || "jy_scissors".equals(roleId)) {
-            List<Long> userIds = new ArrayList<>();
-            if ("jy_bd_manage".equals(roleId) || "jy_scissors_manage".equals(roleId)) {
-                Long deptId = sysDeptService.getDeptIdByUserId(userId);
-                userIds = sysDeptService.getDeptUserListByDeptId(deptId);
-            } else {
-                userIds.add(userId);
-            }
-            List<Long> promoterIds = jiaoYangReportService.getPromoterIdsByUserIds(userIds);
-            if (Check.isNull(promoterIds)) {
-                return getDataTable(
-                        new ArrayList<>()
-                );
-            }
-            requestMap.put("promoterIds", promoterIds);
-        }*/
         if (dateType == 0) {
 
             if (!Check.isNull(orderStartDate)) {

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JyMaterialListController.java

@@ -1,6 +1,8 @@
 package com.ruixuan.jiaoyang.controller;
 
 
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -15,6 +17,7 @@ import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.enums.BusinessType;
 import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.poi.ExcelUtil;
 import com.ruixuan.jiaoyang.entity.JyMaterialList;
 import com.ruixuan.jiaoyang.service.IJyMaterialListService;

+ 8 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/mapper/JiaoYangReportMapper.java

@@ -42,4 +42,12 @@ public interface JiaoYangReportMapper {
     JSONObject getTimeIntervalRatio(Map<String, Object> requestMap);
 
     List<Long> getPromoterIdsByUserIds(@Param("userIds") List<Long> userIds);
+
+    JSONObject dayData(@Param("date") Long date, @Param("lastDate") Long lastDate);
+
+    JSONObject monthData(@Param("nowMonthStartDate") Long nowMonthStartDate, @Param("nowMonthEndDate") Long nowMonthEndDate, @Param("lastMonthStartDate") Long lastMonthStartDate, @Param("lastMonthEndDate") Long lastMonthEndDate);
+
+    List<JSONObject> getTopItem(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("fieId") String fieId, @Param("sort") String sort);
+
+    List<JSONObject> getTopItemUser();
 }

+ 8 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/IJiaoYangReportService.java

@@ -41,4 +41,12 @@ public interface IJiaoYangReportService {
     JSONObject getTimeIntervalRatio(Map<String, Object> requestMap);
 
     List<Long> getPromoterIdsByUserIds(List<Long> userIds);
+
+    JSONObject dayData(Long date, Long lastDate);
+
+    JSONObject monthData(Long nowMonthStartDate, Long nowMonthEndDate, Long lastMonthStartDate, Long lastMonthEndDate);
+
+    List<JSONObject> getTopItem(Long date, Long promoterId,String  fieId,String sort);
+
+    List<JSONObject> getTopItemUser();
 }

+ 20 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/impl/JiaoYangReportServiceImpl.java

@@ -103,4 +103,24 @@ public class JiaoYangReportServiceImpl implements IJiaoYangReportService {
     public List<Long> getPromoterIdsByUserIds(List<Long> userIds) {
         return jiaoYangReportMapper.getPromoterIdsByUserIds(userIds);
     }
+
+    @Override
+    public JSONObject dayData(Long date, Long lastDate) {
+        return jiaoYangReportMapper.dayData(date, lastDate);
+    }
+
+    @Override
+    public JSONObject monthData(Long nowMonthStartDate, Long nowMonthEndDate, Long lastMonthStartDate, Long lastMonthEndDate) {
+        return jiaoYangReportMapper.monthData(nowMonthStartDate, nowMonthEndDate, lastMonthStartDate, lastMonthEndDate);
+    }
+
+    @Override
+    public List<JSONObject> getTopItem(Long date, Long promoterId,String  fieId,String sort) {
+        return jiaoYangReportMapper.getTopItem(date,promoterId,fieId,sort);
+    }
+
+    @Override
+    public List<JSONObject> getTopItemUser() {
+        return jiaoYangReportMapper.getTopItemUser();
+    }
 }

+ 8 - 8
ruixuan-live/src/main/resources/mapper/bytedance/BytedancePromoterOrderListMapper.xml

@@ -181,7 +181,7 @@
         'validRadio',
         sum( total_pay_amount )/100 AS 'payAmount',
         sum( CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END )/100 AS 'validPayAmount',
-        sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END )/100 AS
+        sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END )* 0.9 /100  AS
         'regimentalPromotionAmount',
         author_bind_user_id,
         IFNULL(author_bind_user_name,'-') AS 'userName'
@@ -259,7 +259,7 @@
         sum(total_pay_amount)/100 AS 'orderAmount',
         IFNULL(round(SUM(CASE WHEN sample_voucher_status = 2 THEN total_pay_amount ELSE 0 END) / 100,2), 0) AS
         'voucherOrderAmount',
-        sum(colonel_estimated_commission)/100 AS 'regimentalPromotionAmount',
+        round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 ) AS 'regimentalPromotionAmount',
         IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN colonel_estimated_commission ELSE 0 END)/100, 0)
         AS'voucherRegimentalPromotionAmount',
         sum(colonel_real_commission)/100 AS 'totalRegimentalSettleAmount',
@@ -435,7 +435,7 @@
         sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm',
         sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount',
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission
-        else 0 end)/100 AS 'regimentalPromotionAmount',
+        else 0 end) *0.9 /100 AS 'regimentalPromotionAmount',
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
         'totalRegimentalSettleAmount'
         FROM bytedance_promoter_order_list t2
@@ -474,7 +474,7 @@
         sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm',
         sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount',
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission
-        else 0 end)/100 AS 'regimentalPromotionAmount',
+        else 0 end) * 0.9 /100 AS 'regimentalPromotionAmount',
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
         'totalRegimentalSettleAmount'
         FROM kuaishou_item_list t1
@@ -661,7 +661,7 @@
         AS 'validRadio',
         sum( CASE WHEN t2.flow_point = 'REFUND' THEN 1 ELSE 0 END ) AS 'invalidOrderNUm',
         sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.total_pay_amount ELSE 0 END ) AS 'payAmount',
-        sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) AS
+        sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) * 0.9 AS
         'regimentalPromotionAmount',
         sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_real_commission ELSE 0 END ) AS
         'totalRegimentalSettleAmount'
@@ -695,7 +695,7 @@
         sum( CASE WHEN flow_point = 'REFUND' THEN 1 ELSE 0 END ) AS 'invalidOrderNUm',
         round( sum( CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END )/ 100, 2 ) AS 'payAmount',
         CONCAT(round(colonel_commission_rate/100,2),'%') AS 'regimentalPromotionRate',
-        round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END ) / 100, 2 ) AS
+        round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 ) AS
         'regimentalPromotionAmount',
         round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_real_commission ELSE 0 END ) / 100, 2 ) AS
         'totalRegimentalSettleAmount',
@@ -779,7 +779,7 @@
         sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNum',
         concat(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id) * 100, 2), '%') as 'validOrderRate',
         round(sum(t2.total_pay_amount) / 100, 2) as 'orderAmount',
-        round(sum(t2.colonel_estimated_commission) / 100, 2) as 'regimentalPromotionAmount',
+        round( sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 ) as 'regimentalPromotionAmount',
         round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount'
         from promoter_bind_channel_date t1
         left join bytedance_promoter_order_list t2
@@ -842,7 +842,7 @@
         sum(case when t2.flow_point != 'REFUND' then 1 else 0 end)                                     as 'validOrderNum',
         concat(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id)   * 100, 2), '%') as 'validOrderRate',
         round(sum(t2.total_pay_amount) / 100, 2)                                     as 'orderAmount',
-        round(sum(t2.colonel_estimated_commission) / 100, 2)                      as 'regimentalPromotionAmount',
+        round( sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 )                      as 'regimentalPromotionAmount',
         round(sum(t2.colonel_real_commission) / 100, 2)                   as 'totalRegimentalSettleAmount'
         from kuaishou_promoter t1
         left join(select *

+ 11 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -28,6 +28,7 @@
         <result property="promoterAddress" column="promoter_address"/>
         <result property="consignee" column="consignee"/>
         <result property="courierNumber" column="courier_number"/>
+        <result property="companyCode" column="company_code"/>
         <result property="courierNumberTime" column="courier_number_time"/>
         <result property="taskFileUrl" column="task_file_url"/>
         <result property="collectSampleStatus" column="collect_sample_status"/>
@@ -63,6 +64,7 @@
                promoter_address,
                consignee,
                courier_number,
+               company_code,
                courier_number_time,
                task_file_url,
                collect_sample_status,
@@ -100,6 +102,7 @@
         t1.promoter_address,
         t1.consignee,
         t1.courier_number,
+        t1.company_code,
         t1.courier_number_time,
         t1.task_file_url,
         t1.collect_sample_status,
@@ -330,6 +333,7 @@
             <if test="promoterAddress != null">promoter_address,</if>
             <if test="consignee != null">consignee,</if>
             <if test="courierNumber != null">courier_number,</if>
+            <if test="companyCode != null">company_code,</if>
             <if test="courierNumberTime != null">courier_number_time,</if>
             <if test="taskFileUrl != null">task_file_url,</if>
             <if test="collectSampleStatus != null">collect_sample_status,</if>
@@ -363,6 +367,7 @@
             <if test="promoterAddress != null">#{promoterAddress},</if>
             <if test="consignee != null">#{consignee},</if>
             <if test="courierNumber != null">#{courierNumber},</if>
+            <if test="companyCode != null">#{companyCode},</if>
             <if test="courierNumberTime != null">#{courierNumberTime},</if>
             <if test="taskFileUrl != null">#{taskFileUrl},</if>
             <if test="collectSampleStatus != null">#{collectSampleStatus},</if>
@@ -396,6 +401,7 @@
         promoter_address,
         consignee,
         courier_number,
+        company_code,
         courier_number_time,
         task_file_url,
         promoter_url,
@@ -428,6 +434,7 @@
             #{add.promoterAddress},
             #{add.consignee},
             #{add.courierNumber},
+            #{add.companyCode},
             #{add.courierNumberTime},
             #{add.taskFileUrl},
             #{add.promoterUrl},
@@ -519,6 +526,7 @@
             <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
             <if test="consignee != null">consignee = #{consignee},</if>
             <if test="courierNumber != null">courier_number = #{courierNumber},</if>
+            <if test="companyCode != null">company_code = #{companyCode},</if>
             <if test="courierNumberTime != null">courier_number_time = #{courierNumberTime},</if>
             <if test="taskFileUrl != null">task_file_url = #{taskFileUrl},</if>
             <if test="collectSampleStatus != null">collect_sample_status = #{collectSampleStatus},</if>
@@ -734,6 +742,9 @@
         WHERE t1.collect_sample_status = 5
           AND t2.valid_order_num >= 50
     </select>
+    <select id="getStatusStringByCourierNumbe" resultType="java.lang.String" parameterType="java.lang.String">
+        select  collect_sample_desc  from ruixuan.kuaishou_item_collect_samples where  courier_number = #{num} limit 1
+    </select>
 
     <!--    出单量 >= 50 且 状态为5已签收待上传作业 的数据 改为 状态 7(审核通过)并备注-->
     <update id="updateByIds" parameterType="com.ruixuan.isc.entity.KuaishouItemCollectSamples">

+ 12 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemListMapper.xml

@@ -188,6 +188,18 @@
         order by create_time desc
 
     </select>
+    <select id="selectRuleItemByItemId" resultType="com.alibaba.fastjson.JSONObject"
+            parameterType="java.lang.Long">
+        select item_id                 as 'itemId',
+       item_title              as 'itemTitle',
+       user_id                 as 'userId',
+       group_concat(user_name) as 'userName'
+from kuaishou_item_list
+where item_id = #{itemId}
+  and media_id = 2
+group by item_id
+
+    </select>
 
     <select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
         select item_id as 'itemId',

+ 19 - 2
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -274,7 +274,8 @@
         where id = #{id}
     </select>
 
-    <select id="selectKuaishouPromoterById3" parameterType="Long" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
+    <select id="selectKuaishouPromoterById3" parameterType="Long"
+            resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
         select id,
                media_id,
                user_id,
@@ -492,7 +493,8 @@
     </insert>
 
 
-    <insert id="insertKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter" useGeneratedKeys="true"
+    <insert id="insertKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter"
+            useGeneratedKeys="true"
             keyProperty="id">
         insert into jy_kuaishou_promoter
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -796,6 +798,21 @@
         from kuaishou_settlement_rules
         where id = #{ruleId}
     </select>
+    <select id="selectKuaishouRulePromoterById" resultType="com.alibaba.fastjson.JSONObject"
+            parameterType="java.lang.Long">
+select promoter_id                as 'promoterId',
+       promoter_nick_name         as 'promoterName',
+       t2.user_id                 as 'userId',
+       group_concat(t1.user_name) as 'userName'
+from kuaishou_promoter t1
+         left join sys_user_role t2 on t1.user_id = t2.user_id
+where promoter_id = #{promoterId}
+  and    media_id = 2
+  and t2.role_id not in (210114, 210115)
+  and t2.user_id not in (270128)
+group by promoter_id
+
+    </select>
 
 
     <insert id="addPromotersCount">

+ 267 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouRuleSettlementCheckMapper.xml

@@ -0,0 +1,267 @@
+<?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.ruixuan.isc.mapper.KuaishouRuleSettlementCheckMapper">
+
+    <resultMap type="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck" id="KuaishouRuleSettlementCheckResult">
+        <result property="id" column="id"/>
+        <result property="relateId" column="relate_id"/>
+        <result property="itemIds" column="item_ids"/>
+        <result property="itemTitle" column="item_title"/>
+        <result property="promoterId" column="promoter_id"/>
+        <result property="promoterName" column="promoter_name"/>
+        <result property="itemCreateId" column="item_create_id"/>
+        <result property="itemCreateName" column="item_create_name"/>
+        <result property="promoterCreateId" column="promoter_create_id"/>
+        <result property="promoterCreateName" column="promoter_create_name"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="anchorAmount" column="anchor_amount"/>
+        <result property="shouldAnchorAmount" column="should_anchor_amount"/>
+        <result property="referenceAmount" column="reference_amount"/>
+        <result property="shouldReferenceAmount" column="should_reference_amount"/>
+        <result property="settlementStatus" column="settlement_status"/>
+        <result property="remarks" column="remarks"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouRuleSettlementCheckVo">
+        select id, relate_id, item_ids,item_title, promoter_id, promoter_name, item_create_id, item_create_name, promoter_create_id, promoter_create_name, stat_date, anchor_amount, should_anchor_amount,reference_amount,should_reference_amount, settlement_status, remarks, create_time, update_time from kuaishou_rule_settlement_check
+    </sql>
+
+    <select id="selectKuaishouRuleSettlementCheckList"
+            parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck"
+            resultMap="KuaishouRuleSettlementCheckResult">
+        <include refid="selectKuaishouRuleSettlementCheckVo"/>
+        <where>
+            <if test="relateId != null ">and relate_id = #{relateId}</if>
+            <if test="itemIds != null  and itemIds != ''">and item_ids = #{itemIds}</if>
+            <if test="itemTitle != null  and itemTitle != ''">and item_title = #{itemTitle}</if>
+            <if test="promoterId != null ">and promoter_id = #{promoterId}</if>
+            <if test="promoterName != null  and promoterName != ''">and promoter_name like concat('%', #{promoterName},
+                '%')
+            </if>
+            <if test="itemCreateId != null ">and item_create_id = #{itemCreateId}</if>
+            <if test="itemCreateName != null  and itemCreateName != ''">and item_create_name like concat('%',
+                #{itemCreateName}, '%')
+            </if>
+            <if test="promoterCreateId != null ">and promoter_create_id = #{promoterCreateId}</if>
+            <if test="promoterCreateName != null  and promoterCreateName != ''">and promoter_create_name like
+                concat('%', #{promoterCreateName}, '%')
+            </if>
+            <if test="statDate != null ">and stat_date = #{statDate}</if>
+            <if test="anchorAmount != null ">and anchor_amount = #{anchorAmount}</if>
+            <if test="shouldAnchorAmount != null ">and should_anchor_amount = #{shouldAnchorAmount}</if>
+            <if test="referenceAmount != null ">and reference_amount = #{referenceAmount}</if>
+            <if test="shouldReferenceAmount != null ">and shouldReferenceAmount = #{shouldReferenceAmount}</if>
+            <if test="settlementStatus != null ">and settlement_status = #{settlementStatus}</if>
+            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouRuleSettlementCheckById" parameterType="java.lang.Long"
+            resultMap="KuaishouRuleSettlementCheckResult">
+        <include refid="selectKuaishouRuleSettlementCheckVo"/>
+        where id = #{id}
+    </select>
+    <select id="getTotalList" resultType="com.alibaba.fastjson.JSONObject">
+        select t.*,t2.promoter_info as 'promoterInfo'
+        from (select promoter_create_name as 'userName',
+        promoter_id as 'promoterId',
+        promoter_name as 'promoterName',
+        sum(anchor_amount) as 'anchorAmount',
+        sum(reference_amount) as 'referenceAmount',
+        sum((case
+        when settlement_status = 1
+        then anchor_amount
+        else
+        0 end
+        )) as 'waitAnchorAmount'
+        from kuaishou_rule_settlement_check
+        where stat_date = #{date}
+        <if test="promoterId != null and promoterId != '' ">
+            and promoter_id = #{promoterId}
+        </if>
+        <if test="promoterName != null and promoterName != '' ">
+            AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
+        </if>
+        group by promoter_id) t left join kuaishou_rule_settlement_mentor t2
+        on t.promoterId = t2.promoter_id
+        order by t.referenceAmount desc, t.promoterId asc
+    </select>
+    <select id="detailList" resultType="com.alibaba.fastjson.JSONObject">
+        select t.id as 'id',
+        t.item_ids as 'itemIds',
+        t.item_title as 'itemName',
+        t.promoter_id as 'promoterId',
+        t.promoter_create_name as 'promoterCreateName',
+        t.promoter_name as 'promoterName',
+        t.item_create_id as 'itemCreateId',
+        t.item_create_name as 'itemCreateName',
+        t.anchor_amount as 'anchorAmount',
+        t.reference_amount as 'referenceAmount',
+        t.valid_order_num as 'validOrderNum',
+        (case
+        when t.settlement_status = 1 then '待付款'
+        when t.settlement_status = 2 then '已付款'
+        else ''
+        end
+        ) as 'settlementStatusStr',
+        t.settlement_status as 'settlementStatus',
+        t.remarks as 'remarks',
+        t2.promoter_info as 'promoterInfo'
+        from kuaishou_rule_settlement_check t left join kuaishou_rule_settlement_mentor t2
+        on t.promoter_id = t2.promoter_id
+        where t.promoter_id = #{promoterId}
+        and t.stat_date = #{date}
+        <if test="itemId != null  ">
+            and t.item_ids like concat('%',concat(#{itemId},'%'))
+        </if>
+        order by t.anchor_amount desc, t.item_ids asc
+    </select>
+
+    <insert id="insertKuaishouRuleSettlementCheck" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into kuaishou_rule_settlement_check
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="relateId != null">relate_id,</if>
+            <if test="itemIds != null">item_ids,</if>
+            <if test="itemTitle != null">item_title,</if>
+            <if test="promoterId != null">promoter_id,</if>
+            <if test="promoterName != null">promoter_name,</if>
+            <if test="itemCreateId != null">item_create_id,</if>
+            <if test="itemCreateName != null">item_create_name,</if>
+            <if test="promoterCreateId != null">promoter_create_id,</if>
+            <if test="promoterCreateName != null">promoter_create_name,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="anchorAmount != null">anchor_amount,</if>
+            <if test="shouldAnchorAmount != null">should_anchor_amount,</if>
+            <if test="referenceAmount != null">reference_amount,</if>
+            <if test="shouldReferenceAmount != null">should_reference_amount,</if>
+            <if test="settlementStatus != null">settlement_status,</if>
+            <if test="remarks != null">remarks,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="relateId != null">#{relateId},</if>
+            <if test="itemIds != null">#{itemIds},</if>
+            <if test="itemTitle != null">#{itemTitle},</if>
+            <if test="promoterId != null">#{promoterId},</if>
+            <if test="promoterName != null">#{promoterName},</if>
+            <if test="itemCreateId != null">#{itemCreateId},</if>
+            <if test="itemCreateName != null">#{itemCreateName},</if>
+            <if test="promoterCreateId != null">#{promoterCreateId},</if>
+            <if test="promoterCreateName != null">#{promoterCreateName},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="anchorAmount != null">#{anchorAmount},</if>
+            <if test="shouldAnchorAmount != null">#{shouldAnchorAmount},</if>
+            <if test="referenceAmount != null">#{referenceAmount},</if>
+            <if test="shouldReferenceAmount != null">#{shouldReferenceAmount},</if>
+            <if test="settlementStatus != null">#{settlementStatus},</if>
+            <if test="remarks != null">#{remarks},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+    <insert id="adds">
+
+        insert into kuaishou_rule_settlement_check(
+        relate_id,
+        item_ids,
+        item_title,
+        item_create_id,
+        item_create_name,
+        promoter_id,
+        promoter_name,
+        promoter_create_id,
+        promoter_create_name,
+        stat_date,
+        anchor_amount,
+        should_anchor_amount,
+        reference_amount,
+        should_reference_amount,
+        settlement_status,
+        remarks,
+        valid_order_num
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.relateId},
+            #{add.itemIds},
+            #{add.itemTitle},
+            #{add.itemCreateId},
+            #{add.itemCreateName},
+            #{add.promoterId},
+            #{add.promoterName},
+            #{add.promoterCreateId},
+            #{add.promoterCreateName},
+            #{add.statDate},
+            #{add.anchorAmount},
+            #{add.shouldAnchorAmount},
+            #{add.referenceAmount},
+            #{add.shouldReferenceAmount},
+            #{add.settlementStatus},
+            #{add.remarks},
+            #{add.validOrderNum}
+            )
+        </foreach>
+
+    </insert>
+    <insert id="replacePromoterInfo">
+        replace into kuaishou_rule_settlement_mentor(promoter_id,promoter_info) values (
+        #{promoterId},
+        #{promoterInfo}
+        )
+    </insert>
+
+    <update id="updateKuaishouRuleSettlementCheck" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck">
+        update kuaishou_rule_settlement_check
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="relateId != null">relate_id = #{relateId},</if>
+            <if test="itemIds != null">item_ids = #{itemIds},</if>
+            <if test="itemTitle != null">item_title = #{itemTitle},</if>
+            <if test="promoterId != null">promoter_id = #{promoterId},</if>
+            <if test="promoterName != null">promoter_name = #{promoterName},</if>
+            <if test="itemCreateId != null">item_create_id = #{itemCreateId},</if>
+            <if test="itemCreateName != null">item_create_name = #{itemCreateName},</if>
+            <if test="promoterCreateId != null">promoter_create_id = #{promoterCreateId},</if>
+            <if test="promoterCreateName != null">promoter_create_name = #{promoterCreateName},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="anchorAmount != null">anchor_amount = #{anchorAmount},</if>
+            <if test="shouldAnchorAmount != null">should_anchor_amount = #{shouldAnchorAmount},</if>
+            <if test="referenceAmount != null">reference_amount = #{referenceAmount},</if>
+            <if test="shouldReferenceAmount != null">should_reference_amount = #{shouldAeferenceAmount},</if>
+            <if test="settlementStatus != null">settlement_status = #{settlementStatus},</if>
+            <if test="remarks != null">remarks = #{remarks},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+    <update id="updateFinancialReviewStatusTotal">
+        update kuaishou_rule_settlement_check set settlement_status = #{status}
+        where promoter_id = #{promoterId}
+        and  stat_date = #{statDate}
+        and  settlement_status = 1
+    </update>
+    <update id="updateCheck" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck">
+        update kuaishou_rule_settlement_check set anchor_amount = #{anchorAmount},reference_amount = #{referenceAmount},remarks = #{remarks}
+        where promoter_id = #{promoterId}
+        and  stat_date = #{statDate}
+        and  relate_id = #{relateId}
+    </update>
+
+    <delete id="deleteKuaishouRuleSettlementCheckById" parameterType="java.lang.Long">
+        delete from kuaishou_rule_settlement_check where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouRuleSettlementCheckByIds" parameterType="java.lang.String">
+        delete from kuaishou_rule_settlement_check where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 73 - 42
ruixuan-live/src/main/resources/mapper/isc/KuaishouRuleSettlementDataMapper.xml

@@ -26,12 +26,13 @@
         <result property="anchorAmount" column="anchor_amount"/>
         <result property="referenceAmount" column="reference_amount"/>
         <result property="settlementStatus" column="settlement_status"/>
+        <result property="remarks" column="remarks"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectKuaishouRuleSettlementDataVo">
-        select id, rule_id, rule_type,rule_name, son_rule_id, relate_id, item_ids, promoter_id, promoter_name, item_create_id, item_create_name, promoter_create_id, promoter_create_name, order_num, valid_order_num, yesterday_order_num, yesterday_valid_order_num, stat_date, anchor_amount, reference_amount, settlement_status, create_time, update_time from kuaishou_rule_settlement_data
+        select id, rule_id, rule_type,rule_name, son_rule_id, relate_id, item_ids, promoter_id, promoter_name, item_create_id, item_create_name, promoter_create_id, promoter_create_name, order_num, valid_order_num, yesterday_order_num, yesterday_valid_order_num, stat_date, anchor_amount, reference_amount, settlement_status,remarks,create_time, update_time from kuaishou_rule_settlement_data
     </sql>
 
     <select id="selectKuaishouRuleSettlementDataList" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementData"
@@ -39,7 +40,7 @@
         <include refid="selectKuaishouRuleSettlementDataVo"/>
         <where>
             <if test="ruleId != null ">and rule_id = #{ruleId}</if>
-            <if test="ruleName != null ">and rule_name like concat('%', #{ruleName}, '%')</if>
+            <if test="ruleName != null ">and rule_name like +concat('%', #{ruleName}, '%')</if>
             <if test="sonRuleId != null ">and son_rule_id = #{sonRuleId}</if>
             <if test="relateId != null ">and relate_id = #{relateId}</if>
             <if test="itemIds != null  and itemIds != ''">and item_ids = #{itemIds}</if>
@@ -97,6 +98,7 @@
             <if test="anchorAmount != null">anchor_amount,</if>
             <if test="referenceAmount != null">reference_amount,</if>
             <if test="settlementStatus != null">settlement_status,</if>
+            <if test="remarks != null">remarks,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
         </trim>
@@ -151,6 +153,7 @@
             <if test="anchorAmount != null">anchor_amount = #{anchorAmount},</if>
             <if test="referenceAmount != null">reference_amount = #{referenceAmount},</if>
             <if test="settlementStatus != null">settlement_status = #{settlementStatus},</if>
+            <if test="remarks != null">remarks = #{remarks},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
@@ -211,16 +214,16 @@
         from kuaishou_rule_detail where rule_id = #{ruleId}
     </select>
     <select id="lastRule" resultType="com.alibaba.fastjson.JSONObject">
-        select son_rule_id  as 'sonRuleId',
-        (select  sort_count  from kuaishou_rule_detail where  id = t1.son_rule_id) as 'sortCount',
-         IFNULL(valid_order_num,0)  as 'validOrderNum'
-        from  kuaishou_rule_settlement_data t1
+        select son_rule_id as 'sonRuleId',
+        (select sort_count from kuaishou_rule_detail where id = t1.son_rule_id) as 'sortCount',
+        IFNULL(valid_order_num,0) as 'validOrderNum'
+        from kuaishou_rule_settlement_data t1
         where 1 = 1
         <if test="relateId != null and relateId != ''">
-         and   relate_id = #{relateId}
+            and relate_id = #{relateId}
         </if>
-        and  promoter_id = #{promoterId}
-        and  rule_id = #{ruleId}
+        and promoter_id = #{promoterId}
+        and rule_id = #{ruleId}
         and settlement_status != 1
         order by create_time desc limit 1
     </select>
@@ -244,7 +247,6 @@
     </select>
 
 
-
     <insert id="replaceIncentiveLog">
         replace into kuaishou_rule_incentive_log (
         relate_id,
@@ -279,7 +281,6 @@
     </insert>
 
 
-
     <select id="getTotalByCountAndRuleId" resultType="com.alibaba.fastjson.JSONObject">
         select
         ifnull(round(sum(anchor_amount) * #{incentivizedCount}, 2),0)    as 'anchorAmount',
@@ -292,26 +293,9 @@
 
     </select>
     <select id="getSettlementDate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
-        <!--        select t.* from (
-                select
-                promoter_id as 'promoterId',
-                promoter_name as 'promoterName',
-                sum(anchor_amount) as 'anchorAmount',
-                sum(reference_amount) as 'referenceAmount'
-                from kuaishou_rule_settlement_data
-                where stat_date = #{statDate}
-                and settlement_status != 3
-                <if test="promoterId != null and promoterId != '' ">
-                    and promoter_id = #{promoterId}
-                </if>
-                <if test="promoterName != null and promoterName != '' ">
-                    AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
-                </if>
-                group by promoter_id) t order by t.anchorAmount desc-->
-
         select t.*, t2.item_title as 'itemName',
-         t2.user_name as  'itemUserName',
-        (select  user_name  from  kuaishou_promoter where promoter_id = t.promoterId limit 1) as 'promoterUserName'
+        t2.user_name as 'itemUserName',
+        (select user_name from kuaishou_promoter where promoter_id = t.promoterId limit 1) as 'promoterUserName'
         from (select id as 'id',
         rule_name as 'ruleName',
         item_ids as 'itemIds',
@@ -326,9 +310,9 @@
         settlement_status as 'settlementStatus',
         (
         case
-         when settlement_status = 1 then '未达到结算规则'
-         when settlement_status = 2 then '待结算'
-         when settlement_status = 3 then '已结算'
+        when settlement_status = 1 then '未达到结算规则'
+        when settlement_status = 2 then '待结算'
+        when settlement_status = 3 then '已结算'
         else '-'
         end
         ) as 'settlementStatusDesc'
@@ -347,19 +331,56 @@
         left join kuaishou_item_list t2 on t.itemId = t2.item_id
         order by t.settlementStatus asc
     </select>
+
+    <select id="getSettlementDataV2" resultType="com.alibaba.fastjson.JSONObject">
+        select t.*,t2.* from (
+        select
+        promoter_id as 'promoterId',
+        sum((case when settlement_status = 2
+        then anchor_amount
+        else
+        0 end
+
+        )) as 'waitAnchorAmount',
+        sum(anchor_amount) as 'anchorAmount',
+        sum(reference_amount) as 'referenceAmount'
+        from kuaishou_rule_settlement_data
+        where stat_date = #{date}
+        <if test="promoterId == null  ">
+            and anchor_amount > 0
+        </if>
+        group by promoter_id) t left join(
+        select promoter_id,promoter_nick_name as 'promoterName',t2.user_id as 'userId',group_concat(t1.user_name) as 'userName'
+        from kuaishou_promoter t1
+        left join sys_user_role t2 on t1.user_id = t2.user_id
+        where media_id = 2
+        and t2.role_id not in (210114, 210115) and t2.user_id not in(270128) group by promoter_id
+        ) t2 on t.promoterId = t2.promoter_id
+        where 1 = 1
+        <if test="promoterId != null and promoterId != '' ">
+            and t.promoterId = #{promoterId}
+        </if>
+
+        <if test="promoterName != null and promoterName != '' ">
+            AND t2.promoterName LIKE CONCAT('%', #{promoterName}, '%')
+        </if>
+        order by t.anchorAmount desc,t.promoterId asc
+    </select>
+
+
     <select id="getPromoterSettlementDetail" resultType="com.alibaba.fastjson.JSONObject">
+        select t1.*,t2.* from (
+
         select
         id as 'id',
         rule_id as 'ruleId',
         rule_name as 'ruleName',
         son_rule_id as 'sonRuleId',
         item_ids as 'itemIds',
+        ( select item_title from kuaishou_item_list where item_id = substring_index(item_ids, ',', 1)) as 'itemName',
         promoter_id as 'promoterId',
-        promoter_name as 'promoterName',
         item_create_id as 'itemCreateId',
         item_create_name as 'itemCreateName',
-        promoter_create_id as 'promoterCreateId',
-        promoter_create_name as 'promoterCreateName',
         order_num as 'orderNum',
         valid_order_num as 'validOrderNum',
         last_settlement_order_num as 'lastSettlementOrderNum',
@@ -372,14 +393,26 @@
         else ''
         end
         ) as 'settlementStatusStr',
-        settlement_status as 'settlementStatus'
+        settlement_status as 'settlementStatus',
+        remarks as 'remarks'
         from kuaishou_rule_settlement_data
         where promoter_id = #{promoterId}
         and stat_date = #{date}
-        <if test="settlementStatus != null and settlementStatus != ''">
-            and settlement_status = #{settlementStatus}
+        <if test="itemId == null  ">
+            and anchor_amount > 0
         </if>
-        order by anchor_amount desc
+        <if test="itemId != null  ">
+            and item_ids like concat('%',concat(#{itemId},'%'))
+        </if>
+        ) t1 left join (
+        select promoter_id,promoter_nick_name as 'promoterName',t2.user_id as 'promoterCreateId',group_concat(t1.user_name) as
+        'promoterCreateName'
+        from kuaishou_promoter t1
+        left join sys_user_role t2 on t1.user_id = t2.user_id
+        where media_id = 2
+        and t2.role_id not in (210114, 210115) and t2.user_id not in(270128) group by promoter_id
+        ) t2 on t1.promoterId = t2.promoter_id
+        order by t1.anchorAmount desc ,t1.itemIds asc
 
     </select>
     <select id="getRuleJson" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
@@ -480,9 +513,7 @@
             #{add.lastSettlementOrderNum}
             )
         </foreach>
-
     </insert>
 
 
-
 </mapper>

+ 75 - 29
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -25,9 +25,12 @@
         round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
         sum(pay_amount) as 'payAmount',
         sum(case when order_status != 80 then pay_amount else 0 end) as 'validPayAmount',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
         round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
         then 1 else 0 end),4) as 'deliveryRadio',
         sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount'
         from kuaishou_supply_chain
@@ -88,9 +91,12 @@
         round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
         sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
         regimental_promotion_rate as 'regimentalPromotionRate',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
         round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
         then 1 else 0 end),4) as 'deliveryRadio'
         from kuaishou_supply_chain
         where 1= 1
@@ -149,10 +155,13 @@
         count(t1.oid) as 'orderNum',
         sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid), 4) as 'validRadio',
-        sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t1.send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when t1.order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
         sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
-        t1.order_status != 80 then 1 else 0 end), 4) as 'deliveryRadio',
+        send_status = 1 then 1 else 0 end), 4) as 'deliveryRadio',
         t1.item_commission_rate as 'itemCommissionRate'
         from kuaishou_supply_chain t1
         left join kuaishou_item_bind_user t2
@@ -199,11 +208,14 @@
         sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),
         4) as 'validRadio',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
         sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
         when
-        order_status != 80
+        send_status = 1
         then 1
         else 0 end),
         4) as 'deliveryRadio',
@@ -256,9 +268,12 @@
         regimental_promotion_rate as 'regimentalPromotionRate',
         sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
         round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
         then 1 else 0 end),4) as 'deliveryRadio'
         from kuaishou_supply_chain
         where 1= 1
@@ -292,9 +307,12 @@
         count(oid) as 'orderNum',
         sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
         round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
         then 1 else 0 end),4) as 'deliveryRadio',
         sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
         regimental_promotion_rate as 'regimentalPromotionRate',
@@ -869,10 +887,13 @@
         count(t2.oid) as 'orderNum',
         sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid),4) as 'validRadio',
-        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
         sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
-        when t2.order_status != 80
+        when send_status = 1
         then 1
         else 0 end),
         4) as 'deliveryRadio',
@@ -937,10 +958,21 @@
         sum(
         CASE
         WHEN t2.send_status = 1
-        AND t2.order_status != 80 THEN 1
+        THEN 1
         ELSE 0
         END
         ) AS 'deliveryNum',
+
+        round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+
+        sum(
+        CASE
+        WHEN t2.send_status = 1
+        AND t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) AS 'effDeliveryNum',
         sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(
         sum(
@@ -951,7 +983,7 @@
         END
         ) / sum(
         CASE
-        WHEN t2.order_status != 80 THEN 1
+        WHEN t2.send_status = 1 THEN 1
         ELSE 0
         END
         ),
@@ -1099,10 +1131,21 @@
         sum(
         CASE
         WHEN t2.send_status = 1
-        AND t2.order_status != 80 THEN 1
+        THEN 1
         ELSE 0
         END
         ) AS 'deliveryNum',
+
+        round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+
+        sum(
+        CASE
+        WHEN t2.send_status = 1
+        AND t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) AS 'effDeliveryNum',
         sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(
         sum(
@@ -1113,7 +1156,7 @@
         END
         ) / sum(
         CASE
-        WHEN t2.order_status != 80 THEN 1
+        WHEN t2.send_status != 80 THEN 1
         ELSE 0
         END
         ),
@@ -1289,7 +1332,7 @@
         COUNT(order_id) as 'allNumber',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'orderAmount',
-        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
         'regimentalPromotionAmount'
         FROM bytedance_order_list
         WHERE pay_success_time >= #{startDate}
@@ -1335,7 +1378,7 @@
         COUNT(order_id) as 'allNumber',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END)/100, 0) AS 'orderAmount',
-        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END)/100,0) AS
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 /100,0) AS
         'regimentalPromotionAmount'
         FROM bytedance_order_list
         WHERE pay_success_time >= #{startDate}
@@ -1429,7 +1472,7 @@
         count(1) AS 'orderCount',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
-        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 ,0) AS
         'regimentalPromotionAmount',
         COUNT(DISTINCT author_short_id) as 'promoterCount'
         FROM bytedance_order_list
@@ -1472,7 +1515,7 @@
         count(1) AS 'orderCount',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
         IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
-        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
         'regimentalPromotionAmount'
         FROM bytedance_order_list
         WHERE pay_success_time >= #{startLong}
@@ -1537,7 +1580,7 @@
         (
         SELECT
         IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
-        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount'
         FROM bytedance_order_list t1
         WHERE flow_point != 'REFUND'
         <if test='promoterIds != null and promoterIds.size() > 0'>
@@ -1552,7 +1595,7 @@
         (
         SELECT
         IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
-        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount'
         FROM bytedance_order_list t1
         WHERE flow_point != 'REFUND'
         <if test='promoterIds != null and promoterIds.size() > 0'>
@@ -1625,7 +1668,7 @@
         (
         SELECT
         IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
-        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount',
         COUNT(order_id) as 'orderCount'
         FROM bytedance_order_list t1
         WHERE flow_point != 'REFUND'
@@ -1643,7 +1686,7 @@
         (
         SELECT
         IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
-        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount',
         COUNT(order_id) as 'orderCount'
         FROM bytedance_order_list t1
         WHERE flow_point != 'REFUND'
@@ -2049,10 +2092,13 @@
         count(t2.oid) as 'orderNum',
         sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
         round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4) as 'validRadio',
-        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'shippingGreen',
+        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
         sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
-        when t2.order_status != 80
+        when t2.send_status = 1
         then 1
         else 0 end),
         4) as 'deliveryRadio',
@@ -2202,7 +2248,7 @@
         from user_promoters_count
         where media_id = 2) ttttt
         on t.collectSampleId = ttttt.user_id
-        where  t.orderNum > 0
+        where t.orderNum > 0
         order by t.orderNum desc
     </select>
     <select id="bdTotalV2" resultType="com.alibaba.fastjson.JSONObject">

+ 120 - 5
ruixuan-live/src/main/resources/mapper/jiaoyang/JiaoYangReportMapper.xml

@@ -79,6 +79,8 @@
     <select id="promoter" resultType="com.alibaba.fastjson.JSONObject">
         select t.*,
         tt.head_img as 'headImg',
+        tt.video_count as 'videoCount',
+        tt.video_show as 'videoShow',
         ttt.type as 'type',
         ttt.user_name as 'userName'
         from (
@@ -121,14 +123,14 @@
             </foreach>
         </if>
         group by clip_user_id) t
-        left join ( select * from jy_clip_cooperation where stat_date = DATE_FORMAT(NOW(),'%Y%m%d')) tt on t.promoterId
-        = tt.clip_id
+        left join ( select * from jy_clip_cooperation where stat_date = DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1
+        DAY),'%Y%m%d') ) tt on t.promoterId = tt.clip_id
         left join jy_kuaishou_promoter ttt on t.promoterId = ttt.promoter_id
         where 1 = 1
         <if test="type != null and type != '' ">
             and ttt.type = #{type}
         </if>
-        order by t.orderNum desc
+        order by t.payAmount desc
     </select>
     <select id="anchorOrderDetail" resultType="com.alibaba.fastjson.JSONObject">
         select t.*
@@ -230,10 +232,10 @@
         where
         stat_date = #{date}
         <if test="promoterId != null and promoterId != ''">
-            and clipId = #{promoterId}
+            and clip_id = #{promoterId}
         </if>
         <if test="promoterName != null and promoterName != ''">
-            and clipName like concat(concat('%',#{promoterName}),'%')
+            and clip_name like concat(concat('%',#{promoterName}),'%')
         </if>
     </select>
     <select id="getOrderTotal" resultType="com.alibaba.fastjson.JSONObject">
@@ -614,6 +616,119 @@
             #{userId}
         </foreach>
     </select>
+    <select id="dayData" resultType="com.alibaba.fastjson.JSONObject">
+        select *,
+       t1.gmv - t2.lastGmv                               as 'gvmGap',
+       t1.orderNum - t2.lastOrderNum                     as 'orderNumGap',
+       t1.validGmv - t2.lastValidGmv                     as 'validGmvGap',
+       t1.validOrderNUm - t2.lastValidOrderNUm           as 'validOrderNumGap',
+       t1.mcnPromotionAmount - t2.lastMcnPromotionAmount as 'mcnPromotionAmountGap',
+       t1.grossMargin - t2.lastGrossMargin               as 'grossMarginGap'
+from (select date_format(#{date},'%Y/%m/%d')                                                                   as 'date',
+             round(sum(pay_amount) / 100, 2)                                              as 'gmv',
+             count(oid)                                                                   as 'orderNum',
+             round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'validGmv',
+             sum(case when order_status != 80 then 1 else 0 end)                          as 'validOrderNum',
+             round(sum(mcn_promotion_amount) / 100, 2)                                    as 'mcnPromotionAmount',
+             round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2)                  as 'grossMargin'
+      from  jy_order_list t1 left join jy_kuaishou_promoter t2
+     on t1.clip_user_id = t2.promoter_id
+      where t1.stat_date = #{date}
+      and t2.type = 1
+      ) t1
+         join (select date_format(#{lastDate} ,'%Y/%m/%d')                                                                       as 'lastDate',
+                      round(sum(pay_amount) / 100, 2)                                              as 'lastGmv',
+                      count(oid)                                                                   as 'lastOrderNum',
+                      round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'lastValidGmv',
+                      sum(case when order_status != 80 then 1 else 0 end)                          as 'lastValidOrderNum',
+                      round(sum(mcn_promotion_amount) / 100, 2)                                    as 'lastMcnPromotionAmount',
+                      round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2)                  as 'lastGrossMargin'
+               from jy_order_list t1 left join jy_kuaishou_promoter t2
+               on t1.clip_user_id = t2.promoter_id
+               where t1.stat_date = #{lastDate}
+               and t2.type = 1
+               ) t2
+
+    </select>
+    <select id="monthData" resultType="com.alibaba.fastjson.JSONObject">
+
+        select *,
+        concat(ROUND((t1.gmv - t2.lastGmv) / t2.lastGmv * 100, 2)         ,'%')       as 'gvmRadio',
+        concat(ROUND((t1.orderNum - t2.lastOrderNum) / t2.lastOrderNum * 100, 2),'%') as 'orderNumRadio',
+        concat(ROUND((t1.validGmv - t2.lastValidGmv) / t2.lastValidGmv * 100, 2) ,'%')as 'validGmvRadio',
+        concat(ROUND((t1.validOrderNUm - t2.lastValidOrderNUm) / t2.lastValidOrderNUm * 100,
+        2)                                                          ,'%')as 'validOrderNumRadio',
+        concat(ROUND((t1.mcnPromotionAmount - t2.lastMcnPromotionAmount) / t2.lastMcnPromotionAmount * 100,
+        2)                                                          ,'%')as 'mcnPromotionAmountRadio',
+        ROUND((t1.grossMargin - t2.lastGrossMargin) / t2.lastGrossMargin * 100,
+        2)                                                         as 'grossMarginRadio'
+        from (select CONCAT(date_format(#{nowMonthEndDate} ,'%Y/%m/%d') , '合计')                                                     as 'date',
+        round(sum(pay_amount) / 100, 2)                                              as 'gmv',
+        count(oid)                                                                   as 'orderNum',
+        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'validGmv',
+        sum(case when order_status != 80 then 1 else 0 end)                          as 'validOrderNum',
+        round(sum(mcn_promotion_amount) / 100, 2)                                    as 'mcnPromotionAmount',
+        round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2)                  as 'grossMargin'
+        from jy_order_list t1 left join jy_kuaishou_promoter t2
+        on t1.clip_user_id = t2.promoter_id
+        where t1.stat_date >= #{nowMonthStartDate}
+        and t1.stat_date &lt;= #{nowMonthEndDate}
+        and t2.type = 1
+        ) t1
+        join (select  CONCAT(date_format(#{lastMonthEndDate} ,'%Y/%m/%d')  , '合计')                                                                   as 'lastDate',
+        round(sum(pay_amount) / 100, 2)                                              as 'lastGmv',
+        count(oid)                                                                   as 'lastOrderNum',
+        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'lastValidGmv',
+        sum(case when order_status != 80 then 1 else 0 end)                          as 'lastValidOrderNum',
+        round(sum(mcn_promotion_amount) / 100, 2)                                    as 'lastMcnPromotionAmount',
+        round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2)                  as 'lastGrossMargin'
+        from jy_order_list t1 left join jy_kuaishou_promoter t2
+        on t1.clip_user_id = t2.promoter_id
+        where t1.stat_date >= #{lastMonthStartDate}
+        and t1.stat_date &lt;=  #{lastMonthEndDate}
+        and t2.type = 1
+        ) t2
+    </select>
+    <select id="getTopItem" resultType="com.alibaba.fastjson.JSONObject">
+        select t1.*,
+        t2.promotionVolume as 'yesPromotionVolume',
+        t1.promotionVolume - t2.promotionVolume as 'difference',
+        round((t1.promotionVolume - t2.promotionVolume) / t2.promotionVolume * 100, 2) as 'increaseInPrice',
+        (
+        case when t2.itemId is null
+        then 1
+        else 2
+        end
+        ) as 'isNew'
+        from (select clip_id as 'clipId',
+        clip_name as 'clipName',
+        item_id as 'itemId',
+        item_name as 'itemName',
+        item_img_url as 'itemImgUrl',
+        item_price as 'itemPrice',
+        promotion_volume as 'promotionVolume',
+        promotion_promoter_count as 'promotionPromoterCount'
+        from jy_clip_top_list
+        where stat_date = #{date}
+        <if test="promoterId != null and promoterId != ''">
+            and clip_id = #{promoterId}
+        </if>
+        ) t1
+        left join (select clip_id as 'clipId',
+        item_id as 'itemId',
+        promotion_volume as 'promotionVolume'
+        from jy_clip_top_list
+        where stat_date = DATE_FORMAT(DATE_ADD(#{date}, INTERVAL -1 DAY),'%Y%m%d')
+        <if test="promoterId != null and promoterId != ''">
+            and clip_id = #{promoterId}
+        </if>
+        ) t2
+        on t1.clipId = t2.clipId and t1.itemId = t2.itemId
+        order by ${fieId} ${sort}
+    </select>
+    <select id="getTopItemUser" resultType="com.alibaba.fastjson.JSONObject">
+        select id,name  from jy_fx_top_item_config
+    </select>
 
 
 </mapper>