|
@@ -9,17 +9,16 @@ import com.bofeng.dao.YeweihuiUserRoleMapper;
|
|
import com.bofeng.entity.JmTuangou;
|
|
import com.bofeng.entity.JmTuangou;
|
|
import com.bofeng.entity.UserOpen;
|
|
import com.bofeng.entity.UserOpen;
|
|
import com.yvan.PageDb;
|
|
import com.yvan.PageDb;
|
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
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.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Calendar;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
@@ -86,12 +85,12 @@ public class JmTuangouService {
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
- public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) {
|
|
|
|
|
|
+ public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) throws InvocationTargetException, IllegalAccessException {
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
int moth = cal.get(Calendar.MONTH) + 1;
|
|
int moth = cal.get(Calendar.MONTH) + 1;
|
|
int date = cal.get(Calendar.DAY_OF_MONTH);
|
|
int date = cal.get(Calendar.DAY_OF_MONTH);
|
|
- Integer success = 0;
|
|
|
|
List<String> uptownIdArray = Arrays.asList(uptownIds.split(","));
|
|
List<String> uptownIdArray = Arrays.asList(uptownIds.split(","));
|
|
|
|
+ ArrayList tgList = new ArrayList();
|
|
for (String uptownId : uptownIdArray) {
|
|
for (String uptownId : uptownIdArray) {
|
|
|
|
|
|
jmTuangou.setJmId(IdWorker.getId());
|
|
jmTuangou.setJmId(IdWorker.getId());
|
|
@@ -100,6 +99,7 @@ public class JmTuangouService {
|
|
|
|
|
|
jmTuangou.setTgStatus(1);
|
|
jmTuangou.setTgStatus(1);
|
|
jmTuangou.setRoleType(1);
|
|
jmTuangou.setRoleType(1);
|
|
|
|
+ jmTuangou.setUserCreate(JwtHelper.getUserId());
|
|
jmTuangou.setUserUpdate(JwtHelper.getUserId());
|
|
jmTuangou.setUserUpdate(JwtHelper.getUserId());
|
|
|
|
|
|
if (jmTuangou.getTgType() == 1) {
|
|
if (jmTuangou.getTgType() == 1) {
|
|
@@ -118,13 +118,31 @@ public class JmTuangouService {
|
|
|
|
|
|
}
|
|
}
|
|
jmTuangou.setUserId(JwtHelper.getUserId());
|
|
jmTuangou.setUserId(JwtHelper.getUserId());
|
|
- success = jmTuangouDao.insert(jmTuangou);
|
|
|
|
- if (success == 1) {
|
|
|
|
- List<UserOpen> userList = userOpenMapper.getUsersByUptownId(Long.parseLong(uptownId));
|
|
|
|
- for (UserOpen user : userList) {
|
|
|
|
- epiTemplateMessageService.tuangouSendRemindMessage(user.getUserId(), user.getOpenId(), jmTuangou.getTgEndTime());
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if (jmTuangou.getTgMinNum() == null) {
|
|
|
|
+ jmTuangou.setTgMinNum(0);
|
|
|
|
+ }
|
|
|
|
+ if (jmTuangou.getTgMaxNum() == null) {
|
|
|
|
+ jmTuangou.setTgMaxNum(0);
|
|
}
|
|
}
|
|
|
|
+ JmTuangou jmTuangou1 = new JmTuangou();
|
|
|
|
+ BeanUtils.copyProperties(jmTuangou1, jmTuangou);
|
|
|
|
+ tgList.add(jmTuangou1);
|
|
|
|
+ }
|
|
|
|
+ Integer success = jmTuangouDao.insertJmTuangouList(tgList);
|
|
|
|
+ if (success > 0) {
|
|
|
|
+ Thread thread=new Thread(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ for (String uptownId : uptownIdArray) {
|
|
|
|
+ List<UserOpen> userList = userOpenMapper.getUsersByUptownId(Long.parseLong(uptownId));
|
|
|
|
+ for (UserOpen user : userList) {
|
|
|
|
+ epiTemplateMessageService.tuangouSendRemindMessage(user.getUserId(), user.getOpenId(), jmTuangou.getTgEndTime());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ thread.start();
|
|
}
|
|
}
|
|
return success;
|
|
return success;
|
|
}
|
|
}
|