'提交代码'

dev-discount
199901012 4 years ago
parent 24e465d4cb
commit cee34088e1
  1. 51
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 36
      hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java
  3. 40
      hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java
  4. 7
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  5. 7
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java

@ -468,5 +468,56 @@ public class HighCouponController {
} }
} }
@RequestMapping(value="/getMerchantCouponTree",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询商户下的卡卷【树结构】")
public ResponseData getMerchantCouponTree(HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighCouponController -> getCouponList() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
// 查询商户
Map<String,Object> map = new HashMap<>();
map.put("companyId", userInfoModel.getBsCompany().getId());
List<HighMerchant> merchantList = highMerchantService.getMerchantList(map);
List<Map<String, Object>> parentMap = new ArrayList<>();
Map<String, Object> merchantMap;
List<Map<String, Object>> couponMapList;
Map<String, Object> couponMap;
for (HighMerchant highMerchant : merchantList) {
merchantMap = new HashMap<>();
merchantMap.put("key", highMerchant.getId());
merchantMap.put("title", highMerchant.getMerchantName());
couponMapList = new ArrayList<>();
// 查询门店下的卡卷
List<HighCoupon> list = highCouponService.getCouponListByMerchant(highMerchant.getId());
if (list.size() > 0) {
for (HighCoupon highCoupon : list) {
couponMap = new HashMap<>();
couponMap.put("key", highCoupon.getId());
couponMap.put("title", highCoupon.getCouponName());
couponMap.put("isLeaf", true);
couponMapList.add(couponMap);
}
}
merchantMap.put("children", couponMapList);
parentMap.add(merchantMap);
}
return ResponseMsgUtil.success(parentMap);
} catch (Exception e) {
log.error("HighCouponController -> getMerchantCouponTree() error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -8,6 +8,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsCompany;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.*; import com.hai.service.*;
@ -47,6 +48,9 @@ public class HighCouponController {
@Resource @Resource
private HighCouponHandselService highCouponHandselService; private HighCouponHandselService highCouponHandselService;
@Resource
private BsCompanyService bsCompanyService;
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@ -56,30 +60,28 @@ public class HighCouponController {
@RequestMapping(value="/getCouponList",method = RequestMethod.GET) @RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "卡卷列表") @ApiOperation(value = "卡卷列表")
public ResponseData getCouponList(@RequestParam(name = "regionId", required = true) Long regionId, public ResponseData getCouponList(@RequestParam(name = "regionId", required = true) String regionId,
@RequestParam(name = "merchantId", required = false) Long merchantId, @RequestParam(name = "merchantId", required = false) Long merchantId,
@RequestParam(name = "couponName", required = false) String couponName, @RequestParam(name = "couponName", required = false) String couponName,
@RequestParam(name = "couponType", required = false) Integer couponType, @RequestParam(name = "couponType", required = false) Integer couponType,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
Map<String, Object> map = new HashMap<>(); BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(regionId);
if (bsCompany != null) {
SessionObject sessionObject = userCenter.getSessionObject(request); Map<String, Object> map = new HashMap<>();
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); map.put("companyId", bsCompany.getRegionId());
if (userInfoModel.getBsCompany() == null) { map.put("merchantId", merchantId);
log.error("HighCouponController -> getCouponList() error!","权限不足"); map.put("couponName", couponName);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); map.put("couponType", couponType);
map.put("status", 2);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map)));
} }
map.put("regionId", regionId);
map.put("merchantId", merchantId); return ResponseMsgUtil.success(new PageInfo<>());
map.put("couponName", couponName);
map.put("couponType", couponType);
map.put("status", 2);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map)));
} catch (Exception e) { } catch (Exception e) {
log.error("HighCouponController -> getCouponList() error!",e); log.error("HighCouponController -> getCouponList() error!",e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -9,11 +9,14 @@ import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.MemberValidateUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighMerchant; import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore; import com.hai.entity.HighMerchantStore;
import com.hai.model.HighCouponModel;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighCouponService;
import com.hai.service.HighMerchantService; import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService; import com.hai.service.HighMerchantStoreService;
import com.hai.service.SecUserService; import com.hai.service.SecUserService;
@ -47,6 +50,9 @@ public class HighMerchantStoreController {
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private HighCouponService highCouponService;
@Resource @Resource
private HighMerchantStoreService highMerchantStoreService; private HighMerchantStoreService highMerchantStoreService;
@ -70,34 +76,22 @@ public class HighMerchantStoreController {
} }
} }
@RequestMapping(value="/getStoreListByCompany",method = RequestMethod.GET) @RequestMapping(value="/getStoreListByCoupon",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "根据公司 查询商户门店列表") @ApiOperation(value = "根据卡卷查询门店列表")
public ResponseData getStoreListByCompany(@RequestParam(name = "merchantId", required = false) Long merchantId, public ResponseData getStoreListByCoupon(@RequestParam(name = "couponId", required = true) Long couponId) {
@RequestParam(name = "telephone", required = false) String telephone,
@RequestParam(name = "storeName", required = false) String storeName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighMerchantStoreController -> getStoreListByCompany() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> map = new HashMap<>(); HighCouponModel coupon = highCouponService.getCouponById(couponId);
map.put("companyId", userInfoModel.getBsCompany().getId()); if (coupon == null) {
map.put("merchantId", merchantId); ResponseMsgUtil.success(null);
map.put("telephone", telephone); }
map.put("storeName", storeName); Map<String,Object> map = new HashMap<>();
map.put("merchantId", coupon.getMerchantId());
PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(highMerchantStoreService.getMerchantStoreList(map));
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map)));
} catch (Exception e) { } catch (Exception e) {
log.error("HighMerchantStoreController -> getStoreListByCompany() error!",e); log.error("HighMerchantStoreController -> getStoreListByCoupon() error!",e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

@ -100,4 +100,11 @@ public interface HighCouponService {
**/ **/
List<HighCouponModel> getCouponList(Map<String, Object> map); List<HighCouponModel> getCouponList(Map<String, Object> map);
/**
* @Author 胡锐
* @Description 根据商户 查询处于已上架的卡卷
* @Date 2021/3/24 18:29
**/
List<HighCoupon> getCouponListByMerchant(Long merchantId);
} }

@ -353,4 +353,11 @@ public class HighCouponServiceImpl implements HighCouponService {
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public List<HighCoupon> getCouponListByMerchant(Long merchantId) {
HighCouponExample example = new HighCouponExample();
example.createCriteria().andMerchantIdEqualTo(merchantId).andStatusEqualTo(1).andStatusNotEqualTo(0);
return highCouponMapper.selectByExample(example);
}
} }

Loading…
Cancel
Save