|
@ -4,10 +4,13 @@ import com.yihu.hos.standard.dao.IStdDictionaryModelDao;
|
|
|
import com.yihu.hos.standard.dao.StdDictionaryEntryModelDao;
|
|
|
import com.yihu.hos.standard.match.matchModel.DictItemMatchVO;
|
|
|
import com.yihu.hos.standard.model.adapter.AdapterDictEntryModel;
|
|
|
import com.yihu.hos.standard.model.adapter.AdapterDictModel;
|
|
|
import com.yihu.hos.standard.model.standard.StdDictionaryEntryModel;
|
|
|
import com.yihu.hos.standard.model.standard.StdDictionaryModel;
|
|
|
import com.yihu.hos.standard.service.adapter.AdapterDictEntryService;
|
|
|
import com.yihu.hos.standard.service.adapter.AdapterDictService;
|
|
|
import com.yihu.hos.standard.util.GetChineseFirst;
|
|
|
import com.yihu.hos.web.framework.util.springutil.SpringBeanUtil;
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@ -25,6 +28,7 @@ public class DictitemStandardExistStrategy {
|
|
|
private StdDictionaryEntryModelDao stdDictionaryEntryDao;
|
|
|
|
|
|
private AdapterDictEntryService adapterDictEntryService;
|
|
|
private AdapterDictService adapterDictService;
|
|
|
|
|
|
public DictitemStandardExistStrategy(IStdDictionaryModelDao stdDictionaryDao, StdDictionaryEntryModelDao stdDictionaryEntryDao, AdapterDictEntryService adapterDictEntryService) {
|
|
|
this.stdDictionaryDao = stdDictionaryDao;
|
|
@ -62,13 +66,15 @@ public class DictitemStandardExistStrategy {
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
public boolean match(AdapterDictEntryModel adapterDictEntryModel, DictItemMatchVO matchVO, String adapter_std_version,String version) throws Exception {
|
|
|
public boolean match(AdapterDictEntryModel adapterDictEntryModel, DictItemMatchVO matchVO,String std_version, String adapter_std_version,String version) throws Exception {
|
|
|
boolean flag = false;
|
|
|
try {
|
|
|
String dictitemNameFirstCode = GetChineseFirst.cn2py(adapterDictEntryModel.getStdEntryValue());//待匹配
|
|
|
List<AdapterDictEntryModel> matchList = matchVO.getCodeAdapter().get(dictitemNameFirstCode);//已存在
|
|
|
if (matchList != null && matchList.size() > 0) {
|
|
|
Integer unAdaptDicId = adapterDictEntryModel.getStdDictId();
|
|
|
StdDictionaryModel stdDictionaryModel = stdDictionaryDao.getDictionaryName(adapter_std_version,unAdaptDicId);
|
|
|
StdDictionaryModel stdDictionaryModel = stdDictionaryDao.getDictionaryName(std_version,unAdaptDicId);
|
|
|
StdDictionaryModel adapterDictionaryModel = stdDictionaryDao.getDictionaryName(adapter_std_version,unAdaptDicId);
|
|
|
String orgName = stdDictionaryModel.getName();
|
|
|
for (AdapterDictEntryModel adapterDictEntry : matchList) {
|
|
|
if(adapterDictEntry.getStdEntryValue().contains(adapterDictEntryModel.getStdEntryValue())){
|
|
@ -88,6 +94,15 @@ public class DictitemStandardExistStrategy {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (adapterDictionaryModel != null) {
|
|
|
adapterDictService = SpringBeanUtil.getService(AdapterDictService.BEAN_ID);
|
|
|
AdapterDictModel entity = adapterDictService.getAdapterDictByCode(version, adapterDictionaryModel.getCode());
|
|
|
adapterDictService.saveAdaptDict(entity, adapterDictionaryModel,version);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return flag;
|
|
|
}
|