Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

scr 8 жил өмнө
parent
commit
5eaabed88f

+ 18 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/IdObject.java

@@ -0,0 +1,18 @@
+package com.uas.erp.schedular.b2b.domain;
+
+/**
+ * 只查询id信息
+ *
+ * Created by hejq on 2018-04-16.
+ */
+public class IdObject {
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+}

+ 2 - 2
src/main/java/com/uas/erp/schedular/b2b/task/DeputyOrderTask.java

@@ -63,7 +63,7 @@ public class DeputyOrderTask extends AbstractTask {
 
     @TaskMapping(title = "上传回复不同意的代采订单", fixedDelay = 60000)
     public void uploadNotAgreedDeOrder() {
-        List<DeputyOrder> orders = jdbcTemplate.queryForBeanList("select * from (select sa_fromcode code, sa_code salecode, sa_backreason remark from sale where sa_backstatus = '已驳回待上传' and sa_kind = '代采订单') where rownum < 200",
+        List<DeputyOrder> orders = jdbcTemplate.queryForBeanList("select * from (select sa_fromcode code, sa_code salecode, sa_backreason remark from sale where sa_backstatus = '已驳回待上传') where rownum < 200",
                 DeputyOrder.class);
         if (!CollectionUtils.isEmpty(orders)) {
             ContextHolder.setDataSize(orders.size());
@@ -81,7 +81,7 @@ public class DeputyOrderTask extends AbstractTask {
 
     @TaskMapping(title = "上传已经同意的单据到平台", fixedDelay = 60000)
     public void uploadAgreedDeOrder() {
-        List<DeputyOrder> orders = jdbcTemplate.queryForBeanList("select * from (select sa_fromcode code, sa_code salecode from sale where sa_status = '已审核' and nvl(sa_backstatus,' ')<>'已同意已上传' and sa_kind = '代采订单') where rownum<200",
+        List<DeputyOrder> orders = jdbcTemplate.queryForBeanList("select * from (select sa_fromcode code, sa_code salecode from sale where sa_status = '已审核' and nvl(sa_backstatus,' ')<>'已同意已上传') where rownum<200",
                 DeputyOrder.class);
         if (!CollectionUtils.isEmpty(orders)) {
             ContextHolder.setDataSize(orders.size());

+ 10 - 10
src/main/java/com/uas/erp/schedular/b2b/task/InquiryMouldTask.java

@@ -139,23 +139,23 @@ public class InquiryMouldTask extends AbstractTask {
         if (null != objs) {
             int count = jdbcTemplate.count("from PriceMould where pd_id=? and pd_vend1=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=? and idd_id=?) b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price1 = nvl(b.idd_price,0)", in_id, idd_id);
+                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=" + in_id + " and idd_id=" + idd_id + ") b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price1 = nvl(b.idd_price,0)");
             }
             count = jdbcTemplate.count("from PriceMould where pd_id=? and pd_vend2=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=? and idd_id=?) b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price2 = nvl(b.idd_price,0)", in_id, idd_id);
+                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=" + in_id + " and idd_id=" + idd_id + ") b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price2 = nvl(b.idd_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend3=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=? and idd_id=?) b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price3 = nvl(b.idd_price,0)", in_id, idd_id);
+                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=" + in_id + " and idd_id=" + idd_id + ") b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price3 = nvl(b.idd_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend4=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=? and idd_id=?) b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price4 = nvl(b.idd_price,0)", in_id, idd_id);
+                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=" + in_id + " and idd_id=" + idd_id + ") b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price4 = nvl(b.idd_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend5=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=? and idd_id=?) b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price5 = nvl(b.idd_price,0)", in_id, idd_id);
+                jdbcTemplate.execute("merge into pricemoulddet a using ( select idd_pddid,idd_price from inquirymoulddet where idd_inid=" + in_id + " and idd_id=" + idd_id + ") b on (b.idd_pddid=a.pdd_id  ) when matched then update set a.pdd_price5 = nvl(b.idd_price,0)");
             }
         }
     }
@@ -172,23 +172,23 @@ public class InquiryMouldTask extends AbstractTask {
         if (null != objs) {
             int count = jdbcTemplate.count("from PriceMould where pd_id=? and pd_vend1=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=? and ind_id=?) b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice1 = nvl(b.ind_price,0)", in_id, ind_id);
+                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=" + in_id + " and ind_id=" + ind_id + ") b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice1 = nvl(b.ind_price,0)");
             }
             count = jdbcTemplate.count("from PriceMould where pd_id=? and pd_vend2=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=? and ind_id=?) b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice2 = nvl(b.ind_price,0)", in_id, ind_id);
+                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=" + in_id + " and ind_id=" + ind_id + ") b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice2 = nvl(b.ind_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend3=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=? and ind_id=?) b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice3 = nvl(b.ind_price,0)", in_id, ind_id);
+                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=" + in_id + " and ind_id=" + ind_id + ") b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice3 = nvl(b.ind_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend4=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=? and ind_id=?) b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice4 = nvl(b.ind_price,0)", in_id, ind_id);
+                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=" + in_id + " and ind_id=" + ind_id + ") b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice4 = nvl(b.ind_price,0)");
             }
             count = jdbcTemplate.count("select * from PriceMould where pd_id=? and pd_vend5=?", objs);
             if (count > 0) {
-                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=? and ind_id=?) b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice5 = nvl(b.ind_price,0)", in_id, ind_id);
+                jdbcTemplate.execute("merge into PriceMouldDetail a using ( select ind_pmdid,ind_price from InquiryMouldDetail where ind_inid=" + in_id + " and ind_id=" + ind_id + ") b on (b.ind_pmdid=a.pmd_id  ) when matched then update set a.pmd_prodprice5 = nvl(b.ind_price,0)");
             }
         }
     }

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/InquiryTask.java

@@ -260,7 +260,7 @@ public class InquiryTask extends AbstractTask {
             sqls.add("update InquiryDetail set (id_vendcode,id_vendname)=(select ve_code,ve_name from vendor where ve_uu=id_venduu) where id_inid in ("
                     + idStr.toString() + ")");
             // 默认录单人是采购员
-            sqls.add("update inquiry set (in_recorder,in_recorderid)=(select em_name,em_id from employee,vendor,InquiryDetail where ve_buyerid=em_id and id_detno=1 and ve_uu=id_venduu) where in_id in ("
+            sqls.add("update inquiry set (in_recorder,in_recorderid)=(select em_name,em_id from employee,vendor,InquiryDetail where ve_buyerid=em_id and id_detno=1 and ve_uu=id_venduu and id_inid = in_id) where in_id in ("
                     + idStr.toString() + ")");
             sqls.add("update InquiryDetail set id_lapqty=0,id_price=nvl((select idd_price from InquiryDetailDet where idd_idid=id_id and idd_lapqty=0),0) where id_inid in ("
                     + idStr.toString() + ")");

+ 2 - 2
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseSampleTask.java

@@ -202,10 +202,10 @@ public class PurchaseSampleTask extends AbstractTask {
 
     @TaskMapping(title = "上传作废打样申请单信息传到平台", fixedDelay = 60000)
     public void invalidateSaleSampleSend() {
-        List<Long> sampleIds = jdbcTemplate.queryForBeanList("select productsample.ps_id from productsample left join employee" +
+        List<Long> sampleIds = jdbcTemplate.queryIdList("select productsample.ps_id from productsample left join employee" +
                 " on productsample.ps_appmanid = em_id where ps_sendstatus = '已上传' and ps_status='已作废' and exists (select 1 from productsampledetail left" +
                 " join vendor on pd_vendcode=ve_code where pd_psid=ps_id and ve_uu is not null and nvl(ve_b2benable,0)=1) order by ps_code",
-                Long.class);
+                IdObject.class);
         if (!CollectionUtils.isEmpty(sampleIds)) {
             ContextHolder.setDataSize(sampleIds.size());
             String idStr = StringUtils.collectionToCommaDelimitedString(sampleIds);

+ 13 - 1
src/main/java/com/uas/erp/schedular/database/RestJdbcTemplate.java

@@ -2,9 +2,9 @@ package com.uas.erp.schedular.database;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
+import com.uas.erp.schedular.b2b.domain.IdObject;
 import com.uas.erp.schedular.service.SettingService;
 import com.uas.erp.schedular.util.BeanUtil;
-import com.uas.erp.schedular.util.CollectionUtil;
 import com.uas.erp.schedular.web.ResultListWrap;
 import com.uas.erp.schedular.web.ResultWrap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -277,4 +277,16 @@ public class RestJdbcTemplate {
         return null == code ? null : code.toString();
     }
 
+    public <T> List<Long> queryIdList(String sql, Class<T> elementType) {
+        HttpEntity request = new HttpEntity<Executable>(Executable.query(sql, BeanUtil.getProperties(elementType), null));
+        String resultStr = restTemplate.postForObject(getUrl() + "/v1/exec", request, String.class);
+        ResultListWrap<IdObject> result = JSON.parseObject(resultStr, new TypeReference<ResultListWrap<IdObject>>(elementType){});
+        List<Long> list = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(result.getContent())) {
+            for (IdObject object : result.getContent()) {
+                list.add(object.getId());
+            }
+        }
+        return list;
+    }
 }

+ 1 - 0
src/main/resources/database/template/deputyOrder.xml

@@ -92,6 +92,7 @@
                     v_sale.sa_a2_user := ${order.enfax};
                     v_sale.sa_a25_user := ${order.paycomaddress};
                     v_sale.sa_a10_user_2 := ${order.actualpaydate};
+                    v_sale.sa_state_user := ${order.paymentmethod};
                     insert into sale values v_sale;
             </block>
                 <iterator loop="order.deputyOrderItems" var="item">

+ 2 - 2
src/main/resources/database/template/pubInquiryReply.xml

@@ -16,9 +16,9 @@
                     v_id_id := inquiryAutoDetail_seq.nextval;
                     -- 序号按返回先后顺序插入
                     select nvl(max(id_detno), 1) into v_id_detno from inquiryAutoDetail where id_incode = ${detail.in_code};
-                    insert into inquiryAutoDetail(id_id,id_inid,id_detno,id_prodid,id_prodcode,id_vendname,id_vendyyzzh,id_currency,id_venduu,id_ptid,id_incode,id_leadtime,id_minbuyqty,id_minqty,id_rate,id_attach)
+                    insert into inquiryAutoDetail(id_id,id_inid,id_detno,id_prodid,id_prodcode,id_vendname,id_vendyyzzh,id_currency,id_venduu,id_ptid,id_incode,id_leadtime,id_minbuyqty,id_minqty,id_rate,id_attach,id_remark)
                     select v_id_id,0,v_id_detno,pr_id,pr_code,${detail.id_vendname},${detail.id_vendyyzzh},${detail.id_currency},
-                    ${detail.ve_uu},${detail.b2b_id_id},${detail.in_code},${detail.id_leadtime},${detail.id_minbuyqty},${detail.id_minqty},${detail.id_rate} from product where pr_code=${detail.id_prodcode},${detail.attach};
+                    ${detail.ve_uu},${detail.b2b_id_id},${detail.in_code},${detail.id_leadtime},${detail.id_minbuyqty},${detail.id_minqty},${detail.id_rate},${detail.attach},${detail.id_remark} from product where pr_code=${detail.id_prodcode};
                 end if;
             </block>
             <iterator loop="detail.dets" var="det">