记得上下班打卡 | git大法好,push需谨慎

Commit 7f19ae1f authored by GaoHu's avatar GaoHu

exit

parent f556c368
......@@ -55,20 +55,20 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
PageInfo<GoblinGoodsAnticipateVo> pageInfo = new PageInfo<>();
HashMap<String, Object> map = goblinMongoUtils.getGoblinGoodsAnticipateVos(goodsAnticipateParam);
List<GoblinGoodsAnticipateVo> data = (List<GoblinGoodsAnticipateVo>) map.get("data");
for (GoblinGoodsAnticipateVo goblinGoodsAnticipateVo : data){
for (GoblinGoodsAnticipateVo goblinGoodsAnticipateVo : data) {
//预约开始时间
LocalDateTime aboutStartDate = goblinGoodsAnticipateVo.getAboutStartDate();
LocalDateTime aboutEndDate = goblinGoodsAnticipateVo.getAboutEndDate();
LocalDateTime now = LocalDateTime.now();
if (aboutStartDate.isBefore(now)){
if (aboutStartDate.isBefore(now)) {
//未开始 0
goblinGoodsAnticipateVo.setState(0);
}
if(!aboutStartDate.isBefore(now)&&aboutEndDate.isAfter(now)){
if (!aboutStartDate.isBefore(now) && aboutEndDate.isAfter(now)) {
//预约中
goblinGoodsAnticipateVo.setState(1);
}
if (aboutEndDate.isBefore(now)){
if (aboutEndDate.isBefore(now)) {
//已结束
goblinGoodsAnticipateVo.setState(2);
}
......@@ -97,7 +97,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//redis消息预约消息表
/* LinkedList<Object[]> sqlAnt = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlAnt = CollectionUtil.linkedListObjectArr();
sqlAnt.add(new Object[]{
antId,
goodsAnticipateVo.getName(),
......@@ -126,7 +126,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
goodsAnticipateValueVo.getAboutEndDate(),
});
sendRedis("goblin_goods_anticipate_value", sqlValue);
});*/
});
//mongodb新增
goblinMongoUtils.setGoblinGoodsAnticipateVo(goodsAnticipateVo);
......@@ -181,11 +181,11 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
}
@Override
public ResponseDto<Object> userAbout(String autId,String skuId, String uid, String phone, Integer state) {
public ResponseDto<Object> userAbout(String autId, String skuId, String uid, String phone, Integer state) {
//查询该用户是否预
GoblinGoodAnticipateUserVo userVo = goblinRedisUtils.getUserAboutAut(skuId,uid);
GoblinGoodAnticipateUserVo userVo = goblinRedisUtils.getUserAboutAut(skuId, uid);
LinkedList<Object[]> sqlValue = CollectionUtil.linkedListObjectArr();
if (state.equals(GoblinGoodAnticipateUserVo.STATE_VALID) &&userVo==null) {
if (state.equals(GoblinGoodAnticipateUserVo.STATE_VALID) && userVo == null) {
//用户没有预约过
//发送redis消息修改mysql记录用户预约
sqlValue.add(new Object[]{
......@@ -194,22 +194,22 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
phone,
state
});
sendRedis("goblin_goods_anticipate_user",sqlValue);
GoblinGoodAnticipateUserVo user = new GoblinGoodAnticipateUserVo(uid,skuId,phone,state);
sendRedis("goblin_goods_anticipate_user", sqlValue);
GoblinGoodAnticipateUserVo user = new GoblinGoodAnticipateUserVo(uid, skuId, phone, state);
//mongodb记录
goblinRedisUtils.setUserAboutSku(user);
//预约人数+1或-1
}else {
} else {
//mysql删除用户记录
sqlValue.add(new Object[]{
uid,
skuId
});
sendRedis("goblin_goods_anticipate_user_update",sqlValue);
sendRedis("goblin_goods_anticipate_user_update", sqlValue);
//删除缓存 redis和mongodb
goblinRedisUtils.delUserAboutSku(skuId,uid);
goblinRedisUtils.delUserAboutSku(skuId, uid);
}
goblinRedisUtils.setAutId(autId,state);
goblinRedisUtils.setAutId(autId, state);
return null;
}
......
......@@ -35,6 +35,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -101,8 +102,9 @@ public class GoblinMongoUtils {
* 根据antId修改 预约人数
*/
public void updateGoblinGoodsAnticipateVo(GoblinGoodsAnticipateUpdateParam goodsAnticipateUpdateParam) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
Query query = Query.query(Criteria.where("antId").is(goodsAnticipateUpdateParam.getAutId()));
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate", LocalDateTime.now());
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate", df.format(LocalDateTime.now()));
mongoTemplate.updateFirst(query, update, GoblinGoodsAnticipateVo.class.getSimpleName());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment