|
|
@@ -0,0 +1,39 @@
|
|
|
+package com.uas.platform.b2b.service.impl;
|
|
|
+
|
|
|
+import com.uas.platform.b2b.dao.GuideSettingDao;
|
|
|
+import com.uas.platform.b2b.model.GuideSetting;
|
|
|
+import com.uas.platform.b2b.service.GuideSettingService;
|
|
|
+import com.uas.platform.b2b.support.CommBufferedLogger;
|
|
|
+import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by hejq on 2017-12-13.
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class GuideSettingServiceImpl implements GuideSettingService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GuideSettingDao settingDao;
|
|
|
+
|
|
|
+ private final static CommBufferedLogger logger = BufferedLoggerManager.getLogger(CommBufferedLogger.class);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean toggle(Long useruu, String guName, Short status) {
|
|
|
+ Integer count = settingDao.countByUseruuAndAndNameAndsAndStatus(useruu, guName, status);
|
|
|
+ return count > 0 ? true : false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void save(GuideSetting setting) {
|
|
|
+ List<GuideSetting> settings = settingDao.findByUseruuAndAndName(setting.getUseruu(), setting.getName());
|
|
|
+ if(!CollectionUtils.isEmpty(settings))
|
|
|
+ setting.setId(settings.get(0).getId());
|
|
|
+ settingDao.save(setting);
|
|
|
+ logger.log(setting.getName(), "success", "设置" + setting.getName() + "状态为:" + setting.getStatus(), setting.getUseruu());
|
|
|
+ }
|
|
|
+}
|