Commit 41f3a3c8 by 王昆

gsb

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