提交代码

dev-discount
胡锐 2 years ago
parent f906a4dfb3
commit fba9e3334d
  1. 33
      hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
  2. 1
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  3. 7
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  4. 18
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java

@ -21,11 +21,9 @@ import com.hai.entity.HighOrder;
import com.hai.entity.HighTyAgent; import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTySalesman; import com.hai.entity.HighTySalesman;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.*; import com.hai.model.*;
import com.hai.service.HighCouponCodeService; import com.hai.service.*;
import com.hai.service.HighOrderService;
import com.hai.service.HighTyAgentService;
import com.hai.service.HighTySalesmanService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
@ -59,6 +57,9 @@ public class HighOrderController {
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@Resource
private HighCouponService couponService;
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@ -133,7 +134,20 @@ public class HighOrderController {
HttpServletRequest request) { HttpServletRequest request) {
try { try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId()));
} else {
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("couponName", couponName); map.put("couponName", couponName);
@ -172,7 +186,18 @@ public class HighOrderController {
HttpServletRequest request) { HttpServletRequest request) {
try { try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId()));
} else {
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("couponName", couponName); map.put("couponName", couponName);

@ -1320,6 +1320,7 @@ public interface HighOrderMapperExt {
" 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" +
" where a.goods_type = 1" + " where a.goods_type = 1" +
" <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.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>" +

@ -129,6 +129,13 @@ public interface HighCouponService {
**/ **/
Long getCouponByCouponName(Long companyId,String couponName); Long getCouponByCouponName(Long companyId,String couponName);
/**
* 拼接卡券id
* @param companyId
* @return
*/
String getCouponIdsByCompanyId(Long companyId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据商户 查询处于已上架的卡卷 * @Description 根据商户 查询处于已上架的卡卷

@ -437,7 +437,7 @@ public class HighCouponServiceImpl implements HighCouponService {
criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource"));
} }
example.setOrderByClause("create_time"); example.setOrderByClause("create_time desc");
List<HighCoupon> coupons = highCouponMapper.selectByExample(example); List<HighCoupon> coupons = highCouponMapper.selectByExample(example);
if (coupons != null && coupons.size() > 0) { if (coupons != null && coupons.size() > 0) {
for (HighCoupon highCoupon : coupons) { for (HighCoupon highCoupon : coupons) {
@ -509,6 +509,22 @@ public class HighCouponServiceImpl implements HighCouponService {
return highCouponMapper.countByExample(example); return highCouponMapper.countByExample(example);
} }
@Override
public String getCouponIdsByCompanyId(Long companyId) {
HighCouponExample example = new HighCouponExample();
example.createCriteria().andCompanyIdEqualTo(companyId);
List<HighCoupon> list = highCouponMapper.selectByExample(example);
String str = null;
for (HighCoupon coupon : list) {
if (StringUtils.isBlank(str)) {
str = coupon.getId().toString();
} else {
str += ","+coupon.getId();
}
}
return str;
}
@Override @Override
public List<HighCoupon> getCouponListByMerchant(Long merchantId) { public List<HighCoupon> getCouponListByMerchant(Long merchantId) {
HighCouponExample example = new HighCouponExample(); HighCouponExample example = new HighCouponExample();

Loading…
Cancel
Save