|
|
@@ -11,7 +11,11 @@ import com.uas.platform.b2b.model.InvitationRecord;
|
|
|
import com.uas.platform.b2b.model.User;
|
|
|
import com.uas.platform.b2b.ps.ProductUtils;
|
|
|
import com.uas.platform.b2b.service.InvitationRecordService;
|
|
|
-import com.uas.platform.b2b.support.*;
|
|
|
+import com.uas.platform.b2b.support.MessageConf;
|
|
|
+import com.uas.platform.b2b.support.SPageUtils;
|
|
|
+import com.uas.platform.b2b.support.SendMsgUtils;
|
|
|
+import com.uas.platform.b2b.support.SysConf;
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.persistence.criteria.CriterionExpression;
|
|
|
@@ -33,7 +37,11 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 邀请注册
|
|
|
@@ -79,57 +87,57 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
|
|
|
map.put("error", "该企业已注册!");
|
|
|
return map;
|
|
|
}
|
|
|
- Long useruu = SystemSession.getUser().getUserUU();
|
|
|
- Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ Long userUU = SystemSession.getUser().getUserUU();
|
|
|
+ Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
// UAS邀请注册通过Systemsession获取的用户UU不是当前用户UU,所以参数传过来
|
|
|
// 用户存在才设置进去,不然数据库会报错
|
|
|
if (record.getUseruu() != null) {
|
|
|
User erpUser = userDao.findOne(record.getUseruu());
|
|
|
if (erpUser != null) {
|
|
|
- useruu = record.getUseruu();
|
|
|
+ userUU = record.getUseruu();
|
|
|
}
|
|
|
}
|
|
|
// 企业存在才设置进去,不然数据库会报错
|
|
|
if (record.getEnuu() != null) {
|
|
|
Enterprise enterprise = enterpriseDao.findOne(record.getEnuu());
|
|
|
if (enterprise != null) {
|
|
|
- enuu = record.getEnuu();
|
|
|
+ enUU = record.getEnuu();
|
|
|
}
|
|
|
}
|
|
|
// 先判断记录
|
|
|
- InvitationRecord oldrecord = invitationRecordDao.findByUseruuAndVendname(useruu, record.getVendname());
|
|
|
+ InvitationRecord oldRecord = invitationRecordDao.findByUseruuAndVendname(userUU, record.getVendname());
|
|
|
// 如果是已存在的,直接替换
|
|
|
if (record.getId() != null) {
|
|
|
- oldrecord = invitationRecordDao.findOne(record.getId());
|
|
|
+ oldRecord = invitationRecordDao.findOne(record.getId());
|
|
|
}
|
|
|
- if (oldrecord != null) {
|
|
|
- oldrecord.setCount(oldrecord.getCount() + 1);
|
|
|
- oldrecord.setDate(new Date());
|
|
|
+ if (oldRecord != null) {
|
|
|
+ oldRecord.setCount(oldRecord.getCount() + 1);
|
|
|
+ oldRecord.setDate(new Date(System.currentTimeMillis()));
|
|
|
if (record.getVendname() != null) {
|
|
|
- oldrecord.setVendname(record.getVendname());
|
|
|
+ oldRecord.setVendname(record.getVendname());
|
|
|
}
|
|
|
if (record.getVendusername() != null) {
|
|
|
- oldrecord.setVendusername(record.getVendusername());
|
|
|
+ oldRecord.setVendusername(record.getVendusername());
|
|
|
}
|
|
|
if (record.getVendusertel() != null) {
|
|
|
- oldrecord.setVendusertel(record.getVendusertel().trim());
|
|
|
+ oldRecord.setVendusertel(record.getVendusertel().trim());
|
|
|
}
|
|
|
if (record.getVenduseremail() != null) {
|
|
|
- oldrecord.setVenduseremail(record.getVenduseremail().trim());
|
|
|
+ oldRecord.setVenduseremail(record.getVenduseremail().trim());
|
|
|
}
|
|
|
- record = invitationRecordDao.save(oldrecord);
|
|
|
- if (oldrecord.getVenduseremail() != null) {
|
|
|
+ record = invitationRecordDao.save(oldRecord);
|
|
|
+ if (record.getVenduseremail() != null) {
|
|
|
sendEmail(record);
|
|
|
}
|
|
|
- if (oldrecord.getVendusertel() != null) {
|
|
|
+ if (record.getVendusertel() != null) {
|
|
|
sendMsg(record);
|
|
|
}
|
|
|
map.put("success", "邀请已发送");
|
|
|
} else {
|
|
|
record.setCount(1);
|
|
|
- record.setEnuu(enuu);
|
|
|
- record.setUseruu(useruu);
|
|
|
- record.setDate(new Date());
|
|
|
+ record.setEnuu(enUU);
|
|
|
+ record.setUseruu(userUU);
|
|
|
+ record.setDate(new Date(System.currentTimeMillis()));
|
|
|
record.setActive(Constant.NO);
|
|
|
record = invitationRecordDao.save(record);
|
|
|
if (record.getVenduseremail() != null) {
|