530 lines
18 KiB
Java
530 lines
18 KiB
Java
|
package nccloud.openapi.mmbd.routing;
|
|||
|
|
|||
|
import com.alibaba.fastjson.JSONObject;
|
|||
|
import java.util.ArrayList;
|
|||
|
import java.util.HashMap;
|
|||
|
import java.util.HashSet;
|
|||
|
import java.util.List;
|
|||
|
import java.util.Map;
|
|||
|
import java.util.Set;
|
|||
|
import javax.ws.rs.Consumes;
|
|||
|
import javax.ws.rs.POST;
|
|||
|
import javax.ws.rs.Path;
|
|||
|
import javax.ws.rs.Produces;
|
|||
|
|
|||
|
import nc.bs.framework.common.InvocationInfoProxy;
|
|||
|
import nc.bs.framework.common.NCLocator;
|
|||
|
import nc.itf.bd.rt.rt0008.IRtQuery;
|
|||
|
import nc.util.bd.bom.openapi.BillFieldsCodeToPkUtil;
|
|||
|
import nc.util.mmf.framework.base.MMValueCheck;
|
|||
|
import nc.util.mmf.framework.db.MMSqlBuilder;
|
|||
|
import nc.util.mmpub.dpub.base.ValueCheckUtil;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.AggRtVO;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.AssOrgVO;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.RtActivityVO;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.RtHeadVO;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.RtItemVO;
|
|||
|
import nc.vo.bd.rt.rt0008.entity.RtOpacVO;
|
|||
|
import nc.vo.pub.BusinessException;
|
|||
|
import nc.vo.pub.ISuperVO;
|
|||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|||
|
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
|||
|
import nccloud.api.mmbd.routing.IAPIRoutingBusinessService;
|
|||
|
import nccloud.api.rest.utils.ResultMessageUtil;
|
|||
|
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
|||
|
import org.json.JSONString;
|
|||
|
|
|||
|
@Path("mmbd/routing")
|
|||
|
public class RoutingResource extends AbstractNCCRestResource {
|
|||
|
private static String PD_RT = "pd_rt";
|
|||
|
|
|||
|
private static String PD_RT_B = "pd_rt_b";
|
|||
|
|
|||
|
private static String PD_RT_ASSORG = "pd_rt_assorg";
|
|||
|
|
|||
|
private static String AGG = "agg";
|
|||
|
|
|||
|
private static String MARKWORD = "markword";
|
|||
|
|
|||
|
private static String RTO = "pd_rt_opac";
|
|||
|
|
|||
|
private static String RTA = "pd_rt_activity";
|
|||
|
|
|||
|
private static String CRTID = "crtid";
|
|||
|
|
|||
|
public String getModule() {
|
|||
|
return "mmbd";
|
|||
|
}
|
|||
|
|
|||
|
@POST
|
|||
|
@Path("operation/save")
|
|||
|
@Consumes({ "application/json" })
|
|||
|
@Produces({ "application/json" })
|
|||
|
public JSONString saveRouting(JSONObject para) {
|
|||
|
List<Map<String, Object>> paramList = (List) para.get("data");
|
|||
|
AggRtVO[] retVos = null;
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT)) {
|
|||
|
return ResultMessageUtil.exceptionToJSON("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>Ϣ<EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ",
|
|||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
}
|
|||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
|||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
|||
|
String exception = markword.substring(0, markword.length() - 2);
|
|||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
|||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
|||
|
.lookup(IAPIRoutingBusinessService.class);
|
|||
|
try {
|
|||
|
retVos = service.save(aggVos);
|
|||
|
return ResultMessageUtil.toJSON(retVos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|||
|
} catch (BusinessException e) {
|
|||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
@POST
|
|||
|
@Path("save")
|
|||
|
@Consumes({ "application/json" })
|
|||
|
@Produces({ "application/json" })
|
|||
|
public JSONString saveRouting(List<Map<String, Object>> paramList) {
|
|||
|
AggRtVO[] retVos = null;
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT)) {
|
|||
|
return ResultMessageUtil.exceptionToJSON("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>Ϣ<EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ",
|
|||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
}
|
|||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
|||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
|||
|
String exception = markword.substring(0, markword.length() - 2);
|
|||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
|||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
|||
|
.lookup(IAPIRoutingBusinessService.class);
|
|||
|
try {
|
|||
|
retVos = service.save(aggVos);
|
|||
|
return ResultMessageUtil.toJSON(retVos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|||
|
} catch (BusinessException e) {
|
|||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
@POST
|
|||
|
@Path("operation/update")
|
|||
|
@Consumes({ "application/json" })
|
|||
|
@Produces({ "application/json" })
|
|||
|
public JSONString updateRouting(JSONObject para) {
|
|||
|
List<Map<String, Object>> paramList = (List) para.get("data");
|
|||
|
AggRtVO[] retVos = null;
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT_ASSORG)) {
|
|||
|
return ResultMessageUtil.exceptionToJSON("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>Ϣ<EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ",
|
|||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
}
|
|||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
|||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
|||
|
String exception = markword.substring(0, markword.length() - 2);
|
|||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
|||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
|||
|
.lookup(IAPIRoutingBusinessService.class);
|
|||
|
try {
|
|||
|
retVos = service.update(aggVos);
|
|||
|
return ResultMessageUtil.toJSON(retVos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD>");
|
|||
|
} catch (BusinessException e) {
|
|||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
@POST
|
|||
|
@Path("update")
|
|||
|
@Consumes({ "application/json" })
|
|||
|
@Produces({ "application/json" })
|
|||
|
public JSONString updateRouting(List<Map<String, Object>> paramList) {
|
|||
|
AggRtVO[] retVos = null;
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT_ASSORG)) {
|
|||
|
return ResultMessageUtil.exceptionToJSON("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>Ϣ<EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ",
|
|||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
}
|
|||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
|||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
|||
|
String exception = markword.substring(0, markword.length() - 2);
|
|||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
|||
|
}
|
|||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
|||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
|||
|
.lookup(IAPIRoutingBusinessService.class);
|
|||
|
try {
|
|||
|
retVos = service.update(aggVos);
|
|||
|
return ResultMessageUtil.toJSON(retVos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD>");
|
|||
|
} catch (BusinessException e) {
|
|||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
@POST
|
|||
|
@Path("query")
|
|||
|
@Consumes({ "application/json" })
|
|||
|
@Produces({ "application/json" })
|
|||
|
public JSONString queryRouting(Map<String, Object> paramMap) {
|
|||
|
AggRtVO[] retVos = null;
|
|||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
|||
|
.lookup(IAPIRoutingBusinessService.class);
|
|||
|
try {
|
|||
|
retVos = service.query(paramMap);
|
|||
|
RtHeadVO[] hvos = null;
|
|||
|
if (!ValueCheckUtil.isNullORZeroLength(retVos)) {
|
|||
|
hvos = getHVO(retVos);
|
|||
|
}
|
|||
|
String usercode = InvocationInfoProxy.getInstance().getUserCode();
|
|||
|
if ("plm".equals(usercode) || "gaoning".equals(usercode)) {
|
|||
|
return ResultMessageUtil.toJSONUnTranslate(retVos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>߲<EFBFBD>ѯ<EFBFBD>ɹ<EFBFBD>");
|
|||
|
}
|
|||
|
return ResultMessageUtil.toJSON(hvos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>߲<EFBFBD>ѯ<EFBFBD>ɹ<EFBFBD>");
|
|||
|
} catch (BusinessException e) {
|
|||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private RtHeadVO[] getHVO(AggRtVO[] vos) {
|
|||
|
RtHeadVO[] hvos = new RtHeadVO[vos.length];
|
|||
|
if (MMValueCheck.isNotEmpty(vos)) {
|
|||
|
for (int i = 0; i < hvos.length; i++) {
|
|||
|
hvos[i] = (RtHeadVO) vos[i].getParentVO();
|
|||
|
}
|
|||
|
}
|
|||
|
return hvos;
|
|||
|
}
|
|||
|
|
|||
|
private Map<String, Object> getAggRtVO(List<Map<String, Object>> paramList) {
|
|||
|
List<AggRtVO> aggVoList = new ArrayList<AggRtVO>();
|
|||
|
Map<String, AggRtVO> pkmap = new HashMap<String, AggRtVO>();
|
|||
|
List<String> pklist = new ArrayList<String>();
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
|
|||
|
Map<String, Object> head = (Map) map.get(PD_RT);
|
|||
|
if (MMValueCheck.isNotEmpty(head.get(CRTID))) {
|
|||
|
pklist.add((String) head.get(CRTID));
|
|||
|
}
|
|||
|
}
|
|||
|
String[] pks = (String[]) pklist.toArray(new String[0]);
|
|||
|
AggRtVO[] newaggvos = null;
|
|||
|
if (!ValueCheckUtil.isEmpty(pks)) {
|
|||
|
newaggvos = queryVOByIDs(pks);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(newaggvos)) {
|
|||
|
for (int i = 0; i < newaggvos.length; i++) {
|
|||
|
if (MMValueCheck.isNotEmpty(newaggvos[i].getPrimaryKey())) {
|
|||
|
pkmap.put(newaggvos[i].getPrimaryKey(), newaggvos[i]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
for (Map<String, Object> map : paramList) {
|
|||
|
|
|||
|
Map<String, Set<String>> tableid = new HashMap<String, Set<String>>();
|
|||
|
|
|||
|
Map<String, Object> idvo = new HashMap<String, Object>();
|
|||
|
AggRtVO aggvo = new AggRtVO();
|
|||
|
|
|||
|
Map<String, Object> head = (Map) map.get(PD_RT);
|
|||
|
|
|||
|
List<Map<String, Object>> body_b = (List) map.get(PD_RT_B);
|
|||
|
|
|||
|
List<Map<String, String>> body_s = (List) map.get(PD_RT_ASSORG);
|
|||
|
RtHeadVO hvo = new RtHeadVO();
|
|||
|
for (String headkey : head.keySet()) {
|
|||
|
hvo.setAttributeValue(headkey, head.get(headkey));
|
|||
|
}
|
|||
|
if (MMValueCheck.isEmpty(hvo.getPrimaryKey())) {
|
|||
|
hvo.setStatus(2);
|
|||
|
} else {
|
|||
|
hvo.setStatus(1);
|
|||
|
}
|
|||
|
aggvo.setParent(hvo);
|
|||
|
AggRtVO newRtvo = null;
|
|||
|
for (String pk : pkmap.keySet()) {
|
|||
|
if (pk.equals(hvo.getPrimaryKey())) {
|
|||
|
newRtvo = (AggRtVO) pkmap.get(pk);
|
|||
|
}
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(newRtvo)) {
|
|||
|
Set<String> sethvo = new HashSet<String>();
|
|||
|
RtHeadVO newhvo = (RtHeadVO) newRtvo.getParentVO();
|
|||
|
sethvo.add(newhvo.getPrimaryKey());
|
|||
|
tableid.put(PD_RT, sethvo);
|
|||
|
Set<String> setitemvo = new HashSet<String>();
|
|||
|
RtItemVO[] newitemvos = (RtItemVO[]) newRtvo.getChildren(RtItemVO.class);
|
|||
|
if (MMValueCheck.isNotEmpty(newitemvos)) {
|
|||
|
for (RtItemVO itemvo : newitemvos) {
|
|||
|
setitemvo.add(itemvo.getPrimaryKey());
|
|||
|
idvo.put(itemvo.getPrimaryKey(), itemvo);
|
|||
|
Set<String> setrtovo = new HashSet<String>();
|
|||
|
RtOpacVO[] newrtovos = itemvo.getRtopacitems();
|
|||
|
if (MMValueCheck.isNotEmpty(newrtovos)) {
|
|||
|
for (RtOpacVO newrtavo : newrtovos) {
|
|||
|
setrtovo.add(newrtavo.getPrimaryKey());
|
|||
|
idvo.put(newrtavo.getPrimaryKey(), newrtavo);
|
|||
|
}
|
|||
|
}
|
|||
|
tableid.put(RTO, setrtovo);
|
|||
|
Set<String> setrtavo = new HashSet<String>();
|
|||
|
RtActivityVO[] newrtavos = itemvo.getRtactitems();
|
|||
|
if (MMValueCheck.isNotEmpty(newrtavos)) {
|
|||
|
for (RtActivityVO newrtovo : newrtavos) {
|
|||
|
setrtavo.add(newrtovo.getPrimaryKey());
|
|||
|
idvo.put(newrtovo.getPrimaryKey(), newrtovo);
|
|||
|
}
|
|||
|
}
|
|||
|
tableid.put(RTA, setrtavo);
|
|||
|
}
|
|||
|
}
|
|||
|
tableid.put(PD_RT_B, setitemvo);
|
|||
|
AssOrgVO[] newassvos = (AssOrgVO[]) newRtvo.getChildren(AssOrgVO.class);
|
|||
|
Set<String> setassvo = new HashSet<String>();
|
|||
|
if (MMValueCheck.isNotEmpty(newassvos)) {
|
|||
|
for (AssOrgVO assvo : newassvos) {
|
|||
|
setassvo.add(assvo.getPrimaryKey());
|
|||
|
idvo.put(assvo.getPrimaryKey(), assvo);
|
|||
|
}
|
|||
|
}
|
|||
|
tableid.put(PD_RT_ASSORG, setassvo);
|
|||
|
}
|
|||
|
|
|||
|
List<RtItemVO> rtItemVoList = new ArrayList<RtItemVO>();
|
|||
|
Set<String> body_b_set = (Set) tableid.get(PD_RT_B);
|
|||
|
if (MMValueCheck.isNotEmpty(body_b)) {
|
|||
|
for (Map<String, Object> body_b_map : body_b) {
|
|||
|
RtItemVO itemVo = new RtItemVO();
|
|||
|
for (String body_b_key : body_b_map.keySet()) {
|
|||
|
itemVo.setAttributeValue(body_b_key, body_b_map.get(body_b_key));
|
|||
|
if (RTO.equals(body_b_key)) {
|
|||
|
List<RtOpacVO> rtoVoList = new ArrayList<RtOpacVO>();
|
|||
|
|
|||
|
List<Map<String, Object>> rto = (List) body_b_map.get(body_b_key);
|
|||
|
Set<String> rto_set = (Set) tableid.get(RTO);
|
|||
|
if (MMValueCheck.isNotEmpty(rto)) {
|
|||
|
for (Map<String, Object> rtomap : rto) {
|
|||
|
RtOpacVO rtoVo = new RtOpacVO();
|
|||
|
if (MMValueCheck.isNotEmpty(rtomap)) {
|
|||
|
for (String rtomapkey : rtomap.keySet()) {
|
|||
|
rtoVo.setAttributeValue(rtomapkey, rtomap.get(rtomapkey));
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rtoVo.getPrimaryKey())) {
|
|||
|
rtoVo.setStatus(1);
|
|||
|
} else {
|
|||
|
rtoVo.setStatus(2);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rtoVo.getPrimaryKey())) {
|
|||
|
rto_set.remove(rtoVo.getPrimaryKey());
|
|||
|
}
|
|||
|
rtoVoList.add(rtoVo);
|
|||
|
}
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rto_set)) {
|
|||
|
for (String rto_set_pk : rto_set) {
|
|||
|
RtOpacVO setrtovo = (RtOpacVO) idvo.get(rto_set_pk);
|
|||
|
setrtovo.setStatus(3);
|
|||
|
rtoVoList.add(setrtovo);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
} else if (MMValueCheck.isNotEmpty(rto_set)) {
|
|||
|
for (String rto_set_pk : rto_set) {
|
|||
|
RtOpacVO setrtovo = (RtOpacVO) idvo.get(rto_set_pk);
|
|||
|
setrtovo.setStatus(3);
|
|||
|
rtoVoList.add(setrtovo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
itemVo.setRtopacitems((RtOpacVO[]) rtoVoList.toArray(new RtOpacVO[0]));
|
|||
|
}
|
|||
|
if (RTA.equals(body_b_key)) {
|
|||
|
List<RtActivityVO> rtaVoList = new ArrayList<RtActivityVO>();
|
|||
|
|
|||
|
List<Map<String, Object>> rta = (List) body_b_map.get(body_b_key);
|
|||
|
Set<String> rta_set = (Set) tableid.get(RTA);
|
|||
|
if (MMValueCheck.isNotEmpty(rta)) {
|
|||
|
for (Map<String, Object> rtamap : rta) {
|
|||
|
RtActivityVO rtoVa = new RtActivityVO();
|
|||
|
for (String rtomapkey : rtamap.keySet()) {
|
|||
|
rtoVa.setAttributeValue(rtomapkey, rtamap.get(rtomapkey));
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rtoVa.getPrimaryKey())) {
|
|||
|
rtoVa.setStatus(1);
|
|||
|
} else {
|
|||
|
rtoVa.setStatus(2);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rtoVa.getPrimaryKey())) {
|
|||
|
rta_set.remove(rtoVa.getPrimaryKey());
|
|||
|
}
|
|||
|
rtaVoList.add(rtoVa);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(rta_set)) {
|
|||
|
for (String rta_set_pk : rta_set) {
|
|||
|
RtActivityVO setrtavo = (RtActivityVO) idvo.get(rta_set_pk);
|
|||
|
setrtavo.setStatus(3);
|
|||
|
rtaVoList.add(setrtavo);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
} else if (MMValueCheck.isNotEmpty(rta_set)) {
|
|||
|
for (String rta_set_pk : rta_set) {
|
|||
|
RtActivityVO setrtavo = (RtActivityVO) idvo.get(rta_set_pk);
|
|||
|
setrtavo.setStatus(3);
|
|||
|
rtaVoList.add(setrtavo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
itemVo.setRtactitems((RtActivityVO[]) rtaVoList.toArray(new RtActivityVO[0]));
|
|||
|
}
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(itemVo.getPrimaryKey())) {
|
|||
|
itemVo.setStatus(1);
|
|||
|
} else {
|
|||
|
itemVo.setStatus(2);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(itemVo.getPrimaryKey())) {
|
|||
|
body_b_set.remove(itemVo.getPrimaryKey());
|
|||
|
}
|
|||
|
rtItemVoList.add(itemVo);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(body_b_set)) {
|
|||
|
for (String body_b_setpk : body_b_set) {
|
|||
|
RtItemVO setitemVo = (RtItemVO) idvo.get(body_b_setpk);
|
|||
|
setitemVo.setStatus(3);
|
|||
|
rtItemVoList.add(setitemVo);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
} else if (MMValueCheck.isNotEmpty(body_b_set)) {
|
|||
|
for (String body_b_setpk : body_b_set) {
|
|||
|
RtItemVO setitemVo = (RtItemVO) idvo.get(body_b_setpk);
|
|||
|
setitemVo.setStatus(3);
|
|||
|
rtItemVoList.add(setitemVo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
aggvo.setChildren(RtItemVO.class, (ISuperVO[]) rtItemVoList.toArray(new RtItemVO[0]));
|
|||
|
|
|||
|
List<AssOrgVO> assOrgVoList = new ArrayList<AssOrgVO>();
|
|||
|
Set<String> body_s_set = (Set) tableid.get(PD_RT_ASSORG);
|
|||
|
if (MMValueCheck.isNotEmpty(body_s)) {
|
|||
|
for (Map<String, String> body_s_map : body_s) {
|
|||
|
AssOrgVO orgVo = new AssOrgVO();
|
|||
|
for (String body_s_key : body_s_map.keySet()) {
|
|||
|
orgVo.setAttributeValue(body_s_key, body_s_map.get(body_s_key));
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(orgVo.getPrimaryKey())) {
|
|||
|
orgVo.setStatus(1);
|
|||
|
} else {
|
|||
|
orgVo.setStatus(2);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(orgVo.getPrimaryKey())) {
|
|||
|
body_s_set.remove(orgVo.getPrimaryKey());
|
|||
|
}
|
|||
|
assOrgVoList.add(orgVo);
|
|||
|
}
|
|||
|
if (MMValueCheck.isNotEmpty(body_s_set)) {
|
|||
|
for (String body_s_setpk : body_s_set) {
|
|||
|
AssOrgVO setorgVo = (AssOrgVO) idvo.get(body_s_setpk);
|
|||
|
setorgVo.setStatus(3);
|
|||
|
assOrgVoList.add(setorgVo);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
} else if (MMValueCheck.isNotEmpty(body_s_set)) {
|
|||
|
for (String body_s_setpk : body_s_set) {
|
|||
|
AssOrgVO setorgVo = (AssOrgVO) idvo.get(body_s_setpk);
|
|||
|
setorgVo.setStatus(3);
|
|||
|
assOrgVoList.add(setorgVo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
aggvo.setChildren(AssOrgVO.class, (ISuperVO[]) assOrgVoList.toArray(new AssOrgVO[0]));
|
|||
|
aggVoList.add(aggvo);
|
|||
|
}
|
|||
|
AggRtVO[] aggVos = (AggRtVO[]) aggVoList.toArray(new AggRtVO[0]);
|
|||
|
RtHeadVO[] hvos = new RtHeadVO[aggVos.length];
|
|||
|
String markword = null;
|
|||
|
for (int i = 0; i < aggVos.length; i++) {
|
|||
|
hvos[i] = (RtHeadVO) aggVos[i].getParent();
|
|||
|
RtItemVO[] itemvos = (RtItemVO[]) aggVos[i].getChildren(RtItemVO.class);
|
|||
|
String exceptionMessage = getHeadInputField(hvos) + getHeadInputField(hvos);
|
|||
|
if (MMValueCheck.isNotEmpty(exceptionMessage)) {
|
|||
|
markword = "<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD>," + exceptionMessage;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVos);
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
map.put(AGG, aggVos);
|
|||
|
map.put(MARKWORD, markword);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
private String getHeadInputField(RtHeadVO[] hvos) {
|
|||
|
String retstr = "";
|
|||
|
for (RtHeadVO hvo : hvos) {
|
|||
|
if (hvo.getPk_org() == null || MMValueCheck.isEmpty(hvo.getPk_org())) {
|
|||
|
retstr = retstr + "pk_org,";
|
|||
|
}
|
|||
|
if (hvo.getCmaterialid() == null || MMValueCheck.isEmpty(hvo.getCmaterialid())) {
|
|||
|
retstr = retstr + "cmaterialid,";
|
|||
|
}
|
|||
|
if (hvo.getNastnum() == null || MMValueCheck.isEmpty(hvo.getNastnum())) {
|
|||
|
retstr = retstr + "nastnum,";
|
|||
|
}
|
|||
|
if (hvo.getVersion() == null || MMValueCheck.isEmpty(hvo.getVersion())) {
|
|||
|
retstr = retstr + "version,";
|
|||
|
}
|
|||
|
if (hvo.getFversiontype() == null || MMValueCheck.isEmpty(hvo.getFversiontype())) {
|
|||
|
retstr = retstr + "fversiontype,";
|
|||
|
}
|
|||
|
}
|
|||
|
return retstr;
|
|||
|
}
|
|||
|
|
|||
|
private String getBodyInputField(RtItemVO[] bvos) {
|
|||
|
String retstr = "";
|
|||
|
for (RtItemVO bvo : bvos) {
|
|||
|
if (bvo.getVprocessno() == null || MMValueCheck.isEmpty(bvo.getVprocessno())) {
|
|||
|
retstr = retstr + "vprocessno,";
|
|||
|
}
|
|||
|
if (bvo.getProcessmovetype() == null || MMValueCheck.isEmpty(bvo.getProcessmovetype())) {
|
|||
|
retstr = retstr + "processmovetype,";
|
|||
|
}
|
|||
|
if (bvo.getDeffectdate() == null || MMValueCheck.isEmpty(bvo.getDeffectdate())) {
|
|||
|
retstr = retstr + "deffectdate,";
|
|||
|
}
|
|||
|
if (bvo.getDinvaliddate() == null || MMValueCheck.isEmpty(bvo.getDinvaliddate())) {
|
|||
|
retstr = retstr + "dinvaliddate,";
|
|||
|
}
|
|||
|
if (bvo.getBmainprocess() == null || MMValueCheck.isEmpty(bvo.getBmainprocess())) {
|
|||
|
retstr = retstr + "bmainprocess,";
|
|||
|
}
|
|||
|
}
|
|||
|
return retstr;
|
|||
|
}
|
|||
|
|
|||
|
private AggRtVO[] queryVOByIDs(String[] pks) {
|
|||
|
AggRtVO[] aggvos = null;
|
|||
|
IRtQuery rtquery = (IRtQuery) NCLocator.getInstance().lookup(IRtQuery.class);
|
|||
|
MMSqlBuilder sql = new MMSqlBuilder();
|
|||
|
sql.append(" crtid ", pks);
|
|||
|
try {
|
|||
|
aggvos = rtquery.queryRtByWhereSql(sql.toString());
|
|||
|
} catch (BusinessException e) {
|
|||
|
ExceptionUtils.wrappException(e);
|
|||
|
}
|
|||
|
return aggvos;
|
|||
|
}
|
|||
|
}
|