|
@@ -1,9 +1,8 @@
|
|
|
package com.fuint.module.backendApi.controller;
|
|
|
|
|
|
import com.fuint.common.dto.AccountInfo;
|
|
|
-import com.fuint.common.dto.CommissionRuleDto;
|
|
|
-import com.fuint.common.param.CommissionRuleParam;
|
|
|
-import com.fuint.common.service.CommissionRuleService;
|
|
|
+import com.fuint.common.dto.CommissionLogDto;
|
|
|
+import com.fuint.common.service.CommissionLogService;
|
|
|
import com.fuint.common.service.StoreService;
|
|
|
import com.fuint.common.util.TokenUtil;
|
|
|
import com.fuint.framework.web.BaseController;
|
|
@@ -13,7 +12,7 @@ import com.fuint.common.enums.StatusEnum;
|
|
|
import com.fuint.framework.pagination.PaginationRequest;
|
|
|
import com.fuint.framework.pagination.PaginationResponse;
|
|
|
import com.fuint.framework.exception.BusinessCheckException;
|
|
|
-import com.fuint.repository.model.MtCommissionRule;
|
|
|
+import com.fuint.repository.model.MtCommissionLog;
|
|
|
import com.fuint.repository.model.MtStore;
|
|
|
import com.fuint.utils.StringUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -32,16 +31,16 @@ import java.util.Map;
|
|
|
* Created by FSQ
|
|
|
* CopyRight https://www.fuint.cn
|
|
|
*/
|
|
|
-@Api(tags="管理端-销提成记录相关接口")
|
|
|
+@Api(tags="管理端-分销提成记录相关接口")
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping(value = "/backendApi/commissionLog")
|
|
|
public class BackendCommissionLogController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
- * 分销提成规则服务接口
|
|
|
+ * 分销提成记录业务接口
|
|
|
*/
|
|
|
- private CommissionRuleService commissionRuleService;
|
|
|
+ private CommissionLogService commissionLogService;
|
|
|
|
|
|
/**
|
|
|
* 店铺服务接口
|
|
@@ -49,15 +48,15 @@ public class BackendCommissionLogController extends BaseController {
|
|
|
private StoreService storeService;
|
|
|
|
|
|
/**
|
|
|
- * 规则列表查询
|
|
|
+ * 分销提成记录列表查询
|
|
|
*
|
|
|
- * @param request HttpServletRequest对象
|
|
|
- * @return 规则列表
|
|
|
+ * @param request HttpServletRequest对象
|
|
|
+ * @return 分销提成记录
|
|
|
*/
|
|
|
- @ApiOperation(value = "规则列表查询")
|
|
|
+ @ApiOperation(value = "分销提成记录查询")
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
@CrossOrigin
|
|
|
- @PreAuthorize("@pms.hasPermission('commissionLog:index')")
|
|
|
+ @PreAuthorize("@pms.hasPermission('commission:log:index')")
|
|
|
public ResponseObject list(HttpServletRequest request) throws BusinessCheckException {
|
|
|
String token = request.getHeader("Access-Token");
|
|
|
Integer page = request.getParameter("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(request.getParameter("page"));
|
|
@@ -92,7 +91,7 @@ public class BackendCommissionLogController extends BaseController {
|
|
|
params.put("storeId", storeId);
|
|
|
}
|
|
|
paginationRequest.setSearchParams(params);
|
|
|
- PaginationResponse<MtCommissionRule> paginationResponse = commissionRuleService.queryDataByPagination(paginationRequest);
|
|
|
+ PaginationResponse<MtCommissionLog> paginationResponse = commissionLogService.queryCommissionLogByPagination(paginationRequest);
|
|
|
|
|
|
Map<String, Object> paramsStore = new HashMap<>();
|
|
|
paramsStore.put("status", StatusEnum.ENABLED.getKey());
|
|
@@ -112,86 +111,15 @@ public class BackendCommissionLogController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 更新分销提成规则状态
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "更新分销提成规则状态")
|
|
|
- @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
|
|
|
- @CrossOrigin
|
|
|
- @PreAuthorize("@pms.hasPermission('commissionLog:index')")
|
|
|
- public ResponseObject updateStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- String status = params.get("status") != null ? params.get("status").toString() : StatusEnum.ENABLED.getKey();
|
|
|
- Integer id = params.get("id") == null ? 0 : Integer.parseInt(params.get("id").toString());
|
|
|
-
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- }
|
|
|
-
|
|
|
- CommissionRuleDto commissionRuleDto = commissionRuleService.queryCommissionRuleById(id);
|
|
|
- if (commissionRuleDto == null) {
|
|
|
- return getFailureResult(201);
|
|
|
- }
|
|
|
-
|
|
|
- String operator = accountInfo.getAccountName();
|
|
|
-
|
|
|
- CommissionRuleParam commissionRule = new CommissionRuleParam();
|
|
|
- commissionRule.setOperator(operator);
|
|
|
- commissionRule.setId(id);
|
|
|
- commissionRule.setStatus(status);
|
|
|
- commissionRuleService.updateCommissionRule(commissionRule);
|
|
|
-
|
|
|
- return getSuccessResult(true);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存分销提成规则
|
|
|
- *
|
|
|
- * @param request HttpServletRequest对象
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "保存分销提成规则")
|
|
|
- @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
- @CrossOrigin
|
|
|
- @PreAuthorize("@pms.hasPermission('commissionLog:index')")
|
|
|
- public ResponseObject saveHandler(HttpServletRequest request, @RequestBody CommissionRuleParam params) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- String id = params.getId() == null ? "" : params.getId().toString();
|
|
|
- String name = params.getName() == null ? "" : params.getName();
|
|
|
- String description = params.getDescription() == null ? "" : params.getDescription();
|
|
|
- String status = params.getStatus() == null ? "" : params.getStatus();
|
|
|
-
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- }
|
|
|
-
|
|
|
- MtCommissionRule info = new MtCommissionRule();
|
|
|
- info.setName(name);
|
|
|
- info.setDescription(description);
|
|
|
- info.setOperator(accountInfo.getAccountName());
|
|
|
- info.setStatus(status);
|
|
|
- if (StringUtil.isNotEmpty(id)) {
|
|
|
- info.setId(Integer.parseInt(id));
|
|
|
- commissionRuleService.updateCommissionRule(params);
|
|
|
- } else {
|
|
|
- commissionRuleService.addCommissionRule(params);
|
|
|
- }
|
|
|
- return getSuccessResult(true);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取分销提成规则详情
|
|
|
+ * 获取分销提成记录详情
|
|
|
*
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value = "获取分销提成规则详情")
|
|
|
+ @ApiOperation(value = "获取分销提成记录详情")
|
|
|
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
|
|
@CrossOrigin
|
|
|
- @PreAuthorize("@pms.hasPermission('commissionLog:index')")
|
|
|
+ @PreAuthorize("@pms.hasPermission('commission:log:index')")
|
|
|
public ResponseObject info(HttpServletRequest request, @PathVariable("id") Integer id) throws BusinessCheckException {
|
|
|
String token = request.getHeader("Access-Token");
|
|
|
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
@@ -199,9 +127,9 @@ public class BackendCommissionLogController extends BaseController {
|
|
|
return getFailureResult(1001, "请先登录");
|
|
|
}
|
|
|
|
|
|
- CommissionRuleDto commissionRuleDto = commissionRuleService.queryCommissionRuleById(id);
|
|
|
+ CommissionLogDto commissionLog = commissionLogService.queryCommissionLogById(id);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("commissionRule", commissionRuleDto);
|
|
|
+ result.put("commissionLog", commissionLog);
|
|
|
|
|
|
return getSuccessResult(result);
|
|
|
}
|