Commit d052fb34 by 王勇飞

Merge branch 'ic-deliver' of gitlab.gongsibao.com:jiangyong/zhichan into ic-deliver

parents 794affbd f5ed17b7
......@@ -21,7 +21,7 @@ class DeliverybillCtl extends CtlBase {
}
/*根据用户id获取商机信息,分页获取*/
async findAndCountAll(pobj, qobj, req) {
async findAndCountAll (pobj, qobj, req) {
try {
//TODO 根据业务员id获取该业务员所有交付单列表
if (pobj.search && pobj.search.dateType) {
......@@ -108,7 +108,7 @@ 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 {
......@@ -130,7 +130,7 @@ class DeliverybillCtl extends CtlBase {
}
/*根据交付单编号获取交付单详情和材料详情*/
async dealInfo(mobj, qobj, req) {
async dealInfo (mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
......@@ -240,32 +240,31 @@ class DeliverybillCtl extends CtlBase {
rarr.companyInfo = ms.company_info;//公司详情
rarr.registeredInfo = ms.registered_info;//注册信息
rarr.contributionInfo = ms.contribution_info;//出资比例信息
if (rarr.contributionInfo && rarr.contributionInfo.contributionData && rarr.contributionInfo.contributionData.length >0){
for (var i =0;i<rarr.contributionInfo.contributionData.length;i++)
{
if (rarr.contributionInfo.contributionData[i].phoneNumber && rarr.contributionInfo.contributionData[i].phoneNumber != 'undefined'){
if (rarr.contributionInfo && rarr.contributionInfo.contributionData && rarr.contributionInfo.contributionData.length > 0) {
for (var i = 0; i < rarr.contributionInfo.contributionData.length; i++) {
if (rarr.contributionInfo.contributionData[i].phoneNumber && rarr.contributionInfo.contributionData[i].phoneNumber != 'undefined') {
rarr.contributionInfo.contributionData[i].phoneNumber = system.decryptStr(rarr.contributionInfo.contributionData[i].phoneNumber);
}
if (rarr.contributionInfo.contributionData[i].IdentificationNumber && rarr.contributionInfo.contributionData[i].IdentificationNumber != 'undefined'){
if (rarr.contributionInfo.contributionData[i].IdentificationNumber && rarr.contributionInfo.contributionData[i].IdentificationNumber != 'undefined') {
rarr.contributionInfo.contributionData[i].IdentificationNumber = system.decryptStr(rarr.contributionInfo.contributionData[i].IdentificationNumber);
}
}
}
var position_t_info = ms.position_info;
if (position_t_info && position_t_info != 'undefined'){
if (position_t_info.phoneNumber && position_t_info.phoneNumber != 'undefined'){
if (position_t_info && position_t_info != 'undefined') {
if (position_t_info.phoneNumber && position_t_info.phoneNumber != 'undefined') {
position_t_info.phoneNumber = system.decryptStr(position_t_info.phoneNumber);
}
if (position_t_info.IdentificationNumber && position_t_info.IdentificationNumber != 'undefined'){
if (position_t_info.IdentificationNumber && position_t_info.IdentificationNumber != 'undefined') {
position_t_info.IdentificationNumber = system.decryptStr(position_t_info.IdentificationNumber);
}
if (position_t_info.positionData && position_t_info.positionData.length >0){
for (var i=0;i<pobj.positionInfo.positionData.length;i++){
if (position_t_info.positionData[i].fixedPhone && position_t_info.positionData[i].fixedPhone != 'undefined'){
if (position_t_info.positionData && position_t_info.positionData.length > 0) {
for (var i = 0; i < pobj.positionInfo.positionData.length; i++) {
if (position_t_info.positionData[i].fixedPhone && position_t_info.positionData[i].fixedPhone != 'undefined') {
position_t_info.positionData[i].fixedPhone = system.decryptStr(position_t_info.positionData[i].fixedPhone);
}
if (position_t_info.positionData[i].mobilePhone &&position_t_info.positionData[i].mobilePhone != 'undefined'){
if (position_t_info.positionData[i].mobilePhone && position_t_info.positionData[i].mobilePhone != 'undefined') {
position_t_info.positionData[i].mobilePhone = system.decryptStr(position_t_info.positionData[i].mobilePhone);
}
}
......@@ -275,7 +274,7 @@ class DeliverybillCtl extends CtlBase {
rarr.managerInfo = position_t_info;//经营者信息,个体工商户的经营者信息取该值
rarr.regInfo = ms.file_info;//注册文件信息
rarr.expressInfo = ms.express_info;//邮寄信息
if (rarr.expressInfo && rarr.expressInfo.addresseePhone && rarr.expressInfo.addresseePhone != 'undefined'){
if (rarr.expressInfo && rarr.expressInfo.addresseePhone && rarr.expressInfo.addresseePhone != 'undefined') {
rarr.expressInfo.addresseePhone = system.decryptStr(rarr.expressInfo.addresseePhone);
}
}
......@@ -290,7 +289,7 @@ class DeliverybillCtl extends CtlBase {
}
}
async updatestartTimeByDeliverCode(mobj, qobj, red) {//根据交付单编号更新开始计费时间
async updatestartTimeByDeliverCode (mobj, qobj, red) {//根据交付单编号更新开始计费时间
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.baseInfo.startTime && pobj.baseInfo.startTime != 'undefined') {
try {
......@@ -363,7 +362,7 @@ class DeliverybillCtl extends CtlBase {
}
}
/*根据交付单编号更新交付单状态*/
async updateStatusByDeliverCode(mobj, qobj, req) {
async updateStatusByDeliverCode (mobj, qobj, req) {
var pobj = mobj.d;
console.log("--------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.deliverStatus && pobj.deliverStatus != 'undefined') {
......@@ -416,7 +415,7 @@ class DeliverybillCtl extends CtlBase {
"statusCode": pobj.deliverStatus,
"clerkName": pInfo.salesman_name,
"clerkId": pInfo.salesman_id,
"deliveryId" : pInfo.delivery_man_id,
"deliveryId": pInfo.delivery_man_id,
"deliveryName": pInfo.delivery_man_name
}
if (pInfo.statusReason && pInfo.statusReason != 'undefined') {
......@@ -439,7 +438,7 @@ class DeliverybillCtl extends CtlBase {
}
}
async UpdateofficialSealByDeliverCode(mobj, qobj, req) {//更新营业执照扫描件和公章扫描件
async UpdateofficialSealByDeliverCode (mobj, qobj, req) {//更新营业执照扫描件和公章扫描件
var pobj = mobj.d;
if ((pobj.deliverNumber && pobj.deliverNumber != 'undefined' && ((pobj.baseInfo.officialSeal && pobj.baseInfo.officialSeal != 'undefined') || (pobj.baseInfo.businessLicense && pobj.baseInfo.businessLicense != 'undefined')))) {
try {
......@@ -501,11 +500,11 @@ class DeliverybillCtl extends CtlBase {
}
}
async updateExpressInfoByDeliverCode(mobj, qobj, req) {//更新邮寄信息
async updateExpressInfoByDeliverCode (mobj, qobj, req) {//更新邮寄信息
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.expressInfo && pobj.expressInfo != 'undefined') {
try {
if (pobj.expressInfo.addresseePhone && pobj.expressInfo.addresseePhone != 'undefined'){
if (pobj.expressInfo.addresseePhone && pobj.expressInfo.addresseePhone != 'undefined') {
pobj.expressInfo.addresseePhone = system.encryptStr(pobj.expressInfo.addresseePhone);
}
var deliverInfo = await this.service.findInfoByDeliverCode(pobj)//先得到交付单详情
......@@ -555,7 +554,7 @@ class DeliverybillCtl extends CtlBase {
}
/*更新业务员信息*/
async updateSalesmanInfoByDeliverCode(mobj, qobj, req) {
async updateSalesmanInfoByDeliverCode (mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
......@@ -599,7 +598,7 @@ class DeliverybillCtl extends CtlBase {
}
/*根据交付单编号更新交付单详情*/
async updateInfoByDeliverCode(mobj, qobj, req) {//
async updateInfoByDeliverCode (mobj, qobj, req) {//
var pobj = mobj.d;
console.log("根据交付单编号更新交付单详情-------------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
......@@ -627,42 +626,41 @@ class DeliverybillCtl extends CtlBase {
await this.service.updateInfoByDeliverCode(parms);
//更新材料信息
//相关数据加密
if (pobj.expressInfo && pobj.expressInfo.addresseePhone && pobj.expressInfo.addresseePhone != 'undefined'){
if (pobj.expressInfo && pobj.expressInfo.addresseePhone && pobj.expressInfo.addresseePhone != 'undefined') {
pobj.expressInfo.addresseePhone = system.encryptStr(pobj.expressInfo.addresseePhone);
}
if (pobj.contributionInfo){
if (pobj.contributionInfo.contributionData && pobj.contributionInfo.contributionData.length >0){
for (var i =0;i<pobj.contributionInfo.contributionData.length;i++)
{
if (pobj.contributionInfo.contributionData[i].phoneNumber && pobj.contributionInfo.contributionData[i].phoneNumber != 'undefined'){
if (pobj.contributionInfo) {
if (pobj.contributionInfo.contributionData && pobj.contributionInfo.contributionData.length > 0) {
for (var i = 0; i < pobj.contributionInfo.contributionData.length; i++) {
if (pobj.contributionInfo.contributionData[i].phoneNumber && pobj.contributionInfo.contributionData[i].phoneNumber != 'undefined') {
pobj.contributionInfo.contributionData[i].phoneNumber = system.encryptStr(pobj.contributionInfo.contributionData[i].phoneNumber);
}
if (pobj.contributionInfo.contributionData[i].IdentificationNumber && pobj.contributionInfo.contributionData[i].IdentificationNumber != 'undefined'){
if (pobj.contributionInfo.contributionData[i].IdentificationNumber && pobj.contributionInfo.contributionData[i].IdentificationNumber != 'undefined') {
pobj.contributionInfo.contributionData[i].IdentificationNumber = system.encryptStr(pobj.contributionInfo.contributionData[i].IdentificationNumber);
}
}
}
}
if (pobj.positionInfo){
if (pobj.positionInfo.positionData && pobj.positionInfo.positionData.length >0){
for (var i=0;i<pobj.positionInfo.positionData.length;i++){
if (pobj.positionInfo.positionData[i].fixedPhone && pobj.positionInfo.positionData[i].fixedPhone != 'undefined'){
if (pobj.positionInfo) {
if (pobj.positionInfo.positionData && pobj.positionInfo.positionData.length > 0) {
for (var i = 0; i < pobj.positionInfo.positionData.length; i++) {
if (pobj.positionInfo.positionData[i].fixedPhone && pobj.positionInfo.positionData[i].fixedPhone != 'undefined') {
pobj.positionInfo.positionData[i].fixedPhone = system.encryptStr(pobj.positionInfo.positionData[i].fixedPhone);
}
if (pobj.positionInfo.positionData[i].mobilePhone && pobj.positionInfo.positionData[i].mobilePhone != 'undefined'){
if (pobj.positionInfo.positionData[i].mobilePhone && pobj.positionInfo.positionData[i].mobilePhone != 'undefined') {
pobj.positionInfo.positionData[i].mobilePhone = system.encryptStr(pobj.positionInfo.positionData[i].mobilePhone);
}
}
}
}
if (pobj.managerInfo && pobj.managerInfo != 'undefined'){
if (pobj.managerInfo.phoneNumber && pobj.managerInfo.phoneNumber != 'undefined'){
if (pobj.managerInfo && pobj.managerInfo != 'undefined') {
if (pobj.managerInfo.phoneNumber && pobj.managerInfo.phoneNumber != 'undefined') {
pobj.managerInfo.phoneNumber = system.encryptStr(pobj.managerInfo.phoneNumber);
}
if (pobj.managerInfo.IdentificationNumber && pobj.managerInfo.IdentificationNumber != 'undefined'){
if (pobj.managerInfo.IdentificationNumber && pobj.managerInfo.IdentificationNumber != 'undefined') {
pobj.managerInfo.IdentificationNumber = system.encryptStr(pobj.managerInfo.IdentificationNumber);
}
}
......@@ -715,14 +713,14 @@ class DeliverybillCtl extends CtlBase {
}
async settleApplyForTacent(p, q, req) {
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) {
async settleApply (p, q, req) {
let ids = p.ids
let spname = p.spname
let spid = p.spid
......@@ -730,7 +728,7 @@ class DeliverybillCtl extends CtlBase {
return system.getResult({})
}
/*根据商机编号插入交付单信息*/
async insertInfo(nobj, qobj, req) {//队列的时候用
async insertInfo (nobj, qobj, req) {//队列的时候用
var pobj = nobj.d;
console.log("根据交付单编号更新交付单详情-------------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
......@@ -847,7 +845,7 @@ class DeliverybillCtl extends CtlBase {
}
if (pobj.baseInfo.contactsPhone && pobj.baseInfo.contactsPhone != 'undefined') {
// pobj.baseInfo.contactsPhone = system.encryptStr(pobj.baseInfo.contactsPhone);
// pobj.baseInfo.contactsPhone = system.encryptStr(pobj.baseInfo.contactsPhone);
pobj.cacheInfo.cmpContactInfo.contactsPhone = pobj.baseInfo.contactsPhone;
}
if (pobj.baseInfo.virtualPrice && pobj.baseInfo.virtualPrice != 'undefined') {//虚拟地址价格
......@@ -911,7 +909,7 @@ class DeliverybillCtl extends CtlBase {
}
}
/*获取压缩文件的信息 */
async findZipUrlByDeliverCode(mobj, qobj, req) {//
async findZipUrlByDeliverCode (mobj, qobj, req) {//
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
......@@ -960,14 +958,14 @@ class DeliverybillCtl extends CtlBase {
}
}
timeFormat(date) {
timeFormat (date) {
let localTime = moment.utc(date).toDate();
localTime = moment(localTime).format("YYYY-MM-DD");
return localTime;
}
//元转分 - 解决精度问题 yuan:要转换的钱,单位元; digit:转换倍数
YuanToFen(yuan, digit) {
YuanToFen (yuan, digit) {
var m = 0,
s1 = yuan.toString(),
s2 = digit.toString();
......@@ -976,7 +974,7 @@ class DeliverybillCtl extends CtlBase {
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
}
FenToYuan(fen) {
FenToYuan (fen) {
var num = fen;
num = fen * 0.01;
num += '';
......@@ -986,7 +984,7 @@ class DeliverybillCtl extends CtlBase {
return num;
}
toDecimal2(x) {
toDecimal2 (x) {
var f = parseFloat(x);
if (isNaN(f)) {
return false;
......@@ -1005,7 +1003,7 @@ class DeliverybillCtl extends CtlBase {
}
//time时间n年后的的前一天
oneYearPast(time, n) {
oneYearPast (time, n) {
//var time=new Date();
try {
var year = time.getFullYear() + n;
......@@ -1021,7 +1019,7 @@ class DeliverybillCtl extends CtlBase {
}
//计算俩日期相差多少天
diffDays(time1, time2) {
diffDays (time1, time2) {
try {
var m1 = moment(time1);
var m2 = moment(time2);
......
......@@ -5,7 +5,7 @@ const request = require('request');
const cryptoJS = require('crypto-js');
class System {
static declare(ns) {
static declare (ns) {
var ar = ns.split('.');
var root = System;
for (var i = 0, len = ar.length; i < len; ++i) {
......@@ -18,7 +18,7 @@ class System {
}
}
}
static async delReq(url, qdata) {
static async delReq (url, qdata) {
let rtn = {}
let promise = new Promise(function (resv, rej) {
request.del({
......@@ -41,7 +41,7 @@ class System {
})
return promise;
}
static async getReq(url, qdata) {
static async getReq (url, qdata) {
let rtn = {}
let promise = new Promise(function (resv, rej) {
request.get({
......@@ -64,7 +64,7 @@ class System {
})
return promise;
}
static async postJsonTypeReq(url, data, md = "POST") {
static async postJsonTypeReq (url, data, md = "POST") {
let rtn = {}
let promise = new Promise(function (resv, rej) {
request({
......@@ -92,7 +92,7 @@ class System {
})
return promise;
}
static async post3wFormTypeReq(url, data) {
static async post3wFormTypeReq (url, data) {
let rtn = {}
let promise = new Promise(function (resv, rej) {
request.post({
......@@ -111,7 +111,7 @@ class System {
})
return promise;
}
static async postMpFormTypeReq(url, formdata) {
static async postMpFormTypeReq (url, formdata) {
let promise = new Promise(function (resv, rej) {
request.post({
url: url,
......@@ -133,7 +133,7 @@ class System {
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
*/
static getResult(data, opmsg = "操作成功", req) {
static getResult (data, opmsg = "操作成功", req) {
return {
status: !data ? -1 : 0,
msg: opmsg,
......@@ -146,7 +146,7 @@ class System {
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultSuccess(data, okmsg = "success") {
static getResultSuccess (data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
......@@ -159,7 +159,7 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static getResultFail(status = -1, errmsg = "fail", data = null) {
static getResultFail (status = -1, errmsg = "fail", data = null) {
return {
status: status,
msg: errmsg,
......@@ -171,14 +171,14 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static getResultError(errmsg = "fail", data = null) {
static getResultError (errmsg = "fail", data = null) {
return {
status: -200,
msg: errmsg,
data: data,
};
}
static register(key, ClassObj, groupName, filename) {
static register (key, ClassObj, groupName, filename) {
if (System.objTable[key] != null) {
throw new Error("相同key的对象已经存在");
} else {
......@@ -193,7 +193,7 @@ class System {
return System.objTable[key];
}
static getObject(objpath) {
static getObject (objpath) {
var pathArray = objpath.split(".");
var packageName = pathArray[0];
var groupName = pathArray[1];
......@@ -234,7 +234,7 @@ class System {
}
}
static getSysConfig() {
static getSysConfig () {
var configPath = settings.basepath + "/app/base/db/metadata/index.js";
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
......@@ -244,7 +244,7 @@ class System {
var configValue = require(configPath);
return configValue.config;
}
static get_client_ip(req) {
static get_client_ip (req) {
var ip = req.headers['x-forwarded-for'] ||
req.ip ||
req.connection.remoteAddress ||
......@@ -267,7 +267,7 @@ class System {
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
*/
static execLogs(opTitle, params, identifyCode, resultInfo, errorInfo) {
static execLogs (opTitle, params, identifyCode, resultInfo, errorInfo) {
var reqUrl = settings.logUrl();
let isLogData = true
if (params.method && (params.method.indexOf("find") >= 0 || params.method.indexOf("get") >= 0)) {
......@@ -304,9 +304,9 @@ class System {
* 加密信息
* @param {*} opStr
*/
static encryptStr(opStr) {
static encryptStr (opStr) {
if (!opStr) {
return "opStr is empty";
return opStr;
}
let keyHex = cryptoJS.enc.Utf8.parse(settings.encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(settings.encrypt_secret.substring(0, 8));
......@@ -317,17 +317,21 @@ class System {
* 解密信息
* @param {*} opStr
*/
static decryptStr(opStr) {
static decryptStr (opStr) {
if (!opStr) {
return "opStr is empty";
return opStr;
}
try {
let keyHex = cryptoJS.enc.Utf8.parse(settings.encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(settings.encrypt_secret.substring(0, 8));
var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, {
iv: ivHex
});
var plaintext = bytes.toString(cryptoJS.enc.Utf8);
return plaintext || opStr;
} catch (error) {
return opStr;
}
let keyHex = cryptoJS.enc.Utf8.parse(settings.encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(settings.encrypt_secret.substring(0, 8));
var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, {
iv: ivHex
});
var plaintext = bytes.toString(cryptoJS.enc.Utf8);
return plaintext;
}
......@@ -390,4 +394,6 @@ module.exports = System;
// }catch(e){
// console.log(e);
// }
// })()
\ No newline at end of file
// })()
// console.log(System.decryptStr("13381139519"))
\ No newline at end of file
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