|
@@ -13,7 +13,7 @@ import com.persagy.dc.common.constant.ValidEnum;
|
|
|
import com.persagy.dc.common.exception.BusinessException;
|
|
|
import com.persagy.dc.common.model.entity.BaseEntity;
|
|
|
import com.persagy.dc.define.dao.ObjectInfoMapper;
|
|
|
-import com.persagy.dc.define.entity.ObjectInfo;
|
|
|
+import com.persagy.dc.define.entity.ObjectInfoDefine;
|
|
|
import com.persagy.dc.define.service.IObjectInfoService;
|
|
|
import com.persagy.dc.parser.service.InfoDataFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,49 +39,49 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
private DigitalMessageHelper messageSender;
|
|
|
|
|
|
@Override
|
|
|
- public ObjectInfo load(String id) {
|
|
|
+ public ObjectInfoDefine load(String id) {
|
|
|
return dao.selectById(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ObjectInfo> queryByIds(List<String> idList) {
|
|
|
+ public List<ObjectInfoDefine> queryByIds(List<String> idList) {
|
|
|
return dao.selectBatchIds(idList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ObjectInfo> queryByType(String typeCode) {
|
|
|
- LambdaQueryWrapper<ObjectInfo> wrapper = new LambdaQueryWrapper();
|
|
|
- wrapper.eq(ObjectInfo::getClassCode, typeCode);
|
|
|
- wrapper.eq(ObjectInfo::getValid, ValidEnum.TRUE.getType());
|
|
|
- wrapper.orderByAsc(ObjectInfo::getShowOrder);
|
|
|
+ public List<ObjectInfoDefine> queryByType(String typeCode) {
|
|
|
+ LambdaQueryWrapper<ObjectInfoDefine> wrapper = new LambdaQueryWrapper();
|
|
|
+ wrapper.eq(ObjectInfoDefine::getClassCode, typeCode);
|
|
|
+ wrapper.eq(ObjectInfoDefine::getValid, ValidEnum.TRUE.getType());
|
|
|
+ wrapper.orderByAsc(ObjectInfoDefine::getShowOrder);
|
|
|
return queryByCondition(wrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Map<String, ObjectInfo>> queryByTypes(List<String> typeCodeList) {
|
|
|
- LambdaQueryWrapper<ObjectInfo> wrapper = new LambdaQueryWrapper();
|
|
|
- wrapper.in(ObjectInfo::getClassCode, typeCodeList);
|
|
|
- wrapper.eq(ObjectInfo::getValid, ValidEnum.TRUE.getType());
|
|
|
- wrapper.orderByAsc(ObjectInfo::getShowOrder);
|
|
|
- List<ObjectInfo> infoList = queryByCondition(wrapper);
|
|
|
+ public Map<String, Map<String, ObjectInfoDefine>> queryByTypes(List<String> typeCodeList) {
|
|
|
+ LambdaQueryWrapper<ObjectInfoDefine> wrapper = new LambdaQueryWrapper();
|
|
|
+ wrapper.in(ObjectInfoDefine::getClassCode, typeCodeList);
|
|
|
+ wrapper.eq(ObjectInfoDefine::getValid, ValidEnum.TRUE.getType());
|
|
|
+ wrapper.orderByAsc(ObjectInfoDefine::getShowOrder);
|
|
|
+ List<ObjectInfoDefine> infoList = queryByCondition(wrapper);
|
|
|
if(CollUtil.isEmpty(infoList)) {
|
|
|
return null;
|
|
|
}
|
|
|
- return infoList.stream().collect(Collectors.groupingBy(ObjectInfo::getClassCode, Collectors.toMap(ObjectInfo::getCode, p->p, (v1,v2) -> v1)));
|
|
|
+ return infoList.stream().collect(Collectors.groupingBy(ObjectInfoDefine::getClassCode, Collectors.toMap(ObjectInfoDefine::getCode, p->p, (v1, v2) -> v1)));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ObjectInfo> queryByCondition(Wrapper<ObjectInfo> queryWrapper) {
|
|
|
+ public List<ObjectInfoDefine> queryByCondition(Wrapper<ObjectInfoDefine> queryWrapper) {
|
|
|
return dao.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page queryByCondition(Page page, Wrapper<ObjectInfo> queryWrapper) {
|
|
|
+ public Page queryByCondition(Page page, Wrapper<ObjectInfoDefine> queryWrapper) {
|
|
|
return dao.selectPage(page, queryWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ObjectInfo> insert(List<ObjectInfo> voList) {
|
|
|
+ public List<ObjectInfoDefine> insert(List<ObjectInfoDefine> voList) {
|
|
|
if(CollUtil.isEmpty(voList)) {
|
|
|
return null;
|
|
|
}
|
|
@@ -98,16 +98,16 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ObjectInfo> update(List<ObjectInfo> voList) {
|
|
|
+ public List<ObjectInfoDefine> update(List<ObjectInfoDefine> voList) {
|
|
|
if(CollUtil.isEmpty(voList)) {
|
|
|
return null;
|
|
|
}
|
|
|
validateOnSave(voList, true);
|
|
|
List<String> idList = CollUtil.getFieldValues(voList, BaseEntity.PROP_ID, String.class);
|
|
|
- List<ObjectInfo> dbList = dao.selectBatchIds(idList);
|
|
|
- Map<String, ObjectInfo> dbMap = CollectionUtil.fieldValueMap(dbList, BaseEntity.PROP_ID);
|
|
|
+ List<ObjectInfoDefine> dbList = dao.selectBatchIds(idList);
|
|
|
+ Map<String, ObjectInfoDefine> dbMap = CollectionUtil.fieldValueMap(dbList, BaseEntity.PROP_ID);
|
|
|
voList.forEach(vo -> {
|
|
|
- ObjectInfo dbVO = MapUtil.get(dbMap, vo.getId(), ObjectInfo.class);
|
|
|
+ ObjectInfoDefine dbVO = MapUtil.get(dbMap, vo.getId(), ObjectInfoDefine.class);
|
|
|
// 容错处理
|
|
|
if(dbVO == null) {
|
|
|
return;
|
|
@@ -128,10 +128,10 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
* @param voList
|
|
|
* @param isUpdate
|
|
|
*/
|
|
|
- private void validateOnSave(List<ObjectInfo> voList, boolean isUpdate) {
|
|
|
+ private void validateOnSave(List<ObjectInfoDefine> voList, boolean isUpdate) {
|
|
|
Set<String> codeSet = new HashSet<>();
|
|
|
List<String> idList = new ArrayList<>();
|
|
|
- for(ObjectInfo vo:voList) {
|
|
|
+ for(ObjectInfoDefine vo:voList) {
|
|
|
// 编码重复
|
|
|
if(!codeSet.add(vo.getCode())) {
|
|
|
throw new BusinessException(StrFormatter.format("存在重复编码{},不允许保存!", vo.getCode()));
|
|
@@ -144,15 +144,15 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
}
|
|
|
}
|
|
|
// 查询条件
|
|
|
- LambdaQueryWrapper<ObjectInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.select(ObjectInfo::getCode);
|
|
|
- queryWrapper.in(ObjectInfo::getValid, ValidEnum.TRUE.getType());
|
|
|
- queryWrapper.in(ObjectInfo::getCode, codeSet);
|
|
|
+ LambdaQueryWrapper<ObjectInfoDefine> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.select(ObjectInfoDefine::getCode);
|
|
|
+ queryWrapper.in(ObjectInfoDefine::getValid, ValidEnum.TRUE.getType());
|
|
|
+ queryWrapper.in(ObjectInfoDefine::getCode, codeSet);
|
|
|
if(isUpdate) {
|
|
|
- queryWrapper.notIn(ObjectInfo::getId, idList);
|
|
|
+ queryWrapper.notIn(ObjectInfoDefine::getId, idList);
|
|
|
}
|
|
|
// 查询重复的编码
|
|
|
- List<ObjectInfo> dbList = dao.selectList(queryWrapper);
|
|
|
+ List<ObjectInfoDefine> dbList = dao.selectList(queryWrapper);
|
|
|
if(CollUtil.isEmpty(dbList)) {
|
|
|
return;
|
|
|
}
|
|
@@ -165,10 +165,10 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
if(CollUtil.isEmpty(idList)) {
|
|
|
return;
|
|
|
}
|
|
|
- List<ObjectInfo> dbList = dao.selectBatchIds(idList);
|
|
|
- Map<String, ObjectInfo> dbMap = CollectionUtil.fieldValueMap(dbList, BaseEntity.PROP_ID);
|
|
|
+ List<ObjectInfoDefine> dbList = dao.selectBatchIds(idList);
|
|
|
+ Map<String, ObjectInfoDefine> dbMap = CollectionUtil.fieldValueMap(dbList, BaseEntity.PROP_ID);
|
|
|
idList.forEach(id -> {
|
|
|
- ObjectInfo dbVO = MapUtil.get(dbMap, id, ObjectInfo.class);
|
|
|
+ ObjectInfoDefine dbVO = MapUtil.get(dbMap, id, ObjectInfoDefine.class);
|
|
|
// 容错处理
|
|
|
if(dbVO == null) {
|
|
|
return;
|
|
@@ -176,7 +176,7 @@ public class ObjectInfoServiceImpl implements IObjectInfoService {
|
|
|
// 删除前消息 - 暂不提供同步消息
|
|
|
/// messageSender.sendMessage(DigitalMessageConstant.OPERATE_BEFORE_DELETE, null, dbVO, true);
|
|
|
// 删除
|
|
|
- ObjectInfo vo = new ObjectInfo();
|
|
|
+ ObjectInfoDefine vo = new ObjectInfoDefine();
|
|
|
vo.setId(id);
|
|
|
vo.setValid(ValidEnum.FALSE.getType());
|
|
|
dao.updateById(vo);
|