|
@@ -0,0 +1,423 @@
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+package nc.impl.fip.relation;
|
|
|
+
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+import nc.bs.dao.BaseDAO;
|
|
|
+import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
+import nc.bs.framework.common.NCLocator;
|
|
|
+import nc.bs.logging.Logger;
|
|
|
+import nc.bs.uap.lock.PKLock;
|
|
|
+import nc.impl.fip.messagelogs.FipMessageLogsProxy;
|
|
|
+import nc.impl.fip.pub.tools.FipBSTemplateCleaner;
|
|
|
+import nc.itf.fip.cache.memcache.FipConfigCache;
|
|
|
+import nc.itf.fip.cache.memcache.TemplateCache;
|
|
|
+import nc.itf.fip.pub.FipInterfaceCenter;
|
|
|
+import nc.itf.gl.voucher.IVoucher;
|
|
|
+import nc.itf.uap.busibean.SysinitAccessor;
|
|
|
+import nc.pub.fip.pubtools.SagasUtil;
|
|
|
+import nc.pubitf.fip.external.IDesBillService;
|
|
|
+import nc.pubitf.fip.service.IFipInterfaceCenterService;
|
|
|
+import nc.pubitf.ra.respvoucher.IFipDeleteCheck;
|
|
|
+import nc.vo.arap.pay.bzfk.InvoiceVo;
|
|
|
+import nc.vo.fip.config.ConfigVO;
|
|
|
+import nc.vo.fip.messagelogs.MessageLogVO;
|
|
|
+import nc.vo.fip.messagelogs.MessageTool;
|
|
|
+import nc.vo.fip.operatinglogs.OperatingFlagEmu;
|
|
|
+import nc.vo.fip.operatinglogs.OperatingLogVO;
|
|
|
+import nc.vo.fip.operatinglogs.OperatinglogSceneEnum;
|
|
|
+import nc.vo.fip.pub.FipBillState;
|
|
|
+import nc.vo.fip.pub.SqlTools;
|
|
|
+import nc.vo.fip.relation.FipRelationVO;
|
|
|
+import nc.vo.fip.service.FipBasicRelationVO;
|
|
|
+import nc.vo.fip.service.FipRelationInfoVO;
|
|
|
+import nc.vo.fip.transtemplate.DesBillModeEmu;
|
|
|
+import nc.vo.fip.transtemplate.TransTemplateVO;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.lang.UFBoolean;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+
|
|
|
+import com.yonyou.cloud.ncc.NCCEnv;
|
|
|
+import com.yonyou.cloud.ncc.NCCSagas;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * TODO 接口/类功能说明,使用说明(接口是否为服务组件,服务使用者,类是否线程安全等)。
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * 修改记录:<br>
|
|
|
+ * <li>修改人:修改日期:修改内容:</li> <br>
|
|
|
+ * <br>
|
|
|
+ *
|
|
|
+ * @see
|
|
|
+ * @author gbh
|
|
|
+ * @version V6.0
|
|
|
+ * @since V6.0 创建时间:2010-7-9 下午03:48:17
|
|
|
+ */
|
|
|
+public class FipRelationBO {
|
|
|
+ /*
|
|
|
+ * queryByWhere方法在FipOperatingLogProxy中的实现
|
|
|
+ *
|
|
|
+ * @see nc.itf.fip.opreatinglog.IOperatingLog#queryByWhere(java.lang.String)
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public FipRelationVO[] queryByWhere(String wherepart) throws BusinessException {
|
|
|
+ if (wherepart == null)
|
|
|
+ return null;
|
|
|
+ FipRelationVO[] rs = null;
|
|
|
+ BaseDAO baseDAO = new BaseDAO();
|
|
|
+ // wherepart = SQL_Translator.getSQL(baseDAO.getDBType(), wherepart);
|
|
|
+ Collection c = baseDAO.retrieveByClause(FipRelationVO.class, wherepart);
|
|
|
+ if (c != null && c.size() > 0) {
|
|
|
+ rs = new FipRelationVO[c.size()];
|
|
|
+ c.toArray(rs);
|
|
|
+ }
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * insert方法在FipOperatingLogProxy中的实现
|
|
|
+ *
|
|
|
+ * @see nc.itf.fip.opreatinglog.IOperatingLog#insert(nc.vo.fip.operatinglogs.OperatingLogVO[])
|
|
|
+ */
|
|
|
+ public List<FipRelationVO> insert(List<FipRelationVO> vos) throws BusinessException {
|
|
|
+ if (vos != null) {
|
|
|
+ PKLock instance = PKLock.getInstance();
|
|
|
+ for (FipRelationVO fipRelationVO : vos) {
|
|
|
+ boolean addDynamicLock = instance.addDynamicLock(fipRelationVO.getSrc_billtype() + fipRelationVO.getSrc_relationid() + fipRelationVO.getDes_billtype() + fipRelationVO.getDes_org());
|
|
|
+ if (!addDynamicLock) {
|
|
|
+ throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1017prv_0", "01017prv-2-0003"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] pks = new BaseDAO().insertVOList(vos);
|
|
|
+ for (int i = 0; i < vos.size(); i++) {
|
|
|
+ vos.get(i).setPk_relation(pks[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法说明:
|
|
|
+ * <p>
|
|
|
+ * 修改记录:
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @param vos
|
|
|
+ * @throws BusinessException
|
|
|
+ * @see
|
|
|
+ * @since V6.0
|
|
|
+ */
|
|
|
+ public void deleteReal(FipRelationVO[] vos) throws BusinessException {
|
|
|
+ if (vos != null && vos.length > 0) {
|
|
|
+ // 需要清理缓存,否则该操作可能会影响下一次发送会计平台的数据,如果在该期间模板有过修改
|
|
|
+ FipBSTemplateCleaner.clear();
|
|
|
+ ArrayList<String> pklist = new ArrayList<String>();
|
|
|
+ for (int i = 0; i < vos.length; i++) {
|
|
|
+ pklist.add(vos[i].getPk_relation());
|
|
|
+ }
|
|
|
+ //modify by liubao 2019-07-19 删除凭证效率优化 BEGIN
|
|
|
+ UFBoolean[] bCreatedTempTable = new UFBoolean[1];
|
|
|
+ String strSql = SqlTools.getInStr("pk_relation", pklist, true, bCreatedTempTable);
|
|
|
+ if (bCreatedTempTable[0].booleanValue() == false) {
|
|
|
+ strSql = " des_relationid in (select des_relationid from " + FipRelationVO.getDefaultTableName() + " where " + strSql + " ) ";
|
|
|
+ } else {
|
|
|
+ strSql = " des_relationid in (select des_relationid from " + FipRelationVO.getDefaultTableName() + "," + strSql + " where " + FipRelationVO.getDefaultTableName() + ".pk_relation=" + strSql + ".pk )";
|
|
|
+ }
|
|
|
+ FipRelationVO[] relations = queryByWhere(strSql);
|
|
|
+ //FipRelationVO[] relations = queryByWhere(" " + FipRelationVO.DES_RELATIONID + " in (select " + FipRelationVO.DES_RELATIONID + " from " + FipRelationVO.getDefaultTableName() + " where " + SqlTools.getInStr(FipRelationVO.PK_RELATION, pklist, true) + ") ");
|
|
|
+ //modify by liubao 2019-07-19 删除凭证效率优化 END
|
|
|
+ loggerMessage(relations, "del relation by message");
|
|
|
+ String pk_group = null;
|
|
|
+ HashMap<String, List<FipRelationInfoVO>> dellistmap = new HashMap<String, List<FipRelationInfoVO>>();
|
|
|
+ if (relations != null) {
|
|
|
+ HashMap<String, String> sameleach = new HashMap<String, String>();
|
|
|
+ for (int i = 0; i < relations.length; i++) {
|
|
|
+ FipRelationVO fipRelationVO = relations[i];
|
|
|
+ if (sameleach.get(fipRelationVO.getDes_relationid()) != null)
|
|
|
+ continue;
|
|
|
+ if (pk_group == null)
|
|
|
+ pk_group = fipRelationVO.getDes_group();
|
|
|
+ List<FipRelationInfoVO> list = dellistmap.get(fipRelationVO.getDes_billtype());
|
|
|
+ if (list == null) {
|
|
|
+ list = new ArrayList<FipRelationInfoVO>();
|
|
|
+ dellistmap.put(fipRelationVO.getDes_billtype(), list);
|
|
|
+ }
|
|
|
+ list.add(FipBasicRelationVO.convertFromRelationVO(fipRelationVO).getDesRelation());
|
|
|
+ sameleach.put(fipRelationVO.getDes_relationid(), fipRelationVO.getDes_relationid());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String paraString = SysinitAccessor.getInstance().getParaString(pk_group, "FIP002");
|
|
|
+ boolean isautodel = paraString == null ? true : UFBoolean.valueOf(paraString).booleanValue();// 自动生成的正式单据反生效自动删除
|
|
|
+ if (isautodel) {
|
|
|
+ for (FipRelationVO fipRelationVO : relations) {
|
|
|
+ TransTemplateVO cacheData = TemplateCache.getCacheData(pk_group, fipRelationVO.getDes_org(), fipRelationVO.getSrc_billtype(), fipRelationVO.getDes_billtype(), fipRelationVO.getSrc_defdoc1(), fipRelationVO.getSrc_defdoc2(), fipRelationVO.getSrc_defdoc3());
|
|
|
+ if (cacheData != null) {
|
|
|
+ if (cacheData.getDesbillmode() != DesBillModeEmu.MODE_confirmed_bill)
|
|
|
+ throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1017prv_0", "01017prv-0037")/* @res "目标单据已经生效为正式单据,请先到会计平台删除目标单据。" */);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1017prv_0", "01017prv-0037")/* @res "目标单据已经生效为正式单据,请先到会计平台删除目标单据。" */);
|
|
|
+ }
|
|
|
+ BaseDAO baseDAO = new BaseDAO();
|
|
|
+ baseDAO.deleteVOArray(relations);
|
|
|
+ for (Iterator iterator = dellistmap.keySet().iterator(); iterator.hasNext();) {
|
|
|
+ String billtype = (String) iterator.next();
|
|
|
+ IDesBillService itf = FipInterfaceCenter.getDesBillService(pk_group, billtype);
|
|
|
+ if (itf == null)
|
|
|
+ throw new BusinessException(FipInterfaceCenter.getNoInterfaceFoundMessage(billtype, "IDesBillService"));
|
|
|
+ itf.deleteBill(dellistmap.get(billtype));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法说明:
|
|
|
+ * <p>
|
|
|
+ * 修改记录:
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @param vos
|
|
|
+ * @throws BusinessException
|
|
|
+ * @see
|
|
|
+ * @since V6.0
|
|
|
+ */
|
|
|
+ public void delete(FipRelationVO[] vos) throws BusinessException {
|
|
|
+ if (vos != null && vos.length > 0) {
|
|
|
+ //全局批次号,前端一次后台生成操作的所有数据都用这个批次号
|
|
|
+ String global_batchno = null;
|
|
|
+ if (!NCCEnv.isMerged()) {
|
|
|
+ String batchno = vos[0].getBatchno();
|
|
|
+ if (StringUtils.isNotBlank(batchno)) {
|
|
|
+ String[] noArr = batchno.split("-");
|
|
|
+ if (noArr != null && noArr.length > 0) {
|
|
|
+ if (noArr.length > 1) {
|
|
|
+ global_batchno = noArr[0];
|
|
|
+ vos[0].setBatchno(noArr[1]);
|
|
|
+ } else {
|
|
|
+ global_batchno = noArr[0];
|
|
|
+ vos[0].setBatchno(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //凭证删除传递影像 xuy 2021-09-01 start
|
|
|
+ CredentialsWrite creden=new CredentialsWrite();
|
|
|
+ List<InvoiceVo> Invoicevos=creden.getInvoiceVos(vos);
|
|
|
+ //凭证删除传递影像 xuy 2021-09-01 end
|
|
|
+ //正式凭证消息主键
|
|
|
+ ArrayList<String> pklist = new ArrayList<String>();
|
|
|
+ for (int i = 0; i < vos.length; i++) {
|
|
|
+ pklist.add(vos[i].getPk_relation());
|
|
|
+ }
|
|
|
+ //modify by liubao 2019-07-19 删除凭证效率优化 BEGIN
|
|
|
+ UFBoolean[] bCreatedTempTable = new UFBoolean[1];
|
|
|
+ String strSql = SqlTools.getInStr("pk_relation", pklist, true, bCreatedTempTable);
|
|
|
+ if (bCreatedTempTable[0].booleanValue() == false){
|
|
|
+ strSql=" des_relationid in (select des_relationid from " + FipRelationVO.getDefaultTableName() + " where " + strSql + " ) ";
|
|
|
+ }else{
|
|
|
+ strSql=" des_relationid in (select des_relationid from " + FipRelationVO.getDefaultTableName() + "," + strSql + " where " + FipRelationVO.getDefaultTableName() + ".pk_relation = " + strSql + ".pk )";
|
|
|
+ }
|
|
|
+ FipRelationVO[] relations = queryByWhere(strSql);
|
|
|
+ //FipRelationVO[] relations = queryByWhere(" " + FipRelationVO.DES_RELATIONID + " in (select " + FipRelationVO.DES_RELATIONID + " from " + FipRelationVO.getDefaultTableName() + " where " + SqlTools.getInStr(FipRelationVO.PK_RELATION, pklist, true) + ") ");
|
|
|
+ //modify by liubao 2019-07-19 删除凭证效率优化 END
|
|
|
+
|
|
|
+ String pk_group = null;
|
|
|
+ HashMap<String, List<FipRelationInfoVO>> dellistmap = new HashMap<String, List<FipRelationInfoVO>>();
|
|
|
+ HashMap<String, List<FipRelationVO>> relationMap = new HashMap<String, List<FipRelationVO>>();
|
|
|
+ HashMap<String, List<String>> pkMap = new HashMap<String, List<String>>();//目标单据PK
|
|
|
+ //删除错误中心消息批次号集合
|
|
|
+ Set<String> batchnos = new HashSet<String>();
|
|
|
+ if (relations != null && relations.length > 0) {
|
|
|
+ //这里校验是否是微服务部署,与整体部署逻辑区分开
|
|
|
+ boolean isMerged = NCCEnv.isMerged();
|
|
|
+ if(!isMerged){
|
|
|
+ //对要删除的数据加锁
|
|
|
+ SagasUtil.addDynamicLock(relations);
|
|
|
+ //校验ts
|
|
|
+ SagasUtil.checkBillsTs(relations);
|
|
|
+// //初始化redis中的计数为0,删除分批,每执行完一批,就向redis里面存一批数据,计数也会自增1,等到计数和分批数相等,则认为当前操作完成
|
|
|
+// SagasUtil.processInitCount(global_batchno, FipRedisKeyConst.DELBILL_KEY2);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ HashMap<String, String> sameleach = new HashMap<String, String>();
|
|
|
+ for (int i = 0; i < relations.length; i++) {
|
|
|
+ FipRelationVO fipRelationVO = relations[i];
|
|
|
+ if (StringUtils.isNotBlank(fipRelationVO.getBatchno())) {
|
|
|
+ batchnos.add(fipRelationVO.getBatchno());
|
|
|
+ }
|
|
|
+ if (sameleach.get(fipRelationVO.getDes_relationid()) != null)
|
|
|
+ continue;
|
|
|
+ if (pk_group == null)
|
|
|
+ pk_group = fipRelationVO.getDes_group();
|
|
|
+ List<FipRelationInfoVO> list = dellistmap.get(fipRelationVO.getDes_billtype());
|
|
|
+ List<FipRelationVO> relationList = relationMap.get(fipRelationVO.getDes_billtype());
|
|
|
+ List<String> pkList = pkMap.get(fipRelationVO.getDes_billtype());
|
|
|
+ if (list == null) {
|
|
|
+ list = new ArrayList<FipRelationInfoVO>();
|
|
|
+ dellistmap.put(fipRelationVO.getDes_billtype(), list);
|
|
|
+ }
|
|
|
+ if (relationList == null) {
|
|
|
+ relationList = new ArrayList<FipRelationVO>();
|
|
|
+ relationMap.put(fipRelationVO.getDes_billtype(), relationList);
|
|
|
+ }
|
|
|
+ if (pkList == null) {
|
|
|
+ pkList = new ArrayList<String>();
|
|
|
+ pkMap.put(fipRelationVO.getDes_billtype(), pkList);
|
|
|
+ }
|
|
|
+
|
|
|
+ list.add(FipBasicRelationVO.convertFromRelationVO(fipRelationVO).getDesRelation());
|
|
|
+ relationList.add(fipRelationVO);
|
|
|
+ pkList.add(fipRelationVO.getDes_relationid());
|
|
|
+ sameleach.put(fipRelationVO.getDes_relationid(), fipRelationVO.getDes_relationid());
|
|
|
+ }
|
|
|
+ //删除错误中心消息
|
|
|
+ if (batchnos.size() > 0) {
|
|
|
+ SagasUtil.deleteErrMsg(batchnos.toArray(new String[0]));
|
|
|
+ }
|
|
|
+ if(isMerged){
|
|
|
+ //记录删除消息
|
|
|
+ loggerMessage(relations, "del relation by user");
|
|
|
+ BaseDAO baseDAO = new BaseDAO();
|
|
|
+ baseDAO.deleteVOArray(relations);
|
|
|
+ List<OperatingLogVO> opvolist = new ArrayList<OperatingLogVO>();
|
|
|
+ List<String> relationList = new ArrayList<String>();
|
|
|
+ for (FipRelationVO vo : relations) {
|
|
|
+ relationList.add(vo.getSrc_relationid());
|
|
|
+ // 拉式生成的单据删除时不保留日志
|
|
|
+ ConfigVO cfgvos = FipConfigCache.getCacheData(vo.getSrc_group(), vo.getSrc_billtype(), vo.getDes_billtype(), false);
|
|
|
+ if (cfgvos != null && 1 != cfgvos.getGeneratemode()) {
|
|
|
+ OperatingLogVO tvo = FipBasicRelationVO.convertFromRelationVO(vo).convertToOperatingLogVO();
|
|
|
+ tvo.setPk_operatinglog(null);
|
|
|
+ tvo.setOperateflag(OperatingFlagEmu.FLAG_no_process);
|
|
|
+ tvo.setDes_relationid(null);
|
|
|
+ opvolist.add(tvo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!opvolist.isEmpty())
|
|
|
+ baseDAO.insertVOList(opvolist);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按目标单据类型删除对应的目标单据
|
|
|
+ Set<Entry<String, List<FipRelationInfoVO>>> entrySet = dellistmap.entrySet();
|
|
|
+ if (!entrySet.isEmpty()) {
|
|
|
+ for (Entry<String, List<FipRelationInfoVO>> entry : entrySet) {
|
|
|
+ String billtype = entry.getKey();
|
|
|
+ if(!isMerged){
|
|
|
+ //获取下游服务接口
|
|
|
+ IFipInterfaceCenterService destService = SagasUtil.getFipInterfaceCenterService(billtype);
|
|
|
+ Map<String,Serializable> params = new HashMap<String,Serializable>();
|
|
|
+ params.put("pk_group", pk_group);
|
|
|
+ params.put("billtype", billtype);
|
|
|
+ List<FipRelationInfoVO> value = entry.getValue();
|
|
|
+ //获取当前目标单据类型对应的的消息集合
|
|
|
+ List<FipRelationVO> relationVOs = relationMap.get(billtype);
|
|
|
+ if(relationVOs != null && relationVOs.size() > 0){
|
|
|
+ params.put("data",relationVOs.toArray(new FipRelationVO[0]));
|
|
|
+ params.put("billState", FipBillState.State_RealDes);
|
|
|
+ }
|
|
|
+ if (pklist != null && pklist.size() > 0) {
|
|
|
+ params.put("pks", pklist.toArray(new String[0]));
|
|
|
+ params.put("batchno", global_batchno);
|
|
|
+ params.put("size", dellistmap.size());
|
|
|
+ params.put("scene", OperatinglogSceneEnum.DELETEREAL);
|
|
|
+ }
|
|
|
+ //开启新事务
|
|
|
+ NCCSagas.startNewSaga();
|
|
|
+ //校验提前
|
|
|
+ //获取校验提前的目标单据PK
|
|
|
+ List<String> pks = pkMap.get(billtype);
|
|
|
+ if("C0".equalsIgnoreCase(billtype)){
|
|
|
+ NCLocator.getInstance().lookup(IVoucher.class).checkDeleteVouchersSagasCheck(pks.toArray(new String[0]));
|
|
|
+ } else if ("RA00".equalsIgnoreCase(billtype)){
|
|
|
+ NCLocator.getInstance().lookup(IFipDeleteCheck.class).beforeDeleteCheck(pks.toArray(new String[0]));
|
|
|
+ }
|
|
|
+ //删除目标单据
|
|
|
+ destService.deleteBill(params, value);
|
|
|
+// //注册删除正式凭证消息接口
|
|
|
+// SagasUtil.confirm(OperatinglogSceneEnum.DELETEREAL, params);
|
|
|
+ }else{
|
|
|
+ IDesBillService itf = FipInterfaceCenter.getDesBillService(pk_group, billtype);
|
|
|
+ if (itf == null)
|
|
|
+ throw new BusinessException(FipInterfaceCenter.getNoInterfaceFoundMessage(billtype, "IDesBillService"));
|
|
|
+ itf.deleteBill(dellistmap.get(billtype));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ Logger.error(e.getMessage(), e);
|
|
|
+// SagasUtil.removeRedisData(global_batchno, FipRedisKeyConst.DELBILL_KEY2);
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //凭证删除传递影像 xuy 2021-09-01 start
|
|
|
+ creden.write(Invoicevos);
|
|
|
+ //凭证删除传递影像 xuy 2021-09-01 end
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int deleteByWhere(String wherepart, UFBoolean includebill) throws BusinessException {
|
|
|
+ int executeUpdate = 0;
|
|
|
+ FipRelationVO[] relations = queryByWhere(wherepart);
|
|
|
+ if (relations != null) {
|
|
|
+ loggerMessage(relations, "del relation by offset b=" + includebill);
|
|
|
+ if (relations != null)
|
|
|
+ executeUpdate = relations.length;
|
|
|
+ if (includebill != null && includebill.booleanValue()) {
|
|
|
+ delete(relations);
|
|
|
+ } else {
|
|
|
+ // String sql = "delete from " + FipRelationVO.getDefaultTableName() + " where " + wherepart;
|
|
|
+ new BaseDAO().deleteVOArray(relations);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return executeUpdate;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void loggerMessage(List<FipRelationVO> vos, String msg) throws BusinessException {
|
|
|
+ if (vos == null || vos.size() == 0)
|
|
|
+ return;
|
|
|
+ MessageLogVO[] logvos = new MessageLogVO[vos.size()];
|
|
|
+ for (int i = 0; i < logvos.length; i++) {
|
|
|
+ FipRelationVO vo = vos.get(i);
|
|
|
+ MessageLogVO messageLogVO = MessageTool.createMessageVO(FipBasicRelationVO.convertFromRelationVO(vo).getSrcRelation());
|
|
|
+ logvos[i] = messageLogVO;
|
|
|
+ messageLogVO.setMessagetype(0);
|
|
|
+ messageLogVO.setPk_operator(InvocationInfoProxy.getInstance().getUserId());
|
|
|
+ messageLogVO.setFreedef5(msg);
|
|
|
+ messageLogVO.setFreedef4(vo.getDes_billtype() + ":" + vo.getDes_relationid() + "@" + vo.getDes_org() + ":" + vo.getDes_freedef1());
|
|
|
+ }
|
|
|
+ new FipMessageLogsProxy().insert(logvos);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void loggerMessage(FipRelationVO[] vos, String msg) throws BusinessException {
|
|
|
+ if (vos == null || vos.length == 0)
|
|
|
+ return;
|
|
|
+ MessageLogVO[] logvos = new MessageLogVO[vos.length];
|
|
|
+ for (int i = 0; i < logvos.length; i++) {
|
|
|
+ FipRelationVO vo = vos[i];
|
|
|
+ MessageLogVO messageLogVO = MessageTool.createMessageVO(FipBasicRelationVO.convertFromRelationVO(vo).getSrcRelation());
|
|
|
+ logvos[i] = messageLogVO;
|
|
|
+ messageLogVO.setMessagetype(1);
|
|
|
+ messageLogVO.setPk_operator(InvocationInfoProxy.getInstance().getUserId());
|
|
|
+ messageLogVO.setFreedef5(msg);
|
|
|
+ messageLogVO.setFreedef4(vo.getDes_billtype() + ":" + vo.getDes_relationid() + "@" + vo.getDes_org() + ":" + vo.getDes_freedef1());
|
|
|
+ }
|
|
|
+ new FipMessageLogsProxy().insert(logvos);
|
|
|
+ }
|
|
|
+}
|