Explorar el Código

修改积分规则

zangguocen hace 4 años
padre
commit
0a5669b0a5

+ 3 - 3
yijia-customer/src/main/java/com/yijia/customer/controller/CustomerCardSettingController.java

@@ -92,7 +92,7 @@ public class CustomerCardSettingController extends BaseController
             SysDept dept = new SysDept();
             dept.setDeptId(currentUser.getUser().getDeptId());
             dept.setIntegralFlag(customerCardSetting.getCardEnabledFlag());
-            deptService.updateDept(dept);
+            deptService.updateDeptInfo(dept);
         }
         return toAjax(customerCardSettingService.insertCustomerCardSetting(customerCardSetting));
     }
@@ -113,7 +113,7 @@ public class CustomerCardSettingController extends BaseController
                 SysDept dept =new SysDept();
                 dept.setDeptId(currentUser.getUser().getDeptId());
                 dept.setCardEnabledFlag(customerCardSetting.getCardEnabledFlag());
-                i= deptService.updateDept(dept);
+                i= deptService.updateDeptInfo(dept);
                 if(i==1) {
                     i = customerCardSettingService.updateCustomerCardSetting(customerCardSetting);
                 }
@@ -121,7 +121,7 @@ public class CustomerCardSettingController extends BaseController
                 SysDept dept =new SysDept();
                 dept.setDeptId(currentUser.getUser().getDeptId());
                 dept.setCardEnabledFlag(customerCardSetting.getCardEnabledFlag());
-                i= deptService.updateDept(dept);
+                i= deptService.updateDeptInfo(dept);
             }
         }
         return toAjax(i);

+ 2 - 4
yijia-customer/src/main/java/com/yijia/customer/controller/CustomerCardUseRecordController.java

@@ -48,7 +48,6 @@ public class CustomerCardUseRecordController extends BaseController
     public TableDataInfo list(CustomerCardUseRecord customerCardUseRecord)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        System.out.println("等级:"+currentUser.getUser().getDept().getJiBie());
         SysDept dept =new SysDept();
         dept.setDeptId(currentUser.getUser().getDeptId());
         List<String> list = sysDeptService.selectDeptId(dept);
@@ -68,9 +67,8 @@ public class CustomerCardUseRecordController extends BaseController
     public AjaxResult listCZXFData(CustomerCardUseRecord customerCardUseRecord)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        SysDept dept =new SysDept();
