diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java index 6141bdae..a389163c 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java @@ -62,7 +62,7 @@ public class HighMerchantController { @ApiOperation(value = "增加商户") public ResponseData insertMerchant(@RequestBody HighMerchantModel highMerchant, HttpServletRequest request) { try { - SessionObject sessionObject = userCenter.getSessionObject(request); + SessionObject sessionObject = UserCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); if (userInfoModel.getBsCompany() == null) { log.error("HighMerchantController -> updateMerchant() error!","该主角色没有权限"); @@ -113,7 +113,7 @@ public class HighMerchantController { @ApiOperation(value = "修改商户") public ResponseData updateMerchant(@RequestBody HighMerchantModel highMerchant, HttpServletRequest request) { try { - SessionObject sessionObject = userCenter.getSessionObject(request); + SessionObject sessionObject = UserCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); if (userInfoModel.getBsCompany() == null) { log.error("HighMerchantController -> updateMerchant() error!","该主角色没有权限"); @@ -144,7 +144,7 @@ public class HighMerchantController { } // 校验账户手机号 - if (MemberValidateUtil.validatePhone(highMerchant.getSecUser().getTelephone())) { + if (!MemberValidateUtil.validatePhone(highMerchant.getSecUser().getTelephone())) { log.error("BsStudentController --> updateMerchant() error!", "请输入正确的电话号码"); throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, ""); } @@ -226,7 +226,7 @@ public class HighMerchantController { @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { - SessionObject sessionObject = userCenter.getSessionObject(request); + SessionObject sessionObject = UserCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); if (userInfoModel.getBsCompany() == null) { log.error("HighMerchantController -> getMerchantList() error!","权限不足"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java index 4f1f8d7c..fce209f4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java @@ -20,6 +20,7 @@ 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; @@ -45,8 +46,8 @@ public class HighUserController { @RequestParam(value = "name", required = false) String name, @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "status", required = false) Integer status, - @RequestParam(value = "regTimeStart", required = false) Date regTimeStart, - @RequestParam(value = "regTimeEnd", required = false) Date regTimeEnd, + @RequestParam(value = "regTimeStart", required = false) Long regTimeStart, + @RequestParam(value = "regTimeEnd", required = false) Long regTimeEnd, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize ) { @@ -64,10 +65,10 @@ public class HighUserController { map.put("status", Integer.toString(status)); } if (regTimeStart != null) { - map.put("regTimeStart", DateUtil.date2String(regTimeStart,DateUtil.ymd_HM)); + map.put("regTimeStart", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(regTimeStart)); } if (regTimeEnd != null) { - map.put("regTimeEnd", DateUtil.date2String(regTimeEnd,DateUtil.ymd_HM)); + map.put("regTimeEnd", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(regTimeEnd)); } PageHelper.startPage(pageNum, pageSize); @@ -96,7 +97,7 @@ public class HighUserController { @RequestMapping(value = "/forbiddenUser", method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "禁用账号") + @ApiOperation(value = "禁用启用账号") public ResponseData forbiddenUser(@RequestParam(value = "userId" , required = true) Long userId) { try { @@ -107,7 +108,11 @@ public class HighUserController { throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, ""); } - highUser.setStatus(0); + if (highUser.getStatus() == 1) { + highUser.setStatus(0); + } else { + highUser.setStatus(1); + } highUserService.updateUser(highUser); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java index 5374bc4c..22bb778b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java @@ -41,7 +41,7 @@ public class HighMerchantServiceImpl implements HighMerchantService { highMerchant.getSecUser().setPassword(MD5Util.encode(highMerchant.getSecUser().getPassword().getBytes())); highMerchant.getSecUser().setAdminFlag(1); highMerchant.getSecUser().setStatus(1); - highMerchant.getSecUser().setRoleId(2L); + highMerchant.getSecUser().setRoleId(3L); highMerchant.getSecUser().setObjectType(2); highMerchant.getSecUser().setObjectId(highMerchant.getId()); highMerchant.getSecUser().setCreateTime(new Date()); @@ -70,7 +70,7 @@ public class HighMerchantServiceImpl implements HighMerchantService { public void updateStatus(Long id, Integer status) { // 查询商户 HighMerchantModel merchant = getMerchantById(id); - if(merchant != null) { + if(merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); } merchant.setStatus(status); @@ -103,7 +103,7 @@ public class HighMerchantServiceImpl implements HighMerchantService { criteria.andCompanyIdEqualTo(MapUtils.getLongValue(map, "companyId")); } - if (MapUtils.getLong(map, "merchantKey") != null) { + if (StringUtils.isNotBlank(MapUtils.getString(map, "merchantKey"))) { criteria.andMerchantKeyEqualTo(MapUtils.getString(map, "merchantKey")); } 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 ab515393..34d0e27b 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 @@ -42,7 +42,7 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { highMerchantStore.getSecUser().setPassword(MD5Util.encode(highMerchantStore.getSecUser().getPassword().getBytes())); highMerchantStore.getSecUser().setAdminFlag(1); highMerchantStore.getSecUser().setStatus(1); - highMerchantStore.getSecUser().setRoleId(3L); + highMerchantStore.getSecUser().setRoleId(4L); highMerchantStore.getSecUser().setObjectType(3); highMerchantStore.getSecUser().setObjectId(highMerchantStore.getId()); highMerchantStore.getSecUser().setCreateTime(new Date()); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index a696c931..bdc2d3cf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -28,7 +28,7 @@ public class HighUserServiceImpl implements HighUserService { HighUserExample.Criteria criteria = example.createCriteria(); if (StringUtils.isNotBlank(map.get("phone"))) { - criteria.andPhoneEqualTo(map.get("phone")); + criteria.andPhoneLike("%" + map.get("phone") + "%"); } if (StringUtils.isNotBlank(map.get("name"))) { criteria.andNameLike("%" + map.get("name") + "%");