提交代码

dev-discount
胡锐 2 years ago
parent 8effa3270b
commit 58fbeb01ad
  1. 59
      hai-order/src/main/java/com/web/controller/business/OrderCouponController.java
  2. 7
      hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java
  3. 12
      hai-service/src/main/java/com/hai/order/model/OrderCouponModel.java
  4. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java

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

@ -26,8 +26,11 @@ public interface OrderMapperExt {
@Select({"<script>" + @Select({"<script>" +
" select" + " select" +
" (select `name` from bs_company WHERE id = d.company_id) companyName," +
" b.order_no orderNo," + " b.order_no orderNo," +
" b.mem_phone memPhone," + " b.mem_phone memPhone," +
" d.coupon_key couponKey," +
" (select code_name from sec_dictionary WHERE code_type = 'COUPON_SOURCE' and code_value = d.coupon_source) couponSource," +
" a.goods_name couponName," + " a.goods_name couponName," +
" a.goods_price couponPrice," + " a.goods_price couponPrice," +
" b.total_price totalPrice," + " b.total_price totalPrice," +
@ -60,10 +63,14 @@ public interface OrderMapperExt {
" b.finish_time finishTime" + " b.finish_time finishTime" +
" from high_child_order a" + " from high_child_order a" +
" LEFT JOIN high_order b on b.id = a.order_id" + " LEFT JOIN high_order b on b.id = a.order_id" +
" LEFT JOIN high_coupon d on d.id = a.goods_id" +
" where a.goods_type = 1" + " where a.goods_type = 1" +
" <if test='param.companyId != null'> and d.company_id = #{param.companyId} </if>" +
" <if test='param.goodsId != null'> and a.goods_id in (${param.goodsId}) </if>" + " <if test='param.goodsId != null'> and a.goods_id in (${param.goodsId}) </if>" +
" <if test='param.orderNo != null'> and b.order_no like concat('%', #{param.orderNo}, '%') </if>" + " <if test='param.orderNo != null'> and b.order_no like concat('%', #{param.orderNo}, '%') </if>" +
" <if test='param.memPhone != null'> and b.mem_phone like concat('%', #{param.memPhone}, '%') </if>" + " <if test='param.memPhone != null'> and b.mem_phone like concat('%', #{param.memPhone}, '%') </if>" +
" <if test='param.couponKey != null'> and d.coupon_key like concat('%', #{param.couponKey}, '%') </if>" +
" <if test='param.couponSource != null'> and d.coupon_source = #{param.couponSource} </if>" +
" <if test='param.couponName != null'> and a.goods_name like concat('%', #{param.couponName}, '%') </if>" + " <if test='param.couponName != null'> and a.goods_name like concat('%', #{param.couponName}, '%') </if>" +
" <if test='param.payType != null'> and b.pay_type = #{param.payType} </if>" + " <if test='param.payType != null'> and b.pay_type = #{param.payType} </if>" +
" <if test='param.orderStatus != null'> and b.order_status = #{param.orderStatus} </if>" + " <if test='param.orderStatus != null'> and b.order_status = #{param.orderStatus} </if>" +

@ -16,6 +16,10 @@ import java.util.Date;
@Data @Data
public class OrderCouponModel { public class OrderCouponModel {
@ColumnWidth(25)
@ExcelProperty(value = "分公司")
private String companyName;
@ColumnWidth(25) @ColumnWidth(25)
@ExcelProperty(value = "交易订单号") @ExcelProperty(value = "交易订单号")
private String orderNo; private String orderNo;
@ -24,6 +28,10 @@ public class OrderCouponModel {
@ExcelProperty(value = "客户电话") @ExcelProperty(value = "客户电话")
private String memPhone; private String memPhone;
@ColumnWidth(20)
@ExcelProperty(value = "卡券编号")
private String couponKey;
@ColumnWidth(30) @ColumnWidth(30)
@ExcelProperty(value = "卡券名称") @ExcelProperty(value = "卡券名称")
private String couponName; private String couponName;
@ -32,6 +40,10 @@ public class OrderCouponModel {
@ExcelProperty(value = "卡券面值") @ExcelProperty(value = "卡券面值")
private String couponPrice; private String couponPrice;
@ColumnWidth(13)
@ExcelProperty(value = "卡券来源")
private String couponSource;
@ColumnWidth(13) @ColumnWidth(13)
@ExcelProperty(value = "订单总额") @ExcelProperty(value = "订单总额")
private BigDecimal totalPrice; private BigDecimal totalPrice;

@ -262,7 +262,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
} }
HighChildOrder childOrder = new HighChildOrder(); HighChildOrder childOrder = new HighChildOrder();
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE1.getNumber()); childOrder.setGoodsType(OrderChildGoodsType.TYPE2.getNumber());
childOrder.setGoodsId(user.getId()); childOrder.setGoodsId(user.getId());
childOrder.setGoodsName(user.getName()); childOrder.setGoodsName(user.getName());
childOrder.setGoodsImg(user.getHeaderImg()); childOrder.setGoodsImg(user.getHeaderImg());

Loading…
Cancel
Save