-        dept.setDeptId(currentUser.getUser().getDeptId());
-        List<String> list = sysDeptService.selectDeptId(dept);
+        SysDept sysDept = sysDeptService.selectDeptById(currentUser.getUser().getDeptId());
+        List<String> list = sysDeptService.deptCardInfoList(sysDept);
         if(list!=null && list.size()>0){
             customerCardUseRecord.setStationIdList(list);
             customerCardUseRecord.setStationId(null);

+ 4 - 6
yijia-customer/src/main/java/com/yijia/customer/controller/CustomerElectronicCardController.java

@@ -163,9 +163,8 @@ public class CustomerElectronicCardController extends BaseController
     public AjaxResult listHYData(CustomerElectronicCard customerElectronicCard)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        SysDept dept =new SysDept();
-        dept.setDeptId(currentUser.getUser().getDeptId());
-        List<String> list = deptService.selectDeptId(dept);
+        SysDept sysDept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        List<String> list = deptService.deptCardInfoList(sysDept);
         if(list!=null && list.size()>0){
             customerElectronicCard.setStationIdList(list);
             customerElectronicCard.setStationId(null);
@@ -180,9 +179,8 @@ public class CustomerElectronicCardController extends BaseController
     public AjaxResult listJRHYData(CustomerElectronicCard customerElectronicCard)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        SysDept dept =new SysDept();
-        dept.setDeptId(currentUser.getUser().getDeptId());
-        List<String> list = deptService.selectDeptId(dept);
+        SysDept sysDept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        List<String> list = deptService.deptCardInfoList(sysDept);
         if(list!=null && list.size()>0){
             customerElectronicCard.setStationIdList(list);
             customerElectronicCard.setStationId(null);

+ 2 - 0
yijia-customer/src/main/java/com/yijia/customer/domain/CustomerCardRecordConsumption.java

@@ -8,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.yijia.common.annotation.Excel;
 import com.yijia.common.core.domain.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 客户电子会员卡消费记录对象 customer_card_record_consumption
@@ -62,6 +63,7 @@ public class CustomerCardRecordConsumption extends BaseEntity
 
     /** 是否消费成功:0,未成功;1,成功 */
     private String status;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date payDate;
 

+ 2 - 3
yijia-integral/src/main/java/com/yijia/integral/controller/CustomerPointsController.java

@@ -46,9 +46,8 @@ public class CustomerPointsController extends BaseController
     public TableDataInfo list(CustomerPoints customerPoints)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        SysDept dept =new SysDept();
-        dept.setDeptId(currentUser.getUser().getDeptId());
-        List<String> list = deptService.selectDeptId(dept);
+        SysDept sysDept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        List<String> list = deptService.deptIntegralInfoList(sysDept);
         if(list!=null && list.size()>0){
             customerPoints.setStationIdList(list);
             customerPoints.setStationId(null);

+ 3 - 4
yijia-integral/src/main/java/com/yijia/integral/controller/IntegralRuleController.java

@@ -143,7 +143,7 @@ public class IntegralRuleController extends BaseController
             SysDept dept = new SysDept();
             dept.setDeptId(currentUser.getUser().getDeptId());
             dept.setIntegralFlag(integralRule.getIntegralFlag());
-            sysDeptService.updateDept(dept);
+            sysDeptService.updateDeptInfo(dept);
         }
         return toAjax(integralRuleService.insertIntegralRule(integralRule));
     }
@@ -153,7 +153,6 @@ public class IntegralRuleController extends BaseController
      */
     @Log(title = "积分规则", businessType = BusinessType.UPDATE)
     @PutMapping
-    @Transactional
     public AjaxResult edit(@RequestBody IntegralRule integralRule)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
@@ -164,7 +163,7 @@ public class IntegralRuleController extends BaseController
                 dept.setDeptId(currentUser.getUser().getDeptId());
                 dept.setIntegralFlag(integralRule.getIntegralFlag());
                 integralRule.setStationId(currentUser.getUser().getDeptId());
-                i = sysDeptService.updateDept(dept);
+                i = sysDeptService.updateDeptInfo(dept);
                 if(integralRule!=null && integralRule.getIntegralActivity()==null){
                     integralRule.setIntegralActivity("0");
                     integralRule.setDatePickerTime("");
@@ -176,7 +175,7 @@ public class IntegralRuleController extends BaseController
                 SysDept dept =new SysDept();
                 dept.setDeptId(currentUser.getUser().getDeptId());
                 dept.setIntegralFlag(integralRule.getIntegralFlag());
-                i= sysDeptService.updateDept(dept);
+                i= sysDeptService.updateDeptInfo(dept);
             }
         }
         return toAjax(i);

+ 24 - 15
yijia-integral/src/main/java/com/yijia/integral/domain/CustomerPointsRecord.java

@@ -7,7 +7,7 @@ import com.yijia.common.core.domain.BaseEntity;
 
 /**
  * 客户积分记录对象 customer_points_record
- * 
+ *
  * @author yijia
  * @date 2021-03-17
  */
@@ -41,67 +41,76 @@ public class CustomerPointsRecord extends BaseEntity
     /** 油站名称 */
     @Excel(name = "油站名称")
     private String stationName;
+    private String orderNo;
 
-    public void setId(Long id) 
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setUnionId(String unionId) 
+    public void setUnionId(String unionId)
     {
         this.unionId = unionId;
     }
 
-    public String getUnionId() 
+    public String getUnionId()
     {
         return unionId;
     }
-    public void setCustomerName(String customerName) 
+    public void setCustomerName(String customerName)
     {
         this.customerName = customerName;
     }
 
-    public String getCustomerName() 
+    public String getCustomerName()
     {
         return customerName;
     }
-    public void setRecordType(String recordType) 
+    public void setRecordType(String recordType)
     {
         this.recordType = recordType;
     }
 
-    public String getRecordType() 
+    public String getRecordType()
     {
         return recordType;
     }
-    public void setIntegral(Long integral) 
+    public void setIntegral(Long integral)
     {
         this.integral = integral;
     }
 
-    public Long getIntegral() 
+    public Long getIntegral()
     {
         return integral;
     }
-    public void setStationId(Long stationId) 
+    public void setStationId(Long stationId)
     {
         this.stationId = stationId;
     }
 
-    public Long getStationId() 
+    public Long getStationId()
     {
         return stationId;
     }
-    public void setStationName(String stationName) 
+    public void setStationName(String stationName)
     {
         this.stationName = stationName;
     }
 
-    public String getStationName() 
+    public String getStationName()
     {
         return stationName;
     }

+ 7 - 4
yijia-integral/src/main/java/com/yijia/integral/domain/IntegralRule.java

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.yijia.common.core.domain.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 【请填写功能名称】对象 integral_rule
@@ -32,6 +33,7 @@ public class IntegralRule extends BaseEntity
     private String termDateManage;
 
     /** 清空积分时间 */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date emptyDate;
 
@@ -74,15 +76,15 @@ public class IntegralRule extends BaseEntity
     private String  image4;
     private String  image5;
     private String  gradeName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private String  integralEmptyTime;
+    private Date  integralEmptyTime;
 
-
-    public String getIntegralEmptyTime() {
+    public Date getIntegralEmptyTime() {
         return integralEmptyTime;
     }
 
-    public void setIntegralEmptyTime(String integralEmptyTime) {
+    public void setIntegralEmptyTime(Date integralEmptyTime) {
         this.integralEmptyTime = integralEmptyTime;
     }
 
@@ -317,6 +319,7 @@ public class IntegralRule extends BaseEntity
             .append("integralActivity", getIntegralActivity())
             .append("datePicker", getDatePicker())
             .append("integralProportion", getIntegralProportion())
+            .append("integralEmptyTime", getIntegralEmptyTime())
             .toString();
     }
 }

+ 6 - 4
yijia-integral/src/main/resources/mapper/integral/CustomerPointsRecordMapper.xml

@@ -13,9 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="stationId"    column="station_id"    />
         <result property="stationName"    column="station_name"    />
+        <result property="orderNo"    column="order_no"    />
     </resultMap>
     <sql id="selectCustomerPointsRecordVo">
-        select id, union_id, customer_name, record_type, integral, create_time, station_id, station_name from customer_points_record
+        select id, union_id, customer_name, record_type, integral, create_time, station_id, d.dept_name  as station_name,order_no
+        from customer_points_record p join sys_dept d on p.station_id = d.dept_id
     </sql>
 
     <select id="selectCustomerPointsRecordList" parameterType="CustomerPointsRecord" resultMap="CustomerPointsRecordResult">
@@ -51,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integral != null">integral,</if>
             <if test="createTime != null">create_time,</if>
             <if test="stationId != null">station_id,</if>
-            <if test="stationName != null">station_name,</if>
+            <if test="orderNo != null">order_no,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="unionId != null">#{unionId},</if>
@@ -60,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integral != null">#{integral},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="stationId != null">#{stationId},</if>
-            <if test="stationName != null">#{stationName},</if>
+            <if test="orderNo != null">#{orderNo},</if>
          </trim>
     </insert>
 
@@ -73,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integral != null">integral = #{integral},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="stationId != null">station_id = #{stationId},</if>
-            <if test="stationName != null">station_name = #{stationName},</if>
+            <if test="orderNo != null">order_no = #{orderNo},</if>
         </trim>
         where id = #{id}
     </update>

+ 1 - 2
yijia-integral/src/main/resources/mapper/integral/IntegralRuleMapper.xml

@@ -177,10 +177,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="listRuleInfo" parameterType="IntegralRule" resultMap="IntegralRuleResult">
         SELECT a.station_id,d.dept_name as station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,s.grade as grade_name,
-        b.rule_type,rule_terms,b.grade,b.oil_name,b.sale_amt,b.integral,b.oil_type,c.integral_flag,a.integral_empty_time
+        b.rule_type,rule_terms,b.grade,b.oil_name,b.sale_amt,b.integral,b.oil_type,d.integral_flag,a.integral_empty_time
         from integral_rule a
         join integral_rule_detail b on a.id =b.parent_id
-        join station_pay c on a.station_id =c.station_id
         join sys_dept d on a.station_id =d.dept_id
         left join customer_grade_setting s on s.id = b.grade
         <where>

+ 1 - 1
yijia-station/src/main/java/com/yijia/station/controller/StationPayController.java

@@ -125,6 +125,6 @@ public class StationPayController extends BaseController
         }
         SysDept dept = new SysDept();
         BeanUtils.copyProperties(sysDeptDemo, dept);
