金筑工实名制同步数据
This commit is contained in:
parent
d78537bd28
commit
11aa7cd217
@ -58,7 +58,7 @@ public class ProjectEnterpriseServiceImpl extends ServiceImpl<ProjectEnterpriseM
|
||||
List<String> projectSnList = projectService.getProjectSnList(projectSn);
|
||||
map.put("projectSnList", projectSnList);
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
if (Objects.equals(user.getAccountType(), 6)) {
|
||||
if (user != null && Objects.equals(user.getAccountType(), 6)) {
|
||||
//项目子账号就筛选自己能看到的
|
||||
Long userId = user.getUserId();
|
||||
UserEnterprise userEnterprise = userEnterpriseMapper.selectOne(new LambdaQueryWrapper<UserEnterprise>().eq(UserEnterprise::getUserId, userId));
|
||||
|
||||
@ -775,7 +775,7 @@
|
||||
SELECT count(t1.daytime) num, DATE_FORMAT(t1.daytime, '%m-%d') time
|
||||
FROM (
|
||||
SELECT wa.create_time,
|
||||
DATE_FORMAT(wa.create_time,'%Y-%m-%d') daytime,
|
||||
DATE_FORMAT(wa.create_time, '%Y-%m-%d') daytime,
|
||||
wa.person_sn
|
||||
FROM worker_attendance wa
|
||||
JOIN worker_info wi ON wi.person_sn = wa.person_sn
|
||||
@ -784,7 +784,7 @@
|
||||
and DATE_FORMAT(wa.create_time, '%Y-%m-%d') >= #{queryStartTime}
|
||||
</if>
|
||||
<if test="queryEndTime != null and queryEndTime != ''">
|
||||
and DATE_FORMAT(wa.create_time, '%Y-%m-%d') <![CDATA[<=]]> concat(#{queryEndTime},' 23:59:59')
|
||||
and DATE_FORMAT(wa.create_time, '%Y-%m-%d') <![CDATA[<=]]> concat(#{queryEndTime}, ' 23:59:59')
|
||||
</if>
|
||||
and wa.project_sn = #{projectSn}
|
||||
AND wi.inService_type = 1
|
||||
@ -795,15 +795,14 @@
|
||||
</select>
|
||||
|
||||
<select id="queryPresenceList" resultType="com.zhgd.xmgl.modules.worker.entity.WorkerAttendance">
|
||||
SELECT a.* FROM worker_attendance a WHERE a.id in (
|
||||
SELECT
|
||||
max( id )
|
||||
FROM
|
||||
`worker_attendance`
|
||||
WHERE
|
||||
project_sn = #{projectSn}
|
||||
AND create_time > DATE_SUB(CURRENT_DATE,INTERVAL 1 day)
|
||||
GROUP BY
|
||||
person_sn ) AND a.pass_type = 1
|
||||
SELECT a.*
|
||||
FROM worker_attendance a
|
||||
WHERE a.id in (
|
||||
SELECT max(id)
|
||||
FROM `worker_attendance`
|
||||
WHERE project_sn = #{projectSn}
|
||||
AND create_time > CURRENT_DATE
|
||||
GROUP BY person_sn)
|
||||
AND a.pass_type = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -275,30 +275,26 @@ public class JzgTask {
|
||||
wi.setSex(Integer.valueOf(jzg.getGender()));
|
||||
wi.setNation(getNation(jzg.getNation()));
|
||||
if (StrUtil.isNotBlank(jzg.getIssueCardPicUrl())) {
|
||||
String file = owi.getFieldAcquisitionUrl();
|
||||
if (StrUtil.isNotBlank(file)) {
|
||||
FileUtil.del(new File(path, file));
|
||||
if (owi != null) {
|
||||
deleteFile(owi.getFieldAcquisitionUrl());
|
||||
}
|
||||
wi.setFieldAcquisitionUrl(uploadFileService.uploadUrlResourceRtName(jzg.getIssueCardPicUrl()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(jzg.getHeadImageUrl())) {
|
||||
String file = owi.getIdCardBigPhotoUrl();
|
||||
if (StrUtil.isNotBlank(file)) {
|
||||
FileUtil.del(new File(path, file));
|
||||
if (owi != null) {
|
||||
deleteFile(owi.getIdCardBigPhotoUrl());
|
||||
}
|
||||
wi.setIdCardBigPhotoUrl(uploadFileService.uploadUrlResourceRtName(jzg.getHeadImageUrl()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(jzg.getPositiveIdCardImageUrl())) {
|
||||
String file = owi.getIdCardUpPhotoUrl();
|
||||
if (StrUtil.isNotBlank(file)) {
|
||||
FileUtil.del(new File(path, file));
|
||||
if (owi != null) {
|
||||
deleteFile(owi.getIdCardUpPhotoUrl());
|
||||
}
|
||||
wi.setIdCardUpPhotoUrl(uploadFileService.uploadUrlResourceRtName(jzg.getPositiveIdCardImageUrl()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(jzg.getNegativeIdCardImageUrl())) {
|
||||
String file = owi.getIdCardDownPhotoUrl();
|
||||
if (StrUtil.isNotBlank(file)) {
|
||||
FileUtil.del(new File(path, file));
|
||||
if (owi != null) {
|
||||
deleteFile(owi.getIdCardDownPhotoUrl());
|
||||
}
|
||||
wi.setIdCardDownPhotoUrl(uploadFileService.uploadUrlResourceRtName(jzg.getNegativeIdCardImageUrl()));
|
||||
}
|
||||
@ -325,6 +321,12 @@ public class JzgTask {
|
||||
return wi;
|
||||
}
|
||||
|
||||
private void deleteFile(String file) {
|
||||
if (StrUtil.isNotBlank(file)) {
|
||||
FileUtil.del(new File(path, file));
|
||||
}
|
||||
}
|
||||
|
||||
private WorkerInfo getManagerInfo(JzgManagerInfo jzg, WorkerInfo owi, String projectSn) {
|
||||
WorkerInfo wi = new WorkerInfo();
|
||||
wi.setId(owi != null ? owi.getId() : null);
|
||||
@ -800,29 +802,33 @@ public class JzgTask {
|
||||
|
||||
private void syncEnterpriseInfo(String appKey, String appSecret, String projectCode, String projectSn, String host) {
|
||||
JzgRt jzgRt = jzgPost(appKey, appSecret, projectCode, "/api/v1/getCompanyInfo", new JSONObject(), host);
|
||||
String data = jzgRt.getData();
|
||||
HashMap<String, Object> eMap = new HashMap<>();
|
||||
eMap.put("projectSn", projectSn);
|
||||
eMap.put("pageNo", "1");
|
||||
eMap.put("pageSize", "9999999");
|
||||
List<EnterpriseInfo> records = projectEnterpriseService.selectProjectEnterprisePage(eMap).getRecords();
|
||||
Map<String, EnterpriseInfo> recordMap = records.stream().collect(Collectors.toMap(o -> o.getSocialCode(), Function.identity()));
|
||||
ArrayList<JzgEnterpriseInfo> jzgEnterpriseInfos = JSON.parseObject(data, new TypeReference<ArrayList<JzgEnterpriseInfo>>() {
|
||||
});
|
||||
Map<String, JzgEnterpriseInfo> jzgEnterpriseInfoMap = jzgEnterpriseInfos.stream().collect(Collectors.toMap(JzgEnterpriseInfo::getCorpCode, Function.identity()));
|
||||
for (JzgEnterpriseInfo jzgEnterpriseInfo : jzgEnterpriseInfos) {
|
||||
try {
|
||||
String corpCode = jzgEnterpriseInfo.getCorpCode();
|
||||
EnterpriseInfo enterpriseInfo = recordMap.get(corpCode);
|
||||
if (enterpriseInfo == null) {
|
||||
enterpriseInfoService.saveEnterpriseInfo(getEnterpriseInfo(jzgEnterpriseInfo, null, projectSn));
|
||||
} else {
|
||||
enterpriseInfoService.updateEnterpriseInfo(getEnterpriseInfo(jzgEnterpriseInfo, enterpriseInfo, projectSn));
|
||||
Map<String, JzgEnterpriseInfo> jzgEnterpriseInfoMap = new HashMap<>();
|
||||
if (jzgRt != null) {
|
||||
String data = jzgRt.getData();
|
||||
Map<String, EnterpriseInfo> recordMap = records.stream().collect(Collectors.toMap(o -> o.getSocialCode(), Function.identity()));
|
||||
ArrayList<JzgEnterpriseInfo> jzgEnterpriseInfos = JSON.parseObject(data, new TypeReference<ArrayList<JzgEnterpriseInfo>>() {
|
||||
});
|
||||
jzgEnterpriseInfoMap = jzgEnterpriseInfos.stream().collect(Collectors.toMap(JzgEnterpriseInfo::getCorpCode, Function.identity()));
|
||||
for (JzgEnterpriseInfo jzgEnterpriseInfo : jzgEnterpriseInfos) {
|
||||
try {
|
||||
String corpCode = jzgEnterpriseInfo.getCorpCode();
|
||||
EnterpriseInfo enterpriseInfo = recordMap.get(corpCode);
|
||||
if (enterpriseInfo == null) {
|
||||
enterpriseInfoService.saveEnterpriseInfo(getEnterpriseInfo(jzgEnterpriseInfo, null, projectSn));
|
||||
} else {
|
||||
enterpriseInfoService.updateEnterpriseInfo(getEnterpriseInfo(jzgEnterpriseInfo, enterpriseInfo, projectSn));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("err:", e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("err:", e);
|
||||
}
|
||||
}
|
||||
|
||||
for (EnterpriseInfo enterpriseInfo : records) {
|
||||
try {
|
||||
JzgEnterpriseInfo jzgEnterpriseInfo = jzgEnterpriseInfoMap.get(enterpriseInfo.getSocialCode());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user