From 1626acc411e92b8971c482460b6514e881b9f313 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 06 Apr 2021 11:29:41 +0800
Subject: [PATCH] 20210406 新增分销基本设置初始化Test

---
 zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java            |    7 
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html        |  265 +++++++++++++++++++++++++++++++++++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java |   41 +++++
 zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java  |    2 
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html               |    2 
 zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java                                  |   78 +++++++++++
 zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopActivitiesDao.xml                    |    7 +
 7 files changed, 397 insertions(+), 5 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
index 186ffd8..20134c2 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
@@ -1,11 +1,12 @@
 package com.matrix.system.activity.dto;
 
-import java.util.Date;
-import java.util.List;
 import com.matrix.system.activity.entity.ActivitySignAwardSet;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
 
 @Data
 @ApiModel(value = "UpdateSignAwardSetDto", description = "查询参数")
@@ -25,7 +26,7 @@
 	private List<ActivitySignAwardSet> activitySignAwardSets;
 	
 	@ApiModelProperty(value ="活动主表ID")
-	private Long actId;
+	private Long actMainId;
 	
 	@ApiModelProperty(hidden = true)
 	private Long companyId;
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
index 8839bcd..7d34fb6 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
@@ -189,7 +189,7 @@
 		//获取当前登录人员信息
         QueryUtil.setQueryLimitCom(updateSignAwardSetDto);
         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
-        Long actId = updateSignAwardSetDto.getActId();
+        Long actId = updateSignAwardSetDto.getActMainId();
         Long companyId = user.getCompanyId();
         ShopActivities shopActivity = shopActivitiesDao.selectById(actId);
         //更新活动主表信息
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
new file mode 100644
index 0000000..691b3b9
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
@@ -0,0 +1,41 @@
+package com.matrix.system.shopXcx.api.action;
+
+import com.matrix.component.redis.RedisUserLoginUtils;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.shopXcx.dao.ShopActivitiesDao;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "签到活动接口类")
+@RestController
+@RequestMapping(value = "/wxapi/sign")
+public class WxShopActivitiesSignAction {
+	
+	@Autowired
+    private ShopActivitiesDao shopActivitiesDao;
+	
+	@Autowired
+    private RedisUserLoginUtils redisUserLoginUtils;
+	
+	@ApiOperation(value = "获取签到基本信息", notes = "")
+    @GetMapping(value = "/getSignBasicInfo")
+    public AjaxResult getSignBasicInfo() {
+		//获取登录人信息
+		SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
+		Long companyId = loginUser.getCompanyId();
+		
+//		shopActivitiesDao.selectOneByCompanyIdAndActTypeAndActStatus();
+		
+		
+		
+//        BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_PLAN, HostInterceptor.getCompanyId());
+        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+//        ajaxResult.setData(busParameterSettings.getParamValue3());
+        return ajaxResult;
+    }
+}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopActivitiesDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopActivitiesDao.xml
index 716911e..4c51ce9 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopActivitiesDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopActivitiesDao.xml
@@ -213,6 +213,13 @@
 			<if test="record.actName != null and record.actName != '' ">
 				act_name  = #{record.actName},
 			</if>
+			<if test="record.actCode != null ">
+				act_code  = #{record.actCode},
+			</if>
+
+			<if test="record.actContent != null ">
+				act_content  = #{record.actContent},
+			</if>
 			<if test="record.actType != null ">
 				act_type  = #{record.actType}, 
 			</if>
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html
index 627bf29..5b1320e 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html
@@ -302,6 +302,67 @@
                                                         </el-button>
                                                     </el-col>
                                                 </el-row>
