|
@@ -49,8 +49,6 @@ public class CouponController {
|
|
|
@Resource
|
|
|
private StationService stationService;
|
|
|
@Autowired
|
|
|
- private AppUserInfoService appUserInfoService;
|
|
|
- @Autowired
|
|
|
private SysUserService sysUserService;
|
|
|
|
|
|
/**
|
|
@@ -62,27 +60,37 @@ public class CouponController {
|
|
|
@RequestMapping(value = "/selectStaGrantCouponList", method = RequestMethod.GET)
|
|
|
@Transactional
|
|
|
@ResponseBody
|
|
|
- //@ApiOperation(value = "获取油站已发放的优惠券信息", httpMethod = "GET", notes = "获取油站已发放的优惠券信息")
|
|
|
- public String selectStaGrantCouponList(@ApiParam(value = "油站ID", required = true) @RequestParam Integer stationId,
|
|
|
- @ApiParam(value = "用户unionId", required = true) @RequestParam String unionId,
|
|
|
- @ApiParam(value = "发放方式ID", required = true) @RequestParam String couponIssueId){
|
|
|
+ public String selectStaGrantCouponList(Integer stationId, @RequestParam String unionId, @RequestParam String couponIssueId){
|
|
|
Gson gson =new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
|
|
ResultData resultData = null;
|
|
|
try {
|
|
|
if(unionId !=null && stationId !=null && couponIssueId !=null){
|
|
|
//返回前端结果
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- StationInfo stationInfo = new StationInfo();
|
|
|
- stationInfo.setStationId(stationId);
|
|
|
- StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
|
|
|
- if(stationInfos !=null && stationInfos.getCouponEnabledFlag().equals("1")){
|
|
|
- CouponIssue couponIssue = new CouponIssue();
|
|
|
- couponIssue.setStationId(stationId);
|
|
|
- couponIssue.setCouponIssueId(couponIssueId);
|
|
|
- //获取该领取方式的状态是否启用 1启用 0未启用
|
|
|
- List<CouponIssue> couponIssuesList = couponService.selectCouponIssueList(couponIssue);
|
|
|
- if(couponIssuesList !=null && couponIssuesList.size() >0 && couponIssuesList.get(0).getStatus().equals("1")){
|
|
|
- resultMap.put("giveLimit", couponIssuesList.get(0).getGiveLimit());
|
|
|
+ CouponIssue couponIssue = new CouponIssue();
|
|
|
+ couponIssue.setCouponIssueId(couponIssueId);
|
|
|
+ //获取该领取方式的状态是否启用 1启用 0未启用
|
|
|
+ List<CouponIssue> couponIssuesList = couponService.selectCouponIssueList(couponIssue);
|
|
|
+ if(couponIssuesList !=null && couponIssuesList.size() >0 && couponIssuesList.get(0).getStatus().equals("1")){
|
|
|
+ resultMap.put("giveLimit", couponIssuesList.get(0).getGiveLimit());
|
|
|
+ Integer stationIdIssue = couponIssuesList.get(0).getStationId();
|
|
|
+ //获取当前领取方式的油站信息
|
|
|
+ StationInfo staParam = new StationInfo();
|
|
|
+ staParam.setStationId(stationIdIssue);
|
|
|
+ StationInfo station= stationService.selectStationInfo(staParam);
|
|
|
+ Boolean boo = false;
|
|
|
+ //判断油站
|
|
|
+ if("1".equals(station.getJiBie())){
|
|
|
+ //表示是集团
|
|
|
+ if(station.getCouponFlagGroup() !=null && station.getCouponFlagGroup().equals("1")){
|
|
|
+ if(StringUtils.isNotBlank(station.getCouponEnabledFlagGroup()) && "1".equals(station.getCouponEnabledFlagGroup())){
|
|
|
+ boo = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if( StringUtils.isNotBlank(station.getCouponEnabledFlag()) && "1".equals(station.getCouponEnabledFlag())){
|
|
|
+ boo = true;
|
|
|
+ }
|
|
|
+ if(boo){
|
|
|
CouponUserGiveCount couponUserGiveCount = new CouponUserGiveCount();
|
|
|
couponUserGiveCount.setStationId(stationId);
|
|
|
couponUserGiveCount.setUnionId(unionId);
|
|
@@ -146,13 +154,15 @@ public class CouponController {
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- // -7
|
|
|
- resultData = ResultData.error(CodeMsg.ISSUE_CLOSE);
|
|
|
+ //当前领取方式的站点已关闭优惠券功能
|
|
|
+ resultData = ResultData.error(CodeMsg.NO_ENABLE_COUPON);
|
|
|
}
|
|
|
}else {
|
|
|
- resultData = ResultData.error(CodeMsg.NO_ENABLE_COUPON);
|
|
|
+ // -7 该领取方式已失效
|
|
|
+ resultData = ResultData.error(CodeMsg.ISSUE_CLOSE);
|
|
|
}
|
|
|
}else {
|
|
|
+ //必传参数
|
|
|
resultData = ResultData.error(CodeMsg.PARAMS_NUll);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
@@ -212,18 +222,34 @@ public class CouponController {
|
|
|
CouponVerificationUser cu = couponService.selectCouponVerificationUserInfo(couponVerificationUser);
|
|
|
if(cu !=null && cu.getStationId() !=null){
|
|
|
Integer stationId = cu.getStationId();
|
|
|
- UserCoupon coupon = new UserCoupon();
|
|
|
- coupon.setCouponNo(couponNo);
|
|
|
- //coupon.setUnionId(unionId);
|
|
|
- UserCoupon couponInfo = couponService.selectUserCouponInfo(coupon);
|
|
|
+ UserCoupon ucoupon = new UserCoupon();
|
|
|
+ ucoupon.setCouponNo(couponNo);
|
|
|
+ //获取该已核销优惠券的信息
|
|
|
+ UserCoupon couponInfo = couponService.selectUserCouponInfo(ucoupon);
|
|
|
if(couponInfo !=null){
|
|
|
String verification = couponInfo.getVerification();
|
|
|
StationInfo stationInfo = new StationInfo();
|
|
|
stationInfo.setStationId(cu.getStationId());
|
|
|
- StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
|
|
|
- if(StringUtils.isNotBlank(stationInfos.getCouponFlag()) && stationInfos.getCouponFlag().equals("1")){
|
|
|
- stationId = stationInfos.getGroupId();
|
|
|
+ //核销人员所在的站点信息
|
|
|
+ StationInfo sta_cu = stationService.selectStationInfo(stationInfo);
|
|
|
+ //核销人员所在站点级别
|
|
|
+ String jiBie_cu = sta_cu.getJiBie();
|
|
|
+ Integer stationId_coupon = couponInfo.getStationId();
|
|
|
+ stationInfo.setStationId(stationId_coupon);
|
|
|
+ //当前优惠券所在的站点信息
|
|
|
+ StationInfo sta_coupon = stationService.selectStationInfo(stationInfo);
|
|
|
+ //核销券所在站点级别
|
|
|
+ String jiBie_coupon = sta_coupon.getJiBie();
|
|
|
+ if("1".equals(jiBie_coupon)){
|
|
|
+ //表示为集团共享的优惠券
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
boolean contains = verification.contains(stationId.toString());
|
|
|
if(contains){
|
|
|
//如果当前登录用户是异业端核销人员非加油站异业券核销
|