-        return toAjax(sysDeptService.updateDept(dept));
+        return toAjax(sysDeptService.updateDeptInfo(dept));
     }
 }

+ 1 - 1
yijia-station/src/main/resources/mapper/station/PayOrderMapper.xml

@@ -282,7 +282,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!--日报数据-->
     <select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
         SELECT date_format( b.created_date, '%Y-%m-%d' ) as created_date,sum(b.amt) as amt,sum(b.qyamt) as qy_amt, sum(b.cyamt) as cy_amt,sum(b.order_liters) as order_liters ,count(b.order_no) order_no ,sum(b.member_amt) as menber_amt,sum(receivable_amt) as receivable_amt,sum(received_amt) as received_amt
-        from (SELECT a.*,(SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=2) as qyamt , (SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=1) as cyamt
+        from (SELECT a.*,(SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=1) as qyamt , (SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=2) as cyamt
         from pay_order a
             <where>
                 <if test="stationId != null "> and a.station_id = #{stationId}</if>

+ 27 - 0
yijia-system/src/main/java/com/yijia/system/service/ISysDeptService.java

@@ -129,4 +129,31 @@ public interface ISysDeptService
      * @return
      */
     public SysDept getGroupInfo(SysDept dept);
+
+    /**
+     * 查询积分规则共享
+     * @param dept
+     * @return
+     */
+    public  List<String>  deptIntegralInfoList(SysDept dept);
+
+    /**
+     * 查询电子卡规则共享
+     * @param dept
+     * @return
+     */
+    public  List<String>  deptCardInfoList(SysDept dept);
+    /**
+     * 查询优惠劵规则共享
+     * @param dept
+     * @return
+     */
+    public  List<String>  deptCouponInfoList(SysDept dept);
+
+    /**
+     * 修改油站基础信息
+     * @param dept
+     * @return
+     */
+    public int updateDeptInfo(SysDept dept);
 }

+ 98 - 0
yijia-system/src/main/java/com/yijia/system/service/impl/SysDeptServiceImpl.java

@@ -325,6 +325,104 @@ public class SysDeptServiceImpl implements ISysDeptService
     }
 
     /**
+     * 是否共享积分规则
+     */
+    @Override
+    public List<String> deptIntegralInfoList(SysDept dept) {
+        List<String> list = new ArrayList<>();
+        if(dept!=null &&dept.getJiBie()!=null  && dept.getJiBie()==1 ){
+            if(dept.getIntegralRuleFlag()!=null &&dept.getIntegralRuleFlag().equals("1")){
+                list.add(dept.getDeptId()+"");
+            }else if(dept.getIntegralRuleFlag()!=null &&dept.getIntegralRuleFlag().equals("0")){
+                SysDept sysDept2 =new SysDept();
+                sysDept2.setParentId(dept.getDeptId());
+                List<SysDept> list2 = deptMapper.selectDeptList(sysDept2);
+                for(SysDept dpt2:list2){
+                    list.add(dpt2.getDeptId().toString());
+                }
+            }
+
+        }else if(dept!=null && dept.getJiBie()!=null  && dept.getJiBie()==2){
+            SysDept sysDept  = deptMapper.selectDeptById(dept.getParentId());
+            if(sysDept.getIntegralRuleFlag()!=null &&sysDept.getIntegralRuleFlag().equals("1")){
+                list.add(sysDept.getDeptId()+"");
+            }else if(sysDept.getIntegralRuleFlag()!=null &&sysDept.getIntegralRuleFlag().equals("0")){
+                list.add(dept.getDeptId()+"");
+            }
+        }
+        return list;
+    }
+    /**
+     * 是否共享电子卡规则
+     */
+    @Override
+    public List<String> deptCardInfoList(SysDept dept) {
+        List<String> list = new ArrayList<>();
+        if(dept!=null &&dept.getJiBie()!=null  && dept.getJiBie()==1 ){
+            if(dept.getCardRuleFlag()!=null &&dept.getCardRuleFlag().equals("1")){
+                list.add(dept.getDeptId()+"");
+            }else if(dept.getCardRuleFlag()!=null &&dept.getCardRuleFlag().equals("0")){
+                SysDept sysDept2 =new SysDept();
+                sysDept2.setParentId(dept.getDeptId());
+                List<SysDept> list2 = deptMapper.selectDeptList(sysDept2);
+                for(SysDept dpt2:list2){
+                    list.add(dpt2.getDeptId().toString());
+                }
+            }
+
+        }else if(dept!=null && dept.getJiBie()!=null  && dept.getJiBie()==2){
+            SysDept sysDept  = deptMapper.selectDeptById(dept.getParentId());
+            if(sysDept.getCardRuleFlag()!=null &&sysDept.getCardRuleFlag().equals("1")){
+                list.add(sysDept.getDeptId()+"");
+            }else if(sysDept.getCardRuleFlag()!=null &&sysDept.getCardRuleFlag().equals("0")){
+                list.add(dept.getDeptId()+"");
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 是否共享优惠劵
+     * @param dept
+     * @return
+     */
+    @Override
+    public List<String> deptCouponInfoList(SysDept dept) {
+        List<String> list = new ArrayList<>();
+        if(dept!=null &&dept.getJiBie()!=null  && dept.getJiBie()==1 ){
+            if(dept.getCouponFlag()!=null &&dept.getCouponFlag().equals("1")){
+                list.add(dept.getDeptId()+"");
+            }else if(dept.getCouponFlag()!=null &&dept.getCouponFlag().equals("0")){
+                SysDept sysDept2 =new SysDept();
+                sysDept2.setParentId(dept.getDeptId());
+                List<SysDept> list2 = deptMapper.selectDeptList(sysDept2);
+                for(SysDept dpt2:list2){
+                    list.add(dpt2.getDeptId().toString());
+                }
+            }
+
+        }else if(dept!=null && dept.getJiBie()!=null  && dept.getJiBie()==2){
+            SysDept sysDept  = deptMapper.selectDeptById(dept.getParentId());
+            if(sysDept.getCouponFlag()!=null &&sysDept.getCouponFlag().equals("1")){
+                list.add(sysDept.getDeptId()+"");
+            }else if(sysDept.getCouponFlag()!=null &&sysDept.getCouponFlag().equals("0")){
+                list.add(dept.getDeptId()+"");
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 修改油站基础信息
+     * @param dept
+     * @return
+     */
+    @Override
+    public int updateDeptInfo(SysDept dept) {
+        return deptMapper.updateDept(dept);
+    }
+
+    /**
      * 递归列表
      */
     private void recursionFn(List<SysDept> list, SysDept t)