|
@@ -11,9 +11,6 @@ import com.lc.ibps.cloud.file.provider.UploadProvider;
|
|
|
import com.lc.ibps.common.file.persistence.entity.AttachmentPo;
|
|
import com.lc.ibps.common.file.persistence.entity.AttachmentPo;
|
|
|
import com.lc.ibps.components.quartz.BaseJob2;
|
|
import com.lc.ibps.components.quartz.BaseJob2;
|
|
|
import com.lc.ibps.org.party.persistence.entity.DefaultPartyUserPo;
|
|
import com.lc.ibps.org.party.persistence.entity.DefaultPartyUserPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyEmployeePo;
|
|
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyEntityPo;
|
|
|
|
|
-import com.lc.ibps.platform.service.PatchService;
|
|
|
|
|
import org.quartz.JobDataMap;
|
|
import org.quartz.JobDataMap;
|
|
|
import org.quartz.JobExecutionContext;
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -39,8 +36,67 @@ public class ReplenishSnapshotJob extends BaseJob2 {
|
|
|
context.getJobDetail().getKey().getGroup(),
|
|
context.getJobDetail().getKey().getGroup(),
|
|
|
context.getJobDetail().getKey().getName(),
|
|
context.getJobDetail().getKey().getName(),
|
|
|
context.getTrigger().getKey().getName());
|
|
context.getTrigger().getKey().getName());
|
|
|
- PatchService patchService = AppUtil.getBean(PatchService.class);
|
|
|
|
|
- patchService.replenishSnapshot();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ ICommonDao<?> commonDao = AppUtil.getBean(ICommonDao.class);
|
|
|
|
|
+ UploadProvider uploadFile = AppUtil.getBean(UploadProvider.class);
|
|
|
|
|
+ String runqianServer = EnvUtil.getProperty("runqian.server", "");
|
|
|
|
|
+ String runqianBasePath = EnvUtil.getProperty("runqian.base-path", "");
|
|
|
|
|
+ String sql = " select id_,biz_key_,proc_def_name_,bao_biao_lu_jing_,user_id_,user_name_,account_,end_time_,bo_code_,org_id_ from t_bckzsjb " +
|
|
|
|
|
+ " where date_format(create_time_,'%Y-%m-%d')=current_date and status_='0' and retry_<3 ";
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
|
|
+ if (BeanUtils.isNotEmpty(list)) {
|
|
|
|
|
+ logger.warn("补充快照查询数据总数:{}", list.size());
|
|
|
|
|
+ int success = 0;int error = 0;
|
|
|
|
|
+ for (Map<String, Object> map : list){
|
|
|
|
|
+ APIResult<AttachmentPo> result = new APIResult<>();
|
|
|
|
|
+ String id = map.get("id_").toString();
|
|
|
|
|
+ String userId = map.get("user_id_").toString();
|
|
|
|
|
+ String bizKey = map.get("biz_key_").toString();
|
|
|
|
|
+ String boCode = map.get("bo_code_").toString();
|
|
|
|
|
+ String org = map.get("org_id_").toString();
|
|
|
|
|
+ String userName = map.get("user_name_").toString();
|
|
|
|
|
+ String account = map.get("account_").toString();
|
|
|
|
|
+ try{
|
|
|
|
|
+ String reportPath = "金通医学实验室管理系统/" + map.get("bao_biao_lu_jing_");
|
|
|
|
|
+ String baseUrl = runqianServer + runqianBasePath + "/reportServlet?action=6&file=";
|
|
|
|
|
+ reportPath = URLEncoder.encode(reportPath, "UTF-8");
|
|
|
|
|
+ String url = baseUrl + reportPath + "&print=1&srcType=file¶mString=id_%3D" + bizKey + "&org_=" + org;
|
|
|
|
|
+ LocalDateTime dateTime = LocalDateTime.parse(map.get("end_time_").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ String name = map.get("proc_def_name_") + dateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
|
|
+
|
|
|
|
|
+ DefaultPartyUserPo user = new DefaultPartyUserPo();
|
|
|
|
|
+ user.setUserId(userId);
|
|
|
|
|
+ user.setFullname(userName);
|
|
|
|
|
+ user.setAccount(account);
|
|
|
|
|
+ ContextUtil.setCurrentUser(user);
|
|
|
|
|
+
|
|
|
|
|
+ result = uploadFile.runQianUpload(url , name , StringPool.FileType.Office.PDF );
|
|
|
|
|
+
|
|
|
|
|
+ if (result.getState() == 200 && BeanUtils.isNotEmpty(result.getData())) {
|
|
|
|
|
+ String kuaiZhaoId = result.getData().getId();
|
|
|
|
|
+ commonDao.execute("update "+boCode+" set kuai_zhao_='"+kuaiZhaoId+"' where id_='"+bizKey+"' ");
|
|
|
|
|
+
|
|
|
|
|
+ commonDao.execute("update t_bckzsjb set status_='1',kuai_zhao_='"+kuaiZhaoId+"' where id_='"+id+"'");
|
|
|
|
|
+
|
|
|
|
|
+ logger.warn("Generated Snapshot Success kuaiZhaoId={},id={}" , kuaiZhaoId,id );
|
|
|
|
|
+ success = success + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ commonDao.execute("update t_bckzsjb set retry_=retry_+1,msg_='"+e.getMessage() +"' where id_='"+id+"'");
|
|
|
|
|
+ error = error + 1;
|
|
|
|
|
+ logger.error("补充快照异常,异常数据id:{} with error message {}",id,e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ String msg = "补充快照成功数:"+success+",补充快照异常数:"+error;
|
|
|
|
|
+ logger.warn(msg);
|
|
|
|
|
+ if (error>0){
|
|
|
|
|
+ throw new Exception(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ logger.warn("未查询到需要补充快照的数据");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|