Commit 4ea4666a by 王栋源

wdy

parent 74b6f884
......@@ -24,7 +24,9 @@ class APIBase extends DocBase {
"transfer.test",
"transfer.queryOrder",
"transfer.selnotarytype",
"transfer.writecommunicationlog"
"transfer.writecommunicationlog",
"transfer.uppaymentstatus",
"transfer.m5"
];
var x = lst.indexOf(fullname);
return x >= 0;
......
......@@ -2,7 +2,7 @@ var APIBase = require("../../api.base");
var system = require("../../../system");
const Client = require('aliyun-api-gateway').Client;
const client = new Client('203756933','1hxwkxz2tyn80i3ucrdbchru59zpxibz');
const md5 = require("MD5");
class TradeTransferAPI extends APIBase {
constructor() {
super();
......@@ -32,6 +32,15 @@ class TradeTransferAPI extends APIBase {
return await this.tradetransferSve.writecommunicationlog(pobj);
}
async uppaymentstatus(){
return await this.tradetransferSve.uppaymentstatus();
}
async m5(p){
var signStr="appid=00000051&body=sdfg&cusid=990581007426001&notify_url=dfgdsfgdf&randomstr=dfghrtjjn&reqsn=1564125456123&returl=sdsd154541&trxamt=100&version=12"
var tmpSign = md5(signStr).toUpperCase();
return tmpSign
}
async test(pobj, query){
var url = 'https://jaxiya.gongsibao.com/orders/refuse';
......
......@@ -8,12 +8,14 @@ const logCtl = system.getObject("web.common.oplogCtl");
class TmjsonfileCtl extends CtlBase {
constructor() {
super("transfer", CtlBase.getServiceName(TmjsonfileCtl));
this.execS = system.getObject("util.execClient");
this.uploadfileossurl=settings.uploadfileossurl();
}
async createjsonfile(p, o, q) {
var rtn = await this.service.createjsonfile();
var self=this;
console.log(rtn);
if (rtn.status > -1) {
var oss = system.getObject("util.ossClient");
var newdate = new Date();
var m = newdate.getMonth() + 1;
var d = newdate.getDate();
......@@ -23,18 +25,23 @@ class TmjsonfileCtl extends CtlBase {
} else {
strdate = newdate.getFullYear() + "" + m + d + "_1.json";
}
var result = await oss.upfile(strdate, "/tmp/20191112_2.json");
if (result.res.status > -1) {
var obj = { zc_url: result.url };
var s = await this.service.create(obj);
if (s) {
return { status: 0, msg: "成功" };
}
}else{
return { status:-201, msg: "创建失败" };
var self = this;;
var gobj = {
action: "GenerateUploadFilePolicy",
reqbody: { FileType: "PARTNER_SYNC_FILE" }
}
}else{
return { status:-200, msg: "json文件生成失败" };
var rst = await self.service.aliclient(gobj);
console.log(rst)
var url=this.uploadfileossurl+"/uploadfile/"+strdate+"/"+rst.EncodedPolicy+"/"+rst.Signature;
var upl=await self.execS.execGet(null,url);
console.log(upl);
if(upl.stdout){
return { status: 0, msg: "成功" };
}else {
return { status: -201, msg: "创建失败" };
}
} else {
return { status: -200, msg: "json文件生成失败" };
}
}
......
......@@ -9,7 +9,7 @@ var cacheBaseComp = null;
class TradetransferCtl extends CtlBase {
constructor() {
super("transfer", CtlBase.getServiceName(TradetransferCtl));
this.postfile=system.getObject("util.restClient");
this.postfile = system.getObject("util.restClient");
}
async submit(p, q, req) {
if (req && req.session && req.session.user) {
......@@ -18,60 +18,60 @@ class TradetransferCtl extends CtlBase {
if (req.codepath) {
p.codepath = req.codepath;
}
var a = null;
var result = null;
if (p.tranfer_status == "CONFIRM_ORDER") {
if (p.transfer_status == "CONFIRM_ORDER") {
p.aliorder_status = "1",
a = await this.service.confirmorder(p);
console.log(a)
result = await this.service.confirmorder(p);
console.log(result)
}
if (p.tranfer_status == "CLOSE_ORDER_ONLY") {
if (p.transfer_status == "CLOSE_ORDER_ONLY") {
p.aliorder_status = "11",
a = await this.service.refuseorder(p)
result = await this.service.refuseorder(p)
}
if (p.tranfer_status == "PROVIDE_MATERIAL") {
if (p.transfer_status == "PROVIDE_MATERIAL") {
p.aliorder_status = "3",
a = await this.service.supplymaterail(p)
result = await this.service.supplymaterail(p)
}
if (p.tranfer_status == "BUYER_EXPRESS") {
if (p.transfer_status == "BUYER_EXPRESS") {
p.aliorder_status = "5",
a = await this.service.posttransfermatereial(p)
result = await this.service.posttransfermatereial(p)
}
if (p.tranfer_status == "BUYER_PROVIDE_MATERIAL") {
if (p.transfer_status == "BUYER_PROVIDE_MATERIAL") {
p.aliorder_status = "6",
a = await this.service.receivedtransfermaterail(p)
result = await this.service.receivedtransfermaterail(p)
}
if (p.tranfer_status == "SUBMIT_TO_SBJ") {
if (p.transfer_status == "SUBMIT_TO_SBJ") {
p.aliorder_status = "7",
a = await this.service.submittedtransfermaterail(p)
result = await this.service.submittedtransfermaterail(p)
}
if (p.tranfer_status == "SBJ_ACCEPT") {
if (p.transfer_status == "SBJ_ACCEPT") {
p.aliorder_status = "8",
a = await this.service.acceptedtransfermaterail(p)
result = await this.service.acceptedtransfermaterail(p)
}
if (p.tranfer_status == "SBJ_SUCCESS") {
if (p.transfer_status == "SBJ_SUCCESS") {
p.aliorder_status = "8",
a = await this.service.approvedtransfer(p)
result = await this.service.approvedtransfer(p)
}
if (p.tranfer_status == "SBJ_FAIL") {
if (p.transfer_status == "SBJ_FAIL") {
p.aliorder_status = "8",
a = await this.service.refusetransfer(p)
result = await this.service.refusetransfer(p)
}
if (p.tranfer_status == "TRANSFER_SUCCESS") {
if (p.transfer_status == "TRANSFER_SUCCESS") {
p.aliorder_status = "12",
a = await this.service.tradesuccess(p)
result = await this.service.tradesuccess(p)
}
if (p.tranfer_status == "TRANSFER_FAIL") {
if (p.transfer_status == "TRANSFER_FAIL") {
p.aliorder_status = "10",
a = await this.service.tradefail(p)
result = await this.service.tradefail(p)
}
if (p.tranfer_status == "RefuseOrder") {
if (p.transfer_status == "RefuseOrder") {
p.aliorder_status = "10",
a = await this.service.tradefail(p)
result = await this.service.tradefail(p)
}
if (a.Success) {
if (result && result.Success) {
var rd = await this.service.update(p);
return system.getResult(rd);
} else {
......@@ -79,7 +79,7 @@ class TradetransferCtl extends CtlBase {
}
}
async findone(p,q,req){
async findone(p, q, req) {
var traninfo = await this.service.findOne({ ali_bizid: p.ali_bizid });
return { data: traninfo.dataValues, status: 0, msg: "操作成功" }
}
......@@ -105,9 +105,9 @@ class TradetransferCtl extends CtlBase {
url: "https://trade-mark-user-upload.oss-cn-beijing.aliyuncs.com",
filedir: rst.FileDir
}
if(p.mtype && p.mtype == 'json') {
source.url="https://partner-sync-file.oss-cn-beijing.aliyuncs.com";
source.Bucket="partner-sync-file";
if (p.mtype && p.mtype == 'json') {
source.url = "https://partner-sync-file.oss-cn-beijing.aliyuncs.com";
source.Bucket = "partner-sync-file";
}
console.log(source)
return source;
......@@ -117,7 +117,7 @@ class TradetransferCtl extends CtlBase {
}
}
module.exports = TradetransferCtl;
......@@ -122,12 +122,12 @@ module.exports = {
},
"question_status": { "waithandle": "待解决", "inmiddle": "解决中", "waitcheck": "待验证", "success": "成功解决", "invalid": "无效问题" },
"urgent_status": { "urgent": "紧急", "general": "一般" },
"tranfer_status": {
"transfer_status": {
"READY_ORDER": "订单准备",
"CONFIRM_ORDER": "确认订单",
"CLOSE_ORDER_ONLY": "拒绝订单",
"PROVIDE_MATERIAL": "上传卖家资料",
"PAY_OVER": "尾款确认",
"PAY_OVER": "尾款已支付",
"BUYER_EXPRESS": "邮寄资料",
"BUYER_PROVIDE_MATERIAL": "确认收件",
"SUBMIT_TO_SBJ": "提交官方",
......
......@@ -3,7 +3,7 @@ module.exports={
columnMetaData:[
{"width":"100","label":"买方姓名 ","prop":"user_name","isShowTip":true,"isTmpl":false},
{"width":"80","label":"注册号","prop":"tm_number","isShowTip":true,"isTmpl":false},
{"width":"80","label":"状态","prop":"tranfer_status_name","isShowTip":true,"isTmpl":false},
{"width":"80","label":"状态","prop":"transfer_status_name","isShowTip":true,"isTmpl":false},
{"width":"100","label":"买方电话","prop":"mobile","isShowTip":true,"isTmpl":false},
{"width":"100","label":"尼斯大类","prop":"ncl_one","isShowTip":true,"isTmpl":false},
{"width":"null","label":"操作","name":"null","isShowTip":false,"isTmpl":true,"isBtns":true},
......@@ -13,7 +13,7 @@ module.exports={
{
"title":"控制信息",
ctls:[
{"type":"select","dicKey":"tranfer_status","label":"转让状态","prop":"tranfer_status","labelField":"label","valueField":"value","style":"","isButton":true},
{"type":"select","dicKey":"transfer_status","label":"转让状态","prop":"transfer_status","labelField":"label","valueField":"value","style":"","isButton":true},
// {"type":"select","refModel":"pmproduct","isMulti":false,"label":"所属产品","prop":"pmproduct_id","labelField":"name","valueField":"id","style":""},
]
},
......
......@@ -38,13 +38,13 @@ module.exports = (db, DataTypes) => {
transfer_cert_url: DataTypes.STRING, //转让证明
notarization_url: DataTypes.STRING, //公证书
notarization_flow_id: DataTypes.STRING, //公证流程id
tranfer_status_name: DataTypes.STRING, //流程状态名称
tranfer_status: {
transfer_status_name: DataTypes.STRING, //流程状态名称
transfer_status: {
type: DataTypes.ENUM, //
values: Object.keys(uiconfig.config.pdict.tranfer_status), //
values: Object.keys(uiconfig.config.pdict.transfer_status), //
set: function (val) {
this.setDataValue("tranfer_status", val);
this.setDataValue("tranfer_status_name", uiconfig.config.pdict.tranfer_status[val]);
this.setDataValue("transfer_status", val);
this.setDataValue("transfer_status_name", uiconfig.config.pdict.transfer_status[val]);
}
},
aliorder_status_name: DataTypes.STRING, //阿里订单状态名称
......
......@@ -93,16 +93,15 @@ class NotarizationflowService extends ServiceBase {
companyContactPhone: obj.companyContactPhone, // "企业联系人电话,可以和法人手机号一致",
legalPersonName: obj.legalPersonName // "法定代表人姓名"
},
uploadContext.transferData = {
sellerFrontOfIdCard: obj.sellerFrontOfIdCard,
sellerBackOfIdCard: obj.sellerBackOfIdCard,
tmRegisterCertificate: obj.tmRegisterCertificate,
businessLicense: obj.businessLicense,
tmAcceptCertificate: obj.tmAcceptCertificate,
buyerIdentification: obj.buyerIdentification,
tmRegisterChangeCertificate: obj.tmRegisterChangeCertificate
}
uploadContext.transferData = {
sellerFrontOfIdCard: obj.sellerFrontOfIdCard,
sellerBackOfIdCard: obj.sellerBackOfIdCard,
tmRegisterCertificate: obj.tmRegisterCertificate,
businessLicense: obj.businessLicense,
tmAcceptCertificate: obj.tmAcceptCertificate,
buyerIdentification: obj.buyerIdentification,
tmRegisterChangeCertificate: obj.tmRegisterChangeCertificate
}
} else {
return false;
}
......@@ -117,12 +116,12 @@ class NotarizationflowService extends ServiceBase {
}
console.log(source);
var a = await this.aliclient(source);
console.log(a);
return a;
var result = await this.aliclient(source);
console.log(result);
return result;
}
async selnotarytype(obj){
async selnotarytype(obj) {
if (!obj.ali_bizid) {
return {
"errorCode": "error",
......@@ -146,14 +145,14 @@ class NotarizationflowService extends ServiceBase {
reqbody: {
NotaryType: 1,
BizOrderNo: obj.ali_bizid,
PageNum:1,
PageSize:10,
Token:obj.token
PageNum: 1,
PageSize: 10,
Token: obj.token
}
}
var a = await this.aliclient(source);
console.log(a);
return a;
var result = await this.aliclient(source);
console.log(result);
return result;
}
async firstload(obj) {
......@@ -188,7 +187,12 @@ class NotarizationflowService extends ServiceBase {
} else {
return { data: null, status: -200, msg: "参数异常" }
}
}
async sellist() {
var obj={
}
}
}
module.exports = NotarizationflowService;
......@@ -22,15 +22,15 @@ class TmjsonfileService extends ServiceBase {
var strlist = null;
if (a) {
strlist = a.replace(/"/g, "").replace(/\[/g, "").replace(/\]/g, "").split(",");
if (!strlist[0]) {
if (!strlist) {
strlist.shift();
}
}
var des= tminfos[0][i].tm_ncl_third.replace(/\[/g, "").replace(/\]/g, "").replace(/\'/g, "");
var des = tminfos[0][i].tm_ncl_third.replace(/\[/g, "").replace(/\]/g, "").replace(/\'/g, "");
var source = {
beginTime: 1574388139000,
classificationCode: tminfos[0][i].ncl_one_code,
description:des,
description: des,
endTime: 1668089537981,
label: "商标标签",
originalPrice: 10,
......@@ -50,7 +50,7 @@ class TmjsonfileService extends ServiceBase {
}
var jsonstr = JSON.stringify(sources, null, "\t");
return new Promise(function (resv, rej) {
fs.writeFile('/tmp/20191112_2.json', jsonstr, function (err) {
fs.writeFile('/tmp/tmjsonfile/20191125_2.json', jsonstr, function (err) {
if (err) {
console.error(err);
}
......
......@@ -180,7 +180,7 @@ class TradetransferService extends ServiceBase {
var transferinfo = await this.findOne({ ali_bizid: obj.BizId });
if (transferinfo) {
transferinfo = transferinfo.dataValues;
if (transferinfo.tranfer_status == "CLOSE_ORDER_REFUND") {
if (transferinfo.transfer_status == "CLOSE_ORDER_REFUND") {
return {
"errorCode": "OK",
"errorMsg": "",
......@@ -188,7 +188,7 @@ class TradetransferService extends ServiceBase {
"success": true
}
} else {
transferinfo.tranfer_status = "CLOSE_ORDER_REFUND";
transferinfo.transfer_status = "CLOSE_ORDER_REFUND";
transferinfo.aliorder_status = "11";
await this.update(transferinfo);
return {
......@@ -238,8 +238,8 @@ class TradetransferService extends ServiceBase {
}
}
try {
var a = await this.aliclient(obj)
return a;
var result = await this.aliclient(obj)
return result;
} catch (error) {
console.log(error)
}
......@@ -276,7 +276,7 @@ class TradetransferService extends ServiceBase {
obj.tm_cert_url = obj.tm_cert_url == null ? null : obj.tm_cert_url.split("com//")[1];
obj.seller_apply = obj.seller_apply == null ? null : obj.seller_apply.split("com//")[1];
obj.transfer_cert_url = obj.transfer_cert_url == null ? null : obj.transfer_cert_url.split("com//")[1];
obj.notarization_url= obj.notarization_url == null ? null : obj.notarization_url.split("com//")[1];
obj.notarization_url = obj.notarization_url == null ? null : obj.notarization_url.split("com//")[1];
obj.user_type = obj.user_type == "person" ? 2 : 1;
var sobj = {
action: "SupplyMaterail",
......@@ -345,8 +345,8 @@ class TradetransferService extends ServiceBase {
Logistics: obj.logistics
}
}
var a = await this.aliclient(obj)
return a;
var result = await this.aliclient(obj)
return result;
}
......@@ -510,5 +510,40 @@ class TradetransferService extends ServiceBase {
return await self.aliclient(gobj);
}
async uppaymentstatus() {
var selsql = "select * from trade_transfer where transfer_status='PROVIDE_MATERIAL'";
var transferinfos = await this.dao.customQuery(selsql);
var obj = {
action: "QueryTradeProduceList"
}
var tradeinfo = await this.aliclient(obj);
if (!tradeinfo && tradeinfo.Data.TradeProduces.length > 0) {
return {
status: -1,
msg: "阿里订单查询失败",
data: null
}
}
var aliorder = tradeinfo.Data.TradeProduces.length;
var faillist = [];
if (transferinfos) {
for (let i = 0; i < transferinfos.length; i++) {
var transferinfo = transferinfos[i];
var aliorderindex = aliorder.findIndex(f => f.BizId == transferinfo.ali_bizid)
if (aliorderindex > -1 && aliorder[aliorderindex].BuyerStatus == 10) {
var upd = await this.dao.model.update({ transfer_status: "PAY_OVER" }, { where: { ali_bizid: transferinfo.ali_bizid } });
if (!upd) {
faillist.push(transferinfo.ali_bizid);
}
}
}
}
return {
status: 0,
msg: "成功",
data: faillist
}
}
}
module.exports = TradetransferService;
......@@ -36,6 +36,13 @@ var settings = {
return "http://zc-channel-service";
}
},
uploadfileossurl:function () {
if (this.env == "dev") {
return "http://192.168.18.15:8080";
} else {
return "http://localhost:8080";
}
},
reqEsAddr:function(){
if(this.env=="dev"){
var localsettings=require("./localsettings");
......
......@@ -45,7 +45,7 @@
})
}
if(key=='alisubmit'){
this.supplymaterail.tranfer_status="PROVIDE_MATERIAL";
this.supplymaterail.transfer_status="PROVIDE_MATERIAL";
this.$root.postReq("/web/transfer/tradetransferCtl/submit", this.supplymaterail).then(function (d) {
if (d.status > -1) {
history.go(-1)
......
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