📄 articlebean.java
字号:
package com.doone.fj1w.fjmgr.config;
import com.doone.data.DacClient;
import com.doone.data.DataRow;
import com.doone.data.DataTable;
import com.doone.fj1w.fj1w.login.app.CommitDate;
import com.doone.util.FileLogger;
public class ArticleBean {
DataRow repositoryInfo;
private String paraName;
private String yeWuName;
private String paraValue;
private String articleType;
private String content;
private String cityCode;
private String state;
private String affairId;
private String areaCode;
private CommitDate cd = null;
private final int pageSize = 10; // 默认每页10条
public ArticleBean() {
cd =CommitDate.getInstance();
}
/**取指定的条款协议类型
*
* @param dbClient
* @param ParaValue
* @return
*/
public DataTable getConfigsub(DacClient dbClient,String ParaValue) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select ");
sql.append("ParaId, ");
sql.append("ParaName, ");
sql.append("ParaDesc, ");
sql.append("ParaState ");
sql.append(" from ");
sql.append("Ts_Configsub");
sql.append(" where ParaName='ArticleType'");
sql.append(" and ParaValue='"+ParaValue+"'");
dt = dbClient.executeQuery(sql.toString());
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**取所有的条款协议类型
*
* @param dbClient
* @return
*/
public DataTable getConfigsub(DacClient dbClient) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select ");
sql.append("ParaId, ");
sql.append("ParaName, ");
sql.append("ParaDesc, ");
sql.append("ParaState ");
sql.append(" from ");
sql.append("Ts_Configsub");
sql.append(" where ParaName='ArticleType'");
dt = dbClient.executeQuery(sql.toString());
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**过滤掉已有的自定义免责条款的业务名称
*
* @param dbClient
* @param cityCode
* @return
*/
public DataTable getLastCarticle(DacClient dbClient,String cityCode,String areaCode){
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
Object[] aParam = null;
sql.append("select * from Ts_Configsub ");
sql.append("where ParaValue not in(select distinct AffairId ");
sql.append("from Td_Article where articleType='C' ");
sql.append(" and cityCode=? and areaCode=?");
sql.append(") and paraname='ArticleSELFAffairID'");
aParam = new Object[2];
aParam[0] = cityCode;//按地域权限的
aParam[1] = areaCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**过滤掉已有的产品类免责条款的业务名称
*
* @param dbClient
* @param cityCode
* @return
*/
public DataTable getLastParticle(DacClient dbClient,String cityCode,String areaCode) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
Object[] aParam = null;
sql.append("select PRODUCTID,productName from Td_Product ");
sql.append("where productId not in(select distinct AffairId from Td_Article ");
sql.append("where articleType='P'");
sql.append(" and cityCode=? and areaCode=?");
sql.append(") and upproductid=0");
aParam = new Object[2];
aParam[0] = cityCode;//按地域权限的
aParam[1] = areaCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**根据cityCode得到免责条款协议分页
*
* @param dbClient
* @param CityCode
* @return
*/
public DataTable getArticleByCityCode(DacClient dbClient,String cityCode,int pageNo) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
Object[] aParam = null;
sql.append("select ");
sql.append("d.ArticleId, ");
sql.append("d.ArticleType, ");
sql.append("d.AffairId, ");
sql.append("d.CityCode, ");
sql.append("d.AreaCode, ");
sql.append("d.Content, ");
sql.append("d.State ");
sql.append(" from ");
sql.append("(select c.*,rownum num from Td_Article c");
sql.append(" where c.CityCode=?)d ");
sql.append("where num>="+((pageNo - 1) * pageSize)+" and num<="+(pageNo * pageSize));
aParam = new Object[1];
aParam[0] = cityCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**根据areaCode得到免责条款协议分页
*
* @param dbClient
* @param CityCode
* @return
*/
public DataTable getArticleByAreaCode(DacClient dbClient,String areaCode,int pageNo) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select ");
sql.append("d.ArticleId, ");
sql.append("d.ArticleType, ");
sql.append("d.AffairId, ");
sql.append("d.CityCode, ");
sql.append("d.AreaCode, ");
sql.append("d.Content, ");
sql.append("d.State ");
sql.append(" from ");
sql.append("(select c.*,rownum num from Td_Article c");
Object[] aParam = null;
sql.append(" where c.AreaCode=?)d ");
sql.append("where num>="+((pageNo - 1) * pageSize)+" and num<="+(pageNo * pageSize));
aParam = new Object[1];
aParam[0] = areaCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**
* 通过cityCode的条件查询免责条款的页数
* @param dbClient
* @param cityCode
* @return
*/
public int getArticleCountByCity(DacClient dbClient,String cityCode) {
FileLogger.getLogger().debug(cityCode);
try {
int count = 0;
int pageNum = 0;
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select count(*) cnt from Td_Article");
Object[] aParam = null;
sql.append(" where citycode=?");
aParam = new Object[1];
aParam[0] = cityCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
for(int i=0;i<dt.getRows().getCount();i++){
count = Integer.parseInt(dt.getRow(i).getString("cnt"));
}
if((count%pageSize)==0){
pageNum = count/pageSize;
}
else{
pageNum = count/pageSize+1;
}
return pageNum;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**
* 通过areaCode的条件查询免责条款的页数
* @param dbClient
* @param cityCode
* @return
*/
public int getArticleCountByArea(DacClient dbClient,String areaCode) {
FileLogger.getLogger().debug(areaCode);
try {
int count = 0;
int pageNum = 0;
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select count(*) cnt from Td_Article");
Object[] aParam = null;
sql.append(" where areacode=?");
aParam = new Object[1];
aParam[0] = areaCode;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
for(int i=0;i<dt.getRows().getCount();i++){
count = Integer.parseInt(dt.getRow(i).getString("cnt"));
}
if((count%pageSize)==0){
pageNum = count/pageSize;
}
else{
pageNum = count/pageSize+1;
}
return pageNum;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**根据免责条款协议的ID找到协议信息
*
* @param dbClient
* @param ArticleId
* @return
*/
public DataTable getArticleById(DacClient dbClient,String ArticleId) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select ");
sql.append("ArticleType, ");
sql.append("AffairId, ");
sql.append("CityCode, ");
sql.append("Content, ");
sql.append("State ");
sql.append(" from ");
sql.append("Td_Article");
sql.append(" where ArticleId=?");
Object[] aParam = new Object[1];
aParam[0] = ArticleId;//按地域权限的
dt = dbClient.executeQuery(sql.toString(),aParam);
return dt;
}
catch (Exception ex) {
FileLogger.getLogger().warn(ex);
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/**根据免责条款协议地市得到地市名称
*
* @param dbClient
* @param CityCode
* @return
*/
public DataTable getCtiyofArticle(DacClient dbClient,String CityCode) {
try {
StringBuffer sql = new StringBuffer();
DataTable dt = null;
sql.append("select ");
sql.append("CityName ");
sql.append(" from ");
sql.append("td_city");
sql.append(" where CityCode=?");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -