Procházet zdrojové kódy

[疲劳度][修改]:添加是否启用

release_toaliyun_real
Stormeye Wu před 7 roky
rodič
revize
005d6061c8
4 změnil soubory, kde provedl 26 přidání a 4 odebrání
  1. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201907030811__CHANGE_PUSH_LIMIT.sql
  2. +5
    -3
      mallinkService/src/main/java/com/iformall/domain/po/PushLimit.java
  3. +14
    -0
      mallinkService/src/main/java/com/iformall/service/impl/PushLimitServiceImpl.java
  4. +5
    -1
      mallinkService/src/main/resources/mapper/PushLimitMapper.xml

+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201907030811__CHANGE_PUSH_LIMIT.sql Zobrazit soubor

@@ -0,0 +1,2 @@
ALTER TABLE `push_limit`
ADD COLUMN `enable` TINYINT(2) '0' DEFAULT '0' COMMENT '是否启用,0:Enable,1:Disable';

+ 5
- 3
mallinkService/src/main/java/com/iformall/domain/po/PushLimit.java Zobrazit soubor

@@ -22,7 +22,7 @@ public class PushLimit implements Serializable {
@Transient @Transient
protected String sortColumns; protected String sortColumns;


@io.swagger.annotations.ApiModelProperty(value="",name="tenantId")
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId; private String tenantId;
@io.swagger.annotations.ApiModelProperty(value="每人每天可接收短信数",name="msgAmount") @io.swagger.annotations.ApiModelProperty(value="每人每天可接收短信数",name="msgAmount")
private Integer msgAmount; private Integer msgAmount;
@@ -34,10 +34,12 @@ public class PushLimit implements Serializable {
private String timeStart; private String timeStart;
@io.swagger.annotations.ApiModelProperty(value="发券,发短信结束时间",name="timeEnd") @io.swagger.annotations.ApiModelProperty(value="发券,发短信结束时间",name="timeEnd")
private String timeEnd; private String timeEnd;
@io.swagger.annotations.ApiModelProperty(value="",name="createTime")
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
private Date createTime; private Date createTime;
@io.swagger.annotations.ApiModelProperty(value="",name="updateTime")
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
private Date updateTime; private Date updateTime;
@io.swagger.annotations.ApiModelProperty(value="是否启用,0:Enable,1:Disable",name="enable")
private Integer enable;


public static enum Field public static enum Field
{ {


+ 14
- 0
mallinkService/src/main/java/com/iformall/service/impl/PushLimitServiceImpl.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.iformall.service.impl;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.domain.po.PushLimit; import com.iformall.domain.po.PushLimit;
import com.iformall.enums.EnumEnableType;
import com.iformall.exception.MallinkException; import com.iformall.exception.MallinkException;
import com.iformall.mapper.PushLimitMapper; import com.iformall.mapper.PushLimitMapper;
import com.iformall.mapper.WxCouponActionLogMapper; import com.iformall.mapper.WxCouponActionLogMapper;
@@ -62,6 +63,7 @@ public class PushLimitServiceImpl implements PushLimitService {
pushLimit.setCouponDay(10); pushLimit.setCouponDay(10);
pushLimit.setTimeStart("8:00"); pushLimit.setTimeStart("8:00");
pushLimit.setTimeEnd("23:00"); pushLimit.setTimeEnd("23:00");
pushLimit.setEnable(EnumEnableType.Enable.getCode());
Date curDate = new Date(); Date curDate = new Date();
pushLimit.setCreateTime(curDate); pushLimit.setCreateTime(curDate);
pushLimit.setUpdateTime(curDate); pushLimit.setUpdateTime(curDate);
@@ -92,6 +94,10 @@ public class PushLimitServiceImpl implements PushLimitService {
Date curDate = new Date(); Date curDate = new Date();
// 1. get tenant limit // 1. get tenant limit
PushLimit pushLimit = getPushLimit(tenantId); PushLimit pushLimit = getPushLimit(tenantId);
// 1.1 疲劳度是否启用
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) {
return true;
}
// 2. check time // 2. check time
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd());
if (!isInDate) { if (!isInDate) {
@@ -106,6 +112,10 @@ public class PushLimitServiceImpl implements PushLimitService {
Date curDate = new Date(); Date curDate = new Date();
// 1. get tenant limit // 1. get tenant limit
PushLimit pushLimit = getPushLimit(tenantId); PushLimit pushLimit = getPushLimit(tenantId);
// 1.1 疲劳度是否启用
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) {
return true;
}
// 2. check time // 2. check time
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd());
if (!isInDate) { if (!isInDate) {
@@ -121,6 +131,10 @@ public class PushLimitServiceImpl implements PushLimitService {
Date curDate = new Date(); Date curDate = new Date();
// 1. get tenant limit // 1. get tenant limit
PushLimit pushLimit = getPushLimit(tenantId); PushLimit pushLimit = getPushLimit(tenantId);
// 1.1 疲劳度是否启用
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) {
return true;
}
// 2. check time 是否在给定的时间段内 // 2. check time 是否在给定的时间段内
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd());
if (!isInDate) { if (!isInDate) {


+ 5
- 1
mallinkService/src/main/resources/mapper/PushLimitMapper.xml Zobrazit soubor

@@ -11,10 +11,11 @@
<result column="time_end" jdbcType="VARCHAR" property="timeEnd"/> <result column="time_end" jdbcType="VARCHAR" property="timeEnd"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="enable" jdbcType="TINYINT" property="enable"/>
</resultMap> </resultMap>


<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`msg_amount`,`coupon_amount`,`coupon_day`,`time_start`,`time_end`,`create_time`,`update_time`
`id`,`tenant_id`,`msg_amount`,`coupon_amount`,`coupon_day`,`time_start`,`time_end`,`create_time`,`update_time`,`enable`
</sql> </sql>


<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">
@@ -55,6 +56,9 @@
<if test=" null != updateTime "> <if test=" null != updateTime ">
and `update_time` = #{updateTime} and `update_time` = #{updateTime}
</if> </if>
<if test=" null != enable ">
and `enable` = #{enable}
</if>
<if test=" null != ids "> <if test=" null != ids ">
and id in and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


Načítá se…
Zrušit
Uložit