机场项目推送人员证书和bug修复
This commit is contained in:
parent
a45d977ca2
commit
a3c37ec58d
@ -138,7 +138,7 @@ public class JcCall {
|
||||
JcHttpUtil.UserSyncRequest.CertificateInfo certificateInfo = new JcHttpUtil.UserSyncRequest.CertificateInfo();
|
||||
if (StrUtil.isNotBlank(o.get("photoUrl"))) {
|
||||
try {
|
||||
certificateInfo.setCertificate(PathUtil.getServerUrl() + "/image/" + FileUtils.urlToFileName(o.get("photoUrl")));
|
||||
certificateInfo.setCertificate(FileUtils.getOnlineUrl(o.get("photoUrl")));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.call.JcCall;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerBlacklist;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerCertificate;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
@ -13,9 +14,11 @@ import com.zhgd.xmgl.modules.worker.mapper.WorkerBlacklistMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerCertificateMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerCertificateService;
|
||||
import com.zhgd.xmgl.util.AsyncTaskUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -41,6 +44,9 @@ public class WorkerCertificateServiceImpl extends ServiceImpl<WorkerCertificateM
|
||||
private WorkerBlacklistMapper workerBlacklistMapper;
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private JcCall jcCall;
|
||||
|
||||
|
||||
@Override
|
||||
@ -69,6 +75,14 @@ public class WorkerCertificateServiceImpl extends ServiceImpl<WorkerCertificateM
|
||||
updateById(workerCertificate);
|
||||
|
||||
updateExpired(workerCertificate);
|
||||
jcSendWorker(workerCertificate);
|
||||
}
|
||||
|
||||
private void jcSendWorker(WorkerCertificate workerCertificate) {
|
||||
AsyncTaskUtil.runAsync(() -> {
|
||||
WorkerInfo workerInfo = workerInfoMapper.selectById(workerCertificate.getWorkerId());
|
||||
jcCall.sendSaveWorkerInfoByJc(workerInfo);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,6 +93,7 @@ public class WorkerCertificateServiceImpl extends ServiceImpl<WorkerCertificateM
|
||||
save(workerCertificate);
|
||||
|
||||
updateExpired(workerCertificate);
|
||||
jcSendWorker(workerCertificate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,6 +101,7 @@ public class WorkerCertificateServiceImpl extends ServiceImpl<WorkerCertificateM
|
||||
WorkerCertificate workerCertificate = baseMapper.selectById(id);
|
||||
baseMapper.deleteById(id);
|
||||
updateExpired(workerCertificate);
|
||||
jcSendWorker(workerCertificate);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* url(如:xxx*xxxx,xxx*xxxx,[],xxx.jpg等等)转换成本地文件名称
|
||||
* url(如:xxx*xxxx,xxx*xxxx,[],xxx.jpg等等)转换成文件命名
|
||||
*
|
||||
* @param fileUrl
|
||||
* @return
|
||||
@ -196,11 +196,32 @@ public class FileUtils {
|
||||
return new File(PathUtil.getBasePath() + "/" + fileUrl1).getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* url(如:xxx*xxxx,xxx*xxxx,[],xxx.jpg等等)转换成本地文件名称
|
||||
*
|
||||
* @param fileUrl
|
||||
* @return
|
||||
*/
|
||||
public static String urlToLocalFileName(String fileUrl) {
|
||||
List<FileObj> fileObjs = parseUrlString(fileUrl);
|
||||
if (CollUtil.isEmpty(fileObjs)) {
|
||||
return null;
|
||||
}
|
||||
String fileUrl1 = fileObjs.get(0).getFileUrl();
|
||||
if (StrUtil.isBlank(fileUrl1)) {
|
||||
return null;
|
||||
}
|
||||
if (fileUrl1.contains("http:") || fileUrl1.contains("https:")) {
|
||||
fileUrl1 = StringUtils.substringAfter(fileUrl1, "/image/");
|
||||
}
|
||||
return fileUrl1;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(urlToFileName("图片2.png*http://jxj.zhgdyun.com:21000/image/0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToFileName("文件名称.png*0012710f3eac4542b30314130873ae6e.png"));
|
||||
System.out.println(urlToFileName("0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToFileName("0012710f3eac4542b30314130873ae6e.png,123.png"));
|
||||
System.out.println(urlToLocalFileName("图片2.png*http://jxj.zhgdyun.com:21000/image/0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToLocalFileName("文件名称.png*0012710f3eac4542b30314130873ae6e.png"));
|
||||
System.out.println(urlToLocalFileName("0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToLocalFileName("0012710f3eac4542b30314130873ae6e.png,123.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +234,7 @@ public class FileUtils {
|
||||
String getUrl = null;
|
||||
if (StrUtil.isNotBlank(url)) {
|
||||
try {
|
||||
getUrl = PathUtil.getServerUrl() + "/image/" + FileUtils.urlToFileName(url);
|
||||
getUrl = PathUtil.getServerUrl() + "/image/" + FileUtils.urlToLocalFileName(url);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user