|
@@ -18,6 +18,10 @@ import org.springblade.core.tool.utils.DigestUtil;
|
|
|
import org.springblade.core.tool.utils.WebUtil;
|
|
|
import org.springblade.modules.api.request.AddChildAccountRequest;
|
|
|
import org.springblade.modules.api.request.AlertChildAccountRequest;
|
|
|
+import org.springblade.modules.api.request.TimeRangeReq;
|
|
|
+import org.springblade.modules.api.response.MerchantPieRes;
|
|
|
+import org.springblade.modules.api.response.TurnoverRes;
|
|
|
+import org.springblade.modules.api.utils.TimeRangeReqUtils;
|
|
|
import org.springblade.modules.api.vo.MerchantIncomeVO;
|
|
|
import org.springblade.modules.auth.enums.UserEnum;
|
|
|
import org.springblade.modules.auth.utils.TokenUtil;
|
|
@@ -31,6 +35,7 @@ import org.springframework.util.Assert;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Author pangqijun
|
|
@@ -73,7 +78,7 @@ public class ApiMerchantUserController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/addChildAccount")
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "添加子账号", notes = "传入userMerchant")
|
|
|
public R<Void> addChildAccount(@Valid @RequestBody AddChildAccountRequest request) {
|
|
|
if (!request.getPassword().equals(request.getRePassword())) {
|
|
@@ -107,7 +112,7 @@ public class ApiMerchantUserController {
|
|
|
|
|
|
@Transactional
|
|
|
@PostMapping("/updateChildAccount")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "修改子账号", notes = "alertChildAccountRequest")
|
|
|
public R<Void> deleteChildAccount(@Valid @RequestBody AlertChildAccountRequest request) {
|
|
|
UserMerchantVO userMerchant = iUserMerchantService.getByUserId(request.getId());
|
|
@@ -120,7 +125,7 @@ public class ApiMerchantUserController {
|
|
|
|
|
|
@Transactional
|
|
|
@PostMapping("/deleteChildAccount")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "删除子账号", notes = "传入ids")
|
|
|
public R<Void> deleteChildAccount(@ApiParam(value = "主键集合", required = true) @RequestParam Long childAccountId) {
|
|
|
UserMerchant child = iUserMerchantService.getById(childAccountId);
|
|
@@ -133,7 +138,7 @@ public class ApiMerchantUserController {
|
|
|
* 自定义分页 商家用户表
|
|
|
*/
|
|
|
@GetMapping("/childAccount/list")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "子账号列表", notes = "传入userMerchant")
|
|
|
public R<IPage<UserMerchantVO>> page(UserMerchantVO userMerchant, Query query) {
|
|
|
userMerchant.setParentId(AuthUtil.getUserId());
|
|
@@ -145,11 +150,101 @@ public class ApiMerchantUserController {
|
|
|
* 我的钱包收益记录
|
|
|
*/
|
|
|
@GetMapping("/pageIncome")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "我的钱包收益记录-分页", notes = "我的钱包收益记录-分页")
|
|
|
public R<IPage<MerchantIncomeVO>> pageIncome(Query query) {
|
|
|
IPage<MerchantIncomeVO> pages = iUserMerchantService.pageIncome(Condition.getPage(query), AuthUtil.getUserId());
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 商家端-首页
|
|
|
+ */
|
|
|
+ @PostMapping("/pie")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "商家端-首页-饼图", notes = "商家端-首页-饼图")
|
|
|
+ public R<List<MerchantPieRes>> pie(@Valid @RequestBody TimeRangeReq timeRangeReq) {
|
|
|
+
|
|
|
+ TimeRangeReqUtils.setTimeRangeReq(timeRangeReq);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 数据格式
|
|
|
+ [
|
|
|
+ { value: 0, name: '展现', itemStyle: { color: '#1890ff' } },
|
|
|
+ { value: 0, name: '点击', itemStyle: { color: '#91cb74' } },
|
|
|
+ { value: 0, name: '订单', itemStyle: { color: '#fac858' } },
|
|
|
+ { value: 0, name: '付款', itemStyle: { color: '#ee6666' } },
|
|
|
+ ]
|
|
|
+ * */
|
|
|
+
|
|
|
+ List<MerchantPieRes> result = new ArrayList<>();
|
|
|
+
|
|
|
+ MerchantPieRes reveal = new MerchantPieRes();//展现
|
|
|
+ reveal.setValue("200");
|
|
|
+ reveal.setName("展现");
|
|
|
+ Map<String, String> revealColorMap = new HashMap<>();
|
|
|
+ revealColorMap.put("color", "#1890ff");
|
|
|
+ reveal.setItemStyle(revealColorMap);
|
|
|
+ result.add(reveal);
|
|
|
+
|
|
|
+ MerchantPieRes order = new MerchantPieRes();//订单
|
|
|
+ order.setValue("300");
|
|
|
+ order.setName("点击");
|
|
|
+ Map<String, String> orderColorMap = new HashMap<>();
|
|
|
+ orderColorMap.put("color", "#91cb74");
|
|
|
+ reveal.setItemStyle(orderColorMap);
|
|
|
+ result.add(order);
|
|
|
+
|
|
|
+ MerchantPieRes click = new MerchantPieRes();//订单
|
|
|
+ click.setValue("100");
|
|
|
+ click.setName("订单");
|
|
|
+ Map<String, String> clickColorMap = new HashMap<>();
|
|
|
+ clickColorMap.put("color", "#fac858");
|
|
|
+ reveal.setItemStyle(clickColorMap);
|
|
|
+ result.add(click);
|
|
|
+
|
|
|
+ MerchantPieRes pay = new MerchantPieRes();//付款
|
|
|
+ pay.setValue("100");
|
|
|
+ pay.setName("订单");
|
|
|
+ Map<String, String> payColorMap = new HashMap<>();
|
|
|
+ payColorMap.put("color", "#ee6666");
|
|
|
+ reveal.setItemStyle(payColorMap);
|
|
|
+ result.add(click);
|
|
|
+
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商家端-首页-设备状态
|
|
|
+ */
|
|
|
+ @GetMapping("/survey")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "商家端-首页-设备状态", notes = "商家端-首页-设备状态")
|
|
|
+ public R<Map<String, String>> survey() {
|
|
|
+ //key为名称,value为数量
|
|
|
+ Map<String, String> result = new HashMap<>();
|
|
|
+ result.put("设备数量", "60");
|
|
|
+ result.put("门店数量", "6");
|
|
|
+ result.put("故障设备", "10");
|
|
|
+ result.put("在线设备", "40");
|
|
|
+ result.put("子账号", "6");
|
|
|
+ result.put("订单量", "600");
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商家端-首页-营业额和结算额
|
|
|
+ */
|
|
|
+ @PostMapping("/turnover")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "商家端-首页-营业额和结算额", notes = "商家端-首页-营业额和结算额")
|
|
|
+ public R<TurnoverRes> turnover(@Valid @RequestBody TimeRangeReq timeRangeReq) {
|
|
|
+ TimeRangeReqUtils.setTimeRangeReq(timeRangeReq);
|
|
|
+ //key为名称,value为数量
|
|
|
+ TurnoverRes result = new TurnoverRes();
|
|
|
+ result.setTurnover("6000.00");
|
|
|
+ result.setClearing("5873.16");
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|