parent
b66846f011
commit
4ddc978edf
@ -0,0 +1,86 @@ |
|||||||
|
package com.hfkj.controller; |
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.RedisUtil; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.UserSessionObject; |
||||||
|
import com.hfkj.service.user.BsUserAccountRecordService; |
||||||
|
import com.hfkj.service.user.BsUserAccountService; |
||||||
|
import com.hfkj.service.user.BsUserService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
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 javax.annotation.Resource; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: ClientController |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/userAccount") |
||||||
|
@Api(value="客户端业务") |
||||||
|
public class UserAccountController { |
||||||
|
@Resource |
||||||
|
private BsUserAccountService userAccountService; |
||||||
|
@Resource |
||||||
|
private BsUserAccountRecordService userAccountRecordService; |
||||||
|
@Autowired |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@RequestMapping(value = "/getAccount", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询用户账户信息") |
||||||
|
public ResponseData getAccount() { |
||||||
|
try { |
||||||
|
// 用户session
|
||||||
|
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); |
||||||
|
|
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
// 用户信息
|
||||||
|
param.put("account", userAccountService.getAccount(session.getUser().getId())); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(param); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/getRecordList", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询账户记录") |
||||||
|
public ResponseData getRecordList(@RequestParam(value = "type" , required = false) Integer type, |
||||||
|
@RequestParam(value = "sourceType" , required = false) Integer sourceType, |
||||||
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||||
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||||
|
try { |
||||||
|
// 用户session
|
||||||
|
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); |
||||||
|
|
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
param.put("useId", session.getUser().getId()); |
||||||
|
param.put("type", type); |
||||||
|
param.put("sourceType", sourceType); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum,pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(userAccountRecordService.getList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue