REQ-3581: 同步印章名称

This commit is contained in:
yanglin 2025-03-06 18:25:52 +08:00
parent ec7a886f84
commit b3f87dc604
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,28 @@
package cn.axzo.nanopart.ess.server.ess.job;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.executor.XxlJobExecutor;
import com.xxl.job.core.handler.IJobHandler;
/**
* @author yanglin
*/
@RestController
public class JobHttpHandler {
@PostMapping("/jobs/{jobName}")
ReturnT<String> exec(@PathVariable String jobName,
@RequestBody(required = false) JSONObject paramObj) throws Exception {
IJobHandler jobHandler = XxlJobExecutor.loadJobHandler(jobName);
if (jobHandler == null)
return new ReturnT<>(ReturnT.FAIL_CODE, String.format("找不到job: %s", jobName));
return jobHandler.execute(paramObj == null ? null : paramObj.toJSONString());
}
}

View File

@ -3,6 +3,7 @@ package cn.axzo.nanopart.ess.server.ess.job;
import java.util.List;
import cn.axzo.nanopart.ess.api.enums.EssSealState;
import org.springframework.stereotype.Component;
import com.tencentcloudapi.essbasic.v20210526.models.OccupiedSeal;
@ -38,16 +39,19 @@ public class SyncSealNameJob {
@XxlJob("syncSealNameJob")
public ReturnT<String> execute(String s) {
RecordCursor<EssOrg> cursor = new RecordCursor<>(EssOrg::getId,
() -> essOrgDao.lambdaQuery().eq(EssOrg::isAuthorized, YesOrNo.YES));
() -> essOrgDao.lambdaQuery().eq(EssOrg::getIsAuthorized, YesOrNo.YES));
for (List<EssOrg> orgs : cursor) {
for (EssOrg org : orgs) {
EssPerson superAdmin = orgManager.findSuperAdmin(org.getOuId()).orElse(null);
if (superAdmin == null) continue;
for (EssSeal seal : essSealDao.getByOuId(org.getOuId())) {
try {
if (seal.getState() == EssSealState.DELETED)
continue;
OccupiedSeal sealInfo = essClient.getSealInfo(superAdmin, seal.getEssSealId());
if (sealInfo == null) continue;
essSealDao.updateSealName(seal.getEssSealId(), sealInfo.getSealName());
log.info("update seal name success, sealId: {}, sealName: {}", seal.getEssSealId(), sealInfo.getSealName());
} catch (Exception e) {
log.warn("get seal info failed, sealId: {}", seal.getEssSealId(), e);
}