|
|
|
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
@ -60,9 +61,12 @@ public class OrderCouponController { |
|
|
|
|
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询卡券订单列表") |
|
|
|
|
public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
public ResponseData getOrderList(@RequestParam(name = "companyId", required = false) Long companyId, |
|
|
|
|
@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
|
|
|
|
@RequestParam(name = "couponKey", required = false) String couponKey, |
|
|
|
|
@RequestParam(name = "couponName", required = false) String couponName, |
|
|
|
|
@RequestParam(name = "couponSource", required = false) String couponSource, |
|
|
|
|
@RequestParam(name = "payType", required = false) Integer payType, |
|
|
|
|
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
|
|
|
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
|
|
|
@ -83,16 +87,20 @@ public class OrderCouponController { |
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
|
|
|
|
map.put("companyId", companyId); |
|
|
|
|
|
|
|
|
|
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
|
|
|
|
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); |
|
|
|
|
map.put("companyId", userInfoModel.getBsCompany().getId()); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map.put("orderNo", orderNo); |
|
|
|
|
map.put("memPhone", memPhone); |
|
|
|
|
map.put("couponKey", couponKey); |
|
|
|
|
map.put("couponName", couponName); |
|
|
|
|
map.put("couponSource", couponSource); |
|
|
|
|
map.put("payType", payType); |
|
|
|
|
map.put("orderStatus", orderStatus); |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
@ -116,9 +124,12 @@ public class OrderCouponController { |
|
|
|
|
@RequestMapping(value = "/exportOrderCouponExcel", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "导出卡券订单") |
|
|
|
|
public ResponseData exportOrderCouponExcel(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
public ResponseData exportOrderCouponExcel(@RequestParam(name = "companyId", required = false) Long companyId, |
|
|
|
|
@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
|
|
|
|
@RequestParam(name = "couponKey", required = false) String couponKey, |
|
|
|
|
@RequestParam(name = "couponName", required = false) String couponName, |
|
|
|
|
@RequestParam(name = "couponSource", required = false) String couponSource, |
|
|
|
|
@RequestParam(name = "payType", required = false) Integer payType, |
|
|
|
|
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
|
|
|
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
|
|
|
@ -136,15 +147,20 @@ public class OrderCouponController { |
|
|
|
|
} |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
|
|
|
|
map.put("companyId", companyId); |
|
|
|
|
|
|
|
|
|
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
|
|
|
|
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); |
|
|
|
|
map.put("companyId", userInfoModel.getBsCompany().getId()); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map.put("orderNo", orderNo); |
|
|
|
|
map.put("memPhone", memPhone); |
|
|
|
|
map.put("couponKey", couponKey); |
|
|
|
|
map.put("couponName", couponName); |
|
|
|
|
map.put("couponSource", couponSource); |
|
|
|
|
map.put("payType", payType); |
|
|
|
|
map.put("orderStatus", orderStatus); |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
@ -156,8 +172,17 @@ public class OrderCouponController { |
|
|
|
|
|
|
|
|
|
List<OrderCouponModel> list = orderServiceExt.getOrderCouponList(map); |
|
|
|
|
|
|
|
|
|
Set<String> includeColumnFiledNames = new HashSet<String>(); |
|
|
|
|
for (Field field : OrderCouponModel.class.getDeclaredFields()) { |
|
|
|
|
includeColumnFiledNames.add(field.getName()); |
|
|
|
|
} |
|
|
|
|
if (!userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
|
|
|
|
includeColumnFiledNames.remove("companyName"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, OrderCouponModel.class) |
|
|
|
|
.includeColumnFiledNames(includeColumnFiledNames) |
|
|
|
|
.sheet("卡券订单") |
|
|
|
|
.doWrite(list); |
|
|
|
|
|
|
|
|
|