Commit 448a6f5a authored by suhuiguang's avatar suhuiguang

1.代码优化

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