diff --git a/arap/src/client/nccloud/web/arap/arappub/action/LinkBipAction.java b/arap/src/client/nccloud/web/arap/arappub/action/LinkBipAction.java index d63c8f60..69a6e4e6 100644 --- a/arap/src/client/nccloud/web/arap/arappub/action/LinkBipAction.java +++ b/arap/src/client/nccloud/web/arap/arappub/action/LinkBipAction.java @@ -1,53 +1,78 @@ package nccloud.web.arap.arappub.action; +import nc.bs.dao.BaseDAO; import nc.bs.framework.common.InvocationInfoProxy; -import nc.bs.framework.common.NCLocator; +import nc.itf.arap.pub.IArapBillService; import nc.itf.scmpub.reference.uap.rbac.UserManageQuery; -import nc.itf.uif.pub.IUifService; +import nc.jdbc.framework.processor.MapProcessor; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.arap.basebill.BaseAggVO; +import nc.vo.arap.basebill.BaseItemVO; import nc.vo.bc.pub.util.SysParaInitQuery; -import nc.vo.bd.psn.PsndocVO; +import nc.vo.sm.UserVO; import nccloud.baseapp.core.log.NCCForUAPLogger; +import nccloud.framework.core.exception.ExceptionUtils; +import nccloud.framework.service.ServiceLocator; import nccloud.framework.web.container.IRequest; import nccloud.web.action.NCCAction; import nccloud.web.uapbd.commons.web.ParamUtils; +import java.util.Map; + public class LinkBipAction extends NCCAction { - private IUifService uifservice = NCLocator.getInstance().lookup(IUifService.class); - // JwtUtil util = new JwtUtil(); @Override public Object execute(IRequest request, T para) throws Exception { ParamUtils param = new ParamUtils(request); - String bip_pk = param.getString("bip_pk", null); - String bip_no = param.getString("bip_no", null); - // String pk_group = param.getString("pk_group", null); - String redirctCode = "purinv"; + String pkBill = param.getString("pk_bill", null); + String billType = param.getString("billType", null); + String redirctCode = param.getString("redirctCode", null); + if (redirctCode == null || redirctCode.isEmpty()) { + throw new RuntimeException("redirctCodeΪ,"); + } String userid = InvocationInfoProxy.getInstance().getUserId(); - String psnid = UserManageQuery.queryPsndocByUserid(userid); - // String linkbipurl = SysParaInitQuery.getParaString("GLOBLE00000000000000", "LinkBIPUrl"); - String linkbipurl = ""; - linkbipurl = "https://www.tkkfbip.com/c-kk-lszz-znpt/commontthirdLogin"; - // if (psnid == null || psnid.isEmpty()) { - // throw new RuntimeException("当前用户无人员信息,请检查"); - // } + UserVO userVO = UserManageQuery.queryUserVOByUserid(userid); + if (userVO == null) { + throw new RuntimeException("ǰûѯϢ,"); + } + String userCode = userVO.getUser_code(); + String linkbipurl = SysParaInitQuery.getParaString("GLOBLE00000000000000", "LinkBIPUrl"); try { - // PsndocVO vo = (PsndocVO) uifservice.queryByPrimaryKey(PsndocVO.class, psnid); - // String key = SysParaInitQuery.getParaString("GLOBLE00000000000000", "LinkBIPKey");// 密钥 - // String[] bipkey = key.split("/"); - // if (bipkey == null || bipkey.length != 2) { - // throw new RuntimeException("LinkBIPKey格式不对,请检查!"); - // } - // String userCode = util.encrypt(vo.getCode(), bipkey[0]); - // Map map = new HashMap<>(); - // map.put("userCode", userCode); - // map.put("secretKey", bipkey[1]); - // map.put("ttlMillis", 60000 * 1);// 设置过期时间1分钟 - // String token = util.createJWT(map); - // String url = "?token=" + token + "&redirctCode=" + redirctCode + "&billId=" + bip_pk; - // bip_pk = "2385789401874563081";// 测试环境 - bip_pk = "2414583154678431746";//开发环境 - String url = "?redirctCode=" + redirctCode + "&billId=" + bip_pk; + // =========ӦidѯɹƱ콢id=========== + // NCCForUAPLogger.debug("pkBill:" + pkBill + " billType:" + billType); + BaseAggVO[] vos = ServiceLocator.find(IArapBillService.class).queryArapBillByPKs(new String[]{pkBill}, billType); + if (MMValueCheck.isEmpty(vos)) { + ExceptionUtils.wrapBusinessException("δҵ,ѯ" + "pkBill:" + pkBill + " billType:" + billType); + } + BaseAggVO vo = vos[0]; + BaseItemVO[] itemVOS = vo.getItems(); + BaseItemVO itemVO = itemVOS[0]; + String topBillid = itemVO.getTop_billid(); + String topTradetype = itemVO.getTop_tradetype(); + // NCCForUAPLogger.debug("topBillid:" + topBillid + " topTradetype:" + topTradetype); + String sql = "SELECT a.pk_invoice,a.vbillcode," + + " b.cextsrcbilltype, b.vextsrcbillcode, b.cextsrcid, b.cextsrcbid" + + " FROM po_invoice_b b" + + " LEFT JOIN po_invoice a ON a.pk_invoice = b.pk_invoice" + + " WHERE " + + " a.pk_invoice = '" + topBillid + "'"; + NCCForUAPLogger.debug("sql:" + sql); + Map billMap = (Map) new BaseDAO().executeQuery(sql, new MapProcessor()); + if (MMValueCheck.isEmpty(billMap)) { + ExceptionUtils.wrapBusinessException("δѯɹƱѯsql:" + sql); + } + if (MMValueCheck.isEmpty(billMap.get("cextsrcid"))) { + ExceptionUtils.wrapBusinessException("òɹƱԴⲿϵͳ޷תѯsql:" + sql); + } + // =========ӦidѯɹƱ콢id=========== + + // String bip_pk = "2385789401874563081";// Ի + String bip_pk = billMap.get("cextsrcid") + ""; + bip_pk = "2414583154678431746";// + NCCForUAPLogger.debug("LinkBipAction-userCode = " + userCode); + userCode = "yhtmanager"; + String url = "?redirctCode=" + redirctCode + "&billId=" + bip_pk + "&userCode=" + userCode; linkbipurl = linkbipurl + url; NCCForUAPLogger.debug("LinkBipAction-linkbipurl = " + linkbipurl); return linkbipurl; diff --git a/arap/src/client/nccloud/web/arap/arappub/action/LinkOtherPurInvoiceAction.java b/arap/src/client/nccloud/web/arap/arappub/action/LinkOtherPurInvoiceAction.java deleted file mode 100644 index b023305b..00000000 --- a/arap/src/client/nccloud/web/arap/arappub/action/LinkOtherPurInvoiceAction.java +++ /dev/null @@ -1,61 +0,0 @@ -package nccloud.web.arap.arappub.action; - -import com.alibaba.fastjson.JSONObject; -import nc.bs.dao.BaseDAO; -import nc.itf.arap.pub.IArapBillService; -import nc.jdbc.framework.processor.MapProcessor; -import nc.util.mmf.framework.base.MMValueCheck; -import nc.vo.arap.basebill.BaseAggVO; -import nc.vo.arap.basebill.BaseItemVO; -import nc.vo.pub.BusinessException; -import nccloud.baseapp.core.log.NCCForUAPLogger; -import nccloud.framework.core.exception.ExceptionUtils; -import nccloud.framework.core.json.IJson; -import nccloud.framework.service.ServiceLocator; -import nccloud.framework.web.action.itf.ICommonAction; -import nccloud.framework.web.container.IRequest; -import nccloud.framework.web.json.JsonFactory; -import nccloud.web.arap.arappub.info.CommonInfo; -import nccloud.web.arap.arappub.util.BillActionUtils; - -import java.util.Map; - -public class LinkOtherPurInvoiceAction implements ICommonAction { - public LinkOtherPurInvoiceAction() { - } - - public Object doAction(IRequest request) { - String str = request.read(); - (new BillActionUtils()).setBusiInfoParm(str); - IJson json = JsonFactory.create(); - CommonInfo info = json.fromJson(str, CommonInfo.class); - try { - String pkBill = info.getPk_bill(); - String billType = info.getBillType(); - NCCForUAPLogger.debug("pkBill:" + pkBill + " billType:" + billType); - BaseAggVO[] vos = ServiceLocator.find(IArapBillService.class).queryArapBillByPKs(new String[]{pkBill}, billType); - if (MMValueCheck.isEmpty(vos)) { - ExceptionUtils.wrapBusinessException("δҵ"); - } - BaseAggVO vo = vos[0]; - BaseItemVO[] itemVOS = vo.getItems(); - BaseItemVO itemVO = itemVOS[0]; - String topBillid = itemVO.getTop_billid(); - String topTradetype = itemVO.getTop_tradetype(); - NCCForUAPLogger.debug("topBillid:" + topBillid + " topTradetype:" + topTradetype); - String sql = "SELECT a.pk_invoice,a.vbillcode," + - " b.cextsrcbilltype, b.vextsrcbillcode, b.cextsrcid, b.cextsrcbid" + - " FROM po_invoice_b b" + - " LEFT JOIN po_invoice a ON a.pk_invoice = b.pk_invoice" + - " WHERE " + - " a.pk_invoice = '" + topBillid + "'"; - Map map = (Map) new BaseDAO().executeQuery(sql, new MapProcessor()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("data", map); - return jsonObject; - } catch (BusinessException e) { - ExceptionUtils.wrapException(e); - return null; - } - } -}