+
+                                                <el-drawer
+                                                        title="选择商城优惠券"
+                                                        :visible.sync="drawerCoupon"
+                                                        :direction="directionCoupon"
+                                                        size="90%">
+                                                    <el-row style="margin-left: 50px;">
+                                                        <el-col :span="24">
+                                                            <el-row>
+                                                                <el-form ref="formCoupon" :model="formCoupon" inline >
+                                                                    <el-form-item prop="yhjmc">
+                                                                        <el-input v-model="formCoupon.yhjmc" placeholder="请输入优惠券名称"></el-input>
+                                                                    </el-form-item>
+                                                                    <el-button type="primary" @click="searchFormCoupon" >搜索</el-button>
+                                                                    <el-button @click="resetFormCoupon('formCoupon')">重置</el-button>
+                                                                </el-form>
+                                                            </el-row>
+
+                                                            <el-row class="table-style" >
+                                                                <el-table ref="multipleTable"
+                                                                          :data="couponList.rows"
+                                                                          :height="tableHeightCoupon"
+                                                                          stripe:true
+                                                                          style="width: 100%">
+                                                                    <el-table-column
+                                                                            prop="cname"
+                                                                            label="优惠券名称"
+                                                                            show-overflow-tooltip>
+                                                                    </el-table-column>
+                                                                    <el-table-column
+                                                                            prop="endTime"
+                                                                            label="截止日期"
+                                                                            show-overflow-tooltip>
+                                                                    </el-table-column>
+                                                                    <el-table-column
+                                                                            prop="address"
+                                                                            label="操作">
+                                                                        <template slot-scope="scope">
+                                                                            <el-button type="primary"
+                                                                                       size="mini"
+                                                                                       @click="chooseOneCoupon(scope.row)">选择
+                                                                            </el-button>
+                                                                        </template>
+                                                                    </el-table-column>
+                                                                </el-table>
+                                                            </el-row>
+                                                            <el-row class="paginationStyle"  >
+                                                                <el-pagination background
+                                                                               @size-change="changePageSizeCoupon"
+                                                                               @current-change="changeCurrentPageCoupon"
+                                                                               :current-page="couponList.currentPage"
+                                                                               :page-sizes="[10, 20, 30, 50]"
+                                                                               :page-size="couponList.pageSize"
+                                                                               layout="total, sizes, prev, pager, next, jumper"
+                                                                               :total="couponList.total">
+                                                                </el-pagination>
+                                                            </el-row>
+                                                        </el-col>
+                                                    </el-row>
+                                                </el-drawer>
+
                                             </div>
                                             <div v-show="item.content.awardType === 4">
                                                 <el-row style="display:flex;">
@@ -321,6 +382,67 @@
                                                         </el-button>
                                                     </el-col>
                                                 </el-row>
+
+                                                <el-drawer
+                                                        title="选择ERP产品"
+                                                        :visible.sync="drawerGoods"
+                                                        :direction="directionGoods"
+                                                        size="90%">
+                                                    <el-row style="margin-left: 50px;">
+                                                        <el-col :span="24">
+                                                            <el-row>
+                                                                <el-form ref="formGoods" :model="formGoods" inline >
+                                                                    <el-form-item prop="cpmc">
+                                                                        <el-input v-model="formGoods.cpmc" placeholder="请输入产品名称"></el-input>
+                                                                    </el-form-item>
+                                                                    <el-button type="primary" @click="searchFormGoods" >搜索</el-button>
+                                                                    <el-button @click="resetFormGoods('formGoods')">重置</el-button>
+                                                                </el-form>
+                                                            </el-row>
+
+                                                            <el-row class="table-style" >
+                                                                <el-table ref="multipleTable"
+                                                                          :data="goodsList.rows"
+                                                                          :height="tableHeightGoods"
+                                                                          stripe:true
+                                                                          style="width: 100%">
+                                                                    <el-table-column
+                                                                            prop="cname"
+                                                                            label="优惠券名称"
+                                                                            show-overflow-tooltip>
+                                                                    </el-table-column>
+                                                                    <el-table-column
+                                                                            prop="endTime"
+                                                                            label="截止日期"
+                                                                            show-overflow-tooltip>
+                                                                    </el-table-column>
+                                                                    <el-table-column
+                                                                            prop="address"
+                                                                            label="操作">
+                                                                        <template slot-scope="scope">
+                                                                            <el-button type="primary"
+                                                                                       size="mini"
+                                                                                       @click="chooseOneGoods(scope.row)">选择
+                                                                            </el-button>
+                                                                        </template>
+                                                                    </el-table-column>
+                                                                </el-table>
+                                                            </el-row>
+                                                            <el-row class="paginationStyle"  >
+                                                                <el-pagination background
+                                                                               @size-change="changePageSizeGoods"
+                                                                               @current-change="changeCurrentPageGoods"
+                                                                               :current-page="goodsList.currentPage"
+                                                                               :page-sizes="[10, 20, 30, 50]"
+                                                                               :page-size="goodsList.pageSize"
+                                                                               layout="total, sizes, prev, pager, next, jumper"
+                                                                               :total="goodsList.total">
+                                                                </el-pagination>
+                                                            </el-row>
+                                                        </el-col>
+                                                    </el-row>
+                                                </el-drawer>
+
                                             </div>
                                         </el-tab-pane>
                                     </el-tabs>
