Commit 20a0ec64 by xieshixiang

修改时间类型

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