Browse Source

提交整合市监企业信息表同步至企业信息业务表

扫码市监二维码后台开发
v4
chenrui 2 years ago
parent
commit
584164822e
  1. 7
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnterpriseInformationService.java
  2. 83
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java

7
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnterpriseInformationService.java

@ -1,6 +1,7 @@
package com.zdxt.code.service;
import com.zdxt.code.domain.EnterpriseInformation;
import com.zdxt.code.domain.QrCodeGenerateHistory;
import com.zdxt.code.domain.SearchType;
import com.zdxt.code.domain.StatisticsIndicator;
@ -86,6 +87,12 @@ public interface IEnterpriseInformationService
* @return
*/
int generateQrCode(String enterpriseNumber);
/**
* 二维码生成 返回二维码信息
* @param enterpriseNumber
* @return
*/
QrCodeGenerateHistory generateQrCodeWithReturn(String enterpriseNumber);
/**
* 删除企业信息登记信息

83
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java

@ -271,6 +271,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
//查询最新的二维码数据
QrCodeGenerateHistory qrCodeGenerateHistory1 =
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber());
if(BeanUtil.isNotEmpty(qrCodeGenerateHistory1)){
//判断二维码生成时间
Instant instant = qrCodeGenerateHistory1.getGenerateTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault();
@ -284,6 +285,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
log.error("二维码生成时间不足24小时");
return 0;
}
}
// 企业添加成功,生成企业二维码
String uuid = IdUtil.simpleUUID();
Map<String, String> jsonMap = new HashMap<>();
@ -319,6 +321,75 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
return i;
}
@Override
public QrCodeGenerateHistory generateQrCodeWithReturn(String enterpriseNumber) {
EnterpriseInformation enterpriseInformation = new EnterpriseInformation();
enterpriseInformation.setEnterpriseNumber(enterpriseNumber);
List<EnterpriseInformation> enterpriseInformations = enterpriseInformationMapper.selectEnterpriseInformationList(enterpriseInformation);
if (enterpriseInformations.size() == 0) {
return null;
}
//生成企业统一信用代码盐
String salt = PasswordTools.encrypt(enterpriseInformation.getEnterpriseNumber());
//查询最新的二维码数据
QrCodeGenerateHistory qrCodeGenerateHistory1 =
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber());
if(BeanUtil.isNotEmpty(qrCodeGenerateHistory1)) {
//判断二维码生成时间
Instant instant = qrCodeGenerateHistory1.getGenerateTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault();
// atZone()方法返回在指定时区从此Instant生成的ZonedDateTime。
LocalDateTime date1 = instant.atZone(zoneId).toLocalDateTime();
//当前时间
LocalDateTime date2 = LocalDateTime.now();
//判断相差多少个小时
long hoursDiff = ChronoUnit.HOURS.between(date1, date2);
if (hoursDiff < 24) {
log.error("二维码生成时间不足24小时");
return null;
}
}
// 企业添加成功,生成企业二维码
String uuid = IdUtil.simpleUUID();
Map<String, String> jsonMap = new HashMap<>();
jsonMap.put("salt", salt);
jsonMap.put("codeId", uuid);
jsonMap.put("type", "zfjd");
String text = JSON.toJSONString(jsonMap);
//这里设置自定义网站url
String logoPath = qrCodeUrl;
String upload = null;
try {
File encode = QRCodeUtil.encodeFile(text, logoPath, filePath, true);
MultipartFile multipartFile = QRCodeUtil.getMultipartFile(encode);
upload = fileUploadApi.upload(multipartFile);
} catch (Exception e) {
e.printStackTrace();
}
//作废之前的二维码数据
qrCodeGenerateHistory1.setStatus(1);
iQrCodeGenerateHistoryService.updateQrCodeGenerateHistory(qrCodeGenerateHistory1);
//重新生成二维码
QrCodeGenerateHistory qrCodeGenerateHistory = new QrCodeGenerateHistory();
qrCodeGenerateHistory.setId(uuid);
//生成时间
qrCodeGenerateHistory.setGenerateTime(DateUtils.getNowDate());
//二维码地址
qrCodeGenerateHistory.setQrCodeUrl(upload);
//统一信用代码
qrCodeGenerateHistory.setEnterpriseNumber(enterpriseInformation.getEnterpriseNumber());
//变更原因
qrCodeGenerateHistory.setReasonsChange("登记");
int i = iQrCodeGenerateHistoryService.insertQrCodeGenerateHistory(qrCodeGenerateHistory);
if( i > 0){
return qrCodeGenerateHistory;
}else{
return null;
}
}
/**
* 删除企业信息登记信息
*
@ -439,8 +510,8 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
enterpriseInformation = enterpriseInformationMapper.selectEnterpriseInformationByNum(cid);
log.info("企业信息表中查询企业信息,企业:{}", JSONObject.toJSONString(enterpriseInformation));
if(BeanUtil.isEmpty(enterpriseInformation) &&
StringUtils.isEmpty(enterpriseInformation.getEnterpriseNumber())){
//判断企业信息为空
if(BeanUtil.isEmpty(enterpriseInformation)){
enterpriseInformation = ssztJbxx110497Service.selectSsztJbxx110497ByCode(cid);
if(BeanUtil.isNotEmpty(enterpriseInformation) &&
StringUtils.isNotEmpty(enterpriseInformation.getEnterpriseNumber())){
@ -464,17 +535,15 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
StringUtils.isNotEmpty(qrCodeGenerateHistory.getQrCodeUrl())){
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory);
}else{
//生成企业监督码
this.generateQrCode(enterpriseInformation.getEnterpriseNumber());
//查询企业二维码
QrCodeGenerateHistory qrCodeGenerateHistory1 =
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber());
//生成企业监督码二维码
QrCodeGenerateHistory qrCodeGenerateHistory1 = this.generateQrCodeWithReturn(enterpriseInformation.getEnterpriseNumber());
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory1);
}
}
return enterpriseInformation;
}else {
log.error("企业营业执照二维码中不存在企业统一信用代码,访问地址:{}",url);
//爬取页面统一信用代码
String s = CrawlerUtil.getCreditCode(url);
if (StringUtils.isNotEmpty(s)) {

Loading…
Cancel
Save