| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| @@ -8,10 +9,13 @@ import com.simple.service.WxMerchantBUserService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxMerchantBUser") | |||
| public class WxMerchantBUserController extends BaseController | |||
| @@ -73,12 +77,25 @@ public class WxMerchantBUserController extends BaseController | |||
| } | |||
| @ApiOperation("修改密码") | |||
| @GetMapping("/updatepwd") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pwd",value="密码",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData updatepwd(String phone,String code,String pwd) { | |||
| @PostMapping("/updatepwd") | |||
| public ResultData updatepwd(@RequestBody Map<String,String> params) { | |||
| // String phone,String code,String pwd | |||
| String phone=params.get("phone"); | |||
| String code=params.get("code"); | |||
| String pwd=params.get("pwd"); | |||
| boolean blank = StringUtils.isBlank(phone); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"手机号不能为空"); | |||
| } | |||
| blank = StringUtils.isBlank(code); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"验证码不能为空"); | |||
| } | |||
| blank = StringUtils.isBlank(pwd); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"密码不能为空"); | |||
| } | |||
| return wxMerchantBUserService.updatepwd(phone,code,pwd); | |||
| } | |||
| @@ -3,25 +3,21 @@ package com.simple.controller; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMall; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.service.WxMallService; | |||
| import com.simple.service.WxMerchantBUserService; | |||
| import com.simple.service.WxMerchantService; | |||
| import com.simple.utils.IPUtil; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.service.WxMerchantBUserService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.web.context.request.RequestContextHolder; | |||
| import org.springframework.web.context.request.ServletRequestAttributes; | |||
| @@ -141,11 +137,24 @@ public class WxMerchantBUserController extends BaseController | |||
| @AuthIgnore | |||
| @ApiOperation("修改密码") | |||
| @PostMapping("/updatepwd") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pwd",value="密码",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData updatepwd(String phone,String code,String pwd) { | |||
| public ResultData updatepwd(@RequestBody Map<String,String> params) { | |||
| // String phone,String code,String pwd | |||
| String phone=params.get("phone"); | |||
| String code=params.get("code"); | |||
| String pwd=params.get("pwd"); | |||
| boolean blank = StringUtils.isBlank(phone); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"手机号不能为空"); | |||
| } | |||
| blank = StringUtils.isBlank(code); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"验证码不能为空"); | |||
| } | |||
| blank = StringUtils.isBlank(pwd); | |||
| if(blank){ | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(),"密码不能为空"); | |||
| } | |||
| return wxMerchantBUserService.updatepwd(phone,code,pwd); | |||
| } | |||
| @@ -5,20 +5,26 @@ import java.util.stream.Collectors; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.WxMerchantBUserMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeMapper; | |||
| import com.simple.service.WxMerchantBUserService; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| @Service | |||
| public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| @Autowired | |||
| private Logger logger = Logger.getLogger(WxMerchantBUserServiceImpl.class); | |||
| @Autowired | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @Autowired | |||
| @@ -99,11 +105,15 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| if(list.size()>0){ | |||
| bUser = list.get(0); | |||
| bUser.setBUserPwd(pwd); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser); | |||
| return new ResultData(200,"操作成功"); | |||
| try{ | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser); | |||
| }catch (Exception e){ | |||
| logger.error("db failed: 商户-" + bUser.getId() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(500,"操作失败"); | |||
| return new ResultData(); | |||
| } | |||