xiongzhu 7 年 前
コミット
dc8fed227f
24 ファイル変更5395 行追加4955 行削除
  1. 5 1
      pom.xml
  2. 75 0
      runConfigurations/Tomcat.xml
  3. 23 24
      src/main/java/com/thmodel/constants/ActivityConstants.java
  4. 44 44
      src/main/java/com/thmodel/constants/Constants.java
  5. 72 73
      src/main/java/com/thmodel/constants/OrderConstants.java
  6. 45 44
      src/main/java/com/thmodel/constants/PayConstants.java
  7. 46 45
      src/main/java/com/thmodel/constants/Recursion.java
  8. 252 255
      src/main/java/com/thmodel/constants/SystemPayConstants.java
  9. 164 165
      src/main/java/com/thmodel/dao/impl/AccountRecordDaoImpl.java
  10. 231 228
      src/main/java/com/thmodel/dao/impl/CashRecordDaoImpl.java
  11. 25 25
      src/main/java/com/thmodel/dao/impl/DataTypeInfoDaoImpl.java
  12. 62 63
      src/main/java/com/thmodel/dao/impl/MemberSignDaoImpl.java
  13. 597 596
      src/main/java/com/thmodel/dao/impl/MemberinfoDaoImpl.java
  14. 1 1
      src/main/java/com/thmodel/dao/impl/ModelCardDaoImpl.java
  15. 1757 1753
      src/main/java/com/thmodel/dao/impl/ModelInfoDaoImpl.java
  16. 272 273
      src/main/java/com/thmodel/dao/impl/OrderRecordDaoImpl.java
  17. 236 247
      src/main/java/com/thmodel/dbconnection/DbConnection.java
  18. 309 0
      src/main/java/com/thmodel/dbconnection/FixedCachedRowSetImpl.java
  19. 58 61
      src/main/java/com/thmodel/entity/AccRecord.java
  20. 102 87
      src/main/java/com/thmodel/entity/AccountRecord.java
  21. 156 123
      src/main/java/com/thmodel/entity/BrokerInfor.java
  22. 126 102
      src/main/java/com/thmodel/entity/CashRecord.java
  23. 307 316
      src/main/java/com/thmodel/entity/ModelInfo.java
  24. 430 429
      src/main/java/com/thmodel/servlet/MemberInfoServlet.java

+ 5 - 1
pom.xml

@@ -186,6 +186,10 @@
             <artifactId>tomcat-util</artifactId>
             <version>8.5.34</version>
         </dependency>
-
+        <dependency>
+            <groupId>com.jfinal</groupId>
+            <artifactId>jfinal</artifactId>
+            <version>3.5</version>
+        </dependency>
     </dependencies>
 </project>

+ 75 - 0
runConfigurations/Tomcat.xml

@@ -0,0 +1,75 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="Tomcat" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 8.5.30" ALTERNATIVE_JRE_ENABLED="false">
+    <option name="OPEN_IN_BROWSER" value="false" />
+    <option name="UPDATING_POLICY" value="redeploy-artifacts" />
+    <deployment>
+      <artifact name="thmodel:war exploded">
+        <settings>
+          <option name="CONTEXT_PATH" value="/" />
+        </settings>
+      </artifact>
+    </deployment>
+    <server-settings>
+      <option name="BASE_DIRECTORY_NAME" value="Unnamed_thmodel_2" />
+    </server-settings>
+    <predefined_log_file id="Tomcat" enabled="true" />
+    <predefined_log_file id="Tomcat Catalina" enabled="true" />
+    <predefined_log_file id="Tomcat Manager" enabled="false" />
+    <predefined_log_file id="Tomcat Host Manager" enabled="false" />
+    <predefined_log_file id="Tomcat Localhost Access" enabled="false" />
+    <RunnerSettings RunnerId="Debug">
+      <option name="DEBUG_PORT" value="64278" />
+    </RunnerSettings>
+    <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
+      <option name="USE_ENV_VARIABLES" value="true" />
+      <STARTUP>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </STARTUP>
+      <SHUTDOWN>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </SHUTDOWN>
+    </ConfigurationWrapper>
+    <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
+      <option name="USE_ENV_VARIABLES" value="true" />
+      <STARTUP>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </STARTUP>
+      <SHUTDOWN>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </SHUTDOWN>
+    </ConfigurationWrapper>
+    <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
+      <option name="USE_ENV_VARIABLES" value="true" />
+      <STARTUP>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </STARTUP>
+      <SHUTDOWN>
+        <option name="USE_DEFAULT" value="true" />
+        <option name="SCRIPT" value="" />
+        <option name="VM_PARAMETERS" value="" />
+        <option name="PROGRAM_PARAMETERS" value="" />
+      </SHUTDOWN>
+    </ConfigurationWrapper>
+    <method v="2">
+      <option name="Make" enabled="true" />
+      <option name="BuildArtifacts" enabled="true">
+        <artifact name="thmodel:war exploded" />
+      </option>
+    </method>
+  </configuration>
+</component>

+ 23 - 24
src/main/java/com/thmodel/constants/ActivityConstants.java

@@ -2,33 +2,32 @@ package com.thmodel.constants;
 
 /**
  * @author 刘迎奥
- * @date 2018-08-09
  * @version v1.0
+ * @date 2018-08-09
  * @desc 活动常用 值
  */
 public class ActivityConstants {
 
-	public static final String ACTIVITY_DESC_1  		=  "已报名";
-	
-	public static final String ACTIVITY_DESC_2  		=  "未报名";
-	
-	public static final String ACTIVITY_DESC_3  		=  "余额不足";
-	
-	public static final String ACTIVITY_DESC_4  		=  "已签到";
-	
-	public static final String ACTIVITY_DESC_5  		=  "未签到";
-	
-	public static final String ACTIVITY_DESC_6  		=  "签到失败";
-	
-	public static final String ACTIVITY_DESC_7  		=  "不在活动报名时间内";
-	
-	
-	public static final String ACTIVITY_DESC_SUCCESS  	=  "报名成功";
-	
-	public static final String ACTIVITY_DESC_FAIL  		=  "报名失败";
-	
-	public static final String ACTIVITY_DESC_ERROR  	=  "报名异常";
-	
-	
-	
+    public static final String ACTIVITY_DESC_1 = "已报名";
+
+    public static final String ACTIVITY_DESC_2 = "未报名";
+
+    public static final String ACTIVITY_DESC_3 = "余额不足";
+
+    public static final String ACTIVITY_DESC_4 = "已签到";
+
+    public static final String ACTIVITY_DESC_5 = "未签到";
+
+    public static final String ACTIVITY_DESC_6 = "签到失败";
+
+    public static final String ACTIVITY_DESC_7 = "不在活动报名时间内";
+
+
+    public static final String ACTIVITY_DESC_SUCCESS = "报名成功";
+
+    public static final String ACTIVITY_DESC_FAIL = "报名失败";
+
+    public static final String ACTIVITY_DESC_ERROR = "报名异常";
+
+
 }

+ 44 - 44
src/main/java/com/thmodel/constants/Constants.java

@@ -1,48 +1,48 @@
 package com.thmodel.constants;
 
 public class Constants {
-	
-	//常用返回
-	public static final String success	 		= "success";
-	public static final String fail 			= "fail";
-	public static final String error 			= "error";
-	
-	//上传失败 返回
-	public static final String upload_fail 		= "{\"msg\":\""+ fail +"\"}";
-	
-	//参数标签类型
-	public static final String data_type_1 		= "地区";
-	public static final String data_type_2 		= "会员类别";
-	public static final String data_type_3 		= "会员等级";
-	public static final String data_type_4 		= "形象标签";
-	public static final String data_type_5 		= "技能标签";
-	
-	//异常头像
-	public static final String ERROR_IMG_HP2X 	= "errorimg/hp2x.png";
-	public static final String ERROR_IMG_LOAD2X = "errorimg/load2x.jpg";
-	
-	
-	//返回用户固定值
-	public static final String DESC_USER_0 		= "账号或密码不正确";
-	public static final String DESC_USER_1 		= "已注册用户端";
-	public static final String DESC_USER_2 		= "已注册模特端";
-	public static final String DESC_USER_3 		= "未注册模特端";
-	public static final String DESC_USER_4 		= "未注册用户端";
-	public static final String DESC_USER_5 		= "未注册";
-	public static final String DESC_USER_6 		= "已注册";
-	public static final String DESC_USER_7 		= "无效手机号";
-	public static final String DESC_USER_8 		= "无效邀请码";
-	
-	//账号MembType类型
-	public static final int MEMTYPE_PingTai 	= 11;  	//后台
-	public static final int MEMTYPE_JiGou 		= 9;    //机构
-	public static final int MEMTYPE_JinJiRen 	= 10; 	//推广 = 经纪人
-	public static final int MEMTYPE_Model 		= 7;    //模特,人才
-	public static final int MEMTYPE_HuiYuan 	= 8;   	//会员,消费者
-	
-	//模特在线状态
-	public static final int IS_A_OFFLINE 		= 0; 	//离线
-	public static final int IS_A_ONLINE			= 1; 	//在线
-	public static final int IS_A_BUSY 			= 2; 	//通话中
-	
+
+    //常用返回
+    public static final String success = "success";
+    public static final String fail    = "fail";
+    public static final String error   = "error";
+
+    //上传失败 返回
+    public static final String upload_fail = "{\"msg\":\"" + fail + "\"}";
+
+    //参数标签类型
+    public static final String data_type_1 = "地区";
+    public static final String data_type_2 = "会员类别";
+    public static final String data_type_3 = "会员等级";
+    public static final String data_type_4 = "形象标签";
+    public static final String data_type_5 = "技能标签";
+
+    //异常头像
+    public static final String ERROR_IMG_HP2X   = "errorimg/hp2x.png";
+    public static final String ERROR_IMG_LOAD2X = "errorimg/load2x.jpg";
+
+
+    //返回用户固定值
+    public static final String DESC_USER_0 = "账号或密码不正确";
+    public static final String DESC_USER_1 = "已注册用户端";
+    public static final String DESC_USER_2 = "已注册模特端";
+    public static final String DESC_USER_3 = "未注册模特端";
+    public static final String DESC_USER_4 = "未注册用户端";
+    public static final String DESC_USER_5 = "未注册";
+    public static final String DESC_USER_6 = "已注册";
+    public static final String DESC_USER_7 = "无效手机号";
+    public static final String DESC_USER_8 = "无效邀请码";
+
+    //账号MembType类型
+    public static final int MEMTYPE_PingTai  = 11;    //后台
+    public static final int MEMTYPE_JiGou    = 9;    //机构
+    public static final int MEMTYPE_JinJiRen = 10;    //推广 = 经纪人
+    public static final int MEMTYPE_Model    = 7;    //模特,人才
+    public static final int MEMTYPE_HuiYuan  = 8;    //会员,消费者
+
+    //模特在线状态
+    public static final int IS_A_OFFLINE = 0;    //离线
+    public static final int IS_A_ONLINE  = 1;    //在线
+    public static final int IS_A_BUSY    = 2;    //通话中
+
 }

+ 72 - 73
src/main/java/com/thmodel/constants/OrderConstants.java

@@ -2,84 +2,83 @@ package com.thmodel.constants;
 
 /**
  * @author 刘迎奥
- * @date 2018-07-25
  * @version v1.0
+ * @date 2018-07-25
  * @desc 订单状态   0未付款  1已付款  2客户取消  3模特接单  4模特取消  5订单结算  6超时对消
  * 注意:
  * 模特接单->必须要先付款
- * 
  */
 public class OrderConstants {
-	
-	/**
-	 * 客户下单(未付款)
-	 */
-	public static final String STATE_CODE_0 = "0";
-	
-	/**
-	 * 已付款
-	 */
-	public static final String STATE_CODE_1 = "1";
-	
-	/**
-	 * 客户取消
-	 */
-	public static final String STATE_CODE_2 = "2";
-	
-	/**
-	 * 模特接单
-	 */
-	public static final String STATE_CODE_3 = "3";
-	
-	/**
-	 * 模特取消
-	 */
-	public static final String STATE_CODE_4 = "4";
-	
-	/**
-	 * 订单结算
-	 */
-	public static final String STATE_CODE_5 = "5";
-	
-	/**
-	 * 超时对消
-	 */
-	public static final String STATE_CODE_6 = "6";
-	
 
-	
-	public static String getOrderState(String state_code) {
-		String stateStr = null;
-		switch (state_code) {
-		case "0":
-			stateStr = "未付款";
-			break;
-		case "1":
-			stateStr = "已付款";
-			break;
-		case "2":
-			stateStr = "客户取消";
-			break;
-		case "3":
-			stateStr = "模特接单";
-			break;
-		case "4":
-			stateStr = "模特取消";
-			break;
-		case "5":
-			stateStr = "订单结算";
-			break;
-		case "6":
-			stateStr = "超时对消";
-			break;
-		default:
-			System.out.println("订单状态码无效!");
-			break;
-		}
-		return stateStr;
-	}
-	public static void main(String[] args) {
-		String stateStr = getOrderState("");
-		System.out.println(stateStr);
-	}
+    /**
+     * 客户下单(未付款)
+     */
+    public static final String STATE_CODE_0 = "0";
+
+    /**
+     * 已付款
+     */
+    public static final String STATE_CODE_1 = "1";
+
+    /**
+     * 客户取消
+     */
+    public static final String STATE_CODE_2 = "2";
+
+    /**
+     * 模特接单
+     */
+    public static final String STATE_CODE_3 = "3";
+
+    /**
+     * 模特取消
+     */
+    public static final String STATE_CODE_4 = "4";
+
+    /**
+     * 订单结算
+     */
+    public static final String STATE_CODE_5 = "5";
+
+    /**
+     * 超时对消
+     */
+    public static final String STATE_CODE_6 = "6";
+
+
+    public static String getOrderState(String state_code) {
+        String stateStr = null;
+        switch (state_code) {
+            case "0":
+                stateStr = "未付款";
+                break;
+            case "1":
+                stateStr = "已付款";
+                break;
+            case "2":
+                stateStr = "客户取消";
+                break;
+            case "3":
+                stateStr = "模特接单";
+                break;
+            case "4":
+                stateStr = "模特取消";
+                break;
+            case "5":
+                stateStr = "订单结算";
+                break;
+            case "6":
+                stateStr = "超时对消";
+                break;
+            default:
+                System.out.println("订单状态码无效!");
+                break;
+        }
+        return stateStr;
+    }
+
+    public static void main(String[] args) {
+        String stateStr = getOrderState("");
+        System.out.println(stateStr);
+    }
 }

+ 45 - 44
src/main/java/com/thmodel/constants/PayConstants.java

@@ -2,52 +2,53 @@ package com.thmodel.constants;
 
 /**
  * @author 刘迎奥
- * @date 2018-07-24
  * @version v1.0
+ * @date 2018-07-24
  * @desc 支付状态
  */
 public class PayConstants {
-	
-	//类型
-	public  static  final  String  TYPE_WX 			= "微信";
-
-	public  static  final  String  TYPE_ALIPAY 		= "支付宝";
-	
-	//状态
-	public  static  final  String  STATE_1  =  "待支付";
-
-	public  static  final  String  STATE_2  =  "已支付";
-
-	public  static  final  String  STATE_3  =  "支付失败";// 没有通知后台
-
-	public  static  final  String  STATE_4  =  "待提现";
-
-	public  static  final  String  STATE_5  =  "已提现";
-
-	public  static  final  String  STATE_6  =  "提现失败";
-	
-	public  static  final  String  STATE_7  =  "取消";
-
-	
-	/**
-	 * 0:参数错误 1:提交成功 2:余额不足 3:提交失败(参数错误)
-	 * 支付宝提现
-	 * service
-	 * aliPayOutCash
-	 * @param code
-	 */
-	public static String getSubmitCode(int code) {
-		if (code == 0) {
-			return "参数错误";
-		} else if (code == 1) {
-			return "提交成功";
-		} else if (code == 2) {
-			return "余额不足";
-		} else if (code == 3) {
-			return "提交失败";
-		} else {
-			return "参数错误";
-		}
-	}
-	
+
+    //类型
+    public static final String TYPE_WX = "微信";
+
+    public static final String TYPE_ALIPAY = "支付宝";
+
+    //状态
+    public static final String STATE_1 = "待支付";
+
+    public static final String STATE_2 = "已支付";
+
+    public static final String STATE_3 = "支付失败";// 没有通知后台
+
+    public static final String STATE_4 = "待提现";
+
+    public static final String STATE_5 = "已提现";
+
+    public static final String STATE_6 = "提现失败";
+
+    public static final String STATE_7 = "取消";
+
+
+    /**
+     * 0:参数错误 1:提交成功 2:余额不足 3:提交失败(参数错误)
+     * 支付宝提现
+     * service
+     * aliPayOutCash
+     *
+     * @param code
+     */
+    public static String getSubmitCode(int code) {
+        if (code == 0) {
+            return "参数错误";
+        } else if (code == 1) {
+            return "提交成功";
+        } else if (code == 2) {
+            return "余额不足";
+        } else if (code == 3) {
+            return "提交失败";
+        } else {
+            return "参数错误";
+        }
+    }
+
 }

+ 46 - 45
src/main/java/com/thmodel/constants/Recursion.java

@@ -12,49 +12,50 @@ import com.thmodel.util.MyDateUtil;
  * 递归方法
  */
 public class Recursion {
-	
-	//-------------------------------------------------- 私密空间 评论列表 begin--------------------------------------------------
-	//根目录
-	public static List<Map<String, Object>> getRecordInfo(List<ModelPrivateDiscuss> privateDiscussList){
-		List<Map<String, Object>> recordInfoList = new ArrayList<Map<String, Object>>();
-		for (ModelPrivateDiscuss mpd : privateDiscussList) {
-			//Isgood == 0  是评论
-			if(mpd.getParentpk() <= 0 && mpd.getIsgood()==0){
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("recordinfopk", mpd.getPk());
-				map.put("memberpk", mpd.getMemberpk());
-				map.put("idate", MyDateUtil.format( mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
-				map.put("isgood", mpd.getIsgood());
-				map.put("intro", mpd.getIntro());
-				
-				map.put("recordinfo", childrenRecordInfo(privateDiscussList, mpd.getPk()));
-				
-				recordInfoList.add(map);
-			}
-		}
-		return recordInfoList;
-	}
-	//子目录
-	public static List<Map<String, Object>> childrenRecordInfo(List<ModelPrivateDiscuss> privateDiscussList, int parentpk){
-		List<Map<String, Object>> recordInfoList = new ArrayList<Map<String, Object>>();
-		for (ModelPrivateDiscuss mpd : privateDiscussList) {
-			//Isgood == 0  是评论
-			if(parentpk == mpd.getParentpk() && mpd.getIsgood()==0){
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("recordinfopk", mpd.getPk());
-				map.put("memberpk", mpd.getMemberpk());
-				map.put("idate", MyDateUtil.format( mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
-				map.put("isgood", mpd.getIsgood());
-				map.put("intro", mpd.getIntro());
-				
-				map.put("recordinfo", childrenRecordInfo(privateDiscussList, mpd.getPk()));
-				
-				recordInfoList.add(map);
-			}
-		}
-		return recordInfoList;
-	}
-	//-------------------------------------------------- 私密空间 评论列表 end--------------------------------------------------
-	
-	
+
+    //-------------------------------------------------- 私密空间 评论列表 begin--------------------------------------------------
+    //根目录
+    public static List<Map<String, Object>> getRecordInfo(List<ModelPrivateDiscuss> privateDiscussList) {
+        List<Map<String, Object>> recordInfoList = new ArrayList<Map<String, Object>>();
+        for (ModelPrivateDiscuss mpd : privateDiscussList) {
+            //Isgood == 0  是评论
+            if (mpd.getParentpk() <= 0 && mpd.getIsgood() == 0) {
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("recordinfopk", mpd.getPk());
+                map.put("memberpk", mpd.getMemberpk());
+                map.put("idate", MyDateUtil.format(mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
+                map.put("isgood", mpd.getIsgood());
+                map.put("intro", mpd.getIntro());
+
+                map.put("recordinfo", childrenRecordInfo(privateDiscussList, mpd.getPk()));
+
+                recordInfoList.add(map);
+            }
+        }
+        return recordInfoList;
+    }
+
+    //子目录
+    public static List<Map<String, Object>> childrenRecordInfo(List<ModelPrivateDiscuss> privateDiscussList, int parentpk) {
+        List<Map<String, Object>> recordInfoList = new ArrayList<Map<String, Object>>();
+        for (ModelPrivateDiscuss mpd : privateDiscussList) {
+            //Isgood == 0  是评论
+            if (parentpk == mpd.getParentpk() && mpd.getIsgood() == 0) {
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("recordinfopk", mpd.getPk());
+                map.put("memberpk", mpd.getMemberpk());
+                map.put("idate", MyDateUtil.format(mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
+                map.put("isgood", mpd.getIsgood());
+                map.put("intro", mpd.getIntro());
+
+                map.put("recordinfo", childrenRecordInfo(privateDiscussList, mpd.getPk()));
+
+                recordInfoList.add(map);
+            }
+        }
+        return recordInfoList;
+    }
+    //-------------------------------------------------- 私密空间 评论列表 end--------------------------------------------------
+
+
 }

+ 252 - 255
src/main/java/com/thmodel/constants/SystemPayConstants.java

@@ -13,262 +13,259 @@ import com.thmodel.result.ResultProcedure;
 
 /**
  * @author 刘迎奥
- * @date 2018-07-27
  * @version v2.0
+ * @date 2018-07-27
  * @desc 系统平台支付
  */
 public class SystemPayConstants {
-	
-	private static MemberinfoDao 	memberinfoDao	= new MemberinfoDaoImpl();
-	
-	public static final String PROCEDURE_TABLENAME_REDPACKET 		= "RedPacket";		//红包 
-	public static final String PROCEDURE_TABLENAME_VIDEORECORD 		= "VideoRecord";	//视频聊天     ---
-	public static final String PROCEDURE_TABLENAME_ORDERRECORD 		= "OrderRecord";	//商业订单 
-	public static final String PROCEDURE_TABLENAME_PARTTYSIGN 		= "ParttySign";		//活动
-	public static final String PROCEDURE_TABLENAME_CASHRECORD	 	= "CashRecord";		//充值 , 提现
-	
-	public ResultProcedure procedure(String tablename, int pk) {
-		
-		// 各不同业务调用案例:
-		/*
-		 * call CoinShare('RedPacket',120) 		//红包 
-		 * call CoinShare('VideoRecord',82) 	//视频聊天
-		 * call CoinShare('OrderRecord',237) 	//商业订单 
-		 * call CoinShare('ParttySign',33) 		//活动
-		 * call CoinShare('CashRecord',101) 	//充值
-		 * call CoinShare('CashRecord',102) 	//提现
-		 * 
-		 */
-		
-		if (tablename != null && !tablename.equals("") && pk > 0) {
-			ResultProcedure rp = new ResultProcedure();
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery("call CoinShare('"+tablename+"', "+pk+") ");
-			try {
-				if (rs == null)
-					System.out.print(db.LastError);
-				else if (rs.next()) {
-					int result = rs.getInt("result"); // <0表示失败, =0成功, >0表示已经计算过,无需重复计算
-					String message = rs.getString("mess"); // <0[错误原因], =0['success'], >0['当前业务已经出来的提示内容']
-					rp.setResult(result);
-					rp.setMessage(message);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-			} finally {
-				db.close(rs);
-			}
-			return rp;
-		} else {
-			return null;
-		}
-	}
-	
-	
-	/**
-	 * 添加冻结金额
-	 * @param memberpk
-	 * @param coin
-	 * @return
-	 */
-	public boolean executeYuZhi_add(int memberpk, double coin) {
-		MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
-		if(memberpk > 0 && coin > 0) {
-			//可用金额
-			double coin_enable = member.getCoin_a() - member.getCoin_oi();
-			if(coin <= coin_enable) {
-				String sql = "update memberinfo set coin_OI = ifnull(coin_OI, 0) + "+coin+" where ifnull(coin_A, 0) - ifnull(coin_OI, 0) >= "+coin+" and pk = " + memberpk;
-				DbConnection db = new DbConnection();
-				int rows = db.executeUpdate(sql);
-				if(rows > 0) {
-					return true;
-				}
-			} else {
-				throw new Error("余额不足!payMemberpk为 "+memberpk+"账户   支付币额 :"+coin+", 币额为:"+member.getCoin_a());
-			}
-		}
-		return false;
-	}
-	/**
-	 * 减去冻结金额
-	 * @param memberpk
-	 * @param coin
-	 * @return
-	 */
-	public boolean executeYuZhi_minus(int memberpk, double coin) {
-		MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
-		if(memberpk > 0 && coin > 0) {
-			//可用金额
-			double coin_enable = member.getCoin_a() - member.getCoin_oi();
-			if(coin <= coin_enable) {
-				String sql = "update memberinfo set coin_OI = ifnull(coin_OI, 0) - "+coin+" where ifnull(coin_OI, 0)>= "+coin+" and pk = " + memberpk;
-				DbConnection db = new DbConnection();
-				int rows = db.executeUpdate(sql);
-				if(rows > 0) {
-					return true;
-				}
-			} else {
-				throw new Error("余额不足!payMemberpk为 "+memberpk+"账户   支付币额 :"+coin+", 币额为:"+member.getCoin_a());
-			}
-		}
-		return false;
-	}
-	
-	
-	
-	
-	
-	
-	
-	
-	/**
-	 * 系统平台 公共支付方法
-	 * @param payMemberpk 付款者 会员pk
-	 * @param incomeMemberpk 收入者 会员pk
-	 * @param payType 付款方式 1:余额   2:预支
-	 * @param coin 付款金额   
-	 * @return
-	 */
-	public boolean systemPay(int payMemberpk, int incomeMemberpk, int payType, double coin) {
-		
-		//两个会员账号不能  小于0
-		if(payMemberpk > 0 && incomeMemberpk > 0) {
-			
-			if(payType == 1 || payType == 2) {
-				MemberInfo payMember = memberinfoDao.findMemberinfoByPK(payMemberpk);
-				
-				//余额付款
-				if(payType == 1) {
-					
-					if(coin <= payMember.getCoin_a()) {
-						
-						String sql = "update MemberInfo set coin_a = ifnull(coin_a, 0) - "+ coin +" where coin_A >= "+coin+" and pk = '"+payMemberpk+"' ";
-						DbConnection db = new DbConnection();
-						int rows = db.executeUpdate(sql);
-						if(rows > 0) {
-							String sql_2= "update MemberInfo set coin_a = ifnull(coin_a, 0) + "+ coin +" where pk = '"+incomeMemberpk+"' ";
-							DbConnection db_2 = new DbConnection();
-							int rows_2 = db_2.executeUpdate(sql_2);
-							if(rows_2 > 0) {
-								return true;
-							} else {
-								//回滚
-								String sql_3 = "update MemberInfo set coin_a = ifnull(coin_a, 0) + "+ coin +" where coin_A >= "+coin+" and pk = '"+payMemberpk+"' ";
-								DbConnection db_3 = new DbConnection();
-								int rows_3 = db_3.executeUpdate(sql_3);
-								if(rows_3 > 0) {
-									System.out.println("数据回滚成功!");
-								} else {
-									System.out.println("数据回滚失败!");
-								}
-							}
-						}
-						
-					}else {
-						throw new Error("余额不足!payMemberpk为 "+payMemberpk+"账户   支付 :"+coin+", 余额为:"+payMember.getCoin_a());
-					}
-				}
-				//预支金额付款
-				else if(payType == 2) {
-					if(coin <= payMember.getCoin_oi()) {
-						String sql = "update MemberInfo set coin_oi = ifnull(coin_oi, 0) - "+ coin +" where coin_oi >= "+coin+" and pk = '"+payMemberpk+"' ";
-						DbConnection db = new DbConnection();
-						int rows = db.executeUpdate(sql);
-						if(rows > 0) {
-							String sql_2= "update MemberInfo set coin_a = ifnull(coin_a, 0) + "+ coin +" where pk = '"+incomeMemberpk+"' ";
-							DbConnection db_2 = new DbConnection();
-							int rows_2 = db_2.executeUpdate(sql_2);
-							if(rows_2 > 0) {
-								return true;
-							} else {
-								//回滚
-								String sql_3 = "update MemberInfo set coin_oi = ifnull(coin_oi, 0) + "+ coin +" where coin_oi >= "+coin+" and pk = '"+payMemberpk+"' ";
-								DbConnection db_3 = new DbConnection();
-								int rows_3 = db_3.executeUpdate(sql_3);
-								if(rows_3 > 0) {
-									System.out.println("数据回滚成功!");
-								} else {
-									System.out.println("数据回滚失败!");
-								}
-							}
-						}
-					}else {
-						throw new Error("预支余额不足!payMemberpk为 "+payMemberpk+"账户   支付预支币额 :"+coin+", 预支币额为:"+payMember.getCoin_a());
-					}
-				}
-			}else {
-				throw new Error("参数:payType 必须是 1 和 2 ,  输入参数为 payType: " + payType);
-			}
-		}
-		return false;
-	}
-	
 
-	
-	
-	
-	
-	/**
-	 * 走预支支付
-	 * 把余额里面的金额放到 预支付里面
-	 * @param memberpk
-	 * @param coin
-	 * @return
-	 */
-	public boolean executeYuZhi_Disable(int memberpk, double coin) {
-		MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
-		if(memberpk > 0 && coin > 0) {
-			if(coin <= member.getCoin_a()) {
-				String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) - "+coin+", coin_OI = ifnull(coin_OI, 0) + "+coin+" where coin_A >= "+coin+" and pk = " + memberpk;
-				DbConnection db = new DbConnection();
-				int rows = db.executeUpdate(sql);
-				if(rows > 0) {
-					return true;
-				}
-			} else {
-				throw new Error("余额不足!payMemberpk为 "+memberpk+"账户   支付币额 :"+coin+", 币额为:"+member.getCoin_a());
-			}
-		}
-		return false;
-	}
-	
-	/**
-	 * 添加系统账单记录
-	 * @param ar
-	 * @return
-	 */
-	public boolean insertAccountRecord(AccountRecord ar) {
-		
-		String sql_3 = String.format("insert into AccountRecord(MemberPK, ADate, SType, LinkPK, AType, Coin, abstract)values('%s', now(), '%s', '%s', '%s', '%s', '%s')", 
-										ar.getMemberpk(), ar.getStype(), ar.getLinkpk(), ar.getAtype(), ar.getCoin(), ar.getAbs());
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql_3);
-		if(rows > 0) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-	
-	/**
-	 * 报名活动,支付
-	 * @param memberpk
-	 * @param fee
-	 * @return
-	 */
-	public boolean payToActivity_Disable(int memberpk, double fee) {
-		String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) - "+ fee +", coin_OP = ifnull(coin_OP, 0) - "+fee+"  where pk = "+memberpk+"  and coin_A >= "+fee;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		if(rows > 0) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-	
-	public static void main(String[] args) {
+    private static MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+
+    public static final String PROCEDURE_TABLENAME_REDPACKET   = "RedPacket";        //红包
+    public static final String PROCEDURE_TABLENAME_VIDEORECORD = "VideoRecord";    //视频聊天     ---
+    public static final String PROCEDURE_TABLENAME_ORDERRECORD = "OrderRecord";    //商业订单
+    public static final String PROCEDURE_TABLENAME_PARTTYSIGN  = "ParttySign";        //活动
+    public static final String PROCEDURE_TABLENAME_CASHRECORD  = "CashRecord";        //充值 , 提现
+
+    public ResultProcedure procedure(String tablename, int pk) {
+
+        // 各不同业务调用案例:
+        /*
+         * call CoinShare('RedPacket',120) 		//红包
+         * call CoinShare('VideoRecord',82) 	//视频聊天
+         * call CoinShare('OrderRecord',237) 	//商业订单
+         * call CoinShare('ParttySign',33) 		//活动
+         * call CoinShare('CashRecord',101) 	//充值
+         * call CoinShare('CashRecord',102) 	//提现
+         *
+         */
+
+        if (tablename != null && !tablename.equals("") && pk > 0) {
+            ResultProcedure rp = new ResultProcedure();
+            DbConnection    db = new DbConnection();
+            CachedRowSet    rs = db.executeQuery("call CoinShare('" + tablename + "', " + pk + ") ");
+            try {
+                if (rs == null)
+                    System.out.print(db.LastError);
+                else if (rs.next()) {
+                    int    result  = rs.getInt("result"); // <0表示失败, =0成功, >0表示已经计算过,无需重复计算
+                    String message = rs.getString("mess"); // <0[错误原因], =0['success'], >0['当前业务已经出来的提示内容']
+                    rp.setResult(result);
+                    rp.setMessage(message);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                db.close(rs);
+            }
+            return rp;
+        } else {
+            return null;
+        }
+    }
+
+
+    /**
+     * 添加冻结金额
+     *
+     * @param memberpk
+     * @param coin
+     * @return
+     */
+    public boolean executeYuZhi_add(int memberpk, double coin) {
+        MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
+        if (memberpk > 0 && coin > 0) {
+            //可用金额
+            double coin_enable = member.getCoin_a() - member.getCoin_oi();
+            if (coin <= coin_enable) {
+                String       sql  = "update memberinfo set coin_OI = ifnull(coin_OI, 0) + " + coin + " where ifnull(coin_A, 0) - ifnull(coin_OI, 0) >= " + coin + " and pk = " + memberpk;
+                DbConnection db   = new DbConnection();
+                int          rows = db.executeUpdate(sql);
+                if (rows > 0) {
+                    return true;
+                }
+            } else {
+                throw new Error("余额不足!payMemberpk为 " + memberpk + "账户   支付币额 :" + coin + ", 币额为:" + member.getCoin_a());
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 减去冻结金额
+     *
+     * @param memberpk
+     * @param coin
+     * @return
+     */
+    public boolean executeYuZhi_minus(int memberpk, double coin) {
+        MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
+        if (memberpk > 0 && coin > 0) {
+            //可用金额
+            double coin_enable = member.getCoin_a() - member.getCoin_oi();
+            if (coin <= coin_enable) {
+                String       sql  = "update memberinfo set coin_OI = ifnull(coin_OI, 0) - " + coin + " where ifnull(coin_OI, 0)>= " + coin + " and pk = " + memberpk;
+                DbConnection db   = new DbConnection();
+                int          rows = db.executeUpdate(sql);
+                if (rows > 0) {
+                    return true;
+                }
+            } else {
+                throw new Error("余额不足!payMemberpk为 " + memberpk + "账户   支付币额 :" + coin + ", 币额为:" + member.getCoin_a());
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * 系统平台 公共支付方法
+     *
+     * @param payMemberpk    付款者 会员pk
+     * @param incomeMemberpk 收入者 会员pk
+     * @param payType        付款方式 1:余额   2:预支
+     * @param coin           付款金额
+     * @return
+     */
+    public boolean systemPay(int payMemberpk, int incomeMemberpk, int payType, double coin) {
+
+        //两个会员账号不能  小于0
+        if (payMemberpk > 0 && incomeMemberpk > 0) {
+
+            if (payType == 1 || payType == 2) {
+                MemberInfo payMember = memberinfoDao.findMemberinfoByPK(payMemberpk);
+
+                //余额付款
+                if (payType == 1) {
+
+                    if (coin <= payMember.getCoin_a()) {
+
+                        String       sql  = "update MemberInfo set coin_a = ifnull(coin_a, 0) - " + coin + " where coin_A >= " + coin + " and pk = '" + payMemberpk + "' ";
+                        DbConnection db   = new DbConnection();
+                        int          rows = db.executeUpdate(sql);
+                        if (rows > 0) {
+                            String       sql_2  = "update MemberInfo set coin_a = ifnull(coin_a, 0) + " + coin + " where pk = '" + incomeMemberpk + "' ";
+                            DbConnection db_2   = new DbConnection();
+                            int          rows_2 = db_2.executeUpdate(sql_2);
+                            if (rows_2 > 0) {
+                                return true;
+                            } else {
+                                //回滚
+                                String       sql_3  = "update MemberInfo set coin_a = ifnull(coin_a, 0) + " + coin + " where coin_A >= " + coin + " and pk = '" + payMemberpk + "' ";
+                                DbConnection db_3   = new DbConnection();
+                                int          rows_3 = db_3.executeUpdate(sql_3);
+                                if (rows_3 > 0) {
+                                    System.out.println("数据回滚成功!");
+                                } else {
+                                    System.out.println("数据回滚失败!");
+                                }
+                            }
+                        }
+
+                    } else {
+                        throw new Error("余额不足!payMemberpk为 " + payMemberpk + "账户   支付 :" + coin + ", 余额为:" + payMember.getCoin_a());
+                    }
+                }
+                //预支金额付款
+                else if (payType == 2) {
+                    if (coin <= payMember.getCoin_oi()) {
+                        String       sql  = "update MemberInfo set coin_oi = ifnull(coin_oi, 0) - " + coin + " where coin_oi >= " + coin + " and pk = '" + payMemberpk + "' ";
+                        DbConnection db   = new DbConnection();
+                        int          rows = db.executeUpdate(sql);
+                        if (rows > 0) {
+                            String       sql_2  = "update MemberInfo set coin_a = ifnull(coin_a, 0) + " + coin + " where pk = '" + incomeMemberpk + "' ";
+                            DbConnection db_2   = new DbConnection();
+                            int          rows_2 = db_2.executeUpdate(sql_2);
+                            if (rows_2 > 0) {
+                                return true;
+                            } else {
+                                //回滚
+                                String       sql_3  = "update MemberInfo set coin_oi = ifnull(coin_oi, 0) + " + coin + " where coin_oi >= " + coin + " and pk = '" + payMemberpk + "' ";
+                                DbConnection db_3   = new DbConnection();
+                                int          rows_3 = db_3.executeUpdate(sql_3);
+                                if (rows_3 > 0) {
+                                    System.out.println("数据回滚成功!");
+                                } else {
+                                    System.out.println("数据回滚失败!");
+                                }
+                            }
+                        }
+                    } else {
+                        throw new Error("预支余额不足!payMemberpk为 " + payMemberpk + "账户   支付预支币额 :" + coin + ", 预支币额为:" + payMember.getCoin_a());
+                    }
+                }
+            } else {
+                throw new Error("参数:payType 必须是 1 和 2 ,  输入参数为 payType: " + payType);
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * 走预支支付
+     * 把余额里面的金额放到 预支付里面
+     *
+     * @param memberpk
+     * @param coin
+     * @return
+     */
+    public boolean executeYuZhi_Disable(int memberpk, double coin) {
+        MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
+        if (memberpk > 0 && coin > 0) {
+            if (coin <= member.getCoin_a()) {
+                String       sql  = "update memberinfo set coin_A = ifnull(coin_A, 0) - " + coin + ", coin_OI = ifnull(coin_OI, 0) + " + coin + " where coin_A >= " + coin + " and pk = " + memberpk;
+                DbConnection db   = new DbConnection();
+                int          rows = db.executeUpdate(sql);
+                if (rows > 0) {
+                    return true;
+                }
+            } else {
+                throw new Error("余额不足!payMemberpk为 " + memberpk + "账户   支付币额 :" + coin + ", 币额为:" + member.getCoin_a());
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 添加系统账单记录
+     *
+     * @param ar
+     * @return
+     */
+    public boolean insertAccountRecord(AccountRecord ar) {
+
+        String sql_3 = String.format("insert into AccountRecord(MemberPK, ADate, SType, LinkPK, AType, Coin, abstract)values('%s', now(), '%s', '%s', '%s', '%s', '%s')",
+                ar.getMemberpk(), ar.getStype(), ar.getLinkpk(), ar.getAtype(), ar.getCoin(), ar.getAbs());
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql_3);
+        if (rows > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 报名活动,支付
+     *
+     * @param memberpk
+     * @param fee
+     * @return
+     */
+    public boolean payToActivity_Disable(int memberpk, double fee) {
+        String       sql  = "update memberinfo set coin_A = ifnull(coin_A, 0) - " + fee + ", coin_OP = ifnull(coin_OP, 0) - " + fee + "  where pk = " + memberpk + "  and coin_A >= " + fee;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        if (rows > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static void main(String[] args) {
 		/*SystemPay systemPay = new SystemPay();
 		systemPay.setCoin(99);
 		systemPay.setPayMemberpk(1);
@@ -286,8 +283,8 @@ public class SystemPayConstants {
 		/*AccountRecord ar = new AccountRecord();
 		boolean flag = insertAccountRecord(ar);
 		System.out.println(flag);*/
-		
-	}
-	
-	
+
+    }
+
+
 }

+ 164 - 165
src/main/java/com/thmodel/dao/impl/AccountRecordDaoImpl.java

@@ -18,169 +18,168 @@ import com.thmodel.page.Page;
 
 public class AccountRecordDaoImpl implements AccountRecordDao {
 
-	@Override
-	public double findTodayIncome(int memberpk) {
-		double sumCoin = 0;
-		try {
-			String currentDate = MyDateUtil.format(new Date(), MyDateUtil.DATE_FORMAT_2);
-			
-			//收入状态
-			String sql_where_AType  = "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_1 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_2 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_3 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_4 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_5 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_6 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_0 + "' or "
-									+ "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_7 + "'"
-									;
-			
-			String sql = "select * from ("
-						+ " select sum(coin) from accountrecord where memberpk = '"+memberpk+"' "
-						+ " and("+sql_where_AType+") "
-						+ " and ADate >= '"+currentDate+" 00:00:00' "
-						+ " and ADate <= '"+currentDate+" 23:59:59' "
-						+ " )t1";
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				sumCoin = rs.getDouble(1);
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return sumCoin;
-	}
-
-	@Override
-	public List findAccountRecordBymemberpkAndAType(int memberpk, String atype) {
-		List<AccountRecord> list = new ArrayList<AccountRecord>();
-		try {
-			String sql = "select * from AccountRecord where MemberPK = '"+memberpk+"' and AType = '"+atype+"' ";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null) {
-				while(rs.next()) {
-					AccountRecord ar = new AccountRecord();
-					ar.setPk(rs.getInt("pk"));
-					ar.setMemberpk(rs.getInt("memberpk"));
-					ar.setAdate(rs.getDate("adate"));
-					ar.setStype(rs.getString("stype"));
-					ar.setLinkpk(rs.getInt("linkpk"));
-					ar.setAtype(rs.getString("atype"));
-					ar.setCoin(rs.getDouble("coin"));
-					ar.setAbs(rs.getString("abstract"));
-					list.add(ar);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return list;
-	}
-	
-	public Page<List<AccountRecord>> findAccountRecordByMemberpkSTypeAType(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes, int index, int size) {
-		Page<List<AccountRecord>> page = new Page<List<AccountRecord>>();
-		
-		List<AccountRecord> list = new ArrayList<AccountRecord>();
-		try {
-			String sql = "select * from AccountRecord where MemberPK = '"+memberpk+"' ";
-			if(beginDate != null && !beginDate.equals("")) {
-				sql += " and ADate>= '"+beginDate+"' ";
-			}
-			if(endDate != null && !endDate.equals("")) {
-				sql += " and ADate<= '"+endDate+"' ";
-			}
-			
-			if(stypes != null && stypes.length > 0) {
-				String stypeWhere = " and (";
-				for (String stype : stypes) {
-					stypeWhere += " stype = '"+stype+"' or ";
-				}
-				stypeWhere = stypeWhere.substring(0, stypeWhere.lastIndexOf("or"));
-				stypeWhere += ")";
-				sql += stypeWhere ; 
-			}
-			if(atypes != null && atypes.length > 0) {
-				String atypeWhere = " and (";
-				for (String atype : atypes) {
-					atypeWhere += " atype = '"+atype+"' or ";
-				}
-				atypeWhere = atypeWhere.substring(0, atypeWhere.lastIndexOf("or"));
-				atypeWhere += ")";
-				sql += atypeWhere ; 
-			}
-			sql += " order by ADate desc";
-			
-			// 获取分页总数量
-			String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
-			int count = new DbConnection().queryOneCount(sqlPageCount);
-			page.setCount(count);
-			
-			//分页
-			String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs != null) {
-				while(rs.next()) {
-					AccountRecord ar = new AccountRecord();
-					ar.setPk(rs.getInt("pk"));
-					ar.setMemberpk(rs.getInt("memberpk"));
-					ar.setAdate(rs.getDate("adate"));
-					ar.setStype(rs.getString("stype"));
-					ar.setLinkpk(rs.getInt("linkpk"));
-					ar.setAtype(rs.getString("atype"));
-					ar.setCoin(rs.getDouble("coin"));
-					ar.setAbs(rs.getString("abstract"));
-					list.add(ar);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		page.setData(list);
-		return page;
-	}
-
-	@Override
-	public double findIncome(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes) {
-		String sql = "select sum(coin) as sum1 from AccountRecord where MemberPK = '"+memberpk+"' ";
-		
-		if(beginDate != null && !beginDate.equals("")) {
-			sql += " and ADate>= '"+beginDate+"' ";
-		}
-		if(endDate != null && !endDate.equals("")) {
-			sql += " and ADate<= '"+endDate+"' ";
-		}
-		if(stypes != null && stypes.length > 0) {
-			String stypeWhere = " and (";
-			for (String stype : stypes) {
-				stypeWhere += " stype = '"+stype+"' or ";
-			}
-			stypeWhere = stypeWhere.substring(0, stypeWhere.lastIndexOf("or"));
-			stypeWhere += ")";
-			sql += stypeWhere ; 
-		}
-		if(atypes != null && atypes.length > 0) {
-			String atypeWhere = " and (";
-			for (String atype : atypes) {
-				atypeWhere += " atype = '"+atype+"' or ";
-			}
-			atypeWhere = atypeWhere.substring(0, atypeWhere.lastIndexOf("or"));
-			atypeWhere += ")";
-			sql += atypeWhere ; 
-		}
-		sql = "select * from ("+sql+")table0_";
-		DbConnection db = new DbConnection();
-		String sumStr = db.queryOneString(sql);
-		if(sumStr==null || sumStr.equals("")) {
-			sumStr = "0";
-		}
-		double sum =  Double.parseDouble(sumStr);
-		return sum;
-	}
+    @Override
+    public double findTodayIncome(int memberpk) {
+        double sumCoin = 0;
+        try {
+            String currentDate = MyDateUtil.format(new Date(), MyDateUtil.DATE_FORMAT_2);
+
+            //收入状态
+            String sql_where_AType = "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_1 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_2 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_3 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_4 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_5 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_6 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_0 + "' or "
+                    + "AType='" + AccountConstants.ACCOUNTRECORD_A_TYPE_7 + "'";
+
+            String sql = "select * from ("
+                    + " select sum(coin) from accountrecord where memberpk = '" + memberpk + "' "
+                    + " and(" + sql_where_AType + ") "
+                    + " and ADate >= '" + currentDate + " 00:00:00' "
+                    + " and ADate <= '" + currentDate + " 23:59:59' "
+                    + " )t1";
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                sumCoin = rs.getDouble(1);
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return sumCoin;
+    }
+
+    @Override
+    public List findAccountRecordBymemberpkAndAType(int memberpk, String atype) {
+        List<AccountRecord> list = new ArrayList<AccountRecord>();
+        try {
+            String       sql = "select * from AccountRecord where MemberPK = '" + memberpk + "' and AType = '" + atype + "' ";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    AccountRecord ar = new AccountRecord();
+                    ar.setPk(rs.getInt("pk"));
+                    ar.setMemberpk(rs.getInt("memberpk"));
+                    ar.setAdate(rs.getDate("adate"));
+                    ar.setStype(rs.getString("stype"));
+                    ar.setLinkpk(rs.getInt("linkpk"));
+                    ar.setAtype(rs.getString("atype"));
+                    ar.setCoin(rs.getDouble("coin"));
+                    ar.setAbs(rs.getString("abstract"));
+                    list.add(ar);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    public Page<List<AccountRecord>> findAccountRecordByMemberpkSTypeAType(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes, int index, int size) {
+        Page<List<AccountRecord>> page = new Page<List<AccountRecord>>();
+
+        List<AccountRecord> list = new ArrayList<AccountRecord>();
+        try {
+            String sql = "select * from AccountRecord where MemberPK = '" + memberpk + "' ";
+            if (beginDate != null && !beginDate.equals("")) {
+                sql += " and ADate>= '" + beginDate + "' ";
+            }
+            if (endDate != null && !endDate.equals("")) {
+                sql += " and ADate<= '" + endDate + "' ";
+            }
+
+            if (stypes != null && stypes.length > 0) {
+                String stypeWhere = " and (";
+                for (String stype : stypes) {
+                    stypeWhere += " stype = '" + stype + "' or ";
+                }
+                stypeWhere = stypeWhere.substring(0, stypeWhere.lastIndexOf("or"));
+                stypeWhere += ")";
+                sql += stypeWhere;
+            }
+            if (atypes != null && atypes.length > 0) {
+                String atypeWhere = " and (";
+                for (String atype : atypes) {
+                    atypeWhere += " atype = '" + atype + "' or ";
+                }
+                atypeWhere = atypeWhere.substring(0, atypeWhere.lastIndexOf("or"));
+                atypeWhere += ")";
+                sql += atypeWhere;
+            }
+            sql += " order by ADate desc";
+
+            // 获取分页总数量
+            String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
+            int    count        = new DbConnection().queryOneCount(sqlPageCount);
+            page.setCount(count);
+
+            //分页
+            String       sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+            DbConnection db      = new DbConnection();
+            CachedRowSet rs      = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    AccountRecord ar = new AccountRecord();
+                    ar.setPk(rs.getInt("pk"));
+                    ar.setMemberpk(rs.getInt("memberpk"));
+                    ar.setAdate(rs.getDate("adate"));
+                    ar.setStype(rs.getString("stype"));
+                    ar.setLinkpk(rs.getInt("linkpk"));
+                    ar.setAtype(rs.getString("atype"));
+                    ar.setCoin(rs.getDouble("coin"));
+                    ar.setAbs(rs.getString("abstract"));
+                    list.add(ar);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        page.setData(list);
+        return page;
+    }
+
+    @Override
+    public double findIncome(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes) {
+        String sql = "select sum(coin) as sum1 from AccountRecord where MemberPK = '" + memberpk + "' ";
+
+        if (beginDate != null && !beginDate.equals("")) {
+            sql += " and ADate>= '" + beginDate + "' ";
+        }
+        if (endDate != null && !endDate.equals("")) {
+            sql += " and ADate<= '" + endDate + "' ";
+        }
+        if (stypes != null && stypes.length > 0) {
+            String stypeWhere = " and (";
+            for (String stype : stypes) {
+                stypeWhere += " stype = '" + stype + "' or ";
+            }
+            stypeWhere = stypeWhere.substring(0, stypeWhere.lastIndexOf("or"));
+            stypeWhere += ")";
+            sql += stypeWhere;
+        }
+        if (atypes != null && atypes.length > 0) {
+            String atypeWhere = " and (";
+            for (String atype : atypes) {
+                atypeWhere += " atype = '" + atype + "' or ";
+            }
+            atypeWhere = atypeWhere.substring(0, atypeWhere.lastIndexOf("or"));
+            atypeWhere += ")";
+            sql += atypeWhere;
+        }
+        sql = "select * from (" + sql + ")table0_";
+        DbConnection db     = new DbConnection();
+        String       sumStr = db.queryOneString(sql);
+        if (sumStr == null || sumStr.equals("")) {
+            sumStr = "0";
+        }
+        double sum = Double.parseDouble(sumStr);
+        return sum;
+    }
 }

+ 231 - 228
src/main/java/com/thmodel/dao/impl/CashRecordDaoImpl.java

@@ -15,233 +15,236 @@ import com.thmodel.util.CommentUtils;
 
 import com.thmodel.page.Page;
 
-public class CashRecordDaoImpl implements CashRecordDao{
-
-	@Override
-	public int insertCashRecord(CashRecord cr) {
-		String sql = String.format(" insert into CashRecord(memberpk, fee, ptype, feedate, Abstract, intro, pstate, wid, username, phone, AccFlag)"
-				   				 + " values('%s', '%s', '%s', now(), '%s', '%s', '%s', '%s', '%s', '%s', '%s')", 
-				   				cr.getMemberpk(), cr.getFee(), cr.getPtype(), cr.getAbs(), cr.getIntro(), 
-				   				cr.getPstate(), cr.getWid(), cr.getUsername(), cr.getPhone(), cr.getAccflag());
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public List findCashRecord(int memberpk, String ptype, String pstate) {
-		List<CashRecord> list = new ArrayList<CashRecord>();
-		try {
-			String sql = "select * from CashRecord where memberpk = '"+memberpk+"' ";
-			if(ptype != null && !ptype.equals("")) {
-				sql += " and ptype = '"+ptype+"'";
-			}
-			if(pstate != null && !pstate.equals("")) {
-				sql += " and pstate = '"+pstate+"'";
-			}
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null) {
-				while(rs.next()) {
-					CashRecord c = new CashRecord();
-					c.setPk(rs.getInt("pk"));;
-					c.setMemberpk(rs.getInt("memberpk"));
-					c.setFee(rs.getDouble("fee"));
-					c.setPtype(rs.getString("ptype"));
-					c.setFeedate(rs.getDate("feedate"));
-					c.setAbs(rs.getString("abstract"));
-					c.setIntro(rs.getString("intro"));
-					c.setPstate(rs.getString("pstate"));
-					c.setWid(rs.getString("wid"));
-					c.setUsername(rs.getString("username"));
-					c.setPhone(rs.getString("phone"));
-					c.setAccountingdate(rs.getDate("Accountingdate"));
-					list.add(c);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return list;
-	}
-
-	@Override
-	public int updateCashRecordSetStateByPkAndWid(int pk, String wid, String state, int accflag) {
-		String sql = "update CashRecord set pstate = '"+ PayConstants.STATE_2 +"' , AccountingDate=now(), AccFlag = '"+accflag+"' where pk = '"+ pk +"' and wid = '"+ wid +"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public CashRecord findCashRecordByPkAndWid(int pk, String wid) {
-		CashRecord c = new CashRecord();
-		try {
-			String sql = "select * from CashRecord where pk='"+pk+"' and wid='"+wid+"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				c.setPk(rs.getInt("pk"));;
-				c.setMemberpk(rs.getInt("memberpk"));
-				c.setFee(rs.getDouble("fee"));
-				c.setPtype(rs.getString("ptype"));
-				c.setFeedate(rs.getDate("feedate"));
-				c.setAbs(rs.getString("abstract"));
-				c.setIntro(rs.getString("intro"));
-				c.setPstate(rs.getString("pstate"));
-				c.setWid(rs.getString("wid"));
-				c.setUsername(rs.getString("username"));
-				c.setPhone(rs.getString("phone"));
-				c.setAccountingdate(rs.getDate("Accountingdate"));
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return c;
-	}
-
-	@Override
-	public Page<List<CashRecord>> findCashRecordByMemberpkDatePTypePState(int memberpk, String beginDate, String endDate, String[] PTypes, String[] PStates, int index, int size) {
-		
-		Page<List<CashRecord>> page = new Page<List<CashRecord>>();
-		
-		List<CashRecord> list = new ArrayList<CashRecord>();
-		try {
-			String sql = "select * from CashRecord where memberpk = '"+memberpk+"' ";
-			
-			if(beginDate != null && !beginDate.equals("")) {
-				sql += " and FeeDate>= '"+beginDate+"' ";
-			}
-			if(endDate != null && !endDate.equals("")) {
-				sql += " and FeeDate<= '"+endDate+"' ";
-			}
-			
-			if(PTypes != null && PTypes.length > 0) {
-				String ptypeWhere = " and (";
-				for (String ptype : PTypes) {
-					ptypeWhere += " ptype = '"+ptype+"' or ";
-				}
-				ptypeWhere = ptypeWhere.substring(0, ptypeWhere.lastIndexOf("or"));
-				ptypeWhere += ")";
-				sql += ptypeWhere ; 
-			}
-			if(PStates != null && PStates.length > 0) {
-				String pstateWhere = " and (";
-				for (String pstate : PStates) {
-					pstateWhere += " pstate = '"+pstate+"' or ";
-				}
-				pstateWhere = pstateWhere.substring(0, pstateWhere.lastIndexOf("or"));
-				pstateWhere += ")";
-				sql += pstateWhere ; 
-			}
-			sql += " order by FeeDate desc";
-			
-			
-			//获取分页总数量
-			String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
-			int count = new DbConnection().queryOneCount(sqlPageCount);
-			page.setCount(count);
-			
-			String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs != null) {
-				while(rs.next()) {
-					CashRecord c = new CashRecord();
-					c.setPk(rs.getInt("pk"));
-					c.setMemberpk(rs.getInt("memberpk"));
-					c.setFee(rs.getDouble("fee"));
-					c.setPtype(rs.getString("ptype"));
-					c.setFeedate(rs.getDate("feedate"));
-					c.setAbs(rs.getString("abstract"));
-					c.setIntro(rs.getString("intro"));
-					c.setPstate(rs.getString("pstate"));
-					c.setWid(rs.getString("wid"));
-					c.setUsername(rs.getString("username"));
-					c.setPhone(rs.getString("phone"));
-					c.setAccountingdate(rs.getDate("Accountingdate"));
-					list.add(c);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		page.setData(list);
-		return page;
-	}
-
-	@Override
-	public double findOutCashFee(int memberpk, String beginDate, String endDate, String[] PTypes, String[] PStates) {
-		String sql = "select sum(fee) from CashRecord where memberpk = '"+memberpk+"' ";
-		
-		if(beginDate != null && !beginDate.equals("")) {
-			sql += " and FeeDate>= '"+beginDate+"' ";
-		}
-		if(endDate != null && !endDate.equals("")) {
-			sql += " and FeeDate<= '"+endDate+"' ";
-		}
-		
-		if(PTypes != null && PTypes.length > 0) {
-			String ptypeWhere = " and (";
-			for (String ptype : PTypes) {
-				ptypeWhere += " ptype = '"+ptype+"' or ";
-			}
-			ptypeWhere = ptypeWhere.substring(0, ptypeWhere.lastIndexOf("or"));
-			ptypeWhere += ")";
-			sql += ptypeWhere ; 
-		}
-		if(PStates != null && PStates.length > 0) {
-			String pstateWhere = " and (";
-			for (String pstate : PStates) {
-				pstateWhere += " pstate = '"+pstate+"' or ";
-			}
-			pstateWhere = pstateWhere.substring(0, pstateWhere.lastIndexOf("or"));
-			pstateWhere += ")";
-			sql += pstateWhere ; 
-		}
-		
-		sql = "select * from ("+sql+")table1_";
-		DbConnection db = new DbConnection();
-		String sumStr = db.queryOneString(sql);
-		if(sumStr==null || sumStr.equals("")) {
-			sumStr = "0";
-		}
-		double sum =  Double.parseDouble(sumStr);
-		return sum;
-	}
-
-	@Override
-	public CashRecord findCashRecordOne(int pk) {
-		CashRecord c = new CashRecord();
-		try {
-			String sql = "select * from CashRecord where pk ="+pk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()) {
-				
-				c.setPk(rs.getInt("pk"));;
-				c.setMemberpk(rs.getInt("memberpk"));
-				c.setFee(rs.getDouble("fee"));
-				c.setPtype(rs.getString("ptype"));
-				c.setFeedate(rs.getDate("feedate"));
-				c.setAbs(rs.getString("abstract"));
-				c.setIntro(rs.getString("intro"));
-				c.setPstate(rs.getString("pstate"));
-				c.setWid(rs.getString("wid"));
-				c.setUsername(rs.getString("username"));
-				c.setPhone(rs.getString("phone"));
-				c.setAccountingdate(rs.getDate("Accountingdate"));
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return c;
-	}
-	
+public class CashRecordDaoImpl implements CashRecordDao {
+
+    @Override
+    public int insertCashRecord(CashRecord cr) {
+        String sql = String.format(" insert into CashRecord(memberpk, fee, ptype, feedate, Abstract, intro, pstate, wid, username, phone, AccFlag)"
+                                           + " values('%s', '%s', '%s', now(), '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
+                                   cr.getMemberpk(), cr.getFee(), cr.getPtype(), cr.getAbs(), cr.getIntro(),
+                                   cr.getPstate(), cr.getWid(), cr.getUsername(), cr.getPhone(), cr.getAccflag());
+        DbConnection db = new DbConnection();
+        int          pk = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public List findCashRecord(int memberpk, String ptype, String pstate) {
+        List<CashRecord> list = new ArrayList<CashRecord>();
+        try {
+            String sql = "select * from CashRecord where memberpk = '" + memberpk + "' ";
+            if (ptype != null && !ptype.equals("")) {
+                sql += " and ptype = '" + ptype + "'";
+            }
+            if (pstate != null && !pstate.equals("")) {
+                sql += " and pstate = '" + pstate + "'";
+            }
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    CashRecord c = new CashRecord();
+                    c.setPk(rs.getInt("pk"));
+                    ;
+                    c.setMemberpk(rs.getInt("memberpk"));
+                    c.setFee(rs.getDouble("fee"));
+                    c.setPtype(rs.getString("ptype"));
+                    c.setFeedate(rs.getDate("feedate"));
+                    c.setAbs(rs.getString("abstract"));
+                    c.setIntro(rs.getString("intro"));
+                    c.setPstate(rs.getString("pstate"));
+                    c.setWid(rs.getString("wid"));
+                    c.setUsername(rs.getString("username"));
+                    c.setPhone(rs.getString("phone"));
+                    c.setAccountingdate(rs.getDate("Accountingdate"));
+                    list.add(c);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    @Override
+    public int updateCashRecordSetStateByPkAndWid(int pk, String wid, String state, int accflag) {
+        String       sql  = "update CashRecord set pstate = '" + PayConstants.STATE_2 + "' , AccountingDate=now(), AccFlag = '" + accflag + "' where pk = '" + pk + "' and wid = '" + wid + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public CashRecord findCashRecordByPkAndWid(int pk, String wid) {
+        CashRecord c = new CashRecord();
+        try {
+            String       sql = "select * from CashRecord where pk='" + pk + "' and wid='" + wid + "'";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                c.setPk(rs.getInt("pk"));
+                ;
+                c.setMemberpk(rs.getInt("memberpk"));
+                c.setFee(rs.getDouble("fee"));
+                c.setPtype(rs.getString("ptype"));
+                c.setFeedate(rs.getDate("feedate"));
+                c.setAbs(rs.getString("abstract"));
+                c.setIntro(rs.getString("intro"));
+                c.setPstate(rs.getString("pstate"));
+                c.setWid(rs.getString("wid"));
+                c.setUsername(rs.getString("username"));
+                c.setPhone(rs.getString("phone"));
+                c.setAccountingdate(rs.getDate("Accountingdate"));
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return c;
+    }
+
+    @Override
+    public Page<List<CashRecord>> findCashRecordByMemberpkDatePTypePState(int memberpk, String beginDate, String endDate, String[] PTypes, String[] PStates, int index, int size) {
+
+        Page<List<CashRecord>> page = new Page<List<CashRecord>>();
+
+        List<CashRecord> list = new ArrayList<CashRecord>();
+        try {
+            String sql = "select * from CashRecord where memberpk = '" + memberpk + "' ";
+
+            if (beginDate != null && !beginDate.equals("")) {
+                sql += " and FeeDate>= '" + beginDate + "' ";
+            }
+            if (endDate != null && !endDate.equals("")) {
+                sql += " and FeeDate<= '" + endDate + "' ";
+            }
+
+            if (PTypes != null && PTypes.length > 0) {
+                String ptypeWhere = " and (";
+                for (String ptype : PTypes) {
+                    ptypeWhere += " ptype = '" + ptype + "' or ";
+                }
+                ptypeWhere = ptypeWhere.substring(0, ptypeWhere.lastIndexOf("or"));
+                ptypeWhere += ")";
+                sql += ptypeWhere;
+            }
+            if (PStates != null && PStates.length > 0) {
+                String pstateWhere = " and (";
+                for (String pstate : PStates) {
+                    pstateWhere += " pstate = '" + pstate + "' or ";
+                }
+                pstateWhere = pstateWhere.substring(0, pstateWhere.lastIndexOf("or"));
+                pstateWhere += ")";
+                sql += pstateWhere;
+            }
+            sql += " order by FeeDate desc";
+
+
+            //获取分页总数量
+            String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
+            int    count        = new DbConnection().queryOneCount(sqlPageCount);
+            page.setCount(count);
+
+            String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    CashRecord c = new CashRecord();
+                    c.setPk(rs.getInt("pk"));
+                    c.setMemberpk(rs.getInt("memberpk"));
+                    c.setFee(rs.getDouble("fee"));
+                    c.setPtype(rs.getString("ptype"));
+                    c.setFeedate(rs.getDate("feedate"));
+                    c.setAbs(rs.getString("abstract"));
+                    c.setIntro(rs.getString("intro"));
+                    c.setPstate(rs.getString("pstate"));
+                    c.setWid(rs.getString("wid"));
+                    c.setUsername(rs.getString("username"));
+                    c.setPhone(rs.getString("phone"));
+                    c.setAccountingdate(rs.getDate("Accountingdate"));
+                    list.add(c);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        page.setData(list);
+        return page;
+    }
+
+    @Override
+    public double findOutCashFee(int memberpk, String beginDate, String endDate, String[] PTypes, String[] PStates) {
+        String sql = "select sum(fee) from CashRecord where memberpk = '" + memberpk + "' ";
+
+        if (beginDate != null && !beginDate.equals("")) {
+            sql += " and FeeDate>= '" + beginDate + "' ";
+        }
+        if (endDate != null && !endDate.equals("")) {
+            sql += " and FeeDate<= '" + endDate + "' ";
+        }
+
+        if (PTypes != null && PTypes.length > 0) {
+            String ptypeWhere = " and (";
+            for (String ptype : PTypes) {
+                ptypeWhere += " ptype = '" + ptype + "' or ";
+            }
+            ptypeWhere = ptypeWhere.substring(0, ptypeWhere.lastIndexOf("or"));
+            ptypeWhere += ")";
+            sql += ptypeWhere;
+        }
+        if (PStates != null && PStates.length > 0) {
+            String pstateWhere = " and (";
+            for (String pstate : PStates) {
+                pstateWhere += " pstate = '" + pstate + "' or ";
+            }
+            pstateWhere = pstateWhere.substring(0, pstateWhere.lastIndexOf("or"));
+            pstateWhere += ")";
+            sql += pstateWhere;
+        }
+
+        sql = "select * from (" + sql + ")table1_";
+        DbConnection db     = new DbConnection();
+        String       sumStr = db.queryOneString(sql);
+        if (sumStr == null || sumStr.equals("")) {
+            sumStr = "0";
+        }
+        double sum = Double.parseDouble(sumStr);
+        return sum;
+    }
+
+    @Override
+    public CashRecord findCashRecordOne(int pk) {
+        CashRecord c = new CashRecord();
+        try {
+            String       sql = "select * from CashRecord where pk =" + pk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+
+                c.setPk(rs.getInt("pk"));
+                ;
+                c.setMemberpk(rs.getInt("memberpk"));
+                c.setFee(rs.getDouble("fee"));
+                c.setPtype(rs.getString("ptype"));
+                c.setFeedate(rs.getDate("feedate"));
+                c.setAbs(rs.getString("abstract"));
+                c.setIntro(rs.getString("intro"));
+                c.setPstate(rs.getString("pstate"));
+                c.setWid(rs.getString("wid"));
+                c.setUsername(rs.getString("username"));
+                c.setPhone(rs.getString("phone"));
+                c.setAccountingdate(rs.getDate("Accountingdate"));
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return c;
+    }
+
 
 }

+ 25 - 25
src/main/java/com/thmodel/dao/impl/DataTypeInfoDaoImpl.java

@@ -11,30 +11,30 @@ import com.thmodel.dao.DataTypeInfoDao;
 import com.thmodel.dbconnection.DbConnection;
 
 public class DataTypeInfoDaoImpl implements DataTypeInfoDao {
-	
-	@Override
-	public List<Map<String, Object>> findDataTypeInfoByTypeName(String typeName) {
-		
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		
-		String sql = "select PK, name from DataTypeInfo where TypeName='"+typeName+"' order by OrdId ";
-		
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> resultMap = new HashMap<String, Object>();
-					resultMap.put("pk", rs.getInt("pk"));
-					resultMap.put("name", rs.getString("name"));
-					resultMapList.add(resultMap);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return resultMapList;
-	}
+
+    @Override
+    public List<Map<String, Object>> findDataTypeInfoByTypeName(String typeName) {
+
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+
+        String sql = "select PK, name from DataTypeInfo where TypeName='" + typeName + "' order by OrdId ";
+
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> resultMap = new HashMap<String, Object>();
+                    resultMap.put("pk", rs.getInt("pk"));
+                    resultMap.put("name", rs.getString("name"));
+                    resultMapList.add(resultMap);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return resultMapList;
+    }
 
 }

+ 62 - 63
src/main/java/com/thmodel/dao/impl/MemberSignDaoImpl.java

@@ -11,71 +11,70 @@ import com.thmodel.entity.MemberSign;
 
 public class MemberSignDaoImpl implements MemberSignDao {
 
-	@Override
-	public int insertMemberSign(int PK, String SDate){
-		String sql = "insert into MemberSign(MemberPK, SDate) values('"+PK+"', '"+SDate+"')";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
+    @Override
+    public int insertMemberSign(int PK, String SDate) {
+        String       sql  = "insert into MemberSign(MemberPK, SDate) values('" + PK + "', '" + SDate + "')";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
 
-	@Override
-	public int findMemberSignByPkLikeSDate(int PK, String SDate) {
-		try {
-			int count = 0;
-			String sql = "select count(1) from membersign where MemberPK = '"+ PK +"' and SDate >= '"+SDate+"' and SDate<= '"+SDate+" 23:59:59'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()){
-				count = rs.getInt(1);
-				db.close(rs);
-			}
-			return count;
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-			return -1;
-		}
-	}
+    @Override
+    public int findMemberSignByPkLikeSDate(int PK, String SDate) {
+        try {
+            int          count = 0;
+            String       sql   = "select count(1) from membersign where MemberPK = '" + PK + "' and SDate >= '" + SDate + "' and SDate<= '" + SDate + " 23:59:59'";
+            DbConnection db    = new DbConnection();
+            CachedRowSet rs    = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+                db.close(rs);
+            }
+            return count;
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            return -1;
+        }
+    }
 
-	@Override
-	public int updateMemberInfoToLastSignAndSignDaysByPk(int PK, String LastSign, String SignDays) {
-		String sql = "update MemberInfo set LastSign = '"+ LastSign +"', SignDays = "+ SignDays +" where pk = " + PK;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
+    @Override
+    public int updateMemberInfoToLastSignAndSignDaysByPk(int PK, String LastSign, String SignDays) {
+        String       sql  = "update MemberInfo set LastSign = '" + LastSign + "', SignDays = " + SignDays + " where pk = " + PK;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberInfoToLastSignByPk(int PK, String LastSign) {
+        String       sql  = "update MemberInfo set LastSign = '" + LastSign + "' where pk = " + PK;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public List<MemberSign> findMemberSignByMemberPK(int MemberPK) {
+        List<MemberSign> list = new ArrayList<MemberSign>();
+        String           sql  = "select * from MemberSign where memberPK = " + MemberPK + " ORDER BY sDate DESC LIMIT 30";
+        DbConnection     db   = new DbConnection();
+        CachedRowSet     rs   = db.executeQuery(sql);
+        try {
+            if (rs != null) {
+                while (rs.next()) {
+                    MemberSign ms = new MemberSign();
+                    ms.setPk(rs.getInt("pk"));
+                    ms.setMemberpk(rs.getInt("memberpk"));
+                    ms.setSdate(rs.getDate("sdate"));
+                    list.add(ms);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
 
-	@Override
-	public int updateMemberInfoToLastSignByPk(int PK, String LastSign) {
-		String sql = "update MemberInfo set LastSign = '"+ LastSign +"' where pk = " + PK;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
 
-	@Override
-	public List<MemberSign> findMemberSignByMemberPK(int MemberPK) {
-		List<MemberSign> list = new ArrayList<MemberSign>();
-		String sql = "select * from MemberSign where memberPK = "+MemberPK+" ORDER BY sDate DESC LIMIT 30";
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		try {
-			if(rs!=null){
-				while(rs.next()){
-					MemberSign ms = new MemberSign();
-					ms.setPk(rs.getInt("pk"));
-					ms.setMemberpk(rs.getInt("memberpk"));
-					ms.setSdate(rs.getDate("sdate"));
-					list.add(ms);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return list;
-	}
-	
-	
-	
 }

+ 597 - 596
src/main/java/com/thmodel/dao/impl/MemberinfoDaoImpl.java

@@ -20,600 +20,601 @@ import com.thmodel.entity.ReportInfo;
 import com.thmodel.page.Page;
 import com.thmodel.util.CommentUtils;
 
-public class MemberinfoDaoImpl implements MemberinfoDao{
-	
-	private static final Logger logger = Logger.getLogger(MemberinfoDaoImpl.class);
-	
-	@Override
-	public int insertMemberinfoByRegister(MemberInfo memberinfo) {
-		String tel = memberinfo.getTel();
-		String pass = memberinfo.getPass();
-		String pet = memberinfo.getPet();
-		String token = memberinfo.getToken() == null ? "" : memberinfo.getToken();
-		int membtype = Constants.MEMTYPE_HuiYuan;
-		
-		//给默认头像
-		String hphoto = Constants.ERROR_IMG_HP2X == null ? "" : Constants.ERROR_IMG_HP2X;
-				
-		String sql = String.format("INSERT INTO memberinfo(Tel, Phone, Pass, Pet, membtype, Token, hphoto, MDate, QRCode) VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', now(), '%s')", tel, tel, pass, pet, membtype, token, hphoto, getNewMemQrCode());
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-	
-	@Override
-	public int insertMemberinfoByModelRegister(MemberInfo memberinfo) {
-		String tel = memberinfo.getTel();
-		String pass = memberinfo.getPass();
-		String pet = memberinfo.getPet();
-		String token = memberinfo.getToken() == null ? "" : memberinfo.getToken();
-		int introducerpk = memberinfo.getIntroducerpk();
-		int membtype = Constants.MEMTYPE_Model;
-		//给默认头像
-		String hphoto = Constants.ERROR_IMG_HP2X == null ? "" : Constants.ERROR_IMG_HP2X;
-		
-		String sql = String.format("INSERT INTO memberinfo(Tel, Phone, Pass, Pet, Token, IntroducerPk, hPhoto, membtype, MDate, QRCode) VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', now(), '%s')", tel, tel, pass, pet, token, introducerpk, hphoto, membtype, getNewMemQrCode());
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-	
-	@Override
-	public String getNewMemQrCode() {
-		DbConnection db = new DbConnection();
-		String TmpStr = "", sql;
-		javax.sql.rowset.CachedRowSet rs;
-		int Exists = 1;
-		while (Exists == 1) {
-			int Code = (int) ((Math.random() * 9 + 1) * 100000);
-			TmpStr = String.valueOf(Code);
-			sql = "select count(1) C from memberinfo where qrcode='" + TmpStr + "' ";
-			try {
-				rs = db.executeQuery(sql);
-				if (rs == null) {
-					TmpStr = "";
-					break;
-				}
-				rs.next();
-				if (rs.getInt("C") > 0) {
-					TmpStr = "";
-				} else {
-					Exists = 0;
-				}
-				rs.close();
-			} catch (Exception e) {
-				TmpStr = "";
-				break;
-			}
-		}
-		return TmpStr;
-	}
-	
-	@Override
-	public MemberInfo login(String username, String pwd) {
-		MemberInfo memberinfo = new MemberInfo();
-		try {
-			String sql = "select * from memberinfo where (tel = '"+username+"' or phone='"+username+"') and pass = '"+pwd+"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			
-			if(rs!=null && rs.size()>0 && rs.next()){
-				memberinfo.setPk(rs.getInt("PK"));
-				memberinfo.setMembtype(rs.getInt("MembType"));
-				memberinfo.setMembclass(rs.getInt("MembClass"));
-				memberinfo.setQrcode(rs.getString("QRCode"));
-				memberinfo.setTel(rs.getString("Tel"));
-				memberinfo.setPhone(rs.getString("Phone"));
-				memberinfo.setPet(rs.getString("Pet"));
-				memberinfo.setHphoto(rs.getString("hPhoto"));
-				memberinfo.setPhoto(rs.getString("Photo"));
-				memberinfo.setArea(rs.getInt("Area"));
-				memberinfo.setAge(rs.getString("Age"));
-				memberinfo.setId(rs.getString("ID"));
-				memberinfo.setIslive(rs.getInt("IsLive"));
-				memberinfo.setMdate(rs.getDate("MDate"));
-				memberinfo.setToken(rs.getString("token"));
-				memberinfo.setAcc(rs.getInt("acc"));
-				memberinfo.setLastsign(rs.getDate("LastSign"));
-				memberinfo.setSigndays(rs.getInt("SignDays"));
-				memberinfo.setIdentify(rs.getString("identify"));
-				memberinfo.setWid(rs.getString("WID"));
-				memberinfo.setCoin_a((double)Math.round(rs.getDouble("coin_A")*100)/100);
-				memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
-				memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
-				memberinfo.setCoin_is(rs.getDouble("coin_IS"));
-				memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
-				memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
-				memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
-				memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
-				memberinfo.setCoin_i(rs.getDouble("coin_I"));
-				memberinfo.setCoin_or(rs.getDouble("coin_OR"));
-				memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
-				memberinfo.setCoin_os(rs.getDouble("coin_OS"));
-				memberinfo.setCoin_om(rs.getDouble("coin_OM"));
-				memberinfo.setCoin_o(rs.getDouble("coin_O"));
-				db.close(rs);
-			}
-			if(memberinfo.getPk() > 0){
-				return memberinfo;
-			}else{
-				return null;
-			}
-		} catch (Exception e) {
-			logger.error(e.getMessage());
-			return null;
-		}
-	}
-
-	@Override
-	public int getCountToMemberinfoByTel(String tel) {
-		int count = 0;
-		try {
-			String sql = "select count(1) from memberinfo where tel = '" + tel + "'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()){
-				count = rs.getInt(1);
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			logger.error(e.getMessage());
-			count = -1;
-		}
-		return count;
-		
-	}
-
-	@Override
-	public MemberInfo findMemberinfoByPK(int PK) {
-		MemberInfo memberinfo = new MemberInfo();
-		try {
-			String sql = "select * from memberinfo where pk="+PK;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			
-			if(rs!=null && rs.size()>0 && rs.next()){
-				memberinfo.setPk(rs.getInt("PK"));
-				memberinfo.setMembtype(rs.getInt("MembType"));
-				memberinfo.setMembclass(rs.getInt("MembClass"));
-				memberinfo.setQrcode(rs.getString("QRCode"));
-				memberinfo.setTel(rs.getString("Tel"));
-				memberinfo.setPass(rs.getString("Pass"));
-				memberinfo.setPaypass(rs.getString("PayPass"));
-				memberinfo.setPet(rs.getString("Pet"));
-				memberinfo.setPhone(rs.getString("Phone"));
-				memberinfo.setHphoto(rs.getString("hPhoto"));
-				memberinfo.setPhoto(rs.getString("Photo"));
-				memberinfo.setArea(rs.getInt("Area"));
-				memberinfo.setAge(rs.getString("Age"));
-				memberinfo.setId(rs.getString("ID"));
-				memberinfo.setIslive(rs.getInt("IsLive"));
-				memberinfo.setMdate(rs.getDate("MDate"));
-				memberinfo.setToken(rs.getString("token"));
-				memberinfo.setAcc(rs.getInt("acc"));
-				memberinfo.setLastsign(rs.getDate("LastSign"));
-				memberinfo.setSigndays(rs.getInt("SignDays"));
-				memberinfo.setIntroducerpk(rs.getInt("introducerPK"));
-				memberinfo.setIdentify(rs.getString("identify"));
-				memberinfo.setId_a(rs.getString("iD_A"));
-				memberinfo.setId_a(rs.getString("iD_B"));
-				memberinfo.setId_a(rs.getString("iD_C"));
-				memberinfo.setWid(rs.getString("WID"));
-				memberinfo.setCoin_a((double)Math.round(rs.getDouble("coin_A")*100)/100);
-				memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
-				memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
-				memberinfo.setCoin_is(rs.getDouble("coin_IS"));
-				memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
-				memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
-				memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
-				memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
-				memberinfo.setCoin_i(rs.getDouble("coin_I"));
-				memberinfo.setCoin_or(rs.getDouble("coin_OR"));
-				memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
-				memberinfo.setCoin_os(rs.getDouble("coin_OS"));
-				memberinfo.setCoin_om(rs.getDouble("coin_OM"));
-				memberinfo.setCoin_o(rs.getDouble("coin_O"));
-				memberinfo.setCoin_oi(rs.getDouble("coin_OI"));
-				db.close(rs);
-			}
-			
-			return memberinfo;
-		} catch (Exception e) {
-			logger.error(e.getMessage());
-			return null;
-		}
-	}
-
-	@Override
-	public Map<String, Object> docard(int MemberPK) {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		try {
-			Map<String, Object> map = new HashMap<String, Object>();
-			String sql = "select * from (select LastSign, SignDays, (select sum(acc) from AccRecord where MemberPK = "+MemberPK+") as acc from MemberInfo where pk = "+MemberPK+")t";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()){
-				map.put("pk", MemberPK);//最后一次签到
-				map.put("lastsign", sdf.format(rs.getDate("LastSign")));//最后一次签到
-				map.put("signdays", rs.getString("SignDays"));//连续签到
-				map.put("acc", rs.getString("acc"));//积分
-				db.close(rs);
-			}
-			return map;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public int updatePassword(int PK, String pwd) {
-		String sql = "update MemberInfo set Pass='"+pwd+"' where PK = '"+PK+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public String findPwdByTel(String tel) {
-		String pwd = null;
-		String sql = "select pass from MemberInfo where Tel = '"+tel+"'";
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		try {
-			if(rs!=null && rs.next()){
-				pwd = rs.getString("pass");
-			}
-			return pwd;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-	@Override
-	public int findMemberpkByTel(String tel) {
-		int memberpk = 0;
-		String sql = "select pk from MemberInfo where Tel = '"+tel+"'";
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		try {
-			if(rs!=null && rs.next()){
-				memberpk = rs.getInt(1);
-			}
-			return memberpk;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return -1;
-		}
-	}
-
-	@Override
-	public int updatePetByPK(int PK, String Pet) {
-		String sql = "update MemberInfo set Pet='"+Pet+"' where PK = "+PK;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateAreaByPK(int PK, int Area) {
-		String sql = "update MemberInfo set Area="+Area+" where PK = "+PK;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberhphotoByPk(int pk, String hphoto) {
-		String sql = "update MemberInfo set hPhoto='"+hphoto+"' where pk = "+pk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-
-	@Override
-	public int updateMemberPhoneByPk(int pk, String phone) {
-		String sql = "update memberinfo set phone='"+phone+"' where pk = "+pk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberTokenByPk(int pk, String token) {
-		String sql = "update memberinfo set token='"+token+"' where pk = '"+pk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberToGiveRed_Disable(int memberPk, double coin) {
-		//发红包 更新金额
-		String sql = "update memberinfo set coin_A = coin_A - "+coin+", coin_OI = ifnull(coin_OI, 0) + "+coin+" where coin_A >= "+coin+" and pk = " + memberPk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberToReceiveRed_Disable(int redPacketPk, int modelPk, int memberPk, double coin){
-		int result = 0;
-		try {
-			if(coin > 0) {
-				//发红包的人得 预支金额扣掉
-				String sql = "update memberinfo set coin_OI = ifnull(coin_OI, 0) - '" + coin + "' where pk = '"+memberPk+"'";
-				DbConnection db2 = new DbConnection();
-				int rows = db2.executeUpdate(sql);
-				if(rows > 0) {
-					//收红包的人才的金额加多少
-					// 百分比扣除coin
-					double coin_IRR = 0;//红包分红币额
-					sql = "update memberinfo set coin_A = ifnull(coin_A, 0) + "+coin+", coin_IR=ifnull(coin_IR, 0) + "+coin+", coin_IRR=ifnull(coin_IRR, 0) + "+coin_IRR 
-						+ " where pk = (select memberpk from modelinfo where pk="+modelPk+")";
-					DbConnection db3 = new DbConnection();
-					result = db3.executeUpdate(sql);
-				}
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-			result = -1;
-		}
-		return result;
-	}
-
-	@Override
-	public MemberInfo getMemberInfoByPk(int pk) {
-		MemberInfo memberinfo = new MemberInfo();
-		try {
-			String sql = "select * from memberinfo where pk = '"+ pk +"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			
-			if(rs!=null && rs.size()>0 && rs.next()){
-				memberinfo.setPk(rs.getInt("PK"));
-				memberinfo.setMembtype(rs.getInt("MembType"));
-				memberinfo.setMembclass(rs.getInt("MembClass"));
-				memberinfo.setQrcode(rs.getString("QRCode"));
-				memberinfo.setTel(rs.getString("Tel"));
-				memberinfo.setPhone(rs.getString("Phone"));
-				memberinfo.setPet(rs.getString("Pet"));
-				memberinfo.setHphoto(rs.getString("hPhoto"));
-				memberinfo.setPhoto(rs.getString("Photo"));
-				memberinfo.setArea(rs.getInt("Area"));
-				memberinfo.setAge(rs.getString("Age"));
-				memberinfo.setId(rs.getString("ID"));
-				memberinfo.setIslive(rs.getInt("IsLive"));
-				memberinfo.setMdate(rs.getDate("MDate"));
-				memberinfo.setToken(rs.getString("token"));
-				memberinfo.setAcc(rs.getInt("acc"));
-				memberinfo.setLastsign(rs.getDate("LastSign"));
-				memberinfo.setSigndays(rs.getInt("SignDays"));
-				memberinfo.setIdentify(rs.getString("identify"));
-				memberinfo.setWid(rs.getString("WID"));
-				memberinfo.setCoin_a((double)Math.round(rs.getDouble("coin_A")*100)/100);
-				memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
-				memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
-				memberinfo.setCoin_is(rs.getDouble("coin_IS"));
-				memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
-				memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
-				memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
-				memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
-				memberinfo.setCoin_i(rs.getDouble("coin_I"));
-				memberinfo.setCoin_or(rs.getDouble("coin_OR"));
-				memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
-				memberinfo.setCoin_os(rs.getDouble("coin_OS"));
-				memberinfo.setCoin_om(rs.getDouble("coin_OM"));
-				memberinfo.setCoin_o(rs.getDouble("coin_O"));
-				db.close(rs);
-			}
-			if(memberinfo.getPk() > 0){
-				return memberinfo;
-			}else{
-				return null;
-			}
-		} catch (Exception e) {
-			logger.error(e.getMessage());
-			return null;
-		}
-	}
-
-	@Override
-	public int updateMemberInfoByModelPk(int modelpk, String name, String age, String area) {
-		String sql = "update MemberInfo set ";
-		if(name != null && !name.equals("")) {
-			sql += " Pet = '" + name + "', ";
-		}
-		if(age != null && !age.equals("")) {
-			sql += " age = '" + age + "', ";
-		}
-		if(area != null && !area.equals("")) {
-			sql += " area = '" + area + "', ";
-		}
-		
-		sql = sql.substring(0, sql.lastIndexOf(","));
-		sql += " where pk = (select memberpk from modelinfo where pk = "+modelpk+")";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public String findMemberPetByPk(int pk) {
-		String pet = null;
-		try {
-			String sql = "select pet from memberinfo where pk = " + pk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()) {
-				pet = rs.getString(1);
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return pet;
-	}
-	
-	@Override
-	public int addMemberCoinI(int memberpk, double coin) {
-		String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) + "+coin+"  , coin_I = ifnull(coin_I, 0) + "+coin+"  where pk = " + memberpk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberWidByMemberpk(int memberpk, String wid) {
-		String sql = "update memberinfo set WID ='"+ wid +"' where pk = " + memberpk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberInfoToOutCash(int memberpk, double fee) {
-		
-		String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) - "+fee+"  , coin_O = ifnull(coin_O, 0) + "+fee+"  where pk = "+memberpk+"  and coin_A >= "+fee;
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberCoinOToCoinA_Disable(int memberpk, double subtract_coin_o, double plus_coin_a) {
-		
-		String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) + "+ plus_coin_a +", coin_O = ifnull(coin_O, 0) - "+subtract_coin_o+"  where pk = "+memberpk+"  and coin_O >= "+subtract_coin_o;
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateMemberSetPassByPhone(String phone, String pass) {
-		String sql = "update memberinfo set pass = '"+pass+"' where phone='"+phone+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int findMemberIsModel(int memberpk) {
-		String sql = "select count(1) from memberinfo as e "
-					+ " inner join modelinfo as o on o.memberpk = e.pk "
-					+ " where e.pk = "+memberpk+"  and membtype='7'";
-		DbConnection db = new DbConnection();
-		int rows = db.queryOneCount(sql);
-		return rows;
-	}
-
-	@Override
-	public int findMemberpkByQRcode(String QRCode) {
-		String sql = "select pk from memberinfo where QRCode='"+QRCode+"'";
-		DbConnection db = new DbConnection();
-		return db.queryOneCount(sql);
-	}
-
-	@Override
-	public int insertReportInfo(ReportInfo reportInfo) {
-		reportInfo.setReason(reportInfo.getReason() == null ? "" : reportInfo.getReason());
-		String sql = String.format("insert into ReportInfo(appelleePK, accuserPK, reason, createdate)values('%s', '%s', '%s', now())", 
-											reportInfo.getAppelleepk(), reportInfo.getAccuserpk(), reportInfo.getReason()
-								  );
-		
-		DbConnection db = new DbConnection();
-		return db.executeUpdate(sql);
-	}
-
-	@Override
-	public int deleteModelPrivateDiscuss(int modelprivatediscusspk, int privatepk) {
-		String sql = String.format("delete from  ModelPrivateDiscuss where 1=1 and isgood !=1 and privatepk = '%s' and pk = '%s' ", privatepk, modelprivatediscusspk);
-		DbConnection db = new DbConnection();
-		return db.executeUpdate(sql);
-	}
-
-	@Override
-	public int insertNexus(Nexus nexus) {
-		nexus.setRemarks(nexus.getRemarks() == null ? "" : nexus.getRemarks());
-		String sql = String.format("insert into Nexus(memberpk, modelpk, create_date, remarks) values('%s', '%s', now(), '%s')",
-				nexus.getMemberpk(), nexus.getModelpk(), nexus.getRemarks());
-		DbConnection db = new DbConnection();
-		return db.executeUpdate(sql);
-	}
-
-	@Override
-	public int deleteNexus(Nexus nexus) {
-		String sql = String.format("delete from Nexus where pk = '%s'", nexus.getPk());
-		return  new DbConnection().executeUpdate(sql);
-	}
-
-	@Override
-	public Page<List<Nexus>> findNexusByPage(Nexus nexus, int index, int size) {
-		
-		Page<List<Nexus>> resultPage = new Page<List<Nexus>>();
-		
-		DbConnection db = new DbConnection();
-		String sql = String.format("select * from Nexus where memberpk = '%s' ", nexus.getMemberpk());
-		
-		String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
-		int count = db.queryOneCount(sqlPageCount);
-		resultPage.setCount(count);
-		
-		List<Nexus> nexusList = new ArrayList<Nexus>();
-		String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-		CachedRowSet rs = db.executeQuery(sqlPage);
-		try {
-			if(rs != null) {
-				while(rs.next()) {
-					Nexus n = new Nexus();
-					n.setPk(rs.getInt("pk"));
-					n.setMemberpk(rs.getInt("memberpk"));
-					n.setModelpk(rs.getInt("modelpk"));
-					n.setCreate_date(rs.getDate("create_date"));
-					n.setRemarks(rs.getString("remarks"));
-					nexusList.add(n);
-				}
-			}
-			resultPage.setData(nexusList);
-		} catch (SQLException e) {
-			e.printStackTrace();
-		} finally {
-			db.close(rs);
-		}
-		return resultPage;
-	}
-
-	
-	@Override
-	public List<Nexus> findNexusAll(Nexus nexus) {
-		List<Nexus> nexusList = new ArrayList<Nexus>();
-		
-		DbConnection db = new DbConnection();
-		
-		String sql = String.format("select * from Nexus where memberpk = '%s' ", nexus.getMemberpk());
-		CachedRowSet rs = db.executeQuery(sql);
-		try {
-			if(rs != null) {
-				while(rs.next()) {
-					Nexus n = new Nexus();
-					n.setPk(rs.getInt("pk"));
-					n.setMemberpk(rs.getInt("memberpk"));
-					n.setModelpk(rs.getInt("modelpk"));
-					n.setCreate_date(rs.getDate("create_date"));
-					n.setRemarks(rs.getString("remarks"));
-					nexusList.add(n);
-				}
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		} finally {
-			db.close(rs);
-		}
-		return nexusList;
-	}
-
-	
+public class MemberinfoDaoImpl implements MemberinfoDao {
+
+    private static final Logger logger = Logger.getLogger(MemberinfoDaoImpl.class);
+
+    @Override
+    public int insertMemberinfoByRegister(MemberInfo memberinfo) {
+        String tel      = memberinfo.getTel();
+        String pass     = memberinfo.getPass();
+        String pet      = memberinfo.getPet();
+        String token    = memberinfo.getToken() == null ? "" : memberinfo.getToken();
+        int    membtype = Constants.MEMTYPE_HuiYuan;
+
+        //给默认头像
+        String hphoto = Constants.ERROR_IMG_HP2X == null ? "" : Constants.ERROR_IMG_HP2X;
+
+        String       sql = String.format("INSERT INTO memberinfo(Tel, Phone, Pass, Pet, membtype, Token, hphoto, MDate, QRCode) VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', now(), '%s')", tel, tel, pass, pet, membtype, token, hphoto, getNewMemQrCode());
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public int insertMemberinfoByModelRegister(MemberInfo memberinfo) {
+        String tel          = memberinfo.getTel();
+        String pass         = memberinfo.getPass();
+        String pet          = memberinfo.getPet();
+        String token        = memberinfo.getToken() == null ? "" : memberinfo.getToken();
+        int    introducerpk = memberinfo.getIntroducerpk();
+        int    membtype     = Constants.MEMTYPE_Model;
+        //给默认头像
+        String hphoto = Constants.ERROR_IMG_HP2X == null ? "" : Constants.ERROR_IMG_HP2X;
+
+        String       sql = String.format("INSERT INTO memberinfo(Tel, Phone, Pass, Pet, Token, IntroducerPk, hPhoto, membtype, MDate, QRCode) VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', now(), '%s')", tel, tel, pass, pet, token, introducerpk, hphoto, membtype, getNewMemQrCode());
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public String getNewMemQrCode() {
+        DbConnection                  db     = new DbConnection();
+        String                        TmpStr = "", sql;
+        javax.sql.rowset.CachedRowSet rs;
+        int                           Exists = 1;
+        while (Exists == 1) {
+            int Code = (int) ((Math.random() * 9 + 1) * 100000);
+            TmpStr = String.valueOf(Code);
+            sql = "select count(1) C from memberinfo where qrcode='" + TmpStr + "' ";
+            try {
+                rs = db.executeQuery(sql);
+                if (rs == null) {
+                    TmpStr = "";
+                    break;
+                }
+                rs.next();
+                if (rs.getInt("C") > 0) {
+                    TmpStr = "";
+                } else {
+                    Exists = 0;
+                }
+                rs.close();
+            } catch (Exception e) {
+                TmpStr = "";
+                break;
+            }
+        }
+        return TmpStr;
+    }
+
+    @Override
+    public MemberInfo login(String username, String pwd) {
+        MemberInfo memberinfo = new MemberInfo();
+        try {
+            String       sql = "select * from memberinfo where (tel = '" + username + "' or phone='" + username + "') and pass = '" + pwd + "'";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+
+            if (rs != null && rs.size() > 0 && rs.next()) {
+                memberinfo.setPk(rs.getInt("PK"));
+                memberinfo.setMembtype(rs.getInt("MembType"));
+                memberinfo.setMembclass(rs.getInt("MembClass"));
+                memberinfo.setQrcode(rs.getString("QRCode"));
+                memberinfo.setTel(rs.getString("Tel"));
+                memberinfo.setPhone(rs.getString("Phone"));
+                memberinfo.setPet(rs.getString("Pet"));
+                memberinfo.setHphoto(rs.getString("hPhoto"));
+                memberinfo.setPhoto(rs.getString("Photo"));
+                memberinfo.setArea(rs.getInt("Area"));
+                memberinfo.setAge(rs.getString("Age"));
+                memberinfo.setId(rs.getString("ID"));
+                memberinfo.setIslive(rs.getInt("IsLive"));
+                memberinfo.setMdate(rs.getDate("MDate"));
+                memberinfo.setToken(rs.getString("token"));
+                memberinfo.setAcc(rs.getInt("acc"));
+                memberinfo.setLastsign(rs.getDate("LastSign"));
+                memberinfo.setSigndays(rs.getInt("SignDays"));
+                memberinfo.setIdentify(rs.getString("identify"));
+                memberinfo.setWid(rs.getString("WID"));
+                memberinfo.setCoin_a((double) Math.round(rs.getDouble("coin_A") * 100) / 100);
+                memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
+                memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
+                memberinfo.setCoin_is(rs.getDouble("coin_IS"));
+                memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
+                memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
+                memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
+                memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
+                memberinfo.setCoin_i(rs.getDouble("coin_I"));
+                memberinfo.setCoin_or(rs.getDouble("coin_OR"));
+                memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
+                memberinfo.setCoin_os(rs.getDouble("coin_OS"));
+                memberinfo.setCoin_om(rs.getDouble("coin_OM"));
+                memberinfo.setCoin_o(rs.getDouble("coin_O"));
+                db.close(rs);
+            }
+            if (memberinfo.getPk() > 0) {
+                return memberinfo;
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+            return null;
+        }
+    }
+
+    @Override
+    public int getCountToMemberinfoByTel(String tel) {
+        int count = 0;
+        try {
+            String       sql = "select count(1) from memberinfo where tel = '" + tel + "'";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            logger.error(e.getMessage());
+            count = -1;
+        }
+        return count;
+
+    }
+
+    @Override
+    public MemberInfo findMemberinfoByPK(int PK) {
+        MemberInfo memberinfo = new MemberInfo();
+        try {
+            String       sql = "select * from memberinfo where pk=" + PK;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+
+            if (rs != null && rs.size() > 0 && rs.next()) {
+                memberinfo.setPk(rs.getInt("PK"));
+                memberinfo.setMembtype(rs.getInt("MembType"));
+                memberinfo.setMembclass(rs.getInt("MembClass"));
+                memberinfo.setQrcode(rs.getString("QRCode"));
+                memberinfo.setTel(rs.getString("Tel"));
+                memberinfo.setPass(rs.getString("Pass"));
+                memberinfo.setPaypass(rs.getString("PayPass"));
+                memberinfo.setPet(rs.getString("Pet"));
+                memberinfo.setPhone(rs.getString("Phone"));
+                memberinfo.setHphoto(rs.getString("hPhoto"));
+                memberinfo.setPhoto(rs.getString("Photo"));
+                memberinfo.setArea(rs.getInt("Area"));
+                memberinfo.setAge(rs.getString("Age"));
+                memberinfo.setId(rs.getString("ID"));
+                memberinfo.setIslive(rs.getInt("IsLive"));
+                memberinfo.setMdate(rs.getDate("MDate"));
+                memberinfo.setToken(rs.getString("token"));
+                memberinfo.setAcc(rs.getInt("acc"));
+                memberinfo.setLastsign(rs.getDate("LastSign"));
+                memberinfo.setSigndays(rs.getInt("SignDays"));
+                memberinfo.setIntroducerpk(rs.getInt("introducerPK"));
+                memberinfo.setIdentify(rs.getString("identify"));
+                memberinfo.setId_a(rs.getString("iD_A"));
+                memberinfo.setId_a(rs.getString("iD_B"));
+                memberinfo.setId_a(rs.getString("iD_C"));
+                memberinfo.setWid(rs.getString("WID"));
+                memberinfo.setCoin_a((double) Math.round(rs.getDouble("coin_A") * 100) / 100);
+                memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
+                memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
+                memberinfo.setCoin_is(rs.getDouble("coin_IS"));
+                memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
+                memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
+                memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
+                memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
+                memberinfo.setCoin_i(rs.getDouble("coin_I"));
+                memberinfo.setCoin_or(rs.getDouble("coin_OR"));
+                memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
+                memberinfo.setCoin_os(rs.getDouble("coin_OS"));
+                memberinfo.setCoin_om(rs.getDouble("coin_OM"));
+                memberinfo.setCoin_o(rs.getDouble("coin_O"));
+                memberinfo.setCoin_oi(rs.getDouble("coin_OI"));
+                db.close(rs);
+            }
+
+            return memberinfo;
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+            return null;
+        }
+    }
+
+    @Override
+    public Map<String, Object> docard(int MemberPK) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            Map<String, Object> map = new HashMap<String, Object>();
+            String              sql = "select * from (select LastSign, SignDays, (select sum(acc) from AccRecord where MemberPK = " + MemberPK + ") as acc from MemberInfo where pk = " + MemberPK + ")t";
+            DbConnection        db  = new DbConnection();
+            CachedRowSet        rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                map.put("pk", MemberPK);//最后一次签到
+                map.put("lastsign", sdf.format(rs.getDate("LastSign")));//最后一次签到
+                map.put("signdays", rs.getString("SignDays"));//连续签到
+                map.put("acc", rs.getString("acc"));//积分
+                db.close(rs);
+            }
+            return map;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int updatePassword(int PK, String pwd) {
+        String       sql  = "update MemberInfo set Pass='" + pwd + "' where PK = '" + PK + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public String findPwdByTel(String tel) {
+        String       pwd = null;
+        String       sql = "select pass from MemberInfo where Tel = '" + tel + "'";
+        DbConnection db  = new DbConnection();
+        CachedRowSet rs  = db.executeQuery(sql);
+        try {
+            if (rs != null && rs.next()) {
+                pwd = rs.getString("pass");
+            }
+            return pwd;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int findMemberpkByTel(String tel) {
+        int          memberpk = 0;
+        String       sql      = "select pk from MemberInfo where Tel = '" + tel + "'";
+        DbConnection db       = new DbConnection();
+        CachedRowSet rs       = db.executeQuery(sql);
+        try {
+            if (rs != null && rs.next()) {
+                memberpk = rs.getInt(1);
+            }
+            return memberpk;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+
+    @Override
+    public int updatePetByPK(int PK, String Pet) {
+        String       sql  = "update MemberInfo set Pet='" + Pet + "' where PK = " + PK;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateAreaByPK(int PK, int Area) {
+        String       sql  = "update MemberInfo set Area=" + Area + " where PK = " + PK;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberhphotoByPk(int pk, String hphoto) {
+        String       sql  = "update MemberInfo set hPhoto='" + hphoto + "' where pk = " + pk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+
+    @Override
+    public int updateMemberPhoneByPk(int pk, String phone) {
+        String       sql  = "update memberinfo set phone='" + phone + "' where pk = " + pk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberTokenByPk(int pk, String token) {
+        String       sql  = "update memberinfo set token='" + token + "' where pk = '" + pk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberToGiveRed_Disable(int memberPk, double coin) {
+        //发红包 更新金额
+        String       sql  = "update memberinfo set coin_A = coin_A - " + coin + ", coin_OI = ifnull(coin_OI, 0) + " + coin + " where coin_A >= " + coin + " and pk = " + memberPk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberToReceiveRed_Disable(int redPacketPk, int modelPk, int memberPk, double coin) {
+        int result = 0;
+        try {
+            if (coin > 0) {
+                //发红包的人得 预支金额扣掉
+                String       sql  = "update memberinfo set coin_OI = ifnull(coin_OI, 0) - '" + coin + "' where pk = '" + memberPk + "'";
+                DbConnection db2  = new DbConnection();
+                int          rows = db2.executeUpdate(sql);
+                if (rows > 0) {
+                    //收红包的人才的金额加多少
+                    // 百分比扣除coin
+                    double coin_IRR = 0;//红包分红币额
+                    sql = "update memberinfo set coin_A = ifnull(coin_A, 0) + " + coin + ", coin_IR=ifnull(coin_IR, 0) + " + coin + ", coin_IRR=ifnull(coin_IRR, 0) + " + coin_IRR
+                            + " where pk = (select memberpk from modelinfo where pk=" + modelPk + ")";
+                    DbConnection db3 = new DbConnection();
+                    result = db3.executeUpdate(sql);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            result = -1;
+        }
+        return result;
+    }
+
+    @Override
+    public MemberInfo getMemberInfoByPk(int pk) {
+        MemberInfo memberinfo = new MemberInfo();
+        try {
+            String       sql = "select * from memberinfo where pk = '" + pk + "'";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+
+            if (rs != null && rs.size() > 0 && rs.next()) {
+                memberinfo.setPk(rs.getInt("PK"));
+                memberinfo.setMembtype(rs.getInt("MembType"));
+                memberinfo.setMembclass(rs.getInt("MembClass"));
+                memberinfo.setQrcode(rs.getString("QRCode"));
+                memberinfo.setTel(rs.getString("Tel"));
+                memberinfo.setPhone(rs.getString("Phone"));
+                memberinfo.setPet(rs.getString("Pet"));
+                memberinfo.setHphoto(rs.getString("hPhoto"));
+                memberinfo.setPhoto(rs.getString("Photo"));
+                memberinfo.setArea(rs.getInt("Area"));
+                memberinfo.setAge(rs.getString("Age"));
+                memberinfo.setId(rs.getString("ID"));
+                memberinfo.setIslive(rs.getInt("IsLive"));
+                memberinfo.setMdate(rs.getDate("MDate"));
+                memberinfo.setToken(rs.getString("token"));
+                memberinfo.setAcc(rs.getInt("acc"));
+                memberinfo.setLastsign(rs.getDate("LastSign"));
+                memberinfo.setSigndays(rs.getInt("SignDays"));
+                memberinfo.setIdentify(rs.getString("identify"));
+                memberinfo.setWid(rs.getString("WID"));
+                memberinfo.setCoin_a((double) Math.round(rs.getDouble("coin_A") * 100) / 100);
+                memberinfo.setCoin_ir(rs.getDouble("coin_IR"));
+                memberinfo.setCoin_iv(rs.getDouble("coin_IV"));
+                memberinfo.setCoin_is(rs.getDouble("coin_IS"));
+                memberinfo.setCoin_irr(rs.getDouble("coin_IRR"));
+                memberinfo.setCoin_ivv(rs.getDouble("coin_IVV"));
+                memberinfo.setCoin_iss(rs.getDouble("coin_ISS"));
+                memberinfo.setCoin_ill(rs.getDouble("coin_ILL"));
+                memberinfo.setCoin_i(rs.getDouble("coin_I"));
+                memberinfo.setCoin_or(rs.getDouble("coin_OR"));
+                memberinfo.setCoin_ov(rs.getDouble("coin_OV"));
+                memberinfo.setCoin_os(rs.getDouble("coin_OS"));
+                memberinfo.setCoin_om(rs.getDouble("coin_OM"));
+                memberinfo.setCoin_o(rs.getDouble("coin_O"));
+                db.close(rs);
+            }
+            if (memberinfo.getPk() > 0) {
+                return memberinfo;
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+            return null;
+        }
+    }
+
+    @Override
+    public int updateMemberInfoByModelPk(int modelpk, String name, String age, String area) {
+        String sql = "update MemberInfo set ";
+        if (name != null && !name.equals("")) {
+            sql += " Pet = '" + name + "', ";
+        }
+        if (age != null && !age.equals("")) {
+            sql += " age = '" + age + "', ";
+        }
+        if (area != null && !area.equals("")) {
+            sql += " area = '" + area + "', ";
+        }
+
+        sql = sql.substring(0, sql.lastIndexOf(","));
+        sql += " where pk = (select memberpk from modelinfo where pk = " + modelpk + ")";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public String findMemberPetByPk(int pk) {
+        String pet = null;
+        try {
+            String       sql = "select pet from memberinfo where pk = " + pk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                pet = rs.getString(1);
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return pet;
+    }
+
+    @Override
+    public int addMemberCoinI(int memberpk, double coin) {
+        String       sql  = "update memberinfo set coin_A = ifnull(coin_A, 0) + " + coin + "  , coin_I = ifnull(coin_I, 0) + " + coin + "  where pk = " + memberpk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberWidByMemberpk(int memberpk, String wid) {
+        String       sql  = "update memberinfo set WID ='" + wid + "' where pk = " + memberpk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberInfoToOutCash(int memberpk, double fee) {
+
+        String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) - " + fee + "  , coin_O = ifnull(coin_O, 0) + " + fee + "  where pk = " + memberpk + "  and coin_A >= " + fee;
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberCoinOToCoinA_Disable(int memberpk, double subtract_coin_o, double plus_coin_a) {
+
+        String sql = "update memberinfo set coin_A = ifnull(coin_A, 0) + " + plus_coin_a + ", coin_O = ifnull(coin_O, 0) - " + subtract_coin_o + "  where pk = " + memberpk + "  and coin_O >= " + subtract_coin_o;
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateMemberSetPassByPhone(String phone, String pass) {
+        String       sql  = "update memberinfo set pass = '" + pass + "' where phone='" + phone + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int findMemberIsModel(int memberpk) {
+        String sql = "select count(1) from memberinfo as e "
+                + " inner join modelinfo as o on o.memberpk = e.pk "
+                + " where e.pk = " + memberpk + "  and membtype='7'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.queryOneCount(sql);
+        return rows;
+    }
+
+    @Override
+    public int findMemberpkByQRcode(String QRCode) {
+        String       sql = "select pk from memberinfo where QRCode='" + QRCode + "'";
+        DbConnection db  = new DbConnection();
+        return db.queryOneCount(sql);
+    }
+
+    @Override
+    public int insertReportInfo(ReportInfo reportInfo) {
+        reportInfo.setReason(reportInfo.getReason() == null ? "" : reportInfo.getReason());
+        String sql = String.format("insert into ReportInfo(appelleePK, accuserPK, reason, createdate)values('%s', '%s', '%s', now())",
+                                   reportInfo.getAppelleepk(), reportInfo.getAccuserpk(), reportInfo.getReason()
+        );
+
+        DbConnection db = new DbConnection();
+        return db.executeUpdate(sql);
+    }
+
+    @Override
+    public int deleteModelPrivateDiscuss(int modelprivatediscusspk, int privatepk) {
+        String       sql = String.format("delete from  ModelPrivateDiscuss where 1=1 and isgood !=1 and privatepk = '%s' and pk = '%s' ", privatepk, modelprivatediscusspk);
+        DbConnection db  = new DbConnection();
+        return db.executeUpdate(sql);
+    }
+
+    @Override
+    public int insertNexus(Nexus nexus) {
+        nexus.setRemarks(nexus.getRemarks() == null ? "" : nexus.getRemarks());
+        String sql = String.format("insert into Nexus(memberpk, modelpk, create_date, remarks) values('%s', '%s', now(), '%s')",
+                                   nexus.getMemberpk(), nexus.getModelpk(), nexus.getRemarks());
+        DbConnection db = new DbConnection();
+        return db.executeUpdate(sql);
+    }
+
+    @Override
+    public int deleteNexus(Nexus nexus) {
+        String sql = String.format("delete from Nexus where pk = '%s'", nexus.getPk());
+        return new DbConnection().executeUpdate(sql);
+    }
+
+    @Override
+    public Page<List<Nexus>> findNexusByPage(Nexus nexus, int index, int size) {
+
+        Page<List<Nexus>> resultPage = new Page<List<Nexus>>();
+
+        DbConnection db  = new DbConnection();
+        String       sql = String.format("select * from Nexus where memberpk = '%s' ", nexus.getMemberpk());
+
+        String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
+        int    count        = db.queryOneCount(sqlPageCount);
+        resultPage.setCount(count);
+
+        List<Nexus>  nexusList = new ArrayList<Nexus>();
+        String       sqlPage   = CommentUtils.pagingToMysql(sql, index, size);
+        CachedRowSet rs        = db.executeQuery(sqlPage);
+        try {
+            if (rs != null) {
+                while (rs.next()) {
+                    Nexus n = new Nexus();
+                    n.setPk(rs.getInt("pk"));
+                    n.setMemberpk(rs.getInt("memberpk"));
+                    n.setModelpk(rs.getInt("modelpk"));
+                    n.setCreate_date(rs.getDate("create_date"));
+                    n.setRemarks(rs.getString("remarks"));
+                    nexusList.add(n);
+                }
+            }
+            resultPage.setData(nexusList);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            db.close(rs);
+        }
+        return resultPage;
+    }
+
+
+    @Override
+    public List<Nexus> findNexusAll(Nexus nexus) {
+        List<Nexus> nexusList = new ArrayList<Nexus>();
+
+        DbConnection db = new DbConnection();
+
+        String       sql = String.format("select * from Nexus where memberpk = '%s' ", nexus.getMemberpk());
+        CachedRowSet rs  = db.executeQuery(sql);
+        try {
+            if (rs != null) {
+                while (rs.next()) {
+                    Nexus n = new Nexus();
+                    n.setPk(rs.getInt("pk"));
+                    n.setMemberpk(rs.getInt("memberpk"));
+                    n.setModelpk(rs.getInt("modelpk"));
+                    n.setCreate_date(rs.getDate("create_date"));
+                    n.setRemarks(rs.getString("remarks"));
+                    nexusList.add(n);
+                }
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            db.close(rs);
+        }
+        return nexusList;
+    }
+
+
 }

+ 1 - 1
src/main/java/com/thmodel/dao/impl/ModelCardDaoImpl.java

@@ -14,7 +14,7 @@ public class ModelCardDaoImpl implements ModelCardDao {
     @Override
     public List<ModelCard> findModelCardAll() {
         List<ModelCard> list = new ArrayList<ModelCard>();
-        String sql = "select * from ModelCard order by pk";
+        String          sql  = "select * from ModelCard order by pk";
         try {
             DbConnection db = new DbConnection();
             CachedRowSet rs = db.executeQuery(sql);

+ 1757 - 1753
src/main/java/com/thmodel/dao/impl/ModelInfoDaoImpl.java

@@ -31,65 +31,67 @@ import com.thmodel.service.MemberinfoService;
 import com.thmodel.service.impl.MemberinfoServiceImpl;
 
 public class ModelInfoDaoImpl implements ModelInfoDao {
-	private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
-	@Override
-	public Map<String, Object> getmodel(int memberpk, int index, int size) {
-		String whereSql = " m.nominate = 1 ";
-		List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		//获取总数量
-		String sql = getModelInfoSql(memberpk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		resultMap.put("data", list);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-
-	@Override
-	public Map<String, Object> getmodelfan(int pk, int index, int size) {
-		String whereSql = " m.pk in(select modelPK from ModelFan where memberpk = '"+ pk +"') ";
-		List<ModelInfo> list = modelInfoAndPhotoInfoList(pk, whereSql, true, index, size);
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		//获取总数量
-		String sql = getModelInfoSql(pk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		resultMap.put("data", list);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-	
-	@Override
-	public Map<String, Object> modelstar(int memberpk, int pk, int index, int size) {
-		String whereSql = " m.Star = '"+ pk +"' ";
-		List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		//获取总数量
-		String sql = getModelInfoSql(memberpk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		resultMap.put("data", list);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-	
-	/**
-	 * 查询人才表信息及图片全部信息列表
-	 * @return
-	 */
-	public List<ModelInfo> modelInfoAndPhotoInfoList(int memberPk, String where, boolean ispaging, Integer index, Integer size){
-		List<ModelInfo> resultList = new ArrayList<ModelInfo>();
-		try {
+    private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
+
+    @Override
+    public Map<String, Object> getmodel(int memberpk, int index, int size) {
+        String          whereSql = " m.nominate = 1 ";
+        List<ModelInfo> list     = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        //获取总数量
+        String       sql      = getModelInfoSql(memberpk, whereSql);
+        String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        DbConnection db       = new DbConnection();
+        int          count    = db.queryOneCount(sqlCount);
+        resultMap.put("data", list);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    @Override
+    public Map<String, Object> getmodelfan(int pk, int index, int size) {
+        String          whereSql = " m.pk in(select modelPK from ModelFan where memberpk = '" + pk + "') ";
+        List<ModelInfo> list     = modelInfoAndPhotoInfoList(pk, whereSql, true, index, size);
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        //获取总数量
+        String       sql      = getModelInfoSql(pk, whereSql);
+        String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        DbConnection db       = new DbConnection();
+        int          count    = db.queryOneCount(sqlCount);
+        resultMap.put("data", list);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    @Override
+    public Map<String, Object> modelstar(int memberpk, int pk, int index, int size) {
+        String          whereSql = " m.Star = '" + pk + "' ";
+        List<ModelInfo> list     = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        //获取总数量
+        String       sql      = getModelInfoSql(memberpk, whereSql);
+        String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        DbConnection db       = new DbConnection();
+        int          count    = db.queryOneCount(sqlCount);
+        resultMap.put("data", list);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    /**
+     * 查询人才表信息及图片全部信息列表
+     *
+     * @return
+     */
+    public List<ModelInfo> modelInfoAndPhotoInfoList(int memberPk, String where, boolean ispaging, Integer index, Integer size) {
+        List<ModelInfo> resultList = new ArrayList<ModelInfo>();
+        try {
 			
 			
 			/*
@@ -102,1699 +104,1701 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
 				sql += " and " + where;
 			}
 			*/
-			
-			String sql = getModelInfoSql(memberPk, where);
-			//是否分页
-			if(ispaging) {
-				sql = CommentUtils.pagingToMysql(sql, index, size);
-			}
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ModelInfo modelinfo = new ModelInfo();
-					int modelpk = rs.getInt("PK");
-					modelinfo.setPk(modelpk);
-					modelinfo.setMemberpk(rs.getInt("MemberPK"));
-					modelinfo.setBrokepk(rs.getInt("BrokePK"));
-					modelinfo.setBmemberpk(rs.getInt("BMemberPK"));
-					modelinfo.setNominate(rs.getInt("nominate"));
-					modelinfo.setName(rs.getString("pet"));
-					modelinfo.setSex(rs.getInt("Sex"));
-					modelinfo.setHei((int)rs.getDouble("Hei"));
-					modelinfo.setWei((int)rs.getDouble("wei"));
-					modelinfo.setWai((int)rs.getDouble("wai"));
-					modelinfo.setBust((int)rs.getDouble("bust"));
-					modelinfo.setHip((int)rs.getDouble("hip"));
-					modelinfo.setShoe(rs.getDouble("shoe"));
-					modelinfo.setEye(rs.getInt("eye"));
-					modelinfo.setHair(rs.getInt("hair"));
-					modelinfo.setAddr(rs.getString("addr"));
-					
-					modelinfo.setArea(rs.getInt("Area"));
-					modelinfo.setAreaname(rs.getString("AreaName"));
-					
-					modelinfo.setStage(rs.getString("Stage"));
-					modelinfo.setStar(rs.getInt("Star"));
-					modelinfo.setFcount(rs.getInt("FCount"));
-					modelinfo.setLname(rs.getString("LName"));
-					modelinfo.setUcount(rs.getInt("UCount"));
-					modelinfo.setDcount(rs.getInt("DCount"));
-					modelinfo.setVprice(rs.getDouble("VPrice"));
-					modelinfo.setIs_a(rs.getInt("Is_A"));
-					modelinfo.setRatio_v(rs.getDouble("ratio_V"));
-					modelinfo.setRatio_s(rs.getDouble("ratio_S"));
-					modelinfo.setIs_v(rs.getInt("Is_V"));
-					modelinfo.setRdate(rs.getDate("RDate"));
-					modelinfo.setOccupation(rs.getString("occupation"));
-					
-					//拼接3个 技能标签名字
-					int skill_sum = 3;
-					String skillnames = new DbConnection().queryOneString("select GROUP_CONCAT(name separator ' ') from (select name from datatypeinfo where pk in(select skillpk from ModelPrice where ModelPK ="+modelpk+" order by PDate desc ) order by ordid limit "+skill_sum+")tt0_ ");
-					modelinfo.setSkillnames(skillnames);
-					
-					modelinfo.setTel(rs.getString("tel"));//账号
-					
-					modelinfo.setIsattention(rs.getInt("Isattention"));//是否关注
-					
-					modelinfo.setHphoto(rs.getString("hphoto"));//memberinfo 表   头像 
-					
-					//人才图片
-					List<ModelPhoto> modelPhotoList = this.findModelPhotoByModelPk(modelinfo.getPk());
-					
-					modelinfo.setModelphoto(modelPhotoList);
-					resultList.add(modelinfo);
-				}
-				db.close(rs);
-			}
-			return resultList;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-	
-
-	@Override
-	public List<ModelAct> getModelActListByModelPK(int ModelPK) {
-		try {
-			List<ModelAct> list = new ArrayList<ModelAct>();
-			String sql = "select * from ModelAct where ModelPK = '"+ ModelPK +"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					ModelAct ma = new ModelAct();
-					ma.setPk(rs.getInt("PK"));
-					ma.setModelpk(rs.getInt("ModelPk"));
-					ma.setOrderpk(rs.getInt("OrderPk"));
-					ma.setCaption(rs.getString("Caption"));
-					ma.setPic(rs.getString("Pic"));
-					ma.setVideo(rs.getString("Video"));
-					ma.setIntro(rs.getString("intro"));
-					ma.setUcount(rs.getInt("ucount"));
-					ma.setDcount(rs.getInt("dcount"));
-					ma.setAdate(rs.getDate("adate"));
-					list.add(ma);
-				}
-				db.close(rs);
-			}
-			return list;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public List<Map<String, Object>> getfan(int ModelPK) {
-		List<Map<String, Object>> list= new ArrayList<Map<String, Object>>();
-		try {
-			String sql= "select m.PK, f.FDate, m.Tel, m.Pet, m.hPhoto, m.Photo, m.Area from memberinfo m "
-					+" INNER JOIN ModelFan f on m.pk = f.MemberPk"
-					+" where f.ModelPK = '"+ ModelPK +"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("pk", rs.getInt("pk"));
-					map.put("fdate", MyDateUtil.format(rs.getDate("FDate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("tel", rs.getString("Tel"));
-					map.put("pet", rs.getString("Pet"));
-					map.put("hphoto", rs.getString("hPhoto"));
-					map.put("photo", rs.getString("photo"));
-					map.put("Area", rs.getString("Area"));
-					list.add(map);
-				}
-				db.close(rs);
-			}
-			return list;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public List<ModelPrice> getprice(int ModelPK) {
-		List<ModelPrice> list = new ArrayList<ModelPrice>();
-		try {
-			String sql = "select * from ModelPrice where ModelPK = '"+ ModelPK +"' order by OrderID";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					ModelPrice mp = new ModelPrice();
-					mp.setPk(rs.getInt("pk"));
-					mp.setPdate(rs.getDate("PDate"));
-					mp.setPname(rs.getString("PName"));
-					mp.setPrice(rs.getDouble("Price"));
-					mp.setUnit(rs.getString("Unit"));
-					mp.setOrderid(rs.getInt("OrderID"));
-					mp.setSkillpk(rs.getInt("Skillpk"));
-					list.add(mp);
-				}
-				db.close(rs);
-			}
-			return list;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public List<ChatRecord> findChatRecordByModelPkAndMemberPK(int ModelPk, Integer MemberPK) {
-		List<ChatRecord> list = new ArrayList<ChatRecord>();
-		try {
-			String sql = "select * from ChatRecord where ModelPK = '"+ ModelPk +"' ";
-			if(MemberPK!=null){
-				sql += " and MemberPK = '"+ MemberPK +"' ";
-			}
-			sql += " order by CDate desc limit 50";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ChatRecord cr = new ChatRecord();
-					cr.setPk(rs.getInt("PK"));
-					cr.setCdate(rs.getDate("CDate"));
-					cr.setMemberpk(rs.getInt("MemberPK"));
-					cr.setModelpk(rs.getInt("Modelpk"));
-					cr.setChat(rs.getString("chat"));
-					cr.setCtype(rs.getString("CType"));
-					list.add(cr);
-				}
-				db.close(rs);
-			}
-			return list;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public int insertChatRecord(String CDate, String ModelPK, String MemberPK,
-			String chat, String CType) {
-		
-		String sql = "insert into ChatRecord(CDate,ModelPK,MemberPK,chat,CType) values('"+CDate+"', '"+ModelPK+"', '"+MemberPK+"', '"+chat+"', '"+CType+"')";
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public int updateModelInfoSetCardPK(int ModelPk, int CardPK) {
-		String sql = "update ModelInfo set CardPK = '"+CardPK+"', Rdate = now() where pk = '"+ModelPk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateModelInfoClearMCard(int ModelPk) {
-		String sql = "update ModelInfo set CardPK = '0', Rdate = now() where pk = '"+ModelPk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public List<HonorInfo> findHonorInfoByModelPk(int ModelPk) {
-		List<HonorInfo> list = new ArrayList<HonorInfo>();
-		try {
-			String sql = "select * from HonorInfo where ModelPk='"+ ModelPk +"'";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					HonorInfo hi = new HonorInfo();
-					hi.setPk(rs.getInt("Pk"));
-					hi.setHdate(rs.getString("Hdate"));
-					hi.setHonor(rs.getString("Honor"));
-					hi.setModelpk(rs.getInt("Modelpk"));
-					list.add(hi);
-				}
-				db.close(rs);
-			}
-			return list;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public int insertHonorInfo(int ModelPK, List<String> Honors) {
-		if(Honors.size() > 0) {
-			StringBuffer sb_sql = new StringBuffer("insert into HonorInfo(Modelpk, Hdate, Honor)values");
-			
-			for (String honor : Honors) {
-				sb_sql.append("('"+ModelPK+"', now(), '"+honor+"'),");
-			}
-			String sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
-			DbConnection db = new DbConnection();
-			int pk = db.executeUpdate(sql);
-			return pk;
-		} else {
-			return 0;
-		}
-	}
-	
-	/**
-	 * 经纪人/机构 单表 通用查询遍历
-	 * @param rs
-	 * @return
-	 */
-	public List<BrokerInfor> constantBrokeInfor(CachedRowSet rs){
-		List<BrokerInfor> list = new ArrayList<BrokerInfor>();
-		try {
-			if(rs!=null){
-				while(rs.next()){
-					BrokerInfor bi = new BrokerInfor();
-					bi.setAddr(rs.getString("Addr"));
-					bi.setAuth(rs.getString("Auth"));
-					bi.setIntro(rs.getString("Intro"));
-					bi.setIsadmin(rs.getInt("Isadmin"));
-					bi.setLinkman(rs.getString("Linkman"));
-					bi.setLinktype(rs.getString("Linktype"));
-					bi.setLogo(rs.getString("Logo"));
-					bi.setMemberpk(rs.getInt("Memberpk"));
-					bi.setName(rs.getString("Name"));
-					bi.setPk(rs.getInt("Pk"));
-					bi.setRatio_l(rs.getDouble("Ratio_l"));
-					bi.setRatio_r(rs.getDouble("Ratio_r"));
-					bi.setRatio_s(rs.getDouble("Ratio_s"));
-					bi.setRatio_v(rs.getDouble("Ratio_v"));
-					bi.setSex(rs.getInt("Sex"));
-					bi.setSuperpk(rs.getInt("Superpk"));
-					bi.setOutfit(rs.getString("outfit"));
-					list.add(bi);
-				}
-				rs.close();
-			}
-			return list;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-	
-	@Override
-	public Map<String, Object> findBrokeInforByPk(int pk) {
-		Map<String, Object> map = new HashMap<String, Object>();
-		try {
-			String sql = "select b.*,(select count(1) from modelinfo where BrokePK = b.pk) as modelcount from brokerinfor b where pk = '"+ pk +"'";
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()){
-				map.put("brokepk", rs.getString("pk"));
-				map.put("memberpk", rs.getString("Memberpk"));
-				map.put("logo", rs.getString("logo"));
-				map.put("superpk", rs.getString("superpk"));
-				map.put("sex", rs.getString("sex"));
-				map.put("name", rs.getString("name"));
-				map.put("addr", rs.getString("addr"));
-				map.put("intro", rs.getString("intro"));
-				map.put("linkman", rs.getString("linkman"));
-				map.put("linktype", rs.getString("linktype"));
-				map.put("outfit", rs.getString("outfit"));
-				map.put("modelcount", rs.getString("modelcount"));
-				db.close(rs);
-			}
-			return map;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public int getModelCount(int BrokePK) {
-		int count = 0;
-		String sql = "select count(1) from modelinfo where BrokePK = '"+BrokePK+"'";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null && rs.next()){
-				count = rs.getInt(1);
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return count;
-	}
-
-	@Override
-	public Map<String, Object> findBrokeInforLikeName(String LikeName, int index, int size) {
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		
-		try {
-			List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); 
-			String sql = "select b.*, m.Pet, (select name from datatypeinfo WHERE pk = m.Area) as area , " 
-						+ " (select count(1) from modelinfo tt11_ where tt11_.BrokePK = b.pk and (select count(1) from modelphoto where ModelPK = tt11_.PK)>0) as modelcount "
-						+ " from brokerinfor b "
-						+ " INNER JOIN MemberInfo m on b.MemberPK = m.pk "
-						+ " where 1=1 "
-						+ " and IsAdmin != 1 "
-						+ " and (select count(1) from modelinfo tt2_ where tt2_.BrokePK = b.pk and (select count(1) from modelphoto where ModelPK = tt2_.PK)>0)>0 ";
-			if(LikeName != null && !LikeName.equals("")){
-				sql += " and Name like '%"+ LikeName +"%'";
-			}
-			//获取分页总数量
-			String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-			int count = new DbConnection().queryOneCount(sqlCount);
-			
-			sql = CommentUtils.pagingToMysql(sql, index, size);
-			
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			
-			if(rs!=null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					
-					String brokepk = rs.getString("pk");
-					int modelcount = rs.getInt("modelcount");
-					map.put("brokepk", brokepk);
-					map.put("memberpk", rs.getString("Memberpk"));
-					map.put("logo", rs.getString("logo"));
-					map.put("superpk", rs.getString("superpk"));
-					map.put("sex", rs.getString("sex"));
-					map.put("name", rs.getString("name"));
-					map.put("addr", rs.getString("addr"));
-					map.put("intro", rs.getString("intro"));
-					map.put("linkman", rs.getString("linkman"));
-					map.put("linktype", rs.getString("linktype"));
-					map.put("outfit", rs.getString("outfit"));
-					map.put("pet", rs.getString("pet"));
-					map.put("area", rs.getString("area"));
-					map.put("modelcount", modelcount);
-					
-					List<Integer> photoPkList = new ArrayList<Integer>();
-					List<String> photoList = new ArrayList<String>();
-					sql = "select distinct modelpk, t.photo from(select * from modelphoto where modelpk in (select PK from modelinfo where brokepk = '"+rs.getString("pk")+"')ORDER BY modelpk,OrdId) t group by modelpk";
-					
-					CachedRowSet rs2 = db.executeQuery(sql);
-					if(rs2!=null){
-						while(rs2.next()){
-							photoPkList.add(rs2.getInt("modelpk"));
-							photoList.add(rs2.getString("photo"));
-						}
-						db.close(rs2);
-					}
-					
-					map.put("photopk", photoPkList);
-					map.put("modelphoto", photoList);
-					
-					if(modelcount > 0) {
-						list.add(map);
-					}
-				}
-				db.close(rs);
-			}
-			resultMap.put("data", list);
-			resultMap.put("count", count);
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return resultMap;
-	}
-
-	@Override
-	public int updateModelInfoSetBrokeByPk(int PK, int BrokePK, int BMemberPK) {
-		String sql = "update ModelInfo set BrokePK='"+BrokePK+"', BMemberPK='"+BMemberPK+"' where PK='"+PK+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public Map<String, Object> findModelByBrokePk(int memberpk, int brokePk, int index, int size) {
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		
-		String whereSql = " m.BrokePK = '"+ brokePk +"' ";
-		List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-		
-		//获取总数量
-		String sql = getModelInfoSql(memberpk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		resultMap.put("data", list);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-
-	@Override
-	public Map<String, Object> findModelInfoByName(int memberpk, String likeName, int index, int size) {
-		String whereSql = null;
-		if(likeName!=null && !likeName.equals("")){
-			whereSql = " (b.pet like '%"+ likeName +"%' or m.Stage like '%"+ likeName +"%')";
-		}
-		List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		//获取总数量
-		String sql = getModelInfoSql(memberpk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		
-		resultMap.put("data", list);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-
-	@Override
-	public List<ModelPhoto> findModelPhotoByModelPk(int modelPk) {
-		try {
-			List<ModelPhoto> modelPhotoList = new ArrayList<ModelPhoto>();
-			String sql = "select * from ModelPhoto where ModelPK = "+modelPk+" order by OrdID";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ModelPhoto modelphoto = new ModelPhoto();
-					modelphoto.setPk(rs.getInt("PK"));
-					modelphoto.setModelpk(rs.getInt("ModelPK"));
-					modelphoto.setPhoto(rs.getString("Photo"));
-					modelphoto.setOrdid(rs.getInt("OrdID"));
-					modelphoto.setRdate(rs.getDate("RDate"));
-					modelPhotoList.add(modelphoto);
-				}
-				db.close(rs);
-			}
-			return modelPhotoList;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public Page<List<ModelPrivate>> findModelPrivateByModelPk(int modelPk, int memberpk, int index, int size) {
-		Page<List<ModelPrivate>> page = new Page<List<ModelPrivate>>();
-		
-		List<ModelPrivate> modelPrivateList = new ArrayList<ModelPrivate>();
-		StringBuffer sb = new StringBuffer();
-		sb.append(" select t1_.pk, t1_.modelpk, t1_.pdate, t1_.intro, t1_.ucount,t1_.dcount,");
-		sb.append(" if(t1_.islikes>0, '1', '0') as 'islikes'");
-		sb.append(" from (");
-		sb.append(" select t0_.*, ");
-		sb.append(" (select count(1) from modelprivatediscuss where isgood='1' and privatepk=t0_.pk and memberpk='"+memberpk+"' )as islikes");
-		sb.append(" from modelprivate t0_ ");
-		sb.append(" where t0_.ModelPK = '"+modelPk+"' ");
-		sb.append(" order by t0_.PDate desc");
-		sb.append(" )t1_");
-		String sql = sb.toString();
-		
-		//获取分页总数量
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		int count = new DbConnection().queryOneCount(sqlCount);
-		 
-		String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-		
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs!=null){
-				while(rs.next()){
-					ModelPrivate mp = new ModelPrivate();
-					mp.setPk(rs.getInt("pk"));
-					mp.setModelpk(rs.getInt("modelpk"));
-					mp.setIntro(rs.getString("Intro"));
-					mp.setPdate(rs.getDate("pdate"));
-					mp.setDcount(rs.getInt("dcount"));
-					mp.setUcount(rs.getInt("ucount"));
-					mp.setIslikes(rs.getInt("islikes"));//我是否点赞
-					modelPrivateList.add(mp);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-		}
-		
-		page.setCount(count);
-		page.setData(modelPrivateList);
-		
-		return page;
-	}
-
-	@Override
-	public List<ModelPrivateItem> findModelPrivateItemByPrivatePk(int privatePk) {
-		List<ModelPrivateItem> modelPrivateItemList = new ArrayList<ModelPrivateItem>();
-		String sql = "select * from modelprivateitem where privatepk="+privatePk+" order by pk";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ModelPrivateItem mpi = new ModelPrivateItem();
-					mpi.setPk(rs.getInt("pk"));
-					mpi.setPrivatepk(rs.getInt("privatepk"));
-					mpi.setUrl(rs.getString("url"));
-					mpi.setFtype(rs.getString("ftype"));
-					
-					modelPrivateItemList.add(mpi);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-		}
-		return modelPrivateItemList;
-	}
-
-	@Override
-	public List<ModelPrivateDiscuss> findModelPrivateDiscussByPrivatePk(int privatePk) {
-		List<ModelPrivateDiscuss> modelPrivateDiscussList = new ArrayList<ModelPrivateDiscuss>(); 
-		String sql = "select * from modelprivatediscuss where privatepk = "+privatePk+" and isgood=0 order by idate";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ModelPrivateDiscuss mpd = new ModelPrivateDiscuss();
-					mpd.setPk(rs.getInt("pk"));
-					mpd.setPrivatepk(rs.getInt("privatepk"));
-					mpd.setParentpk(rs.getInt("parentpk"));
-					mpd.setMemberpk(rs.getInt("memberpk"));
-					mpd.setIdate(rs.getDate("idate"));
-					mpd.setIsgood(rs.getInt("isgood"));
-					mpd.setIntro(rs.getString("intro"));
-					
-					modelPrivateDiscussList.add(mpd);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-		}
-		return modelPrivateDiscussList;
-	}
-
-	@Override
-	public int insertModelPrivate(int modelPk, String intro) {
-		String sql = "insert into ModelPrivate(ModelPK, PDate, Intro, UCount, DCount) values('"+modelPk+"', now(), '"+intro+"', '0', '0')";
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public int insertModelPrivateItem(int privatePk, String url, String fType) {
-		String sql = "insert into ModelPrivateItem(PrivatePK, URL, FType)values";
-		int pk = 0;
-		String[] urls = url.split(",");
-		//url 不能为空(可以是多个 用逗号隔开)
-		if(url.length()>0) {
-			for (String urlStr : urls) {
-				if(urlStr != null && !urlStr.equals("")) {
-					sql += "('"+privatePk+"', '"+urlStr+"', '"+fType+"'),";
-				}
-			}
-			sql = sql.substring(0, sql.lastIndexOf(","));
-			DbConnection db = new DbConnection();
-			pk = db.executeUpdate(sql);
-		}
-		return pk;
-	}
-
-	@Override
-	public int praisePrivate(int privatePk, int memberPk) {
-		//添加点赞
-		//IsGood == 1  点赞
-		String sql = "insert into modelprivatediscuss(PrivatePK, ParentPK, MemberPK, IDate, IsGood) values('"+privatePk+"', '0', '"+memberPk+"', now(), '1')";
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-	@Override
-	public int notPraisePrivate(int privatePk, int memberPk) {
-		//取消点赞
-		//IsGood == 1  点赞
-		String sql = "delete from modelprivatediscuss where privatePk = '"+privatePk+"' and memberPk = '"+memberPk+"' ";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int insertModelPrivateDiscuss(int privatePk, int memberPk,
-			int parentPk, String intro) {
-		//IsGood == 0  评论
-		String sql = "insert into modelprivatediscuss(PrivatePK, ParentPK, MemberPK, IDate, IsGood, Intro) " +
-					" values('"+privatePk+"', '"+parentPk+"', '"+memberPk+"', now(), '0', '"+intro+"')";
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public List<Map<String, Object>> findCustomImage(Integer modelPk) {
-		//获取用户印象
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		
-		String sql = "select mf.FigurePK ,dt.Name,count(mf.PK) as FigureCount"
-					+ " from ModelFigure mf,DataTypeInfo dt"
-					+ " where mf.FigurePK=dt.PK ";
-		//modelPk  没有就是查询全部
-		if(modelPk !=null && modelPk > 0){
-			sql += " and mf.ModelPK="+modelPk;
-		}
-					
-		sql += " group by mf.FigurePK,dt.Name "
-			+  " order by FigureCount desc";
-		
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("figurepk", rs.getInt("figurepk"));
-					map.put("name", rs.getString("name"));
-					map.put("figurecount", rs.getString("figureCount"));
-					resultMapList.add(map);
-				}
-				db.close(rs);
-			}
-			return resultMapList; 
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-		
-	}
-
-	@Override
-	public List<Map<String, Object>> findSelfFigure(int modelPk) {
-		
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		//IsSelf = 1   是自评
-		String sql = "select t.pk, t.name from ModelFigure f "
-					+ " inner join DataTypeInfo t on f.figurepk = t.pk"
-					+ " where f.IsSelf=1 and f.modelpk = '"+modelPk+"'"
-					+ " order by f.Fdate desc";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("pk", rs.getInt("pk"));
-					map.put("name", rs.getString("name"));
-					
-					resultMapList.add(map);
-				}
-				db.close(rs);
-			}
-			return resultMapList;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-		
-	}
-
-	@Override
-	public List<Map<String, Object>> findCustomFigure(int modelPk) {
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		//IsSelf != 1   不是自评
-		String sql = "select f.memberpk, GROUP_CONCAT(f.FigurePK SEPARATOR ',') as figurepk, m.hPhoto, m.pet from ModelFigure f"
-					+ " inner join memberinfo m on f.memberpk = m.PK"
-					+ " where IsSelf !=1 and f.modelpk = '"+modelPk+"'"
-					+ " group by f.memberpk"
-					+ " order by f.memberpk, f.Fdate desc";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					
-					String figurepks = rs.getString("figurepk");
-					map.put("memberpk", rs.getInt("memberpk"));
-					map.put("hphoto", rs.getString("hPhoto"));
-					map.put("pet", rs.getString("pet"));
-					
-					map.put("cfigures", findDataTypeInfoByPk(figurepks));
-					resultMapList.add(map);
-				}
-				db.close(rs);
-			}
-			return resultMapList;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-	
-	public List<Map<String, Object>> findDataTypeInfoByPk(String pks){
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		try {
-			String sql = "select pk, name from DataTypeInfo where PK in ("+pks+")";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> resultMap = new HashMap<String, Object>();
-					resultMap.put("pk", rs.getInt("pk"));
-					resultMap.put("name", rs.getString("name"));
-					resultMapList.add(resultMap);
-				}
-				db.close(rs);
-			}
-			return resultMapList;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-	
-	@Override
-	public Map<String, Object> findDataTypeInfoByPkOrTypeName(int memberpk, String pks, String typeName, int index, int size) {
-		try {
-			Map<String, Object> resultMap = new HashMap<String, Object>();
-			String whereSql = " m.pk in(select distinct modelpk from modelprice where skillpk in ("+pks+")) ";
-			
-			List<ModelInfo> modelInfoList = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-			
-			//获取总数量
-			String sql = getModelInfoSql(memberpk, whereSql);
-			String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-			DbConnection db = new DbConnection();
-			int count = db.queryOneCount(sqlCount);
-			
-			resultMap.put("count", count);
-			resultMap.put("data", modelInfoList);
-			
-			return resultMap;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-
-	
-	@Override
-	public Map<String, Object> findModelByFigurePks(int memberpk, String figurePks, int index, int size){
-		String whereSql = " m.pk in (select * from (select modelpk from ModelFigure where FigurePK in ("+figurePks+") group by modelpk order by count(pk) desc)t1)"; 
-		List<ModelInfo> modelInfoList = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
-		
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		//获取总数量
-		String sql = getModelInfoSql(memberpk, whereSql);
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sqlCount);
-		resultMap.put("data", modelInfoList);
-		resultMap.put("count", count);
-		
-		return resultMap;
-	}
-
-	@Override
-	public List<Map<String, Object>> findModelFigureByModelPkAndMemberPk(
-			int memberPk, int modelPk) {
-		List<Map<String, Object>> resultMapList = new ArrayList<Map<String,Object>>();
-		String sql = "select pk,name from DataTypeInfo where pk in(select FigurePk from ModelFigure where modelpk ="+modelPk+" and memberpk = "+memberPk+")";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null){
-				while(rs.next()){
-					Map<String, Object> resultMap = new HashMap<String, Object>();
-					resultMap.put("pk", rs.getInt("pk"));
-					resultMap.put("name", rs.getString("name"));
-					resultMapList.add(resultMap);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return resultMapList;
-	}
-
-	@Override
-	public int insertModelFigure(int memberPk, int modelPk, String figurePks, int isSelf) {
-		
-		String sql = "insert into ModelFigure (modelpk, figurepk, fDate, MemberPk, IsSelf) values";
-		
-		String[] figurePkArray = figurePks.split(",");
-		
-		for (String figurePk : figurePkArray) {
-			sql += "("+modelPk+", "+figurePk+", now(), "+memberPk+", "+isSelf+"),";
-		}
-		sql = sql.substring(0, sql.length()-1);
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		
-		return rows;
-	}
-
-	@Override
-	public Map<String, Object> findModelInfoByPk(int memberpk, int modelPk) {
-		String whereSql = " m.pk = '"+modelPk+"'";
-		List<ModelInfo> modelList = modelInfoAndPhotoInfoList(memberpk, whereSql, false, null, null);
-		
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		resultMap.put("data", modelList);
-		
-		return resultMap;
-	}
-
-	@Override
-	public List<ModelPrivateDiscuss> getPraiseByPrivatePk(int privatePk) {
-		List<ModelPrivateDiscuss> resultList = new ArrayList<ModelPrivateDiscuss>();
-		//isgood = 1  点赞
-		String sql = "select * from modelprivatediscuss where isgood = 1 and privatepk='"+privatePk+"'";
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs!=null){
-				while(rs.next()){
-					ModelPrivateDiscuss mpd = new ModelPrivateDiscuss();
-					mpd.setPk(rs.getInt("pk"));
-					mpd.setPrivatepk(rs.getInt("privatepk"));
-					mpd.setParentpk(rs.getInt("parentpk"));
-					mpd.setMemberpk(rs.getInt("memberpk"));
-					mpd.setIdate(rs.getDate("idate"));
-					mpd.setIsgood(rs.getInt("isgood"));
-					mpd.setIntro(rs.getString("intro"));
-					resultList.add(mpd);
-				}
-				db.close(rs);
-			}
-			
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return resultList;
-	}
-
-	@Override
-	public Page<List<Map<String, Object>>> findModelPrivateLimit(int privatePk, int index, int size) {
-		
-		Page<List<Map<String, Object>>> page = new Page<List<Map<String, Object>>>();
-		
-		List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
-		String sql = "select d.pk, d.PrivatePK, d.ParentPK, d.MemberPK, d.IDate, d.Intro, m.Pet, m.hPhoto "
-					+ " from ModelPrivateDiscuss d " 
-					+ " inner join memberinfo m on d.MemberPK = m.PK "
-					+ " where d.IsGood != 1 and d.privatepk = '"+ privatePk +"' "
-					+ " order by d.idate desc ";
-		
-		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-		int count = new DbConnection().queryOneCount(sqlCount);
-		
-		String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-		try {
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs!=null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("pk", rs.getInt("pk"));
-					map.put("privatepk", rs.getInt("privatepk"));
-					map.put("parentpk", rs.getInt("parentpk"));
-					map.put("memberpk", rs.getInt("memberpk"));
-					map.put("idate", MyDateUtil.format(rs.getDate("idate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("intro", rs.getString("intro"));
-					map.put("pet", rs.getString("pet"));
-					map.put("hphoto", rs.getString("hphoto"));
-					resultList.add(map);
-				}
-				db.close(rs);
-			}
-			
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-		page.setCount(count);
-		page.setData(resultList);
-		return page;
-	}
-
-	@Override
-	public Page<List> findModelInfoAndPhotoInfoList(int memberPk, int index, int size) {
-		
-		Page<List> page = new Page<List>();
-		
-		List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
-		try {
-			String sql = "select a.pk as privatepk, a.modelpk, a.pdate, min(b.pk ) as peivateitempk,"
-						+ " min(b.url) as img, member.pk as memberpk, member.pet, member.hphoto, d.name as area,"
-						+ " (select count(1) from ModelPrivateDiscuss where isgood  = 1 and privatepk = a.PK) as 'likesCount',"
-						+ " (select count(1) from ModelPrivateDiscuss d inner join memberinfo m on d.MemberPK = m.PK  where d.isgood != 1 and d.privatepk = a.PK) as 'commentCount',"
-						+ " (select count(1) from ModelFan where modelPK = a.ModelPK) as 'attentionCount',"
-						+ " (select count(1) from ModelPrivateDiscuss where isgood=1 and privatepk = a.pk and memberpk = "+memberPk+") as 'IsLikes',"
-						+ " (select count(1) from ModelFan where modelPK = a.modelpk and memberpk = "+memberPk+") as 'IsAttention'"
-						+ " from modelprivate a "
-						+ " inner join modelprivateitem b on a.pk = b.privatepk "
-						+ " inner join modelinfo model on model.pk = a.modelpk "
-						+ " inner join memberinfo member on model.memberpk = member.pk "
-						+ " inner join datatypeinfo d on member.area = d.pk "
-						+ " where 1=1 ";
-						
-			//屏蔽摸特
-			List<Nexus> nexusList = memberinfoService.getAllNexus(new Nexus(memberPk));
-			if(nexusList != null && nexusList.size() > 0) {
-				StringBuffer sb = new StringBuffer("0,"); 
-				for (Nexus nexus : nexusList) {
-					sb.append(nexus.getModelpk());
-					sb.append(",");
-				}
-				String nexuspks = sb.substring(0, sb.lastIndexOf(","));
-				sql += " and a.modelpk not in ("+nexuspks+") ";
-			}
-			sql += " group by a.pk,a.modelpk ";
-			sql += " order by a.pk desc ";
-			
-			//分页总数量
-			String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
-			int count = new DbConnection().queryOneCount(sqlPageCount);
-			page.setCount(count);
-			String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs!=null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					
-					map.put("privatepk", rs.getString("privatepk"));
-					map.put("modelpk", rs.getString("modelpk"));
-					map.put("pdate", MyDateUtil.format(rs.getDate("pdate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("peivateitempk", rs.getString("peivateitempk"));
-					map.put("img", rs.getString("img"));
-					map.put("memberpk", rs.getString("memberpk"));
-					map.put("pet", rs.getString("pet"));
-					map.put("hphoto", rs.getString("hphoto"));
-					map.put("area", rs.getString("area"));
-					
-					//评论、点赞、关注	是否点赞、是否关注
-					map.put("likescount", rs.getString("likesCount"));//点赞数量
-					map.put("commentcount", rs.getString("commentCount"));//评论数量
-					map.put("attentioncount", rs.getString("attentionCount"));//关注数量
-					
-					map.put("islikes", rs.getString("IsLikes"));//是否点赞
-					map.put("isattention", rs.getString("IsAttention"));//是否关注
-					
-					resultList.add(map);
-				}
-				db.close(rs);
-			}
-			page.setData(resultList);
-			return page;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
-
-	@Override
-	public boolean findAttention(int memberPk, int modelPk) {
-		//返回值为true:已关注   false:未关注
-		boolean flag = false;
-		try {
-			String sql = "select count(1) from ModelFan where modelPK = " + modelPk + " and memberpk = " + memberPk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				int count = rs.getInt(1);
-				if(count > 0) {
-					flag = true;
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return flag;
-	}
-
-	@Override
-	public boolean findLikes(int memberPk, int privatePk) {
-		//返回值为true:已点赞  false:未点赞
-		boolean flag = false;
-		try {
-			//isgood = 1  点赞		0:评论
-			String sql = "select count(1) from ModelPrivateDiscuss where isgood=1 and privatepk = '"+privatePk+"' and memberpk = " + memberPk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				int count = rs.getInt(1);
-				if(count > 0) {
-					flag = true;
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return flag;
-	}
-
-	@Override
-	public int insertModelFan(int memberPk, int modelPk) {
-		String sql = "insert into ModelFan(modelPk, memberPk, fdate) values('" + modelPk + "', '" + memberPk + "', now())";
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public int deleteModelFan(int memberPk, int modelPk) {
-		String sql = "delete from ModelFan where memberPk='" + memberPk + "' and modelPk='" + modelPk + "'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateModelFanSetFCount(int modelPk) {
-		String sql = "update ModelInfo set FCount=(select count(1) from ModelFan where modelPk = '" + modelPk+"') where pk = " + modelPk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public List<Map<String, Object>> getSkillData(int modelPk) {
-		List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
-		try {
-			String sql = "select "
-						+ " model.lname, model.memberpk, p.pk, p.modelpk, p.pdate, p.price, p.unit, p.skillpk, p.skillphoto, datatype.name"
-						+ " from ModelPrice p "
-						+ " inner join ModelInfo model on p.modelpk = model.pk "
-						+ " inner join datatypeinfo datatype on p.skillpk = datatype.pk "
-						+ " where p.modelpk = " + modelPk
-						+ " order by p.orderid";
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null) {
-				while(rs.next()) {
-					Map<String, Object> map = new HashMap<String, Object>();
-					
-					map.put("skillphoto", rs.getString("skillphoto"));	//工作照片
-					map.put("modelpk", rs.getString("modelpk"));		//人才pk
-					map.put("memberpk", rs.getString("memberpk"));		//会员pk
-					map.put("modelpricepk", rs.getString("pk"));		//技能pk(人才服务pk)
-					map.put("pdate", MyDateUtil.format(rs.getDate("pdate"), MyDateUtil.DATE_FORMAT_1));//定价日期
-					map.put("name", rs.getString("name"));			//技能标签名称
-					map.put("price", rs.getDouble("price"));		//价格
-					map.put("unit", rs.getString("unit"));			//价格单位
-					map.put("skillpk", rs.getString("skillpk"));	//技能标签pk
-					map.put("lname", rs.getString("lname"));		//个性签名
-					
-					mapList.add(map);
-				}
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return mapList;
-	}
-
-	@Override
-	public int insertModelPrice(int skillpk, int modelpk, String skillphoto, double price, String unit, int orderid) {
-		
-		String sql = "insert into ModelPrice(ModelPK, PDate, Price, Unit, OrderID, SkillPK, skillphoto)"
-				+ " values('"+modelpk+"', now(), '"+price+"', '"+unit+"', '"+orderid+"', '"+skillpk+"', '"+skillphoto+"')";
-		
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		
-		return pk;
-	}
-
-	@Override
-	public int updateModelPrice(int pk, int modelpk, String skillpk, String skillphoto, String price, String unit, String orderid) {
-		
-		StringBuffer sb_sql = new StringBuffer();
-		
-		sb_sql.append("update ModelPrice set ");
-		
-		if(skillpk != null && !skillpk.equals("")) {
-			sb_sql.append(" skillpk = '"+skillpk+"', ");
-		}
-		if(skillphoto != null && !skillphoto.equals("")) {
-			sb_sql.append(" skillphoto = '"+skillphoto+"', ");
-		}
-		if(price != null && !price.equals("")) {
-			sb_sql.append(" price = '"+price+"', ");
-		}
-		if(unit != null && !unit.equals("")) {
-			sb_sql.append(" unit = '"+unit+"', ");
-		}
-		if(orderid != null && !orderid.equals("")) {
-			sb_sql.append(" orderid = '"+orderid+"', ");
-		}
-		String sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
-		sql += " where pk = '" + pk + "' and modelpk='" + modelpk + "'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateModelInfoByModelPk(int modelpk, String hei, String wei, String wai, String bust, String hip, String lname, String name, String vprice) {
-		String sql = "update ModelInfo set ";
-		if(hei != null && !hei.equals("")) {
-			sql += " hei = '" + hei + "', ";
-		}
-		if(wei != null && !wei.equals("")) {
-			sql += " wei = '" + wei + "', ";
-		}
-		if(wai != null && !wai.equals("")) {
-			sql += " wai = '" + wai + "', ";
-		}
-		if(bust != null && !bust.equals("")) {
-			sql += " bust = '" + bust + "', ";
-		}
-		if(hip != null && !hip.equals("")) {
-			sql += " hip = '" + hip + "', ";
-		}
-		if(lname != null && !lname.equals("")) {
-			sql += " lname = '" + lname + "', ";
-		}
-		if(name != null && !name.equals("")) {
-			sql += " name = '" + name + "', ";
-		}
-		if(vprice != null && !vprice.equals("")) {
-			sql += " vprice = '" + vprice + "', ";
-		}
-		sql = sql.substring(0, sql.lastIndexOf(","));
-		
-		sql += " where pk = " + modelpk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public Map<String, Object> login(String username, String pwd) {
-		String sql = "select "
-				+" o.pk as modelpk, o.Sex, o.hei,o.IsOrder,o.wei,o.wai,o.bust,o.hip,o.shoe,o.eye,o.hair,o.addr,o.BrokePK,"
-				+" o.BMemberPK, o.Stage,o.Star,o.FCount,o.LName,o.UCount,o.DCount,o.Is_A,o.Is_V,o.CardPK,o.Rdate,o.occupation,o.hasred"
-				+" ,m.* "
-				+" from memberinfo m"
-				+" inner join modelinfo o on o.memberpk = m.pk"
-				+" where"
-				+" (m.tel = '"+username+"' or m.phone='"+username+"') and m.pass = '"+pwd+"'";
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		return getResultSetByLoginInfo(rs);
-	}
-	
-	/**
-	 * 获取 模特端登录信息  公共方法
-	 * @param rs
-	 * @return
-	 */
-	public Map<String, Object> getResultSetByLoginInfo(CachedRowSet rs) {
-		Map<String, Object> map = new HashMap<String, Object>();
-		try {
-			int pk = 0;
-			if(rs!=null && rs.size()>0 && rs.next()){
-				
-				pk = rs.getInt("PK");
-				int modelpk = rs.getInt("modelpk");
-				
-				map.put("hasred", rs.getInt("hasred"));
-				map.put("modelpk", modelpk);
-				map.put("sex", rs.getString("Sex"));
-				map.put("isorder", rs.getString("IsOrder"));
-				map.put("hei", CommentUtils.stringDoubleToInt(rs.getString("hei")));
-				map.put("wei", CommentUtils.stringDoubleToInt(rs.getString("wei")));
-				map.put("wai", CommentUtils.stringDoubleToInt(rs.getString("wai")));
-				map.put("bust", CommentUtils.stringDoubleToInt(rs.getString("bust")));
-				map.put("hip", CommentUtils.stringDoubleToInt(rs.getString("hip")));
-				map.put("shoe", CommentUtils.stringDoubleToInt(rs.getString("shoe")));
-				map.put("eye", CommentUtils.emptyToDefault(rs.getString("eye"), "0"));
-				map.put("hair", CommentUtils.emptyToDefault(rs.getString("hair"), "0"));
-				map.put("addr", rs.getString("addr"));
-				map.put("brokepk", rs.getString("BrokePK"));
-				map.put("bmemberpk", rs.getString("BMemberPK"));
-				map.put("stage", rs.getString("Stage"));
-				map.put("star", CommentUtils.emptyToDefault(rs.getString("Star"), "0"));
-				map.put("fcount", CommentUtils.emptyToDefault(rs.getString("FCount"), "0"));
-				map.put("ucount", CommentUtils.emptyToDefault(rs.getString("UCount"), "0"));
-				map.put("dcount", CommentUtils.emptyToDefault(rs.getString("DCount"), "0"));
-				map.put("lname", rs.getString("LName"));
-				map.put("is_a", rs.getString("Is_A"));
-				map.put("is_v", rs.getString("Is_V"));
-				map.put("cardpk", rs.getString("CardPK"));
-				map.put("rdate", MyDateUtil.format(rs.getDate("Rdate"), MyDateUtil.DATE_FORMAT_1));
-				map.put("occupation", rs.getString("occupation"));
-				
-				map.put("pk", pk);
-				map.put("membtype", rs.getInt("MembType"));
-				map.put("membclass", rs.getInt("MembClass"));
-				map.put("qrcode", rs.getString("QRCode"));
-				map.put("tel", rs.getString("Tel"));
-				map.put("phone", rs.getString("Phone"));
-				map.put("pet", rs.getString("Pet"));
-				map.put("hphoto", rs.getString("hPhoto"));
-				map.put("photo", rs.getString("Photo"));
-				map.put("area", rs.getInt("Area"));
-				map.put("age", rs.getString("Age"));
-				map.put("id", rs.getString("ID"));
-				map.put("islive", rs.getInt("IsLive"));
-				map.put("mdate", MyDateUtil.format(rs.getDate("MDate"), MyDateUtil.DATE_FORMAT_1));
-				map.put("token", rs.getString("token"));
-				map.put("acc", rs.getInt("acc"));
-				map.put("lastsign", MyDateUtil.format(rs.getDate("LastSign"), MyDateUtil.DATE_FORMAT_1));
-				map.put("signdays", rs.getInt("SignDays"));
-				map.put("identify", rs.getString("identify"));
-				map.put("wid", rs.getString("WID"));
-				map.put("coin_a", (double)Math.round(rs.getDouble("coin_A")*100)/100);
-				map.put("coin_ir", rs.getDouble("coin_IR"));
-				map.put("coin_iv", rs.getDouble("coin_IV"));
-				map.put("coin_is", rs.getDouble("coin_IS"));
-				map.put("coin_irr", rs.getDouble("coin_IRR"));
-				map.put("coin_ivv", rs.getDouble("coin_IVV"));
-				map.put("coin_iss", rs.getDouble("coin_ISS"));
-				map.put("coin_ill", rs.getDouble("coin_ILL"));
-				map.put("coin_i", rs.getDouble("coin_I"));
-				map.put("coin_or", rs.getDouble("coin_OR"));
-				map.put("coin_ov", rs.getDouble("coin_OV"));
-				map.put("coin_os", rs.getDouble("coin_OS"));
-				map.put("coin_om", rs.getDouble("coin_OM"));
-				map.put("coin_o", rs.getDouble("coin_O"));
-				
-				//获取模特头像
-				List<ModelPhoto> modelphoto = findModelPhotoByModelPk(modelpk);
-				map.put("modelphoto", modelphoto);
-				
-				rs.close();
-			}
-			if(pk > 0){
-				return map;
-			}else{
-				return null;
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return null;
-		}
-		
-	}
-	
-	@Override
-	public int insertModelStyle(int modelpk, int... stylepks) {
-		
-		String sql = "insert into ModelFigure(modelpk, figurepk, fdate, memberpk, isself)values";
-		for (int stylepk : stylepks) {
-			sql += "("+modelpk+", "+ stylepk +", now(), 0, 1),";
-		}
-		
-		sql = sql.substring(0, sql.lastIndexOf(","));
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int deleteModelStyleAll(int modelpk) {
-		String sql = "delete from ModelFigure where modelpk = "+modelpk+" and isself = 1";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int deleteModelPrice(int modelpk, int skillpk) {
-		String sql = "delete from ModelPrice where modelpk = '"+modelpk+"' and pk = '"+skillpk+"' ";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int insertModelInfo(int memberpk, String name, int BrokePK, int BMemberPK) {
-		
-		String ratio_R = PropertyUtil.getProperty("ratio_R");
-		String ratio_V = PropertyUtil.getProperty("ratio_V");
-		String ratio_S = PropertyUtil.getProperty("ratio_S");
-		
-		String vprice = PropertyUtil.getProperty("default_vprice");
-		
-		String sql = String.format("insert into modelinfo(memberpk, name, stage, BrokePK, BMemberPK, ratio_R, ratio_V, ratio_S, vprice)values('%s', '%s', '%s', '%s', '%s','%s','%s','%s', '%s')",
-														  memberpk, name, name, BrokePK, BMemberPK, ratio_R, ratio_V, ratio_S, vprice);
-		DbConnection db = new DbConnection();
-		int modelpk = db.executeUpdate(sql);
-		return modelpk;
-	}
-	
-	@Override
-	public int insertModelPhoto(int modelpk, String[] photos, int ordid) {
-		if(photos.length > 0) {
-			StringBuffer sb_sql = new StringBuffer("insert into ModelPhoto(ModelPK, RDate, Photo, OrdID)values");
-			
-			for (String photo : photos) {
-				if(photo!=null && !photo.equals("")) {
-					sb_sql.append("('"+modelpk+"', now(), '"+photo+"', '"+ordid+"'),");
-				}
-			}
-			String sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
-			
-			DbConnection db = new DbConnection();
-			int pk = db.executeUpdate(sql);
-			return pk;
-		}else {
-			return 0;
-		}
-	}
-
-	@Override
-	public int deleteModelPhoto(String pks, int modelpk) {
-		
-		if(pks.length() > 0) {
-			String[] pkArray = pks.split(",");
-			String pkStr = "";
-			for (String pk : pkArray) {
-				if(pk!=null && !pk.equals("")) {
-					pkStr += pk + ",";
-				}
-			}
-			pkStr = pkStr.substring(0, pkStr.lastIndexOf(","));
-			
-			String sql = String.format("delete from ModelPhoto where pk in (%s) and modelpk = '%s'", pkStr, modelpk);
-			DbConnection db = new DbConnection();
-			int rows = db.executeUpdate(sql);
-			return rows;
-		} else {
-			return 0;
-		}
-		
-	}
-
-	@Override
-	public List getModelData(int modelpk) {
-		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-		try {
-			String sql = "select "
-						+ " m.pk as 'memberpk', m.pet, m.age, m.Area, o.VPrice,"
-						+ " (select name from datatypeinfo where pk = m.Area) as AreaName,"
-						+ " o.pk as 'modelpk', o.hei, o.wei, o.wai, o.bust, o.hip, o.lname,"
-						+ " (select count(1) from modelphoto where modelpk = o.pk) as photoCount,"
-						+ " (select count(1) from ModelFigure where IsSelf=1 and modelpk=o.pk) as styleCount,"
-						+ " (select count(1) from HonorInfo where modelpk=o.pk) as HonorCount"
-						+ " from memberinfo m"
-						+ " inner join modelinfo o on o.memberpk = m.pk"
-						+ " where o.pk = " + modelpk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null) {
-				while(rs.next()) {
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("memberpk", rs.getString("memberpk"));
-					map.put("pet", rs.getString("pet"));
-					map.put("age", rs.getString("age"));
-					map.put("area", rs.getString("area"));
-					map.put("areaname", rs.getString("areaname"));
-					map.put("modelpk", rs.getString("modelpk"));
-					map.put("hei", CommentUtils.stringDoubleToInt(rs.getString("hei")));
-					map.put("wei", CommentUtils.stringDoubleToInt(rs.getString("wei")));
-					map.put("wai", CommentUtils.stringDoubleToInt(rs.getString("wai")));
-					map.put("bust", CommentUtils.stringDoubleToInt(rs.getString("bust")));
-					map.put("hip", CommentUtils.stringDoubleToInt(rs.getString("hip")));
-					map.put("lname", rs.getString("lname"));
-					map.put("photocount", rs.getString("photoCount"));
-					map.put("stylecount", rs.getString("styleCount"));
-					map.put("honorcount", rs.getString("HonorCount"));
-					map.put("vprice", (int)rs.getDouble("VPrice"));
-					list.add(map);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return list;
-	}
-
-	@Override
-	public int getMemberpkByModelpk(int modelpk) {
-		try {
-			int memberpk = 0;
-			String sql = "select memberpk from modelinfo where pk = " + modelpk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				memberpk = rs.getInt(1);
-				db.close(rs);
-			}
-			return memberpk;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return -1;
-		}
-	}
-
-	@Override
-	public ModelInfo findModelByPk(int modelpk) {
-		ModelInfo modelinfo = new ModelInfo();
-		try {
-			String sql = "select * from modelinfo where pk = " + modelpk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-
-				modelinfo.setPk(rs.getInt("PK"));
-				modelinfo.setMemberpk(rs.getInt("MemberPK"));
-				modelinfo.setBrokepk(rs.getInt("BrokePK"));
-				modelinfo.setBmemberpk(rs.getInt("BMemberPK"));
-				modelinfo.setNominate(rs.getInt("nominate"));
-				modelinfo.setName(rs.getString("Name"));
-				modelinfo.setSex(rs.getInt("Sex"));
-				modelinfo.setHei((int)rs.getDouble("Hei"));
-				modelinfo.setWei((int)rs.getDouble("wei"));
-				modelinfo.setWai((int)rs.getDouble("wai"));
-				modelinfo.setBust((int)rs.getDouble("bust"));
-				modelinfo.setHip((int)rs.getDouble("hip"));
-				modelinfo.setShoe(rs.getDouble("shoe"));
-				modelinfo.setEye(rs.getInt("eye"));
-				modelinfo.setHair(rs.getInt("hair"));
-				modelinfo.setAddr(rs.getString("addr"));
-				modelinfo.setStage(rs.getString("Stage"));
-				modelinfo.setStar(rs.getInt("Star"));
-				modelinfo.setFcount(rs.getInt("FCount"));
-				modelinfo.setLname(rs.getString("LName"));
-				modelinfo.setUcount(rs.getInt("UCount"));
-				modelinfo.setDcount(rs.getInt("DCount"));
-				modelinfo.setVprice(rs.getDouble("VPrice"));
-				modelinfo.setIs_a(rs.getInt("Is_A"));
-				modelinfo.setRatio_v(rs.getDouble("ratio_V"));
-				modelinfo.setRatio_s(rs.getDouble("ratio_S"));
-				modelinfo.setIs_v(rs.getInt("Is_V"));
-				modelinfo.setRdate(rs.getDate("RDate"));
-				modelinfo.setOccupation(rs.getString("occupation"));
-				
-				db.close(rs);
-			}
-			
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return modelinfo;
-	}
-
-	@Override
-	public int verifyModelPhone(String phone) {
-		String sql = "select count(1) from memberinfo as e "
-					+ " inner join modelinfo as o on o.memberpk = e.pk"
-					+ " where e.MembType = '7' and e.tel = '"+phone+"'";
-		DbConnection db = new DbConnection();
-		int count = db.queryOneCount(sql);
-		return count;
-	}
-
-	@Override
-	public int findModelPrivateCount(int privatePk) {
-		int count = 0;
-		try {
-			String sql = "select count(1)"
-						+ " from ModelPrivateDiscuss d "
-						+ " inner join memberinfo m on d.MemberPK = m.PK "
-						+ " where d.IsGood != 1 and d.privatepk =  " + privatePk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				count = rs.getInt(1);
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		return count;
-	}
-
-	@Override
-	public Map<String, Object> getModelLoginInfo(int modelpk) {
-		String sql = "select "
-				+" o.pk as modelpk, o.Sex, o.hei,o.IsOrder,o.wei,o.wai,o.bust,o.hip,o.shoe,o.eye,o.hair,o.addr,o.BrokePK,"
-				+" o.BMemberPK, o.Stage,o.Star,o.FCount,o.LName,o.UCount,o.DCount,o.Is_A,o.Is_V,o.CardPK,o.Rdate,o.occupation,o.hasred"
-				+" ,m.* "
-				+" from memberinfo m"
-				+" inner join modelinfo o on o.memberpk = m.pk"
-				+" where o.pk = " + modelpk;
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		return getResultSetByLoginInfo(rs);
-	}
-	
-	public String getModelInfoSql (int memberPk, String where) {
-		
-		
-		
-		String sql = "select m.*, b.tel, b.hphoto, b.pet, b.Area, "
-				+ " (select name from datatypeinfo where pk = b.Area) as AreaName,"
-				+ " (select count(1) from ModelFan where modelPK = m.pk and memberpk = " + memberPk + ") as 'IsAttention' "
-				+ " from ModelInfo m "
-				+ " inner join memberinfo b on b.pk = m.memberpk "
-				+ " where 1=1 "
-				+ " and MembType = '7' "
-				+ " and (select count(1) from ModelPhoto where ModelPK = m.pk)>0 "		//必须有照片
-				+ " and m.VPrice > 0 "													//视频聊天单价大于0
-				+ " and length(b.pet) > 0 "												//名字必须有
-				;
-		//屏蔽摸特
-		List<Nexus> nexusList = memberinfoService.getAllNexus(new Nexus(memberPk));
-		if(nexusList != null && nexusList.size() > 0) {
-			StringBuffer sb = new StringBuffer("0,"); 
-			for (Nexus nexus : nexusList) {
-				sb.append(nexus.getModelpk());
-				sb.append(",");
-			}
-			String nexuspks = sb.substring(0, sb.lastIndexOf(","));
-			sql += " and m.pk not in ("+nexuspks+") ";
-		}
-		
-		if(where !=null && !where.equals("")){
-			sql += " and " + where;
-		}
-		sql += String.format(" order by FIND_IN_SET(`is_a`, '%s,%s,%s') ", Constants.IS_A_ONLINE, Constants.IS_A_BUSY, Constants.IS_A_OFFLINE);
-		return sql;
-	}
-
-	@Override
-	public Page<List> findModelLikesLimit(int privatePk, int index, int size) {
-		Page page = new Page();
-		
-		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-		
-		StringBuffer sb_sql = new StringBuffer();
-		
-		sb_sql.append(" select d.pk, d.PrivatePK, d.ParentPK, d.MemberPK, d.IDate, m.Pet, m.hPhoto ");
-		sb_sql.append(" from ModelPrivateDiscuss d ");
-		sb_sql.append(" inner join memberinfo m on d.MemberPK = m.PK ");
-		sb_sql.append(" where d.IsGood = 1 and d.privatepk = 1 ");
-		sb_sql.append(" order by d.idate desc ");
-		
-		//获取分页数量
-		String sqlPageCount = CommentUtils.pagingToMysqlCount(sb_sql.toString());
-		int count = new DbConnection().queryOneCount(sqlPageCount);
-		page.setCount(count);
-		
-		String sqlPage = CommentUtils.pagingToMysql(sb_sql.toString(), index, size);
-		
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sqlPage);
-		
-		try {
-			if(rs!=null){
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("pk", rs.getInt("pk"));
-					map.put("privatepk", rs.getInt("privatepk"));
-					map.put("parentpk", rs.getInt("parentpk"));
-					map.put("memberpk", rs.getInt("memberpk"));
-					map.put("idate", MyDateUtil.format(rs.getDate("idate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("pet", rs.getString("pet"));
-					map.put("hphoto", rs.getString("hphoto"));
-					list.add(map);
-				}
-				db.close(rs);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		page.setData(list);
-		return page;
-	}
-
-	@Override
-	public int updateModelOnlineByModelpk(int modelpk, int online) {
-		String sql = "update modelinfo set is_a='"+online+"' where pk = '"+modelpk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int deleteHonorInfo(int modelPK) {
-		String sql = "delete from HonorInfo where ModelPK = '"+modelPK+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int deleteModelPrivateByPk(int privatepk) {
-		String sql = "delete from ModelPrivate where pk = '"+privatepk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-	
-	public int deleteModelPrivateItemByPrivatepk(int privatepk) {
-		String sql = "delete from ModelPrivateItem where PrivatePK = '"+privatepk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-	public int deleteModelPrivateDiscussByPrivatepk(int privatepk) {
-		String sql = "delete from ModelPrivateDiscuss where PrivatePK = '"+privatepk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int getModelpkByMemberpk(int memberpk) {
-		String sql = "select b.pk as modelpk from memberinfo a inner join modelinfo b on a.pk = b.memberpk where a.pk = '"+memberpk+"'"; 
-		int modelpk = new DbConnection().queryOneCount(sql);	
-		return modelpk;
-	}
-
-	@Override
-	public int updateModelSetHasRedByModel(int modelpk, int hasred) {
-		String sql = "update ModelInfo set HasRed = '"+hasred+"' where pk = " + modelpk;
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
+
+            String sql = getModelInfoSql(memberPk, where);
+            //是否分页
+            if (ispaging) {
+                sql = CommentUtils.pagingToMysql(sql, index, size);
+            }
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelInfo modelinfo = new ModelInfo();
+                    int       modelpk   = rs.getInt("PK");
+                    modelinfo.setPk(modelpk);
+                    modelinfo.setMemberpk(rs.getInt("MemberPK"));
+                    modelinfo.setBrokepk(rs.getInt("BrokePK"));
+                    modelinfo.setBmemberpk(rs.getInt("BMemberPK"));
+                    modelinfo.setNominate(rs.getInt("nominate"));
+                    modelinfo.setName(rs.getString("pet"));
+                    modelinfo.setSex(rs.getInt("Sex"));
+                    modelinfo.setHei((int) rs.getDouble("Hei"));
+                    modelinfo.setWei((int) rs.getDouble("wei"));
+                    modelinfo.setWai((int) rs.getDouble("wai"));
+                    modelinfo.setBust((int) rs.getDouble("bust"));
+                    modelinfo.setHip((int) rs.getDouble("hip"));
+                    modelinfo.setShoe(rs.getDouble("shoe"));
+                    modelinfo.setEye(rs.getInt("eye"));
+                    modelinfo.setHair(rs.getInt("hair"));
+                    modelinfo.setAddr(rs.getString("addr"));
+
+                    modelinfo.setArea(rs.getInt("Area"));
+                    modelinfo.setAreaname(rs.getString("AreaName"));
+
+                    modelinfo.setStage(rs.getString("Stage"));
+                    modelinfo.setStar(rs.getInt("Star"));
+                    modelinfo.setFcount(rs.getInt("FCount"));
+                    modelinfo.setLname(rs.getString("LName"));
+                    modelinfo.setUcount(rs.getInt("UCount"));
+                    modelinfo.setDcount(rs.getInt("DCount"));
+                    modelinfo.setVprice(rs.getDouble("VPrice"));
+                    modelinfo.setIs_a(rs.getInt("Is_A"));
+                    modelinfo.setRatio_v(rs.getDouble("ratio_V"));
+                    modelinfo.setRatio_s(rs.getDouble("ratio_S"));
+                    modelinfo.setIs_v(rs.getInt("Is_V"));
+                    modelinfo.setRdate(rs.getDate("RDate"));
+                    modelinfo.setOccupation(rs.getString("occupation"));
+
+                    //拼接3个 技能标签名字
+                    int    skill_sum  = 3;
+                    String skillnames = new DbConnection().queryOneString("select GROUP_CONCAT(name separator ' ') from (select name from datatypeinfo where pk in(select skillpk from ModelPrice where ModelPK =" + modelpk + " order by PDate desc ) order by ordid limit " + skill_sum + ")tt0_ ");
+                    modelinfo.setSkillnames(skillnames);
+
+                    modelinfo.setTel(rs.getString("tel"));//账号
+
+                    modelinfo.setIsattention(rs.getInt("Isattention"));//是否关注
+
+                    modelinfo.setHphoto(rs.getString("hphoto"));//memberinfo 表   头像
+
+                    //人才图片
+                    List<ModelPhoto> modelPhotoList = this.findModelPhotoByModelPk(modelinfo.getPk());
+
+                    modelinfo.setModelphoto(modelPhotoList);
+                    resultList.add(modelinfo);
+                }
+                db.close(rs);
+            }
+            return resultList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    @Override
+    public List<ModelAct> getModelActListByModelPK(int ModelPK) {
+        try {
+            List<ModelAct> list = new ArrayList<ModelAct>();
+            String         sql  = "select * from ModelAct where ModelPK = '" + ModelPK + "'";
+            DbConnection   db   = new DbConnection();
+            CachedRowSet   rs   = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelAct ma = new ModelAct();
+                    ma.setPk(rs.getInt("PK"));
+                    ma.setModelpk(rs.getInt("ModelPk"));
+                    ma.setOrderpk(rs.getInt("OrderPk"));
+                    ma.setCaption(rs.getString("Caption"));
+                    ma.setPic(rs.getString("Pic"));
+                    ma.setVideo(rs.getString("Video"));
+                    ma.setIntro(rs.getString("intro"));
+                    ma.setUcount(rs.getInt("ucount"));
+                    ma.setDcount(rs.getInt("dcount"));
+                    ma.setAdate(rs.getDate("adate"));
+                    list.add(ma);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public List<Map<String, Object>> getfan(int ModelPK) {
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+        try {
+            String sql = "select m.PK, f.FDate, m.Tel, m.Pet, m.hPhoto, m.Photo, m.Area from memberinfo m "
+                    + " INNER JOIN ModelFan f on m.pk = f.MemberPk"
+                    + " where f.ModelPK = '" + ModelPK + "'";
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("pk", rs.getInt("pk"));
+                    map.put("fdate", MyDateUtil.format(rs.getDate("FDate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("tel", rs.getString("Tel"));
+                    map.put("pet", rs.getString("Pet"));
+                    map.put("hphoto", rs.getString("hPhoto"));
+                    map.put("photo", rs.getString("photo"));
+                    map.put("Area", rs.getString("Area"));
+                    list.add(map);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public List<ModelPrice> getprice(int ModelPK) {
+        List<ModelPrice> list = new ArrayList<ModelPrice>();
+        try {
+            String       sql = "select * from ModelPrice where ModelPK = '" + ModelPK + "' order by OrderID";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPrice mp = new ModelPrice();
+                    mp.setPk(rs.getInt("pk"));
+                    mp.setPdate(rs.getDate("PDate"));
+                    mp.setPname(rs.getString("PName"));
+                    mp.setPrice(rs.getDouble("Price"));
+                    mp.setUnit(rs.getString("Unit"));
+                    mp.setOrderid(rs.getInt("OrderID"));
+                    mp.setSkillpk(rs.getInt("Skillpk"));
+                    list.add(mp);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public List<ChatRecord> findChatRecordByModelPkAndMemberPK(int ModelPk, Integer MemberPK) {
+        List<ChatRecord> list = new ArrayList<ChatRecord>();
+        try {
+            String sql = "select * from ChatRecord where ModelPK = '" + ModelPk + "' ";
+            if (MemberPK != null) {
+                sql += " and MemberPK = '" + MemberPK + "' ";
+            }
+            sql += " order by CDate desc limit 50";
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ChatRecord cr = new ChatRecord();
+                    cr.setPk(rs.getInt("PK"));
+                    cr.setCdate(rs.getDate("CDate"));
+                    cr.setMemberpk(rs.getInt("MemberPK"));
+                    cr.setModelpk(rs.getInt("Modelpk"));
+                    cr.setChat(rs.getString("chat"));
+                    cr.setCtype(rs.getString("CType"));
+                    list.add(cr);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int insertChatRecord(String CDate, String ModelPK, String MemberPK,
+                                String chat, String CType) {
+
+        String       sql = "insert into ChatRecord(CDate,ModelPK,MemberPK,chat,CType) values('" + CDate + "', '" + ModelPK + "', '" + MemberPK + "', '" + chat + "', '" + CType + "')";
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public int updateModelInfoSetCardPK(int ModelPk, int CardPK) {
+        String       sql  = "update ModelInfo set CardPK = '" + CardPK + "', Rdate = now() where pk = '" + ModelPk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateModelInfoClearMCard(int ModelPk) {
+        String       sql  = "update ModelInfo set CardPK = '0', Rdate = now() where pk = '" + ModelPk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public List<HonorInfo> findHonorInfoByModelPk(int ModelPk) {
+        List<HonorInfo> list = new ArrayList<HonorInfo>();
+        try {
+            String       sql = "select * from HonorInfo where ModelPk='" + ModelPk + "'";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    HonorInfo hi = new HonorInfo();
+                    hi.setPk(rs.getInt("Pk"));
+                    hi.setHdate(rs.getString("Hdate"));
+                    hi.setHonor(rs.getString("Honor"));
+                    hi.setModelpk(rs.getInt("Modelpk"));
+                    list.add(hi);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int insertHonorInfo(int ModelPK, List<String> Honors) {
+        if (Honors.size() > 0) {
+            StringBuffer sb_sql = new StringBuffer("insert into HonorInfo(Modelpk, Hdate, Honor)values");
+
+            for (String honor : Honors) {
+                sb_sql.append("('" + ModelPK + "', now(), '" + honor + "'),");
+            }
+            String       sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
+            DbConnection db  = new DbConnection();
+            int          pk  = db.executeUpdate(sql);
+            return pk;
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * 经纪人/机构 单表 通用查询遍历
+     *
+     * @param rs
+     * @return
+     */
+    public List<BrokerInfor> constantBrokeInfor(CachedRowSet rs) {
+        List<BrokerInfor> list = new ArrayList<BrokerInfor>();
+        try {
+            if (rs != null) {
+                while (rs.next()) {
+                    BrokerInfor bi = new BrokerInfor();
+                    bi.setAddr(rs.getString("Addr"));
+                    bi.setAuth(rs.getString("Auth"));
+                    bi.setIntro(rs.getString("Intro"));
+                    bi.setIsadmin(rs.getInt("Isadmin"));
+                    bi.setLinkman(rs.getString("Linkman"));
+                    bi.setLinktype(rs.getString("Linktype"));
+                    bi.setLogo(rs.getString("Logo"));
+                    bi.setMemberpk(rs.getInt("Memberpk"));
+                    bi.setName(rs.getString("Name"));
+                    bi.setPk(rs.getInt("Pk"));
+                    bi.setRatio_l(rs.getDouble("Ratio_l"));
+                    bi.setRatio_r(rs.getDouble("Ratio_r"));
+                    bi.setRatio_s(rs.getDouble("Ratio_s"));
+                    bi.setRatio_v(rs.getDouble("Ratio_v"));
+                    bi.setSex(rs.getInt("Sex"));
+                    bi.setSuperpk(rs.getInt("Superpk"));
+                    bi.setOutfit(rs.getString("outfit"));
+                    list.add(bi);
+                }
+                rs.close();
+            }
+            return list;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public Map<String, Object> findBrokeInforByPk(int pk) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        try {
+            String sql = "select b.*,(select count(1) from modelinfo where BrokePK = b.pk) as modelcount from brokerinfor b where pk = '" + pk + "'";
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                map.put("brokepk", rs.getString("pk"));
+                map.put("memberpk", rs.getString("Memberpk"));
+                map.put("logo", rs.getString("logo"));
+                map.put("superpk", rs.getString("superpk"));
+                map.put("sex", rs.getString("sex"));
+                map.put("name", rs.getString("name"));
+                map.put("addr", rs.getString("addr"));
+                map.put("intro", rs.getString("intro"));
+                map.put("linkman", rs.getString("linkman"));
+                map.put("linktype", rs.getString("linktype"));
+                map.put("outfit", rs.getString("outfit"));
+                map.put("modelcount", rs.getString("modelcount"));
+                db.close(rs);
+            }
+            return map;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int getModelCount(int BrokePK) {
+        int    count = 0;
+        String sql   = "select count(1) from modelinfo where BrokePK = '" + BrokePK + "'";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return count;
+    }
+
+    @Override
+    public Map<String, Object> findBrokeInforLikeName(String LikeName, int index, int size) {
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+
+        try {
+            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+            String sql = "select b.*, m.Pet, (select name from datatypeinfo WHERE pk = m.Area) as area , "
+                    + " (select count(1) from modelinfo tt11_ where tt11_.BrokePK = b.pk and (select count(1) from modelphoto where ModelPK = tt11_.PK)>0) as modelcount "
+                    + " from brokerinfor b "
+                    + " INNER JOIN MemberInfo m on b.MemberPK = m.pk "
+                    + " where 1=1 "
+                    + " and IsAdmin != 1 "
+                    + " and (select count(1) from modelinfo tt2_ where tt2_.BrokePK = b.pk and (select count(1) from modelphoto where ModelPK = tt2_.PK)>0)>0 ";
+            if (LikeName != null && !LikeName.equals("")) {
+                sql += " and Name like '%" + LikeName + "%'";
+            }
+            //获取分页总数量
+            String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+            int    count    = new DbConnection().queryOneCount(sqlCount);
+
+            sql = CommentUtils.pagingToMysql(sql, index, size);
+
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+
+                    String brokepk    = rs.getString("pk");
+                    int    modelcount = rs.getInt("modelcount");
+                    map.put("brokepk", brokepk);
+                    map.put("memberpk", rs.getString("Memberpk"));
+                    map.put("logo", rs.getString("logo"));
+                    map.put("superpk", rs.getString("superpk"));
+                    map.put("sex", rs.getString("sex"));
+                    map.put("name", rs.getString("name"));
+                    map.put("addr", rs.getString("addr"));
+                    map.put("intro", rs.getString("intro"));
+                    map.put("linkman", rs.getString("linkman"));
+                    map.put("linktype", rs.getString("linktype"));
+                    map.put("outfit", rs.getString("outfit"));
+                    map.put("pet", rs.getString("pet"));
+                    map.put("area", rs.getString("area"));
+                    map.put("modelcount", modelcount);
+
+                    List<Integer> photoPkList = new ArrayList<Integer>();
+                    List<String>  photoList   = new ArrayList<String>();
+                    sql = "select distinct modelpk, t.photo from(select * from modelphoto where modelpk in (select PK from modelinfo where brokepk = '" + rs.getString("pk") + "')ORDER BY modelpk,OrdId) t group by modelpk";
+
+                    CachedRowSet rs2 = db.executeQuery(sql);
+                    if (rs2 != null) {
+                        while (rs2.next()) {
+                            photoPkList.add(rs2.getInt("modelpk"));
+                            photoList.add(rs2.getString("photo"));
+                        }
+                        db.close(rs2);
+                    }
+
+                    map.put("photopk", photoPkList);
+                    map.put("modelphoto", photoList);
+
+                    if (modelcount > 0) {
+                        list.add(map);
+                    }
+                }
+                db.close(rs);
+            }
+            resultMap.put("data", list);
+            resultMap.put("count", count);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return resultMap;
+    }
+
+    @Override
+    public int updateModelInfoSetBrokeByPk(int PK, int BrokePK, int BMemberPK) {
+        String       sql  = "update ModelInfo set BrokePK='" + BrokePK + "', BMemberPK='" + BMemberPK + "' where PK='" + PK + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public Map<String, Object> findModelByBrokePk(int memberpk, int brokePk, int index, int size) {
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+
+        String          whereSql = " m.BrokePK = '" + brokePk + "' ";
+        List<ModelInfo> list     = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+        //获取总数量
+        String sql      = getModelInfoSql(memberpk, whereSql);
+        String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+
+        DbConnection db    = new DbConnection();
+        int          count = db.queryOneCount(sqlCount);
+        resultMap.put("data", list);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    @Override
+    public Map<String, Object> findModelInfoByName(int memberpk, String likeName, int index, int size) {
+        String whereSql = null;
+        if (likeName != null && !likeName.equals("")) {
+            whereSql = " (b.pet like '%" + likeName + "%' or m.Stage like '%" + likeName + "%')";
+        }
+        List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        //获取总数量
+        String       sql      = getModelInfoSql(memberpk, whereSql);
+        String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        DbConnection db       = new DbConnection();
+        int          count    = db.queryOneCount(sqlCount);
+
+        resultMap.put("data", list);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    @Override
+    public List<ModelPhoto> findModelPhotoByModelPk(int modelPk) {
+        try {
+            List<ModelPhoto> modelPhotoList = new ArrayList<ModelPhoto>();
+            String           sql            = "select * from ModelPhoto where ModelPK = " + modelPk + " order by OrdID";
+            DbConnection     db             = new DbConnection();
+            CachedRowSet     rs             = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPhoto modelphoto = new ModelPhoto();
+                    modelphoto.setPk(rs.getInt("PK"));
+                    modelphoto.setModelpk(rs.getInt("ModelPK"));
+                    modelphoto.setPhoto(rs.getString("Photo"));
+                    modelphoto.setOrdid(rs.getInt("OrdID"));
+                    modelphoto.setRdate(rs.getDate("RDate"));
+                    modelPhotoList.add(modelphoto);
+                }
+                db.close(rs);
+            }
+            return modelPhotoList;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public Page<List<ModelPrivate>> findModelPrivateByModelPk(int modelPk, int memberpk, int index, int size) {
+        Page<List<ModelPrivate>> page = new Page<List<ModelPrivate>>();
+
+        List<ModelPrivate> modelPrivateList = new ArrayList<ModelPrivate>();
+        StringBuffer       sb               = new StringBuffer();
+        sb.append(" select t1_.pk, t1_.modelpk, t1_.pdate, t1_.intro, t1_.ucount,t1_.dcount,");
+        sb.append(" if(t1_.islikes>0, '1', '0') as 'islikes'");
+        sb.append(" from (");
+        sb.append(" select t0_.*, ");
+        sb.append(" (select count(1) from modelprivatediscuss where isgood='1' and privatepk=t0_.pk and memberpk='" + memberpk + "' )as islikes");
+        sb.append(" from modelprivate t0_ ");
+        sb.append(" where t0_.ModelPK = '" + modelPk + "' ");
+        sb.append(" order by t0_.PDate desc");
+        sb.append(" )t1_");
+        String sql = sb.toString();
+
+        //获取分页总数量
+        String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        int    count    = new DbConnection().queryOneCount(sqlCount);
+
+        String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPrivate mp = new ModelPrivate();
+                    mp.setPk(rs.getInt("pk"));
+                    mp.setModelpk(rs.getInt("modelpk"));
+                    mp.setIntro(rs.getString("Intro"));
+                    mp.setPdate(rs.getDate("pdate"));
+                    mp.setDcount(rs.getInt("dcount"));
+                    mp.setUcount(rs.getInt("ucount"));
+                    mp.setIslikes(rs.getInt("islikes"));//我是否点赞
+                    modelPrivateList.add(mp);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+
+        page.setCount(count);
+        page.setData(modelPrivateList);
+
+        return page;
+    }
+
+    @Override
+    public List<ModelPrivateItem> findModelPrivateItemByPrivatePk(int privatePk) {
+        List<ModelPrivateItem> modelPrivateItemList = new ArrayList<ModelPrivateItem>();
+        String                 sql                  = "select * from modelprivateitem where privatepk=" + privatePk + " order by pk";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPrivateItem mpi = new ModelPrivateItem();
+                    mpi.setPk(rs.getInt("pk"));
+                    mpi.setPrivatepk(rs.getInt("privatepk"));
+                    mpi.setUrl(rs.getString("url"));
+                    mpi.setFtype(rs.getString("ftype"));
+
+                    modelPrivateItemList.add(mpi);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+        return modelPrivateItemList;
+    }
+
+    @Override
+    public List<ModelPrivateDiscuss> findModelPrivateDiscussByPrivatePk(int privatePk) {
+        List<ModelPrivateDiscuss> modelPrivateDiscussList = new ArrayList<ModelPrivateDiscuss>();
+        String                    sql                     = "select * from modelprivatediscuss where privatepk = " + privatePk + " and isgood=0 order by idate";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPrivateDiscuss mpd = new ModelPrivateDiscuss();
+                    mpd.setPk(rs.getInt("pk"));
+                    mpd.setPrivatepk(rs.getInt("privatepk"));
+                    mpd.setParentpk(rs.getInt("parentpk"));
+                    mpd.setMemberpk(rs.getInt("memberpk"));
+                    mpd.setIdate(rs.getDate("idate"));
+                    mpd.setIsgood(rs.getInt("isgood"));
+                    mpd.setIntro(rs.getString("intro"));
+
+                    modelPrivateDiscussList.add(mpd);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+        return modelPrivateDiscussList;
+    }
+
+    @Override
+    public int insertModelPrivate(int modelPk, String intro) {
+        String       sql = "insert into ModelPrivate(ModelPK, PDate, Intro, UCount, DCount) values('" + modelPk + "', now(), '" + intro + "', '0', '0')";
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public int insertModelPrivateItem(int privatePk, String url, String fType) {
+        String   sql  = "insert into ModelPrivateItem(PrivatePK, URL, FType)values";
+        int      pk   = 0;
+        String[] urls = url.split(",");
+        //url 不能为空(可以是多个 用逗号隔开)
+        if (url.length() > 0) {
+            for (String urlStr : urls) {
+                if (urlStr != null && !urlStr.equals("")) {
+                    sql += "('" + privatePk + "', '" + urlStr + "', '" + fType + "'),";
+                }
+            }
+            sql = sql.substring(0, sql.lastIndexOf(","));
+            DbConnection db = new DbConnection();
+            pk = db.executeUpdate(sql);
+        }
+        return pk;
+    }
+
+    @Override
+    public int praisePrivate(int privatePk, int memberPk) {
+        //添加点赞
+        //IsGood == 1  点赞
+        String       sql = "insert into modelprivatediscuss(PrivatePK, ParentPK, MemberPK, IDate, IsGood) values('" + privatePk + "', '0', '" + memberPk + "', now(), '1')";
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public int notPraisePrivate(int privatePk, int memberPk) {
+        //取消点赞
+        //IsGood == 1  点赞
+        String       sql  = "delete from modelprivatediscuss where privatePk = '" + privatePk + "' and memberPk = '" + memberPk + "' ";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int insertModelPrivateDiscuss(int privatePk, int memberPk,
+                                         int parentPk, String intro) {
+        //IsGood == 0  评论
+        String sql = "insert into modelprivatediscuss(PrivatePK, ParentPK, MemberPK, IDate, IsGood, Intro) " +
+                " values('" + privatePk + "', '" + parentPk + "', '" + memberPk + "', now(), '0', '" + intro + "')";
+        DbConnection db = new DbConnection();
+        int          pk = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public List<Map<String, Object>> findCustomImage(Integer modelPk) {
+        //获取用户印象
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+
+        String sql = "select mf.FigurePK ,dt.Name,count(mf.PK) as FigureCount"
+                + " from ModelFigure mf,DataTypeInfo dt"
+                + " where mf.FigurePK=dt.PK ";
+        //modelPk  没有就是查询全部
+        if (modelPk != null && modelPk > 0) {
+            sql += " and mf.ModelPK=" + modelPk;
+        }
+
+        sql += " group by mf.FigurePK,dt.Name "
+                + " order by FigureCount desc";
+
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("figurepk", rs.getInt("figurepk"));
+                    map.put("name", rs.getString("name"));
+                    map.put("figurecount", rs.getString("figureCount"));
+                    resultMapList.add(map);
+                }
+                db.close(rs);
+            }
+            return resultMapList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    @Override
+    public List<Map<String, Object>> findSelfFigure(int modelPk) {
+
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+        //IsSelf = 1   是自评
+        String sql = "select t.pk, t.name from ModelFigure f "
+                + " inner join DataTypeInfo t on f.figurepk = t.pk"
+                + " where f.IsSelf=1 and f.modelpk = '" + modelPk + "'"
+                + " order by f.Fdate desc";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("pk", rs.getInt("pk"));
+                    map.put("name", rs.getString("name"));
+
+                    resultMapList.add(map);
+                }
+                db.close(rs);
+            }
+            return resultMapList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    @Override
+    public List<Map<String, Object>> findCustomFigure(int modelPk) {
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+        //IsSelf != 1   不是自评
+        String sql = "select f.memberpk, GROUP_CONCAT(f.FigurePK SEPARATOR ',') as figurepk, m.hPhoto, m.pet from ModelFigure f"
+                + " inner join memberinfo m on f.memberpk = m.PK"
+                + " where IsSelf !=1 and f.modelpk = '" + modelPk + "'"
+                + " group by f.memberpk"
+                + " order by f.memberpk, f.Fdate desc";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+
+                    String figurepks = rs.getString("figurepk");
+                    map.put("memberpk", rs.getInt("memberpk"));
+                    map.put("hphoto", rs.getString("hPhoto"));
+                    map.put("pet", rs.getString("pet"));
+
+                    map.put("cfigures", findDataTypeInfoByPk(figurepks));
+                    resultMapList.add(map);
+                }
+                db.close(rs);
+            }
+            return resultMapList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public List<Map<String, Object>> findDataTypeInfoByPk(String pks) {
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+        try {
+            String       sql = "select pk, name from DataTypeInfo where PK in (" + pks + ")";
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> resultMap = new HashMap<String, Object>();
+                    resultMap.put("pk", rs.getInt("pk"));
+                    resultMap.put("name", rs.getString("name"));
+                    resultMapList.add(resultMap);
+                }
+                db.close(rs);
+            }
+            return resultMapList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public Map<String, Object> findDataTypeInfoByPkOrTypeName(int memberpk, String pks, String typeName, int index, int size) {
+        try {
+            Map<String, Object> resultMap = new HashMap<String, Object>();
+            String              whereSql  = " m.pk in(select distinct modelpk from modelprice where skillpk in (" + pks + ")) ";
+
+            List<ModelInfo> modelInfoList = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+            //获取总数量
+            String       sql      = getModelInfoSql(memberpk, whereSql);
+            String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+            DbConnection db       = new DbConnection();
+            int          count    = db.queryOneCount(sqlCount);
+
+            resultMap.put("count", count);
+            resultMap.put("data", modelInfoList);
+
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    @Override
+    public Map<String, Object> findModelByFigurePks(int memberpk, String figurePks, int index, int size) {
+        String          whereSql      = " m.pk in (select * from (select modelpk from ModelFigure where FigurePK in (" + figurePks + ") group by modelpk order by count(pk) desc)t1)";
+        List<ModelInfo> modelInfoList = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
+
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        //获取总数量
+        String       sql      = getModelInfoSql(memberpk, whereSql);
+        String       sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        DbConnection db       = new DbConnection();
+        int          count    = db.queryOneCount(sqlCount);
+        resultMap.put("data", modelInfoList);
+        resultMap.put("count", count);
+
+        return resultMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> findModelFigureByModelPkAndMemberPk(
+            int memberPk, int modelPk) {
+        List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+        String                    sql           = "select pk,name from DataTypeInfo where pk in(select FigurePk from ModelFigure where modelpk =" + modelPk + " and memberpk = " + memberPk + ")";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> resultMap = new HashMap<String, Object>();
+                    resultMap.put("pk", rs.getInt("pk"));
+                    resultMap.put("name", rs.getString("name"));
+                    resultMapList.add(resultMap);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return resultMapList;
+    }
+
+    @Override
+    public int insertModelFigure(int memberPk, int modelPk, String figurePks, int isSelf) {
+
+        String sql = "insert into ModelFigure (modelpk, figurepk, fDate, MemberPk, IsSelf) values";
+
+        String[] figurePkArray = figurePks.split(",");
+
+        for (String figurePk : figurePkArray) {
+            sql += "(" + modelPk + ", " + figurePk + ", now(), " + memberPk + ", " + isSelf + "),";
+        }
+        sql = sql.substring(0, sql.length() - 1);
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+
+        return rows;
+    }
+
+    @Override
+    public Map<String, Object> findModelInfoByPk(int memberpk, int modelPk) {
+        String          whereSql  = " m.pk = '" + modelPk + "'";
+        List<ModelInfo> modelList = modelInfoAndPhotoInfoList(memberpk, whereSql, false, null, null);
+
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        resultMap.put("data", modelList);
+
+        return resultMap;
+    }
+
+    @Override
+    public List<ModelPrivateDiscuss> getPraiseByPrivatePk(int privatePk) {
+        List<ModelPrivateDiscuss> resultList = new ArrayList<ModelPrivateDiscuss>();
+        //isgood = 1  点赞
+        String sql = "select * from modelprivatediscuss where isgood = 1 and privatepk='" + privatePk + "'";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelPrivateDiscuss mpd = new ModelPrivateDiscuss();
+                    mpd.setPk(rs.getInt("pk"));
+                    mpd.setPrivatepk(rs.getInt("privatepk"));
+                    mpd.setParentpk(rs.getInt("parentpk"));
+                    mpd.setMemberpk(rs.getInt("memberpk"));
+                    mpd.setIdate(rs.getDate("idate"));
+                    mpd.setIsgood(rs.getInt("isgood"));
+                    mpd.setIntro(rs.getString("intro"));
+                    resultList.add(mpd);
+                }
+                db.close(rs);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return resultList;
+    }
+
+    @Override
+    public Page<List<Map<String, Object>>> findModelPrivateLimit(int privatePk, int index, int size) {
+
+        Page<List<Map<String, Object>>> page = new Page<List<Map<String, Object>>>();
+
+        List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
+        String sql = "select d.pk, d.PrivatePK, d.ParentPK, d.MemberPK, d.IDate, d.Intro, m.Pet, m.hPhoto "
+                + " from ModelPrivateDiscuss d "
+                + " inner join memberinfo m on d.MemberPK = m.PK "
+                + " where d.IsGood != 1 and d.privatepk = '" + privatePk + "' "
+                + " order by d.idate desc ";
+
+        String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+        int    count    = new DbConnection().queryOneCount(sqlCount);
+
+        String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("pk", rs.getInt("pk"));
+                    map.put("privatepk", rs.getInt("privatepk"));
+                    map.put("parentpk", rs.getInt("parentpk"));
+                    map.put("memberpk", rs.getInt("memberpk"));
+                    map.put("idate", MyDateUtil.format(rs.getDate("idate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("intro", rs.getString("intro"));
+                    map.put("pet", rs.getString("pet"));
+                    map.put("hphoto", rs.getString("hphoto"));
+                    resultList.add(map);
+                }
+                db.close(rs);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+        page.setCount(count);
+        page.setData(resultList);
+        return page;
+    }
+
+    @Override
+    public Page<List> findModelInfoAndPhotoInfoList(int memberPk, int index, int size) {
+
+        Page<List> page = new Page<List>();
+
+        List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
+        try {
+            String sql = "select a.pk as privatepk, a.modelpk, a.pdate, min(b.pk ) as peivateitempk,"
+                    + " min(b.url) as img, member.pk as memberpk, member.pet, member.hphoto, d.name as area,"
+                    + " (select count(1) from ModelPrivateDiscuss where isgood  = 1 and privatepk = a.PK) as 'likesCount',"
+                    + " (select count(1) from ModelPrivateDiscuss d inner join memberinfo m on d.MemberPK = m.PK  where d.isgood != 1 and d.privatepk = a.PK) as 'commentCount',"
+                    + " (select count(1) from ModelFan where modelPK = a.ModelPK) as 'attentionCount',"
+                    + " (select count(1) from ModelPrivateDiscuss where isgood=1 and privatepk = a.pk and memberpk = " + memberPk + ") as 'IsLikes',"
+                    + " (select count(1) from ModelFan where modelPK = a.modelpk and memberpk = " + memberPk + ") as 'IsAttention'"
+                    + " from modelprivate a "
+                    + " inner join modelprivateitem b on a.pk = b.privatepk "
+                    + " inner join modelinfo model on model.pk = a.modelpk "
+                    + " inner join memberinfo member on model.memberpk = member.pk "
+                    + " inner join datatypeinfo d on member.area = d.pk "
+                    + " where 1=1 ";
+
+            //屏蔽摸特
+            List<Nexus> nexusList = memberinfoService.getAllNexus(new Nexus(memberPk));
+            if (nexusList != null && nexusList.size() > 0) {
+                StringBuffer sb = new StringBuffer("0,");
+                for (Nexus nexus : nexusList) {
+                    sb.append(nexus.getModelpk());
+                    sb.append(",");
+                }
+                String nexuspks = sb.substring(0, sb.lastIndexOf(","));
+                sql += " and a.modelpk not in (" + nexuspks + ") ";
+            }
+            sql += " group by a.pk,a.modelpk ";
+            sql += " order by a.pk desc ";
+
+            //分页总数量
+            String sqlPageCount = CommentUtils.pagingToMysqlCount(sql);
+            int    count        = new DbConnection().queryOneCount(sqlPageCount);
+            page.setCount(count);
+            String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+
+                    map.put("privatepk", rs.getString("privatepk"));
+                    map.put("modelpk", rs.getString("modelpk"));
+                    map.put("pdate", MyDateUtil.format(rs.getDate("pdate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("peivateitempk", rs.getString("peivateitempk"));
+                    map.put("img", rs.getString("img"));
+                    map.put("memberpk", rs.getString("memberpk"));
+                    map.put("pet", rs.getString("pet"));
+                    map.put("hphoto", rs.getString("hphoto"));
+                    map.put("area", rs.getString("area"));
+
+                    //评论、点赞、关注	是否点赞、是否关注
+                    map.put("likescount", rs.getString("likesCount"));//点赞数量
+                    map.put("commentcount", rs.getString("commentCount"));//评论数量
+                    map.put("attentioncount", rs.getString("attentionCount"));//关注数量
+
+                    map.put("islikes", rs.getString("IsLikes"));//是否点赞
+                    map.put("isattention", rs.getString("IsAttention"));//是否关注
+
+                    resultList.add(map);
+                }
+                db.close(rs);
+            }
+            page.setData(resultList);
+            return page;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public boolean findAttention(int memberPk, int modelPk) {
+        //返回值为true:已关注   false:未关注
+        boolean flag = false;
+        try {
+            String       sql = "select count(1) from ModelFan where modelPK = " + modelPk + " and memberpk = " + memberPk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                int count = rs.getInt(1);
+                if (count > 0) {
+                    flag = true;
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+    @Override
+    public boolean findLikes(int memberPk, int privatePk) {
+        //返回值为true:已点赞  false:未点赞
+        boolean flag = false;
+        try {
+            //isgood = 1  点赞		0:评论
+            String       sql = "select count(1) from ModelPrivateDiscuss where isgood=1 and privatepk = '" + privatePk + "' and memberpk = " + memberPk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                int count = rs.getInt(1);
+                if (count > 0) {
+                    flag = true;
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+    @Override
+    public int insertModelFan(int memberPk, int modelPk) {
+        String       sql = "insert into ModelFan(modelPk, memberPk, fdate) values('" + modelPk + "', '" + memberPk + "', now())";
+        DbConnection db  = new DbConnection();
+        int          pk  = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public int deleteModelFan(int memberPk, int modelPk) {
+        String       sql  = "delete from ModelFan where memberPk='" + memberPk + "' and modelPk='" + modelPk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateModelFanSetFCount(int modelPk) {
+        String       sql  = "update ModelInfo set FCount=(select count(1) from ModelFan where modelPk = '" + modelPk + "') where pk = " + modelPk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSkillData(int modelPk) {
+        List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
+        try {
+            String sql = "select "
+                    + " model.lname, model.memberpk, p.pk, p.modelpk, p.pdate, p.price, p.unit, p.skillpk, p.skillphoto, datatype.name"
+                    + " from ModelPrice p "
+                    + " inner join ModelInfo model on p.modelpk = model.pk "
+                    + " inner join datatypeinfo datatype on p.skillpk = datatype.pk "
+                    + " where p.modelpk = " + modelPk
+                    + " order by p.orderid";
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+
+                    map.put("skillphoto", rs.getString("skillphoto"));    //工作照片
+                    map.put("modelpk", rs.getString("modelpk"));        //人才pk
+                    map.put("memberpk", rs.getString("memberpk"));        //会员pk
+                    map.put("modelpricepk", rs.getString("pk"));        //技能pk(人才服务pk)
+                    map.put("pdate", MyDateUtil.format(rs.getDate("pdate"), MyDateUtil.DATE_FORMAT_1));//定价日期
+                    map.put("name", rs.getString("name"));            //技能标签名称
+                    map.put("price", rs.getDouble("price"));        //价格
+                    map.put("unit", rs.getString("unit"));            //价格单位
+                    map.put("skillpk", rs.getString("skillpk"));    //技能标签pk
+                    map.put("lname", rs.getString("lname"));        //个性签名
+
+                    mapList.add(map);
+                }
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return mapList;
+    }
+
+    @Override
+    public int insertModelPrice(int skillpk, int modelpk, String skillphoto, double price, String unit, int orderid) {
+
+        String sql = "insert into ModelPrice(ModelPK, PDate, Price, Unit, OrderID, SkillPK, skillphoto)"
+                + " values('" + modelpk + "', now(), '" + price + "', '" + unit + "', '" + orderid + "', '" + skillpk + "', '" + skillphoto + "')";
+
+        DbConnection db = new DbConnection();
+        int          pk = db.executeUpdate(sql);
+
+        return pk;
+    }
+
+    @Override
+    public int updateModelPrice(int pk, int modelpk, String skillpk, String skillphoto, String price, String unit, String orderid) {
+
+        StringBuffer sb_sql = new StringBuffer();
+
+        sb_sql.append("update ModelPrice set ");
+
+        if (skillpk != null && !skillpk.equals("")) {
+            sb_sql.append(" skillpk = '" + skillpk + "', ");
+        }
+        if (skillphoto != null && !skillphoto.equals("")) {
+            sb_sql.append(" skillphoto = '" + skillphoto + "', ");
+        }
+        if (price != null && !price.equals("")) {
+            sb_sql.append(" price = '" + price + "', ");
+        }
+        if (unit != null && !unit.equals("")) {
+            sb_sql.append(" unit = '" + unit + "', ");
+        }
+        if (orderid != null && !orderid.equals("")) {
+            sb_sql.append(" orderid = '" + orderid + "', ");
+        }
+        String sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
+        sql += " where pk = '" + pk + "' and modelpk='" + modelpk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateModelInfoByModelPk(int modelpk, String hei, String wei, String wai, String bust, String hip, String lname, String name, String vprice) {
+        String sql = "update ModelInfo set ";
+        if (hei != null && !hei.equals("")) {
+            sql += " hei = '" + hei + "', ";
+        }
+        if (wei != null && !wei.equals("")) {
+            sql += " wei = '" + wei + "', ";
+        }
+        if (wai != null && !wai.equals("")) {
+            sql += " wai = '" + wai + "', ";
+        }
+        if (bust != null && !bust.equals("")) {
+            sql += " bust = '" + bust + "', ";
+        }
+        if (hip != null && !hip.equals("")) {
+            sql += " hip = '" + hip + "', ";
+        }
+        if (lname != null && !lname.equals("")) {
+            sql += " lname = '" + lname + "', ";
+        }
+        if (name != null && !name.equals("")) {
+            sql += " name = '" + name + "', ";
+        }
+        if (vprice != null && !vprice.equals("")) {
+            sql += " vprice = '" + vprice + "', ";
+        }
+        sql = sql.substring(0, sql.lastIndexOf(","));
+
+        sql += " where pk = " + modelpk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public Map<String, Object> login(String username, String pwd) {
+        String sql = "select "
+                + " o.pk as modelpk, o.Sex, o.hei,o.IsOrder,o.wei,o.wai,o.bust,o.hip,o.shoe,o.eye,o.hair,o.addr,o.BrokePK,"
+                + " o.BMemberPK, o.Stage,o.Star,o.FCount,o.LName,o.UCount,o.DCount,o.Is_A,o.Is_V,o.CardPK,o.Rdate,o.occupation,o.hasred"
+                + " ,m.* "
+                + " from memberinfo m"
+                + " inner join modelinfo o on o.memberpk = m.pk"
+                + " where"
+                + " (m.tel = '" + username + "' or m.phone='" + username + "') and m.pass = '" + pwd + "'";
+        DbConnection db = new DbConnection();
+        CachedRowSet rs = db.executeQuery(sql);
+        return getResultSetByLoginInfo(rs);
+    }
+
+    /**
+     * 获取 模特端登录信息  公共方法
+     *
+     * @param rs
+     * @return
+     */
+    public Map<String, Object> getResultSetByLoginInfo(CachedRowSet rs) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        try {
+            int pk = 0;
+            if (rs != null && rs.size() > 0 && rs.next()) {
+
+                pk = rs.getInt("PK");
+                int modelpk = rs.getInt("modelpk");
+
+                map.put("hasred", rs.getInt("hasred"));
+                map.put("modelpk", modelpk);
+                map.put("sex", rs.getString("Sex"));
+                map.put("isorder", rs.getString("IsOrder"));
+                map.put("hei", CommentUtils.stringDoubleToInt(rs.getString("hei")));
+                map.put("wei", CommentUtils.stringDoubleToInt(rs.getString("wei")));
+                map.put("wai", CommentUtils.stringDoubleToInt(rs.getString("wai")));
+                map.put("bust", CommentUtils.stringDoubleToInt(rs.getString("bust")));
+                map.put("hip", CommentUtils.stringDoubleToInt(rs.getString("hip")));
+                map.put("shoe", CommentUtils.stringDoubleToInt(rs.getString("shoe")));
+                map.put("eye", CommentUtils.emptyToDefault(rs.getString("eye"), "0"));
+                map.put("hair", CommentUtils.emptyToDefault(rs.getString("hair"), "0"));
+                map.put("addr", rs.getString("addr"));
+                map.put("brokepk", rs.getString("BrokePK"));
+                map.put("bmemberpk", rs.getString("BMemberPK"));
+                map.put("stage", rs.getString("Stage"));
+                map.put("star", CommentUtils.emptyToDefault(rs.getString("Star"), "0"));
+                map.put("fcount", CommentUtils.emptyToDefault(rs.getString("FCount"), "0"));
+                map.put("ucount", CommentUtils.emptyToDefault(rs.getString("UCount"), "0"));
+                map.put("dcount", CommentUtils.emptyToDefault(rs.getString("DCount"), "0"));
+                map.put("lname", rs.getString("LName"));
+                map.put("is_a", rs.getString("Is_A"));
+                map.put("is_v", rs.getString("Is_V"));
+                map.put("cardpk", rs.getString("CardPK"));
+                map.put("rdate", MyDateUtil.format(rs.getDate("Rdate"), MyDateUtil.DATE_FORMAT_1));
+                map.put("occupation", rs.getString("occupation"));
+
+                map.put("pk", pk);
+                map.put("membtype", rs.getInt("MembType"));
+                map.put("membclass", rs.getInt("MembClass"));
+                map.put("qrcode", rs.getString("QRCode"));
+                map.put("tel", rs.getString("Tel"));
+                map.put("phone", rs.getString("Phone"));
+                map.put("pet", rs.getString("Pet"));
+                map.put("hphoto", rs.getString("hPhoto"));
+                map.put("photo", rs.getString("Photo"));
+                map.put("area", rs.getInt("Area"));
+                map.put("age", rs.getString("Age"));
+                map.put("id", rs.getString("ID"));
+                map.put("islive", rs.getInt("IsLive"));
+                map.put("mdate", MyDateUtil.format(rs.getDate("MDate"), MyDateUtil.DATE_FORMAT_1));
+                map.put("token", rs.getString("token"));
+                map.put("acc", rs.getInt("acc"));
+                map.put("lastsign", MyDateUtil.format(rs.getDate("LastSign"), MyDateUtil.DATE_FORMAT_1));
+                map.put("signdays", rs.getInt("SignDays"));
+                map.put("identify", rs.getString("identify"));
+                map.put("wid", rs.getString("WID"));
+                map.put("coin_a", (double) Math.round(rs.getDouble("coin_A") * 100) / 100);
+                map.put("coin_ir", rs.getDouble("coin_IR"));
+                map.put("coin_iv", rs.getDouble("coin_IV"));
+                map.put("coin_is", rs.getDouble("coin_IS"));
+                map.put("coin_irr", rs.getDouble("coin_IRR"));
+                map.put("coin_ivv", rs.getDouble("coin_IVV"));
+                map.put("coin_iss", rs.getDouble("coin_ISS"));
+                map.put("coin_ill", rs.getDouble("coin_ILL"));
+                map.put("coin_i", rs.getDouble("coin_I"));
+                map.put("coin_or", rs.getDouble("coin_OR"));
+                map.put("coin_ov", rs.getDouble("coin_OV"));
+                map.put("coin_os", rs.getDouble("coin_OS"));
+                map.put("coin_om", rs.getDouble("coin_OM"));
+                map.put("coin_o", rs.getDouble("coin_O"));
+
+                //获取模特头像
+                List<ModelPhoto> modelphoto = findModelPhotoByModelPk(modelpk);
+                map.put("modelphoto", modelphoto);
+
+                rs.close();
+            }
+            if (pk > 0) {
+                return map;
+            } else {
+                return null;
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    @Override
+    public int insertModelStyle(int modelpk, int... stylepks) {
+
+        String sql = "insert into ModelFigure(modelpk, figurepk, fdate, memberpk, isself)values";
+        for (int stylepk : stylepks) {
+            sql += "(" + modelpk + ", " + stylepk + ", now(), 0, 1),";
+        }
+
+        sql = sql.substring(0, sql.lastIndexOf(","));
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int deleteModelStyleAll(int modelpk) {
+        String       sql  = "delete from ModelFigure where modelpk = " + modelpk + " and isself = 1";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int deleteModelPrice(int modelpk, int skillpk) {
+        String       sql  = "delete from ModelPrice where modelpk = '" + modelpk + "' and pk = '" + skillpk + "' ";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int insertModelInfo(int memberpk, String name, int BrokePK, int BMemberPK) {
+
+        String ratio_R = PropertyUtil.getProperty("ratio_R");
+        String ratio_V = PropertyUtil.getProperty("ratio_V");
+        String ratio_S = PropertyUtil.getProperty("ratio_S");
+
+        String vprice = PropertyUtil.getProperty("default_vprice");
+
+        String sql = String.format("insert into modelinfo(memberpk, name, stage, BrokePK, BMemberPK, ratio_R, ratio_V, ratio_S, vprice)values('%s', '%s', '%s', '%s', '%s','%s','%s','%s', '%s')",
+                                   memberpk, name, name, BrokePK, BMemberPK, ratio_R, ratio_V, ratio_S, vprice);
+        DbConnection db      = new DbConnection();
+        int          modelpk = db.executeUpdate(sql);
+        return modelpk;
+    }
+
+    @Override
+    public int insertModelPhoto(int modelpk, String[] photos, int ordid) {
+        if (photos.length > 0) {
+            StringBuffer sb_sql = new StringBuffer("insert into ModelPhoto(ModelPK, RDate, Photo, OrdID)values");
+
+            for (String photo : photos) {
+                if (photo != null && !photo.equals("")) {
+                    sb_sql.append("('" + modelpk + "', now(), '" + photo + "', '" + ordid + "'),");
+                }
+            }
+            String sql = sb_sql.substring(0, sb_sql.lastIndexOf(","));
+
+            DbConnection db = new DbConnection();
+            int          pk = db.executeUpdate(sql);
+            return pk;
+        } else {
+            return 0;
+        }
+    }
+
+    @Override
+    public int deleteModelPhoto(String pks, int modelpk) {
+
+        if (pks.length() > 0) {
+            String[] pkArray = pks.split(",");
+            String   pkStr   = "";
+            for (String pk : pkArray) {
+                if (pk != null && !pk.equals("")) {
+                    pkStr += pk + ",";
+                }
+            }
+            pkStr = pkStr.substring(0, pkStr.lastIndexOf(","));
+
+            String       sql  = String.format("delete from ModelPhoto where pk in (%s) and modelpk = '%s'", pkStr, modelpk);
+            DbConnection db   = new DbConnection();
+            int          rows = db.executeUpdate(sql);
+            return rows;
+        } else {
+            return 0;
+        }
+
+    }
+
+    @Override
+    public List getModelData(int modelpk) {
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+        try {
+            String sql = "select "
+                    + " m.pk as 'memberpk', m.pet, m.age, m.Area, o.VPrice,"
+                    + " (select name from datatypeinfo where pk = m.Area) as AreaName,"
+                    + " o.pk as 'modelpk', o.hei, o.wei, o.wai, o.bust, o.hip, o.lname,"
+                    + " (select count(1) from modelphoto where modelpk = o.pk) as photoCount,"
+                    + " (select count(1) from ModelFigure where IsSelf=1 and modelpk=o.pk) as styleCount,"
+                    + " (select count(1) from HonorInfo where modelpk=o.pk) as HonorCount"
+                    + " from memberinfo m"
+                    + " inner join modelinfo o on o.memberpk = m.pk"
+                    + " where o.pk = " + modelpk;
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("memberpk", rs.getString("memberpk"));
+                    map.put("pet", rs.getString("pet"));
+                    map.put("age", rs.getString("age"));
+                    map.put("area", rs.getString("area"));
+                    map.put("areaname", rs.getString("areaname"));
+                    map.put("modelpk", rs.getString("modelpk"));
+                    map.put("hei", CommentUtils.stringDoubleToInt(rs.getString("hei")));
+                    map.put("wei", CommentUtils.stringDoubleToInt(rs.getString("wei")));
+                    map.put("wai", CommentUtils.stringDoubleToInt(rs.getString("wai")));
+                    map.put("bust", CommentUtils.stringDoubleToInt(rs.getString("bust")));
+                    map.put("hip", CommentUtils.stringDoubleToInt(rs.getString("hip")));
+                    map.put("lname", rs.getString("lname"));
+                    map.put("photocount", rs.getString("photoCount"));
+                    map.put("stylecount", rs.getString("styleCount"));
+                    map.put("honorcount", rs.getString("HonorCount"));
+                    map.put("vprice", (int) rs.getDouble("VPrice"));
+                    list.add(map);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    @Override
+    public int getMemberpkByModelpk(int modelpk) {
+        try {
+            int          memberpk = 0;
+            String       sql      = "select memberpk from modelinfo where pk = " + modelpk;
+            DbConnection db       = new DbConnection();
+            CachedRowSet rs       = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                memberpk = rs.getInt(1);
+                db.close(rs);
+            }
+            return memberpk;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+
+    @Override
+    public ModelInfo findModelByPk(int modelpk) {
+        ModelInfo modelinfo = new ModelInfo();
+        try {
+            String       sql = "select * from modelinfo where pk = " + modelpk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+
+                modelinfo.setPk(rs.getInt("PK"));
+                modelinfo.setMemberpk(rs.getInt("MemberPK"));
+                modelinfo.setBrokepk(rs.getInt("BrokePK"));
+                modelinfo.setBmemberpk(rs.getInt("BMemberPK"));
+                modelinfo.setNominate(rs.getInt("nominate"));
+                modelinfo.setName(rs.getString("Name"));
+                modelinfo.setSex(rs.getInt("Sex"));
+                modelinfo.setHei((int) rs.getDouble("Hei"));
+                modelinfo.setWei((int) rs.getDouble("wei"));
+                modelinfo.setWai((int) rs.getDouble("wai"));
+                modelinfo.setBust((int) rs.getDouble("bust"));
+                modelinfo.setHip((int) rs.getDouble("hip"));
+                modelinfo.setShoe(rs.getDouble("shoe"));
+                modelinfo.setEye(rs.getInt("eye"));
+                modelinfo.setHair(rs.getInt("hair"));
+                modelinfo.setAddr(rs.getString("addr"));
+                modelinfo.setStage(rs.getString("Stage"));
+                modelinfo.setStar(rs.getInt("Star"));
+                modelinfo.setFcount(rs.getInt("FCount"));
+                modelinfo.setLname(rs.getString("LName"));
+                modelinfo.setUcount(rs.getInt("UCount"));
+                modelinfo.setDcount(rs.getInt("DCount"));
+                modelinfo.setVprice(rs.getDouble("VPrice"));
+                modelinfo.setIs_a(rs.getInt("Is_A"));
+                modelinfo.setRatio_v(rs.getDouble("ratio_V"));
+                modelinfo.setRatio_s(rs.getDouble("ratio_S"));
+                modelinfo.setIs_v(rs.getInt("Is_V"));
+                modelinfo.setRdate(rs.getDate("RDate"));
+                modelinfo.setOccupation(rs.getString("occupation"));
+
+                db.close(rs);
+            }
+
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return modelinfo;
+    }
+
+    @Override
+    public int verifyModelPhone(String phone) {
+        String sql = "select count(1) from memberinfo as e "
+                + " inner join modelinfo as o on o.memberpk = e.pk"
+                + " where e.MembType = '7' and e.tel = '" + phone + "'";
+        DbConnection db    = new DbConnection();
+        int          count = db.queryOneCount(sql);
+        return count;
+    }
+
+    @Override
+    public int findModelPrivateCount(int privatePk) {
+        int count = 0;
+        try {
+            String sql = "select count(1)"
+                    + " from ModelPrivateDiscuss d "
+                    + " inner join memberinfo m on d.MemberPK = m.PK "
+                    + " where d.IsGood != 1 and d.privatepk =  " + privatePk;
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return count;
+    }
+
+    @Override
+    public Map<String, Object> getModelLoginInfo(int modelpk) {
+        String sql = "select "
+                + " o.pk as modelpk, o.Sex, o.hei,o.IsOrder,o.wei,o.wai,o.bust,o.hip,o.shoe,o.eye,o.hair,o.addr,o.BrokePK,"
+                + " o.BMemberPK, o.Stage,o.Star,o.FCount,o.LName,o.UCount,o.DCount,o.Is_A,o.Is_V,o.CardPK,o.Rdate,o.occupation,o.hasred"
+                + " ,m.* "
+                + " from memberinfo m"
+                + " inner join modelinfo o on o.memberpk = m.pk"
+                + " where o.pk = " + modelpk;
+        DbConnection db = new DbConnection();
+        CachedRowSet rs = db.executeQuery(sql);
+        return getResultSetByLoginInfo(rs);
+    }
+
+    public String getModelInfoSql(int memberPk, String where) {
+
+
+        String sql = "select m.*, b.tel, b.hphoto, b.pet, b.Area, "
+                + " (select name from datatypeinfo where pk = b.Area) as AreaName,"
+                + " (select count(1) from ModelFan where modelPK = m.pk and memberpk = " + memberPk + ") as 'IsAttention' "
+                + " from ModelInfo m "
+                + " inner join memberinfo b on b.pk = m.memberpk "
+                + " where 1=1 "
+                + " and MembType = '7' "
+                + " and (select count(1) from ModelPhoto where ModelPK = m.pk)>0 "        //必须有照片
+                + " and m.VPrice > 0 "                                                    //视频聊天单价大于0
+                + " and length(b.pet) > 0 "                                                //名字必须有
+                ;
+        //屏蔽摸特
+        List<Nexus> nexusList = memberinfoService.getAllNexus(new Nexus(memberPk));
+        if (nexusList != null && nexusList.size() > 0) {
+            StringBuffer sb = new StringBuffer("0,");
+            for (Nexus nexus : nexusList) {
+                sb.append(nexus.getModelpk());
+                sb.append(",");
+            }
+            String nexuspks = sb.substring(0, sb.lastIndexOf(","));
+            sql += " and m.pk not in (" + nexuspks + ") ";
+        }
+
+        if (where != null && !where.equals("")) {
+            sql += " and " + where;
+        }
+        sql += String.format(" order by FIND_IN_SET(`is_a`, '%s,%s,%s') ", Constants.IS_A_ONLINE, Constants.IS_A_BUSY, Constants.IS_A_OFFLINE);
+        return sql;
+    }
+
+    @Override
+    public Page<List> findModelLikesLimit(int privatePk, int index, int size) {
+        Page page = new Page();
+
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+
+        StringBuffer sb_sql = new StringBuffer();
+
+        sb_sql.append(" select d.pk, d.PrivatePK, d.ParentPK, d.MemberPK, d.IDate, m.Pet, m.hPhoto ");
+        sb_sql.append(" from ModelPrivateDiscuss d ");
+        sb_sql.append(" inner join memberinfo m on d.MemberPK = m.PK ");
+        sb_sql.append(" where d.IsGood = 1 and d.privatepk = 1 ");
+        sb_sql.append(" order by d.idate desc ");
+
+        //获取分页数量
+        String sqlPageCount = CommentUtils.pagingToMysqlCount(sb_sql.toString());
+        int    count        = new DbConnection().queryOneCount(sqlPageCount);
+        page.setCount(count);
+
+        String sqlPage = CommentUtils.pagingToMysql(sb_sql.toString(), index, size);
+
+        DbConnection db = new DbConnection();
+        CachedRowSet rs = db.executeQuery(sqlPage);
+
+        try {
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("pk", rs.getInt("pk"));
+                    map.put("privatepk", rs.getInt("privatepk"));
+                    map.put("parentpk", rs.getInt("parentpk"));
+                    map.put("memberpk", rs.getInt("memberpk"));
+                    map.put("idate", MyDateUtil.format(rs.getDate("idate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("pet", rs.getString("pet"));
+                    map.put("hphoto", rs.getString("hphoto"));
+                    list.add(map);
+                }
+                db.close(rs);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        page.setData(list);
+        return page;
+    }
+
+    @Override
+    public int updateModelOnlineByModelpk(int modelpk, int online) {
+        String       sql  = "update modelinfo set is_a='" + online + "' where pk = '" + modelpk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int deleteHonorInfo(int modelPK) {
+        String       sql  = "delete from HonorInfo where ModelPK = '" + modelPK + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int deleteModelPrivateByPk(int privatepk) {
+        String       sql  = "delete from ModelPrivate where pk = '" + privatepk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    public int deleteModelPrivateItemByPrivatepk(int privatepk) {
+        String       sql  = "delete from ModelPrivateItem where PrivatePK = '" + privatepk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    public int deleteModelPrivateDiscussByPrivatepk(int privatepk) {
+        String       sql  = "delete from ModelPrivateDiscuss where PrivatePK = '" + privatepk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int getModelpkByMemberpk(int memberpk) {
+        String sql     = "select b.pk as modelpk from memberinfo a inner join modelinfo b on a.pk = b.memberpk where a.pk = '" + memberpk + "'";
+        int    modelpk = new DbConnection().queryOneCount(sql);
+        return modelpk;
+    }
+
+    @Override
+    public int updateModelSetHasRedByModel(int modelpk, int hasred) {
+        String       sql  = "update ModelInfo set HasRed = '" + hasred + "' where pk = " + modelpk;
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
 
 }

+ 272 - 273
src/main/java/com/thmodel/dao/impl/OrderRecordDaoImpl.java

@@ -19,278 +19,277 @@ import com.thmodel.vo.OrderParam;
 
 import com.thmodel.page.Page;
 
-public class OrderRecordDaoImpl implements OrderRecordDao{
-
-	@Override
-	public int insertOrderRecord(OrderParam model) {
-		
-		String sql = String.format("insert into OrderRecord(MemberPK, ModelPK, BrokerPK, LederPK, ODate, SDate, SkillPK, SCount, SName, SPrice, coin, OrderState, intro, evaluate, LinkMan, LinkPhone, addr, AccFlag, HasRed)" +
-				"values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '', '%s', '%s', '%s', '0', '0')"
-				, model.getMemberpk(), model.getModelpk(), model.getBrokerpk(), model.getLederpk(), model.getOdate()
-				, model.getSdate(), model.getSkillpk(), model.getScount(), model.getSname(), model.getSprice(), model.getCoin()
-				, model.getOrderstate(), model.getIntro(), model.getLinkman(), model.getLinkphone(), model.getAddr());
-		
-		DbConnection db = new DbConnection();
-		int pk = db.executeUpdate(sql);
-		return pk;
-	}
-
-	@Override
-	public Page findOrderRecordByMemberPk(Integer memberPk, Integer modelpk, int index, int size, String... states) {
-		Page page = new Page();
-		
-		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-		try {
-			String sql = "select o.*, "
-					+ " m.MemberPK as model_memberpk, "
-					+ " m.Star as modelstar, "
-					+ " mem.pet as modelpet, "
-					+ " mem.hphoto as modelhphoto, "
-					+ " d.name as skillname,"
-					+ " (select hphoto from memberinfo where pk=o.memberpk) as memberhphoto"
-					+ " from OrderRecord o"
-					+ " inner join modelinfo m on o.modelpk = m.pk"
-					+ " inner join memberinfo mem on m.MemberPK = mem.pk"
-					+ " inner join datatypeinfo d on o.skillpk = d.pk"
-					+ " where 1=1 ";
-			if(memberPk != null) {
-				sql += " and o.MemberPK = '"+ memberPk +"' ";
-			}
-			if(modelpk != null) {
-				sql += " and o.modelpk = '"+ modelpk +"' ";
-			}
-			if(states != null && states.length > 0) {
-				String where = states.length > 0 ? " and ( " : "";
-				for (String state : states) {
-					where += " o.OrderState = '"+ state +"' or ";
-				}
-				where = where.substring(0, where.lastIndexOf("or"));
-				where += ")";
-				sql += where;
-			}
-			
-			sql += " order by o.odate desc, o.sdate, pk ";
-			
-			//获取分页总数量
-			String sqlCount = CommentUtils.pagingToMysqlCount(sql);
-			int count = new DbConnection().queryOneCount(sqlCount);
-			
-			//组装分页sql
-			String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
-			
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sqlPage);
-			if(rs!=null) {
-				while(rs.next()){
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("pk", rs.getInt("pk"));
-					map.put("model_memberpk", rs.getInt("model_memberpk"));
-					map.put("memberpk", rs.getInt("memberpk"));
-					map.put("modelpk", rs.getInt("modelpk"));
-					map.put("brokerpk", rs.getInt("brokerpk"));
-					map.put("lederpk", rs.getInt("lederpk"));
-					map.put("odate", MyDateUtil.format(rs.getDate("odate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("sdate", MyDateUtil.format(rs.getDate("sdate"), MyDateUtil.DATE_FORMAT_1));
-					map.put("skillpk", rs.getInt("skillpk"));
-					map.put("scount", rs.getDouble("scount"));
-					map.put("sname", rs.getString("sname"));
-					map.put("sprice", rs.getDouble("sprice"));
-					map.put("coin", rs.getDouble("coin"));
-					map.put("orderstate", rs.getString("orderstate"));
-					map.put("intro", rs.getString("intro"));
-					map.put("ec", rs.getDouble("ec"));
-					map.put("evaluate", rs.getString("evaluate"));
-					map.put("linkman", rs.getString("linkman"));
-					map.put("linkphone", rs.getString("linkphone"));
-					map.put("addr", rs.getString("addr"));
-					
-					map.put("skillname", rs.getString("skillname"));
-					
-					//用户端显示模特信息
-					map.put("modelstar", rs.getString("modelstar"));
-					map.put("modelpet", rs.getString("modelpet"));
-					map.put("modelhphoto", rs.getString("modelhphoto"));
-					//模特端显示用户头像
-					map.put("memberhphoto", rs.getString("memberhphoto"));
-					
-					list.add(map);
-				}
-				db.close(rs);
-			}
-			
-			page.setData(list);
-			page.setCount(count);
-			
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return page;
-	}
-	
-	@Override
-	public int updateOrderComment(int orderPk, String ec, String evaluate) {
-		
-		String sql = "update OrderRecord set EC = '"+ec+"', evaluate = '"+evaluate+"' where pk = '"+orderPk+"'";
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateOrderRecordSetStateModelpk(int orderpk, int modelpk, int accflag, String setState, String... whereStates) {
-		String sql = "update OrderRecord set OrderState='"+ setState +"', accflag='"+accflag+"' where pk = '"+orderpk+"' and modelpk='"+modelpk+"' ";
-		if(whereStates.length>0) {
-			String whereSql = " and (";
-			for (String whereState : whereStates) {
-				whereSql+= " OrderState ='"+whereState+"' or ";
-			}
-			whereSql = whereSql.substring(0, whereSql.lastIndexOf("or"));
-			whereSql += ")";
-			sql += whereSql;
-		}
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-
-	@Override
-	public int updateOrderRecordSetStateMemberpk(int orderpk, int memberpk, String setState, String... whereState) {
-		String sql = "update OrderRecord set OrderState='"+ setState +"' where pk = '"+orderpk+"' and memberpk='"+memberpk+"' ";
-		
-		
-		String where = whereState.length > 0 ? " and (" : null;
-		
-		for (String state : whereState) {
-			where = where + " orderstate = '" + state + "' or ";
-		}
-		if(whereState.length > 0) {
-			where = where.substring(0, where.lastIndexOf("or"));
-			where += ")";
-			sql += where;
-		}
-		
-		
-		DbConnection db = new DbConnection();
-		int rows = db.executeUpdate(sql);
-		return rows;
-	}
-	
-	
-	@Override
-	public OrderRecord findOrderRecordByPk(int orderpk) {
-		OrderRecord orderRecord = new OrderRecord (); 
-		try {
-			String sql = "select * from orderRecord where pk = " + orderpk;
-			DbConnection db = new DbConnection();
-			CachedRowSet rs = db.executeQuery(sql);
-			if(rs != null && rs.next()) {
-				orderRecord.setPk(rs.getInt("pk"));
-				orderRecord.setMemberpk(rs.getInt("memberpk"));
-				orderRecord.setModelpk(rs.getInt("modelpk"));
-				orderRecord.setBrokerpk(rs.getInt("brokerpk"));
-				orderRecord.setLederpk(rs.getInt("lederpk"));
-				orderRecord.setOdate(rs.getDate("odate"));
-				orderRecord.setSdate(rs.getDate("sdate"));
-				orderRecord.setSkillpk(rs.getInt("skillpk"));
-				orderRecord.setScount(rs.getDouble("scount"));
-				orderRecord.setSname(rs.getString("sname"));
-				orderRecord.setSprice(rs.getDouble("sprice"));
-				orderRecord.setCoin(rs.getDouble("coin"));
-				orderRecord.setOrderstate(rs.getString("orderstate"));
-				orderRecord.setIntro(rs.getString("intro"));
-				orderRecord.setEc(rs.getDouble("ec"));
-				orderRecord.setEvaluate(rs.getString("evaluate"));
-				orderRecord.setLinkman(rs.getString("linkman"));
-				orderRecord.setLinkphone(rs.getString("linkphone"));
-				orderRecord.setAddr(rs.getString("addr"));
-				orderRecord.setAccflag(rs.getInt("accflag"));
-				orderRecord.setHasred(rs.getInt("hasred"));
-				db.close(rs);
-				
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		
-		return orderRecord;
-	}
-
-	@Override
-	public Map<String, Object> getOrderInfo(int orderpk) {
-		Map<String, Object> map = new HashMap<String, Object>();
-		String sql = " select "
-					+ " b.MemberPK as model_memberpk, "
-					+ " a.*, c.pet, c.hphoto, "
-					+ " (select name from datatypeinfo where pk = a.skillpk) as skillname "
-					+ " from orderRecord a"
-					+ " inner join modelinfo b on a.modelpk = b.pk"
-					+ " inner join memberinfo c on b.memberpk = c.pk"
-					+ " where a.pk =" + orderpk;
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		
-		try {
-			if(rs!=null && rs.next()) {
-				map.put("pk", rs.getInt("pk"));
-				map.put("model_memberpk", rs.getInt("model_memberpk"));
-				map.put("memberpk", rs.getInt("memberpk"));
-				map.put("modelpk", rs.getInt("modelpk"));
-				map.put("brokerpk", rs.getInt("brokerpk"));
-				map.put("lederpk", rs.getInt("lederpk"));
-				map.put("odate", MyDateUtil.format(rs.getDate("odate"), MyDateUtil.DATE_FORMAT_1));
-				map.put("sdate", MyDateUtil.format(rs.getDate("sdate"), MyDateUtil.DATE_FORMAT_1));
-				map.put("skillpk", rs.getInt("skillpk"));
-				map.put("skillname", rs.getString("skillname"));
-				map.put("scount", rs.getDouble("scount"));
-				map.put("sname", rs.getString("sname"));
-				map.put("sprice", rs.getDouble("sprice"));
-				map.put("coin", rs.getDouble("coin"));
-				map.put("orderstate", rs.getString("orderstate"));
-				map.put("intro", rs.getString("intro"));
-				map.put("ec", rs.getDouble("ec"));
-				map.put("evaluate", rs.getString("evaluate"));
-				map.put("linkman", rs.getString("linkman"));
-				map.put("linkphone", rs.getString("linkphone"));
-				map.put("addr", rs.getString("addr"));
-				map.put("name", rs.getString("pet"));		//模特的名字
-				map.put("hphoto", rs.getString("hphoto"));	//模特的头像
-				
-				//生成订单号
-				String orderpkstr = orderpk+"";
-				int count = orderpkstr.length() < 8 ? (8 - (orderpkstr.length())) : 0;
-				String ordernumber = CommentUtils.getCharLengthByCount("0", count) + orderpkstr;
-				
-				map.put("ordernumber", ordernumber);	//订单号
-				
-				
-				
-				db.close(rs);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return map;
-	}
-
-	@Override
-	public boolean isOrderEndTime(int pk) {
-		int count = 0;
-		String sql = "select count(1) from OrderRecord where 1=1 "
-					+ " and (SDate + interval SCount hour) <= now() "
-					+ " and pk = " + pk;
-		DbConnection db = new DbConnection();
-		CachedRowSet rs = db.executeQuery(sql);
-		try {
-			if(rs != null && rs.next()) {
-				count = rs.getInt(1);
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		} finally {
-			db.close(rs);
-		}
-		return count > 0 ? true : false;
-		
-	}
+public class OrderRecordDaoImpl implements OrderRecordDao {
+
+    @Override
+    public int insertOrderRecord(OrderParam model) {
+
+        String sql = String.format("insert into OrderRecord(MemberPK, ModelPK, BrokerPK, LederPK, ODate, SDate, SkillPK, SCount, SName, SPrice, coin, OrderState, intro, evaluate, LinkMan, LinkPhone, addr, AccFlag, HasRed)"
+                                           + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '', '%s', '%s', '%s', '0', '0')"
+                , model.getMemberpk(), model.getModelpk(), model.getBrokerpk(), model.getLederpk(), model.getOdate()
+                , model.getSdate(), model.getSkillpk(), model.getScount(), model.getSname(), model.getSprice(), model.getCoin()
+                , model.getOrderstate(), model.getIntro(), model.getLinkman(), model.getLinkphone(), model.getAddr());
+
+        DbConnection db = new DbConnection();
+        int          pk = db.executeUpdate(sql);
+        return pk;
+    }
+
+    @Override
+    public Page findOrderRecordByMemberPk(Integer memberPk, Integer modelpk, int index, int size, String... states) {
+        Page page = new Page();
+
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+        try {
+            String sql = "select o.*, "
+                    + " m.MemberPK as model_memberpk, "
+                    + " m.Star as modelstar, "
+                    + " mem.pet as modelpet, "
+                    + " mem.hphoto as modelhphoto, "
+                    + " d.name as skillname,"
+                    + " (select hphoto from memberinfo where pk=o.memberpk) as memberhphoto"
+                    + " from OrderRecord o"
+                    + " inner join modelinfo m on o.modelpk = m.pk"
+                    + " inner join memberinfo mem on m.MemberPK = mem.pk"
+                    + " inner join datatypeinfo d on o.skillpk = d.pk"
+                    + " where 1=1 ";
+            if (memberPk != null) {
+                sql += " and o.MemberPK = '" + memberPk + "' ";
+            }
+            if (modelpk != null) {
+                sql += " and o.modelpk = '" + modelpk + "' ";
+            }
+            if (states != null && states.length > 0) {
+                String where = states.length > 0 ? " and ( " : "";
+                for (String state : states) {
+                    where += " o.OrderState = '" + state + "' or ";
+                }
+                where = where.substring(0, where.lastIndexOf("or"));
+                where += ")";
+                sql += where;
+            }
+
+            sql += " order by o.odate desc, o.sdate, pk ";
+
+            //获取分页总数量
+            String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+            int    count    = new DbConnection().queryOneCount(sqlCount);
+
+            //组装分页sql
+            String sqlPage = CommentUtils.pagingToMysql(sql, index, size);
+
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sqlPage);
+            if (rs != null) {
+                while (rs.next()) {
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    map.put("pk", rs.getInt("pk"));
+                    map.put("model_memberpk", rs.getInt("model_memberpk"));
+                    map.put("memberpk", rs.getInt("memberpk"));
+                    map.put("modelpk", rs.getInt("modelpk"));
+                    map.put("brokerpk", rs.getInt("brokerpk"));
+                    map.put("lederpk", rs.getInt("lederpk"));
+                    map.put("odate", MyDateUtil.format(rs.getDate("odate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("sdate", MyDateUtil.format(rs.getDate("sdate"), MyDateUtil.DATE_FORMAT_1));
+                    map.put("skillpk", rs.getInt("skillpk"));
+                    map.put("scount", rs.getDouble("scount"));
+                    map.put("sname", rs.getString("sname"));
+                    map.put("sprice", rs.getDouble("sprice"));
+                    map.put("coin", rs.getDouble("coin"));
+                    map.put("orderstate", rs.getString("orderstate"));
+                    map.put("intro", rs.getString("intro"));
+                    map.put("ec", rs.getDouble("ec"));
+                    map.put("evaluate", rs.getString("evaluate"));
+                    map.put("linkman", rs.getString("linkman"));
+                    map.put("linkphone", rs.getString("linkphone"));
+                    map.put("addr", rs.getString("addr"));
+
+                    map.put("skillname", rs.getString("skillname"));
+
+                    //用户端显示模特信息
+                    map.put("modelstar", rs.getString("modelstar"));
+                    map.put("modelpet", rs.getString("modelpet"));
+                    map.put("modelhphoto", rs.getString("modelhphoto"));
+                    //模特端显示用户头像
+                    map.put("memberhphoto", rs.getString("memberhphoto"));
+
+                    list.add(map);
+                }
+                db.close(rs);
+            }
+
+            page.setData(list);
+            page.setCount(count);
+
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return page;
+    }
+
+    @Override
+    public int updateOrderComment(int orderPk, String ec, String evaluate) {
+
+        String       sql  = "update OrderRecord set EC = '" + ec + "', evaluate = '" + evaluate + "' where pk = '" + orderPk + "'";
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateOrderRecordSetStateModelpk(int orderpk, int modelpk, int accflag, String setState, String... whereStates) {
+        String sql = "update OrderRecord set OrderState='" + setState + "', accflag='" + accflag + "' where pk = '" + orderpk + "' and modelpk='" + modelpk + "' ";
+        if (whereStates.length > 0) {
+            String whereSql = " and (";
+            for (String whereState : whereStates) {
+                whereSql += " OrderState ='" + whereState + "' or ";
+            }
+            whereSql = whereSql.substring(0, whereSql.lastIndexOf("or"));
+            whereSql += ")";
+            sql += whereSql;
+        }
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+    @Override
+    public int updateOrderRecordSetStateMemberpk(int orderpk, int memberpk, String setState, String... whereState) {
+        String sql = "update OrderRecord set OrderState='" + setState + "' where pk = '" + orderpk + "' and memberpk='" + memberpk + "' ";
+
+
+        String where = whereState.length > 0 ? " and (" : null;
+
+        for (String state : whereState) {
+            where = where + " orderstate = '" + state + "' or ";
+        }
+        if (whereState.length > 0) {
+            where = where.substring(0, where.lastIndexOf("or"));
+            where += ")";
+            sql += where;
+        }
+
+
+        DbConnection db   = new DbConnection();
+        int          rows = db.executeUpdate(sql);
+        return rows;
+    }
+
+
+    @Override
+    public OrderRecord findOrderRecordByPk(int orderpk) {
+        OrderRecord orderRecord = new OrderRecord();
+        try {
+            String       sql = "select * from orderRecord where pk = " + orderpk;
+            DbConnection db  = new DbConnection();
+            CachedRowSet rs  = db.executeQuery(sql);
+            if (rs != null && rs.next()) {
+                orderRecord.setPk(rs.getInt("pk"));
+                orderRecord.setMemberpk(rs.getInt("memberpk"));
+                orderRecord.setModelpk(rs.getInt("modelpk"));
+                orderRecord.setBrokerpk(rs.getInt("brokerpk"));
+                orderRecord.setLederpk(rs.getInt("lederpk"));
+                orderRecord.setOdate(rs.getDate("odate"));
+                orderRecord.setSdate(rs.getDate("sdate"));
+                orderRecord.setSkillpk(rs.getInt("skillpk"));
+                orderRecord.setScount(rs.getDouble("scount"));
+                orderRecord.setSname(rs.getString("sname"));
+                orderRecord.setSprice(rs.getDouble("sprice"));
+                orderRecord.setCoin(rs.getDouble("coin"));
+                orderRecord.setOrderstate(rs.getString("orderstate"));
+                orderRecord.setIntro(rs.getString("intro"));
+                orderRecord.setEc(rs.getDouble("ec"));
+                orderRecord.setEvaluate(rs.getString("evaluate"));
+                orderRecord.setLinkman(rs.getString("linkman"));
+                orderRecord.setLinkphone(rs.getString("linkphone"));
+                orderRecord.setAddr(rs.getString("addr"));
+                orderRecord.setAccflag(rs.getInt("accflag"));
+                orderRecord.setHasred(rs.getInt("hasred"));
+                db.close(rs);
+
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+
+        return orderRecord;
+    }
+
+    @Override
+    public Map<String, Object> getOrderInfo(int orderpk) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        String sql = " select "
+                + " b.MemberPK as model_memberpk, "
+                + " a.*, c.pet, c.hphoto, "
+                + " (select name from datatypeinfo where pk = a.skillpk) as skillname "
+                + " from orderRecord a"
+                + " inner join modelinfo b on a.modelpk = b.pk"
+                + " inner join memberinfo c on b.memberpk = c.pk"
+                + " where a.pk =" + orderpk;
+        DbConnection db = new DbConnection();
+        CachedRowSet rs = db.executeQuery(sql);
+
+        try {
+            if (rs != null && rs.next()) {
+                map.put("pk", rs.getInt("pk"));
+                map.put("model_memberpk", rs.getInt("model_memberpk"));
+                map.put("memberpk", rs.getInt("memberpk"));
+                map.put("modelpk", rs.getInt("modelpk"));
+                map.put("brokerpk", rs.getInt("brokerpk"));
+                map.put("lederpk", rs.getInt("lederpk"));
+                map.put("odate", MyDateUtil.format(rs.getDate("odate"), MyDateUtil.DATE_FORMAT_1));
+                map.put("sdate", MyDateUtil.format(rs.getDate("sdate"), MyDateUtil.DATE_FORMAT_1));
+                map.put("skillpk", rs.getInt("skillpk"));
+                map.put("skillname", rs.getString("skillname"));
+                map.put("scount", rs.getDouble("scount"));
+                map.put("sname", rs.getString("sname"));
+                map.put("sprice", rs.getDouble("sprice"));
+                map.put("coin", rs.getDouble("coin"));
+                map.put("orderstate", rs.getString("orderstate"));
+                map.put("intro", rs.getString("intro"));
+                map.put("ec", rs.getDouble("ec"));
+                map.put("evaluate", rs.getString("evaluate"));
+                map.put("linkman", rs.getString("linkman"));
+                map.put("linkphone", rs.getString("linkphone"));
+                map.put("addr", rs.getString("addr"));
+                map.put("name", rs.getString("pet"));        //模特的名字
+                map.put("hphoto", rs.getString("hphoto"));    //模特的头像
+
+                //生成订单号
+                String orderpkstr  = orderpk + "";
+                int    count       = orderpkstr.length() < 8 ? (8 - (orderpkstr.length())) : 0;
+                String ordernumber = CommentUtils.getCharLengthByCount("0", count) + orderpkstr;
+
+                map.put("ordernumber", ordernumber);    //订单号
+
+
+                db.close(rs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return map;
+    }
+
+    @Override
+    public boolean isOrderEndTime(int pk) {
+        int count = 0;
+        String sql = "select count(1) from OrderRecord where 1=1 "
+                + " and (SDate + interval SCount hour) <= now() "
+                + " and pk = " + pk;
+        DbConnection db = new DbConnection();
+        CachedRowSet rs = db.executeQuery(sql);
+        try {
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            db.close(rs);
+        }
+        return count > 0 ? true : false;
+
+    }
 
 }

+ 236 - 247
src/main/java/com/thmodel/dbconnection/DbConnection.java

@@ -9,305 +9,294 @@ import javax.naming.InitialContext;
 import javax.sql.*;
 import javax.sql.rowset.CachedRowSet;
 
-import com.sun.rowset.CachedRowSetImpl;
+public class DbConnection {
 
-public class DbConnection{
-	
-	public Connection conn = null;
-	public String LastError;
-	
-	private java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-	
-	public static String getPara(String ParaName) 
-	{
-		String FileName="DBConfig.properties";
-		Properties prop= new Properties();
-		try
-		{
-			InputStream is = DbConnection.class.getResourceAsStream(FileName);
-			prop.load(is);
-			if(is!=null) is.close();
-		}
-		catch(Exception e) {
-			return "Error!";
-		}
-		return prop.getProperty(ParaName);
-	}
-	
-	public static boolean isDebug(){
-		if (getPara("Debug").equals("true")){
-			return true;
-		}else{
-			return false;
-		}
-	}
-	
-	public Connection getConn(){
-		if (getPara("ConnectType").equals("jndi")){
-			return getConnByJndi();
-		}else{
-			return getConnByDriver();
-		}
-	}
-	
-	
-    public Connection getConnByJndi(){
-    	try{
-    		Context ctx=new InitialContext();
-		  	DataSource ds=(DataSource)ctx.lookup("java:comp/env/"+getPara("JndiName"));
-		  	conn = ds.getConnection();
-		}catch(Exception e){
-			e.printStackTrace();
-		}
+    public Connection conn = null;
+    public String     LastError;
+
+    private java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+    public static String getPara(String ParaName) {
+        String     FileName = "DBConfig.properties";
+        Properties prop     = new Properties();
+        try {
+            InputStream is = DbConnection.class.getClassLoader().getResourceAsStream(FileName);
+            prop.load(is);
+            if (is != null) is.close();
+        } catch (Exception e) {
+            return "Error!";
+        }
+        return prop.getProperty(ParaName);
+    }
+
+    public static boolean isDebug() {
+        if (getPara("Debug").equals("true")) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public Connection getConn() {
+        if (getPara("ConnectType").equals("jndi")) {
+            return getConnByJndi();
+        } else {
+            return getConnByDriver();
+        }
+    }
+
+
+    public Connection getConnByJndi() {
+        try {
+            Context    ctx = new InitialContext();
+            DataSource ds  = (DataSource) ctx.lookup("java:comp/env/" + getPara("JndiName"));
+            conn = ds.getConnection();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return conn;
+    }
+
+
+    public Connection getConnByDriver() {
+        try {
+            Class.forName("com.mysql.jdbc.Driver");
+            conn = DriverManager.getConnection(getPara("MySQLURL"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return conn;
     }
-	
-	
-	public Connection getConnByDriver() {
-		try{
-		    Class.forName("com.mysql.jdbc.Driver");
-			conn = DriverManager.getConnection(getPara("MySQLURL"));
-		}catch(Exception e){
-			e.printStackTrace();
-		}
-		return conn;
-	}
-	
-    public CachedRowSet executeQuery(String sql){
-    	LastError = "";
-        ResultSet rs = null;
+
+    public CachedRowSet executeQuery(String sql) {
+        LastError = "";
+        ResultSet    rs  = null;
         CachedRowSet crs = null;
-        try{
-        	if (conn==null||conn.isClosed()){
-        		getConn();
-        	}
+        try {
+            if (conn == null || conn.isClosed()) {
+                getConn();
+            }
             Statement stmt = conn.createStatement(1005, 1007);
-            if (isDebug()){
-            	System.out.println(f.format(new java.util.Date())+":"+sql);
+            if (isDebug()) {
+                System.out.println(f.format(new java.util.Date()) + ":" + sql);
             }
             rs = stmt.executeQuery(sql);
-            crs = new CachedRowSetImpl();
+            crs = new FixedCachedRowSetImpl();
             crs.populate(rs);
 
-        }catch(SQLException ex){
-        	LastError = ex.getMessage();
-        	System.out.println(f.format(new java.util.Date())+":"+sql);
-        	ex.printStackTrace();
-        }finally{
-        	try
-			{
-				conn.close();
-			}
-			catch (SQLException e)
-			{
-				e.printStackTrace();
-			}
+        } catch (SQLException ex) {
+            LastError = ex.getMessage();
+            System.out.println(f.format(new java.util.Date()) + ":" + sql);
+            ex.printStackTrace();
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
         }
         return crs;
     }
-    
-    public int executeUpdate(String sql){
-    	LastError = "";
-    	if (sql==null || sql.trim().equals("")){
-    		return -1;
-    	}
-        Statement stmt = null;
-        int Number = -1;
-        try{
-        	if (conn==null||conn.isClosed()){
-        		getConn();
-        	}
+
+    public int executeUpdate(String sql) {
+        LastError = "";
+        if (sql == null || sql.trim().equals("")) {
+            return -1;
+        }
+        Statement stmt   = null;
+        int       Number = -1;
+        try {
+            if (conn == null || conn.isClosed()) {
+                getConn();
+            }
             stmt = conn.createStatement();
             Number = stmt.executeUpdate(sql);
-            if(Number > 0){
-	            ResultSet rs = stmt.getGeneratedKeys();
-	            while(rs.next()){
-	            	Number = rs.getInt(1);
-	            }
-	            if(rs!= null){
-	            	rs.close();
-	            	rs = null;
-	            }
+            if (Number > 0) {
+                ResultSet rs = stmt.getGeneratedKeys();
+                while (rs.next()) {
+                    Number = rs.getInt(1);
+                }
+                if (rs != null) {
+                    rs.close();
+                    rs = null;
+                }
+            }
+            if (isDebug()) {
+                System.out.println(f.format(new java.util.Date()) + ":" + sql);
             }
-            if (isDebug()){
-            	System.out.println(f.format(new java.util.Date())+":"+sql);
+        } catch (Exception ex) {
+            LastError = ex.getMessage();
+            System.out.println(f.format(new java.util.Date()) + ":" + sql);
+            ex.printStackTrace();
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
             }
-        }catch(Exception ex){
-        	LastError = ex.getMessage();
-        	System.out.println(f.format(new java.util.Date())+":"+sql);
-        	ex.printStackTrace();
-        }finally{
-        	try
-			{
-				conn.close();
-			}
-			catch (SQLException e)
-			{
-				e.printStackTrace();
-			}
         }
         return Number;
     }
-    
-    public boolean executeUpdate(String sqls[]){
-    	LastError = "";
-        Statement stmt = null;
-        boolean result = false;
+
+    public boolean executeUpdate(String sqls[]) {
+        LastError = "";
+        Statement stmt   = null;
+        boolean   result = false;
         try {
-	    	if (conn==null||conn.isClosed()){
-	    		getConn();
-	    	}
-			conn.setAutoCommit(false);
-	        for(int i =0; i<sqls.length ; i++){
-	        	if(null != sqls[i]&& !sqls[i].equals("")){
-		            stmt = conn.createStatement();
-		            if (isDebug()){
-		            	System.out.println(f.format(new java.util.Date())+":"+sqls[i]);
-		            }
-		            stmt.executeUpdate(sqls[i]);
-		        }
-	        }
-        	result = true;
-		    conn.commit();
+            if (conn == null || conn.isClosed()) {
+                getConn();
+            }
+            conn.setAutoCommit(false);
+            for (int i = 0; i < sqls.length; i++) {
+                if (null != sqls[i] && !sqls[i].equals("")) {
+                    stmt = conn.createStatement();
+                    if (isDebug()) {
+                        System.out.println(f.format(new java.util.Date()) + ":" + sqls[i]);
+                    }
+                    stmt.executeUpdate(sqls[i]);
+                }
+            }
+            result = true;
+            conn.commit();
         } catch (SQLException e) {
-        	result = false;
-        	LastError = e.getMessage();
-			e.printStackTrace();
-			try{
-				conn.rollback();
-			}catch (SQLException e2) {
-			}
-		}
-        try{
-        	conn.setAutoCommit(true);
-		}catch (SQLException e2) {
-			e2.printStackTrace();
-		}finally{
-        	try
-			{
-				conn.close();
-			}
-			catch (SQLException e)
-			{
-				e.printStackTrace();
-			}
+            result = false;
+            LastError = e.getMessage();
+            e.printStackTrace();
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+            }
+        }
+        try {
+            conn.setAutoCommit(true);
+        } catch (SQLException e2) {
+            e2.printStackTrace();
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
         }
         return result;
     }
-    
 
-    public int executeParamUpdate(String sql,  String[] params){
-    	if (sql==null || sql.trim().equals("")){
-    		return -1;
-    	}
-    	PreparedStatement  pstmt = null;
-        int Number = -1;
-        try{
-        	if (conn==null||conn.isClosed()){
-        		getConn();
-        	}
-        	
+
+    public int executeParamUpdate(String sql, String[] params) {
+        if (sql == null || sql.trim().equals("")) {
+            return -1;
+        }
+        PreparedStatement pstmt  = null;
+        int               Number = -1;
+        try {
+            if (conn == null || conn.isClosed()) {
+                getConn();
+            }
+
             pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
-            for(int i = 0; i < params.length; i++){
-            	pstmt.setString(i+1, params[i]); 
+            for (int i = 0; i < params.length; i++) {
+                pstmt.setString(i + 1, params[i]);
             }
             Number = pstmt.executeUpdate();
-            if(Number > 0){
-	            ResultSet rs = pstmt.getGeneratedKeys();
-	            while(rs.next()){
-	            	Number = rs.getInt(1);
-	            }
-	            if(rs!= null){
-	            	rs.close();
-	            	rs = null;
-	            }
-            }            
-            if (isDebug()){
-            	System.out.println(f.format(new java.util.Date())+":"+sql);
+            if (Number > 0) {
+                ResultSet rs = pstmt.getGeneratedKeys();
+                while (rs.next()) {
+                    Number = rs.getInt(1);
+                }
+                if (rs != null) {
+                    rs.close();
+                    rs = null;
+                }
+            }
+            if (isDebug()) {
+                System.out.println(f.format(new java.util.Date()) + ":" + sql);
+            }
+        } catch (Exception ex) {
+            System.out.println(f.format(new java.util.Date()) + ":" + sql);
+            ex.printStackTrace();
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
             }
-        }catch(Exception ex){
-        	System.out.println(f.format(new java.util.Date())+":"+sql);
-        	ex.printStackTrace();
-        }finally{
-        	try{
-				conn.close();
-			}
-			catch (SQLException e)
-			{
-				e.printStackTrace();
-			}
         }
         return Number;
     }
-    
+
     /**
      * 查询返回值为 一个 int 类型的 sql
+     *
      * @param sql
      * @return
      */
     public int queryOneCount(String sql) {
-    	CachedRowSet rs = executeQuery(sql);
-    	try {
-    		int count = 0;
-			if(rs!=null && rs.next()) {
-				count = rs.getInt(1);
-			}
-			return count;
-		} catch (SQLException e) {
-			e.printStackTrace();
-			return -1;
-		} finally {
-			close(rs);
-		}
+        CachedRowSet rs = executeQuery(sql);
+        try {
+            int count = 0;
+            if (rs != null && rs.next()) {
+                count = rs.getInt(1);
+            }
+            return count;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return -1;
+        } finally {
+            close(rs);
+        }
     }
+
     /**
      * 查询返回值 为一个  String 类型的 sql
+     *
      * @param sql
      * @return
      */
     public String queryOneString(String sql) {
-    	CachedRowSet rs = executeQuery(sql);
-    	try {
-    		String strValue = null;
-    		if(rs!=null && rs.next()) {
-    			strValue = rs.getString(1);
-    		}
-    		return strValue;
-    	} catch (SQLException e) {
-    		e.printStackTrace();
-    		return null;
-    	} finally {
-    		close(rs);
-    	}
+        CachedRowSet rs = executeQuery(sql);
+        try {
+            String strValue = null;
+            if (rs != null && rs.next()) {
+                strValue = rs.getString(1);
+            }
+            return strValue;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        } finally {
+            close(rs);
+        }
     }
+
     /**
      * 查询返回值 为一个  String 类型的 sql
+     *
      * @param sql
      * @return
      */
     public java.util.Date queryOneDate(String sql) {
-    	CachedRowSet rs = executeQuery(sql);
-    	try {
-    		java.util.Date value = null;
-    		if(rs!=null && rs.next()) {
-    			value = rs.getDate(1);
-    		}
-    		return value;
-    	} catch (SQLException e) {
-    		e.printStackTrace();
-    		return null;
-    	} finally {
-    		close(rs);
-    	}
+        CachedRowSet rs = executeQuery(sql);
+        try {
+            java.util.Date value = null;
+            if (rs != null && rs.next()) {
+                value = rs.getDate(1);
+            }
+            return value;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return null;
+        } finally {
+            close(rs);
+        }
     }
-    
-    public void close(CachedRowSet rs){
-    	try {
-			if(rs!=null){
-				rs.close();
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
+
+    public void close(CachedRowSet rs) {
+        try {
+            if (rs != null) {
+                rs.close();
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
     }
 }

+ 309 - 0
src/main/java/com/thmodel/dbconnection/FixedCachedRowSetImpl.java

@@ -0,0 +1,309 @@
+package com.thmodel.dbconnection;
+
+import com.sun.rowset.CachedRowSetImpl;
+
+import javax.sql.rowset.RowSetMetaDataImpl;
+import java.math.BigDecimal;
+import java.sql.*;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Hashtable;
+
+public class FixedCachedRowSetImpl extends CachedRowSetImpl {
+
+    private static final long serialVersionUID = -9067504047398250113L;
+    private RowSetMetaDataImpl RowSetMD;
+
+    public FixedCachedRowSetImpl() throws SQLException {
+        super();
+    }
+
+    public FixedCachedRowSetImpl(Hashtable env) throws SQLException {
+        super(env);
+    }
+
+    private int getColIdxByName(String name) throws SQLException {
+        RowSetMD = (RowSetMetaDataImpl) this.getMetaData();
+        int cols = RowSetMD.getColumnCount();
+
+        for (int i = 1; i <= cols; ++i) {
+            String colName = RowSetMD.getColumnLabel(i);
+            if (colName != null) if (name.equalsIgnoreCase(colName))
+                return (i);
+            else
+                continue;
+        }
+        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalcolnm").toString());
+    }
+
+    @Override
+    public Collection<?> toCollection(String column) throws SQLException {
+        return toCollection(getColIdxByName(column));
+    }
+
+    @Override
+    public String getString(String columnName) throws SQLException {
+        return getString(getColIdxByName(columnName));
+    }
+
+    @Override
+    public boolean getBoolean(String columnName) throws SQLException {
+        return getBoolean(getColIdxByName(columnName));
+    }
+
+    @Override
+    public byte getByte(String columnName) throws SQLException {
+        return getByte(getColIdxByName(columnName));
+    }
+
+    @Override
+    public short getShort(String columnName) throws SQLException {
+        return getShort(getColIdxByName(columnName));
+    }
+
+    @Override
+    public int getInt(String columnName) throws SQLException {
+        return getInt(getColIdxByName(columnName));
+    }
+
+    @Override
+    public long getLong(String columnName) throws SQLException {
+        return getLong(getColIdxByName(columnName));
+    }
+
+    @Override
+    public float getFloat(String columnName) throws SQLException {
+        return getFloat(getColIdxByName(columnName));
+    }
+
+    @Override
+    public double getDouble(String columnName) throws SQLException {
+        return getDouble(getColIdxByName(columnName));
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+        return getBigDecimal(getColIdxByName(columnName), scale);
+    }
+
+    @Override
+    public byte[] getBytes(String columnName) throws SQLException {
+        return getBytes(getColIdxByName(columnName));
+    }
+
+    @Override
+    public java.sql.Date getDate(String columnName) throws SQLException {
+        return getDate(getColIdxByName(columnName));
+    }
+
+    @Override
+    public java.sql.Time getTime(String columnName) throws SQLException {
+        return getTime(getColIdxByName(columnName));
+    }
+
+    @Override
+    public java.sql.Timestamp getTimestamp(String columnName) throws SQLException {
+        return getTimestamp(getColIdxByName(columnName));
+    }
+
+    @Override
+    public java.io.InputStream getAsciiStream(String columnName) throws SQLException {
+        return getAsciiStream(getColIdxByName(columnName));
+
+    }
+
+    @Override
+    public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
+        return getUnicodeStream(getColIdxByName(columnName));
+    }
+
+    @Override
+    public java.io.InputStream getBinaryStream(String columnName) throws SQLException {
+        return getBinaryStream(getColIdxByName(columnName));
+    }
+
+    @Override
+    public Object getObject(String columnName) throws SQLException {
+        return getObject(getColIdxByName(columnName));
+    }
+
+    @Override
+    public int findColumn(String columnName) throws SQLException {
+        return getColIdxByName(columnName);
+    }
+
+    @Override
+    public java.io.Reader getCharacterStream(String columnName) throws SQLException {
+        return getCharacterStream(getColIdxByName(columnName));
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnName) throws SQLException {
+        return getBigDecimal(getColIdxByName(columnName));
+    }
+
+    @Override
+    public boolean columnUpdated(String columnName) throws SQLException {
+        return columnUpdated(getColIdxByName(columnName));
+    }
+
+    @Override
+    public void updateNull(String columnName) throws SQLException {
+        updateNull(getColIdxByName(columnName));
+    }
+
+    @Override
+    public void updateBoolean(String columnName, boolean x) throws SQLException {
+        updateBoolean(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateByte(String columnName, byte x) throws SQLException {
+        updateByte(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateShort(String columnName, short x) throws SQLException {
+        updateShort(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateInt(String columnName, int x) throws SQLException {
+        updateInt(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateLong(String columnName, long x) throws SQLException {
+        updateLong(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateFloat(String columnName, float x) throws SQLException {
+        updateFloat(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateDouble(String columnName, double x) throws SQLException {
+        updateDouble(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
+        updateBigDecimal(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateString(String columnName, String x) throws SQLException {
+        updateString(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateBytes(String columnName, byte x[]) throws SQLException {
+        updateBytes(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateDate(String columnName, java.sql.Date x) throws SQLException {
+        updateDate(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateTime(String columnName, java.sql.Time x) throws SQLException {
+        updateTime(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException {
+        updateTimestamp(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException {
+        updateAsciiStream(getColIdxByName(columnName), x, length);
+    }
+
+    @Override
+    public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException {
+        updateBinaryStream(getColIdxByName(columnName), x, length);
+    }
+
+    @Override
+    public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException {
+        updateCharacterStream(getColIdxByName(columnName), reader, length);
+    }
+
+    @Override
+    public void updateObject(String columnName, Object x, int scale) throws SQLException {
+        updateObject(getColIdxByName(columnName), x, scale);
+    }
+
+    @Override
+    public void updateObject(String columnName, Object x) throws SQLException {
+        updateObject(getColIdxByName(columnName), x);
+    }
+
+    @Override
+    public Object getObject(String columnName, java.util.Map<String, Class<?>> map) throws SQLException {
+        return getObject(getColIdxByName(columnName), map);
+    }
+
+    @Override
+    public Ref getRef(String colName) throws SQLException {
+        return getRef(getColIdxByName(colName));
+    }
+
+    @Override
+    public Blob getBlob(String colName) throws SQLException {
+        return getBlob(getColIdxByName(colName));
+    }
+
+    @Override
+    public Clob getClob(String colName) throws SQLException {
+        return getClob(getColIdxByName(colName));
+    }
+
+    @Override
+    public Array getArray(String colName) throws SQLException {
+        return getArray(getColIdxByName(colName));
+    }
+
+    @Override
+    public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException {
+        return getDate(getColIdxByName(columnName), cal);
+    }
+
+    @Override
+    public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException {
+        return getTime(getColIdxByName(columnName), cal);
+    }
+
+    @Override
+    public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+        return getTimestamp(getColIdxByName(columnName), cal);
+    }
+
+    @Override
+    public void updateRef(String columnName, Ref ref) throws SQLException {
+        updateRef(getColIdxByName(columnName), ref);
+    }
+
+    @Override
+    public void updateClob(String columnName, Clob c) throws SQLException {
+        updateClob(getColIdxByName(columnName), c);
+    }
+
+    @Override
+    public void updateBlob(String columnName, Blob b) throws SQLException {
+        updateBlob(getColIdxByName(columnName), b);
+    }
+
+    @Override
+    public void updateArray(String columnName, Array a) throws SQLException {
+        updateArray(getColIdxByName(columnName), a);
+    }
+
+    @Override
+    public java.net.URL getURL(String columnName) throws SQLException {
+        return getURL(getColIdxByName(columnName));
+    }
+}

+ 58 - 61
src/main/java/com/thmodel/entity/AccRecord.java

@@ -8,65 +8,62 @@ import com.alibaba.fastjson.annotation.JSONField;
  * 积分历史表
  */
 public class AccRecord {
-	
-	private int pk;
-	private int memberpk;	//会员ID
-	private int acctype;	//积分类别
-	@JSONField(format="yyyy-MM-dd HH:mm:ss")
-	private Date adate; 	//时间
-	private int acc;		//积分
-	private String intro;	//说明
-
-	public int getPk() {
-		return pk;
-	}
-
-	public void setPk(int pk) {
-		this.pk = pk;
-	}
-
-	public int getMemberpk() {
-		return memberpk;
-	}
-
-	public void setMemberpk(int memberpk) {
-		this.memberpk = memberpk;
-	}
-
-	public int getAcctype() {
-		return acctype;
-	}
-
-	public void setAcctype(int acctype) {
-		this.acctype = acctype;
-	}
-
-	public Date getAdate() {
-		return adate;
-	}
-
-	public void setAdate(Date adate) {
-		this.adate = adate;
-	}
-
-	public int getAcc() {
-		return acc;
-	}
-
-	public void setAcc(int acc) {
-		this.acc = acc;
-	}
-
-	public String getIntro() {
-		return intro;
-	}
-
-	public void setIntro(String intro) {
-		this.intro = intro;
-	}
-	
-	
-	
-	
-	
+
+    private int    pk;
+    private int    memberpk;    //会员ID
+    private int    acctype;     //积分类别
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date   adate;       //时间
+    private int    acc;         //积分
+    private String intro;       //说明
+
+    public int getPk() {
+        return pk;
+    }
+
+    public void setPk(int pk) {
+        this.pk = pk;
+    }
+
+    public int getMemberpk() {
+        return memberpk;
+    }
+
+    public void setMemberpk(int memberpk) {
+        this.memberpk = memberpk;
+    }
+
+    public int getAcctype() {
+        return acctype;
+    }
+
+    public void setAcctype(int acctype) {
+        this.acctype = acctype;
+    }
+
+    public Date getAdate() {
+        return adate;
+    }
+
+    public void setAdate(Date adate) {
+        this.adate = adate;
+    }
+
+    public int getAcc() {
+        return acc;
+    }
+
+    public void setAcc(int acc) {
+        this.acc = acc;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+
 }

+ 102 - 87
src/main/java/com/thmodel/entity/AccountRecord.java

@@ -6,95 +6,110 @@ import com.alibaba.fastjson.annotation.JSONField;
 
 /**
  * @author 刘迎奥
- * @date 2018-07-24
  * @version v1.0
+ * @date 2018-07-24
  * @desc 结算记录
  */
 public class AccountRecord {
-	
-	private int pk;
-	private int memberpk;		//会员PK
-	@JSONField(format="yyyy-MM-dd HH:mm:ss")
-	private Date adate;			//结算时间
-	private String stype;		//结算来源
-	private int linkpk;			//关联PK
-	private String atype;		//结算类别
-	private double coin;		//结算币额
-	@JSONField(name="abstract")
-	private String abs;			//摘要
-	
-	public AccountRecord() {}
-	
-	public AccountRecord(int memberpk, String stype, int linkpk, String atype, double coin, String abs) {
-		super();
-		this.memberpk = memberpk;
-		this.stype = stype;
-		this.linkpk = linkpk;
-		this.atype = atype;
-		this.coin = coin;
-		this.abs = abs;
-	}
-	
-	public AccountRecord(int pk, int memberpk, Date adate, String stype, int linkpk, String atype, double coin,
-			String abs) {
-		super();
-		this.pk = pk;
-		this.memberpk = memberpk;
-		this.adate = adate;
-		this.stype = stype;
-		this.linkpk = linkpk;
-		this.atype = atype;
-		this.coin = coin;
-		this.abs = abs;
-	}
-	
-	public int getPk() {
-		return pk;
-	}
-	public void setPk(int pk) {
-		this.pk = pk;
-	}
-	public int getMemberpk() {
-		return memberpk;
-	}
-	public void setMemberpk(int memberpk) {
-		this.memberpk = memberpk;
-	}
-	public Date getAdate() {
-		return adate;
-	}
-	public void setAdate(Date adate) {
-		this.adate = adate;
-	}
-	public String getStype() {
-		return stype;
-	}
-	public void setStype(String stype) {
-		this.stype = stype;
-	}
-	public int getLinkpk() {
-		return linkpk;
-	}
-	public void setLinkpk(int linkpk) {
-		this.linkpk = linkpk;
-	}
-	public String getAtype() {
-		return atype;
-	}
-	public void setAtype(String atype) {
-		this.atype = atype;
-	}
-	public double getCoin() {
-		return coin;
-	}
-	public void setCoin(double coin) {
-		this.coin = coin;
-	}
-	public String getAbs() {
-		return abs;
-	}
-	public void setAbs(String abs) {
-		this.abs = abs;
-	}
-	
+
+    private int    pk;
+    private int    memberpk;    //会员PK
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date   adate;       //结算时间
+    private String stype;       //结算来源
+    private int    linkpk;      //关联PK
+    private String atype;       //结算类别
+    private double coin;        //结算币额
+    @JSONField(name = "abstract")
+    private String abs;         //摘要
+
+    public AccountRecord() {
+    }
+
+    public AccountRecord(int memberpk, String stype, int linkpk, String atype, double coin, String abs) {
+        super();
+        this.memberpk = memberpk;
+        this.stype = stype;
+        this.linkpk = linkpk;
+        this.atype = atype;
+        this.coin = coin;
+        this.abs = abs;
+    }
+
+    public AccountRecord(int pk, int memberpk, Date adate, String stype, int linkpk, String atype, double coin, String abs) {
+        super();
+        this.pk = pk;
+        this.memberpk = memberpk;
+        this.adate = adate;
+        this.stype = stype;
+        this.linkpk = linkpk;
+        this.atype = atype;
+        this.coin = coin;
+        this.abs = abs;
+    }
+
+    public int getPk() {
+        return pk;
+    }
+
+    public void setPk(int pk) {
+        this.pk = pk;
+    }
+
+    public int getMemberpk() {
+        return memberpk;
+    }
+
+    public void setMemberpk(int memberpk) {
+        this.memberpk = memberpk;
+    }
+
+    public Date getAdate() {
+        return adate;
+    }
+
+    public void setAdate(Date adate) {
+        this.adate = adate;
+    }
+
+    public String getStype() {
+        return stype;
+    }
+
+    public void setStype(String stype) {
+        this.stype = stype;
+    }
+
+    public int getLinkpk() {
+        return linkpk;
+    }
+
+    public void setLinkpk(int linkpk) {
+        this.linkpk = linkpk;
+    }
+
+    public String getAtype() {
+        return atype;
+    }
+
+    public void setAtype(String atype) {
+        this.atype = atype;
+    }
+
+    public double getCoin() {
+        return coin;
+    }
+
+    public void setCoin(double coin) {
+        this.coin = coin;
+    }
+
+    public String getAbs() {
+        return abs;
+    }
+
+    public void setAbs(String abs) {
+        this.abs = abs;
+    }
+
 }

+ 156 - 123
src/main/java/com/thmodel/entity/BrokerInfor.java

@@ -1,129 +1,162 @@
 package com.thmodel.entity;
 
 /**
- * 经纪人/机构表 
+ * 经纪人/机构表
  */
 public class BrokerInfor {
-	
-	private int 	pk;
-	private int 	memberpk;	//会员pk
-	private int 	superpk;	//所属机构
-	private int 	sex;		//性别
-	private String 	name;		//名称
-	private String 	logo;		//logo
-	private String 	addr;		//地址
-	private String 	intro;		//经营范围
-	private String 	linkman;	//联系人
-	private String 	linktype;	//联系方式
-	private double 	ratio_v;	//视频分成比例
-	private double 	ratio_s;	//人才服务分成比例
-	private double 	ratio_l;	//队长分成比例
-	private double 	ratio_r;	//红包分成比例
-	private int		isadmin;	//是否管理机构
-	private String 	auth;		//后台权限
-	private String 	outfit;		//机构说明
-	
-	public int getPk() {
-		return pk;
-	}
-	public void setPk(int pk) {
-		this.pk = pk;
-	}
-	public int getMemberpk() {
-		return memberpk;
-	}
-	public void setMemberpk(int memberpk) {
-		this.memberpk = memberpk;
-	}
-	public int getSuperpk() {
-		return superpk;
-	}
-	public void setSuperpk(int superpk) {
-		this.superpk = superpk;
-	}
-	public int getSex() {
-		return sex;
-	}
-	public void setSex(int sex) {
-		this.sex = sex;
-	}
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public String getLogo() {
-		return logo;
-	}
-	public void setLogo(String logo) {
-		this.logo = logo;
-	}
-	public String getAddr() {
-		return addr;
-	}
-	public void setAddr(String addr) {
-		this.addr = addr;
-	}
-	public String getIntro() {
-		return intro;
-	}
-	public void setIntro(String intro) {
-		this.intro = intro;
-	}
-	public String getLinkman() {
-		return linkman;
-	}
-	public void setLinkman(String linkman) {
-		this.linkman = linkman;
-	}
-	public String getLinktype() {
-		return linktype;
-	}
-	public void setLinktype(String linktype) {
-		this.linktype = linktype;
-	}
-	public double getRatio_v() {
-		return ratio_v;
-	}
-	public void setRatio_v(double ratio_v) {
-		this.ratio_v = ratio_v;
-	}
-	public double getRatio_s() {
-		return ratio_s;
-	}
-	public void setRatio_s(double ratio_s) {
-		this.ratio_s = ratio_s;
-	}
-	public double getRatio_l() {
-		return ratio_l;
-	}
-	public void setRatio_l(double ratio_l) {
-		this.ratio_l = ratio_l;
-	}
-	public double getRatio_r() {
-		return ratio_r;
-	}
-	public void setRatio_r(double ratio_r) {
-		this.ratio_r = ratio_r;
-	}
-	public int getIsadmin() {
-		return isadmin;
-	}
-	public void setIsadmin(int isadmin) {
-		this.isadmin = isadmin;
-	}
-	public String getAuth() {
-		return auth;
-	}
-	public void setAuth(String auth) {
-		this.auth = auth;
-	}
-	public String getOutfit() {
-		return outfit;
-	}
-	public void setOutfit(String outfit) {
-		this.outfit = outfit;
-	}
-	
+
+    private int    pk;
+    private int    memberpk;    //会员pk
+    private int    superpk;     //所属机构
+    private int    sex;         //性别
+    private String name;        //名称
+    private String logo;        //logo
+    private String addr;        //地址
+    private String intro;       //经营范围
+    private String linkman;     //联系人
+    private String linktype;    //联系方式
+    private double ratio_v;     //视频分成比例
+    private double ratio_s;     //人才服务分成比例
+    private double ratio_l;     //队长分成比例
+    private double ratio_r;     //红包分成比例
+    private int    isadmin;     //是否管理机构
+    private String auth;        //后台权限
+    private String outfit;      //机构说明
+
+    public int getPk() {
+        return pk;
+    }
+
+    public void setPk(int pk) {
+        this.pk = pk;
+    }
+
+    public int getMemberpk() {
+        return memberpk;
+    }
+
+    public void setMemberpk(int memberpk) {
+        this.memberpk = memberpk;
+    }
+
+    public int getSuperpk() {
+        return superpk;
+    }
+
+    public void setSuperpk(int superpk) {
+        this.superpk = superpk;
+    }
+
+    public int getSex() {
+        return sex;
+    }
+
+    public void setSex(int sex) {
+        this.sex = sex;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLogo() {
+        return logo;
+    }
+
+    public void setLogo(String logo) {
+        this.logo = logo;
+    }
+
+    public String getAddr() {
+        return addr;
+    }
+
+    public void setAddr(String addr) {
+        this.addr = addr;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public String getLinkman() {
+        return linkman;
+    }
+
+    public void setLinkman(String linkman) {
+        this.linkman = linkman;
+    }
+
+    public String getLinktype() {
+        return linktype;
+    }
+
+    public void setLinktype(String linktype) {
+        this.linktype = linktype;
+    }
+
+    public double getRatio_v() {
+        return ratio_v;
+    }
+
+    public void setRatio_v(double ratio_v) {
+        this.ratio_v = ratio_v;
+    }
+
+    public double getRatio_s() {
+        return ratio_s;
+    }
+
+    public void setRatio_s(double ratio_s) {
+        this.ratio_s = ratio_s;
+    }
+
+    public double getRatio_l() {
+        return ratio_l;
+    }
+
+    public void setRatio_l(double ratio_l) {
+        this.ratio_l = ratio_l;
+    }
+
+    public double getRatio_r() {
+        return ratio_r;
+    }
+
+    public void setRatio_r(double ratio_r) {
+        this.ratio_r = ratio_r;
+    }
+
+    public int getIsadmin() {
+        return isadmin;
+    }
+
+    public void setIsadmin(int isadmin) {
+        this.isadmin = isadmin;
+    }
+
+    public String getAuth() {
+        return auth;
+    }
+
+    public void setAuth(String auth) {
+        this.auth = auth;
+    }
+
+    public String getOutfit() {
+        return outfit;
+    }
+
+    public void setOutfit(String outfit) {
+        this.outfit = outfit;
+    }
+
 }

+ 126 - 102
src/main/java/com/thmodel/entity/CashRecord.java

@@ -6,110 +6,134 @@ import com.alibaba.fastjson.annotation.JSONField;
 
 /**
  * @author 刘迎奥
- * @date 2018-07-24
  * @version v1.0
+ * @date 2018-07-24
  * @desc 会员冲值提现记录
  */
 public class CashRecord {
-	
-	private int pk;
-	private int memberpk;		//会员pk
-	private double fee;			//冲值提现金额
-	private String ptype;		//类别
-	@JSONField(format="yyyy-MM-dd HH:mm:ss")
-	private Date feedate;		//订单日期
-	@JSONField(name="abstract")
-	private String abs;			//订单摘要
-	private String intro;		//支付说明
-	private String pstate;		//支付状态
-	private String wid;			//微信ID/支付宝账号
-	
-	private String username;	//用户姓名
-	private String phone;		//手机号
-	@JSONField(format="yyyy-MM-dd HH:mm:ss")
-	private Date accountingdate;//到账时间
-	
-	private int accflag;		//结算状态
-	
-	public int getAccflag() {
-		return accflag;
-	}
-	public void setAccflag(int accflag) {
-		this.accflag = accflag;
-	}
-	public Date getAccountingdate() {
-		return accountingdate;
-	}
-	public void setAccountingdate(Date accountingdate) {
-		this.accountingdate = accountingdate;
-	}
-	public int getPk() {
-		return pk;
-	}
-	public void setPk(int pk) {
-		this.pk = pk;
-	}
-	public int getMemberpk() {
-		return memberpk;
-	}
-	public void setMemberpk(int memberpk) {
-		this.memberpk = memberpk;
-	}
-	public double getFee() {
-		return fee;
-	}
-	public void setFee(double fee) {
-		this.fee = fee;
-	}
-	public String getPtype() {
-		return ptype;
-	}
-	public void setPtype(String ptype) {
-		this.ptype = ptype;
-	}
-	public Date getFeedate() {
-		return feedate;
-	}
-	public void setFeedate(Date feedate) {
-		this.feedate = feedate;
-	}
-	
-	public String getAbs() {
-		return abs;
-	}
-	public void setAbs(String abs) {
-		this.abs = abs;
-	}
-	public String getIntro() {
-		return intro;
-	}
-	public void setIntro(String intro) {
-		this.intro = intro;
-	}
-	public String getPstate() {
-		return pstate;
-	}
-	public void setPstate(String pstate) {
-		this.pstate = pstate;
-	}
-	public String getWid() {
-		return wid;
-	}
-	public void setWid(String wid) {
-		this.wid = wid;
-	}
-	public String getUsername() {
-		return username;
-	}
-	public void setUsername(String username) {
-		this.username = username;
-	}
-	public String getPhone() {
-		return phone;
-	}
-	public void setPhone(String phone) {
-		this.phone = phone;
-	}
-	
-	
+
+    private int    pk;
+    private int    memberpk;        //会员pk
+    private double fee;             //冲值提现金额
+    private String ptype;           //类别
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date   feedate;         //订单日期
+    @JSONField(name = "abstract")
+    private String abs;             //订单摘要
+    private String intro;           //支付说明
+    private String pstate;          //支付状态
+    private String wid;             //微信ID/支付宝账号
+
+    private String username;        //用户姓名
+    private String phone;           //手机号
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date   accountingdate;  //到账时间
+
+    private int accflag;            //结算状态
+
+    public int getAccflag() {
+        return accflag;
+    }
+
+    public void setAccflag(int accflag) {
+        this.accflag = accflag;
+    }
+
+    public Date getAccountingdate() {
+        return accountingdate;
+    }
+
+    public void setAccountingdate(Date accountingdate) {
+        this.accountingdate = accountingdate;
+    }
+
+    public int getPk() {
+        return pk;
+    }
+
+    public void setPk(int pk) {
+        this.pk = pk;
+    }
+
+    public int getMemberpk() {
+        return memberpk;
+    }
+
+    public void setMemberpk(int memberpk) {
+        this.memberpk = memberpk;
+    }
+
+    public double getFee() {
+        return fee;
+    }
+
+    public void setFee(double fee) {
+        this.fee = fee;
+    }
+
+    public String getPtype() {
+        return ptype;
+    }
+
+    public void setPtype(String ptype) {
+        this.ptype = ptype;
+    }
+
+    public Date getFeedate() {
+        return feedate;
+    }
+
+    public void setFeedate(Date feedate) {
+        this.feedate = feedate;
+    }
+
+    public String getAbs() {
+        return abs;
+    }
+
+    public void setAbs(String abs) {
+        this.abs = abs;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public String getPstate() {
+        return pstate;
+    }
+
+    public void setPstate(String pstate) {
+        this.pstate = pstate;
+    }
+
+    public String getWid() {
+        return wid;
+    }
+
+    public void setWid(String wid) {
+        this.wid = wid;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+
 }

+ 307 - 316
src/main/java/com/thmodel/entity/ModelInfo.java

@@ -2,377 +2,368 @@ package com.thmodel.entity;
 
 import java.util.Date;
 import java.util.List;
+
 import com.alibaba.fastjson.annotation.JSONField;
 
 /**
  * 人才信息表
  */
 public class ModelInfo {
-	
-	@JSONField(name="modelpk")
-	private int 	pk;	//伪劣  主键id
-	private int 	memberpk;	//会员PK
-	private int 	nominate;	//是否推荐
-	private String 	name;		//真实姓名
-	private int 	sex;		//性别
-	private int 	hei;		//身高
-	private int 	wei;		//体重
-	private int 	wai;		//腰围
-	private int 	bust;		//胸围
-	private int 	hip;		//臀围
-	private double 	shoe;		//鞋码
-	private int		eye;		//眼睛
-	private int 	hair;		//发色
-	private String 	addr;		//地址
-	
-	private int 	brokepk;	//经济人PK
-	private int 	bmemberpk;	//经济人会员PK
-	private String 	stage;		//艺名
-	private int 	star;		//星级
-	private int 	fcount;		//粉丝数
-	private String 	lname;		//个性签名
-	private int 	ucount;		//用户评价好数
-	private int 	dcount;		//用户评价差数
-	private double 	vprice;		//视频聊天单价
-	private int 	is_a;		//是否在线
-	private double 	ratio_r;	//红包分成比例
-	private double 	ratio_v;	//视频分成比例
-	private double 	ratio_s;	//服务分成比例
-	private int 	is_v;		//是否接受视频聊天
-	private int 	cardpk;		//模卡pk
-	private String 	occupation; //职业
-	private int 	hasred;		//是否有新订单
-	
-	@JSONField(format="yyyy-MM-dd HH:mm:ss")
-	private Date	rdate;		//模卡更新时间
-	
-	private List modelphoto;//人才照片
-	
-	private String tel;//账号
-	
-	private int isattention;//是否关注
-	
-	private String hphoto;//memberinfo 表头像
-
-	private String  areaname;	//地区名称
-	private int     area;		//地区编号
-	
-	private String skillnames;
-	
-	public String getSkillnames() {
-		return skillnames;
-	}
-
-	public void setSkillnames(String skillnames) {
-		this.skillnames = skillnames;
-	}
-
-	public int getPk() {
-		return pk;
-	}
-
-	public void setPk(int pk) {
-		this.pk = pk;
-	}
-
-	public int getMemberpk() {
-		return memberpk;
-	}
-
-	public void setMemberpk(int memberpk) {
-		this.memberpk = memberpk;
-	}
-
-	public int getNominate() {
-		return nominate;
-	}
-
-	public void setNominate(int nominate) {
-		this.nominate = nominate;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public String getAreaname() {
-		return areaname;
-	}
-
-	public void setAreaname(String areaname) {
-		this.areaname = areaname;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public int getSex() {
-		return sex;
-	}
-
-	public void setSex(int sex) {
-		this.sex = sex;
-	}
-
-	public int getHei() {
-		return hei;
-	}
-
-	public void setHei(int hei) {
-		this.hei = hei;
-	}
-
-	public int getWei() {
-		return wei;
-	}
-
-	public void setWei(int wei) {
-		this.wei = wei;
-	}
-
-	public int getWai() {
-		return wai;
-	}
-
-	public void setWai(int wai) {
-		this.wai = wai;
-	}
-
-	public int getBust() {
-		return bust;
-	}
-
-	public void setBust(int bust) {
-		this.bust = bust;
-	}
-
-	public int getHip() {
-		return hip;
-	}
-
-	public void setHip(int hip) {
-		this.hip = hip;
-	}
-
-	public double getShoe() {
-		return shoe;
-	}
-
-	public void setShoe(double shoe) {
-		this.shoe = shoe;
-	}
-	
-	public int getHasred() {
-		return hasred;
-	}
 
-	public void setHasred(int hasred) {
-		this.hasred = hasred;
-	}
+    @JSONField(name = "modelpk")
+    private int    pk;          //伪劣  主键id
+    private int    memberpk;    //会员PK
+    private int    nominate;    //是否推荐
+    private String name;        //真实姓名
+    private int    sex;         //性别
+    private int    hei;         //身高
+    private int    wei;         //体重
+    private int    wai;         //腰围
+    private int    bust;        //胸围
+    private int    hip;         //臀围
+    private double shoe;        //鞋码
+    private int    eye;         //眼睛
+    private int    hair;        //发色
+    private String addr;        //地址
+    private int    brokepk;     //经济人PK
+    private int    bmemberpk;   //经济人会员PK
+    private String stage;       //艺名
+    private int    star;        //星级
+    private int    fcount;      //粉丝数
+    private String lname;       //个性签名
+    private int    ucount;      //用户评价好数
+    private int    dcount;      //用户评价差数
+    private double vprice;      //视频聊天单价
+    private int    is_a;        //是否在线
+    private double ratio_r;     //红包分成比例
+    private double ratio_v;     //视频分成比例
+    private double ratio_s;     //服务分成比例
+    private int    is_v;        //是否接受视频聊天
+    private int    cardpk;      //模卡pk
+    private String occupation;  //职业
+    private int    hasred;      //是否有新订单
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date   rdate;       //模卡更新时间
+    private List   modelphoto;  //人才照片
+    private String tel;         //账号
+    private int    isattention; //是否关注
+    private String hphoto;      //memberinfo 表头像
+    private String areaname;    //地区名称
+    private int    area;        //地区编号
+
+    private String skillnames;
+
+    public String getSkillnames() {
+        return skillnames;
+    }
+
+    public void setSkillnames(String skillnames) {
+        this.skillnames = skillnames;
+    }
+
+    public int getPk() {
+        return pk;
+    }
+
+    public void setPk(int pk) {
+        this.pk = pk;
+    }
+
+    public int getMemberpk() {
+        return memberpk;
+    }
+
+    public void setMemberpk(int memberpk) {
+        this.memberpk = memberpk;
+    }
+
+    public int getNominate() {
+        return nominate;
+    }
+
+    public void setNominate(int nominate) {
+        this.nominate = nominate;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getAreaname() {
+        return areaname;
+    }
+
+    public void setAreaname(String areaname) {
+        this.areaname = areaname;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getSex() {
+        return sex;
+    }
+
+    public void setSex(int sex) {
+        this.sex = sex;
+    }
+
+    public int getHei() {
+        return hei;
+    }
+
+    public void setHei(int hei) {
+        this.hei = hei;
+    }
+
+    public int getWei() {
+        return wei;
+    }
+
+    public void setWei(int wei) {
+        this.wei = wei;
+    }
+
+    public int getWai() {
+        return wai;
+    }
+
+    public void setWai(int wai) {
+        this.wai = wai;
+    }
+
+    public int getBust() {
+        return bust;
+    }
+
+    public void setBust(int bust) {
+        this.bust = bust;
+    }
+
+    public int getHip() {
+        return hip;
+    }
+
+    public void setHip(int hip) {
+        this.hip = hip;
+    }
+
+    public double getShoe() {
+        return shoe;
+    }
+
+    public void setShoe(double shoe) {
+        this.shoe = shoe;
+    }
+
+    public int getHasred() {
+        return hasred;
+    }
+
+    public void setHasred(int hasred) {
+        this.hasred = hasred;
+    }
+
+    public int getEye() {
+        return eye;
+    }
+
+    public void setEye(int eye) {
+        this.eye = eye;
+    }
 
-	public int getEye() {
-		return eye;
-	}
+    public int getHair() {
+        return hair;
+    }
 
-	public void setEye(int eye) {
-		this.eye = eye;
-	}
+    public void setHair(int hair) {
+        this.hair = hair;
+    }
 
-	public int getHair() {
-		return hair;
-	}
+    public String getAddr() {
+        return addr;
+    }
 
-	public void setHair(int hair) {
-		this.hair = hair;
-	}
+    public void setAddr(String addr) {
+        this.addr = addr;
+    }
 
-	public String getAddr() {
-		return addr;
-	}
+    public int getBrokepk() {
+        return brokepk;
+    }
 
-	public void setAddr(String addr) {
-		this.addr = addr;
-	}
+    public void setBrokepk(int brokepk) {
+        this.brokepk = brokepk;
+    }
 
-	public int getBrokepk() {
-		return brokepk;
-	}
+    public int getBmemberpk() {
+        return bmemberpk;
+    }
 
-	public void setBrokepk(int brokepk) {
-		this.brokepk = brokepk;
-	}
+    public void setBmemberpk(int bmemberpk) {
+        this.bmemberpk = bmemberpk;
+    }
 
-	public int getBmemberpk() {
-		return bmemberpk;
-	}
+    public String getStage() {
+        return stage;
+    }
 
-	public void setBmemberpk(int bmemberpk) {
-		this.bmemberpk = bmemberpk;
-	}
+    public void setStage(String stage) {
+        this.stage = stage;
+    }
 
-	public String getStage() {
-		return stage;
-	}
+    public int getStar() {
+        return star;
+    }
 
-	public void setStage(String stage) {
-		this.stage = stage;
-	}
+    public void setStar(int star) {
+        this.star = star;
+    }
 
-	public int getStar() {
-		return star;
-	}
+    public int getFcount() {
+        return fcount;
+    }
 
-	public void setStar(int star) {
-		this.star = star;
-	}
+    public void setFcount(int fcount) {
+        this.fcount = fcount;
+    }
 
-	public int getFcount() {
-		return fcount;
-	}
+    public String getLname() {
+        return lname;
+    }
 
-	public void setFcount(int fcount) {
-		this.fcount = fcount;
-	}
+    public void setLname(String lname) {
+        this.lname = lname;
+    }
 
-	public String getLname() {
-		return lname;
-	}
+    public int getUcount() {
+        return ucount;
+    }
 
-	public void setLname(String lname) {
-		this.lname = lname;
-	}
+    public void setUcount(int ucount) {
+        this.ucount = ucount;
+    }
 
-	public int getUcount() {
-		return ucount;
-	}
+    public int getDcount() {
+        return dcount;
+    }
 
-	public void setUcount(int ucount) {
-		this.ucount = ucount;
-	}
+    public void setDcount(int dcount) {
+        this.dcount = dcount;
+    }
 
-	public int getDcount() {
-		return dcount;
-	}
+    public double getVprice() {
+        return vprice;
+    }
 
-	public void setDcount(int dcount) {
-		this.dcount = dcount;
-	}
+    public void setVprice(double vprice) {
+        this.vprice = vprice;
+    }
 
-	public double getVprice() {
-		return vprice;
-	}
+    public int getIs_a() {
+        return is_a;
+    }
 
-	public void setVprice(double vprice) {
-		this.vprice = vprice;
-	}
+    public void setIs_a(int is_a) {
+        this.is_a = is_a;
+    }
 
-	public int getIs_a() {
-		return is_a;
-	}
+    public double getRatio_r() {
+        return ratio_r;
+    }
 
-	public void setIs_a(int is_a) {
-		this.is_a = is_a;
-	}
+    public void setRatio_r(double ratio_r) {
+        this.ratio_r = ratio_r;
+    }
 
-	public double getRatio_r() {
-		return ratio_r;
-	}
+    public double getRatio_v() {
+        return ratio_v;
+    }
 
-	public void setRatio_r(double ratio_r) {
-		this.ratio_r = ratio_r;
-	}
+    public void setRatio_v(double ratio_v) {
+        this.ratio_v = ratio_v;
+    }
 
-	public double getRatio_v() {
-		return ratio_v;
-	}
+    public double getRatio_s() {
+        return ratio_s;
+    }
 
-	public void setRatio_v(double ratio_v) {
-		this.ratio_v = ratio_v;
-	}
+    public void setRatio_s(double ratio_s) {
+        this.ratio_s = ratio_s;
+    }
 
-	public double getRatio_s() {
-		return ratio_s;
-	}
+    public int getIs_v() {
+        return is_v;
+    }
 
-	public void setRatio_s(double ratio_s) {
-		this.ratio_s = ratio_s;
-	}
+    public void setIs_v(int is_v) {
+        this.is_v = is_v;
+    }
 
-	public int getIs_v() {
-		return is_v;
-	}
+    public int getCardpk() {
+        return cardpk;
+    }
 
-	public void setIs_v(int is_v) {
-		this.is_v = is_v;
-	}
+    public void setCardpk(int cardpk) {
+        this.cardpk = cardpk;
+    }
 
-	public int getCardpk() {
-		return cardpk;
-	}
+    public String getOccupation() {
+        return occupation;
+    }
 
-	public void setCardpk(int cardpk) {
-		this.cardpk = cardpk;
-	}
+    public void setOccupation(String occupation) {
+        this.occupation = occupation;
+    }
 
-	public String getOccupation() {
-		return occupation;
-	}
+    public Date getRdate() {
+        return rdate;
+    }
 
-	public void setOccupation(String occupation) {
-		this.occupation = occupation;
-	}
+    public void setRdate(Date rdate) {
+        this.rdate = rdate;
+    }
 
-	public Date getRdate() {
-		return rdate;
-	}
+    public List getModelphoto() {
+        return modelphoto;
+    }
 
-	public void setRdate(Date rdate) {
-		this.rdate = rdate;
-	}
+    public void setModelphoto(List modelphoto) {
+        this.modelphoto = modelphoto;
+    }
 
-	public List getModelphoto() {
-		return modelphoto;
-	}
+    public String getTel() {
+        return tel;
+    }
 
-	public void setModelphoto(List modelphoto) {
-		this.modelphoto = modelphoto;
-	}
+    public void setTel(String tel) {
+        this.tel = tel;
+    }
 
-	public String getTel() {
-		return tel;
-	}
+    public int getIsattention() {
+        return isattention;
+    }
 
-	public void setTel(String tel) {
-		this.tel = tel;
-	}
+    public void setIsattention(int isattention) {
+        this.isattention = isattention;
+    }
 
-	public int getIsattention() {
-		return isattention;
-	}
+    public String getHphoto() {
+        return hphoto;
+    }
 
-	public void setIsattention(int isattention) {
-		this.isattention = isattention;
-	}
+    public void setHphoto(String hphoto) {
+        this.hphoto = hphoto;
+    }
 
-	public String getHphoto() {
-		return hphoto;
-	}
+    public int getArea() {
+        return area;
+    }
 
-	public void setHphoto(String hphoto) {
-		this.hphoto = hphoto;
-	}
+    public void setArea(int area) {
+        this.area = area;
+    }
 
-	public int getArea() {
-		return area;
-	}
 
-	public void setArea(int area) {
-		this.area = area;
-	}
-	
-
-	
-	
-	
 }

+ 430 - 429
src/main/java/com/thmodel/servlet/MemberInfoServlet.java

@@ -37,303 +37,304 @@ import com.thmodel.service.NimserverService;
 
 import net.sf.json.JSONObject;
 import com.thmodel.page.Page;
+
 /**
  * 会员信息接口请求名:memberInfo
- * @author Administrator
  *
+ * @author Administrator
  */
 public class MemberInfoServlet extends HttpServlet {
-	
-	private static final long serialVersionUID = 1L;
-
-	
-	private static NimserverService nimserverService = new NimserverServiceImpl();
-	
-	private static CashRecordDao cashRecordDao = new CashRecordDaoImpl();
-	
-	private static AccountRecordService accountRecordService = new AccountRecordServiceImpl();
-	private static CashRecordService cashRecordService = new CashRecordServiceImpl();
-	private static ModelInfoService modelInfoService = new ModelInfoServiceImpl();
-	private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
-	
-	
-	public void doGet(HttpServletRequest request, HttpServletResponse response)
-			throws ServletException, IOException {
-		doPost(request, response);
-	}
-
-	public void doPost(HttpServletRequest request, HttpServletResponse response)
-			throws ServletException, IOException {
-		request.setCharacterEncoding("UTF-8");
-
-		// 支持跨域
-		response.setHeader("Access-Control-Allow-Origin", "*");
-		
-		response.setContentType("text/html;charset=UTF-8");
-		
-		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
-		
-		JSONObject resultJson = new JSONObject();
-		try {
-			//1	获取验证码
-			if(action.equalsIgnoreCase("doidentifying")){
-				String mobile = CommentUtils.myToString(request.getParameter("mobile"));//手机
-				String type = CommentUtils.myToString(request.getParameter("type"));//0 注册 1:找回
-				
-				String code = "";
-				resultJson.put("msg", Constants.success);
-				resultJson.put("code", code);
-			}
-			//2	注册账号
-			else if(action.equalsIgnoreCase("doregister")){
-				String mobile = CommentUtils.myToString(request.getParameter("mobile"));//手机
-				String pass = CommentUtils.myToString(request.getParameter("pass"));//密码
-				String pet= CommentUtils.myToString(request.getParameter("pet"));//昵称
-				boolean istel = memberinfoService.isTel(mobile);
-				if(istel){
-					MemberInfo memberinfo = new MemberInfo();
-					memberinfo.setTel(mobile);
-					memberinfo.setPass(pass);
-					memberinfo.setPet(pet);
-					
-					int pk = memberinfoService.doRegister(memberinfo);
-					if(pk > 0){//注册成功
-						//创建网易通讯账号
-						
-						nimserverService.createUser(pk, pet);
-						
-						resultJson.put("msg", Constants.success);
-						resultJson.put("pk", pk);
-					}else{
-						resultJson.put("msg", Constants.fail);
-					}
-				}else{
-					resultJson.put("msg", Constants.fail);
-					resultJson.put("desc", Constants.DESC_USER_6);
-				}
-			}
-			
-			//3	账号登录
-			else if (action.equalsIgnoreCase("dologin")) {
-				String mobile = CommentUtils.myToString(request.getParameter("mobile").toString());
-				String pass = CommentUtils.myToString(request.getParameter("pass").toString());
-
-				String msg = "";
-				String desc = "";
-
-				// 判断是否是模特
-				boolean isModel = modelInfoService.verifyModelPhone(mobile);
-				if (isModel) {
-
-					// 1:已经存在 2:不存在 3:异常
-					int code = memberinfoService.verifyPhone(mobile);
-					if (code == 1) {
-						// 已经存在
-						MemberInfo memberinfo = memberinfoService.dologin(mobile, pass);
-						if (memberinfo != null) {
-							msg = Constants.success;
-							resultJson.put("data", JsonUtils.tofastjson(memberinfo));
-						} else {
-							msg = Constants.fail;
-							desc = Constants.DESC_USER_0;
-						}
-					} else if (code == 2) {
-						msg = Constants.fail;
-						desc = Constants.DESC_USER_5;
-					} else {
-						msg = Constants.fail;
-						desc = Constants.DESC_USER_7;
-					}
-				} else {
-					// 模特用户
-					msg = Constants.fail;
-					desc = Constants.DESC_USER_2;
-				}
-				resultJson.put("msg", msg);
-				if (!msg.equals(Constants.success)) {
-					resultJson.put("desc", desc);
-				}
-			}
-			
-			//3.1	打卡签到
-			else if(action.equalsIgnoreCase("docard")){
-				int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
-				if(PK>0){
-					Map<String, Object> resultMap = memberinfoService.docard(PK);
-					if(resultMap!=null){
-						resultJson.put("msg", Constants.success);
-						resultJson.put("data", JsonUtils.tofastjson(resultMap));
-					}else{
-						resultJson.put("msg", Constants.fail);
-					}
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
 
-			
-			//3.2	获取打卡记录
-			else if(action.equalsIgnoreCase("dogetcard")){
-				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
-				
-				int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
-				if(PK>0){
-					resultJson.put("msg", Constants.success);
-					List<MemberSign> list = memberinfoService.dogetcard(PK);
-					for (MemberSign ms : list) {
-						Map<String, String> map = new HashMap<String, String>();
-						map.put("pk", ms.getPk()+"");
-						map.put("memberpk", ms.getMemberpk()+"");
-						map.put("sdate", sdf.format(ms.getSdate()));
-						mapList.add(map);
-					}
-					resultJson.put("data", JsonUtils.tofastjson(list));
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//3.3	找回密码(重设了密码)
-			else if(action.equalsIgnoreCase("dogetpass")){
-				String mobile = CommentUtils.myToString(request.getParameter("mobile"));
-				String pass = CommentUtils.myToString(request.getParameter("pass"));
-				
-				//String pwd = memberinfoService.getPwdByTel(mobile);
-				boolean flag = memberinfoService.modifypwd(mobile, pass);
-				if(flag){
-					resultJson.put("msg", Constants.success);
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-				
-			}
-			
-			//3.4	修改密码
-			else if(action.equalsIgnoreCase("douppass")){
-				//是否提交成功	密码不可为空,为空不重设密码
-				int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
-				String pass = CommentUtils.myToString(request.getParameter("pass"));
-				boolean flag = memberinfoService.updatepwd(PK, pass);
-				if(flag){
-					resultJson.put("msg", Constants.success);
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//3.5	修改昵称
-			else if(action.equalsIgnoreCase("doputpet")){
-				int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
-				String Pet = CommentUtils.myToString(request.getParameter("Pet"));
-				
-				boolean flag = memberinfoService.updatePet(PK, Pet);
-				if(flag){
-					resultJson.put("msg", Constants.success);
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//3.6	修改地区
-			else if(action.equalsIgnoreCase("doputarea")){
-				int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
-				int Area = Integer.parseInt(CommentUtils.myToString(request.getParameter("Area")));
-				boolean flag = memberinfoService.updateArea(PK, Area);
-				if(flag){
-					resultJson.put("msg", Constants.success);
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//3.7	修改手机
-			else if(action.equalsIgnoreCase("doputphone")) {
-				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//memberpk
-				String phone = CommentUtils.myToString(request.getParameter("Phone"));
-				boolean flag = memberinfoService.updateMemberPhone(pk, phone);
-				
-				if(flag){
-					resultJson.put("msg", Constants.success);
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			// 3.8 验证手机号是否注册
-			else if(action.equalsIgnoreCase("verifyphone")) {
-				
-				String phone = CommentUtils.myToString(request.getParameter("Phone"));
-				int code = memberinfoService.verifyPhone(phone);
-				//1:已经存在 2:不存在 3:异常
-				if(code == 1){
-					resultJson.put("msg", Constants.success);
-					resultJson.put("desc", Constants.DESC_USER_6);
-				}else if(code == 2){
-					
-					resultJson.put("msg", Constants.success);
-					resultJson.put("desc", Constants.DESC_USER_5);
-				}else if(code == 3) {
-					resultJson.put("msg", Constants.error);
-				}
-				
-			}
-			
-			//3.9 根据会员pk 刷新用户信息
-			else if(action.equalsIgnoreCase("getuserinfo")) {
-				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//memberpk
-				MemberInfo memberinfo = memberinfoService.getUserInfo(pk);
-				if(memberinfo != null){
-					resultJson.put("msg", Constants.success);
-					resultJson.put("data", JsonUtils.tofastjson(memberinfo));
-				}else{
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//3.10 获取今日收入
-			else if(action.equalsIgnoreCase("getToDayIncome")) {
-				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
-				double todayIncome = accountRecordService.getTodayIncome(memberpk);
-				if(memberpk > 0 ){
-					resultJson.put("msg", Constants.success);
-					resultJson.put("count", JsonUtils.tofastjson(todayIncome));
-				}else{
-					resultJson.put("msg", Constants.fail);
-					resultJson.put("desc", "memberpk is illegal");
-				}
-			}
-			
+    private static final long serialVersionUID = 1L;
 
-			//获取收入明细
-			else if(action.equalsIgnoreCase("getincomedetails")) {
-				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
-				int year = Integer.parseInt(CommentUtils.myToString(request.getParameter("year")));
-				int month = Integer.parseInt(CommentUtils.myToString(request.getParameter("month")));
-				
-				int index = CommentUtils.myToInt(request.getParameter("index"));
-				int size = CommentUtils.myToInt(request.getParameter("size")) ;
-				
-				index = index == 0 ? 1 : index;
-				size = size == 0 ? 10 : size;
-				
-				Map<String, Object> map = accountRecordService.getIncomeDetails(memberpk, year, month, index, size);
-				Page<List<AccountRecord>> list = (Page<List<AccountRecord>>) map.get("data");
-				double incomecoin = (double) map.get("incomecoin");
-				double allcoin = (double) map.get("allcoin");
-				
-				if(list != null) {
-					resultJson.put("msg", Constants.success);
-					resultJson.put("data", JsonUtils.tofastjson(list));
-					resultJson.put("incomecoin", ((double) Math.round(incomecoin * 100) / 100)+"");
-					resultJson.put("allcoin", ((double) Math.round(allcoin * 100) / 100)+"");
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-				
-			}
-			
-			//支出明细
+
+    private static NimserverService nimserverService = new NimserverServiceImpl();
+
+    private static CashRecordDao cashRecordDao = new CashRecordDaoImpl();
+
+    private static AccountRecordService accountRecordService = new AccountRecordServiceImpl();
+    private static CashRecordService    cashRecordService    = new CashRecordServiceImpl();
+    private static ModelInfoService     modelInfoService     = new ModelInfoServiceImpl();
+    private static MemberinfoService    memberinfoService    = new MemberinfoServiceImpl();
+
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        doPost(request, response);
+    }
+
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        request.setCharacterEncoding("UTF-8");
+
+        // 支持跨域
+        response.setHeader("Access-Control-Allow-Origin", "*");
+
+        response.setContentType("text/html;charset=UTF-8");
+
+        String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+
+        JSONObject resultJson = new JSONObject();
+        try {
+            //1	获取验证码
+            if (action.equalsIgnoreCase("doidentifying")) {
+                String mobile = CommentUtils.myToString(request.getParameter("mobile"));//手机
+                String type   = CommentUtils.myToString(request.getParameter("type"));//0 注册 1:找回
+
+                String code = "";
+                resultJson.put("msg", Constants.success);
+                resultJson.put("code", code);
+            }
+            //2	注册账号
+            else if (action.equalsIgnoreCase("doregister")) {
+                String  mobile = CommentUtils.myToString(request.getParameter("mobile"));//手机
+                String  pass   = CommentUtils.myToString(request.getParameter("pass"));//密码
+                String  pet    = CommentUtils.myToString(request.getParameter("pet"));//昵称
+                boolean istel  = memberinfoService.isTel(mobile);
+                if (istel) {
+                    MemberInfo memberinfo = new MemberInfo();
+                    memberinfo.setTel(mobile);
+                    memberinfo.setPass(pass);
+                    memberinfo.setPet(pet);
+
+                    int pk = memberinfoService.doRegister(memberinfo);
+                    if (pk > 0) {//注册成功
+                        //创建网易通讯账号
+
+                        nimserverService.createUser(pk, pet);
+
+                        resultJson.put("msg", Constants.success);
+                        resultJson.put("pk", pk);
+                    } else {
+                        resultJson.put("msg", Constants.fail);
+                    }
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                    resultJson.put("desc", Constants.DESC_USER_6);
+                }
+            }
+
+            //3	账号登录
+            else if (action.equalsIgnoreCase("dologin")) {
+                String mobile = CommentUtils.myToString(request.getParameter("mobile").toString());
+                String pass   = CommentUtils.myToString(request.getParameter("pass").toString());
+
+                String msg  = "";
+                String desc = "";
+
+                // 判断是否是模特
+                boolean isModel = modelInfoService.verifyModelPhone(mobile);
+                if (isModel) {
+
+                    // 1:已经存在 2:不存在 3:异常
+                    int code = memberinfoService.verifyPhone(mobile);
+                    if (code == 1) {
+                        // 已经存在
+                        MemberInfo memberinfo = memberinfoService.dologin(mobile, pass);
+                        if (memberinfo != null) {
+                            msg = Constants.success;
+                            resultJson.put("data", JsonUtils.tofastjson(memberinfo));
+                        } else {
+                            msg = Constants.fail;
+                            desc = Constants.DESC_USER_0;
+                        }
+                    } else if (code == 2) {
+                        msg = Constants.fail;
+                        desc = Constants.DESC_USER_5;
+                    } else {
+                        msg = Constants.fail;
+                        desc = Constants.DESC_USER_7;
+                    }
+                } else {
+                    // 模特用户
+                    msg = Constants.fail;
+                    desc = Constants.DESC_USER_2;
+                }
+                resultJson.put("msg", msg);
+                if (!msg.equals(Constants.success)) {
+                    resultJson.put("desc", desc);
+                }
+            }
+
+            //3.1	打卡签到
+            else if (action.equalsIgnoreCase("docard")) {
+                int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+                if (PK > 0) {
+                    Map<String, Object> resultMap = memberinfoService.docard(PK);
+                    if (resultMap != null) {
+                        resultJson.put("msg", Constants.success);
+                        resultJson.put("data", JsonUtils.tofastjson(resultMap));
+                    } else {
+                        resultJson.put("msg", Constants.fail);
+                    }
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+
+            //3.2	获取打卡记录
+            else if (action.equalsIgnoreCase("dogetcard")) {
+                SimpleDateFormat          sdf     = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
+
+                int PK = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+                if (PK > 0) {
+                    resultJson.put("msg", Constants.success);
+                    List<MemberSign> list = memberinfoService.dogetcard(PK);
+                    for (MemberSign ms : list) {
+                        Map<String, String> map = new HashMap<String, String>();
+                        map.put("pk", ms.getPk() + "");
+                        map.put("memberpk", ms.getMemberpk() + "");
+                        map.put("sdate", sdf.format(ms.getSdate()));
+                        mapList.add(map);
+                    }
+                    resultJson.put("data", JsonUtils.tofastjson(list));
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //3.3	找回密码(重设了密码)
+            else if (action.equalsIgnoreCase("dogetpass")) {
+                String mobile = CommentUtils.myToString(request.getParameter("mobile"));
+                String pass   = CommentUtils.myToString(request.getParameter("pass"));
+
+                //String pwd = memberinfoService.getPwdByTel(mobile);
+                boolean flag = memberinfoService.modifypwd(mobile, pass);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+
+            }
+
+            //3.4	修改密码
+            else if (action.equalsIgnoreCase("douppass")) {
+                //是否提交成功	密码不可为空,为空不重设密码
+                int     PK   = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+                String  pass = CommentUtils.myToString(request.getParameter("pass"));
+                boolean flag = memberinfoService.updatepwd(PK, pass);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //3.5	修改昵称
+            else if (action.equalsIgnoreCase("doputpet")) {
+                int    PK  = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+                String Pet = CommentUtils.myToString(request.getParameter("Pet"));
+
+                boolean flag = memberinfoService.updatePet(PK, Pet);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //3.6	修改地区
+            else if (action.equalsIgnoreCase("doputarea")) {
+                int     PK   = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+                int     Area = Integer.parseInt(CommentUtils.myToString(request.getParameter("Area")));
+                boolean flag = memberinfoService.updateArea(PK, Area);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //3.7	修改手机
+            else if (action.equalsIgnoreCase("doputphone")) {
+                int     pk    = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//memberpk
+                String  phone = CommentUtils.myToString(request.getParameter("Phone"));
+                boolean flag  = memberinfoService.updateMemberPhone(pk, phone);
+
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            // 3.8 验证手机号是否注册
+            else if (action.equalsIgnoreCase("verifyphone")) {
+
+                String phone = CommentUtils.myToString(request.getParameter("Phone"));
+                int    code  = memberinfoService.verifyPhone(phone);
+                //1:已经存在 2:不存在 3:异常
+                if (code == 1) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("desc", Constants.DESC_USER_6);
+                } else if (code == 2) {
+
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("desc", Constants.DESC_USER_5);
+                } else if (code == 3) {
+                    resultJson.put("msg", Constants.error);
+                }
+
+            }
+
+            //3.9 根据会员pk 刷新用户信息
+            else if (action.equalsIgnoreCase("getuserinfo")) {
+                int        pk         = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//memberpk
+                MemberInfo memberinfo = memberinfoService.getUserInfo(pk);
+                if (memberinfo != null) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("data", JsonUtils.tofastjson(memberinfo));
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //3.10 获取今日收入
+            else if (action.equalsIgnoreCase("getToDayIncome")) {
+                int    memberpk    = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+                double todayIncome = accountRecordService.getTodayIncome(memberpk);
+                if (memberpk > 0) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("count", JsonUtils.tofastjson(todayIncome));
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                    resultJson.put("desc", "memberpk is illegal");
+                }
+            }
+
+
+            //获取收入明细
+            else if (action.equalsIgnoreCase("getincomedetails")) {
+                int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+                int year     = Integer.parseInt(CommentUtils.myToString(request.getParameter("year")));
+                int month    = Integer.parseInt(CommentUtils.myToString(request.getParameter("month")));
+
+                int index = CommentUtils.myToInt(request.getParameter("index"));
+                int size  = CommentUtils.myToInt(request.getParameter("size"));
+
+                index = index == 0 ? 1 : index;
+                size = size == 0 ? 10 : size;
+
+                Map<String, Object>       map        = accountRecordService.getIncomeDetails(memberpk, year, month, index, size);
+                Page<List<AccountRecord>> list       = (Page<List<AccountRecord>>) map.get("data");
+                double                    incomecoin = (double) map.get("incomecoin");
+                double                    allcoin    = (double) map.get("allcoin");
+
+                if (list != null) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("data", JsonUtils.tofastjson(list));
+                    resultJson.put("incomecoin", ((double) Math.round(incomecoin * 100) / 100) + "");
+                    resultJson.put("allcoin", ((double) Math.round(allcoin * 100) / 100) + "");
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+
+            }
+
+            //支出明细
 			/*else if(action.equalsIgnoreCase("getpaydetails")) {
 				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
 				List list = accountRecordService.getPayDetails(memberpk);
@@ -345,7 +346,7 @@ public class MemberInfoServlet extends HttpServlet {
 				}
 				
 			}*/
-			//充值明细
+            //充值明细
 			/*else if(action.equalsIgnoreCase("getrechargedetails")) {
 				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
 				List list = accountRecordService.getRechargeDetails(memberpk);
@@ -356,143 +357,143 @@ public class MemberInfoServlet extends HttpServlet {
 					resultJson.put("msg", Constants.fail);
 				}
 			}*/
-			
-			//提现明细
-			else if(action.equalsIgnoreCase("getoutcashdetails")) {
-				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
-				int year = Integer.parseInt(CommentUtils.myToString(request.getParameter("year")));
-				int month = Integer.parseInt(CommentUtils.myToString(request.getParameter("month")));
-				
-				int index = CommentUtils.myToInt(request.getParameter("index"));
-				int size = CommentUtils.myToInt(request.getParameter("size")) ;
-				
-				index = index == 0 ? 1 : index;
-				size = size == 0 ? 10 : size;
-				
-				Map<String, Object> map = cashRecordService.getOutCashDetails(memberpk, year, month, index, size);
-				
-				Page list = (Page) map.get("data");
-				double outcashcoin = (double) map.get("outcashcoin");
-				double allcoin = (double) map.get("allcoin");
-				
-				if(list != null) {
-					resultJson.put("msg", Constants.success);
-					resultJson.put("data", JsonUtils.tofastjson(list));
-					resultJson.put("outcashcoin", ((double) Math.round(outcashcoin * 100) / 100)+"");
-					resultJson.put("allcoin", ((double) Math.round(allcoin * 100) / 100)+"");
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//查询提现充值记录
-			else if(action.equalsIgnoreCase("getoneoutcashdetails")) {
-				int cashrecordpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("cashrecordpk")));
-				CashRecord c = cashRecordDao.findCashRecordOne(cashrecordpk);
-				if(c != null) {
-					resultJson.put("msg", Constants.success);
-					resultJson.put("data", JsonUtils.tofastjson(c));
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//举报
-			else if(action.equalsIgnoreCase("report")) {
-				int accuserpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("accuserpk")));
-				int appelleepk = Integer.parseInt(CommentUtils.myToString(request.getParameter("appelleepk")));
-				String reason= CommentUtils.myToString(request.getParameter("reason"));
-				
-				ReportInfo reportInfo = new ReportInfo();
-				reportInfo.setAccuserpk(accuserpk);
-				reportInfo.setAppelleepk(appelleepk);
-				reportInfo.setReason(reason);
-				
-				boolean flag = modelInfoService.doAddReport(reportInfo);
-				if(flag) {
-					resultJson.put("msg", Constants.success);
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//添加屏蔽模特
-			else if(action.equalsIgnoreCase("doDefriendModel")) {
-				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
-				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
-				String remarks = CommentUtils.myToString(request.getParameter("remarks"));
-				
-				Nexus nexus = new Nexus();
-				nexus.setMemberpk(memberpk);
-				nexus.setModelpk(modelpk);
-				nexus.setRemarks(remarks);
-				
-				boolean flag = memberinfoService.addDefriendModel(nexus);
-				if(flag) {
-					resultJson.put("msg", Constants.success);
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-			//查询屏蔽的模特列表
-			else if(action.equalsIgnoreCase("doGetDefriendModel")) {
-				
-				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
-				
-				int index = CommentUtils.myToInt(request.getParameter("index"));
-				int size = CommentUtils.myToInt(request.getParameter("size")) ;
-				
-				index = index == 0 ? 1 : index;
-				size = size == 0 ? 10 : size;
-				
-				Nexus nexus = new Nexus();
-				nexus.setMemberpk(memberpk);
-				
-				Page<List<Nexus>> page = memberinfoService.getDefriendModel(nexus, index, size);
-				if(page != null) {
-					
-					int count = page.getCount();
-					List<Nexus> data = page.getData();
-					
-					resultJson.put("msg", Constants.success);
-					
-					resultJson.put("count", count);
-					resultJson.put("data", JsonUtils.tofastjson(data));
-					
-				}else {
-					resultJson.put("msg", Constants.fail);
-					resultJson.put("desc", "参数有误");
-				}
-				
-				
-			}
-			//移除屏蔽的模特
-			else if(action.equalsIgnoreCase("doRemoveDefriendModel")) {
-				int nexuspk = Integer.parseInt(CommentUtils.myToString(request.getParameter("nexuspk")));
-				
-				Nexus nexus = new Nexus();
-				nexus.setPk(nexuspk);
-				
-				boolean flag = memberinfoService.removeDefriendModel(nexus);
-				if(flag) {
-					resultJson.put("msg", Constants.success);
-				} else {
-					resultJson.put("msg", Constants.fail);
-				}
-			}
-			
-		} catch (Exception e) {
-			e.printStackTrace();
-			resultJson.put("msg", Constants.error);
-		} finally{
-			if(action.equals("")){
-				resultJson.put("msg", Constants.error);
-				resultJson.put("value", "参数action不能为空!");
-			}
-			JsonUtils.printWriter(response, resultJson);
-			
-		}
-	}
+
+            //提现明细
+            else if (action.equalsIgnoreCase("getoutcashdetails")) {
+                int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+                int year     = Integer.parseInt(CommentUtils.myToString(request.getParameter("year")));
+                int month    = Integer.parseInt(CommentUtils.myToString(request.getParameter("month")));
+
+                int index = CommentUtils.myToInt(request.getParameter("index"));
+                int size  = CommentUtils.myToInt(request.getParameter("size"));
+
+                index = index == 0 ? 1 : index;
+                size = size == 0 ? 10 : size;
+
+                Map<String, Object> map = cashRecordService.getOutCashDetails(memberpk, year, month, index, size);
+
+                Page   list        = (Page) map.get("data");
+                double outcashcoin = (double) map.get("outcashcoin");
+                double allcoin     = (double) map.get("allcoin");
+
+                if (list != null) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("data", JsonUtils.tofastjson(list));
+                    resultJson.put("outcashcoin", ((double) Math.round(outcashcoin * 100) / 100) + "");
+                    resultJson.put("allcoin", ((double) Math.round(allcoin * 100) / 100) + "");
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //查询提现充值记录
+            else if (action.equalsIgnoreCase("getoneoutcashdetails")) {
+                int        cashrecordpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("cashrecordpk")));
+                CashRecord c            = cashRecordDao.findCashRecordOne(cashrecordpk);
+                if (c != null) {
+                    resultJson.put("msg", Constants.success);
+                    resultJson.put("data", JsonUtils.tofastjson(c));
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //举报
+            else if (action.equalsIgnoreCase("report")) {
+                int    accuserpk  = Integer.parseInt(CommentUtils.myToString(request.getParameter("accuserpk")));
+                int    appelleepk = Integer.parseInt(CommentUtils.myToString(request.getParameter("appelleepk")));
+                String reason     = CommentUtils.myToString(request.getParameter("reason"));
+
+                ReportInfo reportInfo = new ReportInfo();
+                reportInfo.setAccuserpk(accuserpk);
+                reportInfo.setAppelleepk(appelleepk);
+                reportInfo.setReason(reason);
+
+                boolean flag = modelInfoService.doAddReport(reportInfo);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //添加屏蔽模特
+            else if (action.equalsIgnoreCase("doDefriendModel")) {
+                int    memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+                int    modelpk  = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+                String remarks  = CommentUtils.myToString(request.getParameter("remarks"));
+
+                Nexus nexus = new Nexus();
+                nexus.setMemberpk(memberpk);
+                nexus.setModelpk(modelpk);
+                nexus.setRemarks(remarks);
+
+                boolean flag = memberinfoService.addDefriendModel(nexus);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+            //查询屏蔽的模特列表
+            else if (action.equalsIgnoreCase("doGetDefriendModel")) {
+
+                int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+
+                int index = CommentUtils.myToInt(request.getParameter("index"));
+                int size  = CommentUtils.myToInt(request.getParameter("size"));
+
+                index = index == 0 ? 1 : index;
+                size = size == 0 ? 10 : size;
+
+                Nexus nexus = new Nexus();
+                nexus.setMemberpk(memberpk);
+
+                Page<List<Nexus>> page = memberinfoService.getDefriendModel(nexus, index, size);
+                if (page != null) {
+
+                    int         count = page.getCount();
+                    List<Nexus> data  = page.getData();
+
+                    resultJson.put("msg", Constants.success);
+
+                    resultJson.put("count", count);
+                    resultJson.put("data", JsonUtils.tofastjson(data));
+
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                    resultJson.put("desc", "参数有误");
+                }
+
+
+            }
+            //移除屏蔽的模特
+            else if (action.equalsIgnoreCase("doRemoveDefriendModel")) {
+                int nexuspk = Integer.parseInt(CommentUtils.myToString(request.getParameter("nexuspk")));
+
+                Nexus nexus = new Nexus();
+                nexus.setPk(nexuspk);
+
+                boolean flag = memberinfoService.removeDefriendModel(nexus);
+                if (flag) {
+                    resultJson.put("msg", Constants.success);
+                } else {
+                    resultJson.put("msg", Constants.fail);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultJson.put("msg", Constants.error);
+        } finally {
+            if (action.equals("")) {
+                resultJson.put("msg", Constants.error);
+                resultJson.put("value", "参数action不能为空!");
+            }
+            JsonUtils.printWriter(response, resultJson);
+
+        }
+    }
 
 }