|
|
@@ -2,99 +2,97 @@ package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
-import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.model.ErpProdIODetail;
|
|
|
import com.uas.platform.b2b.service.ErpProdIODetailService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
|
-
|
|
|
@Service
|
|
|
-public class ErpProdIODetailServiceImpl implements ErpProdIODetailService{
|
|
|
+public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
|
|
|
|
|
|
@Autowired
|
|
|
- private JdbcTemplate jdbcTemplate;
|
|
|
-
|
|
|
- public List<ErpProdIODetail> findAllApChecks(List<Long> filter){
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
+ public List<ErpProdIODetail> findAllApChecks(List<Long> filter) {
|
|
|
Long enUu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
String sql = "select p.pi_inoutno inOutNo,p.pd_detno detno ,p.pi_class piClass, p.pd_ordercode orderCode, p.pd_orderdetno orderDetno,"
|
|
|
+ " p.pd_prodcode prodCode, p.pr_title prodTitle,p.pd_qty qty, p.pi_date piDate, p.pd_orderprice orderPrice, p.pi_currency currency, p.pd_taxrate taxrate, p.pd_ycheckqty yCheckQty,"
|
|
|
+ " p.pd_thischeckqty thisCheckQty, p.custuu custUu, p.custname custName, p.enuu enUu, p.sourceid sourceId, p.pi_sourcetable sourceTable, p.pi_rate rate, p.pi_receivecode receiveCode,"
|
|
|
+ " p.pi_receivename receiveName from erp$prodiodetail p where enuu = ?";
|
|
|
- Object[] args = new Object[] {enUu};
|
|
|
+ Object[] args = new Object[] { enUu };
|
|
|
if (!CollectionUtils.isEmpty(filter)) {
|
|
|
String[] str = new String[filter.size()];
|
|
|
Long[] lon = new Long[filter.size() + 1];
|
|
|
String s = "";
|
|
|
- for (int i=0;i<filter.size();i++) {
|
|
|
- if (i != filter.size()-1) {
|
|
|
- str[i] ="?,";
|
|
|
+ for (int i = 0; i < filter.size(); i++) {
|
|
|
+ if (i != filter.size() - 1) {
|
|
|
+ str[i] = "?,";
|
|
|
} else {
|
|
|
str[i] = "?";
|
|
|
}
|
|
|
- lon[i+1] = filter.get(i);
|
|
|
+ lon[i + 1] = filter.get(i);
|
|
|
s = s + str[i];
|
|
|
}
|
|
|
sql = sql + " and custUu in (" + s + ")";
|
|
|
lon[0] = enUu;
|
|
|
args = lon;
|
|
|
}
|
|
|
- sql = sql +" order by pi_date desc";
|
|
|
- List<ErpProdIODetail> erpProdIODetails = jdbcTemplate.query(sql,args, new BeanPropertyRowMapper<ErpProdIODetail>(ErpProdIODetail.class));
|
|
|
+ sql = sql + " order by pi_date desc";
|
|
|
+ List<ErpProdIODetail> erpProdIODetails = commonDao.query(sql, args, ErpProdIODetail.class);
|
|
|
return erpProdIODetails;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ErpProdIODetail> findXlsApChecks(List<Long> filter,String keyword, Long fromDate, Long endDate) {
|
|
|
+ public List<ErpProdIODetail> findXlsApChecks(List<Long> filter, String keyword, Long fromDate, Long endDate) {
|
|
|
Long enUu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
String sql = "select p.pi_inoutno inOutNo,p.pd_detno detno ,p.pi_class piClass, p.pd_ordercode orderCode, p.pd_orderdetno orderDetno,"
|
|
|
+ " p.pd_prodcode prodCode, p.pr_title prodTitle,p.pd_qty qty, p.pi_date piDate, p.pd_orderprice orderPrice, p.pi_currency currency, p.pd_taxrate taxrate, p.pd_ycheckqty yCheckQty,"
|
|
|
+ " p.pd_thischeckqty thisCheckQty, p.custuu custUu, p.custname custName, p.enuu enUu, p.sourceid sourceId, p.pi_sourcetable sourceTable, p.pi_rate rate, p.pi_receivecode receiveCode,"
|
|
|
+ " p.pi_receivename receiveName from erp$prodiodetail p where enuu = ?";
|
|
|
- if(keyword != "") {
|
|
|
+ if (keyword != "") {
|
|
|
String[] strs = keyword.split("-");
|
|
|
- if(strs.length == 1 ) {
|
|
|
- sql = sql + " and custname = '" + strs[0] +"'";
|
|
|
+ if (strs.length == 1) {
|
|
|
+ sql = sql + " and custname = '" + strs[0] + "'";
|
|
|
}
|
|
|
- if(strs.length == 2 ) {
|
|
|
- if(strs[0].length() != 0) {
|
|
|
- sql = sql + " and custname = '" + strs[0] +"'";
|
|
|
+ if (strs.length == 2) {
|
|
|
+ if (strs[0].length() != 0) {
|
|
|
+ sql = sql + " and custname = '" + strs[0] + "'";
|
|
|
}
|
|
|
- sql = sql + " and pi_receivename = '" + strs[1] +"'";
|
|
|
+ sql = sql + " and pi_receivename = '" + strs[1] + "'";
|
|
|
}
|
|
|
}
|
|
|
- if(fromDate != null) {
|
|
|
+ if (fromDate != null) {
|
|
|
sql = sql + " and pi_date>" + "to_date('" + new java.sql.Date(new Date(fromDate).getTime()) + "','yyyy-mm-dd')";
|
|
|
}
|
|
|
- if(endDate != null) {
|
|
|
+ if (endDate != null) {
|
|
|
sql = sql + " and pi_date<" + "to_date('" + new java.sql.Date(new Date(endDate).getTime()) + "','yyyy-mm-dd')";
|
|
|
}
|
|
|
|
|
|
- Object[] args = new Object[] {enUu};
|
|
|
+ Object[] args = new Object[] { enUu };
|
|
|
if (!CollectionUtils.isEmpty(filter)) {
|
|
|
String[] str = new String[filter.size()];
|
|
|
Long[] lon = new Long[filter.size() + 1];
|
|
|
String s = "";
|
|
|
- for (int i=0;i<filter.size();i++) {
|
|
|
- if (i != filter.size()-1) {
|
|
|
- str[i] ="?,";
|
|
|
+ for (int i = 0; i < filter.size(); i++) {
|
|
|
+ if (i != filter.size() - 1) {
|
|
|
+ str[i] = "?,";
|
|
|
} else {
|
|
|
str[i] = "?";
|
|
|
}
|
|
|
- lon[i+1] = filter.get(i);
|
|
|
+ lon[i + 1] = filter.get(i);
|
|
|
s = s + str[i];
|
|
|
}
|
|
|
sql = sql + " and custUu in (" + s + ")";
|
|
|
lon[0] = enUu;
|
|
|
args = lon;
|
|
|
}
|
|
|
- sql = sql +" order by pi_date desc";
|
|
|
- List<ErpProdIODetail> erpProdIODetails = jdbcTemplate.query(sql,args, new BeanPropertyRowMapper<ErpProdIODetail>(ErpProdIODetail.class));
|
|
|
+ sql = sql + " order by pi_date desc";
|
|
|
+ List<ErpProdIODetail> erpProdIODetails = commonDao.query(sql, args, ErpProdIODetail.class);
|
|
|
return erpProdIODetails;
|
|
|
}
|
|
|
}
|
|
|
-
|