Pārlūkot izejas kodu

积分活动修改

MS-QJVSRANLTYEO\Administrator 4 gadi atpakaļ
vecāks
revīzija
54b47353d9

+ 35 - 0
Yijia-SaaS/yijia-integral/src/main/java/com/yijia/integral/controller/IntegralRuleController.java

@@ -57,6 +57,41 @@ public class IntegralRuleController extends BaseController
     }
 
     /**
+     * 查询积分明细
+     * @param integralRule
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('integral:rule:listRuleInfo')")
+    @GetMapping("/listRuleInfo")
+    public TableDataInfo listRuleInfo(IntegralRule integralRule)
+    {
+        if(integralRule!=null &&integralRule.getStationId()!=null){
+            SysDept dept =new SysDept();
+            dept.setDeptId(integralRule.getStationId());
+            List<String> list = sysDeptService.selectDeptId(dept);
+            integralRule.setStationIdList(list);
+            integralRule.setStationId(null);
+        }
+        startPage();
+        List<IntegralRule> list = integralRuleService.listRuleInfo(integralRule);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('integral:rule:listRuleOne')")
+    @GetMapping("/listRuleOne")
+    public AjaxResult listRuleOne(IntegralRule integralRule)
+    {
+        if(integralRule!=null &&integralRule.getStationId()!=null){
+            SysDept dept =new SysDept();
+            dept.setDeptId(integralRule.getStationId());
+            List<String> list = sysDeptService.selectDeptId(dept);
+            integralRule.setStationIdList(list);
+            integralRule.setStationId(null);
+        }
+        IntegralRule rule = integralRuleService.selectIntegralRule(integralRule);
+        return AjaxResult.success(rule);
+    }
+    /**
      * 导出积分规则列表
      */
     @PreAuthorize("@ss.hasPermi('integral:rule:export')")

+ 87 - 0
Yijia-SaaS/yijia-integral/src/main/java/com/yijia/integral/domain/IntegralRule.java

@@ -1,5 +1,6 @@
 package com.yijia.integral.domain;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -72,6 +73,92 @@ public class IntegralRule extends BaseEntity
     @Excel(name = "积分抵扣油品规则")
     private String integralDeductionOil;
 
+    /**
+     * 积分有效期设置
+     */
+    private String integralTermSetting;
+    /**
+     * 积分清空时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date integralEmptyTime;
+
+    private BigDecimal ruleTerms;
+    /** 会员等级 */
+    private String gread;
+    /** 油品名称 */
+    private String oilName;
+    /** 每消费金额 */
+    private BigDecimal saleAmt;
+    /** 兑换积分 */
+    private BigDecimal integral;
+    /** 油品类型 1.油品。2.非油品*/
+    private String oilType;
+
+    public BigDecimal getRuleTerms() {
+        return ruleTerms;
+    }
+
+    public void setRuleTerms(BigDecimal ruleTerms) {
+        this.ruleTerms = ruleTerms;
+    }
+
+    public String getGread() {
+        return gread;
+    }
+
+    public void setGread(String gread) {
+        this.gread = gread;
+    }
+
+    public String getOilName() {
+        return oilName;
+    }
+
+    public void setOilName(String oilName) {
+        this.oilName = oilName;
+    }
+
+    public BigDecimal getSaleAmt() {
+        return saleAmt;
+    }
+
+    public void setSaleAmt(BigDecimal saleAmt) {
+        this.saleAmt = saleAmt;
+    }
+
+    public BigDecimal getIntegral() {
+        return integral;
+    }
+
+    public void setIntegral(BigDecimal integral) {
+        this.integral = integral;
+    }
+
+    public String getOilType() {
+        return oilType;
+    }
+
+    public void setOilType(String oilType) {
+        this.oilType = oilType;
+    }
+
+    public String getIntegralTermSetting() {
+        return integralTermSetting;
+    }
+
+    public void setIntegralTermSetting(String integralTermSetting) {
+        this.integralTermSetting = integralTermSetting;
+    }
+
+    public Date getIntegralEmptyTime() {
+        return integralEmptyTime;
+    }
+
+    public void setIntegralEmptyTime(Date integralEmptyTime) {
+        this.integralEmptyTime = integralEmptyTime;
+    }
+
     private List<IntegralRuleDetail> itemsDetail;
     private List<IntegralRuleDetail> notOilList;
     private List<IntegralShopPic> imgFileList;

+ 14 - 0
Yijia-SaaS/yijia-integral/src/main/java/com/yijia/integral/mapper/IntegralRuleMapper.java

@@ -59,4 +59,18 @@ public interface IntegralRuleMapper
      * @return 结果
      */
     public int deleteIntegralRuleByIds(Long[] ids);
