Commit 89cd022b authored by 张永's avatar 张永

select 走读库

parent fecc57b5
...@@ -6,6 +6,7 @@ import java.util.Map; ...@@ -6,6 +6,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.aliyuncs.utils.StringUtils; import com.aliyuncs.utils.StringUtils;
...@@ -21,6 +22,11 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -21,6 +22,11 @@ public class ActivityServiceImpl implements ActivityService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
/** /**
* 众筹项目列表 * 众筹项目列表
* <p>Title: </p> * <p>Title: </p>
...@@ -31,11 +37,11 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -31,11 +37,11 @@ public class ActivityServiceImpl implements ActivityService {
*/ */
public List<Map<String, Object>> crowdFundingsProjectList(Map<String, Object> params, Page page) { public List<Map<String, Object>> crowdFundingsProjectList(Map<String, Object> params, Page page) {
String orgNo = params.get("orgNO")+""; String orgNo = params.get("orgNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = projectSql(orgNo, ""); String sql = projectSql(orgNo, "");
List<Map<String,Object>> list = jdbcTemplate.limit(sql, page); List<Map<String,Object>> list = readJdbcTemplate.limit(sql, page);
// if(list != null && list.size()>0) { // if(list != null && list.size()>0) {
// for(Map<String,Object> map:list) { // for(Map<String,Object> map:list) {
// String projectId = map.get("ProjectID")+""; // String projectId = map.get("ProjectID")+"";
...@@ -62,10 +68,10 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -62,10 +68,10 @@ public class ActivityServiceImpl implements ActivityService {
public Map<String, Object> crowdFundingsProjectDetail(Map<String, Object> params) { public Map<String, Object> crowdFundingsProjectDetail(Map<String, Object> params) {
String projectId = params.get("projectId")+""; String projectId = params.get("projectId")+"";
String orgNo = params.get("orgNo")+""; String orgNo = params.get("orgNo")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String projectSql = projectSql(orgNo, projectId); String projectSql = projectSql(orgNo, projectId);
Map<String,Object> projectMap = jdbcTemplate.queryForMap(projectSql); Map<String,Object> projectMap = readJdbcTemplate.queryForMap(projectSql);
String sql = "SELECT PlanID = a.nPlanID,ProjectID = a.nProjectID,PlanName = a.sPlanName, PlanSummary = a.sPlanSummary,PlanUrl = a.sUrl,AgentContractNO = a.sAgentContractNO, " String sql = "SELECT PlanID = a.nPlanID,ProjectID = a.nProjectID,PlanName = a.sPlanName, PlanSummary = a.sPlanSummary,PlanUrl = a.sUrl,AgentContractNO = a.sAgentContractNO, "
+ " GoodsID = a.nGoodsID, GoodsNO = acg.sGoodsNO,GoodsDesc = acg.sGoodsDesc,PlanStock = a.nPlanStock, PlanPrice = a.nPrice,LimitQty = a.nLimitQty, " + " GoodsID = a.nGoodsID, GoodsNO = acg.sGoodsNO,GoodsDesc = acg.sGoodsDesc,PlanStock = a.nPlanStock, PlanPrice = a.nPrice,LimitQty = a.nLimitQty, "
+ " PlanReturnDays = (select datediff(dd, dEndDate, dReturnDate) from tZHCProject p where p.nProjectID = a.nProjectID), LastUpdateTime = a.dLastUpdateTime ,SaleCount = 0 " + " PlanReturnDays = (select datediff(dd, dEndDate, dReturnDate) from tZHCProject p where p.nProjectID = a.nProjectID), LastUpdateTime = a.dLastUpdateTime ,SaleCount = 0 "
...@@ -73,9 +79,9 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -73,9 +79,9 @@ public class ActivityServiceImpl implements ActivityService {
+ " WHERE a.nProjectID = ? "; + " WHERE a.nProjectID = ? ";
String sql0 = "select so.nPlanID, sum(so.nTotalSaleQty) nSaleQty from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nPlanID = p.nPlanID and p.nProjectID = " + projectId + " group by so.nPlanID"; String sql0 = "select so.nPlanID, sum(so.nTotalSaleQty) nSaleQty from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nPlanID = p.nPlanID and p.nProjectID = " + projectId + " group by so.nPlanID";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql0); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql0);
Map<String, Map<String, Object>> mm = Util.listToMM(list, "nPlanID"); Map<String, Map<String, Object>> mm = Util.listToMM(list, "nPlanID");
List<Map<String,Object>> goodsList = jdbcTemplate.queryForList(sql,projectId); List<Map<String,Object>> goodsList = readJdbcTemplate.queryForList(sql,projectId);
for(Map<String, Object> map : goodsList) { for(Map<String, Object> map : goodsList) {
Object PlanID = map.get("PlanID"); Object PlanID = map.get("PlanID");
Map<String, Object> mmm = mm.get("" + PlanID); Map<String, Object> mmm = mm.get("" + PlanID);
......
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
...@@ -27,6 +28,12 @@ public class BrandServiceImpl implements BrandService { ...@@ -27,6 +28,12 @@ public class BrandServiceImpl implements BrandService {
private static final Log logger = LogFactory.getLog(BrandServiceImpl.class); private static final Log logger = LogFactory.getLog(BrandServiceImpl.class);
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
@Autowired @Autowired
private UserService userService; private UserService userService;
/* /*
...@@ -46,8 +53,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -46,8 +53,8 @@ public class BrandServiceImpl implements BrandService {
}else { }else {
sql +=" AND sOrgList like '%"+orgNO+"%' "; sql +=" AND sOrgList like '%"+orgNO+"%' ";
} }
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page); return readJdbcTemplate.limit(sql, page);
} }
@Override @Override
...@@ -69,8 +76,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -69,8 +76,8 @@ public class BrandServiceImpl implements BrandService {
+ "b.sBrandName, " + "b.sBrandName, "
+ "b.sLogoUrl "; + "b.sLogoUrl ";
String orgNo=(String) map.get("orgNo"); String orgNo=(String) map.get("orgNo");
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page,orgNo); return readJdbcTemplate.limit(sql, page,orgNo);
} }
@Override @Override
...@@ -98,7 +105,7 @@ public class BrandServiceImpl implements BrandService { ...@@ -98,7 +105,7 @@ public class BrandServiceImpl implements BrandService {
+ "ORDER BY " + "ORDER BY "
+ "b.nSort desc, " + "b.nSort desc, "
+ "b.sPinyinCode "; + "b.sPinyinCode ";
return jdbcTemplate.queryForList(sql, orgNo); return readJdbcTemplate.queryForList(sql, orgNo);
} }
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -23,6 +24,12 @@ public class CartServiceImpl implements CartService { ...@@ -23,6 +24,12 @@ public class CartServiceImpl implements CartService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
@Autowired @Autowired
private CartQueryService cartRedisService; private CartQueryService cartRedisService;
...@@ -117,7 +124,7 @@ public class CartServiceImpl implements CartService { ...@@ -117,7 +124,7 @@ public class CartServiceImpl implements CartService {
* @throws * @throws
*/ */
public Map<String, Object> count(String orgNo, String shopNO) { public Map<String, Object> count(String orgNo, String shopNO) {
return jdbcTemplate.queryForMap("select count(nSaleQty) totalCount , isnull(sum(nSaleQty), 0) totalSaleQty from V_Cart where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'"); return readJdbcTemplate.queryForMap("select count(nSaleQty) totalCount , isnull(sum(nSaleQty), 0) totalSaleQty from V_Cart where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'");
} }
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
...@@ -15,18 +16,22 @@ public class CategoryServiceImpl implements CategoryService { ...@@ -15,18 +16,22 @@ public class CategoryServiceImpl implements CategoryService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
public List<Map<String, Object>> queryCategoryByLevel(String orgNO, String scopeTypeID, Integer level) { public List<Map<String, Object>> queryCategoryByLevel(String orgNO, String scopeTypeID, Integer level) {
if(level == null) { if(level == null) {
level = jdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)"); level = readJdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)");
} }
String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc"; String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc";
List<Map<String,Object>> list3=jdbcTemplate.queryForList(three, orgNO, level); List<Map<String,Object>> list3=readJdbcTemplate.queryForList(three, orgNO, level);
return list3; return list3;
} }
public List<Map<String, Object>> queryCategory(String orgNO, String scopeTypeID, String upCategoryNo) { public List<Map<String, Object>> queryCategory(String orgNO, String scopeTypeID, String upCategoryNo) {
String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc"; String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc";
List<Map<String,Object>> list3=jdbcTemplate.queryForList(three, orgNO, upCategoryNo); List<Map<String,Object>> list3=readJdbcTemplate.queryForList(three, orgNO, upCategoryNo);
return list3; return list3;
} }
......
...@@ -178,7 +178,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -178,7 +178,7 @@ public class GoodsServiceImpl implements GoodsService {
" and a.nAgentID = ? " + " and a.nAgentID = ? " +
" and a.nGoodsID = ?"; " and a.nGoodsID = ?";
int mCount = jdbcTemplate.queryForInt(mSql,agentID,goodsId); int mCount = readJdbcTemplate.queryForInt(mSql,agentID,goodsId);
if(mCount >0 ) { if(mCount >0 ) {
IsGoodsUnit = 1; IsGoodsUnit = 1;
} }
...@@ -192,10 +192,10 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -192,10 +192,10 @@ public class GoodsServiceImpl implements GoodsService {
try { try {
if(isCheckAgentID) { if(isCheckAgentID) {
gSql += " and t.nAgentID = ? "; gSql += " and t.nAgentID = ? ";
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId,agentID); detail = readJdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId,agentID);
}else { }else {
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId); detail = readJdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId);
} }
BigDecimal nApSalePrice = (BigDecimal) detail.get("nApSalePrice"); BigDecimal nApSalePrice = (BigDecimal) detail.get("nApSalePrice");
...@@ -210,9 +210,9 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -210,9 +210,9 @@ public class GoodsServiceImpl implements GoodsService {
List<Map<String, Object>> specList = new ArrayList<Map<String,Object>>(); List<Map<String, Object>> specList = new ArrayList<Map<String,Object>>();
if(isCheckAgentID) { if(isCheckAgentID) {
sql += " and og.nAgentID = ? "; sql += " and og.nAgentID = ? ";
specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId,agentID); specList = readJdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId,agentID);
}else { }else {
specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId); specList = readJdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId);
} }
...@@ -264,7 +264,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -264,7 +264,7 @@ public class GoodsServiceImpl implements GoodsService {
}else { }else {
args = new Object[] {custTypeId, orgNo, contractNo, goodsId}; args = new Object[] {custTypeId, orgNo, contractNo, goodsId};
} }
List<Map<String, Object>> promoList = jdbcTemplate.queryForList(promoSql, args); List<Map<String, Object>> promoList = readJdbcTemplate.queryForList(promoSql, args);
detail.put("promoList", promoList); detail.put("promoList", promoList);
...@@ -292,7 +292,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -292,7 +292,7 @@ public class GoodsServiceImpl implements GoodsService {
" and t.nAgentID = ? " + " and t.nAgentID = ? " +
" order by nConvertRate"; " order by nConvertRate";
List<Map<String,Object>> goodsUnitList = jdbcTemplate.queryForList(GoodsUnitSql,orgNo,contractNo,goodsId,agentID,orgNo,contractNo,goodsId,agentID); List<Map<String,Object>> goodsUnitList = readJdbcTemplate.queryForList(GoodsUnitSql,orgNo,contractNo,goodsId,agentID,orgNo,contractNo,goodsId,agentID);
rjx.set("goodsUnitList", goodsUnitList); rjx.set("goodsUnitList", goodsUnitList);
}else { }else {
rjx.set("goodsUnitList", null); rjx.set("goodsUnitList", null);
...@@ -334,7 +334,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -334,7 +334,7 @@ public class GoodsServiceImpl implements GoodsService {
" and a.nGoodsID = ? " + " and a.nGoodsID = ? " +
"order by sPicTypeID, nIdx " + "order by sPicTypeID, nIdx " +
" "; " ";
List<Map<String, Object>> picList1 = jdbcTemplate.queryForList(sql1, agentContractNO, goodsID, agentContractNO, goodsID); List<Map<String, Object>> picList1 = readJdbcTemplate.queryForList(sql1, agentContractNO, goodsID, agentContractNO, goodsID);
Map<String, List<Map<String,Object>>> picML1 = Util.listToML(picList1, "sPicTypeID"); Map<String, List<Map<String,Object>>> picML1 = Util.listToML(picList1, "sPicTypeID");
Map<String, List<Map<String, Object>>> pics = new HashMap<String, List<Map<String, Object>>>(); Map<String, List<Map<String, Object>>> pics = new HashMap<String, List<Map<String, Object>>>();
for(String sPicTypeID : new String[] {"1", "2", "3", "4","5"}) { for(String sPicTypeID : new String[] {"1", "2", "3", "4","5"}) {
......
...@@ -16,6 +16,7 @@ import org.apache.commons.logging.LogFactory; ...@@ -16,6 +16,7 @@ import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.UncategorizedSQLException; import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -48,6 +49,11 @@ public class OrderServiceImpl implements OrderService { ...@@ -48,6 +49,11 @@ public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
/* /*
* @Autowired QiyeWxService wxService; * @Autowired QiyeWxService wxService;
*/ */
...@@ -199,7 +205,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -199,7 +205,7 @@ public class OrderServiceImpl implements OrderService {
if (orderType != null && orderType.length > 0) { if (orderType != null && orderType.length > 0) {
sql += " and a.sB2BOrderTypeID in (" + StringUtil.join("', '", "'", "'", "", orderType) + ")"; sql += " and a.sB2BOrderTypeID in (" + StringUtil.join("', '", "'", "'", "", orderType) + ")";
} }
List<Map<String, Object>> orderList = jdbcTemplate.limit(sql, page); List<Map<String, Object>> orderList = readJdbcTemplate.limit(sql, page);
if (orderList.size() > 0) { if (orderList.size() > 0) {
List<String> orderIds = orderList.stream().map(o -> (String) o.get("sSalesOrderID")) List<String> orderIds = orderList.stream().map(o -> (String) o.get("sSalesOrderID"))
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -219,7 +225,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -219,7 +225,7 @@ public class OrderServiceImpl implements OrderService {
" from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 " + " from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 " +
" where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")"; " where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")";
List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> orderDtlList = readJdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID"); Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID");
for (Map<String, Object> orderMap : orderList) { for (Map<String, Object> orderMap : orderList) {
String sSalesOrderID = (String) orderMap.get("sSalesOrderID"); String sSalesOrderID = (String) orderMap.get("sSalesOrderID");
...@@ -255,14 +261,14 @@ public class OrderServiceImpl implements OrderService { ...@@ -255,14 +261,14 @@ public class OrderServiceImpl implements OrderService {
" from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1" + " from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1" +
" where sosd.sSalesOrderID in("+StringUtil.join("', '", "'", "'", orderIds) +")";*/ " where sosd.sSalesOrderID in("+StringUtil.join("', '", "'", "'", orderIds) +")";*/
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3); List<Map<String, Object>> subList = readJdbcTemplate.queryForList(sql3);
if (subList.size() > 0) { if (subList.size() > 0) {
List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID")) List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID"))
.collect(Collectors.toList()); .collect(Collectors.toList());
String sql4 = "select sosd.*,PromoSalePrice=CONVERT(NUMERIC(12,2),case when sosd.nSaleQty = 0 then 0 else ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2) end),OriginaSaleAmount=sosd.nSaleAmount+sosd.nDisAmount,ISGift = sosd.nTag&1," String sql4 = "select sosd.*,PromoSalePrice=CONVERT(NUMERIC(12,2),case when sosd.nSaleQty = 0 then 0 else ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2) end),OriginaSaleAmount=sosd.nSaleAmount+sosd.nDisAmount,ISGift = sosd.nTag&1,"
+ " agp.sURL from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1" + " agp.sURL from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1"
+ " where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")"; + " where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")";
List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql4); List<Map<String, Object>> subDtlList = readJdbcTemplate.queryForList(sql4);
Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSubOrderID"); Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSubOrderID");
for (Map<String, Object> subMap : subList) { for (Map<String, Object> subMap : subList) {
String sSubOrderID = (String) subMap.get("sSubOrderID"); String sSubOrderID = (String) subMap.get("sSubOrderID");
...@@ -284,7 +290,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -284,7 +290,7 @@ public class OrderServiceImpl implements OrderService {
public String getOrderDetail(String salesOrderId) { public String getOrderDetail(String salesOrderId) {
Map<String, Object> orderMap = null; Map<String, Object> orderMap = null;
try { try {
orderMap = jdbcTemplate.queryForMap("select * from tSalesOrder where sSalesOrderID = ?", salesOrderId); orderMap = readJdbcTemplate.queryForMap("select * from tSalesOrder where sSalesOrderID = ?", salesOrderId);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
throw new XException("订单编号错误或订单不存在"); throw new XException("订单编号错误或订单不存在");
} }
...@@ -329,7 +335,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -329,7 +335,7 @@ public class OrderServiceImpl implements OrderService {
" and sos.nIdx = sod.nIdx \r\n" + " and sos.nIdx = sod.nIdx \r\n" +
" and (sos.nTag&1 = sod.nTag&1 or sos.nTag&1-1 = sod.nTag&1-1) \r\n" + " and (sos.nTag&1 = sod.nTag&1 or sos.nTag&1-1 = sod.nTag&1-1) \r\n" +
"where sod.sSalesOrderID = ? "; "where sod.sSalesOrderID = ? ";
orderDtlList = jdbcTemplate.queryForList(sql2, salesOrderId); orderDtlList = readJdbcTemplate.queryForList(sql2, salesOrderId);
} }
Map<String, Object> payMap = new HashMap<String,Object>(); Map<String, Object> payMap = new HashMap<String,Object>();
try { try {
...@@ -337,7 +343,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -337,7 +343,7 @@ public class OrderServiceImpl implements OrderService {
+ ", create_time = replace(convert(varchar(10),dCreateDate,120),'-','') + replace(convert(varchar(10),dCreateDate,108),':','') " + ", create_time = replace(convert(varchar(10),dCreateDate,120),'-','') + replace(convert(varchar(10),dCreateDate,108),':','') "
+ "from tSalesOrderPay " + "from tSalesOrderPay "
+ "where sSalesOrderID = ? and sOutTradeNO not like '%_D' "; + "where sSalesOrderID = ? and sOutTradeNO not like '%_D' ";
payMap = jdbcTemplate.queryForMap(sqlPay, salesOrderId); payMap = readJdbcTemplate.queryForMap(sqlPay, salesOrderId);
payMap.put("nOrderTotalAmount", orderMap.get("nTotalSaleAmount")); payMap.put("nOrderTotalAmount", orderMap.get("nTotalSaleAmount"));
} catch (Exception e) { } catch (Exception e) {
} }
...@@ -371,7 +377,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -371,7 +377,7 @@ public class OrderServiceImpl implements OrderService {
+ " sCancelUser, " + " sSettleNO, " + " nDebtAmount, " + " sCancelUser, " + " sSettleNO, " + " nDebtAmount, "
+ " dExpectDate = convert(varchar(10), dExpectDate, 120)" + " dExpectDate = convert(varchar(10), dExpectDate, 120)"
+ " from tSalesOrderSub where sSalesOrderID = ?"; + " from tSalesOrderSub where sSalesOrderID = ?";
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql, salesOrderId); List<Map<String, Object>> subList = readJdbcTemplate.queryForList(sql, salesOrderId);
if (subList.size() > 0) { if (subList.size() > 0) {
List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID")).collect(Collectors.toList()); List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID")).collect(Collectors.toList());
String sql2 = "select sosd.*, PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount)/case when sosd.nSaleQty=0 then 1 else sosd.nSaleQty end,2)), \r\n" + String sql2 = "select sosd.*, PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount)/case when sosd.nSaleQty=0 then 1 else sosd.nSaleQty end,2)), \r\n" +
...@@ -387,7 +393,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -387,7 +393,7 @@ public class OrderServiceImpl implements OrderService {
" left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1\r\n" + " left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1\r\n" +
"where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")"; "where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")";
List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> subDtlList = readJdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSalesOrderID"); Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSalesOrderID");
for (Map<String, Object> subMap : subList) { for (Map<String, Object> subMap : subList) {
String sSubOrderID = (String) subMap.get("sSubOrderID"); String sSubOrderID = (String) subMap.get("sSubOrderID");
...@@ -447,19 +453,19 @@ public class OrderServiceImpl implements OrderService { ...@@ -447,19 +453,19 @@ public class OrderServiceImpl implements OrderService {
int ReturnDay = 0; int ReturnDay = 0;
try { try {
String msql = "select convert(int, sValue1) FROM tSystemCtrl WHERE sCode = 'SaleReturnDays' "; String msql = "select convert(int, sValue1) FROM tSystemCtrl WHERE sCode = 'SaleReturnDays' ";
ReturnDay = jdbcTemplate.queryForInt(msql); ReturnDay = readJdbcTemplate.queryForInt(msql);
} catch (Exception e) { } catch (Exception e) {
} }
Map<String, Object> subOrderMap = jdbcTemplate.queryForMap("" + "select " + "sos.*, " Map<String, Object> subOrderMap = readJdbcTemplate.queryForMap("" + "select " + "sos.*, "
+ " IsRefund = case when isnull(sos.sBindPaperNO,'') = '' then 1 when sos.nOrderStatus&17=0 then 0 when datediff(dd,dateadd(dd,1,convert(date,sos.dReceiveDate)),getdate()) >= ? then 0 else 1 end, " + " IsRefund = case when isnull(sos.sBindPaperNO,'') = '' then 1 when sos.nOrderStatus&17=0 then 0 when datediff(dd,dateadd(dd,1,convert(date,sos.dReceiveDate)),getdate()) >= ? then 0 else 1 end, "
+ " LeftReturnQty = isnull(d.nSendQty,0) - isnull(d.nReturnQty,0), " + " LeftReturnQty = isnull(d.nSendQty,0) - isnull(d.nReturnQty,0), "
+ "case when sos.nOrderStatus&145 = 144 then '16' when sos.nOrderStatus&145 = 128 then '8' when sos.nOrderStatus&145 = 0 then '4' when sos.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, " + "case when sos.nOrderStatus&145 = 144 then '16' when sos.nOrderStatus&145 = 128 then '8' when sos.nOrderStatus&145 = 0 then '4' when sos.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, "
+ "case when sos.nOrderStatus&145 = 144 then '已完成' when sos.nOrderStatus&145 = 128 then '配送中' when sos.nOrderStatus&145 = 0 then '待发货' when sos.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText " + "case when sos.nOrderStatus&145 = 144 then '已完成' when sos.nOrderStatus&145 = 128 then '配送中' when sos.nOrderStatus&145 = 0 then '待发货' when sos.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText "
+ "from tSalesOrderSub sos left join (select sSubOrderID, nSendQty = sum(nSendQty), nReturnQty = sum(nReturnQty) from tSalesOrderSubDtl where sSubOrderID = ? group by sSubOrderID) d on sos.sSubOrderID = d.sSubOrderID " + "from tSalesOrderSub sos left join (select sSubOrderID, nSendQty = sum(nSendQty), nReturnQty = sum(nReturnQty) from tSalesOrderSubDtl where sSubOrderID = ? group by sSubOrderID) d on sos.sSubOrderID = d.sSubOrderID "
+ " where sos.sSubOrderID = ?", ReturnDay, subOrderID, subOrderID); + " where sos.sSubOrderID = ?", ReturnDay, subOrderID, subOrderID);
Map<String, Object> orderMap = jdbcTemplate.queryForMap("" + "select " + "so.*, " Map<String, Object> orderMap = readJdbcTemplate.queryForMap("" + "select " + "so.*, "
+ "case when so.nOrderStatus&145 = 144 then '16' when so.nOrderStatus&145 = 128 then '8' when so.nOrderStatus&145 = 0 then '4' when so.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, " + "case when so.nOrderStatus&145 = 144 then '16' when so.nOrderStatus&145 = 128 then '8' when so.nOrderStatus&145 = 0 then '4' when so.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, "
+ "case when so.nOrderStatus&145 = 144 then '已完成' when so.nOrderStatus&145 = 128 then '配送中' when so.nOrderStatus&145 = 0 then '待发货' when so.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText " + "case when so.nOrderStatus&145 = 144 then '已完成' when so.nOrderStatus&145 = 128 then '配送中' when so.nOrderStatus&145 = 0 then '待发货' when so.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText "
+ "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID")); + "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID"));
...@@ -513,12 +519,12 @@ public class OrderServiceImpl implements OrderService { ...@@ -513,12 +519,12 @@ public class OrderServiceImpl implements OrderService {
" left join tAgentContractGoods ag on sosd.sAgentContractNO = ag.sAgentContractNO and sosd.nGoodsID = ag.nGoodsID \r\n" + " left join tAgentContractGoods ag on sosd.sAgentContractNO = ag.sAgentContractNO and sosd.nGoodsID = ag.nGoodsID \r\n" +
"where sosd.sSubOrderID = ?"; "where sosd.sSubOrderID = ?";
List<Map<String, Object>> dtlList = jdbcTemplate.queryForList(sql, subOrderID); List<Map<String, Object>> dtlList = readJdbcTemplate.queryForList(sql, subOrderID);
Map<String, Object> deliver = jdbcTemplate.queryForMap( Map<String, Object> deliver = readJdbcTemplate.queryForMap(
"SELECT sum(a.nNum) nTotalCount, sum(a.nPrice * a.nNum) nTotalAmount FROM tSalesOrderDeliverSubDtl a where a.sSubOrderID = ?", "SELECT sum(a.nNum) nTotalCount, sum(a.nPrice * a.nNum) nTotalAmount FROM tSalesOrderDeliverSubDtl a where a.sSubOrderID = ?",
subOrderID); subOrderID);
String sql3 = "select sSubOrderID, nOrderMoney, sAocOrderID, sAocOrderNumber, nOrderNum, nPickupNum, sExpressNO, sExpressName from tSalesOrderDeliverSub where nTag&1 = 0 and sSubOrderID = ?"; String sql3 = "select sSubOrderID, nOrderMoney, sAocOrderID, sAocOrderNumber, nOrderNum, nPickupNum, sExpressNO, sExpressName from tSalesOrderDeliverSub where nTag&1 = 0 and sSubOrderID = ?";
List<Map<String, Object>> deliverSubList = jdbcTemplate.queryForList(sql3, subOrderID); List<Map<String, Object>> deliverSubList = readJdbcTemplate.queryForList(sql3, subOrderID);
Map<String, Object> payMap = new HashMap<String,Object>(); Map<String, Object> payMap = new HashMap<String,Object>();
...@@ -526,7 +532,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -526,7 +532,7 @@ public class OrderServiceImpl implements OrderService {
String sqlPay = "select sPayTypeID, sPayType, nPayAmount, sOutTradeNO, sTransTraceNO, dPayDateTime, sStatusID = case when nTag&2=2 then '1' else '0' end, sStatus = case when nTag&2=2 then '已付款' else '未付款' end " String sqlPay = "select sPayTypeID, sPayType, nPayAmount, sOutTradeNO, sTransTraceNO, dPayDateTime, sStatusID = case when nTag&2=2 then '1' else '0' end, sStatus = case when nTag&2=2 then '已付款' else '未付款' end "
+ "from tSalesOrderPay " + "from tSalesOrderPay "
+ "where sSalesOrderID = ? and sOutTradeNO not like '%_D' "; + "where sSalesOrderID = ? and sOutTradeNO not like '%_D' ";
payMap = jdbcTemplate.queryForMap(sqlPay, subOrderMap.get("sSalesOrderID")); payMap = readJdbcTemplate.queryForMap(sqlPay, subOrderMap.get("sSalesOrderID"));
payMap.put("nOrderTotalAmount", orderMap.get("nTotalSaleAmount")); payMap.put("nOrderTotalAmount", orderMap.get("nTotalSaleAmount"));
} catch (Exception e) { } catch (Exception e) {
} }
...@@ -557,16 +563,16 @@ public class OrderServiceImpl implements OrderService { ...@@ -557,16 +563,16 @@ public class OrderServiceImpl implements OrderService {
String stockSql = "select og.sWarehouseNO, og.sAgentContractNO, og.nGoodsID, og.nStockQty, og.nLockedQty from tPromoRuleGoods prg, V_OrgGoods og where prg.sAgentContractNO = og.sAgentContractNO and prg.nGoodsID = og.nGoodsID and og.sOrgNO = ? and prg.sPromoPaperNO = ? and prg.sPromoGroupNO = ?"; String stockSql = "select og.sWarehouseNO, og.sAgentContractNO, og.nGoodsID, og.nStockQty, og.nLockedQty from tPromoRuleGoods prg, V_OrgGoods og where prg.sAgentContractNO = og.sAgentContractNO and prg.nGoodsID = og.nGoodsID and og.sOrgNO = ? and prg.sPromoPaperNO = ? and prg.sPromoGroupNO = ?";
List<Map<String, Object>> stockList = jdbcTemplate.queryForList(stockSql, orgNo, promoPaperNO, promoGroupNO); List<Map<String, Object>> stockList = readJdbcTemplate.queryForList(stockSql, orgNo, promoPaperNO, promoGroupNO);
Map<String, Map<String, Object>> stockMM = Util.listToMM(stockList, "_", "sAgentContractNO", "nGoodsID"); Map<String, Map<String, Object>> stockMM = Util.listToMM(stockList, "_", "sAgentContractNO", "nGoodsID");
Map<String, Object> custMap = jdbcTemplate.queryForMap( Map<String, Object> custMap = readJdbcTemplate.queryForMap(
"select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ? and s.sOrgNO = ?", "select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ? and s.sOrgNO = ?",
shopNo, orgNo); shopNo, orgNo);
String sCustTypeID = (String) custMap.get("sCustTypeID"); String sCustTypeID = (String) custMap.get("sCustTypeID");
String sCustNO = (String) custMap.get("sCustNO"); String sCustNO = (String) custMap.get("sCustNO");
this.saveOrderBankAccount(sCustNO, bankType, bankAccount); this.saveOrderBankAccount(sCustNO, bankType, bankAccount);
Map<String, Object> addrMap = jdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId); Map<String, Object> addrMap = readJdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId);
List<String> address = new ArrayList<String>(); List<String> address = new ArrayList<String>();
address.add((String) addrMap.get("sProvince")); address.add((String) addrMap.get("sProvince"));
address.add((String) addrMap.get("sCity")); address.add((String) addrMap.get("sCity"));
...@@ -599,7 +605,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -599,7 +605,7 @@ public class OrderServiceImpl implements OrderService {
+ " CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " + " CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' "
+ " AND a.sPromoPaperNO = ? " + " AND b.sPromoGroupNO = ? " + " AND c.sShopNO = ? "; + " AND a.sPromoPaperNO = ? " + " AND b.sPromoGroupNO = ? " + " AND c.sShopNO = ? ";
List<Map<String, Object>> goodsList = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), promoPaperNO, List<Map<String, Object>> goodsList = readJdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), promoPaperNO,
promoGroupNO, sCustTypeID); promoGroupNO, sCustTypeID);
if (goodsList.size() == 0) { if (goodsList.size() == 0) {
...@@ -750,11 +756,11 @@ public class OrderServiceImpl implements OrderService { ...@@ -750,11 +756,11 @@ public class OrderServiceImpl implements OrderService {
XException.assertNotBlank(terminal, "Terminal不能为空"); XException.assertNotBlank(terminal, "Terminal不能为空");
BigDecimal Qty = BigDecimal.valueOf(saleQty); BigDecimal Qty = BigDecimal.valueOf(saleQty);
Map<String, Object> custMap = jdbcTemplate.queryForMap( Map<String, Object> custMap = readJdbcTemplate.queryForMap(
"select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?", shopNo); "select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?", shopNo);
String sCustNO = (String) custMap.get("sCustNO"); String sCustNO = (String) custMap.get("sCustNO");
this.saveOrderBankAccount(sCustNO, bankType, bankAccount); this.saveOrderBankAccount(sCustNO, bankType, bankAccount);
Map<String, Object> addrMap = jdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId); Map<String, Object> addrMap = readJdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId);
List<String> address = new ArrayList<String>(); List<String> address = new ArrayList<String>();
address.add((String) addrMap.get("sProvince")); address.add((String) addrMap.get("sProvince"));
address.add((String) addrMap.get("sCity")); address.add((String) addrMap.get("sCity"));
...@@ -776,11 +782,11 @@ public class OrderServiceImpl implements OrderService { ...@@ -776,11 +782,11 @@ public class OrderServiceImpl implements OrderService {
+ " LEFT JOIN V_OrgGoods og ON og.sOrgNO = t.sOrgNO " + " LEFT JOIN V_OrgGoods og ON og.sOrgNO = t.sOrgNO "
+ " AND og.sAgentContractNO = t.sAgentContractNO " + " AND og.nGoodsID = t.nGoodsID"; + " AND og.sAgentContractNO = t.sAgentContractNO " + " AND og.nGoodsID = t.nGoodsID";
Map<String, Object> gMap = jdbcTemplate.queryForMap(sqlplan.replaceAll("\\s+", " "), planId, orgNo); Map<String, Object> gMap = readJdbcTemplate.queryForMap(sqlplan.replaceAll("\\s+", " "), planId, orgNo);
BigDecimal nPrice = (BigDecimal) gMap.get("nPrice"); BigDecimal nPrice = (BigDecimal) gMap.get("nPrice");
BigDecimal nTotalSaleAmount = nPrice.multiply(Qty); BigDecimal nTotalSaleAmount = nPrice.multiply(Qty);
BigDecimal nPlanStock = (BigDecimal) gMap.get("nPlanStock"); BigDecimal nPlanStock = (BigDecimal) gMap.get("nPlanStock");
Map<String, Object> planSum = jdbcTemplate.queryForMap( Map<String, Object> planSum = readJdbcTemplate.queryForMap(
"select sum(nTotalSaleQty) nOrderQty, sum(nTotalSaleAmount) nOrderAmount from tSalesOrder where nPlanID = ? and nOrderStatus&1 = 0", "select sum(nTotalSaleQty) nOrderQty, sum(nTotalSaleAmount) nOrderAmount from tSalesOrder where nPlanID = ? and nOrderStatus&1 = 0",
planId); planId);
BigDecimal nOrderQty = (BigDecimal) planSum.get("nOrderQty"); BigDecimal nOrderQty = (BigDecimal) planSum.get("nOrderQty");
...@@ -865,9 +871,9 @@ public class OrderServiceImpl implements OrderService { ...@@ -865,9 +871,9 @@ public class OrderServiceImpl implements OrderService {
jdbcTemplate.save(dtl); jdbcTemplate.save(dtl);
{ {
Long nProjectID = jdbcTemplate.queryForLong("select nProjectID from tZHCPlan where nPlanID = ?", planId); Long nProjectID = readJdbcTemplate.queryForLong("select nProjectID from tZHCPlan where nPlanID = ?", planId);
String sql = "select count(so.sSalesOrderID) nSalePaperQty, isnull(sum(so.nTotalSaleQty), 0) nSaleQty, isnull(sum(so.nTotalSaleAmount), 0) nSaleAmount from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nTag&1 = 0 and so.nPlanID = p.nPlanID and p.nProjectID = ?"; String sql = "select count(so.sSalesOrderID) nSalePaperQty, isnull(sum(so.nTotalSaleQty), 0) nSaleQty, isnull(sum(so.nTotalSaleAmount), 0) nSaleAmount from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nTag&1 = 0 and so.nPlanID = p.nPlanID and p.nProjectID = ?";
Map<String, Object> map = jdbcTemplate.queryForMap(sql, nProjectID); Map<String, Object> map = readJdbcTemplate.queryForMap(sql, nProjectID);
Integer nSalePaperQty = ((Number) map.get("nSalePaperQty")).intValue(); Integer nSalePaperQty = ((Number) map.get("nSalePaperQty")).intValue();
BigDecimal nSaleQty = (BigDecimal) map.get("nSaleQty"); BigDecimal nSaleQty = (BigDecimal) map.get("nSaleQty");
BigDecimal nSaleAmount = (BigDecimal) map.get("nSaleAmount"); BigDecimal nSaleAmount = (BigDecimal) map.get("nSaleAmount");
...@@ -892,13 +898,13 @@ public class OrderServiceImpl implements OrderService { ...@@ -892,13 +898,13 @@ public class OrderServiceImpl implements OrderService {
XException.assertNotBlank(payTypeId, "PayTypeID不能为空"); XException.assertNotBlank(payTypeId, "PayTypeID不能为空");
XException.assertNotBlank(terminal, "Terminal不能为空"); XException.assertNotBlank(terminal, "Terminal不能为空");
Map<String, Object> custMap = jdbcTemplate.queryForMap( Map<String, Object> custMap = readJdbcTemplate.queryForMap(
"select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?", shopNo); "select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?", shopNo);
String sCustTypeID = (String) custMap.get("sCustTypeID"); String sCustTypeID = (String) custMap.get("sCustTypeID");
String sCustNO = (String) custMap.get("sCustNO"); String sCustNO = (String) custMap.get("sCustNO");
this.saveOrderBankAccount(sCustNO, bankType, bankAccount); this.saveOrderBankAccount(sCustNO, bankType, bankAccount);
BigDecimal Qty = BigDecimal.valueOf(saleQty); BigDecimal Qty = BigDecimal.valueOf(saleQty);
Map<String, Object> addrMap = jdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId); Map<String, Object> addrMap = readJdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?", addrId);
List<String> address = new ArrayList<String>(); List<String> address = new ArrayList<String>();
address.add((String) addrMap.get("sProvince")); address.add((String) addrMap.get("sProvince"));
address.add((String) addrMap.get("sCity")); address.add((String) addrMap.get("sCity"));
...@@ -911,7 +917,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -911,7 +917,7 @@ public class OrderServiceImpl implements OrderService {
String sContacts = (String) addrMap.get("sContacts"); String sContacts = (String) addrMap.get("sContacts");
String gSql = "select t.*, ap.nRealSalePrice nApSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = t.sAgentContractNO and ap.nGoodsID = t.nGoodsID where t.sOrgNO = ? and t.sAgentContractNO = ? and t.nGoodsID = ?"; String gSql = "select t.*, ap.nRealSalePrice nApSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = t.sAgentContractNO and ap.nGoodsID = t.nGoodsID where t.sOrgNO = ? and t.sAgentContractNO = ? and t.nGoodsID = ?";
Map<String, Object> gMap = jdbcTemplate.queryForMap(gSql, sCustTypeID, orgNo, contractNo, goodsId); Map<String, Object> gMap = readJdbcTemplate.queryForMap(gSql, sCustTypeID, orgNo, contractNo, goodsId);
BigDecimal nStockQty = (BigDecimal) gMap.get("nStockQty"); BigDecimal nStockQty = (BigDecimal) gMap.get("nStockQty");
BigDecimal nLockedQty = (BigDecimal) gMap.get("nLockedQty"); BigDecimal nLockedQty = (BigDecimal) gMap.get("nLockedQty");
BigDecimal stock = nStockQty.subtract(nLockedQty); BigDecimal stock = nStockQty.subtract(nLockedQty);
...@@ -1048,7 +1054,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -1048,7 +1054,7 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
public List<Map<String, Object>> getDeliverSubDetail(String aocOrderID) { public List<Map<String, Object>> getDeliverSubDetail(String aocOrderID) {
return jdbcTemplate.queryForList("select * from tSalesOrderDeliverSubDtl where nTag&1 = 0 and sAocOrderID = ?", return readJdbcTemplate.queryForList("select * from tSalesOrderDeliverSubDtl where nTag&1 = 0 and sAocOrderID = ?",
aocOrderID); aocOrderID);
} }
...@@ -1093,7 +1099,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -1093,7 +1099,7 @@ public class OrderServiceImpl implements OrderService {
int saleReturnDays = 0; int saleReturnDays = 0;
try { try {
String dSql = "select SaleReturnDays = convert(int, sValue1) FROM tSystemCtrl WHERE sCode = 'SaleReturnDays' "; String dSql = "select SaleReturnDays = convert(int, sValue1) FROM tSystemCtrl WHERE sCode = 'SaleReturnDays' ";
saleReturnDays = jdbcTemplate.queryForInt(dSql); saleReturnDays = readJdbcTemplate.queryForInt(dSql);
} catch (Exception e) { } catch (Exception e) {
} }
...@@ -1130,7 +1136,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -1130,7 +1136,7 @@ public class OrderServiceImpl implements OrderService {
" a.sDeliveryTypeID, a.sDeliveryType, a.sContacts, a.sMobile, a.sAddress, a.nExpressFee, " + " a.sDeliveryTypeID, a.sDeliveryType, a.sContacts, a.sMobile, a.sAddress, a.nExpressFee, " +
" a.nOrderStatus, a.nOrderStatusName, a.sOrderMemo "; " a.nOrderStatus, a.nOrderStatusName, a.sOrderMemo ";
List<Map<String, Object>> orderList = jdbcTemplate.limit(sql, page); List<Map<String, Object>> orderList = readJdbcTemplate.limit(sql, page);
sortList.addAll(orderList); sortList.addAll(orderList);
sortList.sort(new Comparator<Map<String, Object>>() { sortList.sort(new Comparator<Map<String, Object>>() {
...@@ -1184,7 +1190,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -1184,7 +1190,7 @@ public class OrderServiceImpl implements OrderService {
+ " where a.sSubOrderID in (" + StringUtil.join("', '", "'", "'", orderIdList) + ") " + " where a.sSubOrderID in (" + StringUtil.join("', '", "'", "'", orderIdList) + ") "
+ " order by a.nIdx"; + " order by a.nIdx";
List<Map<String, Object>> goodsList = jdbcTemplate.queryForList(detailSql); List<Map<String, Object>> goodsList = readJdbcTemplate.queryForList(detailSql);
Map<String, List<Map<String, Object>>> gmList = Util.listToML(goodsList, "SubOrderID"); Map<String, List<Map<String, Object>>> gmList = Util.listToML(goodsList, "SubOrderID");
for (Map<String, Object> orderMap : orderList) { for (Map<String, Object> orderMap : orderList) {
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
...@@ -17,6 +18,11 @@ public class PageServiceImpl implements PageService { ...@@ -17,6 +18,11 @@ public class PageServiceImpl implements PageService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
/** /**
* 查询首页配置 * 查询首页配置
* <p>Title: query</p> * <p>Title: query</p>
...@@ -29,8 +35,8 @@ public class PageServiceImpl implements PageService { ...@@ -29,8 +35,8 @@ public class PageServiceImpl implements PageService {
public List<Map<String, Object>> query(Map<String, Object> params) { public List<Map<String, Object>> query(Map<String, Object> params) {
String sql = "SELECT sPlatformNO platformNO,sPlatformName platformName,sLogoPath1 logoPath1 ,sLogoPath2 logoPath2,sLogoPath3 logoPath3,sThemeNO themeNO,sThemeJson themeJson,sMemo memo,dLastUpdateTime lastUpdateTime " String sql = "SELECT sPlatformNO platformNO,sPlatformName platformName,sLogoPath1 logoPath1 ,sLogoPath2 logoPath2,sLogoPath3 logoPath3,sThemeNO themeNO,sThemeJson themeJson,sMemo memo,dLastUpdateTime lastUpdateTime "
+ " FROM tPlatformLayout " + "WHERE nTag &1=0 ORDER BY dLastUpdateTime DESC "; + " FROM tPlatformLayout " + "WHERE nTag &1=0 ORDER BY dLastUpdateTime DESC ";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.queryForList(sql); return readJdbcTemplate.queryForList(sql);
} }
/** /**
...@@ -45,11 +51,11 @@ public class PageServiceImpl implements PageService { ...@@ -45,11 +51,11 @@ public class PageServiceImpl implements PageService {
@Override @Override
public List<Map<String, Object>> queryIcon(Map<String, Object> params, Page page) { public List<Map<String, Object>> queryIcon(Map<String, Object> params, Page page) {
String iconGroupNO = params.get("iconGroupNO")+""; String iconGroupNO = params.get("iconGroupNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = " SELECT IconNO = i.sIconNO ,IconPath=i.sIconPath,DefaultTxt=i.sDefaultTxt,DefaultLinkType=i.sDefaultLinkType,DefaultLink=i.sDefaultLink " String sql = " SELECT IconNO = i.sIconNO ,IconPath=i.sIconPath,DefaultTxt=i.sDefaultTxt,DefaultLinkType=i.sDefaultLinkType,DefaultLink=i.sDefaultLink "
+ " FROM tIcon i ,tIconGroup ig" + " FROM tIcon i ,tIconGroup ig"
+ " WHERE i.sGroupNO = ig.sGroupNO AND ig.nTag&1=0 and ig.sGroupNO = ? "; + " WHERE i.sGroupNO = ig.sGroupNO AND ig.nTag&1=0 and ig.sGroupNO = ? ";
return jdbcTemplate.limit(sql, page, iconGroupNO); return readJdbcTemplate.limit(sql, page, iconGroupNO);
} }
/** /**
...@@ -67,7 +73,7 @@ public class PageServiceImpl implements PageService { ...@@ -67,7 +73,7 @@ public class PageServiceImpl implements PageService {
String adTypeID = params.get("adTypeID")+""; String adTypeID = params.get("adTypeID")+"";
String custNo = params.get("custNo")+""; String custNo = params.get("custNo")+"";
String AgentID = params.get("AgentID")+""; String AgentID = params.get("AgentID")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BannerAdNO = b.sBannerAdNO, BannerAdTitle = b.sBannerAdTitle,OrgNO = b.sOrgNO,AdPostionTypeID = b.sAdPositionTypeID,AdPostionType = b.sAdPositionType," String sql = "SELECT BannerAdNO = b.sBannerAdNO, BannerAdTitle = b.sBannerAdTitle,OrgNO = b.sOrgNO,AdPostionTypeID = b.sAdPositionTypeID,AdPostionType = b.sAdPositionType,"
+ " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath," + " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath,"
...@@ -75,7 +81,7 @@ public class PageServiceImpl implements PageService { ...@@ -75,7 +81,7 @@ public class PageServiceImpl implements PageService {
+ " from tBannerAd b " + " from tBannerAd b "
+ " WHERE b.sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = ? "; + " WHERE b.sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = ? ";
return jdbcTemplate.limit(sql, page, orgNO, adTypeID,AgentID); return readJdbcTemplate.limit(sql, page, orgNO, adTypeID,AgentID);
} }
...@@ -93,16 +99,16 @@ public class PageServiceImpl implements PageService { ...@@ -93,16 +99,16 @@ public class PageServiceImpl implements PageService {
String orgNO = params.get("orgNO")+""; String orgNO = params.get("orgNO")+"";
String msgTypeID = params.get("msgTypeID")+""; String msgTypeID = params.get("msgTypeID")+"";
String agentID = params.get("agentID")+""; String agentID = params.get("agentID")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BillBoardID = b.nBillboardID, MsgTypeID = b.sMsgTypeID,MsgType = b.sMsgType,Title = b.sTitle,Content = b.sText,Sort = b.nSort,TradeDate = b.dTradeDate" String sql = "SELECT BillBoardID = b.nBillboardID, MsgTypeID = b.sMsgTypeID,MsgType = b.sMsgType,Title = b.sTitle,Content = b.sText,Sort = b.nSort,TradeDate = b.dTradeDate"
+ " FROM tBillboard b " + " FROM tBillboard b "
+ " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ? "; + " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ? ";
if(StringUtil.isNotBlank(agentID)) { if(StringUtil.isNotBlank(agentID)) {
sql += " and b.nAgentID = ? "; sql += " and b.nAgentID = ? ";
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO,agentID); return readJdbcTemplate.limit(sql, page, msgTypeID, orgNO,agentID);
}else { }else {
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO); return readJdbcTemplate.limit(sql, page, msgTypeID, orgNO);
} }
} }
...@@ -118,18 +124,18 @@ public class PageServiceImpl implements PageService { ...@@ -118,18 +124,18 @@ public class PageServiceImpl implements PageService {
*/ */
public List<Map<String, Object>> queryFinanceProd(Map<String, Object> params, Page page) { public List<Map<String, Object>> queryFinanceProd(Map<String, Object> params, Page page) {
String orgNO = params.get("orgNO")+""; String orgNO = params.get("orgNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "select FinanceID = a.nFinanceID, OrgNO = a.sOrgNO, FinanceName = a.sFinanceName,AgentContractNO = a.sAgentContractNO,BannerUrl = a.sBannerUrl,LogoUrl = a.sLogoUrl," String sql = "select FinanceID = a.nFinanceID, OrgNO = a.sOrgNO, FinanceName = a.sFinanceName,AgentContractNO = a.sAgentContractNO,BannerUrl = a.sBannerUrl,LogoUrl = a.sLogoUrl,"
+ " AddressUrl = a.sAddressUrl, Introduce = a.sMemo, LastUpdateTime = a.dLastUpdateTime " + " AddressUrl = a.sAddressUrl, Introduce = a.sMemo, LastUpdateTime = a.dLastUpdateTime "
+ " from tFinanceProd a where a.nTag&2 = 2 and a.sOrgNO = ? "; + " from tFinanceProd a where a.nTag&2 = 2 and a.sOrgNO = ? ";
List<Map<String,Object>> list = jdbcTemplate.limit(sql, page, orgNO); List<Map<String,Object>> list = readJdbcTemplate.limit(sql, page, orgNO);
if(list != null && list.size() >0) { if(list != null && list.size() >0) {
for(Map<String,Object> map:list) { for(Map<String,Object> map:list) {
String FinanceID = map.get("FinanceID")+""; String FinanceID = map.get("FinanceID")+"";
String picSql = "select FinanceID = nFinanceID,Item = nItem, PicDesc = sPicDesc,URL = sURL from tFinanceProdPic where nFinanceID = ?"; String picSql = "select FinanceID = nFinanceID,Item = nItem, PicDesc = sPicDesc,URL = sURL from tFinanceProdPic where nFinanceID = ?";
List<Map<String,Object>> picList = jdbcTemplate.queryForList(picSql,FinanceID); List<Map<String,Object>> picList = readJdbcTemplate.queryForList(picSql,FinanceID);
map.put("picList", picList); map.put("picList", picList);
} }
} }
......
...@@ -85,16 +85,16 @@ public class UserServiceImpl implements UserService { ...@@ -85,16 +85,16 @@ public class UserServiceImpl implements UserService {
} }
try { try {
String sql = "SELECT * FROM tCustomer WHERE sCustNO = ? AND nTag&1=0"; String sql = "SELECT * FROM tCustomer WHERE sCustNO = ? AND nTag&1=0";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
TCustomer tcustomer = jdbcTemplate.queryForBean(sql, TCustomer.class, custNO); TCustomer tcustomer = readJdbcTemplate.queryForBean(sql, TCustomer.class, custNO);
List<TShop> shops = null; List<TShop> shops = null;
String shopSql = "SELECT * FROM tShop WHERE nTag&1=0 and sCustNO =? "; String shopSql = "SELECT * FROM tShop WHERE nTag&1=0 and sCustNO =? ";
if(StringUtil.isNotEmpty(shopNO)) { if(StringUtil.isNotEmpty(shopNO)) {
shopSql += " AND sShopNO = ? "; shopSql += " AND sShopNO = ? ";
shops = jdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim(),shopNO.trim()); shops = readJdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim(),shopNO.trim());
}else { }else {
shops = jdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim()); shops = readJdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim());
} }
tcustomer.settShops(shops); tcustomer.settShops(shops);
...@@ -118,7 +118,7 @@ public class UserServiceImpl implements UserService { ...@@ -118,7 +118,7 @@ public class UserServiceImpl implements UserService {
public boolean checkShopExists(String custNO,String shopNO) { public boolean checkShopExists(String custNO,String shopNO) {
try { try {
String sql = "SELECT count(1) FROM tShop WHERE sCustNO = ? AND sShopNO = ? AND nTag&1=0"; String sql = "SELECT count(1) FROM tShop WHERE sCustNO = ? AND sShopNO = ? AND nTag&1=0";
int i = jdbcTemplate.queryForInt(sql,custNO,shopNO); int i = readJdbcTemplate.queryForInt(sql,custNO,shopNO);
if(i >0) { if(i >0) {
return true; return true;
} }
...@@ -132,7 +132,7 @@ public class UserServiceImpl implements UserService { ...@@ -132,7 +132,7 @@ public class UserServiceImpl implements UserService {
public TCustomer getCustomer(String mobile) { public TCustomer getCustomer(String mobile) {
try { try {
String sql = "SELECT * FROM tCustomer WHERE sMobile = ? AND nTag&1=0"; String sql = "SELECT * FROM tCustomer WHERE sMobile = ? AND nTag&1=0";
return jdbcTemplate.queryForBean(sql, TCustomer.class, mobile); return readJdbcTemplate.queryForBean(sql, TCustomer.class, mobile);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -144,8 +144,8 @@ public class UserServiceImpl implements UserService { ...@@ -144,8 +144,8 @@ public class UserServiceImpl implements UserService {
return new TShop(); return new TShop();
} }
String sql = "SELECT * FROM tShop WHERE sShopNO = ? AND nTag&1=0"; String sql = "SELECT * FROM tShop WHERE sShopNO = ? AND nTag&1=0";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.queryForBean(sql, TShop.class, shopNO); return readJdbcTemplate.queryForBean(sql, TShop.class, shopNO);
} }
/** /**
...@@ -660,7 +660,7 @@ public class UserServiceImpl implements UserService { ...@@ -660,7 +660,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public Map<String, Object> queryCustomerByOpenId(String openId) { public Map<String, Object> queryCustomerByOpenId(String openId) {
String sql = "select c.*, m.sMobile sSalesmanMobile from tCustomer c left join tSalesman m on m.sSalesmanNO = c.sSalesmanNO1, tB2BUser u where c.sCustNO = u.sCustNO and u.sOpenID = ? and c.nTag&1 = 0 and u.nTag&1 = 0"; String sql = "select c.*, m.sMobile sSalesmanMobile from tCustomer c left join tSalesman m on m.sSalesmanNO = c.sSalesmanNO1, tB2BUser u where c.sCustNO = u.sCustNO and u.sOpenID = ? and c.nTag&1 = 0 and u.nTag&1 = 0";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, openId); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql, openId);
if(list.size() > 1) { if(list.size() > 1) {
throw new XException("OpenID绑定异常"); throw new XException("OpenID绑定异常");
} }
...@@ -669,7 +669,7 @@ public class UserServiceImpl implements UserService { ...@@ -669,7 +669,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public Map<String, Object> queryCustomerByMobile(String mobile) { public Map<String, Object> queryCustomerByMobile(String mobile) {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from tCustomer where sMobile = ? or sCustNO = ? and nTag&1 = 0", mobile, mobile); List<Map<String, Object>> list = readJdbcTemplate.queryForList("select * from tCustomer where sMobile = ? or sCustNO = ? and nTag&1 = 0", mobile, mobile);
return list.size() == 0 ? null : list.get(0); return list.size() == 0 ? null : list.get(0);
} }
...@@ -677,7 +677,7 @@ public class UserServiceImpl implements UserService { ...@@ -677,7 +677,7 @@ public class UserServiceImpl implements UserService {
public Map<String, Object> createCustomer(String orgNo, String openId, String mobile) { public Map<String, Object> createCustomer(String orgNo, String openId, String mobile) {
String sSalesmanNO1 = null; String sSalesmanNO1 = null;
try { try {
sSalesmanNO1 = jdbcTemplate.queryForString("select sSalesmanNO from tOrg where sOrgNO = ?", orgNo); sSalesmanNO1 = readJdbcTemplate.queryForString("select sSalesmanNO from tOrg where sOrgNO = ?", orgNo);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -707,7 +707,7 @@ public class UserServiceImpl implements UserService { ...@@ -707,7 +707,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<Map<String, Object>> queryShopList(String orgNo, String custNo) { public List<Map<String, Object>> queryShopList(String orgNo, String custNo) {
List<Map<String, Object>> shopList = jdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0", custNo, orgNo); List<Map<String, Object>> shopList = readJdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0", custNo, orgNo);
return shopList; return shopList;
} }
...@@ -763,7 +763,7 @@ public class UserServiceImpl implements UserService { ...@@ -763,7 +763,7 @@ public class UserServiceImpl implements UserService {
}, keyHolder); }, keyHolder);
Object key = keyHolder.getKey(); Object key = keyHolder.getKey();
jdbcTemplate.update("update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?", key); jdbcTemplate.update("update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?", key);
String sShopNO = jdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?", key); String sShopNO = readJdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?", key);
map.put("sShopNO", sShopNO); map.put("sShopNO", sShopNO);
return map; return map;
} }
...@@ -838,13 +838,13 @@ public class UserServiceImpl implements UserService { ...@@ -838,13 +838,13 @@ public class UserServiceImpl implements UserService {
+ "left join tOrg o on o.sOrgNO = s.sOrgNO " + "left join tOrg o on o.sOrgNO = s.sOrgNO "
+ "where " + "where "
+ "sm.sSalesmanNO = s.sSalesmanNO1 and s.sShopNO = ?"; + "sm.sSalesmanNO = s.sSalesmanNO1 and s.sShopNO = ?";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, shopNo); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql, shopNo);
return list != null && list.size() > 0 ? list.get(0) : null; return list != null && list.size() > 0 ? list.get(0) : null;
} }
@Override @Override
public Map<String, Object> getCustomerByNO(String custNo) { public Map<String, Object> getCustomerByNO(String custNo) {
return jdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo); return readJdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo);
} }
@Override @Override
...@@ -857,7 +857,7 @@ public class UserServiceImpl implements UserService { ...@@ -857,7 +857,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<Map<String, Object>> queryBankList(String sCustNO) { public List<Map<String, Object>> queryBankList(String sCustNO) {
String sql = "SELECT * FROM tCustBank where sCustNO = ? and nTag&1 = 0 order by dLastUpdateTime desc"; String sql = "SELECT * FROM tCustBank where sCustNO = ? and nTag&1 = 0 order by dLastUpdateTime desc";
return jdbcTemplate.queryForList(sql, sCustNO); return readJdbcTemplate.queryForList(sql, sCustNO);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment