|
@@ -94,29 +94,35 @@ public class BuyService {
|
|
|
List<JmTuangou> jmTuangous = jmTuangouDao.selectAll();
|
|
|
if (jmTuangous != null && jmTuangous.size() > 0) {
|
|
|
for (JmTuangou list : jmTuangous) {
|
|
|
- // 团购数量 最小起订量
|
|
|
- Buy buy = buyMapper.selectCountNum(list.getJmId());
|
|
|
- //已经到截止时间
|
|
|
- if (list.getTgEndTime().getTime() < new DateTime().getMillis()) {
|
|
|
-
|
|
|
- if (buy != null) { //最小起订量
|
|
|
- if (list.getTgMinNum().intValue() > buy.getCount().intValue()) {
|
|
|
- jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
|
|
|
+ //判断是指挥部还是管理员
|
|
|
+ if (list.getTgSupplier().equals("指挥部")) {
|
|
|
+ if (list.getTgEndTime().getTime() < new DateTime().getMillis()) {
|
|
|
+ jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 团购数量 最小起订量
|
|
|
+ Buy buy = buyMapper.selectCountNum(list.getJmId());
|
|
|
+ //已经到截止时间
|
|
|
+ if (list.getTgEndTime().getTime() < new DateTime().getMillis()) {
|
|
|
+
|
|
|
+ if (buy != null) { //最小起订量
|
|
|
+ if (list.getTgMinNum().longValue() > buy.getCount().longValue()) {
|
|
|
+ jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
|
|
|
+ } else {
|
|
|
+ jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
|
|
|
+ }
|
|
|
} else {
|
|
|
- jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
|
|
|
+ jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
|
|
|
}
|
|
|
} else {
|
|
|
- jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
|
|
|
- }
|
|
|
- } else {
|
|
|
- //团购数量已经过了最大起订量的 就直接发货
|
|
|
- if (buy != null) {
|
|
|
- if (list.getTgMaxNum().intValue() == buy.getCount().intValue()) {
|
|
|
- jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
|
|
|
+ //团购数量已经过了最大起订量的 就直接发货
|
|
|
+ if (buy != null) {
|
|
|
+ if (list.getTgMaxNum().intValue() == buy.getCount().intValue()) {
|
|
|
+ jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
return 1;
|