mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 12:32:09 +08:00
FileUpload&UserInfo&Accounts
This commit is contained in:
@@ -71,6 +71,8 @@ public class Accounts extends JpaBaseEntity implements Serializable {
|
|||||||
@Column
|
@Column
|
||||||
private String strategyId;
|
private String strategyId;
|
||||||
@Column
|
@Column
|
||||||
|
private String strategyName;
|
||||||
|
@Column
|
||||||
private int status;
|
private int status;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@@ -214,7 +216,15 @@ public class Accounts extends JpaBaseEntity implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstId() {
|
public String getStrategyName() {
|
||||||
|
return strategyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrategyName(String strategyName) {
|
||||||
|
this.strategyName = strategyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstId() {
|
||||||
return instId;
|
return instId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
122
maxkey-core/src/main/java/org/maxkey/entity/FileUpload.java
Normal file
122
maxkey-core/src/main/java/org/maxkey/entity/FileUpload.java
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
package org.maxkey.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "MXK_FILE_UPLOAD")
|
||||||
|
public class FileUpload extends JpaBaseEntity {
|
||||||
|
private static final long serialVersionUID = -4338400992411166457L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||||
|
String id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
byte[] uploaded;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
MultipartFile uploadFile;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
String fileName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
String contentType;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
long contentSize;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
String createdBy;
|
||||||
|
|
||||||
|
String createdDate;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getUploaded() {
|
||||||
|
return uploaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploaded(byte[] uploaded) {
|
||||||
|
this.uploaded = uploaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultipartFile getUploadFile() {
|
||||||
|
return uploadFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploadFile(MultipartFile uploadFile) {
|
||||||
|
this.uploadFile = uploadFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileName(String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentType() {
|
||||||
|
return contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentType(String contentType) {
|
||||||
|
this.contentType = contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getContentSize() {
|
||||||
|
return contentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentSize(long contentSize) {
|
||||||
|
this.contentSize = contentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(String createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedDate() {
|
||||||
|
return createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedDate(String createdDate) {
|
||||||
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("FileUpload [id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append(", uploadFile=");
|
||||||
|
builder.append(uploadFile);
|
||||||
|
builder.append(", createdBy=");
|
||||||
|
builder.append(this.createdBy);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
package org.maxkey.entity;
|
package org.maxkey.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,7 +30,6 @@ import javax.persistence.Id;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||||
import org.maxkey.util.StringUtils;
|
import org.maxkey.util.StringUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* .
|
* .
|
||||||
@@ -110,8 +108,7 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
@Column
|
@Column
|
||||||
protected byte[] picture;
|
protected byte[] picture;
|
||||||
protected String pictureBase64;
|
protected String pictureBase64;
|
||||||
@JsonIgnore
|
protected String pictureId;
|
||||||
protected MultipartFile pictureFile;
|
|
||||||
@Column
|
@Column
|
||||||
protected int idType;
|
protected int idType;
|
||||||
@Column
|
@Column
|
||||||
@@ -413,16 +410,6 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getPicture() {
|
|
||||||
if (pictureFile != null && !pictureFile.isEmpty()) {
|
|
||||||
try {
|
|
||||||
picture = pictureFile.getBytes();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPictureBase64() {
|
public String getPictureBase64() {
|
||||||
return pictureBase64;
|
return pictureBase64;
|
||||||
@@ -439,6 +426,10 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] getPicture() {
|
||||||
|
return picture;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the protectedAppsMap
|
* @return the protectedAppsMap
|
||||||
*/
|
*/
|
||||||
@@ -628,15 +619,15 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
this.birthDate = birthDate;
|
this.birthDate = birthDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultipartFile getPictureFile() {
|
public String getPictureId() {
|
||||||
return pictureFile;
|
return pictureId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPictureFile(MultipartFile pictureFile) {
|
public void setPictureId(String pictureId) {
|
||||||
this.pictureFile = pictureFile;
|
this.pictureId = pictureId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIdType() {
|
public int getIdType() {
|
||||||
return idType;
|
return idType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.maxkey.persistence.mapper;
|
||||||
|
|
||||||
|
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||||
|
import org.maxkey.entity.FileUpload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Crystal.sea
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface FileUploadMapper extends IJpaBaseMapper<FileUpload> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.maxkey.persistence.service;
|
||||||
|
|
||||||
|
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||||
|
import org.maxkey.entity.FileUpload;
|
||||||
|
import org.maxkey.persistence.mapper.FileUploadMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class FileUploadService extends JpaBaseService<FileUpload>{
|
||||||
|
|
||||||
|
public FileUploadService() {
|
||||||
|
super(FileUploadMapper.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.connsec.db.service.BaseService#getMapper()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FileUploadMapper getMapper() {
|
||||||
|
return (FileUploadMapper)super.getMapper();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -212,7 +212,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
|||||||
|
|
||||||
public UserInfo passwordEncoder(UserInfo userInfo) {
|
public UserInfo passwordEncoder(UserInfo userInfo) {
|
||||||
//密码不为空,则需要进行加密处理
|
//密码不为空,则需要进行加密处理
|
||||||
if(userInfo.getPassword()!=null && !userInfo.getPassword().equals("")) {
|
if(!StringUtils.isBlank(userInfo.getPassword())) {
|
||||||
String password = passwordEncoder.encode(userInfo.getPassword());
|
String password = passwordEncoder.encode(userInfo.getPassword());
|
||||||
userInfo.setDecipherable(PasswordReciprocal.getInstance().encode(userInfo.getPassword()));
|
userInfo.setDecipherable(PasswordReciprocal.getInstance().encode(userInfo.getPassword()));
|
||||||
_logger.debug("decipherable : "+userInfo.getDecipherable());
|
_logger.debug("decipherable : "+userInfo.getDecipherable());
|
||||||
@@ -220,6 +220,9 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
|||||||
userInfo.setPasswordLastSetTime(DateUtils.getCurrentDateTimeAsString());
|
userInfo.setPasswordLastSetTime(DateUtils.getCurrentDateTimeAsString());
|
||||||
|
|
||||||
userInfo.setModifiedDate(DateUtils.getCurrentDateTimeAsString());
|
userInfo.setModifiedDate(DateUtils.getCurrentDateTimeAsString());
|
||||||
|
}else {
|
||||||
|
userInfo.setPassword(null);
|
||||||
|
userInfo.setDecipherable(null);
|
||||||
}
|
}
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ public class MaxKeyMgtMvcConfig implements WebMvcConfigurer {
|
|||||||
.addPathPatterns("/apps/**")
|
.addPathPatterns("/apps/**")
|
||||||
.addPathPatterns("/accounts/**")
|
.addPathPatterns("/accounts/**")
|
||||||
|
|
||||||
|
|
||||||
.addPathPatterns("/access/**")
|
.addPathPatterns("/access/**")
|
||||||
.addPathPatterns("/access/**/**")
|
.addPathPatterns("/access/**/**")
|
||||||
|
|
||||||
@@ -136,6 +137,8 @@ public class MaxKeyMgtMvcConfig implements WebMvcConfigurer {
|
|||||||
.addPathPatterns("/institutions/**")
|
.addPathPatterns("/institutions/**")
|
||||||
.addPathPatterns("/localization/**")
|
.addPathPatterns("/localization/**")
|
||||||
|
|
||||||
|
.addPathPatterns("/file/upload/")
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
_logger.debug("add PermissionAdapter");
|
_logger.debug("add PermissionAdapter");
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class AccountsController {
|
|||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||||
Accounts account=accountsService.get(id);
|
Accounts account=accountsService.get(id);
|
||||||
|
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(account.getRelatedPassword()));
|
||||||
return new Message<Accounts>(account).buildResponse();
|
return new Message<Accounts>(account).buildResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,10 +128,13 @@ public class AccountsController {
|
|||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value = "/generate")
|
@RequestMapping(value = "/generate")
|
||||||
public String generate(@ModelAttribute Accounts account) {
|
public ResponseEntity<?> generate(@ModelAttribute Accounts account) {
|
||||||
AccountsStrategy accountsStrategy = accountsStrategyService.get(account.getStrategyId());
|
AccountsStrategy accountsStrategy = accountsStrategyService.get(account.getStrategyId());
|
||||||
UserInfo userInfo = userInfoService.get(account.getUserId());
|
UserInfo userInfo = userInfoService.get(account.getUserId());
|
||||||
return accountsService.generateAccount(userInfo,accountsStrategy);
|
return new Message<Object>(
|
||||||
|
Message.SUCCESS,
|
||||||
|
(Object)accountsService.generateAccount(userInfo,accountsStrategy)
|
||||||
|
).buildResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.maxkey.web.contorller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.maxkey.authn.annotation.CurrentUser;
|
||||||
|
import org.maxkey.entity.FileUpload;
|
||||||
|
import org.maxkey.entity.Message;
|
||||||
|
import org.maxkey.entity.UserInfo;
|
||||||
|
import org.maxkey.persistence.service.FileUploadService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class FileUploadEndpoint {
|
||||||
|
|
||||||
|
private static Logger _logger = LoggerFactory.getLogger(FileUploadEndpoint.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
FileUploadService fileUploadService;
|
||||||
|
|
||||||
|
@RequestMapping(value={"/file/upload/"})
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<?> upload( HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
@ModelAttribute FileUpload fileUpload,
|
||||||
|
@CurrentUser UserInfo currentUser){
|
||||||
|
_logger.debug("FileUpload");
|
||||||
|
fileUpload.setId(fileUpload.generateId());
|
||||||
|
fileUpload.setContentType(fileUpload.getUploadFile().getContentType());
|
||||||
|
fileUpload.setFileName(fileUpload.getUploadFile().getOriginalFilename());
|
||||||
|
fileUpload.setContentSize(fileUpload.getUploadFile().getSize());
|
||||||
|
fileUpload.setCreatedBy(currentUser.getUsername());
|
||||||
|
/*
|
||||||
|
* upload UploadFile MultipartFile to Uploaded Bytes
|
||||||
|
*/
|
||||||
|
if(null!=fileUpload.getUploadFile()&&!fileUpload.getUploadFile().isEmpty()){
|
||||||
|
try {
|
||||||
|
fileUpload.setUploaded(fileUpload.getUploadFile().getBytes());
|
||||||
|
fileUploadService.insert(fileUpload);
|
||||||
|
_logger.trace("FileUpload SUCCESS");
|
||||||
|
} catch (IOException e) {
|
||||||
|
_logger.error("FileUpload IOException",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Message<Object>(Message.SUCCESS,(Object)fileUpload.getId()).buildResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ import org.maxkey.constants.ConstsPasswordSetType;
|
|||||||
import org.maxkey.entity.ExcelImport;
|
import org.maxkey.entity.ExcelImport;
|
||||||
import org.maxkey.entity.Message;
|
import org.maxkey.entity.Message;
|
||||||
import org.maxkey.entity.UserInfo;
|
import org.maxkey.entity.UserInfo;
|
||||||
|
import org.maxkey.persistence.service.FileUploadService;
|
||||||
import org.maxkey.persistence.service.UserInfoService;
|
import org.maxkey.persistence.service.UserInfoService;
|
||||||
import org.maxkey.util.DateUtils;
|
import org.maxkey.util.DateUtils;
|
||||||
import org.maxkey.util.ExcelUtils;
|
import org.maxkey.util.ExcelUtils;
|
||||||
@@ -73,6 +74,9 @@ public class UserInfoController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
FileUploadService fileUploadService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@@ -101,6 +105,8 @@ public class UserInfoController {
|
|||||||
if(userInfo.getPicture()!=null){
|
if(userInfo.getPicture()!=null){
|
||||||
userInfo.transPictureBase64();
|
userInfo.transPictureBase64();
|
||||||
}
|
}
|
||||||
|
userInfo.setPassword("");
|
||||||
|
userInfo.setDecipherable("");
|
||||||
return new Message<UserInfo>(userInfo).buildResponse();
|
return new Message<UserInfo>(userInfo).buildResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +116,10 @@ public class UserInfoController {
|
|||||||
_logger.debug("-Add :" + userInfo);
|
_logger.debug("-Add :" + userInfo);
|
||||||
userInfo.setId(WebContext.genId());
|
userInfo.setId(WebContext.genId());
|
||||||
userInfo.setInstId(currentUser.getInstId());
|
userInfo.setInstId(currentUser.getInstId());
|
||||||
|
if(StringUtils.isNotBlank(userInfo.getPictureId())) {
|
||||||
|
userInfo.setPicture(fileUploadService.get(userInfo.getPictureId()).getUploaded());
|
||||||
|
fileUploadService.remove(userInfo.getPictureId());
|
||||||
|
}
|
||||||
if (userInfoService.insert(userInfo)) {
|
if (userInfoService.insert(userInfo)) {
|
||||||
return new Message<UserInfo>(Message.SUCCESS).buildResponse();
|
return new Message<UserInfo>(Message.SUCCESS).buildResponse();
|
||||||
} else {
|
} else {
|
||||||
@@ -128,6 +138,10 @@ public class UserInfoController {
|
|||||||
convertExtraAttribute(userInfo) ;
|
convertExtraAttribute(userInfo) ;
|
||||||
_logger.info(userInfo.getExtraAttribute());
|
_logger.info(userInfo.getExtraAttribute());
|
||||||
userInfo.setInstId(currentUser.getInstId());
|
userInfo.setInstId(currentUser.getInstId());
|
||||||
|
if(StringUtils.isNotBlank(userInfo.getPictureId())) {
|
||||||
|
userInfo.setPicture(fileUploadService.get(userInfo.getPictureId()).getUploaded());
|
||||||
|
fileUploadService.remove(userInfo.getPictureId());
|
||||||
|
}
|
||||||
if (userInfoService.update(userInfo)) {
|
if (userInfoService.update(userInfo)) {
|
||||||
return new Message<UserInfo>(Message.SUCCESS).buildResponse();
|
return new Message<UserInfo>(Message.SUCCESS).buildResponse();
|
||||||
} else {
|
} else {
|
||||||
@@ -148,9 +162,12 @@ public class UserInfoController {
|
|||||||
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value = "/randomPassword")
|
@RequestMapping(value = "/randomPassword", produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public String randomPassword() {
|
public ResponseEntity<?> randomPassword() {
|
||||||
return userInfoService.randomPassword();
|
return new Message<Object>(
|
||||||
|
Message.SUCCESS,
|
||||||
|
(Object)userInfoService.randomPassword()
|
||||||
|
).buildResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -169,7 +186,7 @@ public class UserInfoController {
|
|||||||
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value="/changePassword")
|
@RequestMapping(value="/changePassword", produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public ResponseEntity<?> changePassword( @ModelAttribute("userInfo")UserInfo userInfo) {
|
public ResponseEntity<?> changePassword( @ModelAttribute("userInfo")UserInfo userInfo) {
|
||||||
_logger.debug(userInfo.getId());
|
_logger.debug(userInfo.getId());
|
||||||
userInfo.setPasswordSetType(ConstsPasswordSetType.PASSWORD_NORMAL);
|
userInfo.setPasswordSetType(ConstsPasswordSetType.PASSWORD_NORMAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user