Jelajahi Sumber

运营绩效功能,初版

zhaoxian 2 tahun lalu
induk
melakukan
84f54f6f19

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouOperationReportController.java

@@ -84,7 +84,7 @@ public class KuaishouOperationReportController {
             if (Check.isNull(mediaId) || Check.isNull(time)) {
                 return Result.error("请选择媒体或季度");
             }
-            if (mediaId.equals("1")) {
+            if ("1".equals(mediaId)) {
                 return kuaishouOperationReportService.queryToutiaoQuarterlyCharge(time, role, userId, pageNo, pageSize);
             } else {
                 return kuaishouOperationReportService.queryKuaishouQuarterlyCharge(time, role, userId, pageNo, pageSize);

+ 22 - 22
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouOperationReportMapper.xml

@@ -6,9 +6,9 @@
         SELECT
         t.id AS 'userId',
         t.realname AS 'userName',
-        IFNULL(t1.totalCharge,0.0) as '1totalCharge',
-        IFNULL(t3.totalCharge,0.0) as '2totalCharge',
-        IFNULL(t5.totalCharge,0.0) as '3totalCharge'
+        IFNULL(ROUND(t1.totalCharge,3),0.0) as '1totalCharge',
+        IFNULL(ROUND(t3.totalCharge,3),0.0) as '2totalCharge',
+        IFNULL(ROUND(t5.totalCharge,3),0.0) as '3totalCharge'
         FROM (SELECT id,realname FROM sys_user WHERE id in
         <foreach collection="userIds" item="user" separator="," open="(" close=")">
             #{user.userId}
@@ -54,20 +54,20 @@
         SELECT
         t.id AS 'userId',
         t.realname AS 'userName',
-        IFNULL(t1.totalCharge,0.0) as '1totalCharge',
-        IFNULL(t1.totalCharge - t2.JLCharge - t2.KFCharge,0.0) as '1FWCharge',
-        IFNULL(t2.JLCharge,0.0) as '1JLCharge',
-        IFNULL(t2.KFCharge,0.0) as '1KFCharge',
+        IFNULL( ROUND(t1.totalCharge,3),0.0) as '1totalCharge',
+        IFNULL( ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge,3),0.0) as '1FWCharge',
+        IFNULL( ROUND(t2.JLCharge,3),0.0) as '1JLCharge',
+        IFNULL( ROUND(t2.KFCharge,3),0.0) as '1KFCharge',
 
-        IFNULL(t3.totalCharge,0.0) as '2totalCharge',
-        IFNULL(t3.totalCharge - t4.JLCharge - t4.KFCharge,0.0) as '2FWCharge',
-        IFNULL(t4.JLCharge,0.0) as '2JLCharge',
-        IFNULL(t4.KFCharge,0.0) as '2KFCharge',
+        IFNULL( ROUND(t3.totalCharge,3),0.0) as '2totalCharge',
+        IFNULL( ROUND(t3.totalCharge - t4.JLCharge - t4.KFCharge,3),0.0) as '2FWCharge',
+        IFNULL( ROUND(t4.JLCharge,3),0.0) as '2JLCharge',
+        IFNULL( ROUND(t4.KFCharge,3),0.0) as '2KFCharge',
 
-        IFNULL(t5.totalCharge,0.0) as '3totalCharge',
-        IFNULL(t5.totalCharge - t6.JLCharge - t6.KFCharge,0.0) as '3FWCharge',
-        IFNULL(t6.JLCharge,0.0) as '3JLCharge',
-        IFNULL(t6.KFCharge,0.0) as '3KFCharge'
+        IFNULL( ROUND(t5.totalCharge,3),0.0) as '3totalCharge',
+        IFNULL( ROUND(t5.totalCharge - t6.JLCharge - t6.KFCharge,3),0.0) as '3FWCharge',
+        IFNULL( ROUND(t6.JLCharge,3),0.0) as '3JLCharge',
+        IFNULL( ROUND(t6.KFCharge,3),0.0) as '3KFCharge'
         FROM (SELECT id,realname FROM sys_user WHERE id in
         <foreach collection="userIds" item="user" separator="," open="(" close=")">
             #{user.userId}
@@ -156,10 +156,10 @@
         SELECT
         t.id AS 'userId',
         t.realname AS 'userName',
-        IFNULL(t1.totalCharge,0.0) as 'totalCharge',
-        IFNULL(t1.totalCharge - t2.JLCharge - t2.KFCharge,0.0) as 'FWCharge',
-        IFNULL(t2.JLCharge,0.0) as 'JLCharge',
-        IFNULL(t2.KFCharge,0.0) as 'KFCharge'
+        IFNULL(ROUND(t1.totalCharge,3),0.0) as 'totalCharge',
+        IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge,3),0.0) as 'FWCharge',
+        IFNULL(ROUND(t2.JLCharge,3),0.0) as 'JLCharge',
+        IFNULL(ROUND(t2.KFCharge,3),0.0) as 'KFCharge'
         FROM (SELECT id,realname FROM sys_user WHERE id in
         <foreach collection="userIds" item="userId" separator="," open="(" close=")">
             #{userId}
@@ -197,7 +197,7 @@
         SELECT
         t.id AS 'userId',
         t.realname AS 'userName',
-        IFNULL(t1.totalCharge,0.0) as 'totalCharge'
+        IFNULL(ROUND(t1.totalCharge,3),0.0) as 'totalCharge'
         FROM (SELECT id,realname FROM sys_user WHERE id in
         <foreach collection="userIds" item="userId" separator="," open="(" close=")">
             #{userId}
@@ -218,7 +218,7 @@
     </select>
 
     <select id="getManageChargeCommission" resultType="java.math.BigDecimal">
-        SELECT IFNULL(t1.totalCharge - t2.JLCharge - t2.KFCharge, 0.0)
+        SELECT IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge, 3), 0.0)
         FROM (
                  SELECT SUM(charge) as 'totalCharge'
                  FROM application.kuaishou_operation_performance_base
@@ -249,7 +249,7 @@
     </select>
 
     <select id="getTtManageChargeCommission" resultType="java.math.BigDecimal">
-        SELECT IFNULL(SUM(cost), 0.0)
+        SELECT IFNULL(ROUND(SUM(cost), 3), 0.0)
         FROM application.bytedance_operation_performance_base
         WHERE account_id IN (
             SELECT account_id

+ 11 - 11
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouOperationReportServiceImpl.java

@@ -58,7 +58,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         if (Check.isNull(role)) {
             //运营助理
             roleCode.add("operationAssistant");
-            //快手运营经理
+            //头条运营经理
             roleCode.add("touTiaoOperationManager");
             //运营专员
             roleCode.add("operator");
@@ -104,13 +104,13 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         if (Check.isNull(role)) {
             //运营助理
             roleCode.add("operationAssistant");
-            //快手运营经理
-            roleCode.add("kuaishouOperationManager");
+            //头条运营经理
+            roleCode.add("touTiaoOperationManager");
             //运营专员
             roleCode.add("operator");
         } else {
             if ("manager".equals(role)) {
-                roleCode.add("kuaishouOperationManager");
+                roleCode.add("touTiaoOperationManager");
             } else {
                 roleCode.add(role);
             }
@@ -425,7 +425,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
             datum.put("totalCharge", totalCharge);
             datum.put("FWCharge", totalCharge);
             //服务消耗提成
-            BigDecimal FWChargeCommission = datum.getBigDecimal("FWCharge").multiply(new BigDecimal("0.003"));
+            BigDecimal FWChargeCommission = datum.getBigDecimal("FWCharge").multiply(new BigDecimal("0.003")).setScale(3, BigDecimal.ROUND_HALF_UP);
             datum.put("FWChargeCommission", FWChargeCommission);
             //有效月份
             Integer monthCount = datum.getInteger("monthCount");
@@ -473,7 +473,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
                 datum.put("manageCharge", managenCharge);
 
                 //季度管理消耗提成
-                manageChargeCommission = managenCharge.multiply(new BigDecimal("0.002").multiply(new BigDecimal("0.2")));
+                manageChargeCommission = managenCharge.multiply(new BigDecimal("0.002")).multiply(new BigDecimal("0.2")).setScale(3, BigDecimal.ROUND_HALF_UP);
                 datum.put("manageChargeCommission", manageChargeCommission);
                 //运营赔付扣罚比例
                 datum.put("operateCompensation", "-");
@@ -497,7 +497,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
                 //发放系数
                 datum.put("paySalaryRatio", userEntity.getPaySalaryRatio());
                 //最终发放金额
-                datum.put("finalPutMoney", new BigDecimal(userEntity.getPaySalaryRatio()).multiply(putMoney));
+                datum.put("finalPutMoney", new BigDecimal(userEntity.getPaySalaryRatio()).multiply(putMoney).setScale(3, BigDecimal.ROUND_HALF_UP));
             } else {
                 datum.put("paySalaryRatio", 1);
                 datum.put("finalPutMoney", putMoney);
@@ -900,13 +900,13 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
             //经理管理消耗提成
             BigDecimal manageChargeCommission = null;
             //服务消耗提成
-            BigDecimal FWChargeCommission = fwCharge.multiply(new BigDecimal("0.003"));
+            BigDecimal FWChargeCommission = fwCharge.multiply(new BigDecimal("0.003")).setScale(3, BigDecimal.ROUND_HALF_UP);
             datum.put("FWChargeCommission", FWChargeCommission);
             if (kfCharge.doubleValue() >= 300000) {
                 //季度框返是否满足30w
                 datum.put("KFChargeIsOk", "是");
                 //框返消耗提成
-                KFChargeCommission = kfCharge.multiply(new BigDecimal("0.003"));
+                KFChargeCommission = kfCharge.multiply(new BigDecimal("0.003")).setScale(3, BigDecimal.ROUND_HALF_UP);
                 datum.put("KFChargeCommission", KFChargeCommission);
             } else {
                 KFChargeCommission = new BigDecimal("0.0");
@@ -955,7 +955,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
                 //季度管理消耗
                 datum.put("manageCharge", managenCharge);
                 //季度管理服务提成
-                manageChargeCommission = managenCharge.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.2"));
+                manageChargeCommission = managenCharge.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.2")).setScale(3, BigDecimal.ROUND_HALF_UP);
                 datum.put("manageChargeCommission", manageChargeCommission);
                 //运营赔付扣罚比例
                 datum.put("operateCompensation", "-");
@@ -979,7 +979,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
                 //发放系数
                 datum.put("paySalaryRatio", userEntity.getPaySalaryRatio());
                 //最终发放金额
-                datum.put("finalPutMoney", new BigDecimal(userEntity.getPaySalaryRatio()).multiply(putMoney));
+                datum.put("finalPutMoney", new BigDecimal(userEntity.getPaySalaryRatio()).multiply(putMoney).setScale(3, BigDecimal.ROUND_HALF_UP));
             } else {
                 datum.put("paySalaryRatio", 1);
                 datum.put("finalPutMoney", putMoney);

+ 8 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysOperateRelController.java

@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 助理和运营关系记录表
@@ -78,11 +80,13 @@ public class SysOperateRelController {
      * @param id
      * @return
      */
-    @ApiOperation(value = "助理和运营关系记录表-通过id删除", notes = "助理和运营关系记录表-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id") String id) {
+    @GetMapping(value = "/delete")
+    public Result<?> delete(String assistantId, String statMonth) {
         try {
-            sysOperateRelService.removeById(id);
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("assistant_id", assistantId);
+            deleteMap.put("stat_month", statMonth);
+            sysOperateRelService.removeByMap(deleteMap);
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");