From 81da61b828e29b7745e1382dfbbaeb685dc083ef Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 23 一月 2024 17:17:55 +0800
Subject: [PATCH] 抖音转链修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java |  330 +++++++++++++++++++++++++++---------------------------
 1 files changed, 165 insertions(+), 165 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
index 5906cca..cc4c881 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
@@ -1,165 +1,165 @@
-package com.yeshi.fanli.service.impl.customerservice;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-import org.yeshi.utils.StringUtil;
-
-import com.yeshi.fanli.dao.mybatis.customerservice.CustomerServiceCommonQuestionMapper;
-import com.yeshi.fanli.entity.customerservice.CustomerServiceCommonQuestion;
-import com.yeshi.fanli.exception.user.CustomerServiceCommonQuestionException;
-import com.yeshi.fanli.service.inter.customerservice.CustomerServiceCommonQuestionService;
-
-@Service
-public class CustomerServiceCommonQuestionServiceImpl implements CustomerServiceCommonQuestionService {
-
-	@Resource
-	private CustomerServiceCommonQuestionMapper customerServiceCommonQuestionMapper;
-
-	@Override
-	public CustomerServiceCommonQuestion searchByKey(String key) {
-		List<CustomerServiceCommonQuestion> list = customerServiceCommonQuestionMapper.selectByKey(key);
-		if (list == null || list.size() == 0)
-			return null;
-		Comparator<CustomerServiceCommonQuestion> cm = new Comparator<CustomerServiceCommonQuestion>() {
-
-			@Override
-			public int compare(CustomerServiceCommonQuestion o1, CustomerServiceCommonQuestion o2) {
-				return o1.getKey().replace(key, "").length() - o2.getKey().replace(key, "").length();
-			}
-		};
-		Collections.sort(list, cm);
-		return list.get(0);
-	}
-
-	@Override
-	public CustomerServiceCommonQuestion searchByKeyCache(String key) {
-		return searchByKey(key);
-	}
-
-	@Override
-	public void addCustomerServiceCommonQuestion(CustomerServiceCommonQuestion question)
-			throws CustomerServiceCommonQuestionException {
-		if (question == null || StringUtil.isNullOrEmpty(question.getKey())
-				|| StringUtil.isNullOrEmpty(question.getContent())
-				|| StringUtil.isNullOrEmpty(question.getContentType()))
-			throw new CustomerServiceCommonQuestionException(1, "闂淇℃伅涓嶅畬鏁�");
-
-		CustomerServiceCommonQuestion oldQuestion = searchByKey(question.getKey());
-		if (oldQuestion != null && oldQuestion.getKey().equalsIgnoreCase(question.getKey()))
-			throw new CustomerServiceCommonQuestionException(2, "宸叉湁璇ラ棶棰�");
-		customerServiceCommonQuestionMapper.insertSelective(question);
-	}
-
-	@Override
-	public void updateCustomerServiceCommonQuestion(CustomerServiceCommonQuestion question)
-			throws CustomerServiceCommonQuestionException {
-		if (question == null || question.getId() == null)
-			return;
-		customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(question);
-	}
-
-	@Override
-	public void deleteCustomerServiceCommonQuestion(Long id) {
-		customerServiceCommonQuestionMapper.deleteByPrimaryKey(id);
-	}
-
-	@Override
-	public List<String> listKeysCache() {
-		return customerServiceCommonQuestionMapper.selectKeys();
-	}
-
-	@Override
-	public List<CustomerServiceCommonQuestion> listCustomerServiceCommonQuestion(int page, int pageSize) {
-		return customerServiceCommonQuestionMapper.selectOrderByUpdateTime((page - 1) * pageSize, pageSize);
-	}
-
-	@Override
-	public Long countCustomerServiceCommonQuestion() {
-		return customerServiceCommonQuestionMapper.selectCount();
-	}
-	
-	
-	@Override
-	public List<CustomerServiceCommonQuestion> listQuery(long start, int count, String key, 
-			String type, Integer state, Integer sort){
-		return customerServiceCommonQuestionMapper.listQuery(start, count, key, type, state, sort);
-	}
-	
-	@Override
-	public long countQuery(String key, String type, Integer state) {
-		return customerServiceCommonQuestionMapper.countQuery(key, type, state);
-	}
-
-	@Override
-	public int deleteBatchByPrimaryKey(List<Long> list) {
-		return customerServiceCommonQuestionMapper.deleteBatchByPrimaryKey(list);
-	}
-
-	@Override
-	public int insert(CustomerServiceCommonQuestion record) {
-		return customerServiceCommonQuestionMapper.insert(record);
-	}
-
-	@Override
-	public int insertSelective(CustomerServiceCommonQuestion record) {
-		return customerServiceCommonQuestionMapper.insertSelective(record);
-	}
-
-	@Override
-	public int updateByPrimaryKeySelective(CustomerServiceCommonQuestion record) {
-		return customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
-	}
-
-	@Override
-	public int updateByPrimaryKey(CustomerServiceCommonQuestion record) {
-		return customerServiceCommonQuestionMapper.updateByPrimaryKey(record);
-	}
-
-	@Override
-	public CustomerServiceCommonQuestion selectByPrimaryKey(Long id) {
-		return customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
-	}
-	
-	@Override
-	public void save(CustomerServiceCommonQuestion record) throws Exception, CustomerServiceCommonQuestionException {
-		if (record == null) {
-			throw new  CustomerServiceCommonQuestionException(1, "鍙傛暟涓嶈兘涓虹┖");
-		}
-		
-		String key = record.getKey();
-		String content = record.getContent();
-		String contentType = record.getContentType();
-		if (key == null || key.trim().length() == 0 || content == null || content.trim().length() == 0
-				|| contentType == null || contentType.trim().length() == 0) {
-			throw new  CustomerServiceCommonQuestionException(1, "缂栬緫鍐呭涓嶈兘涓虹┖");
-		}
-		
-		Long id = record.getId();
-		if (id == null) {
-			// 鏂板
-			record.setWeight(0);
-			record.setCreateTime(new Date());
-			record.setUpdateTime(new Date());
-			customerServiceCommonQuestionMapper.insert(record);
-		} else {
-			CustomerServiceCommonQuestion commonQuestion = customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
-			if (commonQuestion == null) {
-				throw new  CustomerServiceCommonQuestionException(1, "鏁版嵁宸蹭笉瀛樺湪");
-			}
-			// 淇敼
-			record.setUpdateTime(new Date());
-			// 淇濆瓨涔嬪墠鐨勭姸鎬�
-			record.setState(commonQuestion.isState());
-			
-			customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
-		}
-		
-	}
-	
-}
+package com.yeshi.fanli.service.impl.customerservice;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.yeshi.utils.StringUtil;
+
+import com.yeshi.fanli.dao.mybatis.customerservice.CustomerServiceCommonQuestionMapper;
+import com.yeshi.fanli.entity.customerservice.CustomerServiceCommonQuestion;
+import com.yeshi.fanli.exception.user.CustomerServiceCommonQuestionException;
+import com.yeshi.fanli.service.inter.customerservice.CustomerServiceCommonQuestionService;
+
+@Service
+public class CustomerServiceCommonQuestionServiceImpl implements CustomerServiceCommonQuestionService {
+
+	@Resource
+	private CustomerServiceCommonQuestionMapper customerServiceCommonQuestionMapper;
+
+	@Override
+	public CustomerServiceCommonQuestion searchByKey(String key) {
+		List<CustomerServiceCommonQuestion> list = customerServiceCommonQuestionMapper.selectByKey(key);
+		if (list == null || list.size() == 0)
+			return null;
+		Comparator<CustomerServiceCommonQuestion> cm = new Comparator<CustomerServiceCommonQuestion>() {
+
+			@Override
+			public int compare(CustomerServiceCommonQuestion o1, CustomerServiceCommonQuestion o2) {
+				return o1.getKey().replace(key, "").length() - o2.getKey().replace(key, "").length();
+			}
+		};
+		Collections.sort(list, cm);
+		return list.get(0);
+	}
+
+	@Override
+	public CustomerServiceCommonQuestion searchByKeyCache(String key) {
+		return searchByKey(key);
+	}
+
+	@Override
+	public void addCustomerServiceCommonQuestion(CustomerServiceCommonQuestion question)
+			throws CustomerServiceCommonQuestionException {
+		if (question == null || StringUtil.isNullOrEmpty(question.getKey())
+				|| StringUtil.isNullOrEmpty(question.getContent())
+				|| StringUtil.isNullOrEmpty(question.getContentType()))
+			throw new CustomerServiceCommonQuestionException(1, "闂淇℃伅涓嶅畬鏁�");
+
+		CustomerServiceCommonQuestion oldQuestion = searchByKey(question.getKey());
+		if (oldQuestion != null && oldQuestion.getKey().equalsIgnoreCase(question.getKey()))
+			throw new CustomerServiceCommonQuestionException(2, "宸叉湁璇ラ棶棰�");
+		customerServiceCommonQuestionMapper.insertSelective(question);
+	}
+
+	@Override
+	public void updateCustomerServiceCommonQuestion(CustomerServiceCommonQuestion question)
+			throws CustomerServiceCommonQuestionException {
+		if (question == null || question.getId() == null)
+			return;
+		customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(question);
+	}
+
+	@Override
+	public void deleteCustomerServiceCommonQuestion(Long id) {
+		customerServiceCommonQuestionMapper.deleteByPrimaryKey(id);
+	}
+
+	@Override
+	public List<String> listKeysCache() {
+		return customerServiceCommonQuestionMapper.selectKeys();
+	}
+
+	@Override
+	public List<CustomerServiceCommonQuestion> listCustomerServiceCommonQuestion(int page, int pageSize) {
+		return customerServiceCommonQuestionMapper.selectOrderByUpdateTime((page - 1) * pageSize, pageSize);
+	}
+
+	@Override
+	public Long countCustomerServiceCommonQuestion() {
+		return customerServiceCommonQuestionMapper.selectCount();
+	}
+	
+	
+	@Override
+	public List<CustomerServiceCommonQuestion> listQuery(long start, int count, String key, 
+			String type, Integer state, Integer sort){
+		return customerServiceCommonQuestionMapper.listQuery(start, count, key, type, state, sort);
+	}
+	
+	@Override
+	public long countQuery(String key, String type, Integer state) {
+		return customerServiceCommonQuestionMapper.countQuery(key, type, state);
+	}
+
+	@Override
+	public int deleteBatchByPrimaryKey(List<Long> list) {
+		return customerServiceCommonQuestionMapper.deleteBatchByPrimaryKey(list);
+	}
+
+	@Override
+	public int insert(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.insert(record);
+	}
+
+	@Override
+	public int insertSelective(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.insertSelective(record);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
+	}
+
+	@Override
+	public int updateByPrimaryKey(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.updateByPrimaryKey(record);
+	}
+
+	@Override
+	public CustomerServiceCommonQuestion selectByPrimaryKey(Long id) {
+		return customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
+	}
+	
+	@Override
+	public void save(CustomerServiceCommonQuestion record) throws Exception, CustomerServiceCommonQuestionException {
+		if (record == null) {
+			throw new  CustomerServiceCommonQuestionException(1, "鍙傛暟涓嶈兘涓虹┖");
+		}
+		
+		String key = record.getKey();
+		String content = record.getContent();
+		String contentType = record.getContentType();
+		if (key == null || key.trim().length() == 0 || content == null || content.trim().length() == 0
+				|| contentType == null || contentType.trim().length() == 0) {
+			throw new  CustomerServiceCommonQuestionException(1, "缂栬緫鍐呭涓嶈兘涓虹┖");
+		}
+		
+		Long id = record.getId();
+		if (id == null) {
+			// 鏂板
+			record.setWeight(0);
+			record.setCreateTime(new Date());
+			record.setUpdateTime(new Date());
+			customerServiceCommonQuestionMapper.insert(record);
+		} else {
+			CustomerServiceCommonQuestion commonQuestion = customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
+			if (commonQuestion == null) {
+				throw new  CustomerServiceCommonQuestionException(1, "鏁版嵁宸蹭笉瀛樺湪");
+			}
+			// 淇敼
+			record.setUpdateTime(new Date());
+			// 淇濆瓨涔嬪墠鐨勭姸鎬�
+			record.setState(commonQuestion.isState());
+			
+			customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
+		}
+		
+	}
+	
+}

--
Gitblit v1.8.0