|
|
@@ -15,6 +15,7 @@ import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
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.RestController;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.goafanti.achievement.bo.InputAchievement;
|
|
|
@@ -38,6 +39,9 @@ import com.goafanti.common.model.MessageProducer;
|
|
|
import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.service.FieldGlossoryService;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
+import com.goafanti.common.utils.PasswordUtil;
|
|
|
+import com.goafanti.common.utils.TimeUtils;
|
|
|
+import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.demand.bo.InputDemand;
|
|
|
import com.goafanti.demand.service.DemandService;
|
|
|
@@ -79,6 +83,10 @@ public class AppUserController extends BaseApiController {
|
|
|
AchievementInterestService achievementInterestService;
|
|
|
@Resource
|
|
|
private FieldGlossoryService fieldGlossoryService;
|
|
|
+ @Resource
|
|
|
+ private UserService userService;
|
|
|
+ @Resource(name = "passwordUtil")
|
|
|
+ private PasswordUtil passwordUtil;
|
|
|
|
|
|
@RequestMapping(value = "/uploadImg",method = RequestMethod.POST)
|
|
|
public Result uploadAvatar(HttpServletRequest req){
|
|
|
@@ -130,10 +138,10 @@ public class AppUserController extends BaseApiController {
|
|
|
@RequestMapping(value = "/listMessage", method = RequestMethod.POST)
|
|
|
public Result listMessage(Integer subject,Integer sourceType,Integer pageNo,Integer pageSize){
|
|
|
Result res = new Result();
|
|
|
- if(null == subject){
|
|
|
+ /*if(null == subject){
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "必须指定消息类型"));
|
|
|
return res;
|
|
|
- }
|
|
|
+ }*/
|
|
|
User u = TokenManager.getUserToken();
|
|
|
if(u != null){
|
|
|
List<MessageBo> boList = messageService.selectSyncMessage(u.getId());
|
|
|
@@ -163,6 +171,8 @@ public class AppUserController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 同步绑定账号
|
|
|
* @param uuid
|
|
|
@@ -548,4 +558,35 @@ public class AppUserController extends BaseApiController {
|
|
|
return res().error(buildError("user only", "必须是登录会员才能访问。"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Result resetPassword(String userName,String newPwd,String pwd) {
|
|
|
+ Result res=new Result();
|
|
|
+ if(null == TokenManager.getSession().getAttribute(VerifyCodeUtils.RESET_CODE)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.RESET_CODE_OVERTIME, "", "页面超时失效,请重新获取!"));
|
|
|
+ cleanCodeSession();
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(newPwd)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新密码"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(userName)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户名"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ User user=userService.selectByNameAndType(userName, null);
|
|
|
+ user.setPassword(newPwd);
|
|
|
+ user.setPassword(passwordUtil.getEncryptPwd(user));
|
|
|
+ userService.updateByPrimaryKeySelective(user);
|
|
|
+ return res;
|
|
|
+
|
|
|
+ }
|
|
|
+ private void cleanCodeSession() {
|
|
|
+ VerifyCodeUtils.clearResetCode();
|
|
|
+ VerifyCodeUtils.clearResetCodeTime();
|
|
|
+ VerifyCodeUtils.clearMobileCode();
|
|
|
+ VerifyCodeUtils.clearMobileCodeTime();
|
|
|
+ }
|
|
|
}
|