From ed38148fe7089cb2fb76341c8e899652ec425186 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 30 Mar 2021 23:29:37 +0800 Subject: [PATCH] 1 --- .../bweb/controller/BsCompanyController.java | 11 ++-- .../bweb/controller/HighCouponController.java | 2 + .../cweb/controller/HighUserController.java | 58 +++++++++++++++++++ 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 hai-cweb/src/main/java/com/cweb/controller/HighUserController.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java index 22857901..76c66d5f 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java @@ -198,11 +198,7 @@ public class BsCompanyController { } UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - // 校验该区域是否存在公司 - if (bsCompanyService.selectCompanyByRegion(secCompanyModel.getCompany().getRegionId()) != null) { - log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域分公司已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); - } + // 校验公司名称 BsCompany secCompany = bsCompanyService.selectCompanyByName(company.getName()); @@ -210,6 +206,11 @@ public class BsCompanyController { log.error("BsCompanyController --> updateCompany() error!", "该单位已经存在"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_NAME_IS_EXIST_ERROR, ""); } + // 校验该区域是否存在公司 + if (bsCompanyService.selectCompanyByRegion(secCompanyModel.getCompany().getRegionId()) != null && !secCompany.getId().equals(company.getId())) { + log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域分公司已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); + } BsOrganization organization = bsOrganizationService.findTopByCompany(company.getId()); if (organization == null) { log.error("BsCompanyController --> updateCompany() error!", "未找到该部门信息"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index f8211039..423e5e09 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -371,6 +371,8 @@ public class HighCouponController { map.put("status", status); PageHelper.startPage(pageNum, pageSize); + + return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map))); } catch (Exception e) { log.error("HighCouponController -> getCouponList() error!",e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java new file mode 100644 index 00000000..dfa29ed5 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -0,0 +1,58 @@ +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.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.service.HighUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +/** + * @Auther: 袁野 + * @Description: + * @Date: 2021/3/30 22:50 + */ +@Controller +@RequestMapping(value = "/highUser") +@Api(value = "用户接口") +public class HighUserController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighUserService highUserService; + + @RequestMapping(value = "/findUser", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findById( HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + return ResponseMsgUtil.success(highUserService.findByUserId(userInfoModel.getHighUser().getId())); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +}