Commit 7e0891ad by liuyang

2024-10-10 文档入库领用返回ID

parent 3ce4fabb
......@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -56,6 +57,7 @@ public class ServiceHGBG001 extends ServiceEPBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HGBG001> hgbg001s = new ArrayList<>();
for (Map resultRow : resultRows) {
HGBG001 hpbg001 = new HGBG001();
hpbg001.fromMap(resultRow);
......@@ -64,7 +66,9 @@ public class ServiceHGBG001 extends ServiceEPBase {
} else {
this.modify(hpbg001);
}
hgbg001s.add(hpbg001);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(hgbg001s);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
......
......@@ -57,15 +57,8 @@ public class ServiceHGBG002 extends ServiceEPBase {
List<Long> ids = ObjectUtils.listEpKey(resultRows, HGBG002.FIELD_ID);
List<HGBG002A> hgbg002AList = HGBGTools.HgBg002a.getByParentId(ids);
for (HGBG002 hgbg002: resultRows) {
hgbg002.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgbg002.getId() == null || hgbg002.getId() == 0) {
continue;
}
List<HGBG002A> hgbg002As = hgbg002AList.stream().filter(hgbg002a1 -> hgbg002a1.getParentId().equals(hgbg002.getId())
&& hgbg002a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hgbg002As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HGBG002.DELETE, hgbg002);
hgbg002As = hgbg002AList.stream().filter(hgbg002a1 -> hgbg002a1.getParentId().equals(hgbg002.getId())).collect(Collectors.toList());
List<HGBG002A> hgbg002As = hgbg002AList.stream().filter(hgbg002a1 -> hgbg002a1.getParentId().equals(hgbg002.getId())).collect(Collectors.toList());
hgbg002As.forEach(hgbg002a -> DaoUtils.update(HGBG002A.DELETE, hgbg002a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ReviewStatusEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.bg.domain.HGBG001;
import com.baosight.hggp.hg.bg.domain.HGBG002;
import com.baosight.hggp.hg.bg.domain.HGBG002A;
import com.baosight.hggp.hg.bg.tools.HGBGTools;
......@@ -54,17 +53,14 @@ public class ServiceHGBG002A extends ServiceEPBase {
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = ObjectUtils.listKey(resultRows, HGBG002.FIELD_ID);
List<HGBG002A> resultRows = MapUtils.toDaoEPBases(inInfo, HGBG002A.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HGBG002A.FIELD_PARENT_ID);
if (Objects.nonNull(ids)) {
HGBG002 hgbg002 = HGBGTools.HgBg002.get(ids.get(0));
HGBG002 hgbg002 = HGBGTools.HgBg002.get(resultRows.get(0).getParentId());
AssertUtils.isTrue(hgbg002.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
}
for (Map resultRow: resultRows) {
HGBG002A hpbg002a = new HGBG002A();
hpbg002a.fromMap(resultRow);
hpbg002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
for (HGBG002A hpbg002a: resultRows) {
DaoUtils.update(HGBG002A.DELETE, hpbg002a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -55,14 +55,8 @@ public class ServiceHGBG003 extends ServiceEPBase {
List<HGBG003A> hpbg003AList = HGBGTools.HgBg003a.getByParentId(ids);
for (HGBG003 hpbg003: resultRows) {
hpbg003.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003.getId() == null || hpbg003.getId() == 0) {
continue;
}
List<HGBG003A> hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())
&& hpbg003a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hpbg003As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HGBG003.DELETE, hpbg003);
hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())).collect(Collectors.toList());
List<HGBG003A> hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())).collect(Collectors.toList());
hpbg003As.forEach(hpbg003a -> DaoUtils.update(HGBG003A.DELETE, hpbg003a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -54,17 +54,13 @@ public class ServiceHGBG003A extends ServiceEPBase {
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = ObjectUtils.listKey(resultRows, HGBG003.FIELD_ID);
List<HGBG003A> resultRows = MapUtils.toDaoEPBases(inInfo, HGBG003A.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HGBG003A.FIELD_PARENT_ID);
if (Objects.nonNull(ids)) {
HGBG003 hgbg003 = HGBGTools.HgBg003.get(ids.get(0));
HGBG003 hgbg003 = HGBGTools.HgBg003.get(resultRows.get(0).getParentId());
AssertUtils.isTrue(hgbg003.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
}
for (Map resultRow: resultRows) {
HGBG003A hpbg003a = new HGBG003A();
hpbg003a.fromMap(resultRow);
hpbg003a.setDeleteFlag(CommonConstant.YesNo.YES_1);
for (HGBG003A hpbg003a: resultRows) {
DaoUtils.update(HGBG003A.DELETE, hpbg003a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -15,6 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -59,6 +60,7 @@ public class ServiceHGBG004 extends ServiceEPBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HGBG004> hgbg004s = new ArrayList<>();
for (Map resultRow : resultRows) {
HGBG004 hpbg004 = new HGBG004();
hpbg004.fromMap(resultRow);
......@@ -67,7 +69,9 @@ public class ServiceHGBG004 extends ServiceEPBase {
} else {
this.modify(hpbg004);
}
hgbg004s.add(hpbg004);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(hgbg004s);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment