提交赠券功能

dev-discount
袁野 3 years ago
parent 406b262178
commit 25b32d61bf
  1. 1
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  2. 5
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java
  3. 38
      hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java
  4. 5
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java
  5. 13
      hai-service/src/main/java/com/hai/model/HighUserDiscountUnicomModel.java
  6. 2
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  7. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountServiceImpl.java
  8. 2
      hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java

@ -208,7 +208,6 @@ public class HighDiscountController {
map.put("useScope", useScope);
map.put("discountName", discountName);
map.put("discountType", discountType);
map.put("useScope", useScope);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highDiscountService.getDiscount(map)));

@ -218,8 +218,9 @@ public class HighDiscountPackageController {
}
}
HighDiscountPackage highDiscountPackage1 = highDiscountPackageService.getCallExclusive(highDiscountPackage.getUsingAttribution() , userInfoModel.getBsCompany().getId().intValue());
if (highDiscountPackageService.getCallExclusive(highDiscountPackage.getUsingAttribution() , userInfoModel.getBsCompany().getId().intValue()) != null) {
if (highDiscountPackage1 != null && highDiscountPackage1.getId() != highDiscountPackage.getId()) {
log.error("highCouponPackage -> updateCouponPackageInfo() error!","专属优惠券已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "专属优惠券已存在");
}
@ -489,7 +490,7 @@ public class HighDiscountPackageController {
try {
Map<String,Object> map = new HashMap<>();
map.put("discountPackageId" , id);
return ResponseMsgUtil.success(highDiscountPackageDetailsService.getDiscountPackageDetailsList(map));

@ -9,15 +9,13 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighDiscountCouponRel;
import com.hai.entity.HighDiscountUserRel;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountCouponRelService;
import com.hai.service.HighDiscountUserRelService;
import com.hai.service.HighOpenApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -56,6 +54,9 @@ public class HighUserDiscountController {
@Resource
private HighDiscountCouponRelService highDiscountCouponRelService;
@Resource
private HighOpenApiService highOpenApiService;
@RequestMapping(value="/receiveDiscount",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "用户领取优惠券")
@ -163,4 +164,33 @@ public class HighUserDiscountController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserOrderPreList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户预约订单")
public ResponseData getUserOrderPreList(@RequestParam(name = "usingAttribution", required = false) Integer usingAttribution,
@RequestParam(name = "year", required = false) String year,
HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
map.put("usingAttribution", usingAttribution);
if (year != null) {
map.put("createTimeS", year + "-01-01 00:00:00");
map.put("createTimeE", year + "-12-31 23:59:59");
}
return ResponseMsgUtil.success(highOpenApiService.getUserCouponsList(map));
} catch (Exception e) {
log.error("HighOrderController --> getUserPreOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -17,12 +17,13 @@ public interface HighDiscountUserRelMapperExt {
@Select({"<script>" +
" SELECT" +
" hdur.id id , " +
" hdur.using_attribution usingAttribution , " +
" hd.using_range usingAttribution , " +
" hdur.use_time useTime , " +
" hdur.use_end_time useEndTime , " +
" hdur.status status , " +
" hdur.create_time createTime , " +
" hd.discount_name discountName , " +
" hd.discount_img discountImg , " +
" hd.discount_condition discountCondition , " +
" hd.discount_price discountPrice , " +
" hd.discount_type discountType " +
@ -30,7 +31,7 @@ public interface HighDiscountUserRelMapperExt {
" high_discount_user_rel hdur join high_discount hd on hdur.discount_id = hd.id " +
" WHERE" +
" 1=1" +
" <if test='map.usingAttribution != null'> and hdur.using_attribution = #{map.usingAttribution} </if> " +
" <if test='map.usingAttribution != null'> and hd.using_range = #{map.usingAttribution} </if> " +
" <if test='map.userId != null'> and hdur.user_id = #{map.userId} </if>",
" <if test='map.createTimeS != null'> <![CDATA[ and hdur.create_time >= #{map.createTimeS} ]]> </if>",
" <if test='map.createTimeE != null'> <![CDATA[ and hdur.create_time <= #{map.createTimeE} ]]> </if>",

@ -20,6 +20,11 @@ public class HighUserDiscountUnicomModel {
*/
private Integer status;
/**
* 优惠券图片
*/
private String discountImg;
/**
* 使用时间
*/
@ -134,4 +139,12 @@ public class HighUserDiscountUnicomModel {
public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice;
}
public String getDiscountImg() {
return discountImg;
}
public void setDiscountImg(String discountImg) {
this.discountImg = discountImg;
}
}

@ -96,7 +96,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
HighDiscountAgentCodeExample example = new HighDiscountAgentCodeExample();
HighDiscountAgentCodeExample.Criteria criteria = example.createCriteria();
criteria.andDiscountAgentIdEqualTo(discountAgentId).andStatusEqualTo(1);
criteria.andDiscountAgentIdEqualTo(discountAgentId).andStatusEqualTo(5);
example.setOrderByClause("create_time desc");
return highDiscountAgentCodeMapper.selectByExample(example);
}

@ -59,9 +59,7 @@ public class HighDiscountServiceImpl implements HighDiscountService {
if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId"));
}
if (MapUtils.getLong(map, "useScope") != null) {
criteria.andUseScopeEqualTo(MapUtils.getInteger(map, "useScope"));
}
example.setOrderByClause("update_time desc");
return highDiscountMapper.selectByExample(example);

@ -153,7 +153,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService {
highDiscountUserRel.setUseEndTime(userEndTime.getTime());
// 修改优惠券二维码状态
discountAgentCode.setStatus(5);
discountAgentCode.setStatus(2);
highDiscountAgentCodeService.updateCode(discountAgentCode);
// 新增优惠券与用户的绑定关系

Loading…
Cancel
Save