dev-discount
袁野 4 years ago
parent 4d87d3d7fb
commit 7d982b7e15
  1. 176
      hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java
  2. 1
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  4. 48
      hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java
  5. 61
      hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java
  6. 7
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  7. 1
      hai-service/src/main/java/com/hai/model/HighDiscountModel.java
  8. 10
      hai-service/src/main/java/com/hai/model/UserInfoModel.java
  9. 22
      hai-service/src/main/java/com/hai/model/UserModel.java
  10. 2
      hai-service/src/main/java/com/hai/service/HighAgentService.java
  11. 14
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  12. 2
      hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java
  13. 29
      hai-service/src/main/java/com/hai/service/impl/HighAgentServiceImpl.java
  14. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountServiceImpl.java
  15. 29
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  16. 4
      hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java

@ -1,5 +1,7 @@
package com.bweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -8,6 +10,9 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.MemberValidateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighAgent;
import com.hai.entity.HighUser;
import com.hai.entity.SecUser;
import com.hai.model.HighAgentModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
@ -18,16 +23,18 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Auther: 袁野
@ -59,8 +66,8 @@ public class HighAgentController {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getMerchant() == null) {
log.error("HighMerchantController -> insertAgent() error!","该主角色没有权限");
if (userInfoModel.getBsCompany() == null) {
log.error("HighAgentController -> insertAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
@ -69,34 +76,24 @@ public class HighAgentController {
|| StringUtils.isBlank(highAgentModel.getAgentUser())
|| StringUtils.isBlank(highAgentModel.getAgentPhone())
|| StringUtils.isBlank(highAgentModel.getSecUser().getPassword())
|| StringUtils.isBlank(highAgentModel.getSecUser().getTelephone())
|| StringUtils.isBlank(highAgentModel.getSecUser().getLoginName())
) {
log.error("HighMerchantController -> insertAgent() error!","参数错误");
log.error("HighAgentController -> insertAgent() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 校验账号手机号是否存在
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) {
log.error("HighMerchantStoreController --> insertAgent() error!", "联系方式已被使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.TEL_EXISTED, "");
// 校验账号用户名是否存在
if (secUserService.findByLoginName(highAgentModel.getSecUser().getLoginName()) != null) {
log.error("HighAgentController --> insertAgent() error!", "用户名已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, "");
}
if (highAgentService.findByAgentName(highAgentModel.getAgentName())) {
log.error("HighMerchantStoreController --> insertAgent() error!", "代理商名称已存在");
log.error("HighAgentController --> insertAgent() error!", "代理商名称已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, "");
}
// 校验账户手机号
if (!MemberValidateUtil.validatePhone(highAgentModel.getSecUser().getTelephone())) {
log.error("BsStudentController --> insertMerchant() error!", "请输入正确的电话号码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, "");
}
// 校验账号手机号是否存在
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) {
log.error("BsStudentController --> insertMerchant() error!", "电话号码已被使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, "");
}
highAgentModel.setStatus(1); // 状态:0:不可用,1:可用
highAgentModel.setCreateTime(new Date());
@ -115,14 +112,14 @@ public class HighAgentController {
@RequestMapping(value = "/updateAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改代理商")
public ResponseData updateAgentMsg(@RequestBody HighAgentModel highAgentModel, HttpServletRequest request) {
public ResponseData updateAgent(@RequestBody HighAgentModel highAgentModel, HttpServletRequest request) {
try {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getMerchant() == null) {
log.error("HighMerchantController -> insertAgent() error!","该主角色没有权限");
if (userInfoModel.getBsCompany() == null) {
log.error("HighAgentController -> insertAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
@ -132,51 +129,132 @@ public class HighAgentController {
|| StringUtils.isBlank(highAgentModel.getAgentUser())
|| StringUtils.isBlank(highAgentModel.getAgentPhone())
|| StringUtils.isBlank(highAgentModel.getSecUser().getPassword())
|| StringUtils.isBlank(highAgentModel.getSecUser().getTelephone())
|| StringUtils.isBlank(highAgentModel.getSecUser().getLoginName())
) {
log.error("HighMerchantController -> insertAgent() error!","参数错误");
log.error("HighAgentController -> insertAgent() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighAgent highAgent = highAgentService.findByAgentMsgId(highAgentModel.getId());
// 校验账号手机号是否存在
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) {
log.error("HighMerchantStoreController --> insertAgent() error!", "联系方式已被使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.TEL_EXISTED, "");
// 校验账号用户名是否存在
if (secUserService.findByLoginName(highAgentModel.getSecUser().getLoginName()) != null && !highAgentModel.getId().equals(highAgent.getId())) {
log.error("HighAgentController --> insertAgent() error!", "用户名已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, "");
}
if (highAgentService.findByAgentName(highAgentModel.getAgentName())) {
log.error("HighMerchantStoreController --> insertAgent() error!", "代理商名称已存在");
if (highAgentService.findByAgentName(highAgentModel.getAgentName()) && !highAgentModel.getId().equals(highAgent.getId())) {
log.error("HighAgentController --> insertAgent() error!", "代理商名称已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, "");
}
// 校验账户手机号
if (!MemberValidateUtil.validatePhone(highAgentModel.getSecUser().getTelephone())) {
log.error("BsStudentController --> insertMerchant() error!", "请输入正确的电话号码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, "");
}
// 校验账号手机号是否存在
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) {
log.error("BsStudentController --> insertMerchant() error!", "电话号码已被使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, "");
}
highAgentModel.setStatus(1); // 状态:0:不可用,1:可用
highAgentModel.setCreateTime(new Date());
highAgentModel.setOperatorId(userInfoModel.getSecUser().getId());
highAgentModel.setOperatorName(userInfoModel.getSecUser().getUserName());
highAgentService.insertAgentMsg(highAgentModel);
highAgentService.updateAgentMsg(highAgentModel);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("BsPositionController --> addPosition() error!", e);
log.error("HighAgentController --> insertAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getListAgent", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商列表")
public ResponseData getListAgent(
@RequestParam(value = "agentName", required = false) String agentName,
@RequestParam(value = "agentPhone", required = false) String agentPhone,
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, String> map = new HashMap<>();
if (StringUtils.isNotBlank(agentName)) {
map.put("agentName", agentName);
}
if (StringUtils.isNotBlank(agentPhone)) {
map.put("agentPhone", agentPhone);
}
if (status != null) {
map.put("status", Integer.toString(status));
}
PageHelper.startPage(pageNum, pageSize);
List<HighAgent> highAgents = highAgentService.getListAgentMsg(map);
return ResponseMsgUtil.success(new PageInfo<>(highAgents));
} catch (Exception e) {
log.error("HighAgentController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findByAgentId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情")
public ResponseData findById(@RequestParam(value = "agentId", required = true) Long agentId) {
try {
HighAgentModel highAgentModel = new HighAgentModel();
HighAgent highAgent = highAgentService.findByAgentMsgId(agentId);
BeanUtils.copyProperties(highAgent, highAgentModel);
// 查询商户主账号
SecUser mainAccount = secUserService.getMainAccount(4, highAgent.getId());
if (mainAccount != null) {
highAgentModel.setSecUser(mainAccount);
}
return ResponseMsgUtil.success(highAgentModel);
} catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/forbiddenUser", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "禁用启用账号")
public ResponseData forbiddenUser(@RequestParam(value = "agentId" , required = true) Long agentId) {
try {
HighAgent highAgent = highAgentService.findByAgentMsgId(agentId);
if (highAgent == null) {
log.error("HighUserController --> forbiddenUser() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, "");
}
if (highAgent.getStatus() == 1) {
highAgent.setStatus(0);
} else {
highAgent.setStatus(1);
}
HighAgentModel highAgentModel = new HighAgentModel();
BeanUtils.copyProperties(highAgent, highAgentModel);
highAgentService.updateAgentMsg(highAgentModel);
return ResponseMsgUtil.success("禁用成功");
} catch (Exception e) {
log.error("BsPositionController --> addPosition() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -58,7 +58,6 @@ public class HighDiscountController {
}
if (StringUtils.isBlank(highDiscount.getDiscountName())
|| StringUtils.isBlank(highDiscount.getDiscountImg())
|| StringUtils.isBlank(highDiscount.getDiscountCarouselImg())
|| highDiscount.getDiscountType() == null
|| highDiscount.getDiscountPrice() == null
|| highDiscount.getEffectiveDay() == null

@ -95,6 +95,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/coupon/getCouponById")
.excludePathPatterns("/highMerchantStore/getMerchantStoreById")
.excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
.excludePathPatterns("/highMerchantStore/getMerchantList")
.excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
.excludePathPatterns("/wechat/*")
;
}

@ -58,7 +58,10 @@ public class HighCouponController {
@Resource
private HighUserCouponService highUserCouponService;
@RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@Resource
private HighMerchantStoreService highMerchantStoreService;
@RequestMapping(value = "/getCouponList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "卡卷列表")
public ResponseData getCouponList(@RequestParam(name = "regionId", required = true) String regionId,
@ -86,12 +89,12 @@ public class HighCouponController {
return ResponseMsgUtil.success(new PageInfo<>());
} catch (Exception e) {
log.error("HighCouponController -> getCouponList() error!",e);
log.error("HighCouponController -> getCouponList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getCouponById",method = RequestMethod.GET)
@RequestMapping(value = "/getCouponById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "卡卷信息")
public ResponseData getCouponById(@RequestParam(name = "userId", required = false) Long userId,
@ -100,12 +103,12 @@ public class HighCouponController {
HighCoupon coupon = highCouponService.getCouponById(couponId);
if (coupon != null & userId != null) {
coupon.setNumberUpperLimitStatus(highCouponService.userBuyLimitNumber(userId,coupon.getId()));
coupon.setNumberUpperLimitStatus(highCouponService.userBuyLimitNumber(userId, coupon.getId()));
}
return ResponseMsgUtil.success(coupon);
} catch (Exception e) {
log.error("HighCouponController -> getCouponById() error!",e);
log.error("HighCouponController -> getCouponById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@ -123,7 +126,7 @@ public class HighCouponController {
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
map.put("status", status);
@ -140,7 +143,7 @@ public class HighCouponController {
@ResponseBody
@ApiOperation(value = "获取用户卡卷详细")
public ResponseData getUserCouponDetail(@RequestParam(name = "couponId", required = true) Long couponId,
HttpServletRequest request) {
HttpServletRequest request) {
try {
// 用户
@ -171,7 +174,7 @@ public class HighCouponController {
@ResponseBody
@ApiOperation(value = "卡卷过期,再次领取")
public ResponseData againReceiveCoupon(@RequestParam(name = "couponId", required = true) Long couponId,
HttpServletRequest request) {
HttpServletRequest request) {
try {
// 用户
@ -193,5 +196,34 @@ public class HighCouponController {
}
}
@RequestMapping(value = "/getCouponListByStoreId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据门店ID查询用户卡卷列表")
public ResponseData getCouponListByStoreId(
@RequestParam(name = "storeId", required = false) Long storeId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("merchantId", highMerchantStoreService.getMerchantStoreById(storeId).getMerchantId());
map.put("userId", userInfoModel.getHighUser().getId());
map.put("status", 1);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highUserCouponService.getUserCouponList(map)));
} catch (Exception e) {
log.error("HighCouponController -> getCouponList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,6 +1,5 @@
package com.cweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
@ -9,17 +8,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.BsCompany;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore;
import com.hai.model.*;
import com.hai.service.HighCouponService;
import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService;
import com.hai.service.SecUserService;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,7 +24,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -58,7 +53,7 @@ public class HighMerchantStoreController {
private HighMerchantService highMerchantService;
@Resource
private SecUserService secUserService;
private BsCompanyService bsCompanyService;
@RequestMapping(value="/getMerchantStoreById",method = RequestMethod.GET)
@ResponseBody
@ -106,5 +101,55 @@ public class HighMerchantStoreController {
}
}
@RequestMapping(value="/getStoreListByMerchant",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据商户查询门店列表")
public ResponseData getStoreListByMerchant(@RequestParam(name = "merchantId", required = true) Long merchantId,
@RequestParam(name = "longitude", required = true) String longitude,
@RequestParam(name = "latitude", required = true) String latitude) {
try {
Map<String,Object> map = new HashMap<>();
map.put("merchantId", merchantId);
map.put("longitude", longitude);
map.put("latitude", latitude);
List<HighMerchantStore> storeList = highMerchantStoreService.getStoreListByLongitude(map);
if (storeList != null && storeList.size() > 0) {
HighMerchant merchant = highMerchantService.getMerchantById(merchantId);
for (HighMerchantStore store : storeList) {
store.setExt1(merchant.getMerchantLogo());
}
}
return ResponseMsgUtil.success(storeList);
} catch (Exception e) {
log.error("HighMerchantStoreController -> getStoreListByCoupon() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getMerchantList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商户列表")
public ResponseData getMerchantList(
@RequestParam(name = "regionId", required = true) String regionId) {
try {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(regionId);
Map<String, Object> map = new HashMap<>();
map.put("companyId", bsCompany.getId());
map.put("status", 1);
return ResponseMsgUtil.success(highMerchantService.getMerchantList(map));
} catch (Exception e) {
log.error("HighMerchantController -> getMerchantList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -3,10 +3,12 @@ package com.cweb.controller;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserCoupon;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCouponService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api;
@ -43,6 +45,9 @@ public class HighUserController {
@Resource
private HighUserCouponService highUserCouponService;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/findUser", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情")
@ -56,6 +61,8 @@ public class HighUserController {
HighUser highUser = highUserService.findByUserId(userInfoModel.getHighUser().getId());
if (highUser != null) {
highUser.setUnusedCouponNum( highUserCouponService.getCouponList(highUser.getId(), 1).size()); //未使用卡卷数量
highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1));
highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1));
}
return ResponseMsgUtil.success(highUser);

@ -1,6 +1,5 @@
package com.hai.model;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountCouponRel;
import java.util.List;

@ -28,6 +28,8 @@ public class UserInfoModel {
private HighMerchant merchant;
// 门店
private HighMerchantStore merchantStore;
// 代理商
private HighAgent highAgent;
// 权限列表
private List<SecPermission> permissionList;
// 菜单权限列表
@ -116,4 +118,12 @@ public class UserInfoModel {
public void setToken(String token) {
this.token = token;
}
public HighAgent getHighAgent() {
return highAgent;
}
public void setHighAgent(HighAgent highAgent) {
this.highAgent = highAgent;
}
}

@ -10,6 +10,12 @@ public class UserModel {
// 未使用卡卷数量
private Integer unusedCouponNum;
// 未使用优惠券数量
private Integer unusedDiscount;
// 待支付数量
private Integer unpaid;
public Integer getUnusedCouponNum() {
return unusedCouponNum;
}
@ -17,4 +23,20 @@ public class UserModel {
public void setUnusedCouponNum(Integer unusedCouponNum) {
this.unusedCouponNum = unusedCouponNum;
}
public Integer getUnusedDiscount() {
return unusedDiscount;
}
public void setUnusedDiscount(Integer unusedDiscount) {
this.unusedDiscount = unusedDiscount;
}
public Integer getUnpaid() {
return unpaid;
}
public void setUnpaid(Integer unpaid) {
this.unpaid = unpaid;
}
}

@ -59,7 +59,7 @@ public interface HighAgentService {
* @param: [highUser] 用户信息
* @return: com.hai.entity.HighAgentMsg
*/
void updateAgentMsg(HighAgentModel highAgentModel);
void updateAgentMsg(HighAgentModel highAgentModel) throws Exception;
/**
*

@ -105,4 +105,18 @@ public interface HighOrderService {
**/
void cancelOrder(Long orderId);
/**
* @Author 袁野
* @Description 根据用户查询订单统计
* @Date 2021/3/27 15:50
**/
Integer countOrderByUserId(Long memId , Integer status);
/**
* @Author 袁野
* @Description 根据未使用优惠券
* @Date 2021/3/27 15:50
**/
Integer countUnusedDiscountByUserId(Long userId , Integer status);
}

@ -61,7 +61,7 @@ public class BsCompanyServiceImpl implements BsCompanyService {
bsOrganizationMapper.insert(secOrganization);
// 保存公司主角色
secUser.setCompanyId(secCompany.getId());
secUser.setObjectType(5);
secUser.setObjectType(1);
secUser.setObjectId(secCompany.getId());
secUser.setOrganizationId(secOrganization.getId());
secUserMapper.insert(secUser);

@ -4,6 +4,7 @@ import com.hai.common.utils.MD5Util;
import com.hai.dao.HighAgentMapper;
import com.hai.entity.HighAgent;
import com.hai.entity.HighAgentExample;
import com.hai.entity.SecUser;
import com.hai.model.HighAgentModel;
import com.hai.service.HighAgentService;
import com.hai.service.SecUserService;
@ -35,12 +36,15 @@ public class HighAgentServiceImpl implements HighAgentService {
HighAgentExample example = new HighAgentExample();
HighAgentExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(map.get("userName"))) {
criteria.andAgentNameLike("%" + map.get("userName") + "%");
}
if (StringUtils.isNotBlank(map.get("agentName"))) {
criteria.andAgentNameLike("%" + map.get("agentName") + "%");
}
if (StringUtils.isNotBlank(map.get("agentPhone"))) {
criteria.andAgentPhoneEqualTo( map.get("agentPhone"));
}
if (StringUtils.isNotBlank(map.get("status"))) {
criteria.andStatusEqualTo(Integer.valueOf(map.get("status")));
}
return highAgentMapper.selectByExample(example);
}
@ -57,12 +61,25 @@ public class HighAgentServiceImpl implements HighAgentService {
criteria.andAgentNameEqualTo(agentName);
return highAgentMapper.selectByExample(example).size() == 0;
return highAgentMapper.selectByExample(example).size() != 0;
}
@Override
public void updateAgentMsg(HighAgentModel highAgentModel) {
public void updateAgentMsg(HighAgentModel highAgentModel) throws Exception {
highAgentMapper.updateByPrimaryKey(highAgentModel);
// 查询主账号
SecUser mainAccount = secUserService.getMainAccount(4, highAgentModel.getId());
if (mainAccount != null) {
String userPass = MD5Util.encode(highAgentModel.getSecUser().getPassword().getBytes());
if (!mainAccount.getPassword().equals(userPass)) {
mainAccount.setPassword(userPass);
}
if (highAgentModel.getStatus() == 0) {
mainAccount.setStatus(0);
}
mainAccount.setTelephone(highAgentModel.getSecUser().getLoginName());
secUserService.updateUser(mainAccount);
}
}
@Override
@ -70,7 +87,7 @@ public class HighAgentServiceImpl implements HighAgentService {
highAgentMapper.insert(highAgentModel);
highAgentModel.getSecUser().setUserName(highAgentModel.getAgentName());
highAgentModel.getSecUser().setLoginName(highAgentModel.getSecUser().getTelephone());
highAgentModel.getSecUser().setLoginName(highAgentModel.getSecUser().getLoginName());
highAgentModel.getSecUser().setPassword(MD5Util.encode(highAgentModel.getSecUser().getPassword().getBytes()));
highAgentModel.getSecUser().setAdminFlag(1);
highAgentModel.getSecUser().setStatus(1);

@ -44,10 +44,10 @@ public class HighDiscountServiceImpl implements HighDiscountService {
HighDiscountExample example = new HighDiscountExample();
HighDiscountExample.Criteria criteria = example.createCriteria();
if (StringUtils.isBlank(MapUtils.getString(map, "discountKey"))) {
if (StringUtils.isNotBlank(MapUtils.getString(map, "discountKey"))) {
criteria.andDiscountKeyEqualTo(MapUtils.getString(map, "discountKey"));
}
if (StringUtils.isBlank(MapUtils.getString(map, "discountName"))) {
if (StringUtils.isNotBlank(MapUtils.getString(map, "discountName"))) {
criteria.andDiscountNameLike("%" + MapUtils.getString(map, "discountName") + "%");
}
if (MapUtils.getInteger(map, "discountType") != null) {

@ -6,10 +6,7 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.dao.HighChildOrderMapper;
import com.hai.dao.HighOrderMapper;
import com.hai.dao.HighOrderMapperExt;
import com.hai.dao.HighUserCouponMapper;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.model.HighCouponHandselModel;
import com.hai.model.HighCouponModel;
@ -57,6 +54,8 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource
private HighUserCouponMapper highUserCouponMapper;
@Resource
private HighDiscountUserRelMapper highDiscountUserRelMapper;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
@ -344,4 +343,26 @@ public class HighOrderServiceImpl implements HighOrderService {
updateOrder(order);
}
}
@Override
public Integer countOrderByUserId(Long memId , Integer status) {
HighOrderExample example = new HighOrderExample();
HighOrderExample.Criteria criteria = example.createCriteria();
criteria.andMemIdEqualTo(memId);
criteria.andOrderStatusEqualTo(status);
return highOrderMapper.selectByExample(example).size();
}
@Override
public Integer countUnusedDiscountByUserId(Long userId, Integer status) {
HighDiscountUserRelExample example = new HighDiscountUserRelExample();
HighDiscountUserRelExample.Criteria criteria = example.createCriteria();
return highDiscountUserRelMapper.selectByExample(example).size();
}
}

@ -76,6 +76,10 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getLong(map, "merchantId") != null) {
criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}

Loading…
Cancel
Save