|
@@ -1,5 +1,6 @@
|
|
|
package com.wdklian.ncs.ms.open.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
@@ -13,6 +14,7 @@ import com.wdklian.ncs.ms.common.utils.MatchConditionAnalysis;
|
|
|
import com.wdklian.ncs.ms.framework.database.annotation.Table;
|
|
|
import com.wdklian.ncs.ms.framework.exception.ServiceException;
|
|
|
import com.wdklian.ncs.ms.framework.util.BeanUtil;
|
|
|
+import com.wdklian.ncs.ms.framework.util.StringUtil;
|
|
|
import com.wdklian.ncs.ms.open.common.ShopHelper;
|
|
|
import com.wdklian.ncs.ms.open.service.iservice.NursingMarkCategoryConfigService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -82,7 +84,18 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
throw new ServiceException("已存在同名分类[" + nurseCategoryConfigDO.getCategoryName() + "],请更换名称");
|
|
|
}
|
|
|
if (StrUtil.isEmpty(nurseCategoryConfigDO.getMatchCondition())) {
|
|
|
- nurseCategoryConfigDO.setMatchCondition("[{\"containKeywords\":[],\"excludeKeywords\":[],\"eliminateKeywords\":[],\"containKeywordsInputVisable\":false,\"excludeKeywordsInputVisable\":false,\"eliminateKeywordsInputVisable\":false,\"bgColor\":\"\"}]");
|
|
|
+ nurseCategoryConfigDO.setMatchCondition("[{\"containKeywords\":[],\"excludeKeywords\":[],\"eliminateKeywords\":[],\"containKeywordsInputVisable\":false,\"excludeKeywordsInputVisable\":false,\"eliminateKeywordsInputVisable\":false,\"bgColor\":\"\",\"iconUrl\":\"\",\"contentShow\":3}]");
|
|
|
+ }
|
|
|
+ if(StringUtil.isEmpty(nurseCategoryConfigDO.getDefaultIcon())){ //默认分类图标被清除,匹配条件中的显示设置需要设置为仅显示文字
|
|
|
+ JSONArray jsonArray = JSON.parseArray(nurseCategoryConfigDO.getMatchCondition());
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ Object iconUrl = jsonObject.getByPath("$.iconUrl");
|
|
|
+ if(iconUrl == null || StrUtil.isEmpty(iconUrl.toString())){
|
|
|
+ jsonObject.put("contentShow",3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nurseCategoryConfigDO.setMatchCondition(jsonArray.toJSONString());
|
|
|
}
|
|
|
return super.edit(nurseCategoryConfigDO, id);
|
|
|
}
|
|
@@ -94,7 +107,7 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
throw new ServiceException("已存在同名分类[" + nurseCategoryConfigDO.getCategoryName() + "],请更换名称");
|
|
|
}
|
|
|
if (StrUtil.isEmpty(nurseCategoryConfigDO.getMatchCondition())) {
|
|
|
- nurseCategoryConfigDO.setMatchCondition("[{\"containKeywords\":[],\"excludeKeywords\":[],\"eliminateKeywords\":[],\"containKeywordsInputVisable\":false,\"excludeKeywordsInputVisable\":false,\"eliminateKeywordsInputVisable\":false,\"bgColor\":\"\"}]");
|
|
|
+ nurseCategoryConfigDO.setMatchCondition("[{\"containKeywords\":[],\"excludeKeywords\":[],\"eliminateKeywords\":[],\"containKeywordsInputVisable\":false,\"excludeKeywordsInputVisable\":false,\"eliminateKeywordsInputVisable\":false,\"bgColor\":\"\",\"iconUrl\":\"\",\"contentShow\":3}]");
|
|
|
}
|
|
|
NursingMarkCategoryConfigDO add = super.add(nurseCategoryConfigDO);
|
|
|
int lastId = this.daoSupport.getLastId(NursingMarkCategoryConfigDO.class.getAnnotation(Table.class).name());
|
|
@@ -334,7 +347,7 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
public String getAllAdviceCategoryCaseWhenSql(String matchProp, ShopDO part, Boolean distinct) {
|
|
|
List<NursingMarkCategoryConfigDO> nurseCategories = this.listAutoChildrenCategory(part.getShopId());
|
|
|
if (!nurseCategories.isEmpty()) {
|
|
|
- List<String> hisCode = part == null ? null : this.shopHelper.listPartsRefHisCode(part);
|
|
|
+ List<String> hisCode = this.shopHelper.listPartsRefHisCode(part);
|
|
|
StringBuilder sbuilder = new StringBuilder();
|
|
|
for (NursingMarkCategoryConfigDO settingDO : nurseCategories) {
|
|
|
sbuilder.append(getNurseCategoryCaseSQL(settingDO, matchProp, distinct ? null : hisCode));
|
|
@@ -560,6 +573,8 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
|
|
|
for (Object o : matchConditon) {
|
|
|
String bgColor = categoryConfigDO.getDefaultColor();
|
|
|
+ String defaultIcon =ObjectUtil.defaultIfEmpty(categoryConfigDO.getDefaultIcon(),"");
|
|
|
+ Integer defaultcontentShow = ObjectUtil.defaultIfNull(categoryConfigDO.getDefaultContentShow(),3);
|
|
|
replaceBuild.setLength(0);
|
|
|
|
|
|
|
|
@@ -605,6 +620,14 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
if (conditon.containsKey("bgColor") && StrUtil.isNotEmpty(conditon.getString("bgColor"))) {
|
|
|
bgColor = conditon.getString("bgColor");
|
|
|
}
|
|
|
+ Object iconUrl = conditon.getByPath("$.iconUrl");
|
|
|
+ if(iconUrl!=null){
|
|
|
+ defaultIcon = iconUrl.toString();
|
|
|
+ }
|
|
|
+ Object contentShow = conditon.getByPath("$.contentShow");
|
|
|
+ if(contentShow!=null){
|
|
|
+ defaultcontentShow = (Integer) contentShow;
|
|
|
+ }
|
|
|
|
|
|
if (sbuilder.length() > 10) {
|
|
|
sbuilder.delete(sbuilder.length() - 5, sbuilder.length());
|
|
@@ -619,7 +642,12 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
sbuilder.append(")) then ").append(replaceBuild.length() == 0 ? filed : replaceBuild.toString()).append(" ");
|
|
|
} else if (filed.equalsIgnoreCase("category_name")) {
|
|
|
sbuilder.append(")) then '").append(categoryConfigDO.getCategoryName()).append("'");
|
|
|
- } else {
|
|
|
+ } else if(filed.equalsIgnoreCase("icon_url")){
|
|
|
+ sbuilder.append(")) then '").append(defaultIcon).append("'");
|
|
|
+ } else if(filed.equalsIgnoreCase("content_show")){
|
|
|
+ sbuilder.append(")) then '").append(defaultcontentShow).append("'");
|
|
|
+ } else if(filed.equalsIgnoreCase("bg_color"))
|
|
|
+ {
|
|
|
sbuilder.append(")) then '").append(bgColor).append("'");
|
|
|
}
|
|
|
|
|
@@ -633,7 +661,7 @@ public class NursingMarkCategoryConfigServiceImpl extends OpenPlateformCRUDServi
|
|
|
return sbuilder.toString();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
return "";
|
|
|
}
|
|
|
|