+
+    /**
+     *根据当前站,获取积分规则数据
+     * @param integralRule
+     * @return
+     */
+    public IntegralRule selectIntegralRule(IntegralRule integralRule);
+
+    /**
+     * 查询积分明细
+     * @param integralRule
+     * @return
+     */
+    public List<IntegralRule> listRuleInfo(IntegralRule integralRule);
 }

+ 13 - 0
Yijia-SaaS/yijia-integral/src/main/java/com/yijia/integral/service/IIntegralRuleService.java

@@ -58,4 +58,17 @@ public interface IIntegralRuleService
      * @return 结果
      */
     public int deleteIntegralRuleById(Long id);
+
+    /**
+     * 获取当前油站的积分规则
+     * @param integralRule
+     * @return
+     */
+    public IntegralRule selectIntegralRule(IntegralRule integralRule);
+    /**
+     * 查询积分明细
+     * @param integralRule
+     * @return
+     */
+    public List<IntegralRule> listRuleInfo(IntegralRule integralRule);
 }

+ 43 - 0
Yijia-SaaS/yijia-integral/src/main/java/com/yijia/integral/service/impl/IntegralRuleServiceImpl.java

@@ -173,6 +173,10 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
                 SimpleDateFormat sdf =   new SimpleDateFormat( "yyyy-MM-dd");
                 integralRule.setEmptyDate(sdf.parse("2099-12-31") );
             }
+            if(integralRule !=null && integralRule.getIntegralTermSetting()!=null && integralRule.getIntegralTermSetting().equals("1")){
+                SimpleDateFormat sdf =   new SimpleDateFormat( "yyyy-MM-dd");
+                integralRule.setIntegralEmptyTime(sdf.parse("2099-12-31") );
+            }
         } catch (ParseException e) {
             e.printStackTrace();
         }
@@ -202,4 +206,43 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
     {
         return integralRuleMapper.deleteIntegralRuleById(id);
     }
+
+    /****
+     * 获取当前站的积分规则
+     * @param integralRule
+     * @return
+     */
+    @Override
+    public IntegralRule selectIntegralRule(IntegralRule integralRule) {
+        IntegralRule rule = integralRuleMapper.selectIntegralRule(integralRule);
+        if(rule!=null){
+            IntegralRuleDetail  detail  = new  IntegralRuleDetail();
+            detail.setParentId(rule.getId());
+            detail.setOilType("1");
+            List<IntegralRuleDetail> list =  integralRuleDetailMapper.selectIntegralRuleDetailList(detail);
+            rule.setItemsDetail(list);
+            //查询非油品数据
+            IntegralRuleDetail  itemdetail  = new  IntegralRuleDetail();
+            itemdetail.setParentId(rule.getId());
+            itemdetail.setOilType("2");
+            List<IntegralRuleDetail> notOillist =  integralRuleDetailMapper.selectIntegralRuleDetailList(itemdetail);
+            rule.setNotOilList(notOillist);
+            //查询图片信息
+            IntegralShopPic shopPic =new IntegralShopPic();
+            shopPic.setParentId(rule.getId());
+            List<IntegralShopPic> shopPicList = integralShopPicMapper.selectIntegralShopPicList(shopPic);
+            rule.setImgFileList(shopPicList);
+        }
+        return rule;
+    }
+
+    /**
+     * 查询积分明细
+     * @param integralRule
+     * @return
+     */
+    @Override
+    public List<IntegralRule> listRuleInfo(IntegralRule integralRule) {
+        return integralRuleMapper.listRuleInfo(integralRule);
+    }
 }

+ 62 - 3
Yijia-SaaS/yijia-integral/src/main/resources/mapper/integral/IntegralRuleMapper.xml

@@ -18,10 +18,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="integralProportion"    column="integral_proportion"    />
         <result property="integralDeductionOil"    column="integral_deduction_oil"    />
         <result property="datePickerTime"    column="date_picker_time"    />
+        <result property="integralTermSetting"    column="integral_term_setting"    />
+        <result property="integralEmptyTime"    column="integral_empty_time"    />
+        <result property="ruleTerms"    column="rule_terms"    />
+        <result property="gread"    column="gread"    />
+        <result property="oilName"    column="oil_name"    />
+        <result property="saleAmt"    column="sale_amt"    />
+        <result property="integral"    column="integral"    />
+        <result property="oilType"    column="oil_type"    />
     </resultMap>
 
     <sql id="selectIntegralRuleVo">
-        select id, station_id, station_name, rule_type, term_date_manage, empty_date, expiration_reminder, remind_date, integral_activity, date_picker, integral_proportion, integral_deduction_oil,date_picker_time from integral_rule
+        select id, station_id, station_name, rule_type, term_date_manage, empty_date, expiration_reminder, remind_date, integral_activity, date_picker, integral_proportion, integral_deduction_oil,date_picker_time,integral_term_setting,integral_empty_time from integral_rule
     </sql>
 
     <select id="selectIntegralRuleList" parameterType="IntegralRule" resultMap="IntegralRuleResult">
