提交代码

dev-discount
胡锐 2 years ago
parent 8effa3270b
commit 58fbeb01ad
  1. 33
      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.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);

@ -26,8 +26,11 @@ public interface OrderMapperExt {
@Select({"<script>" +
" select" +
" (select `name` from bs_company WHERE id = d.company_id) companyName," +
" b.order_no orderNo," +
" 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_price couponPrice," +
" b.total_price totalPrice," +
@ -60,10 +63,14 @@ public interface OrderMapperExt {
" b.finish_time finishTime" +
" from high_child_order a" +
" 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" +
" <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.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.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.payType != null'> and b.pay_type = #{param.payType} </if>" +
" <if test='param.orderStatus != null'> and b.order_status = #{param.orderStatus} </if>" +

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

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

Loading…
Cancel
Save