|
|
|
@ -1,8 +1,10 @@ |
|
|
|
|
package com.bweb.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.bweb.config.SysConst; |
|
|
|
|
import com.bweb.model.ExportHighOrderModel; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hai.common.Base64Util; |
|
|
|
@ -15,12 +17,16 @@ import com.hai.common.security.SessionObject; |
|
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
|
import com.hai.common.utils.IDGenerator; |
|
|
|
|
import com.hai.common.utils.PageUtil; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.enum_type.QrCodeType; |
|
|
|
|
import com.hai.model.DiscountUseConditionModel; |
|
|
|
|
import com.hai.model.HighOrderModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
import com.hai.order.model.OrderCouponModel; |
|
|
|
|
import com.hai.service.*; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@ -32,9 +38,11 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -205,10 +213,10 @@ public class HighDiscountAgentRelController { |
|
|
|
|
@RequestMapping(value="/getDiscountUseConditionList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询优惠券使用情况") |
|
|
|
|
public ResponseData getDiscountUseConditionList(@RequestParam(name = "discountId", required = false) Long discountId, |
|
|
|
|
@RequestParam(name = "discountName", required = false) String discountName, |
|
|
|
|
@RequestParam(name = "storeName", required = false) String storeName, |
|
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
|
public ResponseData getDiscountUseConditionList(@RequestParam(name = "agentId", required = false) Long agentId, |
|
|
|
|
@RequestParam(name = "discountId", required = false) Long discountId, |
|
|
|
|
@RequestParam(name = "status", required = false) String status, |
|
|
|
|
@RequestParam(name = "userPhone", required = false) String userPhone, |
|
|
|
|
@RequestParam(name = "receiveTimeS", required = false) Long receiveTimeS, |
|
|
|
|
@RequestParam(name = "receiveTimeE", required = false) Long receiveTimeE, |
|
|
|
|
@RequestParam(name = "useTimeS", required = false) Long useTimeS, |
|
|
|
@ -221,17 +229,18 @@ public class HighDiscountAgentRelController { |
|
|
|
|
try { |
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
if (userInfoModel.getHighAgent() == null) { |
|
|
|
|
log.error("HighCouponController -> insertCoupon() error!","该主角色没有权限"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
if (userInfoModel.getBsCompany() != null) { |
|
|
|
|
map.put("agentId", agentId); |
|
|
|
|
} else if (userInfoModel.getHighAgent() != null) { |
|
|
|
|
map.put("agentId", userInfoModel.getHighAgent().getId()); |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
map.put("discountId", discountId); |
|
|
|
|
map.put("discountName", discountName); |
|
|
|
|
map.put("storeName", storeName); |
|
|
|
|
map.put("status", status); |
|
|
|
|
map.put("userPhone", userPhone); |
|
|
|
|
map.put("receiveTimeS", receiveTimeS); |
|
|
|
|
map.put("receiveTimeE", receiveTimeE); |
|
|
|
|
map.put("useTimeS", useTimeS); |
|
|
|
@ -248,6 +257,55 @@ public class HighDiscountAgentRelController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/exportDiscountUseCondition",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询优惠券使用情况") |
|
|
|
|
public ResponseData exportDiscountUseCondition(@RequestParam(name = "agentId", required = false) Long agentId, |
|
|
|
|
@RequestParam(name = "discountId", required = false) Long discountId, |
|
|
|
|
@RequestParam(name = "status", required = false) String status, |
|
|
|
|
@RequestParam(name = "userPhone", required = false) String userPhone, |
|
|
|
|
@RequestParam(name = "receiveTimeS", required = false) Long receiveTimeS, |
|
|
|
|
@RequestParam(name = "receiveTimeE", required = false) Long receiveTimeE, |
|
|
|
|
@RequestParam(name = "useTimeS", required = false) Long useTimeS, |
|
|
|
|
@RequestParam(name = "useTimeE", required = false) Long useTimeE, |
|
|
|
|
@RequestParam(name = "idS", required = false) Long idS, |
|
|
|
|
@RequestParam(name = "idE", required = false) Long idE, |
|
|
|
|
HttpServletRequest request) { |
|
|
|
|
try { |
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
if (userInfoModel.getBsCompany() != null) { |
|
|
|
|
map.put("agentId", agentId); |
|
|
|
|
} else if (userInfoModel.getHighAgent() != null) { |
|
|
|
|
map.put("agentId", userInfoModel.getHighAgent().getId()); |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
map.put("discountId", discountId); |
|
|
|
|
map.put("status", status); |
|
|
|
|
map.put("userPhone", userPhone); |
|
|
|
|
map.put("receiveTimeS", receiveTimeS); |
|
|
|
|
map.put("receiveTimeE", receiveTimeE); |
|
|
|
|
map.put("useTimeS", useTimeS); |
|
|
|
|
map.put("useTimeE", useTimeE); |
|
|
|
|
map.put("idS", idS); |
|
|
|
|
map.put("idE", idE); |
|
|
|
|
|
|
|
|
|
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, DiscountUseConditionModel.class) |
|
|
|
|
.sheet("sheet1") |
|
|
|
|
.doWrite(highDiscountAgentCodeService.getDiscountUseConditionList(map)); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(fileName); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getDiscountUseConditionList() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getDiscountCodeById",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询优惠券码 详情") |
|
|
|
@ -297,4 +355,29 @@ public class HighDiscountAgentRelController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/exportDiscountReceive",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "导出领取记录") |
|
|
|
|
public ResponseData exportDiscountReceive(@RequestParam(name = "id", required = true) Long id) { |
|
|
|
|
try { |
|
|
|
|
HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(id); |
|
|
|
|
if (rel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "数据不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; |
|
|
|
|
String pathName = System.currentTimeMillis()+".xlsx"; |
|
|
|
|
File file = new File(fileUrl); |
|
|
|
|
if (!file.exists()) { |
|
|
|
|
file.mkdirs(); |
|
|
|
|
} |
|
|
|
|
// EasyExcel.write(fileUrl+pathName).sheet("sheet1").doWrite(dataList);
|
|
|
|
|
return ResponseMsgUtil.success(pathName); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getReceiveLink() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|