|
|
@@ -115,31 +115,22 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResult editInfo(WestreamUser entity) { |
|
|
|
//新增 |
|
|
|
if (StringUtils.isNull(entity.getId())) { |
|
|
|
if (StringUtils.isEmpty(entity.getOpenid())) { |
|
|
|
return JsonResult.error("openid为空"); |
|
|
|
} |
|
|
|
// 添加 |
|
|
|
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getOpenid, entity.getOpenid()) |
|
|
|
.eq(WestreamUser::getMark, 1)); |
|
|
|
if (count > 0) { |
|
|
|
return JsonResult.error("用户已存在"); |
|
|
|
} |
|
|
|
if (StringUtils.isEmpty(entity.getOpenid())) { |
|
|
|
return JsonResult.error("openid为空"); |
|
|
|
} |
|
|
|
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getOpenid, entity.getOpenid()) |
|
|
|
.eq(WestreamUser::getMark, 1)); |
|
|
|
if(ObjectUtil.isNull(westreamUser)){ |
|
|
|
//新增 |
|
|
|
entity.setHeartbeatTime(new Date()); |
|
|
|
westreamUserMapper.insert(entity); |
|
|
|
} else { |
|
|
|
}else { |
|
|
|
// 编辑 |
|
|
|
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getOpenid, entity.getOpenid()) |
|
|
|
.ne(WestreamUser::getId, entity.getId()) |
|
|
|
.eq(WestreamUser::getMark, 1)); |
|
|
|
if (count > 0) { |
|
|
|
return JsonResult.error("用户已存在"); |
|
|
|
} |
|
|
|
entity.setHeartbeatTime(new Date()); |
|
|
|
westreamUserMapper.updateById(entity); |
|
|
|
westreamUserMapper.update(entity,new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getOpenid,entity.getOpenid()) |
|
|
|
.eq(WestreamUser::getMark, 1)); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |