|
@@ -7,15 +7,20 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.erp.schedular.entity.Master;
|
|
|
import com.uas.erp.schedular.task.support.Method;
|
|
|
import com.uas.erp.schedular.util.ContextHolder;
|
|
|
+import com.uas.erp.schedular.util.StringUtil;
|
|
|
import com.usoft.fin.external.open.api.entity.*;
|
|
|
import com.usoft.fin.external.open.api.protobuf.*;
|
|
|
import com.usoft.sdk.fin.client.CapitalSideSdk;
|
|
|
import com.usoft.sdk.fin.client.TradingHallSdk;
|
|
|
+import com.usoft.fin.external.open.api.entity.GuarantorJson;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.json.JSONArray;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -63,7 +68,21 @@ public class B2BInformation extends AbstractTask{
|
|
|
GetOfferQuotaInfoListResp resp = capitalSideSdk.getOfferQuotaInfoList(req);
|
|
|
List<OfferQuotaAndOfferQuotaInfoRest> restlist = resp.getOfferQuotaAndOfferQuotaInfoList();
|
|
|
List<Map<String, Object>> enUUList = new ArrayList<>();
|
|
|
+ StringBuffer buf=new StringBuffer();
|
|
|
+ String nameMob ="";
|
|
|
for(OfferQuotaAndOfferQuotaInfoRest rest : restlist) {
|
|
|
+ Object dbperson = rest.getOfferQuoteInfo().getGuarantorJson();
|
|
|
+ if(!dbperson.equals("")){
|
|
|
+ com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(rest.getOfferQuoteInfo().getGuarantorJson());
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++){
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ nameMob += (jsonObject.getString("name")).toString()+ ",";
|
|
|
+ if(nameMob.length() > 0){
|
|
|
+ nameMob = nameMob.substring(0, nameMob.length() - 1);
|
|
|
+ }
|
|
|
+ buf.append(nameMob);
|
|
|
+ }
|
|
|
+ }
|
|
|
Map<String, Object> enMap = new HashMap<>();
|
|
|
if (rest.getOfferQuoteInfo().getFsEnuu() > 0) {
|
|
|
sqls.add("MERGE INTO CUSTOMERQUOTA INERP " +
|
|
@@ -87,14 +106,14 @@ public class B2BInformation extends AbstractTask{
|
|
|
" CQ_CODE,CQ_FACTORUU,CQ_FACTORNAME,CQ_CUSTCODE,CQ_CUSTUU,CQ_CUSTNAME," +
|
|
|
" CQ_APPLYQUOTA,CQ_EFFECTDAYS,CQ_LENDRATE,CQ_ANNUALRATE,CQ_REPAYMENTMEANS," +
|
|
|
" CQ_INDATE,CQ_RECORDER,CQ_RECORDERUU,CQ_AUDITDATE," +
|
|
|
- " CQ_STATUSCODE,CQ_STATUS,CQ_BASICEVALUATION,CQ_ISEFFECT,CQ_QUOTA)" +
|
|
|
+ " CQ_STATUSCODE,CQ_STATUS,CQ_BASICEVALUATION,CQ_ISEFFECT,CQ_QUOTA,cq_assuremeans,cq_uinfo)" +
|
|
|
" VALUES(CUSTOMERQUOTA_SEQ.NEXTVAL,'" + (rest.getOfferQuoteInfo().getStatus() == 1401 ? "待上传" : "已上传") + "','B2B','卖方客户',SYSDATE,'"+ currMaster.getMa_user()+"','卖方客户申请单'," +
|
|
|
" '" + rest.getOfferQuoteInfo().getCode() + "'," + rest.getOfferQuoteInfo().getCsEnuu() + ",'" + rest.getOfferQuoteInfo().getCsEnName() + "',ONERP.CU_CODE," + rest.getOfferQuoteInfo().getFsEnuu() + ",'" + rest.getOfferQuoteInfo().getFsEnName() + "'," +
|
|
|
" " + rest.getOfferQuoteInfo().getQuotaAmount()*10000 + "," + rest.getOfferQuoteInfo().getCredDays() + "," + rest.getOfferQuoteInfo().getFinanceRate() + "," + rest.getOfferQuoteInfo().getOfferRate() + ",'" + rest.getOfferQuoteInfo().getRepayment() + "'," +
|
|
|
" TO_DATE('" + rest.getOfferQuoteInfo().getApplyTime() + "','YYYY-MM-DD hh24:mi:ss'),'" + rest.getOfferQuoteInfo().getApplyUsername() + "'," + rest.getOfferQuoteInfo().getApplyUu() + ",TO_DATE('" + rest.getOfferQuoteInfo().getCheckerTime() + "','YYYY-MM-DD hh24:mi:ss')," +
|
|
|
" '" + (rest.getOfferQuoteInfo().getStatus() == 1402 || rest.getOfferQuoteInfo().getStatus() == 1403? "AUDITED" : "ENTERING") + "',"
|
|
|
+ "'" + (rest.getOfferQuoteInfo().getStatus() == 1402 || rest.getOfferQuoteInfo().getStatus() == 1403 ? "已审核" : "在录入") + "',"
|
|
|
- + "'" + rest.getOfferQuoteInfo().getCheckerContent() + "','未生效','" + rest.getOfferQuoteInfo().getQuotaAmount()*10000 + "')");
|
|
|
+ + "'" + rest.getOfferQuoteInfo().getCheckerContent() + "','未生效','" + rest.getOfferQuoteInfo().getQuotaAmount()*10000 + "','"+buf.toString()+"','"+rest.getOfferQuoteInfo().getGuarantorJson()+"')");
|
|
|
enMap.put("CQ_CODE",rest.getOfferQuoteInfo().getCode());
|
|
|
enMap.put("CQ_CUSTUU", rest.getOfferQuoteInfo().getFsEnuu());
|
|
|
enMap.put("CQ_FACTORUU", rest.getOfferQuoteInfo().getCsEnuu());
|
|
@@ -106,16 +125,6 @@ public class B2BInformation extends AbstractTask{
|
|
|
}
|
|
|
System.out.println(sqls);
|
|
|
jdbcTemplate.batchExecute(sqls);
|
|
|
-
|
|
|
- for(int i = 0;i<list.size();i++){
|
|
|
- Object auditdate = jdbcTemplate.getObject("select to_char(max(cq_auditdate),'YYYY-MM-DD hh24:mi:ss') from CUSTOMERQUOTA "
|
|
|
- + " where cq_custname = ?",list.get(i).get("CQ_CUSTNAME"));
|
|
|
- if(auditdate != null){
|
|
|
- jdbcTemplate.execute("update CUSTOMERQUOTA set CQ_ISEFFECT = '已生效' where cq_custname = ? and "
|
|
|
- + " cq_auditdate = ? and cq_status = ?", list.get(i).get("CQ_CUSTNAME"),auditdate,"已审核");
|
|
|
- }
|
|
|
-
|
|
|
- }*/
|
|
|
|
|
|
|
|
|
|
|
@@ -147,6 +156,8 @@ public class B2BInformation extends AbstractTask{
|
|
|
if (cq_factoruu!=null) {
|
|
|
cqFactoruu = Integer.valueOf(cq_factoruu.toString());
|
|
|
}
|
|
|
+
|
|
|
+ String cqCode = map.get("CQ_CODE").toString();
|
|
|
|
|
|
|
|
|
Object cq_custuu = map.get("CQ_CUSTUU");
|
|
@@ -167,6 +178,20 @@ public class B2BInformation extends AbstractTask{
|
|
|
Double cqAnnualrate = Double.valueOf(map.get("CQ_ANNUALRATE").toString());
|
|
|
|
|
|
String cqRepaymentmeans = map.get("CQ_REPAYMENTMEANS").toString();
|
|
|
+ List<GuarantorJson> guarantorJsonList= new ArrayList<GuarantorJson>();
|
|
|
+ GuarantorJson.Builder guarantorJson = GuarantorJson.newBuilder();
|
|
|
+
|
|
|
+ Object dbInfo = map.get("CQ_UINFO");
|
|
|
+ if(dbInfo != null ){
|
|
|
+
|
|
|
+ com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(map.get("CQ_UINFO").toString());
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++){
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ guarantorJson.setName(jsonObject.getString("name")).toString();
|
|
|
+ guarantorJson.setMobile(jsonObject.getString("mobile")).toString();
|
|
|
+ }
|
|
|
+ guarantorJsonList.add(guarantorJson.build());
|
|
|
+ }
|
|
|
|
|
|
Object cq_recorderuu = map.get("CQ_RECORDERUU");
|
|
|
Integer cqRecorderuu =200040254;
|
|
@@ -197,7 +222,7 @@ public class B2BInformation extends AbstractTask{
|
|
|
SaveOfferQuotaInfoReq.Builder req = SaveOfferQuotaInfoReq.newBuilder();
|
|
|
req.setCsEnuu(cqFactoruu).setCsEnName("深圳市英唐保理有限公司").setFsEnuu(cqCustuu).setFsEnName(cqCustname).setQuotaAmount(cqQuota)
|
|
|
.setCredDays(cqEffectdays).setFinanceRate(cqLendrate).setOfferRate(cqAnnualrate).setRepayment(
|
|
|
- cqRepaymentmeans).setApplyUu(cqRecorderuu).setPreviousRecord("");
|
|
|
+ cqRepaymentmeans).setApplyUu(cqRecorderuu).setPreviousRecord("").setAcceptOfferQuotaCode(cqCode).addGuarantorJson(guarantorJson);
|
|
|
SaveOfferQuotaInfoResp resp = capitalSideSdk.saveOfferQuotaInfo(req);
|
|
|
String s = ProtoBufUtil.toJSON(resp);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s);
|
|
@@ -230,7 +255,7 @@ public class B2BInformation extends AbstractTask{
|
|
|
private List<Map<String, Object>> getCustomerQuotaUpload() {
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from (select cq_id,cq_factoruu," +
|
|
|
"cq_custuu,cq_custname,cq_effectdays,cq_quota,cq_lendrate,cq_annualrate," +
|
|
|
- "cq_repaymentmeans,cq_recorderuu,cq_approval,cq_enddate,cq_basicevaluation from " +
|
|
|
+ "cq_repaymentmeans,cq_recorderuu,cq_approval,cq_enddate,cq_basicevaluation,cq_code,cq_uinfo from " +
|
|
|
"customerQuota where " +
|
|
|
"CQ_UPLOADSTATUS='待上传' and cq_status = '已审核' and cq_quotatype='卖方客户' order by cq_code ) where rownum " +
|
|
|
"< 100");
|