@@ -457,6 +579,40 @@
             imageUrlButton: '',
             imageUrlState: '',
 
+            //优惠券搜索弹出
+            drawerCoupon: false,
+            directionCoupon: 'rtl',
+            tableHeightCoupon: 500,
+            //--优惠券
+            formCoupon:{
+                yhjmc:'',
+                order:'',
+                sort:''
+            },
+            couponList:{
+                rows:[],
+                total:0,
+                pageSize:10,
+                currentPage:1,
+            },
+
+            //品项搜索弹出
+            drawerGoods: false,
+            directionGoods: 'rtl',
+            tableHeightGoods: 500,
+            //--品项
+            formGoods:{
+                cpmc:'',
+                order:'',
+                sort:''
+            },
+            goodsList:{
+                rows:[],
+                total:0,
+                pageSize:10,
+                currentPage:1,
+            },
+
             //字体颜色
             typographyColor: '#409EFF',
             //背景颜色
@@ -503,6 +659,115 @@
             this.loadInfo();
         },
         methods: {
+            //选择优惠券
+            chooseCoupon(val){
+                let _this = this;
+                _this.drawerCoupon = true;
+                _this.formCoupon.yhjmc = val;
+                _this.loadCouponList();
+            },
+            //--优惠券
+            loadCouponList() {
+                let _this = this;
+                let data=_this.getRequestParamCoupon();
+                data.pageSize=_this.couponList.pageSize;
+                data.pageNum=_this.couponList.currentPage;
+                AjaxProxy.requst({
+                    app: _this,
+                    data:data,
+                    url: basePath + '/admin/activitySignAwardSet/selectCouponList',
+                    callback: function (data) {
+                        _this.couponList.rows = data.rows;
+                        _this.couponList.total = data.total;
+                    }
+                });
+            },
+            //查询参数
+            getRequestParamCoupon(){
+                let _this = this;
+                return   {
+                    yhjmc:_this.formCoupon.yhjmc,
+                    order:_this.formCoupon.order,
+                    sort:_this.formCoupon.sort,
+                }
+            },
+            //查询
+            searchFormCoupon:function(){
+                this.couponList.currentPage=1;
+                this.loadCouponList();
+            },
+            //重置
+            resetFormCoupon(formName) {
+                // this.formCoupon.yhjmc = ''
+                // console.log(this.$refs[formName].resetFields)
+                (this.$refs[formName])[0].resetFields();
+            },
+            changePageSizeCoupon(val) {
+                this.couponList.pageSize = val;
+                this.loadCouponList();
+            },
+            changeCurrentPageCoupon(val) {
+                this.couponList.currentPage = val;
+                this.loadCouponList();
+            },
+            //选择
+            chooseOneCoupon(row) {
+                let _this = this;
+                _this.editableTabs[_this.tabIndex-1].content.couponId = row.id;
+                _this.editableTabs[_this.tabIndex-1].content.couponName = row.cname;
+                _this.drawerCoupon = false;
+            },
+
+            //--品项
+            loadGoodsList() {
+                let _this = this;
+                let data=_this.getRequestParamGoods();
+                data.pageSize=_this.goodsList.pageSize;
+                data.pageNum=_this.goodsList.currentPage;
+                AjaxProxy.requst({
+                    app: _this,
+                    data:data,
+                    url: basePath + '/admin/activitySignAwardSet/selectGoodsList',
+                    callback: function (data) {
+                        _this.goodsList.rows = data.rows;
+                        _this.goodsList.total = data.total;
+                    }
+                });
+            },
+            //查询参数
+            getRequestParamGoods(){
+                let _this = this;
+                return   {
+                    cpmc:_this.formCoupon.cpmc,
+                    order:_this.formCoupon.order,
+                    sort:_this.formCoupon.sort,
+                }
+            },
+            //查询
+            searchFormGoods:function(){
+                this.goodsList.currentPage=1;
+                this.loadGoodsList();
+            },
+            //重置
+            resetFormGoods(formName) {
+                (this.$refs[formName])[0].resetFields();
+            },
+            changePageSizeGoods(val) {
+                this.goodsList.pageSize = val;
+                this.loadGoodsList();
+            },
+            changeCurrentPageGoods(val) {
+                this.goodsList.currentPage = val;
+                this.loadGoodsList();
+            },
+            //选择
+            chooseOneGoods(row) {
+                let _this = this;
+                _this.editableTabs[_this.tabIndex-1].content.goodsId = row.id;
+                _this.editableTabs[_this.tabIndex-1].content.goodsName = row.name;
+                _this.drawerGoods = false;
+            },
+
             //加载活动详情
             loadInfo() {
                 let _this = this;
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
index cb5a821..44d8841 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
@@ -776,7 +776,7 @@
                 let _this = this;
                 _this.editableTabs[_this.tabIndex-1].content.goodsId = row.id;
                 _this.editableTabs[_this.tabIndex-1].content.goodsName = row.name;
-                _this.drawerCoupon = false;
+                _this.drawerGoods = false;
             },
 
             //保存
diff --git a/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java b/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java
new file mode 100644
index 0000000..c37e2bb
--- /dev/null
+++ b/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java
@@ -0,0 +1,78 @@
+package com.matrix;
+
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class FenxiaoSoreInitTest {
+	
+	@Autowired
+    private BusParameterSettingsDao busParameterSettingsDao;
+	
+	@Test
+	public void InitByCompanyId() {
+	    //对应的公司ID
+		long companyId = 35L;
+		initBusParameterSetting(companyId);
+		initBusParameterFenxiaoSetting(companyId);
+	}
+
+    /**
+     * 初始化默认积分规则设置
+     */
+    public void initBusParameterSetting(long companyId) {
+        List<BusParameterSettings> ruleSettings=new ArrayList<>();
+
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CREDIT_POINTS_CASH, companyId));
+
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.GIVE_CONSUMPTION, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.REFERRALS_CONSUMPTION, companyId));
+
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.EVALUATUIN_ORDER_SHOP, companyId));
+        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.SIGN_SHOP, companyId));
+
+        busParameterSettingsDao.batchInsert(ruleSettings);
+    }
+
+    /**
+     * 初始化默认分销规则设置
+     */
+    public void initBusParameterFenxiaoSetting(long companyId) {
+        List<BusParameterSettings> ruleSettings=new ArrayList<>();
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_SWITCH, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_MODEL, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_WAY, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_AUDIT_METHOD, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_PLAN, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_POSTER, companyId));
+        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_ZGFY, companyId));
+        busParameterSettingsDao.batchInsert(ruleSettings);
+    }
+
+    private BusParameterSettings addScoreRuleSetting(String code,long companyId) {
+        BusParameterSettings busParameterSetting = new BusParameterSettings();
+        busParameterSetting.setParamCode(code);
+        busParameterSetting.setCompanyId(companyId);
+        return busParameterSetting;
+    }
+
+}

--
Gitblit v1.9.1