| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | | record.setParams(null);
|
| | | } else if (!StringUtil.isJson(params)) {
|
| | | throw new FloatADException(1, "跳转参数非JSON格式");
|
| | | } else {
|
| | | record.setParams(params.trim());
|
| | | }
|
| | |
|
| | | FloatADTypeEnum typeEnum = record.getTypeEnum();
|
| | |
| | |
|
| | | /**
|
| | | * 删除图片-不更新数据库
|
| | | * @param record
|
| | | * @throws Exception
|
| | | */
|
| | | public void removePicture(String picture) throws Exception {
|
| | |
| | | floatADMapper.updateByPrimaryKey(resultObj);
|
| | | floatADMapper.updateByPrimaryKey(exchangeObject);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void switchState(Long id) throws FloatADException {
|
| | | if (id == null) {
|
| | | throw new FloatADException(1, "请传递正确参数");
|
| | | }
|
| | | FloatAD resultObj = floatADMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new FloatADException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer state = resultObj.getState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1;
|
| | | } else {
|
| | | state = 0;
|
| | | }
|
| | | |
| | | FloatAD updateObj = new FloatAD();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | floatADMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "configCache", key = "'getValidFloatADCache-'+#position+'-'+#type+'-'+#platform+'-'+#versionCode")
|
| | | @Cacheable(value = "configCache", key = "'getValidFloatADCache-'+#position+'-'+#type+'-'+#platform+'-'+#versionCode+'-'+system")
|
| | | @Override
|
| | | public List<FloatAD> getValidFloatADCache(String position, Integer type, String platform, Integer versionCode) {
|
| | | public List<FloatAD> getValidFloatADCache(String position, Integer type, String platform, Integer versionCode, SystemEnum system) {
|
| | | List<FloatAD> list = floatADMapper.getValidFloatAD(position, type);
|
| | | // 过滤
|
| | | filterFloatAD(list, platform, versionCode);
|
| | | |
| | | filterFloatAD(list, platform, versionCode,system);
|
| | | return list;
|
| | | }
|
| | |
|
| | |
| | | * @param platform
|
| | | * @param versionCode
|
| | | */
|
| | | private void filterFloatAD(List<FloatAD> list, String platform, int versionCode) {
|
| | | private void filterFloatAD(List<FloatAD> list, String platform, int versionCode, SystemEnum system) {
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode);
|
| | | AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode,system);
|
| | | if (app == null) {
|
| | | list.clear();
|
| | | return;
|