From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java |  778 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 390 insertions(+), 388 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java
index e2f1c93..6076574 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java
@@ -1,388 +1,390 @@
-package com.yeshi.fanli.service.impl.homemodule;
-
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-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;
-import org.springframework.web.multipart.MultipartFile;
-import org.yeshi.utils.tencentcloud.COSManager;
-
-import com.yeshi.fanli.dao.mybatis.homemodule.HomeNavbarMapper;
-import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
-import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
-import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar.NavbarTypeEnum;
-import com.yeshi.fanli.entity.bus.homemodule.SwiperBanner;
-import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
-import com.yeshi.fanli.exception.homemodule.SpecialException;
-import com.yeshi.fanli.service.inter.goods.GoodsClassService;
-import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
-import com.yeshi.fanli.service.inter.homemodule.SwiperBannerService;
-import com.yeshi.fanli.util.FilePathEnum;
-import com.yeshi.fanli.util.StringUtil;
-
-
-@Service
-public class HomeNavbarServiceImpl implements HomeNavbarService {
-	
-	@Resource
-	private HomeNavbarMapper homeNavbarMapper;
-	
-	@Resource
-	private GoodsClassService goodsClassService;
-	
-	@Resource
-	private SwiperBannerService swiperBannerService;
-
-	@Override
-	@Transactional
-	public int deleteBatchByPrimaryKey(List<Long> list) {
-		if (list == null || list.size() == 0) {
-			return 0;
-		}
-		
-		for (Long id: list) {
-			HomeNavbar homeNavbar = homeNavbarMapper.selectByPrimaryKey(id);
-			if (homeNavbar !=null) {
-				// 鍒犻櫎宸插瓨鍦ㄥ浘鐗� /
-				String picture = homeNavbar.getPicture();
-				if (!StringUtil.isNullOrEmpty(picture)) {
-					COSManager.getInstance().deleteFile(picture);
-				}
-			}
-		}
-		return homeNavbarMapper.deleteBatchByPrimaryKey(list);
-	}
-
-	
-
-	@Override
-	public void saveObject(MultipartFile file, HomeNavbar record) throws HomeNavbarException, Exception{
-		
-		String name = record.getName();
-		if (name == null || name.trim().length() == 0) {
-			throw new HomeNavbarException(1, "瀵艰埅鍚嶇О涓嶈兘涓虹┖");
-		}
-		
-		Integer sex = null;
-		NavbarTypeEnum type = record.getType();
-		if (NavbarTypeEnum.category.equals(type)) {
-			Long classId = record.getClassId();
-			if (classId == null) {
-				throw new HomeNavbarException(1, "璇烽�夋嫨鍒嗙被");
-			}
-			
-			GoodsClass goodsClass = goodsClassService.getGoodsClass(record.getClassId());
-			if (goodsClass == null) {
-				throw new HomeNavbarException(1, "鍒嗙被涓嶅瓨鍦�");
-			}
-			sex = goodsClass.getSex();
-			if (sex == null) {
-				throw new HomeNavbarException(1, "鍒嗙被鏈寚瀹氶�傜敤鐗堟湰");
-			}
-			record.setUrl(null);
-		} else if(NavbarTypeEnum.weex.equals(type) || NavbarTypeEnum.web.equals(type)) {
-			String url = record.getUrl();
-			if (url == null || url.trim().length() == 0) {
-				throw new HomeNavbarException(1, "璇疯緭鍏Rl閾炬帴");
-			}
-		} else {
-			throw new HomeNavbarException(1, "绫诲瀷鐨勫�间笉姝g‘");
-		}
-		
-		
-		Long swiperBannerId = record.getSwiperBannerId();
-		if (swiperBannerId != null && swiperBannerId == 0) {
-			record.setSwiperBannerId(null);
-		}
-		
-		// 鏃堕棿杞崲
-		handleTime(record);
-		
-		// 鍥剧墖涓婁紶
-		String picture = null;
-		if (file != null) {
-			picture = uploadPicture(file);
-		}
-		
-		Boolean isDefault = record.getIsDefault();
-		if (isDefault == null) {
-			record.setIsDefault(false);
-		}
-		
-		Boolean isFixed = record.getIsFixed();
-		if (isFixed == null) {
-			record.setIsFixed(false);
-		}
-		
-		Long id = record.getId();
-		if (id == null) {
-			record.setPicture(picture);
-			record.setCreatetime(new Date());
-			record.setUpdatetime(new Date());
-			
-			Integer state = record.getState();
-			if (state == null) {
-				record.setState(0);
-			}
-			
-			record.setOrderby(homeNavbarMapper.getDefaultMaxOrder() + 1);
-			record.setOrderMan(homeNavbarMapper.getManMaxOrder() + 1);
-			record.setOrderWoman(homeNavbarMapper.getWomanMaxOrder() + 1);
-			
-			record.setIsFixed(false);//鐩墠鏃犲浐瀹氶」
-			homeNavbarMapper.insert(record);
-		} else {
-			// 淇敼
-			HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
-			if (resultObj == null) {
-				throw new HomeNavbarException(1, "淇敼鍐呭宸蹭笉瀛樺湪");
-			}
-			
-			if (picture != null && picture.trim().length() > 0) {
-				// 鍒犻櫎鑰佸浘
-				removePicture(resultObj.getPicture());
-				// 瀛樺偍鏂板浘
-				record.setPicture(picture);
-			} else {
-				record.setPicture(resultObj.getPicture());
-			}
-			
-			record.setOrderby(resultObj.getOrderby());
-			record.setOrderMan(resultObj.getOrderMan());
-			record.setOrderWoman(resultObj.getOrderWoman());
-			record.setCreatetime(resultObj.getCreatetime());
-			record.setUpdatetime(new Date());
-			record.setIsFixed(false);//鐩墠鏃犲浐瀹氶」
-			homeNavbarMapper.updateByPrimaryKey(record);
-		}
-	}
-
-	
-	/**
-	 * 涓婁紶鍥剧墖
-	 * @param file
-	 * @return
-	 * @throws Exception
-	 */
-	public String uploadPicture(MultipartFile file) throws Exception {
-		// 鏂囦欢瑙f瀽 
-		InputStream inputStream = file.getInputStream();
-		String contentType = file.getContentType();
-		String type = contentType.substring(contentType.indexOf("/") + 1);
-	
-		// 鏂囦欢璺緞
-		String filePath= FilePathEnum.homeNavbar.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
-		// 鎵ц涓婁紶
-		String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
-		
-		return fileLink;
-	}
-
-	/**
-	 * 鍒犻櫎鍥剧墖-涓嶆洿鏂版暟鎹簱
-	 * @param picture
-	 * @throws Exception
-	 */
-	public void removePicture(String picture) throws Exception {
-		if (picture != null && picture.trim().length() > 0) {
-			COSManager.getInstance().deleteFile(picture);
-		}
-	}
-	
-	
-	/**
-	 * web娈垫椂闂磋浆鎹�
-	 * 
-	 * @param record
-	 */
-	private void handleTime(HomeNavbar record) throws SpecialException, Exception {
-		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-		
-		String startTime_str = record.getStartTime_str();
-		if (!StringUtil.isNullOrEmpty(startTime_str)) {
-			startTime_str = startTime_str.replaceAll("T", " ");
-			record.setStartTime(format.parse(startTime_str));
-		}
-		
-		String endTime_str = record.getEndTime_str();
-		if (!StringUtil.isNullOrEmpty(endTime_str)) {
-			endTime_str = endTime_str.replaceAll("T", " ");
-			record.setEndTime(format.parse(endTime_str));
-		}
-		
-		if (record.getEndTime() != null && record.getStartTime() != null
-				&& record.getStartTime().getTime() > record.getEndTime().getTime()) {
-			throw new SpecialException(1, "璧峰鏃堕棿涓嶈兘灏忎簬缁撴潫鏃堕棿");
-		}
-	}
-	
-	
-	@Override
-	public void updateOrder(Long id, Integer moveType, Integer sex) throws HomeNavbarException, Exception{
-
-		if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
-			throw new HomeNavbarException(1, "浼犻�掔殑绫诲瀷涓嶆纭�");
-		}
-		
-		if (id == null) {
-			throw new HomeNavbarException(1, "ID涓嶈兘涓虹┖");
-		}
-		
-		
-		HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
-		if (resultObj == null) {
-			throw new HomeNavbarException(1, "鎿嶄綔鏁版嵁宸蹭笉瀛樺湪");
-		}
-			
-		if (sex == null) {
-			sex = GoodsClass.SEX_DEFAULT;
-		}
-		
-		HomeNavbar changeObj = null;
-		if (GoodsClass.SEX_ALL == sex || GoodsClass.SEX_DEFAULT == sex) {
-			Integer orderby = resultObj.getOrderby();
-			changeObj = homeNavbarMapper.getDefaultChangeOrder(moveType, orderby);
-			if (changeObj == null ) {
-				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
-			}
-			resultObj.setOrderby(changeObj.getOrderby());
-			changeObj.setOrderby(orderby);
-		} else if (GoodsClass.SEX_MAN == sex) {
-			Integer orderMan = resultObj.getOrderMan();
-			changeObj = homeNavbarMapper.getManChangeOrder(moveType, orderMan);
-			if (changeObj == null ) {
-				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
-			}
-			resultObj.setOrderMan(changeObj.getOrderMan());
-			changeObj.setOrderMan(orderMan);
-		} else if (GoodsClass.SEX_WOMAN == sex) {
-			Integer orderWoman = resultObj.getOrderWoman();
-			changeObj = homeNavbarMapper.getWomanChangeOrder(moveType, orderWoman);
-			if (changeObj == null ) {
-				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
-			}
-			resultObj.setOrderWoman(changeObj.getOrderWoman());
-			changeObj.setOrderWoman(orderWoman);
-		}
-		
-		if (changeObj == null ) {
-			throw new HomeNavbarException(1, "鏃犲彲浜ゆ崲鐨勪綅缃�");
-		}
-		
-		homeNavbarMapper.updateByPrimaryKeySelective(changeObj);
-		homeNavbarMapper.updateByPrimaryKeySelective(resultObj);
-	}
-
-
-	
-	@Override
-	public List<HomeNavbar> listQuery(long start, int count, String key, Integer sex, SystemEnum system) {
-		
-		List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key, sex,system);
-		if (listObj == null || listObj.size() == 0) {
-			return null;
-		}
-		
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
-		
-		for (HomeNavbar homeNavbar: listObj) {
-			Date startTime = homeNavbar.getStartTime();
-			if (startTime == null) {
-				homeNavbar.setStartTime_str("");
-			} else {
-				homeNavbar.setStartTime_str(sdf.format(startTime));
-			}
-			
-			Date endTime = homeNavbar.getEndTime();
-			if (endTime == null) {
-				homeNavbar.setEndTime_str("");
-			} else {
-				homeNavbar.setEndTime_str(sdf.format(endTime));
-			}
-			
-			Long classId = homeNavbar.getClassId();
-			if (classId != null) {
-				GoodsClass goodsClass = goodsClassService.selectByPrimaryKey(classId);
-				if(goodsClass != null) {
-					homeNavbar.setClassName(goodsClass.getName());
-				}
-			}
-			
-			Long swiperBannerId = homeNavbar.getSwiperBannerId();
-			if (swiperBannerId != null) {
-				SwiperBanner swiperBanner = swiperBannerService.selectByPrimaryKey(swiperBannerId);
-				if(swiperBanner != null) {
-					homeNavbar.setSwiperName(swiperBanner.getTitle());
-				}
-			} else {
-				// 鍒濆鍖�
-				homeNavbar.setSwiperBannerId(0L);
-			}
-		}
-		return listObj;
-	}
-	
-	@Override
-	public long countlistQuery(String key, Integer sex, SystemEnum system) {
-		return homeNavbarMapper.countListQuery(key, sex,system);
-	}
-
-	@Override
-	@Cacheable(value = "configCache", key = "'listQueryEffectiveNavbar-'+#system")
-	public List<HomeNavbar> listQueryEffectiveNavbar(SystemEnum system) {
-		return homeNavbarMapper.listQueryEffective(system);
-	}
-	
-	
-	@Override
-	@Cacheable(value = "configCache", key = "'listQueryDefaultNavbar-'+#sex")
-	public List<HomeNavbar> listQueryDefaultNavbar(Integer sex, SystemEnum system) {
-		return homeNavbarMapper.listQueryDefaultNavbar(sex,system);
-	}
-	
-	
-	@Override
-	@Cacheable(value = "configCache", key = "'listQueryFixedNavbar-'+#system")
-	public List<HomeNavbar> listQueryFixedNavbar(SystemEnum system) {
-		return homeNavbarMapper.listQueryFixedNavbar(system);
-	}
-
-	@Override
-	public HomeNavbar getEffectiveByClassId(Long classId, SystemEnum system) {
-		return homeNavbarMapper.getEffectiveByClassId(classId,system);
-	}
-
-	
-	@Override
-	public void switchState(Long id) throws HomeNavbarException {
-		if (id == null) {
-			throw new HomeNavbarException(1, "璇蜂紶閫掓纭弬鏁�");
-		}
-		
-		HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
-		if (resultObj == null) {
-			throw new HomeNavbarException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�");
-		}
-		
-		Integer state = resultObj.getState();
-		if (state == null || state == 0) {
-			state = 1;
-		} else {
-			state = 0;
-		}
-		
-		HomeNavbar updateObj = new HomeNavbar();
-		updateObj.setId(id);
-		updateObj.setState(state);
-		homeNavbarMapper.updateByPrimaryKeySelective(updateObj);
-	}
-	
-}
+package com.yeshi.fanli.service.impl.homemodule;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+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;
+import org.springframework.web.multipart.MultipartFile;
+import org.yeshi.utils.tencentcloud.COSManager;
+
+import com.yeshi.fanli.dao.mybatis.homemodule.HomeNavbarMapper;
+import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
+import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
+import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar.NavbarTypeEnum;
+import com.yeshi.fanli.entity.bus.homemodule.SwiperBanner;
+import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
+import com.yeshi.fanli.exception.homemodule.SpecialException;
+import com.yeshi.fanli.service.inter.goods.GoodsClassService;
+import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
+import com.yeshi.fanli.service.inter.homemodule.SwiperBannerService;
+import com.yeshi.fanli.util.FilePathEnum;
+import com.yeshi.fanli.util.StringUtil;
+
+
+@Service
+public class HomeNavbarServiceImpl implements HomeNavbarService {
+	
+	@Resource
+	private HomeNavbarMapper homeNavbarMapper;
+	
+	@Resource
+	private GoodsClassService goodsClassService;
+	
+	@Resource
+	private SwiperBannerService swiperBannerService;
+
+	@Override
+	@Transactional
+	public int deleteBatchByPrimaryKey(List<Long> list) {
+		if (list == null || list.size() == 0) {
+			return 0;
+		}
+		
+		for (Long id: list) {
+			HomeNavbar homeNavbar = homeNavbarMapper.selectByPrimaryKey(id);
+			if (homeNavbar !=null) {
+				// 鍒犻櫎宸插瓨鍦ㄥ浘鐗� /
+				String picture = homeNavbar.getPicture();
+				if (!StringUtil.isNullOrEmpty(picture)) {
+					COSManager.getInstance().deleteFile(picture);
+				}
+			}
+		}
+		return homeNavbarMapper.deleteBatchByPrimaryKey(list);
+	}
+
+	
+
+	@Override
+	public void saveObject(MultipartFile file, HomeNavbar record) throws HomeNavbarException, Exception{
+		
+		String name = record.getName();
+		if (name == null || name.trim().length() == 0) {
+			throw new HomeNavbarException(1, "瀵艰埅鍚嶇О涓嶈兘涓虹┖");
+		}
+		
+		Integer sex = null;
+		NavbarTypeEnum type = record.getType();
+		if (NavbarTypeEnum.category.equals(type)) {
+			Long classId = record.getClassId();
+			if (classId == null) {
+				throw new HomeNavbarException(1, "璇烽�夋嫨鍒嗙被");
+			}
+			
+			GoodsClass goodsClass = goodsClassService.getGoodsClass(record.getClassId());
+			if (goodsClass == null) {
+				throw new HomeNavbarException(1, "鍒嗙被涓嶅瓨鍦�");
+			}
+			sex = goodsClass.getSex();
+			if (sex == null) {
+				throw new HomeNavbarException(1, "鍒嗙被鏈寚瀹氶�傜敤鐗堟湰");
+			}
+			record.setUrl(null);
+		} else if(NavbarTypeEnum.weex.equals(type) || NavbarTypeEnum.web.equals(type)) {
+			String url = record.getUrl();
+			if (url == null || url.trim().length() == 0) {
+				throw new HomeNavbarException(1, "璇疯緭鍏Rl閾炬帴");
+			}
+		} else {
+			throw new HomeNavbarException(1, "绫诲瀷鐨勫�间笉姝g‘");
+		}
+		
+		
+		Long swiperBannerId = record.getSwiperBannerId();
+		if (swiperBannerId != null && swiperBannerId == 0) {
+			record.setSwiperBannerId(null);
+		}
+		
+		// 鏃堕棿杞崲
+		handleTime(record);
+		
+		// 鍥剧墖涓婁紶
+		String picture = null;
+		if (file != null) {
+			picture = uploadPicture(file);
+		}
+		
+		Boolean isDefault = record.getIsDefault();
+		if (isDefault == null) {
+			record.setIsDefault(false);
+		}
+		
+		Boolean isFixed = record.getIsFixed();
+		if (isFixed == null) {
+			record.setIsFixed(false);
+		}
+		
+		Long id = record.getId();
+		if (id == null) {
+			record.setPicture(picture);
+			record.setCreatetime(new Date());
+			record.setUpdatetime(new Date());
+			
+			Integer state = record.getState();
+			if (state == null) {
+				record.setState(0);
+			}
+			
+			record.setOrderby(homeNavbarMapper.getDefaultMaxOrder() + 1);
+			record.setOrderMan(homeNavbarMapper.getManMaxOrder() + 1);
+			record.setOrderWoman(homeNavbarMapper.getWomanMaxOrder() + 1);
+			
+			record.setIsFixed(false);//鐩墠鏃犲浐瀹氶」
+			homeNavbarMapper.insert(record);
+		} else {
+			// 淇敼
+			HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
+			if (resultObj == null) {
+				throw new HomeNavbarException(1, "淇敼鍐呭宸蹭笉瀛樺湪");
+			}
+			
+			if (picture != null && picture.trim().length() > 0) {
+				// 鍒犻櫎鑰佸浘
+				removePicture(resultObj.getPicture());
+				// 瀛樺偍鏂板浘
+				record.setPicture(picture);
+			} else {
+				record.setPicture(resultObj.getPicture());
+			}
+			
+			record.setOrderby(resultObj.getOrderby());
+			record.setOrderMan(resultObj.getOrderMan());
+			record.setOrderWoman(resultObj.getOrderWoman());
+			record.setCreatetime(resultObj.getCreatetime());
+			record.setUpdatetime(new Date());
+			if(record.getIsFixed()==null) {
+				record.setIsFixed(false);//鐩墠鏃犲浐瀹氶」
+			}
+			homeNavbarMapper.updateByPrimaryKey(record);
+		}
+	}
+
+	
+	/**
+	 * 涓婁紶鍥剧墖
+	 * @param file
+	 * @return
+	 * @throws Exception
+	 */
+	public String uploadPicture(MultipartFile file) throws Exception {
+		// 鏂囦欢瑙f瀽 
+		InputStream inputStream = file.getInputStream();
+		String contentType = file.getContentType();
+		String type = contentType.substring(contentType.indexOf("/") + 1);
+	
+		// 鏂囦欢璺緞
+		String filePath= FilePathEnum.homeNavbar.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
+		// 鎵ц涓婁紶
+		String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
+		
+		return fileLink;
+	}
+
+	/**
+	 * 鍒犻櫎鍥剧墖-涓嶆洿鏂版暟鎹簱
+	 * @param picture
+	 * @throws Exception
+	 */
+	public void removePicture(String picture) throws Exception {
+		if (picture != null && picture.trim().length() > 0) {
+			COSManager.getInstance().deleteFile(picture);
+		}
+	}
+	
+	
+	/**
+	 * web娈垫椂闂磋浆鎹�
+	 * 
+	 * @param record
+	 */
+	private void handleTime(HomeNavbar record) throws SpecialException, Exception {
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+		
+		String startTime_str = record.getStartTime_str();
+		if (!StringUtil.isNullOrEmpty(startTime_str)) {
+			startTime_str = startTime_str.replaceAll("T", " ");
+			record.setStartTime(format.parse(startTime_str));
+		}
+		
+		String endTime_str = record.getEndTime_str();
+		if (!StringUtil.isNullOrEmpty(endTime_str)) {
+			endTime_str = endTime_str.replaceAll("T", " ");
+			record.setEndTime(format.parse(endTime_str));
+		}
+		
+		if (record.getEndTime() != null && record.getStartTime() != null
+				&& record.getStartTime().getTime() > record.getEndTime().getTime()) {
+			throw new SpecialException(1, "璧峰鏃堕棿涓嶈兘灏忎簬缁撴潫鏃堕棿");
+		}
+	}
+	
+	
+	@Override
+	public void updateOrder(Long id, Integer moveType, Integer sex) throws HomeNavbarException, Exception{
+
+		if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
+			throw new HomeNavbarException(1, "浼犻�掔殑绫诲瀷涓嶆纭�");
+		}
+		
+		if (id == null) {
+			throw new HomeNavbarException(1, "ID涓嶈兘涓虹┖");
+		}
+		
+		
+		HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
+		if (resultObj == null) {
+			throw new HomeNavbarException(1, "鎿嶄綔鏁版嵁宸蹭笉瀛樺湪");
+		}
+			
+		if (sex == null) {
+			sex = GoodsClass.SEX_DEFAULT;
+		}
+		
+		HomeNavbar changeObj = null;
+		if (GoodsClass.SEX_ALL == sex || GoodsClass.SEX_DEFAULT == sex) {
+			Integer orderby = resultObj.getOrderby();
+			changeObj = homeNavbarMapper.getDefaultChangeOrder(moveType, orderby);
+			if (changeObj == null ) {
+				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
+			}
+			resultObj.setOrderby(changeObj.getOrderby());
+			changeObj.setOrderby(orderby);
+		} else if (GoodsClass.SEX_MAN == sex) {
+			Integer orderMan = resultObj.getOrderMan();
+			changeObj = homeNavbarMapper.getManChangeOrder(moveType, orderMan);
+			if (changeObj == null ) {
+				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
+			}
+			resultObj.setOrderMan(changeObj.getOrderMan());
+			changeObj.setOrderMan(orderMan);
+		} else if (GoodsClass.SEX_WOMAN == sex) {
+			Integer orderWoman = resultObj.getOrderWoman();
+			changeObj = homeNavbarMapper.getWomanChangeOrder(moveType, orderWoman);
+			if (changeObj == null ) {
+				throw new HomeNavbarException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
+			}
+			resultObj.setOrderWoman(changeObj.getOrderWoman());
+			changeObj.setOrderWoman(orderWoman);
+		}
+		
+		if (changeObj == null ) {
+			throw new HomeNavbarException(1, "鏃犲彲浜ゆ崲鐨勪綅缃�");
+		}
+		
+		homeNavbarMapper.updateByPrimaryKeySelective(changeObj);
+		homeNavbarMapper.updateByPrimaryKeySelective(resultObj);
+	}
+
+
+	
+	@Override
+	public List<HomeNavbar> listQuery(long start, int count, String key, Integer sex, SystemEnum system) {
+		
+		List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key, sex,system);
+		if (listObj == null || listObj.size() == 0) {
+			return null;
+		}
+		
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
+		
+		for (HomeNavbar homeNavbar: listObj) {
+			Date startTime = homeNavbar.getStartTime();
+			if (startTime == null) {
+				homeNavbar.setStartTime_str("");
+			} else {
+				homeNavbar.setStartTime_str(sdf.format(startTime));
+			}
+			
+			Date endTime = homeNavbar.getEndTime();
+			if (endTime == null) {
+				homeNavbar.setEndTime_str("");
+			} else {
+				homeNavbar.setEndTime_str(sdf.format(endTime));
+			}
+			
+			Long classId = homeNavbar.getClassId();
+			if (classId != null) {
+				GoodsClass goodsClass = goodsClassService.selectByPrimaryKey(classId);
+				if(goodsClass != null) {
+					homeNavbar.setClassName(goodsClass.getName());
+				}
+			}
+			
+			Long swiperBannerId = homeNavbar.getSwiperBannerId();
+			if (swiperBannerId != null) {
+				SwiperBanner swiperBanner = swiperBannerService.selectByPrimaryKey(swiperBannerId);
+				if(swiperBanner != null) {
+					homeNavbar.setSwiperName(swiperBanner.getTitle());
+				}
+			} else {
+				// 鍒濆鍖�
+				homeNavbar.setSwiperBannerId(0L);
+			}
+		}
+		return listObj;
+	}
+	
+	@Override
+	public long countlistQuery(String key, Integer sex, SystemEnum system) {
+		return homeNavbarMapper.countListQuery(key, sex,system);
+	}
+
+	@Override
+	@Cacheable(value = "configCache", key = "'listQueryEffectiveNavbar-'+#system")
+	public List<HomeNavbar> listQueryEffectiveNavbar(SystemEnum system) {
+		return homeNavbarMapper.listQueryEffective(system);
+	}
+	
+	
+	@Override
+	@Cacheable(value = "configCache", key = "'listQueryDefaultNavbar-'+#sex")
+	public List<HomeNavbar> listQueryDefaultNavbar(Integer sex, SystemEnum system) {
+		return homeNavbarMapper.listQueryDefaultNavbar(sex,system);
+	}
+	
+	
+	@Override
+	@Cacheable(value = "configCache", key = "'listQueryFixedNavbar-'+#system")
+	public List<HomeNavbar> listQueryFixedNavbar(SystemEnum system) {
+		return homeNavbarMapper.listQueryFixedNavbar(system);
+	}
+
+	@Override
+	public HomeNavbar getEffectiveByClassId(Long classId, SystemEnum system) {
+		return homeNavbarMapper.getEffectiveByClassId(classId,system);
+	}
+
+	
+	@Override
+	public void switchState(Long id) throws HomeNavbarException {
+		if (id == null) {
+			throw new HomeNavbarException(1, "璇蜂紶閫掓纭弬鏁�");
+		}
+		
+		HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
+		if (resultObj == null) {
+			throw new HomeNavbarException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�");
+		}
+		
+		Integer state = resultObj.getState();
+		if (state == null || state == 0) {
+			state = 1;
+		} else {
+			state = 0;
+		}
+		
+		HomeNavbar updateObj = new HomeNavbar();
+		updateObj.setId(id);
+		updateObj.setState(state);
+		homeNavbarMapper.updateByPrimaryKeySelective(updateObj);
+	}
+	
+}

--
Gitblit v1.8.0