|
|
@ -271,19 +271,21 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
//查询最新的二维码数据
|
|
|
//查询最新的二维码数据
|
|
|
QrCodeGenerateHistory qrCodeGenerateHistory1 = |
|
|
QrCodeGenerateHistory qrCodeGenerateHistory1 = |
|
|
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber()); |
|
|
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber()); |
|
|
//判断二维码生成时间
|
|
|
if(BeanUtil.isNotEmpty(qrCodeGenerateHistory1)){ |
|
|
Instant instant = qrCodeGenerateHistory1.getGenerateTime().toInstant(); |
|
|
//判断二维码生成时间
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
Instant instant = qrCodeGenerateHistory1.getGenerateTime().toInstant(); |
|
|
// atZone()方法返回在指定时区从此Instant生成的ZonedDateTime。
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
LocalDateTime date1 = instant.atZone(zoneId).toLocalDateTime(); |
|
|
// atZone()方法返回在指定时区从此Instant生成的ZonedDateTime。
|
|
|
//当前时间
|
|
|
LocalDateTime date1 = instant.atZone(zoneId).toLocalDateTime(); |
|
|
LocalDateTime date2 = LocalDateTime.now(); |
|
|
//当前时间
|
|
|
//判断相差多少个小时
|
|
|
LocalDateTime date2 = LocalDateTime.now(); |
|
|
long hoursDiff = ChronoUnit.HOURS.between(date1, date2); |
|
|
//判断相差多少个小时
|
|
|
if (hoursDiff < 24) { |
|
|
long hoursDiff = ChronoUnit.HOURS.between(date1, date2); |
|
|
log.error("二维码生成时间不足24小时"); |
|
|
if (hoursDiff < 24) { |
|
|
return 0; |
|
|
log.error("二维码生成时间不足24小时"); |
|
|
} |
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 企业添加成功,生成企业二维码
|
|
|
// 企业添加成功,生成企业二维码
|
|
|
String uuid = IdUtil.simpleUUID(); |
|
|
String uuid = IdUtil.simpleUUID(); |
|
|
Map<String, String> jsonMap = new HashMap<>(); |
|
|
Map<String, String> jsonMap = new HashMap<>(); |
|
|
@ -319,6 +321,75 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
return i; |
|
|
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); |
|
|
enterpriseInformation = enterpriseInformationMapper.selectEnterpriseInformationByNum(cid); |
|
|
log.info("企业信息表中查询企业信息,企业:{}", JSONObject.toJSONString(enterpriseInformation)); |
|
|
log.info("企业信息表中查询企业信息,企业:{}", JSONObject.toJSONString(enterpriseInformation)); |
|
|
|
|
|
|
|
|
if(BeanUtil.isEmpty(enterpriseInformation) && |
|
|
//判断企业信息为空
|
|
|
StringUtils.isEmpty(enterpriseInformation.getEnterpriseNumber())){ |
|
|
if(BeanUtil.isEmpty(enterpriseInformation)){ |
|
|
enterpriseInformation = ssztJbxx110497Service.selectSsztJbxx110497ByCode(cid); |
|
|
enterpriseInformation = ssztJbxx110497Service.selectSsztJbxx110497ByCode(cid); |
|
|
if(BeanUtil.isNotEmpty(enterpriseInformation) && |
|
|
if(BeanUtil.isNotEmpty(enterpriseInformation) && |
|
|
StringUtils.isNotEmpty(enterpriseInformation.getEnterpriseNumber())){ |
|
|
StringUtils.isNotEmpty(enterpriseInformation.getEnterpriseNumber())){ |
|
|
@ -464,17 +535,15 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
StringUtils.isNotEmpty(qrCodeGenerateHistory.getQrCodeUrl())){ |
|
|
StringUtils.isNotEmpty(qrCodeGenerateHistory.getQrCodeUrl())){ |
|
|
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory); |
|
|
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory); |
|
|
}else{ |
|
|
}else{ |
|
|
//生成企业监督码
|
|
|
//生成企业监督码二维码
|
|
|
this.generateQrCode(enterpriseInformation.getEnterpriseNumber()); |
|
|
QrCodeGenerateHistory qrCodeGenerateHistory1 = this.generateQrCodeWithReturn(enterpriseInformation.getEnterpriseNumber()); |
|
|
//查询企业二维码
|
|
|
|
|
|
QrCodeGenerateHistory qrCodeGenerateHistory1 = |
|
|
|
|
|
iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseInformation.getEnterpriseNumber()); |
|
|
|
|
|
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory1); |
|
|
enterpriseInformation.setQrCodeGenerateHistory(qrCodeGenerateHistory1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return enterpriseInformation; |
|
|
return enterpriseInformation; |
|
|
}else { |
|
|
}else { |
|
|
|
|
|
log.error("企业营业执照二维码中不存在企业统一信用代码,访问地址:{}",url); |
|
|
//爬取页面统一信用代码
|
|
|
//爬取页面统一信用代码
|
|
|
String s = CrawlerUtil.getCreditCode(url); |
|
|
String s = CrawlerUtil.getCreditCode(url); |
|
|
if (StringUtils.isNotEmpty(s)) { |
|
|
if (StringUtils.isNotEmpty(s)) { |
|
|
|