Commit 9c49ccf5 authored by 钱坤's avatar 钱坤

早报发送的长链改为短链

新增后门接口强制重发某个机构某日的早报,
parent e0a56e9f
package com.tanpu.feo.feojob.controller; package com.tanpu.feo.feojob.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.feo.feojob.dao.user.entity.DaySubjectEntity;
import com.tanpu.feo.feojob.dto.OrgSyncDto; import com.tanpu.feo.feojob.dto.OrgSyncDto;
import com.tanpu.feo.feojob.jobs.DaySubJob; import com.tanpu.feo.feojob.jobs.DaySubJob;
import com.tanpu.feo.feojob.jobs.OrgSyncByWxcpJob; import com.tanpu.feo.feojob.jobs.OrgSyncByWxcpJob;
...@@ -9,13 +11,13 @@ import com.tanpu.feo.feojob.service.OrgSyncByJyzyService; ...@@ -9,13 +11,13 @@ import com.tanpu.feo.feojob.service.OrgSyncByJyzyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "手动执行 早报推送") @Api(tags = "手动执行 早报推送")
...@@ -33,4 +35,15 @@ public class DaySubjectController { ...@@ -33,4 +35,15 @@ public class DaySubjectController {
return CommonResp.success("执行完成"); return CommonResp.success("执行完成");
} }
@RequestMapping(value = "/sendOneOrgDaySubject", method = RequestMethod.GET)
@ApiOperation(value = "单机构早报推送")
public CommonResp<String> sendOneOrgDaySubject(@RequestParam String orgId, @RequestParam String date) {
List<DaySubjectEntity> daySubjectList = daySubJob.getDaySubject(date, orgId);
List<DaySubjectEntity> list = daySubjectList.stream().filter(p -> StringUtils.equals(p.getDsPt(), orgId))
.collect(Collectors.toList());
String oneMorningTitle = daySubJob.getOneMorningTitle();
daySubJob.sendDaySubject(orgId, list, oneMorningTitle);
return CommonResp.success("执行完成");
}
} }
package com.tanpu.feo.feojob.feign.shorter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@FeignClient(value = "shorturl", url = "${tanpu.feo-shorter.svc:}", path = "/")
public interface ShorterFeign {
@PostMapping("/shorter/get")
ShorterResp getShorter(String url);
}
package com.tanpu.feo.feojob.feign.shorter;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class ShorterResp<T> {
private int code;
private String msg;
private T result;
public ShorterResp(int code, String msg) {
this.code = code;
this.msg = msg;
}
public boolean isSuccess() {
return code == 200;
}
public boolean isNotSuccess() {
return !isSuccess();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment