|
@ -1,21 +1,24 @@ |
|
|
package awesome.group.game.service; |
|
|
package awesome.group.game.service; |
|
|
|
|
|
|
|
|
import awesome.group.game.dao.bean.MatrixAdvRecord; |
|
|
import awesome.group.game.dao.bean.MatrixAdvRecord; |
|
|
|
|
|
import awesome.group.game.dao.bean.MatrixApp; |
|
|
import awesome.group.game.dao.mapper.MatrixAdvRecordMapper; |
|
|
import awesome.group.game.dao.mapper.MatrixAdvRecordMapper; |
|
|
|
|
|
import awesome.group.game.dao.mapper.MatrixAppMapper; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordEditBo; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordEditBo; |
|
|
import jakarta.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.StringUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class MatrixService { |
|
|
public class MatrixService { |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private MatrixAdvRecordMapper mapper; |
|
|
private MatrixAdvRecordMapper mapper; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private MatrixAppMapper appMapper; |
|
|
|
|
|
|
|
|
public void saveRecord(MatrixAdvRecordEditBo bo, String ip) { |
|
|
public void saveRecord(MatrixAdvRecordEditBo bo, String ip) { |
|
|
Assert.isTrue(StringUtils.hasText(bo.appCode), "appCode不能为空"); |
|
|
Assert.isTrue(StringUtils.hasText(bo.appCode), "appCode不能为空"); |
|
|
Integer appId = mapper.queryAppId(bo.appCode); |
|
|
Integer appId = mapper.queryAppId(bo.appCode); |
|
@ -34,7 +37,22 @@ public class MatrixService { |
|
|
mapper.insert(record); |
|
|
mapper.insert(record); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<String> whiteList() { |
|
|
public boolean whiteList(String deviceId, String appCode) { |
|
|
return mapper.queryWhitelist(); |
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
|
|
|
if (app == null) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return mapper.queryWhitelist(app.getChannel(), deviceId) > 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void addIntoWhiteList(String deviceId, String appCode) { |
|
|
|
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
|
|
|
if (app == null) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (mapper.queryWhitelist(app.getChannel(), deviceId) > 0) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
mapper.insertWhiteList(app.getChannel(), deviceId); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|