From cdb9f2ea5edbefccdebee4dd77aa64586964fbe4 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Sat, 3 Apr 2021 16:46:29 +0800 Subject: [PATCH] 1 --- .../bweb/controller/HighAgentController.java | 66 +++++++------------ .../bweb/controller/HighOrderController.java | 10 +-- .../com/hai/common/exception/ErrorCode.java | 1 + .../java/com/hai/dao/HighOrderMapperExt.java | 10 +-- .../com/hai/service/HighAgentService.java | 15 ++++- .../com/hai/service/HighOrderService.java | 9 ++- .../service/impl/HighAgentServiceImpl.java | 14 +++- .../impl/HighMerchantStoreServiceImpl.java | 2 - .../service/impl/HighOrderServiceImpl.java | 23 ++++++- 9 files changed, 91 insertions(+), 59 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java index 9d36e026..0c83d0eb 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java @@ -11,6 +11,7 @@ import com.hai.model.HighAgentModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.HighAgentService; +import com.hai.service.SecUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -45,6 +46,9 @@ public class HighAgentController { @Resource private HighAgentService highAgentService; + @Resource + private SecUserService secUserService; + @RequestMapping(value = "/insertAgent", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "新增代理商") @@ -54,53 +58,33 @@ public class HighAgentController { SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); if (userInfoModel.getMerchant() == null) { - log.error("HighMerchantController -> insertMerchantStore() error!","该主角色没有权限"); + log.error("HighMerchantController -> insertAgent() error!","该主角色没有权限"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); } -// if ( -// StringUtils.isBlank(highAgentModel.getSecUser().getPassword()) -// || StringUtils.isBlank(highAgentModel.getSecUser().getUserName()) -// || StringUtils.isBlank(highAgentModel.getSecUser().getUserName()) -// -// ) + if (highAgentModel.getId() == null + || StringUtils.isBlank(highAgentModel.getAgentName()) + || StringUtils.isBlank(highAgentModel.getAgentAddress()) + || StringUtils.isBlank(highAgentModel.getAgentUser()) + || StringUtils.isBlank(highAgentModel.getAgentPhone()) + || StringUtils.isBlank(highAgentModel.getSecUser().getPassword()) + || StringUtils.isBlank(highAgentModel.getSecUser().getTelephone()) + ) { + log.error("HighMerchantController -> 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 (highAgentService.findByAgentName(highAgentModel.getAgentName())) { + log.error("HighMerchantStoreController --> insertAgent() error!", "代理商名称已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, ""); + } -// if (highAgentModel.getAgentAddress() == null -// || StringUtils.isBlank(highMerchantStore.getStoreKey()) -// || StringUtils.isBlank(highMerchantStore.getSecUser().getPassword()) -// || StringUtils.isBlank(highMerchantStore.getSecUser().getTelephone()) -// ) { -// log.error("HighMerchantStoreController -> insertMerchantStore() error!","参数错误"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); -// } -// -// // 校验账户手机号 -// if (!MemberValidateUtil.validatePhone(highMerchantStore.getSecUser().getTelephone())) { -// log.error("HighMerchantStoreController --> insertMerchantStore() error!", "请输入正确的电话号码"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, ""); -// } -// -// // 校验账号手机号是否存在 -// if (secUserService.findByPhone(highMerchantStore.getSecUser().getTelephone()) != null) { -// log.error("HighMerchantStoreController --> insertMerchantStore() error!", "电话号码已被使用"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, ""); -// } -// if ( -// reqBody.getId() == null -// ) { -// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); -// } -// -// HighUser highUser = highUserService.findByUserId(reqBody.getId()); -// -// if (highUser == null) { -// log.error("HighUserController --> updateUser() error!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, ""); -// } -// -// highUserService.updateUser(reqBody); return ResponseMsgUtil.success("新增成功"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index ed50a6dc..25da943b 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -101,9 +101,9 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "获取用户订单") public ResponseData getOrderList( - @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "phone", required = false) String phone, + @RequestParam(name = "memPhone", required = false) String memPhone, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { @@ -124,12 +124,12 @@ public class HighOrderController { if (userInfoModel.getSecRole().getRoleType() == 3) { map.put("storeId" , userInfoModel.getMerchantStore().getId()); } - map.put("status", status); + map.put("orderStatus", orderStatus); map.put("orderNo", orderNo); - map.put("phone", phone); + map.put("memPhone", memPhone); PageHelper.startPage(pageNum,pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getOrderList(map))); + return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getOrderBList(map))); } catch (Exception e) { log.error("HighOrderController --> getUserOrderList() error!", e); diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index eafe6695..88439353 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -104,6 +104,7 @@ public enum ErrorCode { COUPON_CODE_STATUS("2122","卡券码状态错误"), COUPON_CODE_OVERDUE("2122","卡券码已过期"), COUPON_CODE_NAME("2123","卡券名称已存在"), + AGENT_NAME("2124","代理商名称已存在"), STATUS_ERROR("3000","状态错误"), ADD_DATA_ERROR("3001","增加数据失败"), diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 690ecca4..8bf9ceb0 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -55,11 +55,11 @@ public interface HighOrderMapperExt { " AND company_id = #{map.companyId} ", " AND merchant_id = #{map.merchantId} ", " AND store_id = #{map.storeId} ", - " AND mem_phone = #{map.memName} ", - " AND order_no = #{map.orderNo} ", - " AND pay_model = #{map.payModel} ", - " AND pay_type = #{map.payType} ", - " AND order_status = #{map.orderStatus} ", + " AND mem_phone = #{map.memPhone} ", + " AND order_no = #{map.orderNo} ", + " AND pay_model = #{map.payModel} ", + " AND pay_type = #{map.payType} ", + " AND order_status = #{map.orderStatus} ", " order by create_time desc ", "" }) diff --git a/hai-service/src/main/java/com/hai/service/HighAgentService.java b/hai-service/src/main/java/com/hai/service/HighAgentService.java index d7970240..6e1f7dc1 100644 --- a/hai-service/src/main/java/com/hai/service/HighAgentService.java +++ b/hai-service/src/main/java/com/hai/service/HighAgentService.java @@ -32,12 +32,23 @@ public interface HighAgentService { * @Description: 查询代理商信息详情 * @Date: 2021/03/09 10:23 * @author: Sum1Dream - * @param: agentMsgId 代理商信息id + * @param: agentId 代理商信息id * @return: HighUser */ - HighAgent findByAgentMsgId(Long agentMsgId); + HighAgent findByAgentMsgId(Long agentId); + /** + * + * @Title: findByAgentName + * @Description: 查询代理商名称查询详情 + * @Date: 2021/03/09 10:23 + * @author: Sum1Dream + * @param: agentName 代理商名称 + * @return: HighUser + */ + Boolean findByAgentName(String agentName); + /** * * @Title: updateUser diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 79d4606c..32f490df 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -70,12 +70,19 @@ public interface HighOrderService { **/ HighOrder getOrderByOrderNo(String orderNo); + /** + * @Author 袁野 + * @Description 查询订单列表 + * @Date 2021/3/26 23:06 + **/ + List getOrderBList(Map map); + /** * @Author 胡锐 * @Description 查询订单列表 * @Date 2021/3/26 23:06 **/ - List getOrderList(Map map); + List getOrderList(Map map); /** * @Author 胡锐 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighAgentServiceImpl.java index 226d8212..d5d32cb0 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighAgentServiceImpl.java @@ -44,12 +44,22 @@ public class HighAgentServiceImpl implements HighAgentService { } @Override - public void updateAgentMsg(HighAgent highAgent) { + public Boolean findByAgentName(String agentName) { + HighAgentExample example = new HighAgentExample(); + HighAgentExample.Criteria criteria = example.createCriteria(); + criteria.andAgentNameEqualTo(agentName); + + return highAgentMapper.selectByExample(example).size() == 0; } @Override - public void insertAgentMsg(HighAgent highAgent) { + public void updateAgentMsg(HighAgent highAgent) { + highAgentMapper.updateByPrimaryKey(highAgent); + } + @Override + public void insertAgentMsg(HighAgent highAgent) { + highAgentMapper.insert(highAgent); } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java index e5f66a64..bec7c23e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java @@ -17,7 +17,6 @@ import com.hai.service.HighMerchantStoreService; import com.hai.service.SecUserService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; -import org.gavaghan.geodesy.GeodeticCalculator; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -30,7 +29,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static com.hai.common.utils.CoordCommonUtil.getDistance; @Service("highMerchantStoreService") public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index be849613..6c3360e8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -259,11 +259,32 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override - public List getOrderList(Map map) { + public List getOrderBList(Map map) { return highOrderMapperExt.selectOrderDataList(map); } + @Override + public List getOrderList(Map map) { + HighOrderExample example = new HighOrderExample(); + HighOrderExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "memId") != null) { + criteria.andMemIdEqualTo(MapUtils.getLong(map, "memId")); + } + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andOrderStatusEqualTo(MapUtils.getInteger(map, "status")); + } + + if (MapUtils.getString(map, "orderNo") != null) { + criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); + } + + example.setOrderByClause("create_time desc"); + return highOrderMapper.selectByExample(example); + } + @Override public List getCloseOrder() { return highOrderMapperExt.getCloseOrder();