From c9cbdfa41d645d42eeaa7e06d550d4ef8ac328e7 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 03 一月 2020 12:15:08 +0800 Subject: [PATCH] redis关键词 --- fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java | 43 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java index 8ed9d59..907610e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java @@ -8,18 +8,20 @@ import java.util.UUID; import javax.annotation.Resource; -import javax.transaction.Transactional; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import org.yeshi.utils.tencentcloud.COSManager; import com.yeshi.fanli.dao.mybatis.homemodule.FloatADMapper; import com.yeshi.fanli.entity.bus.homemodule.FloatAD; +import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum; import com.yeshi.fanli.entity.common.JumpDetailV2; -import com.yeshi.fanli.exception.FloatADException; +import com.yeshi.fanli.exception.homemodule.FloatADException; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.homemodule.FloatADService; +import com.yeshi.fanli.util.FilePathEnum; import com.yeshi.fanli.util.StringUtil; @Service @@ -48,8 +50,14 @@ String params = record.getParams(); if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) ) { record.setParams(null); + } else if (!StringUtil.isJson(params)) { + throw new FloatADException(1, "璺宠浆鍙傛暟闈濲SON鏍煎紡"); } + FloatADTypeEnum typeEnum = record.getTypeEnum(); + if (typeEnum == null) + throw new FloatADException(1, "绫诲瀷涓嶈兘涓虹┖"); + if (!StringUtil.isNullOrEmpty(jumpType)) { List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType); if (listByType !=null && listByType.size() > 0) { @@ -80,6 +88,12 @@ String picture = null; if (file != null) { picture = uploadPicture(file); + } + + // 閫傜敤绫诲瀷 锛� 0閫氱敤 1鏂颁汉 + Integer type = record.getType(); + if (type == null) { + record.setType(0); } Long id = record.getId(); @@ -133,7 +147,7 @@ String type = contentType.substring(contentType.indexOf("/") + 1); // 鏂囦欢璺緞 - String filePath="/img/FloatAD/"+UUID.randomUUID().toString().replace("-", "") + "." + type; + String filePath= FilePathEnum.floatAD.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type; // 鎵ц涓婁紶 String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); @@ -152,7 +166,7 @@ } @Override - @Transactional + @Transactional(rollbackFor=Exception.class) public void updateOrder(Long id, Integer moveType) throws FloatADException { if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) { @@ -185,7 +199,7 @@ } @Override - @Transactional + @Transactional(rollbackFor=Exception.class) public int deleteByPrimaryKeyList(List<Long> list) throws Exception{ List<FloatAD> listSwiper = floatADMapper.ListByPrimaryKey(list); @@ -212,6 +226,11 @@ } for (FloatAD floatAD : listQuery) { + + FloatADTypeEnum typeEnum = floatAD.getTypeEnum(); + if (typeEnum != null) { + floatAD.setTypeName(typeEnum.getDesc()); + } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); Date startTime = floatAD.getStartTime(); @@ -256,8 +275,8 @@ } @Override - public FloatAD getEffectiveFloatAD(String position) { - FloatAD floatAD = floatADMapper.getEffectiveFloatAD(position); + public FloatAD getEffectiveFloatAD(String position, Integer type) { + FloatAD floatAD = floatADMapper.getEffectiveFloatAD(position, type); if (floatAD != null) { JumpDetailV2 jumpDetail = floatAD.getJumpDetail(); @@ -275,5 +294,15 @@ return floatAD; } + + @Override + public List<FloatAD> getValidCommonByPosition(String position) { + return floatADMapper.getValidFloatAD(position, 1); + } + + @Override + public List<FloatAD> getValidByPosition(String position) { + return floatADMapper.getValidFloatAD(position, null); + } } -- Gitblit v1.8.0