Commit 20a0ec64 by xieshixiang

修改时间类型

parent 7bbab3c5
......@@ -112,7 +112,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
info.setUnqId(unqIdUtil.getUnqId());
info.setGmtBindTime(DateTime.now().toString());
info.setGmtBindTime(new Date().toString());
mapper.insert(info);
return ResponseGenerator.success(new BindInfoRes(info.getUnqId()));
}
......
package com.hikcreate.edl.pub.web.mobile.infra.data.cache;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo;
......@@ -11,6 +10,7 @@ import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
......@@ -26,11 +26,12 @@ public class BindCache {
/**
* 获取绑定信息
*
* @param unqId
* @return
*/
@Cacheable( value = "bindinfo", key = "'id:'+#unqId", unless = "#result==null" )
public ParkBindInfo getById( String unqId ) {
@Cacheable(value = "bindinfo", key = "'id:'+#unqId", unless = "#result==null")
public ParkBindInfo getById(String unqId) {
LambdaQueryWrapper<ParkBindInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParkBindInfo::getUnqId, unqId);
queryWrapper.eq(ParkBindInfo::getStatus, 1);
......@@ -39,30 +40,32 @@ public class BindCache {
/**
* 查询用户绑定信息
* @param userId 第三方用户ID
*
* @param userId 第三方用户ID
* @return
*/
@Cacheable( value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0" )
@Cacheable(value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0")
public List<BindInfoQueryRes> selectByQuery(String userId) {
return mapper.selectByQuery(userId);
}
/**
* 解绑
* @param unqId 绑定唯一标识
*
* @param unqId 绑定唯一标识
* @param userId 第三方用户ID
* @return
*/
@Caching(evict = {
@CacheEvict( value = "bindinfo", key = "'id:'+#unqId", condition = "#unqId!=null"),
@CacheEvict( value = "bindinfo", key = "'userId:'+#userId", condition = "#userId!=null")
@CacheEvict(value = "bindinfo", key = "'id:'+#unqId", condition = "#unqId!=null"),
@CacheEvict(value = "bindinfo", key = "'userId:'+#userId", condition = "#userId!=null")
})
public boolean unBind(String unqId, String userId){
public boolean unBind(String unqId, String userId) {
ParkBindInfo bindInfo = new ParkBindInfo();
bindInfo.setUnqId(unqId);
bindInfo.setStatus("0");
bindInfo.setUnbindTime(DateTime.now().toString());
return mapper.unbind(bindInfo) > 0 ;
bindInfo.setUnbindTime(new Date().toString());
return mapper.unbind(bindInfo) > 0;
}
}
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