|
@@ -75,16 +75,47 @@ class LookuserService extends CrudService {
|
|
}
|
|
}
|
|
|
|
|
|
async updatexf(data) {
|
|
async updatexf(data) {
|
|
- const { roomid, isxf, userid, hosname, deptname, level, major } = data;
|
|
|
|
|
|
+ const { roomid, userid } = data;
|
|
const lookuser = await this.model.findOne({ roomid, userid });
|
|
const lookuser = await this.model.findOne({ roomid, userid });
|
|
if (!lookuser) {
|
|
if (!lookuser) {
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
|
|
}
|
|
}
|
|
- lookuser.isxf = isxf;
|
|
|
|
- lookuser.hosname = hosname;
|
|
|
|
- lookuser.deptname = deptname;
|
|
|
|
- lookuser.level = level;
|
|
|
|
- lookuser.major = major;
|
|
|
|
|
|
+ if (data.hosname) {
|
|
|
|
+ lookuser.hosname = data.hosname;
|
|
|
|
+ }
|
|
|
|
+ if (data.deptname) {
|
|
|
|
+ lookuser.deptname = data.deptname;
|
|
|
|
+ }
|
|
|
|
+ if (data.level) {
|
|
|
|
+ lookuser.level = data.level;
|
|
|
|
+ }
|
|
|
|
+ if (data.title) {
|
|
|
|
+ lookuser.title = data.title;
|
|
|
|
+ }
|
|
|
|
+ if (data.remark) {
|
|
|
|
+ lookuser.remark = data.remark;
|
|
|
|
+ }
|
|
|
|
+ if (data.age) {
|
|
|
|
+ lookuser.age = data.age;
|
|
|
|
+ }
|
|
|
|
+ if (data.gender) {
|
|
|
|
+ lookuser.gender = data.gender;
|
|
|
|
+ }
|
|
|
|
+ if (data.idnumber) {
|
|
|
|
+ lookuser.idnumber = data.idnumber;
|
|
|
|
+ }
|
|
|
|
+ if (data.major) {
|
|
|
|
+ lookuser.major = data.major;
|
|
|
|
+ }
|
|
|
|
+ if (data.isjc) {
|
|
|
|
+ lookuser.isjc = data.isjc;
|
|
|
|
+ }
|
|
|
|
+ if (data.isxf) {
|
|
|
|
+ lookuser.isxf = data.isxf;
|
|
|
|
+ }
|
|
|
|
+ if (data.address) {
|
|
|
|
+ lookuser.address = data.address;
|
|
|
|
+ }
|
|
const res = await lookuser.save();
|
|
const res = await lookuser.save();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -98,27 +129,27 @@ class LookuserService extends CrudService {
|
|
const data = [];
|
|
const data = [];
|
|
for (const _luser of lusers) {
|
|
for (const _luser of lusers) {
|
|
const luser = _.cloneDeep(JSON.parse(JSON.stringify(_luser)));
|
|
const luser = _.cloneDeep(JSON.parse(JSON.stringify(_luser)));
|
|
- const user = await this.umodel.findById(_luser.userid);
|
|
|
|
- if (user) {
|
|
|
|
- luser.idnumber = user.number;
|
|
|
|
- luser.isjc = user.isjc;
|
|
|
|
- luser.isxf = user.isxf;
|
|
|
|
- luser.address = user.address;
|
|
|
|
- luser.age = user.age;
|
|
|
|
- luser.gender = user.gender;
|
|
|
|
- if (user.hosname) {
|
|
|
|
- luser.hosname = user.hosname;
|
|
|
|
- }
|
|
|
|
- if (user.deptname) {
|
|
|
|
- luser.deptname = user.deptname;
|
|
|
|
- }
|
|
|
|
- if (user.level) {
|
|
|
|
- luser.level = user.level;
|
|
|
|
- }
|
|
|
|
- if (user.major) {
|
|
|
|
- luser.major = user.major;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // const user = await this.umodel.findById(_luser.userid);
|
|
|
|
+ // if (user) {
|
|
|
|
+ // luser.idnumber = user.number;
|
|
|
|
+ // luser.isjc = user.isjc;
|
|
|
|
+ // luser.isxf = user.isxf;
|
|
|
|
+ // luser.address = user.address;
|
|
|
|
+ // luser.age = user.age;
|
|
|
|
+ // luser.gender = user.gender;
|
|
|
|
+ // if (user.hosname) {
|
|
|
|
+ // luser.hosname = user.hosname;
|
|
|
|
+ // }
|
|
|
|
+ // if (user.deptname) {
|
|
|
|
+ // luser.deptname = user.deptname;
|
|
|
|
+ // }
|
|
|
|
+ // if (user.level) {
|
|
|
|
+ // luser.level = user.level;
|
|
|
|
+ // }
|
|
|
|
+ // if (user.major) {
|
|
|
|
+ // luser.major = user.major;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
const lrecords = await this.rmodel.find({ roomid: _luser.roomid, userid: _luser.userid }).sort({ createtime: -1 }).limit(1);
|
|
const lrecords = await this.rmodel.find({ roomid: _luser.roomid, userid: _luser.userid }).sort({ createtime: -1 }).limit(1);
|
|
if (lrecords.length > 0) {
|
|
if (lrecords.length > 0) {
|
|
const lrecord = lrecords[0];
|
|
const lrecord = lrecords[0];
|