Commit 41f3a3c8 by 王昆

gsb

parent 296b11ae
...@@ -2,10 +2,12 @@ var APIBase = require("../../api.base"); ...@@ -2,10 +2,12 @@ var APIBase = require("../../api.base");
var system = require("../../../system"); var system = require("../../../system");
const crypto = require('crypto'); const crypto = require('crypto');
const xlsx = require('node-xlsx'); const xlsx = require('node-xlsx');
const moment = require("moment");
class LaoActionApi extends APIBase { class LaoActionApi extends APIBase {
constructor() { constructor() {
super(); super();
this.signUrl = "https://bpohhr.gongsibao.com/ec3rd?appId=lwb";
this.usersSve = system.getObject("service.operator.usersSve"); this.usersSve = system.getObject("service.operator.usersSve");
this.logSve = system.getObject("service.operator.logSve"); this.logSve = system.getObject("service.operator.logSve");
this.recruitSve = system.getObject("service.operator.recruitSve"); this.recruitSve = system.getObject("service.operator.recruitSve");
...@@ -23,7 +25,7 @@ class LaoActionApi extends APIBase { ...@@ -23,7 +25,7 @@ class LaoActionApi extends APIBase {
this.applyStatusMap = { this.applyStatusMap = {
10: "已申请", 10: "已申请",
20: "邀请面试", 20: "面试",
30: "面试成功", 30: "面试成功",
40: "面试失败", 40: "面试失败",
50: "待签约", 50: "待签约",
...@@ -331,43 +333,38 @@ class LaoActionApi extends APIBase { ...@@ -331,43 +333,38 @@ class LaoActionApi extends APIBase {
var parm = {}; var parm = {};
parm.id = obj.id; parm.id = obj.id;
parm.user_id = obj.user_id; parm.user_id = obj.user_id;
if (obj.labour_id){ if (obj.labour_id) {
parm.labour_id = obj.labour_id; parm.labour_id = obj.labour_id;
} }
parm.recruit_id = obj.recruit_id; parm.recruit_id = obj.recruit_id;
parm.labour_user_id = obj.labour_user_id; parm.labour_user_id = obj.labour_user_id;
if (obj.ecid){ if (obj.ecid) {
parm.ecid = obj.ecid; parm.ecid = obj.ecid;
} }
if (obj.apply_stauts == "已申请") { if (obj.apply_stauts == "已申请") {
parm.apply_stauts = 10; parm.apply_stauts = 10;
} } else if (obj.apply_stauts == "邀请面试") {
else if (obj.apply_stauts == "邀请面试") {
parm.apply_stauts = 20; parm.apply_stauts = 20;
} } else if (obj.apply_stauts == "面试成功") {
else if (obj.apply_stauts == "面试成功") {
parm.apply_stauts = 30; parm.apply_stauts = 30;
} } else if (obj.apply_stauts == "面试失败") {
else if (obj.apply_stauts == "面试失败") {
parm.apply_stauts = 40; parm.apply_stauts = 40;
} } else if (obj.apply_stauts == "待签约") {
else if (obj.apply_stauts == "待签约") {
parm.apply_stauts = 50; parm.apply_stauts = 50;
} } else if (obj.apply_stauts == "签约成功") {
else if (obj.apply_stauts == "签约成功") {
parm.apply_stauts = 60; parm.apply_stauts = 60;
} }
if (obj.interview_time){ if (obj.interview_time) {
parm.interview_time = obj.interview_time; parm.interview_time = obj.interview_time;
} }
if (obj.sign_at){ if (obj.sign_at) {
parm.sign_at = obj.sign_at; parm.sign_at = obj.sign_at;
} }
if (obj.contract_url){ if (obj.contract_url) {
parm.contract_url = obj.contract_url; parm.contract_url = obj.contract_url;
} }
...@@ -375,8 +372,8 @@ class LaoActionApi extends APIBase { ...@@ -375,8 +372,8 @@ class LaoActionApi extends APIBase {
return system.getResult(result.data.dataValues); return system.getResult(result.data.dataValues);
} }
async FindUserLabourInfo(obj){//获取应聘信息 async FindUserLabourInfo(obj) {//获取应聘信息
if (!obj){ if (!obj) {
return system.getResult(null, "参数不能为空"); return system.getResult(null, "参数不能为空");
} }
var temp_info = {}; var temp_info = {};
...@@ -393,95 +390,151 @@ class LaoActionApi extends APIBase { ...@@ -393,95 +390,151 @@ class LaoActionApi extends APIBase {
parm.current_page = 1; parm.current_page = 1;
} }
if (obj.id){ if (obj.id) {
parm.id = obj.id; parm.id = obj.id;
} }
if (obj.user_id){ if (obj.user_id) {
parm.user_id = obj.user_id; parm.user_id = obj.user_id;
} }
if (obj.labour_id){ if (obj.labour_id) {
parm.labour_id = obj.labour_id; parm.labour_id = obj.labour_id;
} }
if (obj.recruit_id){ if (obj.recruit_id) {
parm.recruit_id = obj.recruit_id; parm.recruit_id = obj.recruit_id;
} }
if (obj.labour_user_id){ if (obj.labour_user_id) {
parm.labour_user_id = obj.labour_user_id; parm.labour_user_id = obj.labour_user_id;
} }
if (obj.ecid){ if (obj.ecid) {
parm.ecid = obj.ecid; parm.ecid = obj.ecid;
} }
if (obj.apply_stauts){ if (obj.apply_stauts) {
if (obj.apply_stauts == "已申请"){ if (obj.apply_stauts == "已申请") {
parm.apply_stauts = 10; parm.apply_stauts = 10;
} } else if (obj.apply_stauts == "邀请面试") {
else if (obj.apply_stauts == "邀请面试"){
parm.apply_stauts = 20; parm.apply_stauts = 20;
} } else if (obj.apply_stauts == "面试成功") {
else if (obj.apply_stauts == "面试成功"){
parm.apply_stauts = 30; parm.apply_stauts = 30;
} } else if (obj.apply_stauts == "面试失败") {
else if (obj.apply_stauts == "面试失败"){
parm.apply_stauts = 40; parm.apply_stauts = 40;
} } else if (obj.apply_stauts == "待签约") {
else if (obj.apply_stauts == "待签约"){
parm.apply_stauts = 50; parm.apply_stauts = 50;
} } else if (obj.apply_stauts == "签约成功") {
else if (obj.apply_stauts == "签约成功"){
parm.apply_stauts = 60; parm.apply_stauts = 60;
} }
} }
temp_info = await this.userlabourSve.finduserlabourByWhere(parm); temp_info = await this.userlabourSve.finduserlabourByWhere(parm);
if (temp_info.status == 0) { if (temp_info.status == 0) {
try{ try {
for (var i=0;i< temp_info.data.rows.length; i++){ for (var i = 0; i < temp_info.data.rows.length; i++) {
var cominfo = await this.usersSve.findUserInfoByid(temp_info.data.rows[i].user_id); var cominfo = await this.usersSve.findUserInfoByid(temp_info.data.rows[i].user_id);
if (cominfo){ if (cominfo) {
temp_info.data.rows[i].com_name = cominfo.com_name; temp_info.data.rows[i].com_name = cominfo.com_name;
} } else {
else{
temp_info.data.rows[i].com_name = ""; temp_info.data.rows[i].com_name = "";
} }
temp_info.data.rows[i].apply_stauts_name = this.applyStatusMap[temp_info.data.rows[i].apply_stauts]; temp_info.data.rows[i].apply_stauts_name = this.applyStatusMap[temp_info.data.rows[i].apply_stauts];
var recruiinfo = await this.recruitSve.findById(temp_info.data.rows[i].recruit_id); var recruiinfo = await this.recruitSve.findById(temp_info.data.rows[i].recruit_id);
if (recruiinfo){ if (recruiinfo) {
temp_info.data.rows[i].recruit_name = recruiinfo.recruit_name; temp_info.data.rows[i].recruit_name = recruiinfo.recruit_name;
temp_info.data.rows[i].work_address = recruiinfo.work_address; temp_info.data.rows[i].work_address = recruiinfo.work_address;
} } else {
else{
temp_info.data.rows[i].recruit_name = ""; temp_info.data.rows[i].recruit_name = "";
temp_info.data.rows[i].work_address = ""; temp_info.data.rows[i].work_address = "";
} }
var userinfo = await this.usersSve.findUserInfoByid(temp_info.data.rows[i].labour_user_id); var userinfo = await this.usersSve.findUserInfoByid(temp_info.data.rows[i].labour_user_id);
if (userinfo){ if (userinfo) {
temp_info.data.rows[i].phone_no = userinfo.phone_no; temp_info.data.rows[i].phone_no = userinfo.phone_no;
temp_info.data.rows[i].user_name = userinfo.user_name;; temp_info.data.rows[i].user_name = userinfo.user_name;
temp_info.data.rows[i].id_card = userinfo.id_card;; temp_info.data.rows[i].id_card = userinfo.id_card;
} } else {
else{
temp_info.data.rows[i].phone_no = ""; temp_info.data.rows[i].phone_no = "";
temp_info.data.rows[i].user_name = ""; temp_info.data.rows[i].user_name = "";
temp_info.data.rows[i].id_card = ""; temp_info.data.rows[i].id_card = "";
} }
// userId=5&ecid=495
if(userinfo && temp_info.data.rows[i].ecid && temp_info.data.rows[i].apply_stauts == 50) {
temp_info.data.rows[i].signUrl = this.signUrl + `&userId=${userinfo.id}&&ecid=${temp_info.data.rows[i].ecid}`;
}
} }
return temp_info; return temp_info;
} } catch (e) {
catch (e)
{
console.log(e); console.log(e);
return system.getResult(null, "获取数据失败"); return system.getResult(null, "获取数据失败");
} }
} } else {
else{
console.log(e); console.log(e);
return system.getResult(null, "获取数据失败"); return system.getResult(null, "获取数据失败");
} }
} }
// 我的应聘-邀请面试
async inviteInterview(obj) {
let id = Number(obj.id || 0);
let interviewTime = moment(obj.interviewTime);
let userlabour = await this.userlabourSve.findById(id);
if (!userlabour) {
return system.getResult(null, "应聘信息不存在");
}
if (userlabour.apply_stauts != 10) {
return system.getResult(null, "已邀请");
}
userlabour.apply_stauts = 20;
userlabour.interview_time = interviewTime;
await userlabour.save();
return system.getResultSuccess();
}
// 我的应聘-面试 成功or失败
async interviewResult(obj) {
let id = Number(obj.id || 0);
let userlabour = await this.userlabourSve.findById(id);
if (!userlabour) {
return system.getResult(null, "应聘信息不存在");
}
if (userlabour.apply_stauts != 20) {
return system.getResult(null, "面试结果已处理");
}
if (obj.success) {
userlabour.apply_stauts = 30;
} else {
userlabour.apply_stauts = 40;
}
await userlabour.save();
return system.getResultSuccess();
}
// 我的应聘-发起签约
async inviteSign(obj) {
let id = Number(obj.id || 0);
let ecid = Number(obj.ecid || 0);
let userlabour = await this.userlabourSve.findById(id);
if (!userlabour) {
return system.getResult(null, "应聘信息不存在");
}
if (userlabour.apply_stauts != 30) {
return system.getResult(null, "已发起签约");
}
userlabour.apply_stauts = 50;
userlabour.ecid = ecid;
await userlabour.save();
return system.getResultSuccess();
}
async FindRecruitInfo(obj) { //获取招聘信息 async FindRecruitInfo(obj) { //获取招聘信息
if (!obj) { if (!obj) {
return system.getResult(null, "参数不能为空"); return system.getResult(null, "参数不能为空");
...@@ -700,7 +753,7 @@ class LaoActionApi extends APIBase { ...@@ -700,7 +753,7 @@ class LaoActionApi extends APIBase {
return system.getResult(null, "人才id不存在"); return system.getResult(null, "人才id不存在");
} }
if(!obj.recruit_id) { if (!obj.recruit_id) {
return system.getResult(null, "请选择招聘信息"); return system.getResult(null, "请选择招聘信息");
} }
...@@ -738,20 +791,19 @@ class LaoActionApi extends APIBase { ...@@ -738,20 +791,19 @@ class LaoActionApi extends APIBase {
return await this.recruitSve.findRecruitByWhere(parm); return await this.recruitSve.findRecruitByWhere(parm);
} }
async UpdateUserLabourStatusInfo(obj){//根据id更新应聘信息 async UpdateUserLabourStatusInfo(obj) {//根据id更新应聘信息
if (!obj.id || !obj.apply_stauts){ if (!obj.id || !obj.apply_stauts) {
return system.getResult(null, "参数错误"); return system.getResult(null, "参数错误");
} }
try{ try {
var re = await this.userlabourSve.updateStatus(obj); var re = await this.userlabourSve.updateStatus(obj);
if (re == 1) { if (re == 1) {
return system.getResult(re); return system.getResult(re);
} else { } else {
return system.getResult(null, "更新数据失败"); return system.getResult(null, "更新数据失败");
} }
} } catch {
catch{
return system.getResult(null, "更新失败!"); return system.getResult(null, "更新失败!");
} }
...@@ -1216,9 +1268,9 @@ class LaoActionApi extends APIBase { ...@@ -1216,9 +1268,9 @@ class LaoActionApi extends APIBase {
/** /**
* 纳税信息 * 纳税信息
* @param {*} obj * @param {*} obj
*/ */
async taxinfoListByMonth(obj){ async taxinfoListByMonth(obj) {
try { try {
return await this.taxinfoSve.taxinfoListByMonth(obj); return await this.taxinfoSve.taxinfoListByMonth(obj);
} catch (error) { } catch (error) {
...@@ -1229,9 +1281,9 @@ class LaoActionApi extends APIBase { ...@@ -1229,9 +1281,9 @@ class LaoActionApi extends APIBase {
/** /**
* 纳税信息 按照人信息 * 纳税信息 按照人信息
* @param {*} obj * @param {*} obj
*/ */
async taxinfoListByUser(obj){ async taxinfoListByUser(obj) {
try { try {
return await this.taxinfoSve.taxinfoListByUser(obj); return await this.taxinfoSve.taxinfoListByUser(obj);
} catch (error) { } catch (error) {
...@@ -1242,9 +1294,9 @@ class LaoActionApi extends APIBase { ...@@ -1242,9 +1294,9 @@ class LaoActionApi extends APIBase {
/** /**
* 纳税信息 明细 * 纳税信息 明细
* @param {*} obj * @param {*} obj
*/ */
async taxinfoById(obj){ async taxinfoById(obj) {
try { try {
return await this.taxinfoSve.taxinfoById(obj); return await this.taxinfoSve.taxinfoById(obj);
} catch (error) { } catch (error) {
......
...@@ -6,7 +6,7 @@ class XbgApi extends apiBase { ...@@ -6,7 +6,7 @@ class XbgApi extends apiBase {
constructor() { constructor() {
super(); super();
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.url = "http://192.168.18.125:3000/api/xbgApi/"; this.url = "http://bpohhr.gongsibao.com/api/xbgApi/";
// this.url = "https://bpohhr.gongsibao.com/api/xbgApi/"; // this.url = "https://bpohhr.gongsibao.com/api/xbgApi/";
this.testCompanyIds = 12; this.testCompanyIds = 12;
this.ecompanyId = '1103817785420820481'; this.ecompanyId = '1103817785420820481';
...@@ -230,8 +230,8 @@ class XbgApi extends apiBase { ...@@ -230,8 +230,8 @@ class XbgApi extends apiBase {
} }
let params = { let params = {
idNo: "222403198301071778", // idNo: "222403198301071778",
// idNo: userInfo.id_card, idNo: userInfo.id_card,
ecid: userlabour.ecid, ecid: userlabour.ecid,
}; };
let rs = await this.restClient.execPost(params, this.url + "validLwbSign"); let rs = await this.restClient.execPost(params, this.url + "validLwbSign");
...@@ -268,8 +268,8 @@ class XbgApi extends apiBase { ...@@ -268,8 +268,8 @@ class XbgApi extends apiBase {
} }
let params = { let params = {
idNo: "222403198301071778", // idNo: "222403198301071778",
// idNo: userInfo.id_card, idNo: userInfo.id_card,
ecid: userlabour.ecid, ecid: userlabour.ecid,
}; };
......
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