Просмотр исходного кода

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

release_toaliyun_real
Stormeye Wu 7 лет назад
Родитель
Сommit
005d6061c8
4 измененных файлов: 26 добавлений и 4 удалений
  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 Просмотреть файл

@@ -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 Просмотреть файл

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

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

public static enum Field
{


+ 14
- 0
mallinkService/src/main/java/com/iformall/service/impl/PushLimitServiceImpl.java Просмотреть файл

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


+ 5
- 1
mallinkService/src/main/resources/mapper/PushLimitMapper.xml Просмотреть файл

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

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


Загрузка…
Отмена
Сохранить