|
@@ -7,7 +7,6 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.common.config.FSConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
-import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.param.BaseQueryParam;
|
|
|
import com.fs.common.utils.OrderUtils;
|
|
|
import com.fs.store.domain.FsUser;
|
|
@@ -20,16 +19,15 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
import java.awt.*;
|
|
|
import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
@@ -38,6 +36,7 @@ import java.util.List;
|
|
|
@Api("个人中心")
|
|
|
@RestController
|
|
|
@RequestMapping(value="/app/user")
|
|
|
+@Slf4j
|
|
|
public class UserController extends AppBaseController {
|
|
|
|
|
|
@Autowired
|
|
@@ -57,12 +56,12 @@ public class UserController extends AppBaseController {
|
|
|
private IFsUserPromoterApplyService userPromoterApplyService;
|
|
|
/**
|
|
|
* 获取用户信息
|
|
|
- * @param request
|
|
|
- * @return */
|
|
|
+ * @return R
|
|
|
+ * */
|
|
|
@Login
|
|
|
@ApiOperation("获取用户信息")
|
|
|
@GetMapping("/getUserInfo")
|
|
|
- public R getUserInfo(HttpServletRequest request){
|
|
|
+ public R getUserInfo(){
|
|
|
try {
|
|
|
FsUser user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
|
return R.ok().put("user",user);
|
|
@@ -75,14 +74,14 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("检测是否登录")
|
|
|
@GetMapping("/checkLogin")
|
|
|
- public R checkLogin(HttpServletRequest request){
|
|
|
+ public R checkLogin(){
|
|
|
return R.ok("认证成功");
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
@ApiOperation("获取推荐海报")
|
|
|
@GetMapping("/getTuiImg")
|
|
|
- public R getTuiImg(HttpServletRequest request){
|
|
|
+ public R getTuiImg(){
|
|
|
try {
|
|
|
FsUser user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
|
if(StringUtils.isEmpty(user.getUserCode())){
|
|
@@ -94,84 +93,58 @@ public class UserController extends AppBaseController {
|
|
|
}
|
|
|
File newFile = new File("fx.jpg");
|
|
|
File newFileT = new File("simsunb.ttf");
|
|
|
- try {
|
|
|
- InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
- FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
- // if(!newFile.exists()){
|
|
|
- // InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
- // FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
- // }
|
|
|
- if(!newFileT.exists()){
|
|
|
- InputStream streamT = getClass().getClassLoader()
|
|
|
- .getResourceAsStream("simsunb.ttf");
|
|
|
- FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
-
|
|
|
- throw new CustomException(e.getMessage());
|
|
|
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
+ FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
+ if(!newFileT.exists()) {
|
|
|
+ InputStream streamT = getClass().getClassLoader()
|
|
|
+ .getResourceAsStream("simsunb.ttf");
|
|
|
+ FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- String url=fsConfig.getTuiImgPath()+"/tui-"+getUserId()+".jpg";
|
|
|
- File outputFile = new File(url);
|
|
|
- if(!outputFile.exists())
|
|
|
- {
|
|
|
- try {
|
|
|
- outputFile.createNewFile();
|
|
|
-
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT);
|
|
|
- Font f= font.deriveFont(Font.PLAIN,50);
|
|
|
- ImgUtil.pressText(//
|
|
|
- newFile,
|
|
|
- outputFile,
|
|
|
- user.getNickname()+"邀您加入",
|
|
|
- Color.BLACK,
|
|
|
- f, //字体
|
|
|
- -60, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 900, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
- );
|
|
|
- ImgUtil.pressText(//
|
|
|
- outputFile,
|
|
|
- outputFile,
|
|
|
- "邀请码:"+user.getUserCode(),
|
|
|
- Color.BLACK,
|
|
|
- f, //字体
|
|
|
- -40, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 1000, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
- );
|
|
|
- File qr = new File(fsConfig.getTuiImgPath()+"/qr-"+getUserId()+".png");
|
|
|
- if(!qr.exists())
|
|
|
- {
|
|
|
- try {
|
|
|
- qr.createNewFile();
|
|
|
-
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- QrCodeUtil.generate(fsConfig.getUrl()+"/distribution?userCode="+user.getUserCode(), 300, 300,
|
|
|
- FileUtil.file(fsConfig.getTuiImgPath()+"/qr-"+getUserId()+".png"));
|
|
|
- ImgUtil.pressImage(
|
|
|
- outputFile,
|
|
|
- outputFile,
|
|
|
- ImgUtil.read(qr), //QR图片
|
|
|
- -400, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 900, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 1f
|
|
|
- );
|
|
|
- return R.ok().put("url","profile/tui/tui-"+getUserId()+".jpg");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.error("操作异常");
|
|
|
+ String url=fsConfig.getTuiImgPath()+"/tui-"+getUserId()+".jpg";
|
|
|
+ File outputFile = new File(url);
|
|
|
+ if(!outputFile.exists()) {
|
|
|
+ outputFile.createNewFile();
|
|
|
}
|
|
|
+ Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT);
|
|
|
+ Font f= font.deriveFont(Font.PLAIN,50);
|
|
|
+ ImgUtil.pressText(//
|
|
|
+ newFile,
|
|
|
+ outputFile,
|
|
|
+ user.getNickname()+"邀您加入",
|
|
|
+ Color.BLACK,
|
|
|
+ f, //字体
|
|
|
+ -60, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 900, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
+ );
|
|
|
+ ImgUtil.pressText(//
|
|
|
+ outputFile,
|
|
|
+ outputFile,
|
|
|
+ "邀请码:"+user.getUserCode(),
|
|
|
+ Color.BLACK,
|
|
|
+ f, //字体
|
|
|
+ -40, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 1000, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
+ );
|
|
|
+ File qr = new File(fsConfig.getTuiImgPath()+"/qr-"+getUserId()+".png");
|
|
|
+ if(!qr.exists()) {
|
|
|
+ qr.createNewFile();
|
|
|
+ }
|
|
|
+ QrCodeUtil.generate(fsConfig.getUrl()+"/distribution?userCode="+user.getUserCode(), 300, 300,
|
|
|
+ FileUtil.file(fsConfig.getTuiImgPath()+"/qr-"+getUserId()+".png"));
|
|
|
+ ImgUtil.pressImage(
|
|
|
+ outputFile,
|
|
|
+ outputFile,
|
|
|
+ ImgUtil.read(qr), //QR图片
|
|
|
+ -400, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 900, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 1f
|
|
|
+ );
|
|
|
+ return R.ok().put("url","profile/tui/tui-"+getUserId()+".jpg");
|
|
|
} catch (Exception e){
|
|
|
-
|
|
|
+ log.error("获取推荐海报操作异常",e);
|
|
|
return R.error("操作异常");
|
|
|
}
|
|
|
}
|
|
@@ -179,7 +152,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取我的推荐人")
|
|
|
@GetMapping("/getMyTuiList")
|
|
|
- public R getMyTuiList(BaseQueryParam param, HttpServletRequest request){
|
|
|
+ public R getMyTuiList(BaseQueryParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
List<FsUserTuiVO> list= userService.selectFsUserTuiList(getUserId());
|
|
|
PageInfo<FsUserTuiVO> listPageInfo=new PageInfo<>(list);
|
|
@@ -189,7 +162,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取用户金额")
|
|
|
@GetMapping("/getTuiMoney")
|
|
|
- public R getMemberTuiMoney(HttpServletRequest request){
|
|
|
+ public R getMemberTuiMoney(){
|
|
|
try {
|
|
|
FsUser user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
|
BigDecimal yesterdayMoney=userBillService.selectFsUserBillTotalByUserId(getUserId(),"brokerage_price");
|
|
@@ -203,7 +176,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取我的推荐订单")
|
|
|
@GetMapping("/getMyTuiOrderList")
|
|
|
- public R getMyTuiOrderList(BaseQueryParam param, HttpServletRequest request){
|
|
|
+ public R getMyTuiOrderList(BaseQueryParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
List<FsStoreOrderTuiVO> list= orderService.selectFsStoreOrderTuiListVO(getUserId());
|
|
|
PageInfo<FsStoreOrderTuiVO> listPageInfo=new PageInfo<>(list);
|
|
@@ -213,7 +186,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取用户佣金记录")
|
|
|
@GetMapping("/getTuiMoneyLogs")
|
|
|
- public R getTuiMoneyLogs(BaseQueryParam param, HttpServletRequest request){
|
|
|
+ public R getTuiMoneyLogs(BaseQueryParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
FsUserBill map=new FsUserBill();
|
|
|
map.setUserId(Long.parseLong(getUserId()));
|
|
@@ -227,7 +200,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取商品足迹")
|
|
|
@GetMapping("/getProductFoots")
|
|
|
- public R getProductFoots(FsStoreProductRelationQueryParam param, HttpServletRequest request){
|
|
|
+ public R getProductFoots(FsStoreProductRelationQueryParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
List<FsStoreProductRelationQueryVO> list=productRelationService.selectFsStoreProductRelationListVOQuery(param);
|
|
@@ -238,7 +211,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("删除足迹")
|
|
|
@PostMapping("/delProductFoots")
|
|
|
- public R delProductFoots(@RequestBody FsStoreProductFootDelParam param, HttpServletRequest request){
|
|
|
+ public R delProductFoots(@RequestBody FsStoreProductFootDelParam param){
|
|
|
productRelationService.deleteFsStoreProductRelationById(param.getId());
|
|
|
return R.ok("操作成功");
|
|
|
}
|
|
@@ -247,7 +220,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("申请提现")
|
|
|
@PostMapping("/doExtract")
|
|
|
- public R doExtract(@Validated @RequestBody FsUseDoExtractParam param, HttpServletRequest request){
|
|
|
+ public R doExtract(@Validated @RequestBody FsUseDoExtractParam param){
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
return userExtractService.doExtract(param);
|
|
|
}
|
|
@@ -255,7 +228,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取提现记录")
|
|
|
@GetMapping("/getExtractList")
|
|
|
- public R getExtractList(FsUseExtractQueryParam param, HttpServletRequest request){
|
|
|
+ public R getExtractList(FsUseExtractQueryParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
List<FsUserExtractVO> list=userExtractService.selectFsUserExtractListVOQuery(param);
|
|
@@ -266,7 +239,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("修改用户信息")
|
|
|
@PostMapping("/editUser")
|
|
|
- public R editUser(@RequestBody FsUserEditParam param, HttpServletRequest request){
|
|
|
+ public R editUser(@RequestBody FsUserEditParam param){
|
|
|
FsUser user=new FsUser();
|
|
|
user.setUserId(Long.parseLong(getUserId()));
|
|
|
user.setAvatar(param.getAvatar());
|
|
@@ -281,7 +254,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("申请推广员")
|
|
|
@PostMapping("/applyPromoter")
|
|
|
- public R applyPromoter(@RequestBody FsUserPromoterApply param, HttpServletRequest request){
|
|
|
+ public R applyPromoter(@RequestBody FsUserPromoterApply param){
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
|
|
|
FsUserPromoterApply promoterApply=userPromoterApplyService.selectFsUserPromoterApplyByUserId(Long.parseLong(getUserId()));
|
|
@@ -299,7 +272,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("绑定推广员")
|
|
|
@PostMapping("/bindPromoter")
|
|
|
- public R bindPromoter(@RequestBody FsUserBindPromoterParam param, HttpServletRequest request){
|
|
|
+ public R bindPromoter(@RequestBody FsUserBindPromoterParam param){
|
|
|
|
|
|
FsUser user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
|
if(user.getIsPromoter()==null||user.getIsPromoter()==0){
|
|
@@ -325,7 +298,7 @@ public class UserController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取分享用户列表")
|
|
|
@GetMapping("/getUserShareList")
|
|
|
- public R getUserShareList(UserShareListParam param, HttpServletRequest request){
|
|
|
+ public R getUserShareList(UserShareListParam param){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
List<FsUserShareVO> list= userService.selectFsUserShareList(getUserId(),param.getType());
|
|
|
PageInfo<FsUserShareVO> listPageInfo=new PageInfo<>(list);
|