PayablebillImpl

时间:2022-06-09 00:36:25
package nc.impl.arap.payablebill;

import java.util.List;
import java.util.Map; import nc.bs.dao.BaseDAO;
import nc.itf.arap.payablebill.IPayablebillItf;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.vo.arap.payable.PayableBillVO;
import nc.vo.arap.payablebill.MidPayinfoVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException; /**
* 应付单管理审批弃审中间表数据操作接口实现
* @author 陈志锋
* 2015-12-25
*/
public class PayablebillImpl implements IPayablebillItf { private BaseDAO baseDAO;
public BaseDAO getBaseDAO(){
if(baseDAO == null){
baseDAO = new BaseDAO();
}
return baseDAO;
} @Override
public Boolean insertInfoMiddle(AggregatedValueObject aggvo) throws BusinessException {
String pk_payablebill = aggvo.getParentVO().getPrimaryKey();
MidPayinfoVO[] billVOs = getMidPayinfoVO(pk_payablebill);
if(billVOs != null){
for (int i = 0; i < billVOs.length; i++) {
MidPayinfoVO midPayinfoVO = billVOs[i];
midPayinfoVO.setDr(0);
getBaseDAO().insertVO(midPayinfoVO);
}
}
return true;
} @Override
public Boolean deteleInfoMiddle(String billPk) throws BusinessException { StringBuffer sqlstr=new StringBuffer("");
sqlstr.append("select * from (select ap_payableitem.pk_payablebill from ap_payableitem").append("\r\n");
sqlstr.append(" where ap_payableitem.top_billid = '"+billPk+"'").append("\r\n");
sqlstr.append(" order by ap_payableitem.ts desc ) temp where rownum = 1");
List<PayableBillVO> list = (List<PayableBillVO>) getBaseDAO().executeQuery(sqlstr.toString(), new BeanListProcessor(PayableBillVO.class));
if(list != null && list.size() > 0){
for (int i = 0; i < list.size(); i++) {
PayableBillVO billVO = list.get(i);
String pk_bill = billVO.getPrimaryKey();
if(billVO.getApprovestatus() == 1){
continue;
}else{
String delsql = " update MID_PAYINFO set billstate = 1,dr=1 where billPK='"+pk_bill+"' and nvl(dr,0)=0 ";
getBaseDAO().executeUpdate(delsql);
}
}
}
return true;
} private MidPayinfoVO[] getMidPayinfoVO(String pk_payablebill) throws BusinessException{
StringBuffer sqlstr=new StringBuffer("");
sqlstr.append("").append("\r\n");
sqlstr.append("select distinct ap_payablebill.def2 guid,").append("\r\n");
sqlstr.append(" ap_payablebill.money dkAmount,").append("\r\n");
sqlstr.append(" billuser.user_name createby,").append("\r\n");
sqlstr.append(" ap_payablebill.billdate createdate,").append("\r\n");
sqlstr.append(" ap_payablebill.approvedate approvedate,").append("\r\n");
sqlstr.append(" appuser.user_name approvedby,").append("\r\n");
sqlstr.append(" bd_supplier.code sfProviderCode,").append("\r\n");
sqlstr.append(" bd_supplier.name sfProviderName,").append("\r\n");
sqlstr.append(" ").append("\r\n");
sqlstr.append(" 0 billstate,").append("\r\n");
sqlstr.append(" ap_payablebill.pk_payablebill billPk,").append("\r\n");
sqlstr.append(" ap_payablebill.billno").append("\r\n");
sqlstr.append(" from ap_payablebill").append("\r\n");
sqlstr.append(" left join ap_payableitem").append("\r\n");
sqlstr.append(" on ap_payableitem.pk_payablebill = ap_payablebill.pk_payablebill").append("\r\n");
sqlstr.append(" left join bd_supplier").append("\r\n");
sqlstr.append(" on bd_supplier.pk_supplier = ap_payableitem.supplier").append("\r\n");
sqlstr.append(" left join sm_user appuser").append("\r\n");
sqlstr.append(" on appuser.cuserid = ap_payablebill.approver").append("\r\n");
sqlstr.append(" left join sm_user billuser").append("\r\n");
sqlstr.append(" on billuser.cuserid = ap_payablebill.billmaker").append("\r\n");
sqlstr.append(" where ap_payablebill.pk_payablebill = '"+pk_payablebill+"'").append("\r\n");
sqlstr.append(" and nvl(ap_payablebill.dr, 0) = 0 and nvl(appuser.dr,0) = 0").append("\r\n");
sqlstr.append(" and nvl(bd_supplier.dr,0) = 0 and nvl(billuser.dr,0) = 0").append("\r\n");
sqlstr.append(" and ap_payablebill.billstatus = 1 and nvl(ap_payablebill.def2,'~') <> '~' ");
List<MidPayinfoVO> listMidVO = (List<MidPayinfoVO>) getBaseDAO().executeQuery(sqlstr.toString(), new BeanListProcessor(MidPayinfoVO.class));
if(listMidVO != null && listMidVO.size() > 0){
return listMidVO.toArray(new MidPayinfoVO[0]);
}else{
return null;
} } @Override
public String getPayableStatue(String pk_payablebill)throws BusinessException {
String sql = "select ap_payablebill.approvestatus from ap_payablebill where ap_payablebill.pk_payablebill = '"+pk_payablebill+"'";
Map map = (Map) getBaseDAO().executeQuery(sql, new MapProcessor());
String billstatus = "";
if(map != null || map.size() > 0){
billstatus = (map.get("approvestatus")==null?"":map.get("approvestatus")) + "";
}
return billstatus;
} }

  

