From a9f950c0d11a687a7a940443b8c765f6d87ae4f1 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 20 Apr 2021 00:26:22 +0800
Subject: [PATCH] 合并新的修改
---
zq-erp/src/main/java/com/matrix/system/score/action/ScoreRuleSettingAction.java | 284 ++++++++++++++++++++++++++------------------------------
1 files changed, 133 insertions(+), 151 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/score/action/ScoreRuleSettingAction.java b/zq-erp/src/main/java/com/matrix/system/score/action/ScoreRuleSettingAction.java
index 18f6519..25a2ee1 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/action/ScoreRuleSettingAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/action/ScoreRuleSettingAction.java
@@ -1,151 +1,133 @@
-package com.matrix.system.score.action;
-
-import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.core.tools.WebUtil;
-import com.matrix.system.common.bean.BusParameterSettings;
-import com.matrix.system.common.bean.SysUsers;
-import com.matrix.system.common.dao.BusParameterSettingsDao;
-import com.matrix.system.constance.Dictionary;
-import com.matrix.system.hive.action.util.QueryUtil;
-import com.matrix.system.hive.bean.ParameterSettings;
-import com.matrix.system.hive.bean.SysProjUse;
-import com.matrix.system.score.constant.ScoreSettingConstant;
-import com.matrix.system.score.service.ScoreOrderService;
-import com.matrix.system.score.vo.ScoreOrderVo;
-import com.matrix.system.score.vo.ScoreRuleSettingsVo;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import io.swagger.annotations.Api;
-import net.sf.jsqlparser.util.AddAliasesVisitor;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2021-02-22
- **/
-@Api(value = "积分订单", tags = "积分订单")
-@RestController
-@RequestMapping(value = "/score/ruleSetting")
-public class ScoreRuleSettingAction {
-
- @Autowired
- private ScoreOrderService scoreOrderService;
- @Autowired
- private BusParameterSettingsDao busParameterSettingsDao;
-
-
- @GetMapping(value = "/testApi")
- public AjaxResult testApi() {
- scoreOrderService.testMethod();
- return AjaxResult.buildSuccessInstance("success");
- }
-
- /**
- *查询积分规则配置
- */
- @RequestMapping(value = "/selectScoreRule")
- public AjaxResult selectScoreRule() {
-
- AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
- SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
- Long companyId = user.getCompanyId();
-
- //积分有效期
- String[] jfyxqArrayCode={ScoreSettingConstant.VALID_PERIOD_POINTS};
- String[] jfyxqArrayName={"积分有效期:从获得开始 到"};
- List<ScoreRuleSettingsVo> jfyxqRuleSettingsVo = getRuleSettingsVo(jfyxqArrayCode,jfyxqArrayName,companyId);
- result.putInMap("jfyxq", jfyxqRuleSettingsVo);
- //积分抵扣现金
- String[] jfdxjArrayCode={ScoreSettingConstant.CREDIT_POINTS_CASH};
- String[] jfdxjArrayName={"积分抵扣现金"};
- List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(Arrays.asList(jfdxjArrayCode), companyId);
- List<ScoreRuleSettingsVo> jfdxjRuleSettingsVo=new ArrayList<ScoreRuleSettingsVo>();
- int index=0;
- for (BusParameterSettings item:dataList){
- ScoreRuleSettingsVo paramVo=new ScoreRuleSettingsVo();
- BeanUtils.copyProperties(item,paramVo);
- paramVo.setParamName(jfdxjArrayName[index]);
- String paramValue = paramVo.getParamValue();
- if(StrUtil.isNotEmpty(paramValue)) {
- paramVo.setParamSwitch(Boolean.TRUE);
- }else {
- paramVo.setParamSwitch(Boolean.FALSE);
- }
- jfdxjRuleSettingsVo.add(paramVo);
- index++;
- }
- result.putInMap("jfdxj", jfdxjRuleSettingsVo);
- //门店积分规则
- String[] mdjfArrayCode={
- ScoreSettingConstant.CASH_CONSUMPTION,
- ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION,
- ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION,
- ScoreSettingConstant.PRINCIPAL_CONSUMPTION,
- ScoreSettingConstant.GIVE_CONSUMPTION,
- ScoreSettingConstant.REFERRALS_CONSUMPTION};
- String[] mdjfArrayName={
- "现金消费",
- "本金余额消费",
- "赠金余额消费",
- "本金消耗",
- "赠送消耗",
- "转介客户"};
- List<ScoreRuleSettingsVo> mdjfRuleSettingsVo = getRuleSettingsVo(mdjfArrayCode,mdjfArrayName,companyId);
- result.putInMap("mdjf", mdjfRuleSettingsVo);
- //商城积分规则
- String[] scjfArrayCode={
- ScoreSettingConstant.CASH_CONSUMPTION_SHOP,
- ScoreSettingConstant.RESERVATION_SERVICE_SHOP,
- ScoreSettingConstant.EVALUATUIN_ORDER_SHOP,
- ScoreSettingConstant.SIGN_SHOP};
- String[] scjfArrayName={
- "现金消费",
- "预约服务",
- "评价订单",
- "签到"};
- List<ScoreRuleSettingsVo> scjfRuleSettingsVo =getRuleSettingsVo(scjfArrayCode,scjfArrayName,companyId);
- result.putInMap("scjf", scjfRuleSettingsVo);
- return result;
- }
-
- /**
- *获取对应的积分规则设置数据
- * @param ArrayCode
- * @param ArrayName
- * @param companyId
- * @return
- */
- private List<ScoreRuleSettingsVo> getRuleSettingsVo(String[] ArrayCode,String[] ArrayName,Long companyId){
- List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(Arrays.asList(ArrayCode), companyId);
- List<ScoreRuleSettingsVo> scoreRuleSettingsVos=new ArrayList<ScoreRuleSettingsVo>();
- int index=0;
- for (BusParameterSettings item:dataList){
- ScoreRuleSettingsVo paramVo=new ScoreRuleSettingsVo();
- BeanUtils.copyProperties(item,paramVo);
- paramVo.setParamName(ArrayName[index]);
- scoreRuleSettingsVos.add(paramVo);
- index++;
- }
- return scoreRuleSettingsVos;
- }
-
- /**
- * 修改公司维度的积分规则
- */
- @PostMapping(value = "/updateScoreRule")
- public @ResponseBody
- AjaxResult updateScoreRule(@RequestBody List<BusParameterSettings> busParameterSettings) {
- return scoreOrderService.updateScoreRuleByCompanyId(busParameterSettings);
- }
-
-}
+package com.matrix.system.score.action;
+
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.WebUtil;
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.service.ScoreRuleSettingService;
+import com.matrix.system.score.vo.ScoreRuleSettingsVo;
+
+import cn.hutool.core.util.StrUtil;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author wzy
+ * @date 2021-02-22
+ **/
+@RestController
+@RequestMapping(value = "/score/ruleSetting")
+public class ScoreRuleSettingAction {
+
+ @Autowired
+ private ScoreRuleSettingService scoreRuleSettingService;
+ @Autowired
+ private BusParameterSettingsDao busParameterSettingsDao;
+
+
+ /**
+ *查询积分规则配置
+ */
+ @RequestMapping(value = "/selectScoreRule")
+ public AjaxResult selectScoreRule() {
+
+ AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ Long companyId = user.getCompanyId();
+
+ //积分有效期
+ String[] jfyxqArrayCode={ScoreSettingConstant.VALID_PERIOD_POINTS};
+ String[] jfyxqArrayName={"积分有效期:从获得开始 到"};
+ List<ScoreRuleSettingsVo> jfyxqRuleSettingsVo = getRuleSettingsVo(jfyxqArrayCode,jfyxqArrayName,companyId);
+ result.putInMap("jfyxq", jfyxqRuleSettingsVo);
+ //积分抵扣现金
+ String[] jfdxjArrayCode={ScoreSettingConstant.CREDIT_POINTS_CASH};
+ String[] jfdxjArrayName={"积分抵扣现金"};
+ List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(Arrays.asList(jfdxjArrayCode), companyId);
+ List<ScoreRuleSettingsVo> jfdxjRuleSettingsVo=new ArrayList<ScoreRuleSettingsVo>();
+ int index=0;
+ for (BusParameterSettings item:dataList){
+ ScoreRuleSettingsVo paramVo=new ScoreRuleSettingsVo();
+ BeanUtils.copyProperties(item,paramVo);
+ paramVo.setParamName(jfdxjArrayName[index]);
+ String paramValue = paramVo.getParamValue();
+ if(StrUtil.isNotEmpty(paramValue)) {
+ paramVo.setParamSwitch(Boolean.TRUE);
+ }else {
+ paramVo.setParamSwitch(Boolean.FALSE);
+ }
+ jfdxjRuleSettingsVo.add(paramVo);
+ index++;
+ }
+ result.putInMap("jfdxj", jfdxjRuleSettingsVo);
+ //门店积分规则
+ String[] mdjfArrayCode={
+ ScoreSettingConstant.CASH_CONSUMPTION,
+ ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION,
+ ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION,
+ ScoreSettingConstant.PRINCIPAL_CONSUMPTION,
+ ScoreSettingConstant.GIVE_CONSUMPTION,
+ ScoreSettingConstant.REFERRALS_CONSUMPTION};
+ String[] mdjfArrayName={
+ "现金消费",
+ "本金余额消费",
+ "赠金余额消费",
+ "本金消耗",
+ "赠送消耗",
+ "转介客户"};
+ List<ScoreRuleSettingsVo> mdjfRuleSettingsVo = getRuleSettingsVo(mdjfArrayCode,mdjfArrayName,companyId);
+ result.putInMap("mdjf", mdjfRuleSettingsVo);
+ //商城积分规则
+ String[] scjfArrayCode={
+ ScoreSettingConstant.CASH_CONSUMPTION_SHOP,
+ ScoreSettingConstant.RESERVATION_SERVICE_SHOP,
+ ScoreSettingConstant.EVALUATUIN_ORDER_SHOP};
+ String[] scjfArrayName={
+ "现金消费",
+ "预约服务",
+ "评价订单"};
+ List<ScoreRuleSettingsVo> scjfRuleSettingsVo =getRuleSettingsVo(scjfArrayCode,scjfArrayName,companyId);
+ result.putInMap("scjf", scjfRuleSettingsVo);
+ return result;
+ }
+
+ /**
+ *获取对应的积分规则设置数据
+ * @param ArrayCode
+ * @param ArrayName
+ * @param companyId
+ * @return
+ */
+ private List<ScoreRuleSettingsVo> getRuleSettingsVo(String[] ArrayCode,String[] ArrayName,Long companyId){
+ List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(Arrays.asList(ArrayCode), companyId);
+ List<ScoreRuleSettingsVo> scoreRuleSettingsVos=new ArrayList<ScoreRuleSettingsVo>();
+ int index=0;
+ for (BusParameterSettings item:dataList){
+ ScoreRuleSettingsVo paramVo=new ScoreRuleSettingsVo();
+ BeanUtils.copyProperties(item,paramVo);
+ paramVo.setParamName(ArrayName[index]);
+ scoreRuleSettingsVos.add(paramVo);
+ index++;
+ }
+ return scoreRuleSettingsVos;
+ }
+
+ /**
+ * 修改公司维度的积分规则
+ */
+ @PostMapping(value = "/updateScoreRule")
+ public @ResponseBody
+ AjaxResult updateScoreRule(@RequestBody List<BusParameterSettings> busParameterSettings) {
+ return scoreRuleSettingService.updateScoreRuleByCompanyId(busParameterSettings);
+ }
+
+}
--
Gitblit v1.9.1