'提交代码'

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.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsCompany;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
@ -47,6 +48,9 @@ public class HighCouponController {
@Resource
private HighCouponHandselService highCouponHandselService;
@Resource
private BsCompanyService bsCompanyService;
@Resource
private HighCouponCodeService highCouponCodeService;
@ -56,30 +60,28 @@ public class HighCouponController {
@RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@ResponseBody
@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 = "couponName", required = false) String couponName,
@RequestParam(name = "couponType", required = false) Integer couponType,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) {
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> map = new HashMap<>();
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, "");
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(regionId);
if (bsCompany != null) {
Map<String, Object> map = new HashMap<>();
map.put("companyId", bsCompany.getRegionId());
map.put("merchantId", merchantId);
map.put("couponName", couponName);
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);
map.put("couponName", couponName);
map.put("couponType", couponType);
map.put("status", 2);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map)));
return ResponseMsgUtil.success(new PageInfo<>());
} catch (Exception e) {
log.error("HighCouponController -> getCouponList() error!",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.utils.MemberValidateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore;
import com.hai.model.HighCouponModel;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCouponService;
import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService;
import com.hai.service.SecUserService;
@ -47,6 +50,9 @@ public class HighMerchantStoreController {
@Autowired
private UserCenter userCenter;
@Resource
private HighCouponService highCouponService;
@Resource
private HighMerchantStoreService highMerchantStoreService;
@ -70,34 +76,22 @@ public class HighMerchantStoreController {
}
}
@RequestMapping(value="/getStoreListByCompany",method = RequestMethod.GET)
@RequestMapping(value="/getStoreListByCoupon",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据公司 查询商户门店列表")
public ResponseData getStoreListByCompany(@RequestParam(name = "merchantId", required = false) Long merchantId,
@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) {
@ApiOperation(value = "根据卡卷查询门店列表")
public ResponseData getStoreListByCoupon(@RequestParam(name = "couponId", required = true) Long couponId) {
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<>();
map.put("companyId", userInfoModel.getBsCompany().getId());
map.put("merchantId", merchantId);
map.put("telephone", telephone);
map.put("storeName", storeName);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map)));
HighCouponModel coupon = highCouponService.getCouponById(couponId);
if (coupon == null) {
ResponseMsgUtil.success(null);
}
Map<String,Object> map = new HashMap<>();
map.put("merchantId", coupon.getMerchantId());
return ResponseMsgUtil.success(highMerchantStoreService.getMerchantStoreList(map));
} catch (Exception e) {
log.error("HighMerchantStoreController -> getStoreListByCompany() error!",e);
log.error("HighMerchantStoreController -> getStoreListByCoupon() error!",e);
return ResponseMsgUtil.exception(e);
}
}

@ -100,4 +100,11 @@ public interface HighCouponService {
**/
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<>();
}
@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