From c1b462af63ae1d293bf967d3c3da07d9348f8e76 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 05 Aug 2021 15:18:51 +0800
Subject: [PATCH] add /distrib/shareMoments
---
gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java | 108 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 80 insertions(+), 28 deletions(-)
diff --git a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java
index da31405..6afbb57 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java
@@ -1,7 +1,9 @@
package com.xzx.gc.user.controller;
+import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.xzx.gc.common.constant.CommonEnum;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.dto.log.OperationAppLog;
@@ -52,6 +54,43 @@
@Autowired
private UserHeadRelateMapper userHeadRelateMapper;
+
+ /**
+ * 查看积分运行设置详情
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/distrib/scoreSetting.json")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = ViewScoreSettingVo.class)})
+ @ApiOperation(value="运营管理-查看积分运行设置详情", notes="test: 仅0有正确返回")
+ public JsonResult<ViewScoreSettingVo> viewScoreSetting(@RequestBody ViewScoreSettingDto viewScoreSettingDto) {
+ ViewScoreSettingVo viewScoreSettingVo = distribService.viewScoreSetting("积分运行设置");
+ return JsonResult.success(viewScoreSettingVo);
+ }
+
+ /**
+ * 更新积分运行设置
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/distrib/updateScoreSetting.json")
+ @ApiOperation(value="运营管理--更新积分运行设置", notes="test: 仅0有正确返回")
+ public JsonResult updateScoreSetting(@RequestBody UpdateScoreSetting model, HttpServletRequest request) {
+
+ RedPaperRule redPaperRule = redPaperRuleMapper.selectByRuleName("积分运行设置");
+ if(ObjectUtil.isEmpty(redPaperRule)){
+ distribService.addScoreSetting(model);
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.USER_MODUL_NAME).operateAction("运营管理--新增积分运行设置").build();
+ mqUtil.sendApp(build);
+ }else{
+ Integer id = model.getId();
+ if(redPaperRule.getId() != id){
+ return JsonResult.failMessage("规则不存在!");
+ }
+ distribService.updateScoreSetting(model);
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.USER_MODUL_NAME).operateAction("运营管理--更新积分运行设置-" + model.getId()).build();
+ mqUtil.sendApp(build);
+ }
+ return JsonResult.success("操作成功!");
+ }
/**
* 查看分銷系統设置详情
@@ -106,33 +145,46 @@
@ApiOperation(value="分銷系統管理--新增团长", notes="test: 仅0有正确返回")
public JsonResult adddistrib(@RequestBody AdddistribDto model, HttpServletRequest request) {
String id = model.getId();
- AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id);
- if(ObjectUtil.isEmpty(accountInfo)){
- return JsonResult.failMessage("账户不存在!");
+ List<String> ids = StrUtil.split(id, ',');
+// AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id);
+ List<AccountInfo> accountInfos = accountMapper.selectAccountInfoByIds(ids);
+ if (CollUtil.isNotEmpty(accountInfos)) {
+ for (AccountInfo accountInfo : accountInfos) {
+// if(ObjectUtil.isEmpty(accountInfo)){
+// return JsonResult.failMessage("账户不存在!");
+// }
+ if(ObjectUtil.isEmpty(accountInfo.getIsHead())
+ || accountInfo.getIsHead() == 1){
+ return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能重复添加!");
+ }
+ if(ObjectUtil.isEmpty(accountInfo.getDelFlag())
+ || accountInfo.getDelFlag() == 1){
+ return JsonResult.failMessage(accountInfo.getAccountName() + "账户已删除!");
+ }
+ if(ObjectUtil.isEmpty(accountInfo.getIsProhibit())
+ || "1".equals(accountInfo.getIsProhibit())){
+ return JsonResult.failMessage(accountInfo.getAccountName() + "账户已冻结!");
+ }
+ //团员不能当团长
+ String userId = accountInfo.getUserId();
+ UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId);
+ if(ObjectUtil.isNotEmpty(userHeadRelate)){
+ return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能申请成为团长!");
+ }
+// distribService.adddistrib(accountInfo.getAccountId());
+
+ accountInfo.setIsHead(1);
+ accountMapper.updateByPrimaryKey(accountInfo);
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build();
+ mqUtil.sendApp(build);
+ }
+
+ return JsonResult.success("操作成功!");
+ } else {
+ return JsonResult.failMessage("参数错误");
}
- if(ObjectUtil.isEmpty(accountInfo.getIsHead())
- || accountInfo.getIsHead() == 1){
- return JsonResult.failMessage("账户不能重复添加!");
- }
- if(ObjectUtil.isEmpty(accountInfo.getDelFlag())
- || accountInfo.getDelFlag() == 1){
- return JsonResult.failMessage("账户已删除!");
- }
- if(ObjectUtil.isEmpty(accountInfo.getIsProhibit())
- || accountInfo.getIsProhibit() == "1"){
- return JsonResult.failMessage("账户已冻结!");
- }
- //团员不能当团长
- String userId = accountInfo.getUserId();
- UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId);
- if(ObjectUtil.isNotEmpty(userHeadRelate)){
- return JsonResult.failMessage("账户不能申请成为团长!");
- }
- distribService.adddistrib(model);
- OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
- .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build();
- mqUtil.sendApp(build);
- return JsonResult.success("操作成功!");
+
}
@ApiOperation(value = "团长列表")
@@ -214,13 +266,13 @@
return JsonResult.success(distribService.distribDataList(distribDataListDto));
}
- @ApiOperation(value = "团长数据--列表导出")
+ @ApiOperation(value = "团长数据--列表导出",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/distrib/distribDataExport.json")
public void distribDataExport(@RequestBody ExportDistribDataListDto distribDataListDto, HttpServletRequest request, HttpServletResponse response) {
List<List<String>> rows = new ArrayList<>();
List<String> header=new ArrayList<>();
//标题
- header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计收益积分", "累计收益(元)", "累计订单重量(kg)","累计数量(家电)");
+ header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计积分收益", "累计环保币收益", "累计订单重量(kg)","累计订单数量(家电)");
rows.add(header);
Map<String, Object> stringObjectMap = distribService.distribDataExport(distribDataListDto);
List<DistribDataListVo> distribDataListVos = (List<DistribDataListVo>) stringObjectMap.get("data");
--
Gitblit v1.9.1