Commit 3a96d22f authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents ef91da76 5710dcc4
...@@ -48,34 +48,39 @@ public class OrgSyncJob extends QuartzJobBean { ...@@ -48,34 +48,39 @@ public class OrgSyncJob extends QuartzJobBean {
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("token", token); headers.put("token", token);
headers.put("Content-Type", "application/x-www-form-urlencoded"); headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Idap", "eddie.wu_v");
int pageSize = 1;
try { try {
// todo 这里要加分页查询的参数 for (int i = 1; i <= pageSize; i++) {
String response = HttpUtil.get(orgSyncUrl, headers); String response = HttpUtil.get(orgSyncUrl+"?currentPage="+i, headers);
DDSyncOrgInfo ddSyncOrgInfo = JSONObject.parseObject(response, DDSyncOrgInfo.class); DDSyncOrgInfo ddSyncOrgInfo = JSONObject.parseObject(response, DDSyncOrgInfo.class);
List<OrgSyncData> orgSyncDatas = ddSyncOrgInfo.getData(); pageSize = ddSyncOrgInfo.getPageSize();
orgSyncDatas.forEach(osd -> { List<OrgSyncData> orgSyncDatas = ddSyncOrgInfo.getData();
OrganizationExample example = new OrganizationExample(); orgSyncDatas.forEach(osd -> {
example.createCriteria().andNameEqualTo(osd.getNameCN()); OrganizationExample example = new OrganizationExample();
Organization o = new Organization(); example.createCriteria().andNameEqualTo(osd.getNameCN());
o.setClientCode(osd.getCode()); Organization o = new Organization();
o.setCode(osd.getCode()); o.setClientCode(osd.getCode());
o.setEnterpriseAccountCode(String.valueOf(osd.getSobId())); o.setCode(osd.getCode());
o.setEnterpriseAccountName(osd.getSobName()); o.setEnterpriseAccountCode(String.valueOf(osd.getSobId()));
o.setCurrencyCode(osd.getCurrencyCode()); o.setEnterpriseAccountName(osd.getSobName());
o.setLegalEntity(osd.getLegalEntity()); o.setCurrencyCode(osd.getCurrencyCode());
o.setLegalPersonName(osd.getLegalRepresentative()); o.setLegalEntity(osd.getLegalEntity());
o.setAddress(osd.getAddress()); o.setLegalPersonName(osd.getLegalRepresentative());
o.setCreateTime(osd.getGmtCreate()); o.setAddress(osd.getAddress());
o.setUpdateTime(osd.getGmtModified()); o.setCreateTime(osd.getGmtCreate());
o.setPsCode(osd.getPsCode()); o.setUpdateTime(osd.getGmtModified());
RegionExample regionExample = new RegionExample(); o.setPsCode(osd.getPsCode());
regionExample.createCriteria().andShortNameEqualTo(osd.getCompanyLocation()); RegionExample regionExample = new RegionExample();
List<Region> regions = regionMapper.selectByExample(regionExample); regionExample.createCriteria().andShortNameEqualTo(osd.getCompanyLocation());
if (regions.size() > 0) { List<Region> regions = regionMapper.selectByExample(regionExample);
o.setRegionId(regions.get(0).getId()); if (regions.size() > 0) {
} o.setRegionId(regions.get(0).getId());
organizationMapper.updateByExampleSelective(o, example); }
}); organizationMapper.updateByExampleSelective(o, example);
});
}
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("机构信息同步异常:[%s]", e.getMessage()), e); logger.error(String.format("机构信息同步异常:[%s]", e.getMessage()), e);
} }
......
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