Преглед изворни кода

充值列表-添加导出;详情添加代理商;状态详情添加角色展示

zhaoxian пре 2 година
родитељ
комит
ab49f1b89c

+ 95 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/controller/FinancePaymentRechargeApplicationController.java

@@ -1,12 +1,15 @@
 package cn.com.ctop.finance.payment.controller;
 
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.finance.payment.entity.FinancePaymentRechargeApplication;
 import cn.com.ctop.finance.payment.service.IFinancePaymentRechargeApplicationService;
 import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,9 +20,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 充值申请表
@@ -184,4 +190,92 @@ public class FinancePaymentRechargeApplicationController {
         return Result.error("查询异常");
     }
 
+
+    /**
+     * 下载
+     */
+    @GetMapping(value = "/excelInfo")
+    public void excelInfo(HttpServletResponse response, FinancePaymentRechargeApplication recharge,
+                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            //查询用户角色
+            String roleCode = sysRoleService.getRoleCodeByUserId(recharge.getUserId());
+            if ("sale".equals(roleCode) || "saleAssistant".equals(roleCode) || "saleAm".equals(roleCode)) {
+                if ("4f6454dbad954a8094013bf4c6d74796".equals(recharge.getUserId())) {
+                    /*销售助理 曹媛 4f6454dbad954a8094013bf4c6d74796:侯加鑫、王维新、高洪哲             */
+
+                    List<String> userIds = new ArrayList<>();
+                    userIds.add("4f6454dbad954a8094013bf4c6d74796");
+                    userIds.add("42e137a90ca94cbfa89b21b306cb2e78");//侯加鑫
+                    userIds.add("959842590bfc4ad38e0aced255177ced");//王维新
+                    userIds.add("f0190eaabfb4488caa22e123e94dadc8");//高洪哲
+                    recharge.setUserIds(userIds);
+                } else if ("163a4cc9a72c425e873d36d08e75f2cd".equals(recharge.getUserId())) {
+                    /*销售助理 陈心瑞:崔泽、王明雨                 */
+                    List<String> userIds = new ArrayList<>();
+                    userIds.add("163a4cc9a72c425e873d36d08e75f2cd");
+                    userIds.add("fe4965692844468798e4fc265e3cdfc8");//崔泽
+                    userIds.add("9a99a2e906b64f5082f87c3a60a20b2e");//王明雨
+                    recharge.setUserIds(userIds);
+                } else {
+                    recharge.setApplicanterId(recharge.getUserId());
+                }
+            }
+
+            List<JSONObject> list = financePaymentRechargeApplicationService.queryAccountList(recharge);
+            List<List<Object>> excelList = new ArrayList<>();
+            if (!list.isEmpty()) {
+                Map<String, String> map = getStatusStr();
+                list.forEach(data -> {
+                    List<Object> temp = new ArrayList<>();
+                    temp.add(data.getString("advertiserName"));
+                    temp.add(data.getString("agentName"));
+                    String amends = data.getString("amends");
+                    temp.add("1".equals(amends) ? "是" : "否");
+                    temp.add(data.getString("productName"));
+                    temp.add(data.getString("projectName") + "(" + data.getString("projectId") + ")");
+                    temp.add(data.getString("accountId"));
+                    temp.add(data.getString("accountName"));
+                    temp.add(data.getString("cashAmounts"));
+                    temp.add(data.getString("receivedAmounts"));
+                    temp.add(data.getString("rebateRate"));
+                    String rebateType = data.getString("rebateType");
+                    temp.add("1".equals(rebateType) ? "返货" : "返现");
+                    temp.add(data.getString("applicanter"));
+                    temp.add(data.getString("createTime"));
+                    temp.add(map.get(data.getString("auditStatus")));
+                    temp.add(data.getString("remarks"));
+                    temp.add(data.getString("approvalContent"));
+                    excelList.add(temp);
+                });
+            }
+
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            String[] titles = {"客户名称", "代理商", "是否后补", "产品名称", "项目", "账户ID", "账户名称", "现金金额", "账显金额",
+                    "返点比例", "返点类型", "申请人", "申请时间", "状态", "充值备注", "拒绝原因"};
+            eeu.exportExcelForAttendance(workbook, 0, "充值列表", titles, excelList);
+            HttpUtils.setResponseHeader(response, "info.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map<String, String> getStatusStr() {
+        Map<String, String> map = new HashMap<>();
+        map.put("-1", "退回修改");
+        map.put("0", "创建申请");
+        map.put("1", "待审核");
+        map.put("2", "待充值");
+        map.put("3", "充值完成");
+        map.put("4", "临时充值");
+        map.put("5", "审核拒绝");
+        return map;
+    }
+
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/entity/FinancePaymentRechargeAccount.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.finance.payment.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -11,6 +12,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 充值账户表
@@ -90,4 +92,9 @@ public class FinancePaymentRechargeAccount {
      */
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
+    /**
+     * 代理商名称
+     */
+    @TableField(exist = false)
+    private String agentName;
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/mapper/FinancePaymentRechargeApplicationMapper.java

@@ -19,4 +19,6 @@ public interface FinancePaymentRechargeApplicationMapper extends BaseMapper<Fina
     List<JSONObject> queryAuditProcess(@Param("id") Long id);
 
     List<JSONObject> queryPageList(FinancePaymentRechargeApplication recharge);
+
+    List<JSONObject> queryAccountList(FinancePaymentRechargeApplication recharge);
 }

+ 15 - 22
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/mapper/xml/FinancePaymentApplicationMapper.xml

@@ -5,8 +5,8 @@
     <select id="getAdvertisers" resultType="com.alibaba.fastjson.JSONObject">
         SELECT group_concat(DISTINCT t2.id) as 'advertiserIds', t1.advertiser_name as 'advertiserName'
         FROM `ctop_cwjs_policy_info` t1
-                 LEFT JOIN
-             ctop_advertiser t2 ON t1.advertiser_name = t2.name
+        LEFT JOIN
+        ctop_advertiser t2 ON t1.advertiser_name = t2.name
         WHERE t2.id is not null
         <if test="mediaType != null and mediaType != '' ">
             AND media_type = #{mediaType}
@@ -82,25 +82,13 @@
     </select>
 
     <select id="queryCwjsPolicyInfo" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            t1.id as 'id',
-            t1.advertiser_name as 'advertiserName',
-            t1.media_type as 'mediaType',
-            t2.policy_product_name as 'policyProductName',
-            approved_status as 'approvedStatus',
-            advance_pay as 'advancePay',
-            rebate_type as 'rebateType',
-            rebate_rate as 'rebateRate',
-            policy_start_date as 'policyStartDate',
-            policy_end_date as 'policyEndDate'
-        FROM
-            `ctop_cwjs_policy_info` t1
-                LEFT JOIN ctop_cwjs_policy_product t2 ON t1.id = t2.policy_id
-        WHERE t1.advertiser_name =#{advertiserName}
-          AND t1.media_type =#{type}
-          AND t2.policy_product_name =#{productName}
-        ORDER BY policy_start_date desc,policy_end_date desc
-            LIMIT 1
+        SELECT t1.id as 'id', t1.advertiser_name as 'advertiserName', t1.media_type as 'mediaType', t2.policy_product_name as 'policyProductName', approved_status as 'approvedStatus', advance_pay as 'advancePay', rebate_type as 'rebateType', rebate_rate as 'rebateRate', policy_start_date as 'policyStartDate', policy_end_date as 'policyEndDate'
+        FROM `ctop_cwjs_policy_info` t1
+                 LEFT JOIN ctop_cwjs_policy_product t2 ON t1.id = t2.policy_id
+        WHERE t1.advertiser_name = #{advertiserName}
+          AND t1.media_type = #{type}
+          AND t2.policy_product_name = #{productName}
+        ORDER BY policy_start_date desc, policy_end_date desc LIMIT 1
     </select>
 
     <select id="queryAuditProcess" resultType="com.alibaba.fastjson.JSONObject">
@@ -116,7 +104,12 @@
                  SELECT t1.audit_status,
                         IFNULL(t1.revieweder_id, '-'),
                         IFNULL(t1.revieweder, '-'),
-                        IFNULL(t4.role_name, '-'),
+                        CASE revieweder_id
+                            WHEN 'financialReview' THEN '财务审核'
+                            WHEN 'meidaManager' THEN '媒介'
+                            ELSE
+                                t4.role_name
+                            END,
                         t1.approval_content,
                         t1.files,
                         t1.update_time

+ 16 - 13
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/mapper/xml/FinancePaymentRechargeAccountMapper.xml

@@ -9,20 +9,23 @@
     </select>
 
     <select id="queryByRechargeId" resultType="cn.com.ctop.finance.payment.entity.FinancePaymentRechargeAccount">
-        SELECT id,
-               recharge_id,
-               project_id,
-               account_id,
-               account_name,
-               cash_amount,
-               received_amount,
-               rebate_type,
-               rebate_rate,
-               create_time,
-               update_time
-        FROM `finance_payment_recharge_account`
+        SELECT t1.id,
+               t1.recharge_id,
+               t1.project_id,
+               t1.account_id,
+               t1.account_name,
+               t1.cash_amount,
+               t1.received_amount,
+               t1.rebate_type,
+               t1.rebate_rate,
+               t1.create_time,
+               t1.update_time,
+               t3.agent_name
+        FROM `finance_payment_recharge_account` t1
+                 LEFT JOIN ctop_oauth_token t2 ON t1.account_id = t2.account_id
+                 LEFT JOIN ctop_oauth_config t3 ON t2.app_id = t3.app_id
         WHERE recharge_id = #{rechargeId}
-        order by id
+        order by t1.id
     </select>
 
     <delete id="delByRechargeId">

+ 75 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/mapper/xml/FinancePaymentRechargeApplicationMapper.xml

@@ -15,7 +15,12 @@
                  SELECT t1.audit_status,
                         IFNULL(t1.revieweder_id, '-'),
                         IFNULL(t1.revieweder, '-'),
-                        IFNULL(t4.role_name, '-'),
+                        CASE revieweder_id
+                            WHEN 'financialReview' THEN '财务审核'
+                            WHEN 'meidaManager' THEN '媒介'
+                            ELSE
+                                t4.role_name
+                            END,
                         t1.approval_content,
                         t1.files,
                         t1.update_time
@@ -92,4 +97,73 @@
         order by t1.create_time desc
     </select>
 
+    <select id="queryAccountList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.id,
+        t1.advertiser_id as 'advertiserId',
+        t1.advertiser_name as 'advertiserName',
+        t1.product_id as 'productId',
+        t1.product_name as 'productName',
+        t1.project_id as 'projectId',
+        t1.project_name as 'projectName',
+        t2.account_id as 'accountId',
+        t2.account_name as 'accountName',
+        t2.cash_amount as 'cashAmounts',
+        t2.received_amount as 'receivedAmounts',
+        t2.rebate_type as 'rebateType',
+        t1.applicanter_id as 'applicanterId',
+        t1.applicanter as 'applicanter',
+        DATE_FORMAT(t1.create_time,'%Y-%m-%d %H:%i:%s') as 'createTime',
+        t1.files as 'files',
+        t1.approval_content as 'approvalContent',
+        t1.audit_status as 'auditStatus',
+        t1.payment_media as 'paymentMedia',
+        t1.recharge_type as 'rechargeType',
+        t2.rebate_rate as 'rebateRate',
+        t1.revieweder_id as 'reviewederId',
+        t1.revieweder as 'revieweder',
+        t1.amends,
+        t1.remarks,
+        t4.agent_name as 'agentName'
+        FROM finance_payment_recharge_application t1
+        LEFT JOIN finance_payment_recharge_account t2 ON t1.id = t2.recharge_id
+        LEFT JOIN ctop_oauth_token t3 ON t2.account_id = t3.account_id
+        LEFT JOIN ctop_oauth_config t4 ON t3.app_id = t4.app_id
+        <where>
+            <if test="advertiserName != null and advertiserName != '' ">
+                and t1.advertiser_name like concat('%',#{advertiserName},'%')
+            </if>
+            <if test="productName != null and productName != '' ">
+                and t1.product_name like concat('%',#{productName},'%')
+            </if>
+            <if test="projectName != null and projectName != '' ">
+                and t1.project_name like concat('%',#{projectName},'%')
+            </if>
+            <if test="auditStatus != null and auditStatus != '' ">
+                and t1.audit_status=#{auditStatus}
+            </if>
+            <if test="applicanterId != null and applicanterId != '' ">
+                and t1.applicanter_id=#{applicanterId}
+            </if>
+            <if test="userIds != null and userIds.size()>0">
+                and t1.applicanter_id IN
+                <foreach collection="userIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="paymentMedia != null and paymentMedia != '' ">
+                and t1.payment_media=#{paymentMedia}
+            </if>
+            <if test="rechargeType != null and rechargeType != '' ">
+                and t1.recharge_type=#{rechargeType}
+            </if>
+            <if test="startDate != null and startDate != '' ">
+                and t1.create_time >= #{startDate}
+                and t1.create_time &lt;= #{endDate}
+            </if>
+        </where>
+        GROUP BY t2.id
+        order by t1.create_time desc
+    </select>
+
 </mapper>

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/IFinancePaymentRechargeApplicationService.java

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 
+import java.util.List;
+
 /**
  * 充值申请表
  *
@@ -28,4 +30,5 @@ public interface IFinancePaymentRechargeApplicationService extends IService<Fina
 
     Result<Object> queryAuditProcess(Long id);
 
+    List<JSONObject> queryAccountList(FinancePaymentRechargeApplication recharge);
 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentApplicationServiceImpl.java

@@ -74,7 +74,7 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
         //获取审核人
         getRevieweder(application);
         Date createTime = new Date();
-        Thread.sleep(200);
+        Thread.sleep(800);
         //添加申请
         this.save(application);
         //消息通知内容
@@ -164,7 +164,7 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
         insertRecord(application.getId(), oldApplication.getReviewederId(), oldApplication.getAuditStatus(), oldApplication.getApprovalContent(), oldApplication.getFiles(), oldApplication.getUpdateTime());
         //添加修改记录
         insertRecord(application.getId(), application.getApplicanterId(), "-1", null, application.getFiles(), new Date());
-        Thread.sleep(100);
+        Thread.sleep(800);
         //获取审核人
         getRevieweder(application);
         this.updateById(application);

+ 7 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentRechargeApplicationServiceImpl.java

@@ -113,7 +113,7 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
                 data.put("projectName", project.getProjectName());
             }
             Date createTime = new Date();
-            Thread.sleep(200);
+            Thread.sleep(800);
             //判断审核人和状态
             getReviewedRole(recharge);
             recharge.setPoolId(pool.getId());
@@ -200,7 +200,7 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
         insertRecord(recharge.getId(), oldRecharge.getReviewederId(), oldRecharge.getAuditStatus(), oldRecharge.getApprovalContent(), oldRecharge.getFiles(), oldRecharge.getUpdateTime());
         //添加申请记录 -1 退回修改
         insertRecord(recharge.getId(), recharge.getApplicanterId(), "-1", null, recharge.getFiles(), new Date());
-        Thread.sleep(100);
+        Thread.sleep(800);
 
         this.updateById(recharge);
 
@@ -339,6 +339,11 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
         return Result.ok(baseMapper.queryAuditProcess(id));
     }
 
+    @Override
+    public List<JSONObject> queryAccountList(FinancePaymentRechargeApplication recharge) {
+        return baseMapper.queryAccountList(recharge);
+    }
+
     private void getReviewedRole(FinancePaymentRechargeApplication recharge) {
         String financialReview = recharge.getFinancialReview();
         if (!Check.isNull(financialReview) && "1".equals(financialReview)) {