|
|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|