Quellcode durchsuchen

核心业务 可以按单位更新数据

master
PoffyZhang vor 1 Jahr
Ursprung
Commit
2b091d21bd
3 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java
  3. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java Datei anzeigen

@@ -61,7 +61,7 @@ public class IrsController {

@ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务")
@GetMapping("/refresh-core-biz")
public void refreshCoreBiz() throws UnknownHostException {
projectCoreBizTask.doTask();
public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException {
projectCoreBizTask.doTask(orgCode);
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java Datei anzeigen

@@ -80,7 +80,7 @@ public class ProjectIrsManage {

ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class);
JSONObject body = forEntity.getBody();
log.info("core biz :{}",body);
JSONObject datas = body.getJSONObject("datas");
if(Objects.nonNull(datas)){
return datas;


+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java Datei anzeigen

@@ -64,7 +64,7 @@ public class SynProjectCoreBizTask {
*
*/
@Scheduled(cron = "0 0 2 * * ?")
public void doTask() throws UnknownHostException {
public void doTask(String orgCode) throws UnknownHostException {
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) {
log.info("定时器没开启或者host不对! {}:{}",
HOST,InetAddress.getLocalHost().getHostName());
@@ -77,7 +77,8 @@ public class SynProjectCoreBizTask {

List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE
, DingOrganizationContant.GOV_TEMPORARY)));
, DingOrganizationContant.GOV_TEMPORARY))
.eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode));

log.info("总共需要同步 orgs size :{}",orgs.size());

@@ -93,6 +94,7 @@ public class SynProjectCoreBizTask {

//去请求IRS接口
JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1);

JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA);
if(CollUtil.isNotEmpty(jsonArray)){
jsonArray.forEach(j -> {


Laden…
Abbrechen
Speichern