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 | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 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 e2fe975..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 @@ -16,10 +16,12 @@ 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 @@ -52,6 +54,10 @@ 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) { @@ -84,6 +90,12 @@ picture = uploadPicture(file); } + // 閫傜敤绫诲瀷 锛� 0閫氱敤 1鏂颁汉 + Integer type = record.getType(); + if (type == null) { + record.setType(0); + } + Long id = record.getId(); if (id == null) { int maxOrder = floatADMapper.getMaxOrderByPosition(position); @@ -93,10 +105,6 @@ record.setState(0); } - Integer type = record.getType(); - if (type == null) { - record.setType(0); - } record.setOrder(maxOrder + 1); record.setCreateTime(new Date()); record.setUpdateTime(new Date()); @@ -117,7 +125,6 @@ record.setPicture(resultObj.getPicture()); } - record.setType(resultObj.getType()); record.setOrder(resultObj.getOrder()); record.setCreateTime(resultObj.getCreateTime()); record.setUpdateTime(new Date()); @@ -140,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(); @@ -159,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))) { @@ -192,7 +199,7 @@ } @Override - @Transactional + @Transactional(rollbackFor=Exception.class) public int deleteByPrimaryKeyList(List<Long> list) throws Exception{ List<FloatAD> listSwiper = floatADMapper.ListByPrimaryKey(list); @@ -219,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(); @@ -282,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