PayablebillImpl的更多相关文章

    随机推荐

    1. python 中的 try&sol;except&sol;else&sol;finally语句

      1.python中try/except/else/finally正常的语句是这样的: try: normal excute block except A: Except A handle except ...

    2. c语言小程序

      这是一个用c语言写的小程序,功能是随机输出30道100以内的四则运算,先生成两个随机数,再通过随机数确定四则运算符号,最后输出题目. #include<iostream> using na ...

    3. 【转】服务器证书安装配置指南(Weblogic)

      服务器证书安装配置指南(Weblogic) 详情请点击: http://verisign.itrus.com.cn/html/fuwuyuzhichi/fuwuqizhengshuanzhuangpe ...

    4. TCP协议的三次握手和四次分手

      HTTP连接 HTTP协议即超文本传送协议(Hypertext Transfer Protocol ),是Web联网的基础,也是手机联网常用的协议之一,HTTP协议是建立在TCP协议之上的一种应用. ...

    5. Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id &OpenCurlyDoubleQuote;null”

      编写好继承了WebSecurityConfigurerAdapter类的WebSecurityConfig类后,我们需要在configure(AuthenticationManagerBuilder ...

    6. Windows环境下使用bitvise架构sftp服务器

      Windows环境下使用Bitvise架构sftp服务器 Bitvise分成Bitvise ssh server和Bitvise ssh client 0 说明:文档暂时只使用Bitvise工具做搭建 ...

    7. Jquery Ajax 调用后台并返回数据

      一.前台调用ajax并解析json对象. $.ajax({ url : '', type : 'POST', //GET data : '’, beforeSend : function(reques ...

    8. float&colon;浮点型double&colon;双精度实型decimal&colon;数字型单精度浮点数&lpar;Single&rpar;双精度浮点数&lpar;double&rpar;

          单精度浮点数(Single) 双精度浮点数(double)       Decimal为SQL Server.MySql等数据库的一种数据类型,不属于浮点数类型,可以在定义时划定整数部分以及小 ...

    9. Haskell语言学习笔记(79)lambda演算

      lambda演算 根据*,lambda演算(英语:lambda calculus,λ-calculus)是一套从数学逻辑中发展,以变量绑定和替换的规则,来研究函数如何抽象化定义.函数如何被应用以 ...

    10. tcp通讯中socket套接字accept和listen的关系

      今天看到一个文章,客户端的connect在服务端调用accept之前,突然想到这可以建立正常的连接么?以前从没细细的思考过listen accept connect之前的关系,带着疑问学习了一下,记录 ...

    相关文章