|
@@ -19,6 +19,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.zskk.shop.dao.ShopConfigMapper;
|
|
import com.zskk.shop.dao.ShopConfigMapper;
|
|
import com.zskk.shop.dao.entry.ShopConfig;
|
|
import com.zskk.shop.dao.entry.ShopConfig;
|
|
|
|
+import com.zskk.shop.exception.ErrorConstant;
|
|
|
|
+import com.zskk.shop.exception.ZSKKException;
|
|
import com.zskk.shop.utils.ToolsUtil;
|
|
import com.zskk.shop.utils.ToolsUtil;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -28,11 +30,23 @@ public class ShopConfigService {
|
|
*/
|
|
*/
|
|
public static final String KEY_EQUIPMENT_INFO = "equipment_info";
|
|
public static final String KEY_EQUIPMENT_INFO = "equipment_info";
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * KEY 中心专家
|
|
|
|
+ */
|
|
|
|
+ public static final String KEY_DOCTOR_INFO = "doctor_info";
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * KEY 医技检查
|
|
|
|
+ */
|
|
|
|
+ public static final String KEY_CHECK_INFO = "check_info";
|
|
|
|
+
|
|
private Set<String> ALL_KEYS = new HashSet<>();
|
|
private Set<String> ALL_KEYS = new HashSet<>();
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
public void init(){
|
|
public void init(){
|
|
ALL_KEYS.add(KEY_EQUIPMENT_INFO);
|
|
ALL_KEYS.add(KEY_EQUIPMENT_INFO);
|
|
|
|
+ ALL_KEYS.add(KEY_DOCTOR_INFO);
|
|
|
|
+ ALL_KEYS.add(KEY_CHECK_INFO);
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -60,6 +74,16 @@ public class ShopConfigService {
|
|
return config != null? config.getValue(): null;
|
|
return config != null? config.getValue(): null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取配置
|
|
|
|
+ * @param key
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public ShopConfig getConfig(String key){
|
|
|
|
+ ShopConfig config = shopConfigMapper.query(key);
|
|
|
|
+ return config;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置
|
|
* 设置
|
|
* @param key
|
|
* @param key
|
|
@@ -80,4 +104,31 @@ public class ShopConfigService {
|
|
shopConfigMapper.add(config);
|
|
shopConfigMapper.add(config);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 发布配置
|
|
|
|
+ * @param key
|
|
|
|
+ */
|
|
|
|
+ public void release(String key){
|
|
|
|
+ ShopConfig from = getConfig(key);
|
|
|
|
+ if (from == null){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ShopConfig to = shopConfigMapper.queryOnline(key);
|
|
|
|
+ if (to == null){
|
|
|
|
+ shopConfigMapper.addOnline(from);
|
|
|
|
+ }else{
|
|
|
|
+ shopConfigMapper.updateOnline(from);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询上线配置数据
|
|
|
|
+ * @param key
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public ShopConfig getOnline(String key){
|
|
|
|
+ return shopConfigMapper.queryOnline(key);
|
|
|
|
+ }
|
|
}
|
|
}
|