|
@@ -20,10 +20,11 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 消息管理
|
|
@@ -41,6 +42,7 @@ public class WxMessageController {
|
|
|
private final ApplicationPortRefService applicationPortRefService;
|
|
|
private final TemplateMessageService templateMessageService;
|
|
|
|
|
|
+
|
|
|
public WxMessageController(AppMsgRefService appMsgRefService, MessageService messageService, AppmsgService appmsgService
|
|
|
, ApplicationPortRefService applicationPortRefService , TemplateMessageService templateMessageService){
|
|
|
this.appMsgRefService=appMsgRefService;
|
|
@@ -217,9 +219,30 @@ public class WxMessageController {
|
|
|
* 模板消息配置列表页
|
|
|
*/
|
|
|
@PostMapping("/getTemplateMsgOfPage/{appId}")
|
|
|
- public ResultInfo getTemplateMsgOfPage(@PathVariable String appId,@RequestBody FiltersData filtersData){
|
|
|
+ public ResultInfo getTemplateMsgOfPage(@PathVariable String appId,@RequestBody FiltersData filtersData) throws ParseException {
|
|
|
if(StringUtils.isEmpty(appId))
|
|
|
return new ResultInfo(ResultInfo.TYPE_RESULT_FAIL,20002,"appId不能为空");
|
|
|
+ Iterator<FiltersUtils> iterator = filtersData.getFilters().iterator();
|
|
|
+ FiltersUtils newFilter=null;
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ FiltersUtils f=iterator.next();
|
|
|
+ if(!StringUtils.isEmpty(f.getValue())){
|
|
|
+ if("sendTime".equals(f.getField())){
|
|
|
+ if("equal".equals(f.getOperate())){
|
|
|
+ f.setOperate("greaterorequal");
|
|
|
+ DateTimeFormatter dateTimeFormatter= DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LocalDate localDay=LocalDate.parse(f.getValue(), dateTimeFormatter);
|
|
|
+ localDay=localDay.plusDays(1L);
|
|
|
+ newFilter=new FiltersUtils();
|
|
|
+ newFilter.setField("sendTime");
|
|
|
+ newFilter.setOperate("less");
|
|
|
+ newFilter.setValue(localDay.format(dateTimeFormatter));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newFilter!=null)
|
|
|
+ filtersData.getFilters().add(newFilter);
|
|
|
String filterSql=filtersData.getFilterString();
|
|
|
List<TemplateMessage>list= templateMessageService.getListOfPage(filterSql,appId,(filtersData.getPageIndex()-1)*filtersData.getPageSize(),filtersData.getPageSize());
|
|
|
int count=0;
|