@@ -39,6 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integralProportion != null  and integralProportion != ''"> and integral_proportion = #{integralProportion}</if>
             <if test="integralDeductionOil != null  and integralDeductionOil != ''"> and integral_deduction_oil = #{integralDeductionOil}</if>
             <if test="datePickerTime != null  and datePickerTime != ''"> and date_picker_time = #{datePickerTime}</if>
+            <if test="integralEmptyTime != null  and integralEmptyTime != ''"> and integral_empty_time = #{integralEmptyTime}</if>
+            <if test="integralTermSetting != null  and integralTermSetting != ''"> and integral_term_setting = #{integralTermSetting}</if>
             <if test="stationIdList != null ">
                 and station_id in
                 <foreach item="item" index="index" collection="stationIdList"
@@ -70,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integralProportion != null">integral_proportion,</if>
             <if test="integralDeductionOil != null">integral_deduction_oil,</if>
             <if test="datePickerTime != null">date_picker_time,</if>
+            <if test="integralEmptyTime != null">integral_empty_time,</if>
+            <if test="integralTermSetting != null">integral_term_setting,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="stationId != null">#{stationId},</if>
@@ -84,6 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integralProportion != null">#{integralProportion},</if>
             <if test="integralDeductionOil != null">#{integralDeductionOil},</if>
             <if test="datePickerTime != null">#{datePickerTime},</if>
+            <if test="integralEmptyTime != null">#{integralEmptyTime},</if>
+            <if test="integralTermSetting != null">#{integralTermSetting},</if>
          </trim>
     </insert>
 
@@ -101,7 +115,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="datePicker != null">date_picker = #{datePicker},</if>
             <if test="integralProportion != null">integral_proportion = #{integralProportion},</if>
             <if test="integralDeductionOil != null">integral_deduction_oil = #{integralDeductionOil},</if>
-            <if test="datePickerTime != null  and datePickerTime != ''">  date_picker_time = #{datePickerTime},</if>
+            <if test="datePickerTime != null ">  date_picker_time = #{datePickerTime},</if>
+            <if test="integralEmptyTime != null  ">  integral_empty_time = #{integralEmptyTime},</if>
+            <if test="integralTermSetting != null  ">  integral_term_setting = #{integralTermSetting},</if>
         </trim>
         where id = #{id}
     </update>
@@ -116,5 +132,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
-    
+    <select id="selectIntegralRule" parameterType="IntegralRule" resultMap="IntegralRuleResult">
+        <include refid="selectIntegralRuleVo"/>
+        <where>
+            <if test="stationId != null "> and station_id = #{stationId}</if>
+            <if test="stationName != null  and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
+            <if test="ruleType != null  and ruleType != ''"> and rule_type = #{ruleType}</if>
+            <if test="termDateManage != null  and termDateManage != ''"> and term_date_manage = #{termDateManage}</if>
+            <if test="emptyDate != null "> and empty_date = #{emptyDate}</if>
+            <if test="expirationReminder != null  and expirationReminder != ''"> and expiration_reminder = #{expirationReminder}</if>
+            <if test="remindDate != null "> and remind_date = #{remindDate}</if>
+            <if test="integralActivity != null  and integralActivity != ''"> and integral_activity = #{integralActivity}</if>
+            <if test="datePicker != null  and datePicker != ''"> and date_picker = #{datePicker}</if>
+            <if test="integralProportion != null  and integralProportion != ''"> and integral_proportion = #{integralProportion}</if>
+            <if test="integralDeductionOil != null  and integralDeductionOil != ''"> and integral_deduction_oil = #{integralDeductionOil}</if>
+            <if test="datePickerTime != null  and datePickerTime != ''"> and date_picker_time = #{datePickerTime}</if>
+            <if test="integralEmptyTime != null  and integralEmptyTime != ''"> and integral_empty_time = #{integralEmptyTime}</if>
+            <if test="integralTermSetting != null  and integralTermSetting != ''"> and integral_term_setting = #{integralTermSetting}</if>
+            <if test="stationIdList != null ">
+                and station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        order by  id desc limit 1
+    </select>
+
+    <select id="listRuleInfo" parameterType="IntegralRule" resultMap="IntegralRuleResult">
+        SELECT a.station_id,a.station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,b.rule_type,rule_terms,gread,oil_name,sale_amt,integral,oil_type
+        from integral_rule a join integral_rule_detail b on a.id =b.parent_id
+        <where>
+            <if test="stationId != null "> and a.station_id = #{stationId}</if>
+            <if test="stationName != null  and stationName != ''"> and a.station_name like concat('%', #{stationName}, '%')</if>
+            <if test="stationIdList != null ">
+                and a.station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
 </mapper>