|
@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
/**
|
|
|
* Created by trick on 2017/5/20
|
|
@ -62,7 +63,7 @@ public class WechatService {
|
|
|
|
|
|
//====================微信与租户管理=======================
|
|
|
|
|
|
public MixEnvelop getWxWechatList(String name,String saasName,Integer status,Integer publicType,Integer page,Integer size){
|
|
|
public MixEnvelop getWxWechatList(String name,String saasName,Integer status,Integer publicType,Integer page,Integer size,String wechatId){
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" w.id AS \"id\", " +
|
|
@ -72,7 +73,7 @@ public class WechatService {
|
|
|
" w.public_type AS \"publicType\"," +
|
|
|
" w.token AS \"token\"," +
|
|
|
" w.enc_type AS \"encType\"," +
|
|
|
" w.type as \"type\"," +
|
|
|
// " w.type as \"type\"," +
|
|
|
" w.app_id AS \"appId\"," +
|
|
|
" w.app_secret AS \"appSecret\"," +
|
|
|
" w.app_origin_id AS \"appOriginId\"," +
|
|
@ -106,8 +107,35 @@ public class WechatService {
|
|
|
if (StringUtils.isNotBlank(saasName)) {
|
|
|
sql += " AND bs.`name` like '%" + saasName + "%'";
|
|
|
}
|
|
|
sql += " LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
List<WxWechatVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxWechatVO.class));
|
|
|
|
|
|
|
|
|
|
|
|
List<WxWechatVO> list =null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String oracleSql="SELECT\n" +
|
|
|
"\t*\n" +
|
|
|
"FROM\n" +
|
|
|
"\t(\n" +
|
|
|
"\t\tSELECT\n" +
|
|
|
"\t\t\tA .*\n" +
|
|
|
"\t\tFROM\n" +
|
|
|
"\t\t\t(";
|
|
|
|
|
|
oracleSql+=sql;
|
|
|
|
|
|
oracleSql+="\t\t\t) A\n" +
|
|
|
"\t\tWHERE\n" +
|
|
|
" ROWNUM <="+page*size +
|
|
|
"\t) \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tROWNUM >= "+(page-1)*size;
|
|
|
Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
|
|
|
list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper(WxWechatVO.class));
|
|
|
}else {
|
|
|
sql += " LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
Logger.getAnonymousLogger().info("sql="+sql);
|
|
|
list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxWechatVO.class));
|
|
|
}
|
|
|
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(WxWechatVO wx :list){
|
|
@ -146,7 +174,7 @@ public class WechatService {
|
|
|
|
|
|
public List<WxSaasVO> getWxSaasVOs(String id){
|
|
|
String sql ="SELECT " +
|
|
|
" bs.`name` AS \"saasName\", " +
|
|
|
" bs.name AS \"saasName\", " +
|
|
|
" bs.id AS \"saasid\"" +
|
|
|
" FROM " +
|
|
|
" wx_wechat_saas s " +
|
|
@ -370,8 +398,33 @@ public class WechatService {
|
|
|
if(StringUtils.isNotBlank(scene)){
|
|
|
sql+= " AND g.scene = '"+scene+"' ORDER BY g.scene ASC ";
|
|
|
}
|
|
|
sql+=" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
List<WxGraphicMessageVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxGraphicMessageVO.class));
|
|
|
|
|
|
|
|
|
List<WxReplySceneVO> list=null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String oracleSql="SELECT\n" +
|
|
|
"\t*\n" +
|
|
|
"FROM\n" +
|
|
|
"\t(\n" +
|
|
|
"\t\tSELECT\n" +
|
|
|
"\t\t\tA .*\n" +
|
|
|
"\t\tFROM\n" +
|
|
|
"\t\t\t(";
|
|
|
|
|
|
oracleSql+=sql;
|
|
|
|
|
|
oracleSql+="\t\t\t) A\n" +
|
|
|
"\t\tWHERE\n" +
|
|
|
" ROWNUM <="+page*size +
|
|
|
"\t) \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tROWNUM >= "+(page-1)*size;
|
|
|
list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper(WxReplySceneVO.class));
|
|
|
}else {
|
|
|
sql+=" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxGraphicMessageVO.class));
|
|
|
}
|
|
|
|
|
|
return MixEnvelop.getSuccessListWithPage(BaseRequestMapping.WeChat.api_success, list, page, size, count);
|
|
|
}
|
|
|
|
|
@ -492,7 +545,7 @@ public class WechatService {
|
|
|
" s.wechat_id AS \"wechatId\"," +
|
|
|
" s.scene AS \"scene\", " +
|
|
|
" s.status as \"status\", " +
|
|
|
" s.id as \"id\", " +
|
|
|
// " s.id as \"id\", " +
|
|
|
" s.content as \"content\", " +
|
|
|
" s.app_origin_id AS \"appOriginId\", " +
|
|
|
" s.event as \"event\", " +
|
|
@ -514,9 +567,32 @@ public class WechatService {
|
|
|
if(status!=null){
|
|
|
sql += " AND s.status = "+status;
|
|
|
}
|
|
|
sql+=" ORDER BY s.create_time DESC LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
|
|
|
List<WxReplySceneVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxReplySceneVO.class));
|
|
|
List<WxReplySceneVO> list=null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String oracleSql="SELECT\n" +
|
|
|
"\t*\n" +
|
|
|
"FROM\n" +
|
|
|
"\t(\n" +
|
|
|
"\t\tSELECT\n" +
|
|
|
"\t\t\tA .*\n" +
|
|
|
"\t\tFROM\n" +
|
|
|
"\t\t\t(";
|
|
|
|
|
|
oracleSql+=sql;
|
|
|
|
|
|
oracleSql+="\t\t\t) A\n" +
|
|
|
"\t\tWHERE\n" +
|
|
|
" ROWNUM <="+page*size +
|
|
|
"\t) \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tROWNUM >= "+(page-1)*size;
|
|
|
list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper(WxReplySceneVO.class));
|
|
|
}else {
|
|
|
sql+=" ORDER BY s.create_time DESC LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxReplySceneVO.class));
|
|
|
}
|
|
|
|
|
|
return MixEnvelop.getSuccessListWithPage(BaseRequestMapping.WeChat.api_success, list, page, size, count);
|
|
|
}
|
|
|
|