Commit 2b787e33 by 王悦

Merge branch 'ic-deliver' of /Users/feng/feng/gongsibao/zhichan with conflicts.

parent 727ed38d
......@@ -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) {
......@@ -95,7 +95,6 @@ class DeliverybillCtl extends CtlBase {
robj.clerkName = element.salesman_name;//业务员名称
robj.clerkPhone = system.decryptStr(element.salesman_phone);//业务员电话
robj.deliveryName = element.delivery_man_name;//交付人员名称
robj.baseInfo.deliveryName = element.delivery_man_name;//交付人员名称
robj.createdTime = this.timeFormat(element.created_at);//交付单创建时间
robj.created_at = this.timeFormat(element.created_at);//交付单创建时间-shousuo
rarr.push(robj);
......@@ -109,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 {
......@@ -131,13 +130,12 @@ 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 {
var rs = await this.service.findInfoByDeliverCode(pobj);
var ms = await this.materialService.findInfoByDeliverNumber(pobj);
console.log("ms___________________________" + JSON.stringify(ms));
var rarr = {
"baseInfo": {},
"contactsInfo": {},
......@@ -165,7 +163,6 @@ class DeliverybillCtl extends CtlBase {
rarr.baseInfo.clerkName = rs.salesman_name;//业务员名称
rarr.baseInfo.clerkPhone = system.decryptStr(rs.salesman_phone);//业务员电话
rarr.deliveryName = rs.delivery_man_name;//交付人员名称
rarr.baseInfo.deliveryName = rs.delivery_man_name;//交付人员名称
rarr.baseInfo.sellingPrice = this.FenToYuan(rs.selling_price);//价格
rarr.baseInfo.costPrice = this.FenToYuan(rs.cost_price);//成本价
rarr.baseInfo.deliverStatus = rs.delivery_status;//状态
......@@ -212,7 +209,7 @@ class DeliverybillCtl extends CtlBase {
rarr.baseInfo.buyDuration = rs.delivery_info.buyDuration;//购买时长
}
if (rs.delivery_info.buyTime && rs.delivery_info.buyTime != 'undefined') {
rarr.baseInfo.buyTime = this.timeFormat(rs.delivery_info.buyTime);//购买时间
rarr.baseInfo.buyTime = rs.delivery_info.buyTime;//购买时间
}
if (rs.delivery_info.startTime && rs.delivery_info.startTime != 'undefined') {
rarr.baseInfo.startTime = rs.delivery_info.startTime;//开始计费时间
......@@ -243,31 +240,32 @@ 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 < position_t_info.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);
}
}
......@@ -277,24 +275,22 @@ 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);
}
}
return system.getResult(rarr);
}
catch (error) {
console.log("error___________________________" + error);
return system.getResultError(error);
}
}
else {
console.log("参数错误!___________________________");
return system.getResultError("参数错误!");
}
}
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 {
......@@ -367,7 +363,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') {
......@@ -420,7 +416,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') {
......@@ -443,7 +439,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 {
......@@ -505,11 +501,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)//先得到交付单详情
......@@ -558,8 +554,8 @@ class DeliverybillCtl extends CtlBase {
}
}
/*更新业务员信息*/
async updateSalesmanInfoByDeliverCode (mobj, qobj, req) {
/*更新业务员/交付员信息*/
async updateUsermanInfoByDeliverCode(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
......@@ -570,20 +566,34 @@ class DeliverybillCtl extends CtlBase {
"flowId": res.id,
"flowCode": pobj.deliverNumber,
"salesmanInfo": {
"oldOpcode": res.delivery_man_opcode,
"oldClerkName": res.delivery_man_name,
"oldClerkId": res.delivery_man_id,
//"oldClerkPhone": res.salesman_phone,
"oldFacilitatorId": res.facilitator_id,
"oldFacilitatorName": res.facilitator_name,
"newOpcode": pobj.salesmanOpcode,
"newClerkName": pobj.salesmanName,
"newClerkId": pobj.salesmanId,
//"newClerkPhone": pobj.salesmanPhone,
"newFacilitatorId": pobj.facilitatorId,
"newFacilitatorName": pobj.facilitatorName
}
}
if (pobj.type == "deliverman") {
sInfo.salesmanInfo = {
"oldOpcode": res.delivery_man_opcode,
"oldClerkName": res.delivery_man_name,
"oldClerkId": res.delivery_man_id,
"newOpcode": pobj.deliverymanOpcode,
"newClerkName": pobj.deliverymanName,
"newClerkId": pobj.deliverymanId,
}
}
if (pobj.type == "salesman") {
sInfo.salesmanInfo = {
"oldOpcode": res.sales_man_opcode,
"oldClerkName": res.sales_man_name,
"oldClerkId": res.sales_man_id,
"newOpcode": pobj.salesmanOpcode,
"newClerkName": pobj.salesmanName,
"newClerkId": pobj.salesmanId,
}
}
await this.shisService.insertInfo(sInfo);//之前业务员转历史
await this.service.updateSalesmanInfoByDeliverCode(pobj);//更新业务员信息
return system.getResult("操作成功!");
......@@ -603,7 +613,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') {
......@@ -631,41 +641,42 @@ 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);
}
}
......@@ -718,14 +729,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
......@@ -733,7 +744,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') {
......@@ -914,7 +925,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 {
......@@ -963,14 +974,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();
......@@ -979,7 +990,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 += '';
......@@ -989,7 +1000,7 @@ class DeliverybillCtl extends CtlBase {
return num;
}
toDecimal2 (x) {
toDecimal2(x) {
var f = parseFloat(x);
if (isNaN(f)) {
return false;
......@@ -1008,7 +1019,7 @@ class DeliverybillCtl extends CtlBase {
}
//time时间n年后的的前一天
oneYearPast (time, n) {
oneYearPast(time, n) {
//var time=new Date();
try {
var year = time.getFullYear() + n;
......@@ -1024,7 +1035,7 @@ class DeliverybillCtl extends CtlBase {
}
//计算俩日期相差多少天
diffDays (time1, time2) {
diffDays(time1, time2) {
try {
var m1 = moment(time1);
var m2 = moment(time2);
......
......@@ -84,18 +84,31 @@ class DeliverybillDao extends Dao {
return await this.updateByWhere(setobj, whereobj, t);
}
/*更新交付人员信息*/
/*更新业务员/交付员信息*/
async updateSalesmanInfoByDeliverCode(qobj, t) {
var setobj = {};
if(qobj.type == "salesman") {
if (qobj.salesmanId && qobj.salesmanId != 'undefined') {
setobj.delivery_man_id = qobj.salesmanId;
setobj.salesman_id = qobj.salesmanId;
};
if (qobj.salesmanName && qobj.salesmanName != 'undefined') {
setobj.delivery_man_name = qobj.salesmanName;
setobj.salesman_name = qobj.salesmanName;
};
if (qobj.salesmanOpcode && qobj.salesmanOpcode != 'undefined') {
setobj.delivery_man_opcode = qobj.salesmanOpcode;
setobj.salesman_opcode = qobj.salesmanOpcode;
};
}
if(qobj.type == "deliverman") {
if (qobj.deliverymanId && qobj.deliverymanId != 'undefined') {
setobj.delivery_man_id = qobj.deliverymanId;
};
if (qobj.deliverymanName && qobj.deliverymanName != 'undefined') {
setobj.delivery_man_name = qobj.deliverymanName;
};
if (qobj.deliverymanOpcode && qobj.deliverymanOpcode != 'undefined') {
setobj.delivery_man_opcode = qobj.deliverymanOpcode;
};
}
// if (qobj.salesmanPhone && qobj.salesmanPhone != 'undefined') {
// setobj.salesman_phone = qobj.salesmanPhone;
// };
......
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