|
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.sso.entity.PartnershipRecordView;
|
|
import com.uas.sso.entity.PartnershipRecordView;
|
|
|
import com.uas.sso.util.AccountUtils;
|
|
import com.uas.sso.util.AccountUtils;
|
|
|
import com.uas.message.mail.service.MailService;
|
|
import com.uas.message.mail.service.MailService;
|
|
|
-import com.uas.message.sms.service.SmsService;
|
|
|
|
|
import com.uas.platform.b2b.core.util.ThreadUtils;
|
|
import com.uas.platform.b2b.core.util.ThreadUtils;
|
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.dao.InvitationRecordDao;
|
|
import com.uas.platform.b2b.dao.InvitationRecordDao;
|
|
@@ -18,7 +17,6 @@ import com.uas.platform.b2b.service.EnterpriseService;
|
|
|
import com.uas.platform.b2b.service.InvitationRecordService;
|
|
import com.uas.platform.b2b.service.InvitationRecordService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
import com.uas.platform.b2b.support.MessageConf;
|
|
import com.uas.platform.b2b.support.MessageConf;
|
|
|
-import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
import com.uas.platform.b2b.temporary.model.SmsMessage;
|
|
import com.uas.platform.b2b.temporary.model.SmsMessage;
|
|
|
import com.uas.platform.b2b.v2.model.Invitation;
|
|
import com.uas.platform.b2b.v2.model.Invitation;
|
|
|
import com.uas.platform.b2b.v2.service.InviteRecordService;
|
|
import com.uas.platform.b2b.v2.service.InviteRecordService;
|
|
@@ -29,8 +27,6 @@ import com.uas.platform.core.util.HttpUtil;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
import com.uas.search.b2b.model.PageParams;
|
|
import com.uas.search.b2b.model.PageParams;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
-import com.uas.sso.entity.PartnershipRecordView;
|
|
|
|
|
-import com.uas.sso.util.AccountUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.ui.ModelMap;
|
|
@@ -63,9 +59,6 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MessageConf messageConf;
|
|
private MessageConf messageConf;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private SmsService smsService;
|
|
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MailService mailService;
|
|
private MailService mailService;
|
|
|
|
|
|
|
@@ -95,16 +88,14 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
baseInfo.setAdminName(user.getUserName());
|
|
baseInfo.setAdminName(user.getUserName());
|
|
|
baseInfo.setEnTel(user.getUserTel());
|
|
baseInfo.setEnTel(user.getUserTel());
|
|
|
}
|
|
}
|
|
|
- List<InvitationRecord> records = invitationRecordService.findbyVendName(e.getEnName());
|
|
|
|
|
- if (!CollectionUtils.isEmpty(records)) {
|
|
|
|
|
- Enterprise enterprise = enterpriseService.findByEnUU(records.get(0).getEnuu());
|
|
|
|
|
- if (null == enterprise) {
|
|
|
|
|
- enterprise = enterpriseService.findByenBussinessCode(records.get(0).getBussinesscode());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (null != e.getInviteUU()) {
|
|
|
|
|
+ Enterprise enterprise = enterpriseService.findByEnUU(e.getInviteUU());
|
|
|
String enName = enterprise != null ? enterprise.getEnName() : null;
|
|
String enName = enterprise != null ? enterprise.getEnName() : null;
|
|
|
baseInfo.setInviteEnName(enName);
|
|
baseInfo.setInviteEnName(enName);
|
|
|
- String userName = records.get(0).getUser() != null ? records.get(0).getUser().getUserName() : null;
|
|
|
|
|
- baseInfo.setInviteUserName(userName);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null != e.getInviteUserUU()) {
|
|
|
|
|
+ User u = userDao.findOne(e.getInviteUserUU());
|
|
|
|
|
+ baseInfo.setInviteUserName(u.getUserName());
|
|
|
}
|
|
}
|
|
|
baseInfoList.add(baseInfo);
|
|
baseInfoList.add(baseInfo);
|
|
|
}
|
|
}
|
|
@@ -136,15 +127,12 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
@Override
|
|
@Override
|
|
|
public ModelMap getInvationCount(Long userUU, Long enUU) {
|
|
public ModelMap getInvationCount(Long userUU, Long enUU) {
|
|
|
ModelMap map = new ModelMap();
|
|
ModelMap map = new ModelMap();
|
|
|
- Integer allNum = 0;
|
|
|
|
|
- Integer todoNum = 0;
|
|
|
|
|
- Integer doneNum = 0;
|
|
|
|
|
String allSql = "select COALESCE(sum(count), 0) from v$invitation where useruu = " + userUU;
|
|
String allSql = "select COALESCE(sum(count), 0) from v$invitation where useruu = " + userUU;
|
|
|
String todoSql = "select COALESCE(sum(count), 0) from v$invitation where active = 0 and useruu = " + userUU;
|
|
String todoSql = "select COALESCE(sum(count), 0) from v$invitation where active = 0 and useruu = " + userUU;
|
|
|
String doneSql = "select COALESCE(sum(count), 0) from v$invitation where active = 1 and useruu = " + userUU;
|
|
String doneSql = "select COALESCE(sum(count), 0) from v$invitation where active = 1 and useruu = " + userUU;
|
|
|
- allNum = commonDao.queryForObject(allSql, Integer.class);
|
|
|
|
|
- todoNum = commonDao.queryForObject(todoSql, Integer.class);
|
|
|
|
|
- doneNum = commonDao.queryForObject(doneSql, Integer.class);
|
|
|
|
|
|
|
+ Integer allNum = commonDao.queryForObject(allSql, Integer.class);
|
|
|
|
|
+ Integer todoNum = commonDao.queryForObject(todoSql, Integer.class);
|
|
|
|
|
+ Integer doneNum = commonDao.queryForObject(doneSql, Integer.class);
|
|
|
map.put("all", allNum);
|
|
map.put("all", allNum);
|
|
|
map.put("todo", todoNum);
|
|
map.put("todo", todoNum);
|
|
|
map.put("done", doneNum);
|
|
map.put("done", doneNum);
|
|
@@ -161,11 +149,11 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year) {
|
|
public List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year) {
|
|
|
- String sql = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
|
|
|
|
|
|
|
+ String sql = "select substr(time, -2) month, time, in_enuu enUU,count(1) count from(" +
|
|
|
"select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + ")" +
|
|
"select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + ")" +
|
|
|
"where time like '%" + year + "%' group by time,in_enuu order by time";
|
|
"where time like '%" + year + "%' group by time,in_enuu order by time";
|
|
|
List<Invitation> all = commonDao.query(sql, Invitation.class);
|
|
List<Invitation> all = commonDao.query(sql, Invitation.class);
|
|
|
- String sql1 = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
|
|
|
|
|
|
|
+ String sql1 = "select substr(time, -2) month, time ,in_enuu enUU,count(1) count from(" +
|
|
|
"select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + " and COALESCE(in_active,0) = 1)" +
|
|
"select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + " and COALESCE(in_active,0) = 1)" +
|
|
|
"where time like '%" + year + "%' group by time,in_enuu order by time";
|
|
"where time like '%" + year + "%' group by time,in_enuu order by time";
|
|
|
List<Invitation> done = commonDao.query(sql1, Invitation.class);
|
|
List<Invitation> done = commonDao.query(sql1, Invitation.class);
|
|
@@ -456,7 +444,12 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ModelMap inviteByBatch(Long enUU, Long userUU, List<InvitationRecord> records, String source) {
|
|
public ModelMap inviteByBatch(Long enUU, Long userUU, List<InvitationRecord> records, String source) {
|
|
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
Enterprise ve = enterpriseService.findByEnUU(enUU);
|
|
Enterprise ve = enterpriseService.findByEnUU(enUU);
|
|
|
|
|
+ int size = 0;
|
|
|
|
|
+ int fsize = 0;
|
|
|
|
|
+ StringBuffer successStr = new StringBuffer();
|
|
|
|
|
+ StringBuffer failStr = new StringBuffer();
|
|
|
if (null == ve) {
|
|
if (null == ve) {
|
|
|
throw new IllegalOperatorException(enUU + "对应的企业不存在!");
|
|
throw new IllegalOperatorException(enUU + "对应的企业不存在!");
|
|
|
}
|
|
}
|
|
@@ -475,13 +468,32 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
record.setActive(Constant.NO);
|
|
record.setActive(Constant.NO);
|
|
|
record.setSource(source);
|
|
record.setSource(source);
|
|
|
record.setEnuu(enUU);
|
|
record.setEnuu(enUU);
|
|
|
- invite(record);
|
|
|
|
|
- // 发送邮件
|
|
|
|
|
- if (null != record.getVenduseremail() && record.getVenduseremail().contains("@")) {
|
|
|
|
|
- sendEmail(record);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ invite(record);
|
|
|
|
|
+ // 发送邮件
|
|
|
|
|
+ if (null != record.getVenduseremail() && record.getVenduseremail().contains("@")) {
|
|
|
|
|
+ sendEmail(record);
|
|
|
|
|
+ }
|
|
|
|
|
+ size++;
|
|
|
|
|
+ if (successStr.length() > 0) {
|
|
|
|
|
+ successStr.append(";");
|
|
|
|
|
+ }
|
|
|
|
|
+ successStr.append(record.getVendname());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ fsize++;
|
|
|
|
|
+ if (failStr.length() > 0) {
|
|
|
|
|
+ failStr.append(";");
|
|
|
|
|
+ }
|
|
|
|
|
+ failStr.append(record.getVendname());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return new ModelMap("success", "邀请已发送,共" + records.size() + "条");
|
|
|
|
|
|
|
+ if (size > 0) {
|
|
|
|
|
+ map.put("success", "发送成" + size + "条," + successStr + "发送成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fsize > 0) {
|
|
|
|
|
+ map.put("error", "发送失败" + fsize + "条," + failStr + "发送失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ return map;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -513,4 +525,20 @@ public class InviteRecordServiceImpl implements InviteRecordService {
|
|
|
}
|
|
}
|
|
|
}).run();
|
|
}).run();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新邀请注册记录企业信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param e 企业信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void updateVendName(EnterpriseBaseInfo e) {
|
|
|
|
|
+ List<InvitationRecord> recordList = invitationRecordService.findByVendUU(e.getUu());
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(recordList)) {
|
|
|
|
|
+ for (InvitationRecord record : recordList) {
|
|
|
|
|
+ record.setVendname(e.getEnName());
|
|
|
|
|
+ }
|
|
|
|
|
+ invitationRecordDao.save(recordList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|