Merge remote-tracking branch 'origin/在线访问lhj' into 在线访问lhj

在线访问lhj
李宏杰 8 months ago
commit b7192d6aad

@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.DateUtils;
@ -29,21 +28,51 @@ import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.member.service.IMemberService;
import com.tamguo.utils.ShiroUtils;
/**
* AccountController
*/
@Controller
public class AccountController {
/**
*
*/
@Value("${file.storage.path}")
String fileStoragePath;
/**
*
*/
@Value("${tamguo.domain.name}")
String tamguoDomainName;
/**
*
*/
@Autowired
IMemberService iMemberService;
/**
*
*/
@Autowired
CacheService cacheService;
/**
*
*/
private static final String AVATOR_NO_FORMAT = "00000";
/**
*
*/
private static final String AVATOR_PREFIX = "MTX";
/**
* "account.html"
* @param model
* @return
*/
@RequestMapping(value = {"account.html"}, method = RequestMethod.GET)
public ModelAndView list(ModelAndView model) {
model.setViewName("account");
@ -51,15 +80,26 @@ public class AccountController {
return model;
}
/**
*
* @return
*/
@RequestMapping(value = {"getCurrentMember"}, method = RequestMethod.GET)
@ResponseBody
public Result getCurrentMember() {
return Result.result(0, iMemberService.findByUid(ShiroUtils.getMemberId()), "success");
}
/**
*
* @param file
* @param request HTTP
* @return
* @throws IOException
*/
@RequestMapping(value = "uploadFile", method = RequestMethod.POST)
@ResponseBody
public UploaderMessage uploadFileHandler(@RequestParam("file") MultipartFile file,HttpServletRequest request) throws IOException {
public UploaderMessage uploadFileHandler(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws IOException {
if (!file.isEmpty()) {
InputStream in = null;
@ -93,12 +133,12 @@ public class AccountController {
msg.setError("File upload file");
return msg;
} finally {
if (out != null) {
if (out!= null) {
out.close();
out = null;
}
if (in != null) {
if (in!= null) {
in.close();
in = null;
}
@ -111,6 +151,10 @@ public class AccountController {
}
}
/**
*
* @return
*/
private String getAvatorNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
String format = sdf.format(new Date());

Loading…
Cancel
Save