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

[消息组件][添加][添加账单邮件通知]

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
6c3d421cf6
3 измененных файлов: 51 добавлений и 4 удалений
  1. +11
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/WxTopicController.java
  2. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumWxTopicStatus.java
  3. +3
    -4
      mallinkService/src/main/resources/mapper/WxTopicMapper.xml

+ 11
- 0
mallinkAdmin/src/main/java/com/iformall/controller/WxTopicController.java Просмотреть файл

@@ -3,6 +3,8 @@ package com.iformall.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.enums.EnumCouponChannelActivityStatus;
import com.iformall.enums.EnumWxTopicStatus;
import com.iformall.service.*; import com.iformall.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -12,6 +14,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import java.util.Date;

@RestController @RestController
@RequestMapping("topic") @RequestMapping("topic")
@Api(description = "专题相关接口") @Api(description = "专题相关接口")
@@ -29,6 +33,13 @@ public class WxTopicController extends BaseController {
String tenantId = getTenantId(); String tenantId = getTenantId();
wxTopic.setTenantId(tenantId); wxTopic.setTenantId(tenantId);
PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize);

Date now = new Date();
page.getList().stream().forEach(cc->{
if (cc.getEndTime()!=null && now.getTime() > cc.getEndTime().getTime()) {
cc.setStatus(EnumWxTopicStatus.INVAILD.getCode());
}
});
return new ResultData(page); return new ResultData(page);
} }




+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumWxTopicStatus.java Просмотреть файл

@@ -0,0 +1,37 @@
package com.iformall.enums;

/**
* Created by luozukai
* 状态1生效2失效3作废
*/
public enum EnumWxTopicStatus {
VAILD(1, "有效"),
INVAILD(2, "无效"),
CANCLE(3, "作废")
;

public static EnumWxTopicStatus getEnum(Integer code) {
for (EnumWxTopicStatus value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumWxTopicStatus(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 3
- 4
mallinkService/src/main/resources/mapper/WxTopicMapper.xml Просмотреть файл

@@ -18,8 +18,7 @@
</resultMap> </resultMap>


<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`name`,`title`,content,cover,advert,begin_time,end_time,createtime,updatetime,
if(now() > end_time,2,status) as status
`id`,`tenant_id`,`name`,`title`,content,cover,advert,begin_time,end_time,createtime,updatetime
</sql> </sql>


<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">
@@ -46,9 +45,9 @@
</if> </if>
order by createtime desc order by createtime desc
</sql> </sql>
<select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_topic
select * from wx_topic
<include refid="dynamicWhereConditions" /> <include refid="dynamicWhereConditions" />
</select> </select>




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