Commit 60bd5d59 by 王勇飞

gyq

parent 4d46a261
......@@ -41,7 +41,7 @@ class DeliverybillCtl extends CtlBase {
robj.settle_status = element.settle_status;
robj.settlebill = element.settlebill;
if (robj.businessName == '公司注册') {
if (robj.baseInfo.isWhether == "是" || robj.baseInfo.isVirtual == "是") {//如果有刻章需求或者是虚拟地址
if (robj.baseInfo.isWhether == "yes" || robj.baseInfo.isVirtual == "yes") {//如果有刻章需求或者是虚拟地址
robj.relatedProducts = '有';
}
else {
......@@ -50,7 +50,7 @@ class DeliverybillCtl extends CtlBase {
}
else if (robj.businessName == '云上园区注册') {
robj.registeredType = element.delivery_info.registeredType;//园区注册时,根据该值跳界面
if (robj.baseInfo.isWhether == "是") {//如果有刻章需求或者是虚拟地址
if (robj.baseInfo.isWhether == "yes"|| robj.baseInfo.financial == "yes") {//如果有刻章需求或者是财税服务
robj.relatedProducts = '有';
}
else {
......@@ -77,23 +77,23 @@ class DeliverybillCtl extends CtlBase {
}
/*根据交付单编号获取交付单xinxi*/
async findInfoByDeliverCode(mobj, qobj, req){
async findInfoByDeliverCode(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try{
try {
var rs = await this.service.findInfoByDeliverCode(pobj);
if (rs){
if (rs) {
return system.getResult(rs);
}
else{
else {
return system.getResultError("数据不存在");
}
}
catch(error){
catch (error) {
return system.getResultError(error);
}
}
else{
else {
return system.getResultError("参数错误!");
}
}
......@@ -118,6 +118,7 @@ class DeliverybillCtl extends CtlBase {
"expressInfo": {}
}
if (rs) {
console.log("D___________________________" + JSON.stringify(rs));
rarr.id = rs.id;//数据的id
rarr.baseInfo.deliverNumber = rs.delivery_code;//交付单编号
rarr.baseInfo.businessName = rs.product_name;//产品名称
......@@ -140,11 +141,11 @@ class DeliverybillCtl extends CtlBase {
rarr.baseInfo.serviceArea = appconfig.pdict.registeredAreaDict[rarr.serviceCode];//服务地区名称
}
if (rs.delivery_info.contactsName && rs.delivery_info.contactsName != 'undefined'){
if (rs.delivery_info.contactsName && rs.delivery_info.contactsName != 'undefined') {
rarr.contactsInfo.contactsName = rs.delivery_info.contactsName;//联系人信息
rarr.baseInfo.contactsName = rs.delivery_info.contactsName;//联系人信息
}
if (rs.delivery_info.contactsPhone && rs.delivery_info.contactsPhone != 'undefined'){
if (rs.delivery_info.contactsPhone && rs.delivery_info.contactsPhone != 'undefined') {
rarr.contactsInfo.contactsPhone = rs.delivery_info.contactsPhone;//联系电话信息
rarr.baseInfo.contactsPhone = rs.delivery_info.contactsPhone;//联系电话信息
}
......@@ -177,9 +178,14 @@ class DeliverybillCtl extends CtlBase {
if (rs.delivery_info.buyTime && rs.delivery_info.buyTime != 'undefined') {
rarr.baseInfo.buyTime = rs.delivery_info.buyTime;//购买时间
}
if (rs.delivery_info.buyDuration && rs.delivery_info.buyDuration != 'undefined' && rarr.baseInfo.buyTime && rarr.baseInfo.buyTime != 'undefined') {
var d = new Date(rarr.baseInfo.buyTime);
rarr.baseInfo.endTime = this.oneYearPast(d, Number(rs.delivery_info.buyDuration));//到期时间
if (rs.delivery_info.startTime && rs.delivery_info.startTime != 'undefined') {
rarr.baseInfo.startTime = rs.delivery_info.startTime;//开始计费时间
}
if (rs.delivery_info.buyDuration && rs.delivery_info.buyDuration != 'undefined' && rarr.baseInfo.startTime && rarr.baseInfo.startTime != 'undefined') {
console.log("ddddddddddd____________________________"+ rarr.baseInfo.startTime );
var d = new Date(rarr.baseInfo.startTime);
console.log("ddddddddddd____________________________"+ d );
rarr.baseInfo.endTime = this.oneYearPast(d, 1);//到期时间
var ss = moment();
rarr.baseInfo.surplusDuration = this.diffDays(ss, rarr.baseInfo.endTime);//剩余时长
}
......@@ -217,6 +223,58 @@ class DeliverybillCtl extends CtlBase {
}
}
async updatestartTimeByDeliverCode(mobj, qobj, red) {//根据交付单编号更新开始计费时间
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.baseInfo.startTime && pobj.baseInfo.startTime != 'undefined'){
try{
var rs = await this.service.findInfoByDeliverCode(pobj)//先得到交付单详情
if (rs && rs != 'undefined') {
rs.delivery_info.startTime = pobj.baseInfo.startTime;
//回传信息给庄冰,放队列
var rc = system.getObject("util.execClient");
var requrl = this.queueUrl;
var params = {
"actionType": "produceData",
"actionBody": {
"pushUrl": this.receiveUrl,
"actionType": "updateOrderStatus",
"identifyCode": "ic-manage",
"messageBody": {
"orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[rs.delivery_status],
"deliverContent": { "baseInfo": rs.delivery_info }
}
}
}
var rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
console.log("RRRRRRRRRRRRRR");
console.log(JSON.stringify(j));
if (j.status == 1) {
//更新详情
var uarr = {
"deliverNumber": pobj.deliverNumber,
"baseInfo": rs.delivery_info
};
await this.service.updateInfoByDeliverCode(uarr);
return system.getResult("更新成功");
}
else {
return system.getResultError("更新失败!");
}
}
else {
return system.getResultError("数据不存在!");
}
}
catch(error){
return system.getResultError(error);
}
}
else{
return system.getResultError("参数错误!");
}
}
/*根据交付单编号更新交付单状态*/
async updateStatusByDeliverCode(mobj, qobj, req) {
var pobj = mobj.d;
......@@ -297,7 +355,7 @@ class DeliverybillCtl extends CtlBase {
"messageBody": {
"orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[rs.delivery_status],
"deliverContent": {"baseInfo":rs.delivery_info}
"deliverContent": { "baseInfo": rs.delivery_info }
}
}
}
......@@ -354,7 +412,7 @@ class DeliverybillCtl extends CtlBase {
"messageBody": {
"orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[deliverInfo.delivery_status],
"deliverContent": {"expressInfo":pobj.expressInfo}
"deliverContent": { "expressInfo": pobj.expressInfo }
}
}
}
......@@ -375,7 +433,7 @@ class DeliverybillCtl extends CtlBase {
}
}
catch(error){
catch (error) {
console.log("Error-----------------------------------------------" + error);
return system.getResultError(error);
}
......@@ -388,6 +446,7 @@ class DeliverybillCtl extends CtlBase {
/*根据交付单编号更新交付单详情*/
async updateInfoByDeliverCode(mobj, qobj, req) {//
var pobj = mobj.d;
console.log("根据交付单编号更新交付单详情-------------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
var rs = await this.service.findInfoByDeliverCode(pobj)//先得到交付单详情
......@@ -438,6 +497,7 @@ class DeliverybillCtl extends CtlBase {
params.actionBody.status = appconfig.pdict.ddyDict[rs.delivery_status];
}
var rtn = await rc.execPost(params, requrl);
console.log("rtn-------------------------------------------" + rtn.stdout);
var j = JSON.parse(rtn.stdout);
if (j.status == 1) {
return system.getResult("操作成功!");
......@@ -447,41 +507,44 @@ class DeliverybillCtl extends CtlBase {
}
}
catch (error) {
console.log("error-------------------------------------------" + error);
return system.getResultError(error);
}
}
else {
console.log("参数错误-------------------------------------------参数错误!");
return system.getResultError("参数错误!");
}
}
async settleApplyForTacent(p,q,req){
let ids=p.ids
let spname=p.spname
let spid=p.spid
let rtn=await this.service.settleApplyForTacent(ids,p.userid,p.username,spname,spid)
async settleApplyForTacent(p, q, req) {
let ids = p.ids
let spname = p.spname
let spid = p.spid
let rtn = await this.service.settleApplyForTacent(ids, p.userid, p.username, spname, spid)
return system.getResult({})
}
async settleApply(p,q,req){
let ids=p.ids
let spname=p.spname
let spid=p.spid
let rtn=await this.service.settleApply(ids,p.userid,p.username,spname,spid)
async settleApply(p, q, req) {
let ids = p.ids
let spname = p.spname
let spid = p.spid
let rtn = await this.service.settleApply(ids, p.userid, p.username, spname, spid)
return system.getResult({})
}
/*根据商机编号插入交付单信息*/
async insertInfo(nobj, qobj, req) {//队列的时候用
var pobj = nobj.d;
console.log("根据交付单编号更新交付单详情-------------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
pobj.deliverStatus = "received";
pobj.businessType = appconfig.pdict.dyDict[pobj.businessType];
if (pobj.companyInfo.companyPropertiesName && pobj.companyInfo.companyPropertiesName != 'undefined') {
if (pobj.businessName == "公司注册"){
if (pobj.businessName == "公司注册") {
pobj.companyInfo.companyProperties = appconfig.pdict.companyNatureDictT[pobj.companyInfo.companyPropertiesName];
}
else if (pobj.businessName == "云上园区注册"){
else if (pobj.businessName == "云上园区注册") {
pobj.companyInfo.companyProperties = appconfig.pdict.registeredTypeDictT[pobj.companyInfo.companyPropertiesName];
}
pobj.baseInfo.companyProperties = pobj.companyInfo.companyProperties;
......@@ -493,7 +556,7 @@ class DeliverybillCtl extends CtlBase {
}
if (pobj.baseInfo.taxpayerName && pobj.baseInfo.taxpayerName != 'undefined') {
pobj.baseInfo.taxpayerType = appconfig.pdict.TaxpayerTypeDictT[pobj.baseInfo.taxpayerName];
if (pobj.businessName == "公司注册" || pobj.businessName == "云上园区注册"){
if (pobj.businessName == "公司注册" || pobj.businessName == "云上园区注册") {
pobj.companyInfo.taxpayerType = pobj.baseInfo.taxpayerType;
}
}
......@@ -501,8 +564,8 @@ class DeliverybillCtl extends CtlBase {
pobj.channelSource = "tencentCloud";//目前渠道只有腾讯
pobj.channelNumber = "1111111";
pobj.cacheInfo = {
"cmpDeliverInfo":{},
"cmpContactInfo":{}
"cmpDeliverInfo": {},
"cmpContactInfo": {}
};
if (pobj.businessMode && pobj.businessMode != 'undefined') {//如果有商机编号,需要取方案编号
var schemeInfo = await this.schemeService.findInfoByDemandCode(pobj);
......@@ -530,8 +593,8 @@ class DeliverybillCtl extends CtlBase {
if (pobj.baseInfo.isWhether && pobj.baseInfo.isWhether != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.isWhether = pobj.baseInfo.isWhether;
}
if (pobj.baseInfo.financial && pobj.baseInfo.financial != 'undefined'){
pobj.cacheInfo.financial = pobj.baseInfo.financial;
if (pobj.baseInfo.financial && pobj.baseInfo.financial != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.financial = pobj.baseInfo.financial;
}
if (pobj.baseInfo.addressType && pobj.baseInfo.addressType != 'undefined') {
......@@ -567,11 +630,11 @@ class DeliverybillCtl extends CtlBase {
pobj.cacheInfo.cmpDeliverInfo.fullAddress = pobj.companyInfo.fullAddress;
pobj.cacheInfo.cmpDeliverInfo.residenceAddress = pobj.companyInfo.fullAddress;
}
if (pobj.baseInfo.contactsName && pobj.baseInfo.contactsName != 'undefined'){
if (pobj.baseInfo.contactsName && pobj.baseInfo.contactsName != 'undefined') {
pobj.cacheInfo.cmpContactInfo.contactsName = pobj.baseInfo.contactsName;
}
if (pobj.baseInfo.contactsPhone && pobj.baseInfo.contactsPhone != 'undefined'){
if (pobj.baseInfo.contactsPhone && pobj.baseInfo.contactsPhone != 'undefined') {
pobj.cacheInfo.cmpContactInfo.contactsPhone = pobj.baseInfo.contactsPhone;
}
......@@ -677,25 +740,38 @@ class DeliverybillCtl extends CtlBase {
//time时间n年后的的前一天
oneYearPast(time, n) {
//var time=new Date();
try{
var year = time.getFullYear() + n;
var d = time.setFullYear(year);
var date = time.getDate(d) - 1;
var xx = time.setDate(date);
return moment(new Date(xx)).format('yyyy-MM-DD');
}
catch{
return "";
}
}
//计算俩日期相差多少天
diffDays(time1, time2) {
try{
var m1 = moment(time1);
var m2 = moment(time2);
return m2.diff(m1, 'day');
}
catch{
return "";
}
}
}
module.exports = DeliverybillCtl;
// var task = new DeliverybillCtl();
// var d = new Date("2020-06-05");
// var oneYear = task.oneYearPast(d);
// console.log("dddddddddddd:" + d);
// var oneYear = task.oneYearPast(d,1);
// var ss = moment();
// var diff = task.diffDays(ss,oneYear);
// console.log(oneYear);
......
......@@ -35,7 +35,7 @@ class DeliverybillDao extends Dao {
//不是来自平台前端查询
if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) {
qc.where.product_code = qc.where.product_code || {
[this.db.Op.notIn]: ["ICP", "EDI"]
[this.db.Op.notIn]: ["ICP", "EDI","ICPANNUALREPORT","EDIANNUALREPORT"]
}
if (qobj.bizpath && qobj.bizpath != "") {
if (qobj.bizpath.indexOf("myDeliver") > 0) {//说明是从商机列表过来的
......
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