| | |
| | | import com.dsh.guns.modular.system.service.IRoleService; |
| | | import com.dsh.guns.modular.system.service.IUserService; |
| | | import com.dsh.guns.modular.system.transfer.UserDto; |
| | | import com.dsh.guns.modular.system.util.OssUploadUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | if (user.getPassword().equals(oldMd5)) { |
| | | String newMd5 = MD5.md5(newPwd); |
| | | user.setPassword(newMd5); |
| | | user.setPassWordUpdate(new Date()); |
| | | user.updateById(); |
| | | return SUCCESS_TIP; |
| | | } else { |
| | |
| | | User objectUser = UserFactory.createUser(user); |
| | | //查找平台所属公司 |
| | | //Search for the company that owns the platform. |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | this.userService.save(objectUser); |
| | | |
| | | return SUCCESS_TIP; |
| | |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode()); |
| | | |
| | | User user = userService.getById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.OK.getCode()); |
| | | |
| | | User user = userService.getById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 上传图片 |
| | | */ |
| | | @RequestMapping(method = RequestMethod.POST, path = "/upload") |
| | | @RequestMapping(method = RequestMethod.POST, path = "/uploadImg") |
| | | @ResponseBody |
| | | public String upload(@RequestPart("file") MultipartFile picture) { |
| | | |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | public String uploadImg(@RequestPart("file") MultipartFile picture) { |
| | | String pictureName = ""; |
| | | try { |
| | | String fileSavePath = gunsProperties.getFileUploadPath(); |
| | | picture.transferTo(new File(fileSavePath + pictureName)); |
| | | } catch (Exception e) { |
| | | throw new GunsException(BizExceptionEnum.UPLOAD_ERROR); |
| | | pictureName = OssUploadUtil.ossUpload("img/", picture); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return pictureName; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(method = RequestMethod.POST, path = "/uploadFile") |
| | | @ResponseBody |
| | | public String uploadFile(@RequestPart("file") MultipartFile picture) { |
| | | String pictureName = ""; |
| | | try { |
| | | pictureName = OssUploadUtil.ossUpload("video/", picture); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return pictureName; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断当前登录的用户是否有操作这个用户的权限 |
| | | */ |