Commit 448a6f5a authored by suhuiguang's avatar suhuiguang

1.代码优化

parent 8e68ea21
...@@ -160,9 +160,9 @@ ...@@ -160,9 +160,9 @@
from from
tz_base_enterprise_info tz_base_enterprise_info
where where
qr_code <![CDATA[<>]]> '' (qr_code is null or LENGTH(qr_code) = 0)
and use_code <![CDATA[<>]]> '' and use_code <![CDATA[<>]]> ''
limit 100 limit 1000
</select> </select>
</mapper> </mapper>
...@@ -236,21 +236,26 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -236,21 +236,26 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
} }
@Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}") @Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}")
public void asyncSetQrCode(){ public void asyncSetQrCode() {
//给所有新注册的企业创建二维码,每次处理100个,不排序 // 给所有新注册的企业创建二维码,每次处理100个,不排序
if(log.isDebugEnabled()){ if (log.isDebugEnabled()) {
log.debug("新注册企业二维码生成开始"); log.debug("新注册企业二维码生成开始");
} }
List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode(); List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode();
if(noQrCodeList.isEmpty()){ if (noQrCodeList.isEmpty()) {
if(log.isDebugEnabled()){ if (log.isDebugEnabled()) {
log.debug("暂无待生成二维码的企业"); log.debug("暂无待生成二维码的企业");
} }
return; return;
} }
noQrCodeList.forEach(e-> e.setQrCode(createQRCode(e.getUseCode())));
noQrCodeList.parallelStream().forEach(enterpriseInfo -> {
enterpriseInfo.setQrCode(createQRCode(enterpriseInfo.getUseCode()));
});
tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList); tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList);
if(log.isDebugEnabled()){
if (log.isDebugEnabled()) {
log.debug("新注册企业二维码生成结束"); log.debug("新注册企业二维码生成结束");
} }
} }
......
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