|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.ctop.finance.policy.controller;
|
|
|
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
@@ -21,6 +22,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.entity.SysUser;
|
|
@@ -37,15 +39,19 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.ctop.finance.policy.service.impl.CwjsCompanySubjectServiceImpl;
|
|
|
import org.jeecg.ctop.finance.policy.utils.Check;
|
|
|
import org.jeecg.ctop.finance.policy.utils.ListPageUtil;
|
|
|
+import org.jeecg.ctop.finance.settlement.entity.vo.ProfitReportBytedanceVo;
|
|
|
+import org.jeecg.ctop.finance.settlement.entity.vo.ProfitReportKuaiShouVo;
|
|
|
import org.jeecg.ctop.finance.settlement.service.serviceImpl.ReportSettlementServiceImpl;
|
|
|
import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
|
|
|
import org.jeecg.modules.system.service.ISysRoleService;
|
|
|
+import org.jeecgframework.poi.excel.ExcelExportUtil;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -939,6 +945,54 @@ public class CwjsPolicyInfoController {
|
|
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value="政策信息导出", notes="政策信息导出")
|
|
|
+ @GetMapping(value = "/exportPolicy")
|
|
|
+ public Result exportPolicy(CwjsPolicyInfo cwjsPolicyInfo,
|
|
|
+ HttpServletResponse response) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 1:待审核 2:审核中 3:审核通过4:审核拒绝 5-作废 默认不显示作废
|
|
|
+ if (Check.isNull(cwjsPolicyInfo.getApprovedStatus())) {
|
|
|
+ cwjsPolicyInfo.setStatusList(Arrays.asList(1, 2, 3, 4));
|
|
|
+ } else {
|
|
|
+ cwjsPolicyInfo.setStatusList(Arrays.asList(cwjsPolicyInfo.getApprovedStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询政策
|
|
|
+ List<CwjsPolicyInfo> cwjsPolicyInfoList = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
|
|
|
+ if (Check.isNull(cwjsPolicyInfoList)) {
|
|
|
+ return Result.errorMsg("暂无政策。");
|
|
|
+ }
|
|
|
+ List<ExportCwjsPolicyPojo> resultList = new ArrayList<>();
|
|
|
+ for (CwjsPolicyInfo vo : cwjsPolicyInfoList) {
|
|
|
+ ExportCwjsPolicyPojo exportCwjsPolicyPojo = new ExportCwjsPolicyPojo();
|
|
|
+ BeanUtils.copyProperties(vo, exportCwjsPolicyPojo);
|
|
|
+ exportCwjsPolicyPojo.setMediaType(ExportCwjsPolicyPojo.getMediaTypeStr(vo.getMediaType()));
|
|
|
+ exportCwjsPolicyPojo.setApprovedStatus(ExportCwjsPolicyPojo.getApprovedStatusStr(vo.getApprovedStatus()));
|
|
|
+ exportCwjsPolicyPojo.setRebateType(ExportCwjsPolicyPojo.getRebateTypeStr(vo.getRebateType()));
|
|
|
+ exportCwjsPolicyPojo.setRebateRate(vo.getRebateRate()+"%");
|
|
|
+ exportCwjsPolicyPojo.setDianPayCompanyRebateRate(Check.isNull(vo.getDianPayCompanyRebateRate()) ? "" : vo.getDianPayCompanyRebateRate()+"%");
|
|
|
+ exportCwjsPolicyPojo.setPromotionType(vo.getPromotionType() == 0 ? "自运营" : "代运营");
|
|
|
+ exportCwjsPolicyPojo.setAdvancePay(vo.getAdvancePay() == 0 ? "否" : "是");
|
|
|
+ exportCwjsPolicyPojo.setIsDianPay(vo.getIsDianPay() == 0 ? "否" : "是");
|
|
|
+ exportCwjsPolicyPojo.setCustomerFlag(vo.getCustomerFlag() == 0 ? "否" : "是");
|
|
|
+ exportCwjsPolicyPojo.setCreateTime(DateUtils.dateToStringTime(vo.getCreateTime()));
|
|
|
+ exportCwjsPolicyPojo.setProductName(StringUtils.strip(vo.getPolicyProductName().toString(),"[]"));
|
|
|
+ resultList.add(exportCwjsPolicyPojo);
|
|
|
+ }
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("政策内容", "销售政策"), ExportCwjsPolicyPojo.class, resultList);
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
+ response.setHeader("content-Type", "application/vnd.ms-excel");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("快手利润单.xls", "UTF-8"));
|
|
|
+ workbook.write(response.getOutputStream());
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|