Selaa lähdekoodia

商机下载轮询修改

will.chen 6 vuotta sitten
vanhempi
commit
60840d4240

+ 13 - 9
src/main/java/com/uas/erp/schedular/publicinquiry/task/EnterInquiryTask.java

@@ -272,47 +272,51 @@ public class EnterInquiryTask extends AbstractTask{
         }
         try{
             //从平台获取企业商机,保存到本地
+            String ids = "";
             List<InquiryEnRemind> downs = getForList("/inquiry/public/enremind?vendUU="+enterpriseMap.get("EN_UU"), InquiryEnRemind.class);
             if(!CollectionUtils.isEmpty(downs)){
                 ContextHolder.setDataSize(downs.size());
-                saveInquiryEnRemind(downs);
+                ids = saveInquiryEnRemind(downs);
             }
             // 回执
-            onReplySuccess(downs, enterpriseMap.get("EN_UU"));
+            onReplySuccess(ids, enterpriseMap.get("EN_UU"));
         }catch (Exception e){
             e.printStackTrace();
         }
 
     }
 
-    private void onReplySuccess(List<InquiryEnRemind> downs, Object en_uu) {
-        String idStr = CollectionUtil.getKeyString(downs);
+    private void onReplySuccess(String ids, Object en_uu) {
         MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
         map.set("vendUU", String.valueOf(en_uu));
-        map.set("ids", idStr);
-        if(!StringUtils.isEmpty(idStr)){
+        map.set("ids", ids);
+        if(!StringUtils.isEmpty(ids)){
             post("/inquiry/public/enremind/back", map);
         }
     }
 
-    private void saveInquiryEnRemind(List<InquiryEnRemind> downs) throws Exception {
+    private String saveInquiryEnRemind(List<InquiryEnRemind> downs) throws Exception {
+        StringBuilder sb = new StringBuilder();
         Map<String, Object> model = new HashMap<String, Object>();
         model.put("inquiryEnRemind", downs);
         try{
             String sql = SqlTemplate.fromXmlFile("database/template/inquiryEnRemind.xml", model);
             jdbcTemplate.execute(sql);
+            sb.append(CollectionUtil.getKeyString(downs));
         }catch (Exception e){
-            for(int i = 0; i < downs.size(); i=i+2){
+            for(int i = 0; i < downs.size(); i=i+1){
                 try {
-                    List<InquiryEnRemind> tempList = downs.subList(i,i+2);
+                    List<InquiryEnRemind> tempList = downs.subList(i,i+1);
                     model.put("inquiryEnRemind", tempList);
                     String sql = SqlTemplate.fromXmlFile("database/template/inquiryEnRemind.xml", model);
                     jdbcTemplate.execute(sql);
+                    sb.append(downs.get(i).getId() + ",");
                 }catch (Exception e1){
                     continue;
                 }
             }
         }
+        return sb.substring(0, sb.length()-2);
     }
 
 }

+ 1 - 1
src/main/resources/database/template/inquiryEnRemind.xml

@@ -37,7 +37,7 @@
                 ${detail.needQty},${detail.endDate},${detail.enUU},v_cu_code);
                 select count(*) into v_count from product left join productsaler on ps_prcode=pr_code where pr_orispeccode=${detail.cmpCode};
                 if v_count > 0 then
-                select ps_emcode,ps_emname into v_domancode,v_doman from productsaler left join product on pr_code=ps_prcode where pr_orispeccode=${detail.cmpCode} and rownum=1 order by ps_data desc;
+                select ps_emcode,ps_emname into v_domancode,v_doman from product left join productsaler on pr_code=ps_prcode where pr_orispeccode=${detail.cmpCode} and rownum=1 order by ps_data desc;
                 update businesschance set bc_domancode=v_domancode,bc_doman=v_doman where bc_id=v_id;
                 end if;
                 end if;