xiongzhu 7 年 前
コミット
2b1e1ec1c8
100 ファイル変更17664 行追加0 行削除
  1. 5 0
      .gitignore
  2. 191 0
      pom.xml
  3. 129 0
      src/main/java/com/thmodel/alipay/AliPay.java
  4. 23 0
      src/main/java/com/thmodel/alipay/AliPayConfig.java
  5. 44 0
      src/main/java/com/thmodel/constants/AccountConstants.java
  6. 34 0
      src/main/java/com/thmodel/constants/ActivityConstants.java
  7. 48 0
      src/main/java/com/thmodel/constants/Constants.java
  8. 85 0
      src/main/java/com/thmodel/constants/OrderConstants.java
  9. 53 0
      src/main/java/com/thmodel/constants/PayConstants.java
  10. 60 0
      src/main/java/com/thmodel/constants/Recursion.java
  11. 293 0
      src/main/java/com/thmodel/constants/SystemPayConstants.java
  12. 15 0
      src/main/java/com/thmodel/dao/AccRecordDao.java
  13. 50 0
      src/main/java/com/thmodel/dao/AccountRecordDao.java
  14. 73 0
      src/main/java/com/thmodel/dao/CashRecordDao.java
  15. 15 0
      src/main/java/com/thmodel/dao/DataTypeInfoDao.java
  16. 47 0
      src/main/java/com/thmodel/dao/MemberSignDao.java
  17. 268 0
      src/main/java/com/thmodel/dao/MemberinfoDao.java
  18. 15 0
      src/main/java/com/thmodel/dao/ModelCardDao.java
  19. 579 0
      src/main/java/com/thmodel/dao/ModelInfoDao.java
  20. 77 0
      src/main/java/com/thmodel/dao/OrderRecordDao.java
  21. 89 0
      src/main/java/com/thmodel/dao/ParttyInfoDao.java
  22. 54 0
      src/main/java/com/thmodel/dao/RedPacketDao.java
  23. 56 0
      src/main/java/com/thmodel/dao/VideoRecordDao.java
  24. 29 0
      src/main/java/com/thmodel/dao/impl/AccRecordDaoImpl.java
  25. 186 0
      src/main/java/com/thmodel/dao/impl/AccountRecordDaoImpl.java
  26. 247 0
      src/main/java/com/thmodel/dao/impl/CashRecordDaoImpl.java
  27. 40 0
      src/main/java/com/thmodel/dao/impl/DataTypeInfoDaoImpl.java
  28. 81 0
      src/main/java/com/thmodel/dao/impl/MemberSignDaoImpl.java
  29. 619 0
      src/main/java/com/thmodel/dao/impl/MemberinfoDaoImpl.java
  30. 42 0
      src/main/java/com/thmodel/dao/impl/ModelCardDaoImpl.java
  31. 1800 0
      src/main/java/com/thmodel/dao/impl/ModelInfoDaoImpl.java
  32. 296 0
      src/main/java/com/thmodel/dao/impl/OrderRecordDaoImpl.java
  33. 301 0
      src/main/java/com/thmodel/dao/impl/ParttyInfoDaoImpl.java
  34. 110 0
      src/main/java/com/thmodel/dao/impl/RedPacketDaoImpl.java
  35. 162 0
      src/main/java/com/thmodel/dao/impl/VideoRecordDaoImpl.java
  36. 313 0
      src/main/java/com/thmodel/dbconnection/DbConnection.java
  37. 72 0
      src/main/java/com/thmodel/entity/AccRecord.java
  38. 100 0
      src/main/java/com/thmodel/entity/AccountRecord.java
  39. 129 0
      src/main/java/com/thmodel/entity/BrokerInfor.java
  40. 115 0
      src/main/java/com/thmodel/entity/CashRecord.java
  41. 77 0
      src/main/java/com/thmodel/entity/ChatRecord.java
  42. 49 0
      src/main/java/com/thmodel/entity/HonorInfo.java
  43. 308 0
      src/main/java/com/thmodel/entity/MemberInfo.java
  44. 39 0
      src/main/java/com/thmodel/entity/MemberSign.java
  45. 96 0
      src/main/java/com/thmodel/entity/ModelAct.java
  46. 70 0
      src/main/java/com/thmodel/entity/ModelCard.java
  47. 378 0
      src/main/java/com/thmodel/entity/ModelInfo.java
  48. 53 0
      src/main/java/com/thmodel/entity/ModelPhoto.java
  49. 99 0
      src/main/java/com/thmodel/entity/ModelPrice.java
  50. 85 0
      src/main/java/com/thmodel/entity/ModelPrivate.java
  51. 82 0
      src/main/java/com/thmodel/entity/ModelPrivateDiscuss.java
  52. 48 0
      src/main/java/com/thmodel/entity/ModelPrivateItem.java
  53. 83 0
      src/main/java/com/thmodel/entity/Nexus.java
  54. 225 0
      src/main/java/com/thmodel/entity/OrderRecord.java
  55. 140 0
      src/main/java/com/thmodel/entity/ParttyInfo.java
  56. 61 0
      src/main/java/com/thmodel/entity/RedPacket.java
  57. 80 0
      src/main/java/com/thmodel/entity/ReportInfo.java
  58. 98 0
      src/main/java/com/thmodel/entity/VideoRecord.java
  59. 39 0
      src/main/java/com/thmodel/nimserver/CheckSumBuilder.java
  60. 46 0
      src/main/java/com/thmodel/nimserver/NimConfig.java
  61. 452 0
      src/main/java/com/thmodel/nimserver/Nimserver.java
  62. 24 0
      src/main/java/com/thmodel/page/Page.java
  63. 31 0
      src/main/java/com/thmodel/result/ResultProcedure.java
  64. 51 0
      src/main/java/com/thmodel/service/AccountRecordService.java
  65. 57 0
      src/main/java/com/thmodel/service/ActivityService.java
  66. 16 0
      src/main/java/com/thmodel/service/CashRecordService.java
  67. 185 0
      src/main/java/com/thmodel/service/MemberinfoService.java
  68. 49 0
      src/main/java/com/thmodel/service/ModelCardService.java
  69. 475 0
      src/main/java/com/thmodel/service/ModelInfoService.java
  70. 41 0
      src/main/java/com/thmodel/service/NimserverService.java
  71. 92 0
      src/main/java/com/thmodel/service/OrderService.java
  72. 97 0
      src/main/java/com/thmodel/service/PayService.java
  73. 25 0
      src/main/java/com/thmodel/service/UtilServer.java
  74. 58 0
      src/main/java/com/thmodel/service/VideoRecordService.java
  75. 122 0
      src/main/java/com/thmodel/service/impl/AccountRecordServiceImpl.java
  76. 126 0
      src/main/java/com/thmodel/service/impl/ActivityServiceImpl.java
  77. 57 0
      src/main/java/com/thmodel/service/impl/CashRecordServiceImpl.java
  78. 408 0
      src/main/java/com/thmodel/service/impl/MemberinfoServiceImpl.java
  79. 99 0
      src/main/java/com/thmodel/service/impl/ModelCardServiceImpl.java
  80. 886 0
      src/main/java/com/thmodel/service/impl/ModelInfoServiceImpl.java
  81. 86 0
      src/main/java/com/thmodel/service/impl/NimserverServiceImpl.java
  82. 339 0
      src/main/java/com/thmodel/service/impl/OrderServiceImpl.java
  83. 286 0
      src/main/java/com/thmodel/service/impl/PayServiceImpl.java
  84. 35 0
      src/main/java/com/thmodel/service/impl/UtilServerImpl.java
  85. 113 0
      src/main/java/com/thmodel/service/impl/VideoRecordServiceImpl.java
  86. 192 0
      src/main/java/com/thmodel/servlet/ActivityServlet.java
  87. 498 0
      src/main/java/com/thmodel/servlet/MemberInfoServlet.java
  88. 91 0
      src/main/java/com/thmodel/servlet/ModelCardServlet.java
  89. 737 0
      src/main/java/com/thmodel/servlet/ModelInfoServlet.java
  90. 435 0
      src/main/java/com/thmodel/servlet/OrderServlet.java
  91. 285 0
      src/main/java/com/thmodel/servlet/PayServlet.java
  92. 211 0
      src/main/java/com/thmodel/servlet/UploadServlet.java
  93. 60 0
      src/main/java/com/thmodel/servlet/VideoRecordServlet.java
  94. 438 0
      src/main/java/com/thmodel/servlet/model/ModelServlet.java
  95. 391 0
      src/main/java/com/thmodel/servlet/netease/NeteaseServlet.java
  96. 302 0
      src/main/java/com/thmodel/util/CommentUtils.java
  97. 64 0
      src/main/java/com/thmodel/util/DBRecordsPack.java
  98. 159 0
      src/main/java/com/thmodel/util/JsonUtils.java
  99. 41 0
      src/main/java/com/thmodel/util/MD5Util.java
  100. 449 0
      src/main/java/com/thmodel/util/MyDateUtil.java

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+/target
+*.iml
+.idea
+.DS_Store
+.vscode

+ 191 - 0
pom.xml

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>izouma.com</groupId>
+    <artifactId>thmodel</artifactId>
+    <version>1.0</version>
+    <packaging>war</packaging>
+    <properties>
+        <jdk.version>1.8</jdk.version>
+    </properties>
+    <build>
+        <finalName>thmodel</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.xml</include>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${jdk.version}</source>
+                    <target>${jdk.version}</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.10</version>
+                <configuration>
+                    <skip>true</skip>
+                    <testFailureIgnore>true</testFailureIgnore>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>javax</groupId>
+            <artifactId>javaee-api</artifactId>
+            <version>7.0</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jstl</artifactId>
+            <version>1.2</version>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet.jsp</groupId>
+            <artifactId>jsp-api</artifactId>
+            <version>2.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>3.3.87.ALL</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.7.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-email</artifactId>
+            <version>1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.0.4</version>
+        </dependency>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.ezmorph</groupId>
+            <artifactId>ezmorph</artifactId>
+            <version>1.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.13 </version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.4.4</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.30</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.25</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xmlbeans</groupId>
+            <artifactId>xmlbeans</artifactId>
+            <version>2.6.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-util -->
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-util</artifactId>
+            <version>8.5.34</version>
+        </dependency>
+
+    </dependencies>
+</project>

+ 129 - 0
src/main/java/com/thmodel/alipay/AliPay.java

@@ -0,0 +1,129 @@
+package com.thmodel.alipay;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.alipay.api.domain.AlipayTradeAppPayModel;
+import com.alipay.api.internal.util.AlipaySignature;
+import com.alipay.api.request.AlipayTradeAppPayRequest;
+import com.alipay.api.response.AlipayTradeAppPayResponse;
+import com.thmodel.util.MD5Util;
+
+public class AliPay{
+	
+	public AliPay() {
+		
+	}
+
+	
+	
+	/**
+	 * 服务端SDK生成APP支付订单信息示例
+	 * @param outtradeno
+	 */
+	public String aliPayOrder(String body, String subject, String timeoutExpress, String totalAmount, String outTradeNo, int pk) {
+		// 支付宝配置信息
+		String APP_ID = AliPayConfig.APP_ID;
+		String APP_PRIVATE_KEY = AliPayConfig.APP_PRIVATE_KEY;
+		String CHARSET = AliPayConfig.CHARSET;
+		String ALIPAY_PUBLIC_KEY = AliPayConfig.ALIPAY_PUBLIC_KEY;
+		
+		// 实例化客户端
+		AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", APP_ID,
+				APP_PRIVATE_KEY, "json", CHARSET, ALIPAY_PUBLIC_KEY, "RSA2");
+		// 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
+		AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
+		// SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
+		AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
+		
+		//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。
+		model.setBody(body);
+		
+		//商品的标题/交易标题/订单标题/订单关键字等。
+		model.setSubject(subject);
+		
+		//商户网站唯一订单号
+		model.setOutTradeNo(outTradeNo);
+		
+		//该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。注:若为空,则默认为15d。
+		model.setTimeoutExpress(timeoutExpress);
+		
+		//订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]
+		model.setTotalAmount(totalAmount);
+		
+		//销售产品码,商家和支付宝签约的产品码,为固定值QUICK_MSECURITY_PAY
+		model.setProductCode("QUICK_MSECURITY_PAY");
+		
+		request.setBizModel(model);
+		request.setNotifyUrl(AliPayConfig.SUCCESS_URL + "?orderno="+outTradeNo+"&pk="+pk);
+
+		//request.setNotifyUrl("http://118.190.49.85/thmodel/pay?action=alipaycallback&pk="+pk+"&outtradeno="+outTradeNo+"&result=success&source=回调接口");
+		
+		try {
+			// 这里和普通的接口调用不同,使用的是sdkExecute
+			AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
+			
+			//System.out.println(response.getBody());// 就是orderString 可以直接给客户端请求,无需再做处理。
+			return response.getBody();
+		} catch (AlipayApiException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	/**
+	 * 服务端验证异步通知信息参数示例
+	 * @param request
+	 * @return
+	 * @throws AlipayApiException 
+	 */
+	public boolean verifyAsync(HttpServletRequest request) throws AlipayApiException {
+		// 支付宝配置信息
+		String APP_ID = AliPayConfig.APP_ID;
+		String APP_PRIVATE_KEY = AliPayConfig.APP_PRIVATE_KEY;
+		String CHARSET = AliPayConfig.CHARSET;
+		String ALIPAY_PUBLIC_KEY = AliPayConfig.ALIPAY_PUBLIC_KEY;
+				
+				
+		//获取支付宝POST过来反馈信息
+		Map<String,String> params = new HashMap<String,String>();
+		Map requestParams = request.getParameterMap();
+		for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
+		    String name = (String) iter.next();
+		    String[] values = (String[]) requestParams.get(name);
+		    String valueStr = "";
+		    for (int i = 0; i < values.length; i++) {
+		        valueStr = (i == values.length - 1) ? valueStr + values[i]
+		                    : valueStr + values[i] + ",";
+		  	}
+		    //乱码解决,这段代码在出现乱码时使用。
+			//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
+			params.put(name, valueStr);
+		}
+		//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
+		//boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type)
+		boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET,"RSA2");
+		return flag;
+	}
+	
+	public String getAliPayOrderId() {
+		
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+		String sysDate = sdf.format(new Date());
+		UUID uuid = UUID.randomUUID();
+		String uuidAndDate = uuid.toString().replaceAll("-", "")+sysDate;
+		String orderid = MD5Util.MD5(uuidAndDate);
+		orderid = orderid.substring(0, 15);
+		return orderid;
+	}
+	
+}

+ 23 - 0
src/main/java/com/thmodel/alipay/AliPayConfig.java

@@ -0,0 +1,23 @@
+package com.thmodel.alipay;
+
+/**
+ * 支付宝配置信息
+ * @author 刘迎奥
+ * @date 2018年7月20日
+ * @version v1.0
+ */
+public class AliPayConfig {
+	
+	public static final String APP_ID = "2018071860706455";
+	
+	public static final String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCP3dAVo0xi5qFhly1GTWuwGhaUHrkG9MPTORmGsAVHHGXBKb9Bu42LjB6Ij31l4YiLvveuA6gfKGAy9KhEKLb9FO0QxTZho89YYOq1NM8vJkkt8+CXOSVY28rA3biittu+7JOhm/DSTmywjjV0ZzVterZSmZUKACMXLBNpXmTxBTFfVgEpO4Em7EG+EiQ970Pt1aDj3g1gw2Hm1pYtjwA2yamtBuCHuhITx2XkAaGQZlZHsCrHESsQiJaLSaGry04cdLv/J2/nonii2GylLdjAK7SJn5u6dFQKtj+R4ooeWt7CZoO5CH3AQCMJe3yzQ9V1tiec4iAE3mL8qWyI+qVjAgMBAAECggEALoSzjvuRbH1Ue2DNo+jOxE97M4PHokcstrTE2zc5TagSAuaD0DZb615wVQnIq1PEuiMSpTLLft+oU3GmovtjR+wnR3/tOJ8mIVadLeCYiY9gpDoySdORjuzq33gSBpMH9PE8P0pUETyIioJBKJViwjamk4jTlzs6HXkEAdMi4oeiijs1P+jjYzN2+iiCCE1g+xm2L+fq48ZQXU8mRb+8vwAupM6gveGQJQbbNEYylz7TJ+bUL+ZxpfmkkyvFHNfGyLQIvWqYkdFxBXU3xTNXic3x6Ekprw82PLB7u6Gvl61ajui87uePGa+0VYUWTNxSD41ef2a24gjCzMreZtgdGQKBgQD0n/8g2R6y1f27g8BApe9L4/AExayte/0jkOvQ8QAe1IQ3yzjDoR3NQpQGVw/U4rXBHv7nqpphWHiutRi59YDDQe2DlRP+xlkD6Fqpl5FFprTe9IJcdG4LmRF0INBJAtBmNTjDm6RuY6hzMeIg4RqoJU/1ZrV37n2UpnDZscm+DQKBgQCWjmRN1ZC0H9Ns5juojuLZ6nqe3WdBq/T1HqFKCjGpF2ido1tzBGvyM/KO20tg+X2S0ZE8Q8db46Iid1Fi7UJeS2laDarZJqy8fQvjLrki5KFAteBAqP1154eUJbtLozHSE9+zGKMh/KzHhHek1jNKF3IxCuYv4FumS4WGUQSFLwKBgQDKlZ3xlB2KORGSMwAKCeFs1e215gak/WOcCq5gMNXKsnB0zEXMLSfDDvoLbhpcUQv4TTUIog6Lw3reJHe/uQLTsUuDhvgyLA0X4VsDy9Ow/OgZJCC5dGqWDEOaCnqznDL+EeFajRDVoo6kJ5F/bSxoR846Cr8J/WXeryASCNxsGQKBgD7YGQ5UQx6s2jfusqBdZFvKAH0ntd43xPw8WN7q+me2mbiTY6zS/6wN+wWejAximAQc7h7Vu/WjQx5X5+T/XGC34bXxVotmFVxoZfnimuzxuk2knYLgB0yb5H/2cAPWjwk9unarpgydyBFQPhDUSHx45PWLsyHw6NC1XXr/fn+JAoGBALluUDxuqtgU56f91ipJiA5mjLc0eGixMrMjR/FSkvcYYWYkAiiwYNFlwzm55VQHAXQf6jEPMRZ/0WVOVvntySYBNe91icTxK8cekAsxSxZdjmkvPTDH3pObO0AwRUEa7KiIfOi/vPF0xp+MzKeNZakgmiUeONasi0AvLX4FWpwZ";
+	
+	public static final String CHARSET = "utf-8";
+	
+	public static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj93QFaNMYuahYZctRk1rsBoWlB65BvTD0zkZhrAFRxxlwSm/QbuNi4weiI99ZeGIi773rgOoHyhgMvSoRCi2/RTtEMU2YaPPWGDqtTTPLyZJLfPglzklWNvKwN24orbbvuyToZvw0k5ssI41dGc1bXq2UpmVCgAjFywTaV5k8QUxX1YBKTuBJuxBvhIkPe9D7dWg494NYMNh5taWLY8ANsmprQbgh7oSE8dl5AGhkGZWR7AqxxErEIiWi0mhq8tOHHS7/ydv56J4othspS3YwCu0iZ+bunRUCrY/keKKHlrewmaDuQh9wEAjCXt8s0PVdbYnnOIgBN5i/KlsiPqlYwIDAQAB";
+
+	
+	
+	public static final String SUCCESS_URL = "http://118.190.49.85/thmodel/aliPaySuccess.jsp";
+	
+}

+ 44 - 0
src/main/java/com/thmodel/constants/AccountConstants.java

@@ -0,0 +1,44 @@
+package com.thmodel.constants;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-26
+ * @version v1.0
+ * @desc 账单记录类型
+ * 1收入 2支出 3充值 4提现
+ */
+public class AccountConstants {
+	
+	/*
+	 * 	结算类别:
+		红包收入、聊天收入、服务收入、红包分红入、聊天分成入、服务分成入、队长收入、冲值币额收入、
+		红包支付、聊天支付、订单支付、模卡支付、
+		提现支出,活动支出,活动退费
+		结算来源:冲值提现、红包、聊天、订单、活动
+	 */
+	public static final String accountrecord_S_TYPE_1  =  "充值提现";
+	public static final String ACCOUNTRECORD_S_TYPE_2  =  "红包";
+	public static final String ACCOUNTRECORD_S_TYPE_3  =  "聊天";
+	public static final String ACCOUNTRECORD_S_TYPE_4  =  "订单";
+	public static final String ACCOUNTRECORD_S_TYPE_5  =  "活动";
+	
+	public static final String ACCOUNTRECORD_A_TYPE_0  =  "服务分成收入";
+	public static final String ACCOUNTRECORD_A_TYPE_1  =  "红包收入";
+	public static final String ACCOUNTRECORD_A_TYPE_2  =  "聊天收入";
+	public static final String ACCOUNTRECORD_A_TYPE_3  =  "服务收入";
+	public static final String ACCOUNTRECORD_A_TYPE_4  =  "红包分红收入";
+	public static final String ACCOUNTRECORD_A_TYPE_5  =  "聊天分成收入";
+	public static final String ACCOUNTRECORD_A_TYPE_6  =  "队长收入";
+	public static final String ACCOUNTRECORD_A_TYPE_7  =  "充值币额收入";
+	public static final String ACCOUNTRECORD_A_TYPE_8  =  "红包支付";
+	public static final String ACCOUNTRECORD_A_TYPE_9  =  "聊天支付";
+	public static final String ACCOUNTRECORD_A_TYPE_10 =  "订单支付";
+	public static final String ACCOUNTRECORD_A_TYPE_11 =  "模卡支付";
+	public static final String ACCOUNTRECORD_A_TYPE_12 =  "提现支出";
+	public static final String ACCOUNTRECORD_A_TYPE_13 =  "活动支出";
+	public static final String ACCOUNTRECORD_A_TYPE_14 =  "活动退费";
+	
+	
+	
+	
+}

+ 34 - 0
src/main/java/com/thmodel/constants/ActivityConstants.java

@@ -0,0 +1,34 @@
+package com.thmodel.constants;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-08-09
+ * @version v1.0
+ * @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  	=  "报名异常";
+	
+	
+	
+}

+ 48 - 0
src/main/java/com/thmodel/constants/Constants.java

@@ -0,0 +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; 	//通话中
+	
+}

+ 85 - 0
src/main/java/com/thmodel/constants/OrderConstants.java

@@ -0,0 +1,85 @@
+package com.thmodel.constants;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-25
+ * @version v1.0
+ * @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);
+	}
+}

+ 53 - 0
src/main/java/com/thmodel/constants/PayConstants.java

@@ -0,0 +1,53 @@
+package com.thmodel.constants;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-24
+ * @version v1.0
+ * @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 "参数错误";
+		}
+	}
+	
+}

+ 60 - 0
src/main/java/com/thmodel/constants/Recursion.java

@@ -0,0 +1,60 @@
+package com.thmodel.constants;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.ModelPrivateDiscuss;
+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--------------------------------------------------
+	
+	
+}

+ 293 - 0
src/main/java/com/thmodel/constants/SystemPayConstants.java

@@ -0,0 +1,293 @@
+package com.thmodel.constants;
+
+import java.sql.SQLException;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.result.ResultProcedure;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-27
+ * @version v2.0
+ * @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) {
+		/*SystemPay systemPay = new SystemPay();
+		systemPay.setCoin(99);
+		systemPay.setPayMemberpk(1);
+		systemPay.setIncomeMemberpk(2);
+		systemPay.setPayType(2);
+		boolean flag = systemPay(systemPay);
+		System.out.println(flag);*/
+		
+		/*
+		//预支支付
+		boolean flag = executeYuZhi(48, 100.00);
+		System.out.println(flag);
+		*/
+		
+		/*AccountRecord ar = new AccountRecord();
+		boolean flag = insertAccountRecord(ar);
+		System.out.println(flag);*/
+		
+	}
+	
+	
+}

+ 15 - 0
src/main/java/com/thmodel/dao/AccRecordDao.java

@@ -0,0 +1,15 @@
+package com.thmodel.dao;
+
+/**
+ * 积分表
+ */
+public interface AccRecordDao {
+	
+	/**
+	 * 根据会员id 获取所有积分
+	 * @return
+	 */
+	public int getAccSumByMemberPK(int MemberPK);
+	
+	
+}

+ 50 - 0
src/main/java/com/thmodel/dao/AccountRecordDao.java

@@ -0,0 +1,50 @@
+package com.thmodel.dao;
+
+import java.util.List;
+
+import com.thmodel.entity.AccountRecord;
+
+import com.thmodel.page.Page;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-24
+ * @version v1.0
+ * @desc 结算记录
+ */
+public interface AccountRecordDao {
+	
+	/**
+	 * 获取今日收入
+	 * @param memberpk
+	 * @return
+	 */
+	public double findTodayIncome(int memberpk);
+	
+	/**
+	 * 查询账单明细   根据会员pk 和  结算类型
+	 * @param memberpk
+	 * @param atype
+	 * @return
+	 */
+	public List findAccountRecordBymemberpkAndAType(int memberpk, String atype);
+	
+	/**
+	 * 
+	 * @param memberpk
+	 * @param stypes
+	 * @param atypes
+	 * @return
+	 */
+	public Page<List<AccountRecord>> findAccountRecordByMemberpkSTypeAType(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes, int index, int size);
+	
+	/**
+	 * 获取收入 根据 会员pk
+	 * @param memberpk
+	 * @param beginDate
+	 * @param endDate
+	 * @return
+	 */
+	public double findIncome(int memberpk, String beginDate, String endDate, String[] stypes, String[] atypes);
+	
+}

+ 73 - 0
src/main/java/com/thmodel/dao/CashRecordDao.java

@@ -0,0 +1,73 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.CashRecord;
+
+import com.thmodel.page.Page;
+
+public interface CashRecordDao {
+	
+	/**
+	 * 添加 一条记录
+	 * @param cashRecord
+	 * @return
+	 */
+	public int insertCashRecord(CashRecord cashRecord);
+	
+	/**
+	 * 查询记录
+	 * @param ptype
+	 * @param pstate
+	 * @return
+	 */
+	public List findCashRecord(int memberpk, String ptype, String pstate);
+	
+	/**
+	 * 根据pk获取一个明细
+	 * @param pk
+	 * @return
+	 */
+	public CashRecord findCashRecordOne(int pk);
+	
+	/**
+	 * 根据 pk和wid 修改 状态pstate
+	 * @param pk
+	 * @param wid
+	 * @return
+	 */
+	public int updateCashRecordSetStateByPkAndWid(int pk, String wid, String state, int accflag);
+	
+	/**
+	 * 根据pk 和  wid 查询 记录
+	 * @param pk
+	 * @param wid
+	 * @return
+	 */
+	public CashRecord findCashRecordByPkAndWid(int pk, String wid);
+	
+	/**
+	 * 查询记录
+	 * @param memberpk
+	 * @param beginDate
+	 * @param endDate
+	 * @param PType
+	 * @param PState
+	 * @return
+	 */
+	public Page<List<CashRecord>> findCashRecordByMemberpkDatePTypePState(int memberpk, String beginDate, String endDate, String[] PType, String[] PState, int index, int size);
+	
+	/**
+	 * 记录fee
+	 * @param memberpk
+	 * @param beginDate
+	 * @param endDate
+	 * @param PType
+	 * @param PState
+	 * @return
+	 */
+	public double findOutCashFee(int memberpk, String beginDate, String endDate, String[] PType, String[] PState);
+	
+	
+}

+ 15 - 0
src/main/java/com/thmodel/dao/DataTypeInfoDao.java

@@ -0,0 +1,15 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+public interface DataTypeInfoDao {
+	
+	/**
+	 * 根据类型查询 参数表pk 和 name
+	 * @param typeName 类型名称
+	 * @return
+	 */
+	public List<Map<String, Object>> findDataTypeInfoByTypeName(String typeName);
+	
+}

+ 47 - 0
src/main/java/com/thmodel/dao/MemberSignDao.java

@@ -0,0 +1,47 @@
+package com.thmodel.dao;
+
+import java.util.List;
+
+import com.thmodel.entity.MemberSign;
+
+/**
+ * 会员签到信息表
+ */
+public interface MemberSignDao {
+	
+	//插入一条	会员签到信息	记录
+	public int insertMemberSign(int PK, String SDate);
+	
+	/**
+	 * 根据会员id查询某一天是否签过到
+	 * @param PK
+	 * @param SDate
+	 * @return
+	 */
+	public int findMemberSignByPkLikeSDate(int PK, String SDate);
+	
+	/**
+	 * 根据id 修改最后一次签到时间 和 连续签到天数
+	 * @param PK
+	 * @param LastSign
+	 * @param SignDays
+	 * @return
+	 */
+	public int updateMemberInfoToLastSignAndSignDaysByPk(int PK, String LastSign, String SignDays);
+	
+	/**
+	 * 根据id 修改最后一次签到时间
+	 * @param PK
+	 * @param LastSign
+	 * @return
+	 */
+	public int updateMemberInfoToLastSignByPk(int PK, String LastSign);
+	
+	/**
+	 * 根据账号pk获取 签到记录
+	 * @param MemberPK
+	 * @return
+	 */
+	public List<MemberSign> findMemberSignByMemberPK(int MemberPK);
+	
+}

+ 268 - 0
src/main/java/com/thmodel/dao/MemberinfoDao.java

@@ -0,0 +1,268 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.Nexus;
+import com.thmodel.entity.ReportInfo;
+import com.thmodel.page.Page;
+
+public interface MemberinfoDao {
+	
+	/**
+	 * 客户端注册
+	 * 插入会员账号信息表
+	 * @param memberinfo
+	 * @return
+	 */
+	public int insertMemberinfoByRegister(MemberInfo memberinfo);
+	
+	/**
+	 * 模特端注册
+	 * 插入会员账号信息表
+	 * @param memberinfo
+	 * @return
+	 */
+	public int insertMemberinfoByModelRegister(MemberInfo memberinfo);
+	
+	/**
+	 * 获取新的邀请码
+	 * @return
+	 */
+	public String getNewMemQrCode();
+	
+	/**
+	 * 根据手机号 和 密码  查询会员/用户信息
+	 * @param username
+	 * @param pwd
+	 * @return
+	 */
+	public MemberInfo login(String username, String pwd);
+	
+	/**
+	 * 根据手机号查询会员/用户信息数量
+	 * @param tel
+	 * @return
+	 */
+	public int getCountToMemberinfoByTel(String tel);
+	
+	/**
+	 * 根据主键pk 查询会员信息
+	 * @param PK
+	 * @return
+	 */
+	public MemberInfo findMemberinfoByPK(int PK);
+	
+	/**
+	 * 获取签到返回值
+	 * 会员PK,积分,最后一次签到时间,连续签到天数
+	 * @return
+	 */
+	public Map<String, Object> docard(int MemberPK);
+	
+	/**
+	 * 根据PK修改密码
+	 * @param PK
+	 * @param pwd
+	 * @return
+	 */
+	public int updatePassword(int PK, String pwd);
+	
+	/**
+	 * 根据手机号/账号	获取密码
+	 * @param tel
+	 * @return
+	 */
+	public String findPwdByTel(String tel);
+	
+	/**
+	 * 根据手机号 查询账号pk
+	 * @param tel
+	 * @return
+	 */
+	public int findMemberpkByTel(String tel);
+	
+	/**
+	 * 根据PK主键  修改昵称
+	 * @param PK
+	 * @param Pet
+	 */
+	public int updatePetByPK(int PK, String Pet);
+	
+	/**
+	 * 根据主键PK修改地区
+	 * @param PK
+	 * @param Area
+	 * @return
+	 */
+	public int updateAreaByPK(int PK, int Area);
+	
+	/**
+	 *  修改用户头像
+	 * @param pk
+	 * @param hphoto
+	 * @return
+	 */
+	public int updateMemberhphotoByPk(int pk, String hphoto);
+	
+	/**
+	 * 根据PK 修改手机号
+	 * @param pk
+	 * @param phone
+	 * @return
+	 */
+	public int updateMemberPhoneByPk(int pk, String phone);
+	
+	/**
+	 * 根据PK 修改token
+	 * @param pk
+	 * @param token
+	 * @return
+	 */
+	public int updateMemberTokenByPk(int pk, String token);
+	
+	/**
+	 * 发红包 时 更新金额
+	 * @param memberPk
+	 * @param coin
+	 * @return
+	 */
+	public int updateMemberToGiveRed_Disable(int memberPk, double coin);
+	
+	/**
+	 * 收红包 时 更新金额
+	 * @param redPacketPk 红包pk
+	 * @param modelPk 收红包的人才pk
+	 * @param memberPk 发红包的会员pk
+	 * @param coin 发红包的金额
+	 * @return
+	 */
+	public int updateMemberToReceiveRed_Disable(int redPacketPk, int modelPk, int memberPk, double coin);
+	
+	
+	/**
+	 * 根据
+	 * @param pk
+	 * @return
+	 */
+	public MemberInfo getMemberInfoByPk(int pk);
+	
+	/**
+	 * 修改用户信息  根据人才pk
+	 * @param modelpk
+	 * @param name
+	 * @param age
+	 * @param area
+	 * @return
+	 */
+	public int updateMemberInfoByModelPk(int modelpk, String name, String age, String area);
+
+	/**
+	 * 根据会员pk 查询会员昵称Pet
+	 * @param pk
+	 * @return
+	 */
+	public String findMemberPetByPk(int pk);
+	
+	/**
+	 * 累加充值币额
+	 * @param memberpk
+	 * @param coin 
+	 * @return
+	 */
+	public int addMemberCoinI(int memberpk, double coin);
+	
+	/**
+	 * 修改支付宝账号  根据 会员pk
+	 * @param memberpk
+	 * @param wid
+	 * @return
+	 */
+	public int updateMemberWidByMemberpk(int memberpk, String wid);
+	
+	/**
+	 * 提现减去余额里面的钱
+	 * @param memberpk
+	 * @param fee
+	 * @return
+	 */
+	public int updateMemberInfoToOutCash(int memberpk, double fee);
+	
+	
+	/**
+	 * 扣除预支付的钱,添加到余额里面
+	 * @param memberpk 会员pk
+	 * @param subtract_coin_o 减去预支里面的金额
+	 * @param plus_coin_a 添加到余额里面的金额
+	 * @return
+	 */
+	public int updateMemberCoinOToCoinA_Disable(int memberpk, double subtract_coin_o, double plus_coin_a);
+	
+	/**
+	 * 根据手机号修改密码
+	 * @param phone
+	 * @param pass
+	 * @return
+	 */
+	public int updateMemberSetPassByPhone(String phone, String pass);
+	
+	/**
+	 * 查询memberpk  是否是模特
+	 * @param memberpk
+	 * @return
+	 */
+	public int findMemberIsModel(int memberpk);
+	
+	/**
+	 * 根据邀请码 获取 pk
+	 * @param introducerpk
+	 * @return
+	 */
+	public int findMemberpkByQRcode(String QRCode);
+	
+	/**
+	 * 添加举报记录
+	 * @param reportInfo
+	 * @return
+	 */
+	public int insertReportInfo(ReportInfo reportInfo);
+	
+	/**
+	 * 删除评论
+	 * @param modelprivatediscusspk
+	 * @param privatepk
+	 * @return
+	 */
+	public int deleteModelPrivateDiscuss(int modelprivatediscusspk, int privatepk);
+	
+	/**
+	 * 添加屏蔽模特
+	 * @param nexus
+	 * @return
+	 */
+	public int insertNexus(Nexus nexus);
+	
+	/**
+	 * 删除屏蔽的模特
+	 * @param nexus
+	 * @return
+	 */
+	public int deleteNexus(Nexus nexus);
+	
+	/**
+	 * 查询屏蔽的模特
+	 * @param nexus
+	 * @return
+	 */
+	public Page<List<Nexus>> findNexusByPage(Nexus nexus, int index, int size);
+	
+	/**
+	 * 查询全部屏蔽的模特
+	 * @param nexus
+	 * @return
+	 */
+	public List<Nexus> findNexusAll(Nexus nexus);
+	
+	
+}

+ 15 - 0
src/main/java/com/thmodel/dao/ModelCardDao.java

@@ -0,0 +1,15 @@
+package com.thmodel.dao;
+
+import java.util.List;
+
+import com.thmodel.entity.ModelCard;
+
+public interface ModelCardDao {
+	
+	/**
+	 * 获取全部模卡
+	 * @return
+	 */
+	public List<ModelCard> findModelCardAll();
+	
+}

+ 579 - 0
src/main/java/com/thmodel/dao/ModelInfoDao.java

@@ -0,0 +1,579 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.ChatRecord;
+import com.thmodel.entity.HonorInfo;
+import com.thmodel.entity.ModelAct;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.ModelPhoto;
+import com.thmodel.entity.ModelPrice;
+import com.thmodel.entity.ModelPrivate;
+import com.thmodel.entity.ModelPrivateDiscuss;
+import com.thmodel.entity.ModelPrivateItem;
+
+import com.thmodel.page.Page;
+
+//人才信息表
+public interface ModelInfoDao {
+	
+	/**
+	 * * 获取推荐的人才信息
+	 * (10个)
+	 * (用于主页)
+	 * @param memberpk 当前会员pk
+	 * @return
+	 */
+	public Map<String, Object> getmodel(int memberpk, int index, int size);
+	
+	/**
+	 * 根据账号pk
+	 * 获取关注的人才信息(10个)
+	 * @param pk
+	 * @return
+	 */
+	public Map<String, Object> getmodelfan(int pk, int index, int size);
+	
+	/**
+	 * 获取星级的人才信息(10个)
+	 * @param pk
+	 * @return
+	 */
+	public Map<String, Object> modelstar(int memberpk, int pk, int index, int size);
+	
+	/**
+	 * 查询人才表信息及图片全部信息列表
+	 * @param memberPk 当前人的会员pk
+	 * @param where 查询条件
+	 * @param ispaging 是否分页
+	 * @param index 
+	 * @param size
+	 * @return
+	 */
+	public List<ModelInfo> modelInfoAndPhotoInfoList(int memberPk, String where, boolean ispaging, Integer index, Integer size);
+	
+	/**
+	 * 发现
+	 * @return
+	 */
+	public Page<List> findModelInfoAndPhotoInfoList(int memberPk, int index, int size);
+	
+	/**
+	 * 根据人才pk 获取人才视频列表
+	 * @param ModelPK
+	 */
+	public List<ModelAct> getModelActListByModelPK(int ModelPK);
+	
+	/**
+	 * 根据人才pk  查询粉丝列表
+	 * @param ModelPK
+	 * @return
+	 */
+	public List<Map<String, Object>> getfan(int ModelPK);
+	
+	/**
+	 * 根据人才pk 获取人才定价表
+	 * @param ModelPK
+	 * @return
+	 */
+	public List<ModelPrice> getprice(int ModelPK);
+	
+	/**
+	 * 获取聊天记录
+	 * @param ModelPk
+	 * @param MemberPK
+	 * @return
+	 */
+	public List<ChatRecord> findChatRecordByModelPkAndMemberPK(int ModelPk, Integer MemberPK);
+	
+	/**
+	 * 插入聊天记录
+	 * @param CDate
+	 * @param ModelPK
+	 * @param MemberPK
+	 * @param chat
+	 * @param CType
+	 * @return 插入 生成的pk
+	 */
+	public int insertChatRecord(String CDate, String ModelPK, String MemberPK, String chat, String CType);
+	
+	/**
+	 * 根据 人才表pk设置模卡pk(及模卡更新时间)
+	 * @param ModelPk
+	 * @param ModelCardPK
+	 * @return
+	 */
+	public int updateModelInfoSetCardPK(int ModelPk, int CardPK);
+	
+	/**
+	 * 根据人才表pk 清除模卡pk(设为0,及更新[模卡更新时间])
+	 * @param ModelPk
+	 * @return
+	 */
+	public int updateModelInfoClearMCard(int ModelPk);
+	
+	/**
+	 * 根据人才pk获取荣誉
+	 * @param ModelPk
+	 * @return
+	 */
+	public List<HonorInfo> findHonorInfoByModelPk(int ModelPk);
+	
+	/**
+	 * 插入荣誉信息
+	 * @param ModelPK
+	 * @param HDate
+	 * @param Honor
+	 * @return
+	 */
+	public int insertHonorInfo(int ModelPK, List<String> Honors);
+	
+	/**
+	 * 根据经济人pk 查询经纪人信息
+	 * @param pk
+	 * @return
+	 */
+	public Map<String, Object> findBrokeInforByPk(int pk);
+	
+	/**
+	 * 根据经纪人pk 查询人才(模特)数量
+	 * @param BrokePK
+	 * @return
+	 */
+	public int getModelCount(int BrokePK);
+	
+	/**
+	 * 根据经纪人名称查询经纪人列表
+	 * @return
+	 */
+	public Map<String, Object> findBrokeInforLikeName(String LikeName, int index, int size);
+	
+	/**
+	 * 根据人才pk 设置经纪人PK 和经纪人会员pk
+	 * @param pk
+	 * @param BrokePK
+	 * @param BMemberPK
+	 * @return
+	 */
+	public int updateModelInfoSetBrokeByPk(int PK, int BrokePK, int BMemberPK);
+	
+	/**
+	 * 根据经纪人pk查询所有人才
+	 * @param memberpk
+	 * @param brokePk
+	 * @return
+	 */
+	public Map<String, Object> findModelByBrokePk(int memberpk, int brokePk, int index, int size);
+	
+	/**
+	 * 根据名称模糊检索人才信息
+	 * @param memberpk
+	 * @param likeName
+	 * @return
+	 */
+	public Map<String, Object> findModelInfoByName(int memberpk, String likeName, int index, int size);
+	
+	/**
+	 * 根据人才Pk查询人才图片列表
+	 * @param modelPk
+	 * @return
+	 */
+	public List<ModelPhoto> findModelPhotoByModelPk(int modelPk);
+	
+	/**
+	 * 私密空间
+	 * 根据人才pk 查询人才私密空间表
+	 * @param modelPk 人才PK
+	 * @return
+	 */
+	public Page<List<ModelPrivate>> findModelPrivateByModelPk(int modelPk, int memberpk, int index, int size);
+	
+	/**
+	 * 私密空间
+	 * 根据空间PK 查询 空间明细表
+	 * @param privatePk 空间pk
+	 * @return
+	 */
+	public List<ModelPrivateItem> findModelPrivateItemByPrivatePk(int privatePk);
+	
+	/**
+	 * 私密空间
+	 * 根据空间pk 查询 空间评价表
+	 * @param privatePk
+	 * @return
+	 */
+	public List<ModelPrivateDiscuss> findModelPrivateDiscussByPrivatePk(int privatePk);
+	
+	/**
+	 * 添加私密空间
+	 * @param modelPk
+	 * @param intro
+	 * @return
+	 */
+	public int insertModelPrivate(int modelPk, String intro);
+	
+	/**
+	 * 添加私密空间明细
+	 * @param privatePk 空间pk
+	 * @param url
+	 * @param fType 文件类型(链接、图片)
+	 * @return
+	 */
+	public int insertModelPrivateItem(int privatePk, String url, String fType);
+	
+	/**
+	 * 添加私密空间  点赞
+	 * 点赞模特的私密空间
+	 * @param privatePk 空间pk
+	 * @param memberPk 会员pk
+	 */
+	public int praisePrivate(int privatePk, int memberPk);
+	
+	/**
+	 * 取消对私密空间的点赞
+	 * @param privatePk
+	 * @param memberPk
+	 * @return
+	 */
+	public int notPraisePrivate(int privatePk, int memberPk);
+	
+	
+	/**
+	 * 添加私密空间  评论
+	 * 评论模特的私密空间
+	 * @param privatePk 空间pk
+	 * @param memberPk 会员pk
+	 * @param parentPk 父类pk
+	 * @param intro 评论内容
+	 * @return
+	 */
+	public int insertModelPrivateDiscuss(int privatePk, int memberPk, int parentPk, String intro);
+	
+	/**
+	 * 获取用户印象,按从多到少排序
+	 * @param modelPk 人才pk
+	 * @return
+	 */
+	public List<Map<String, Object>> findCustomImage(Integer modelPk);
+	/**
+	 * 获取自评
+	 * @param modelPk 人才pk
+	 * @return
+	 */
+	public List<Map<String, Object>> findSelfFigure(int modelPk);
+	/**
+	 * 用户评价(不是自评就是用户评价)
+	 * @return
+	 */
+	public List<Map<String, Object>> findCustomFigure(int modelPk);
+	
+	/**
+	 * 根据参数表pk 查询  参数pk 和 name
+	 * @param pks 1,2,3
+	 * @return
+	 */
+	public List<Map<String, Object>> findDataTypeInfoByPk(String pks);
+	
+	/**
+	 * 
+	 * @param pks
+	 * @param typeName
+	 * @return
+	 */
+	public Map<String, Object> findDataTypeInfoByPkOrTypeName(int memberpk, String pks, String typeName, int index, int sizes);
+	
+
+	
+	/**
+	 * 根据形象pk(多个) 查询人才信息
+	 * @param figurePks 形象pk FigurePk,FigurePk,FigurePk...
+	 * @return
+	 */
+	public Map<String, Object> findModelByFigurePks(int memberpk, String figurePks, int index, int size);
+	
+	/**
+	 * 根据 会员pk 和 人才pk 查询关联的 标签pk 和 name
+	 * @param memberPk
+	 * @param modelPk
+	 * @return
+	 */
+	public List<Map<String, Object>> findModelFigureByModelPkAndMemberPk(int memberPk, int modelPk);
+	
+	/**
+	 * 插入人才标签
+	 * @param memberPk 会员pk
+	 * @param modelPk 人才pk
+	 * @param figurePks 形象标签pk 1,2,3...
+	 * @param isSelf 是否自评 0 和 1
+	 * @return
+	 */
+	public int insertModelFigure(int memberPk, int modelPk, String figurePks, int isSelf);
+	
+	/**
+	 * 根据人才pk  查询人才信息
+	 * @param modelPk
+	 * @return
+	 */
+	public Map<String, Object> findModelInfoByPk(int memberpk, int modelPk);
+	
+	/**
+	 * 根据 空间pk 获取空间点赞
+	 * @param memberPk
+	 * @return
+	 */
+	public List<ModelPrivateDiscuss> getPraiseByPrivatePk(int privatePk);
+	
+	/**
+	 * 分页获取人才评论数
+	 * @param ModelPk 人才pk
+	 * @param index 第几页
+	 * @param size 每页显示多少条
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> findModelPrivateLimit(int privatePk, int index, int size);
+	
+	/**
+	 * 判断有没有关注
+	 * @param memberPk
+	 * @param modelPk
+	 * @return true:已关注    false:未关注
+	 */
+	public boolean findAttention(int memberPk, int modelPk);
+	
+	
+	/**
+	 * 判断有没有点赞
+	 * @param memberPk
+	 * @param modelPk
+	 * @return true: 已点赞	false: 未点赞
+	 */
+	public boolean findLikes(int memberPk, int privatePk);
+	
+	/**
+	 * 添加关注  粉丝
+	 * @param memberPk
+	 * @param modelPk
+	 * @return
+	 */
+	public int insertModelFan(int memberPk, int modelPk);
+	
+	/**
+	 * 删除关注
+	 * @param memberPk
+	 * @param modelPk
+	 * @return
+	 */
+	public int deleteModelFan(int memberPk, int modelPk);
+	
+	/**
+	 * 更新人才粉丝数量
+	 * @param modelPk
+	 * @return
+	 */
+	public int updateModelFanSetFCount(int modelPk);
+
+	/**
+	 * 获取人才的技能列表
+	 * @param modelPk
+	 * @return
+	 */
+	public List<Map<String, Object>> getSkillData(int modelPk);
+	
+	/**
+	 * 添加技能
+	 * @param skillpk
+	 * @param modelpk
+	 * @param skillphoto
+	 * @param price
+	 * @param unit
+	 * @param orderid
+	 * @return
+	 */
+	public int insertModelPrice(int skillpk, int modelpk, String skillphoto, double price, String unit, int orderid);
+	
+	/**
+	 * 修改技能
+	 * @param pk
+	 * @param modelpk
+	 * @param skillpk
+	 * @param skillphoto
+	 * @param price
+	 * @param unit
+	 * @param orderid
+	 * @return
+	 */
+	public int updateModelPrice(int pk, int modelpk, String skillpk, String skillphoto, String price, String unit, String orderid);
+	
+	/**
+	 * 修改人才信息
+	 * @param modelpk
+	 * @param hei
+	 * @param wei
+	 * @param wai
+	 * @param bust
+	 * @param hip
+	 * @param lname
+	 * @param name
+	 * @return
+	 */
+	public int updateModelInfoByModelPk(int modelpk, String hei, String wei, String wai, String bust, String hip, String lname, String name, String vprice);
+	
+	/**
+	 * 模特端登陆
+	 * @param username
+	 * @param pwd
+	 * @return
+	 */
+	public Map<String, Object> login(String username, String pwd);
+	
+	/**
+	 * 删除人才的所有风格标签(自评)
+	 * @param modelpk
+	 * @return
+	 */
+	public int deleteModelStyleAll(int modelpk);
+	
+	/**
+	 * 添加人才的风格标签(自评)
+	 * @param modelpk
+	 * @param stylepk
+	 * @return
+	 */
+	public int insertModelStyle(int modelpk, int... stylepks);
+	
+	/**
+	 * 删除人才技能
+	 * @param modelpk 人才pk
+	 * @param skillpk 技能pk
+	 * @return
+	 */
+	public int deleteModelPrice(int modelpk, int skillpk);
+	
+	/**
+	 * 添加人才信息(绑定会员账号)
+	 * @param memberpk
+	 * @param name
+	 * @return
+	 */
+	public int insertModelInfo(int memberpk, String name, int BrokePK, int BMemberPK);
+	
+	/**
+	 * 添加人才照片
+	 * @param modelpk
+	 * @param photo
+	 * @param ordid
+	 * @return
+	 */
+	public int insertModelPhoto(int modelpk, String[] photos, int ordid);
+	
+	/**
+	 * 删除人才照片
+	 * @param pk 人才照片pk
+	 * @param modelpk 人才pk
+	 * @return
+	 */
+	public int deleteModelPhoto(String pks, int modelpk);
+	
+	/**
+	 * 获取模特端   模卡资料
+	 * @param modelpk 人才pk
+	 * @return
+	 */
+	public List getModelData(int modelpk);
+	
+	/**
+	 * 根据人才pk 获取对应的会员pk
+	 * @param modelpk
+	 * @return
+	 */
+	public int getMemberpkByModelpk(int modelpk);
+	
+	/**
+	 * 根据人才pk 获取人才信息
+	 * @param modelpk
+	 * @return
+	 */
+	public ModelInfo findModelByPk(int modelpk);
+	
+	/**
+	 * 模特端验证手机号是否注册
+	 * @param phone
+	 * @return
+	 */
+	public int verifyModelPhone(String phone);
+	
+	/**
+	 * 获取空间评论总数量
+	 * @param privatePk
+	 * @return
+	 */
+	public int findModelPrivateCount(int privatePk);
+	
+	/**
+	 * 模特端刷新模特登录信息
+	 * @param modelpk
+	 * @return
+	 */
+	public Map<String, Object> getModelLoginInfo(int modelpk);
+	
+	/**
+	 * 分页显示点赞记录
+	 * @param privatePk
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public Page<List> findModelLikesLimit(int privatePk, int index, int size);
+	
+	/**
+	 * 修改模特 的  在线离线状态   is_a 属性
+	 * @param modelpk
+	 * @param online
+	 * @return
+	 */
+	public int updateModelOnlineByModelpk(int modelpk, int online);
+	
+	/**
+	 * 删除 人才下的所有荣誉
+	 * @param modelPK
+	 * @return
+	 */
+	public int deleteHonorInfo(int modelPK);
+	
+	/**
+	 * 删除 空间动态根据动态pk
+	 * @param privatepk
+	 * @return
+	 */
+	public int deleteModelPrivateByPk(int privatepk);
+	
+	/**
+	 * 根据空间动态pk 删除空间明细(图片)
+	 * @param privatepk
+	 * @return
+	 */
+	public int deleteModelPrivateItemByPrivatepk(int privatepk);
+	
+	/**
+	 * 根据空间动态pk 删除 评论或点赞
+	 * @param privatepk
+	 * @return
+	 */
+	public int deleteModelPrivateDiscussByPrivatepk(int privatepk);
+
+	/**
+	 * 根据模特的会员pk获取modelpk
+	 * @param memberpk
+	 * @return
+	 */
+	public int getModelpkByMemberpk(int memberpk);
+	
+	/**
+	 * 修改是否有订单
+	 * @param modelpk
+	 * @param hasred
+	 * @return
+	 */
+	public int updateModelSetHasRedByModel(int modelpk, int hasred);
+}

+ 77 - 0
src/main/java/com/thmodel/dao/OrderRecordDao.java

@@ -0,0 +1,77 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.OrderRecord;
+import com.thmodel.vo.OrderParam;
+
+import com.thmodel.page.Page;
+
+public interface OrderRecordDao {
+
+	/**
+	 * 插入一条订单记录
+	 * @param model
+	 * @return
+	 */
+	public int insertOrderRecord(OrderParam model);
+	
+	/**
+	 * 根据订单会员pk 查询订单
+	 * @param memberPk
+	 * @return
+	 */
+	public Page findOrderRecordByMemberPk(Integer memberPk, Integer modelpk, int index, int size, String... state);
+	
+	/**
+	 * 对订单评论
+	 * @param orderPk
+	 * @param ec
+	 * @param evaluate
+	 * @return
+	 */
+	public int updateOrderComment(int orderPk, String ec, String evaluate);
+	
+	/**
+	 * 修改订单状态  根据订单pk 和  人才pk
+	 * @param orderpk 订单pk
+	 * @param modelpk 人才pk
+	 * @param setState 修改为的状态
+	 * @param whereState 判断条件状态
+	 * @return
+	 */
+	public int updateOrderRecordSetStateModelpk(int orderpk, int modelpk, int accflag, String setState, String... whereState);
+	
+	/**
+	 * 修改订单状态  根据订单pk 和  会员pk
+	 * @param orderpk 订单pk
+	 * @param memberpk 会员pk
+	 * @param setState 修改为的状态
+	 * @param whereState 判断条件状态
+	 * @return
+	 */
+	public int updateOrderRecordSetStateMemberpk(int orderpk, int memberpk, String setState, String... whereState);
+	
+	/**
+	 * 根据 订单pk  查询订单信息
+	 * @param orderpk
+	 * @return
+	 */
+	public OrderRecord findOrderRecordByPk(int orderpk);
+	
+	/**
+	 * 获取订单详情
+	 * @param orderpk
+	 * @return
+	 */
+	public Map<String, Object> getOrderInfo(int orderpk);
+	
+	/**
+	 * 判断是否到订单结束时间
+	 * @param pk
+	 * @return
+	 */
+	public boolean isOrderEndTime(int pk);
+	
+}

+ 89 - 0
src/main/java/com/thmodel/dao/ParttyInfoDao.java

@@ -0,0 +1,89 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.ParttyInfo;
+
+public interface ParttyInfoDao {
+	
+	/**
+	 * 获取最近的活动
+	 * @return
+	 */
+	public Map<String, Object> findPartty(int memberPk, int index, int size);
+	
+	/**
+	 * 根据会与pk查询  会员参加过的活动
+	 * @return
+	 */
+	public Map<String, Object> findParttyByMemberPk(int memberPk, int index, int size);
+	
+	/**
+	 * 根据会与pk查询  会员没有参加过的活动
+	 * @return
+	 */
+	public Map<String, Object> findParttyNotMemberPk(int memberPk, int index, int size);
+	
+	/**
+	 * 插入参加活动记录
+	 * @param pk  会员PK
+	 * @param parttyPk  活动PK
+	 * @param people  参与人员
+	 * @param tel  联系方式
+	 * @param pCount  人数
+	 * @param fee  费用
+	 * @return
+	 */
+	public int insertParttyInfo(int pk, int parttyPk, String people, String tel, int pCount, String fee);
+	
+	/**
+	 * 根据会员pk和活动pk  设置签到时间
+	 * @param pk
+	 * @param parttyPk
+	 * @return
+	 */
+	public int updateParttySignSetSign(int pk, int parttyPk);
+	
+	/**
+	 * 判断是否已经参加活动
+	 * @param pk 会员pk
+	 * @param parttyPk 活动pk
+	 * @return
+	 */
+	public int isJoinParttyInfo(int pk, int parttyPk);
+	
+	/**
+	 * 获取横幅活动
+	 * @return
+	 */
+	public List<Map<String, Object>> findParttyInfoByBanner();
+	
+	/**
+	 * 当前 时间 是否 在活动报名 开始时间 之后
+	 * @param parttypk
+	 * @return
+	 */
+	public boolean isParttySBeg(int parttypk);
+	
+	/**
+	 * 判断 当前时间 是否 在 活动报名结束时间 之前
+	 * @param parttypk
+	 * @return
+	 */
+	public boolean isParttySEndt(int parttypk);
+	
+	/**
+	 * 判断是否在报名时间 内
+	 * @param parttyPk
+	 * @return
+	 */
+	public boolean isParttySign(int parttyPk);
+
+	/**
+	 * 根据活动pk 查询活动
+	 * @param parttyPk
+	 */
+	public ParttyInfo findParttyByPk(int parttyPk);
+	
+}

+ 54 - 0
src/main/java/com/thmodel/dao/RedPacketDao.java

@@ -0,0 +1,54 @@
+package com.thmodel.dao;
+
+import java.util.List;
+
+import com.thmodel.entity.RedPacket;
+
+/**
+ * 红包
+ * @author 刘迎奥
+ * @date 2018年7月6日
+ * @version v1.0
+ */
+public interface RedPacketDao {
+	
+	/**
+	 * 添加红包记录
+	 * @param modelPk
+	 * @param memberPk
+	 * @param coin
+	 * @param rState
+	 * @return
+	 */
+	public int insertRedPacket(int modelPk, int memberPk, double coin, int rState);
+	
+	/**
+	 * 修改红包状态 为 收红包
+	 * @param pk
+	 * @param modelPk
+	 * @return
+	 */
+	public int updateRedPacket(int pk, int modelPk);
+	
+	/**
+	 * 根据发红包的会员pk 查询 发红包记录
+	 * @param memberPk
+	 * @return
+	 */
+	public List<RedPacket> findRedPacketByMemberPk(int memberPk);
+	
+	/***
+	 * 根据收红包的人才pk 查询 收到的红包记录
+	 * @param modelPk
+	 * @return
+	 */
+	public List<RedPacket> findRedPacketByModelPk(int modelPk);
+	
+	/**
+	 * 根据主键pk 查询  红包信息
+	 * @param pk 
+	 * @return
+	 */
+	public RedPacket findRedPacketByPk(int pk);
+	
+}

+ 56 - 0
src/main/java/com/thmodel/dao/VideoRecordDao.java

@@ -0,0 +1,56 @@
+package com.thmodel.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.VideoRecord;
+
+import com.thmodel.page.Page;
+
+/**
+ * 视频
+ */
+public interface VideoRecordDao {
+	
+	/**
+	 * 插入视频聊天记录
+	 * @param memberPk  会员pk
+	 * @param modelPk  人才pk
+	 * @param begDate  开始时间
+	 * @param hasAnswer  是否接听
+	 * @return
+	 */
+	public int insertVideoRecord(int memberPk, int modelPk, String begDate, int hasAnswer);
+	
+	/**
+	 * 根据人才pk 查询视频订单
+	 * @param modelPk
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> getVideoRecordByModelPk(int modelPk, int index, int size);
+	
+	/**
+	 * 根据人才pk 查询视频订单
+	 * @param memberpk
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> getVideoRecordByMemberpk(int memberpk, int index, int size);
+	
+	/**
+	 * 修改视频订单
+	 * @param pk
+	 * @param duration
+	 * @param coin
+	 * @param HasAnswer
+	 * @return
+	 */
+	public int updateVideoRecordByPk(int pk, String duration, String coin, String hasanswer, Integer AccFlag);
+	
+	/**
+	 * 根据pk查询视频订单信息
+	 * @param pk
+	 * @return
+	 */
+	public VideoRecord findVideoRecordByPk(int pk);
+	
+}

+ 29 - 0
src/main/java/com/thmodel/dao/impl/AccRecordDaoImpl.java

@@ -0,0 +1,29 @@
+package com.thmodel.dao.impl;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.AccRecordDao;
+import com.thmodel.dbconnection.DbConnection;
+
+public class AccRecordDaoImpl implements AccRecordDao{
+
+	@Override
+	public int getAccSumByMemberPK(int MemberPK) {
+		try {
+			int sum = 0;
+			String sql = "select sum(acc) from AccRecord where MemberPK = "+MemberPK;
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs!=null && rs.next()){
+				sum = rs.getInt(1);
+				db.close(rs);
+			}
+			return sum;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return 0;
+		}
+	}
+
+
+}

+ 186 - 0
src/main/java/com/thmodel/dao/impl/AccountRecordDaoImpl.java

@@ -0,0 +1,186 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.dao.AccountRecordDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.MyDateUtil;
+
+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;
+	}
+}

+ 247 - 0
src/main/java/com/thmodel/dao/impl/CashRecordDaoImpl.java

@@ -0,0 +1,247 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.constants.PayConstants;
+import com.thmodel.dao.CashRecordDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.CashRecord;
+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;
+	}
+	
+
+}

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

@@ -0,0 +1,40 @@
+package com.thmodel.dao.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+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;
+	}
+
+}

+ 81 - 0
src/main/java/com/thmodel/dao/impl/MemberSignDaoImpl.java

@@ -0,0 +1,81 @@
+package com.thmodel.dao.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.MemberSignDao;
+import com.thmodel.dbconnection.DbConnection;
+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 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 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;
+	}
+	
+	
+	
+}

+ 619 - 0
src/main/java/com/thmodel/dao/impl/MemberinfoDaoImpl.java

@@ -0,0 +1,619 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import org.apache.log4j.Logger;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.Nexus;
+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;
+	}
+
+	
+}

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

@@ -0,0 +1,42 @@
+package com.thmodel.dao.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.ModelCardDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.ModelCard;
+
+public class ModelCardDaoImpl implements ModelCardDao {
+
+    @Override
+    public List<ModelCard> findModelCardAll() {
+        List<ModelCard> list = new ArrayList<ModelCard>();
+        String sql = "select * from ModelCard order by pk";
+        try {
+            DbConnection db = new DbConnection();
+            CachedRowSet rs = db.executeQuery(sql);
+            if (rs != null) {
+                while (rs.next()) {
+                    ModelCard mc = new ModelCard();
+                    mc.setPk(rs.getInt("pk"));
+                    mc.setSample(rs.getString("Sample"));
+                    mc.setCardname(rs.getString("Cardname"));
+                    mc.setUrl(rs.getString("Url"));
+                    mc.setFee(rs.getDouble("Fee"));
+                    mc.setPrice(rs.getDouble("Price"));
+                    list.add(mc);
+                }
+                db.close(rs);
+            }
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+}

+ 1800 - 0
src/main/java/com/thmodel/dao/impl/ModelInfoDaoImpl.java

@@ -0,0 +1,1800 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.BrokerInfor;
+import com.thmodel.entity.ChatRecord;
+import com.thmodel.entity.HonorInfo;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.ModelAct;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.ModelPhoto;
+import com.thmodel.entity.ModelPrice;
+import com.thmodel.entity.ModelPrivate;
+import com.thmodel.entity.ModelPrivateDiscuss;
+import com.thmodel.entity.ModelPrivateItem;
+import com.thmodel.entity.Nexus;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.MyDateUtil;
+import com.thmodel.util.PropertyUtil;
+import com.thmodel.page.Page;
+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 {
+			
+			
+			/*
+			String sql = "select m.*, b.tel, b.hphoto, b.pet, "
+						+ " (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 ";
+			if(where !=null && !where.equals("")){
+				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;
+	}
+
+}

+ 296 - 0
src/main/java/com/thmodel/dao/impl/OrderRecordDaoImpl.java

@@ -0,0 +1,296 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.constants.OrderConstants;
+import com.thmodel.dao.OrderRecordDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.OrderRecord;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.MyDateUtil;
+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;
+		
+	}
+
+}

+ 301 - 0
src/main/java/com/thmodel/dao/impl/ParttyInfoDaoImpl.java

@@ -0,0 +1,301 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.ParttyInfoDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.ParttyInfo;
+import com.thmodel.util.CommentUtils;
+
+public class ParttyInfoDaoImpl implements ParttyInfoDao {
+
+	@Override
+	public Map<String, Object> findPartty(int memberpk, int index, int size) {
+		
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		
+		List<ParttyInfo> list = new ArrayList<ParttyInfo>();
+		StringBuffer sb = new StringBuffer();
+		sb.append(" select a.*, ");
+		sb.append(" (select count(1) from ParttySign where parttypk = a.pk and memberpk ='"+memberpk+"' )as issign , ");
+		sb.append(" (select sum(pCount) from ParttySign where ParttyPK = a.pk) signcount, ");
+		sb.append(" (select count(1) from parttyinfo where pk = a.PK and SBeg <= now() and SEndt >= now()) as issigndate");
+		sb.append(" from parttyinfo a ");
+		sb.append(" where ifnull(a.isbanner, 0) != 1 ");
+		sb.append(" order by a.Beg desc");
+		String sql = sb.toString();
+		
+		//获取分页总数量
+		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+		int count = new DbConnection().queryOneCount(sqlCount);
+		
+		sql = CommentUtils.pagingToMysql(sql, index, size);
+		
+		try {
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs!=null){
+				while(rs.next()){
+					ParttyInfo pi = new ParttyInfo();
+					pi.setBeg(rs.getDate("Beg"));
+					pi.setBrprice(rs.getDouble("Brprice"));
+					pi.setCaption(rs.getString("Caption"));
+					pi.setEndt(rs.getDate("Endt"));
+					pi.setIntro(rs.getString("Intro"));
+					pi.setMeprice(rs.getDouble("Meprice"));
+					pi.setMoprice(rs.getDouble("Moprice"));
+					pi.setPic(rs.getString("Pic"));
+					pi.setPk(rs.getInt("Pk"));
+					pi.setSbeg(rs.getDate("Sbeg"));
+					pi.setSendt(rs.getDate("Sendt"));
+					pi.setTerm(rs.getString("Term"));
+					pi.setIssign(rs.getInt("issign"));
+					
+					pi.setSigncount(rs.getInt("signcount"));
+					pi.setIssigndate(rs.getInt("issigndate"));
+					
+					list.add(pi);
+				}
+				db.close(rs);
+			}
+			
+			resultMap.put("data", list);
+			resultMap.put("count", count);
+			return resultMap;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	@Override
+	public Map<String, Object> findParttyByMemberPk(int memberPk, int index, int size) {
+		
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		
+		List<ParttyInfo> list = new ArrayList<ParttyInfo>();
+		String sql = "select p.*,(select count(1) from ParttySign where parttypk = p.pk and memberpk ='"+memberPk+"' )as issign "
+				+ " from parttyinfo p inner join ParttySign s on p.pk = s.ParttyPK where s.MemberPK = '"+memberPk+"' order by p.Beg desc ";
+		
+		//获取分页总数量
+		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+		int count = new DbConnection().queryOneCount(sqlCount);
+		
+		sql = CommentUtils.pagingToMysql(sql, index, size);
+		
+		try {
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs!=null){
+				while(rs.next()){
+					ParttyInfo pi = new ParttyInfo();
+					pi.setBeg(rs.getDate("Beg"));
+					pi.setBrprice(rs.getDouble("Brprice"));
+					pi.setCaption(rs.getString("Caption"));
+					pi.setEndt(rs.getDate("Endt"));
+					pi.setIntro(rs.getString("Intro"));
+					pi.setMeprice(rs.getDouble("Meprice"));
+					pi.setMoprice(rs.getDouble("Moprice"));
+					pi.setPic(rs.getString("Pic"));
+					pi.setPk(rs.getInt("Pk"));
+					pi.setSbeg(rs.getDate("Sbeg"));
+					pi.setSendt(rs.getDate("Sendt"));
+					pi.setTerm(rs.getString("Term"));
+					pi.setIssign(rs.getInt("issign"));
+					list.add(pi);
+				}
+				db.close(rs);
+			}
+			
+			resultMap.put("data", list);
+			resultMap.put("count", count);
+			
+			return resultMap;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	public Map<String, Object> findParttyNotMemberPk(int memberPk, int index, int size) {
+		
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		
+		List<ParttyInfo> list = new ArrayList<ParttyInfo>();
+		String sql = "select a.*,(select count(1) from ParttySign where parttypk = a.pk and memberpk ='"+memberPk+"' )as issign, "
+				+ " (select sum(pCount) from ParttySign where ParttyPK = a.pk) signcount, "
+				+ "	(select count(1) from parttyinfo where pk = a.PK and SBeg <= now() and SEndt >= now()) as issigndate"
+				+ " from parttyinfo a where "
+				+ " 1=1 "
+				+ " and a.pk not in "
+				+ "("
+				+ " select p.pk from parttyinfo p "
+				+ " inner join ParttySign s on p.pk = s.ParttyPK "
+				+ " where s.MemberPK = '"+ memberPk +"' order by p.Beg desc "
+				+ ")";
+		
+		//获取分页总数量
+		String sqlCount = CommentUtils.pagingToMysqlCount(sql);
+		int count = new DbConnection().queryOneCount(sqlCount);
+		
+		sql = CommentUtils.pagingToMysql(sql, index, size);
+		
+		
+		try {
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs!=null){
+				while(rs.next()){
+					ParttyInfo pi = new ParttyInfo();
+					pi.setBeg(rs.getDate("Beg"));
+					pi.setBrprice(rs.getDouble("Brprice"));
+					pi.setCaption(rs.getString("Caption"));
+					pi.setEndt(rs.getDate("Endt"));
+					pi.setIntro(rs.getString("Intro"));
+					pi.setMeprice(rs.getDouble("Meprice"));
+					pi.setMoprice(rs.getDouble("Moprice"));
+					pi.setPic(rs.getString("Pic"));
+					pi.setPk(rs.getInt("Pk"));
+					pi.setSbeg(rs.getDate("Sbeg"));
+					pi.setSendt(rs.getDate("Sendt"));
+					pi.setTerm(rs.getString("Term"));
+					pi.setIssign(rs.getInt("issign"));
+					
+					pi.setSigncount(rs.getInt("signcount"));
+					pi.setIssigndate(rs.getInt("issigndate"));
+					list.add(pi);
+				}
+				db.close(rs);
+			}
+			
+			resultMap.put("data", list);
+			resultMap.put("count", count);
+			
+			return resultMap;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	@Override
+	public int insertParttyInfo(int pk, int parttyPk, String people,
+			String tel, int pCount, String fee) {
+		String sql = "insert into ParttySign(ParttyPK, MemberPK, enrollDate, people, Tel, pCount, Fee, IsSign, AccFlag)" +
+					" values('"+parttyPk+"', '"+pk+"', now(), '"+people+"','"+tel+"', '"+pCount+"', '"+fee+"', 0, 1);";
+		DbConnection db = new DbConnection();
+		int result_pk = db.executeUpdate(sql);
+		return result_pk;
+	}
+
+	@Override
+	public int updateParttySignSetSign(int pk, int parttyPk) {
+		String sql = "update ParttySign set IsSign=1, SignDate=now() where MemberPK = '"+pk+"' and ParttyPK='"+parttyPk+"'";
+		DbConnection db = new DbConnection();
+		int rows = db.executeUpdate(sql);
+		return rows;
+	}
+
+	@Override
+	public int isJoinParttyInfo(int pk, int parttyPk) {
+		int count = 0;
+		try {
+			String sql = "select count(1) from ParttySign where parttypk = "+parttyPk+" and memberpk = " + pk;
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs != null && rs.next()) {
+				count = rs.getInt(1);
+				db.close(rs);
+			}
+			return count;
+		} catch (SQLException e) {
+			e.printStackTrace();
+			return -1;
+		}
+	}
+
+	@Override
+	public List<Map<String, Object>> findParttyInfoByBanner() {
+		try {
+			List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
+			String sql = "select * from parttyinfo where isbanner = '1'";
+			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("pic", rs.getString("pic"));
+					map.put("banner", rs.getString("banner"));
+					map.put("caption", rs.getString("caption"));
+					
+					resultList.add(map);
+				}
+				db.close(rs);
+			}
+			return resultList;
+		} catch (SQLException e) {
+			e.printStackTrace();
+			return null;
+		}
+		
+	}
+
+	@Override
+	public boolean isParttySBeg(int parttypk) {
+		String sql = "select count(1) from ParttyInfo where pk = "+parttypk+" and SBeg <= now()";
+		int count = new DbConnection().queryOneCount(sql);
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public boolean isParttySEndt(int parttypk) {
+		String sql = "select count(1) from ParttyInfo where pk = "+parttypk+" and SEndt >= now()";
+		int count = new DbConnection().queryOneCount(sql);
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public boolean isParttySign(int parttyPk) {
+		String sql = "select count(1) from ParttyInfo where pk = "+parttyPk+" and SBeg <= now() and SEndt >= now()";
+		int count = new DbConnection().queryOneCount(sql);
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public ParttyInfo findParttyByPk(int parttyPk) {
+		ParttyInfo pi = new ParttyInfo();
+		try {
+			String sql = "select * from parttyinfo where pk = " + parttyPk;
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs!=null && rs.next()){
+				pi.setBeg(rs.getDate("Beg"));
+				pi.setBrprice(rs.getDouble("Brprice"));
+				pi.setCaption(rs.getString("Caption"));
+				pi.setEndt(rs.getDate("Endt"));
+				pi.setIntro(rs.getString("Intro"));
+				pi.setMeprice(rs.getDouble("Meprice"));
+				pi.setMoprice(rs.getDouble("Moprice"));
+				pi.setPic(rs.getString("Pic"));
+				pi.setPk(rs.getInt("Pk"));
+				pi.setSbeg(rs.getDate("Sbeg"));
+				pi.setSendt(rs.getDate("Sendt"));
+				pi.setTerm(rs.getString("Term"));
+				pi.setIsbanner(rs.getInt("Isbanner"));
+				pi.setBanner(rs.getString("Banner"));
+				db.close(rs);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return pi;
+	}
+
+}

+ 110 - 0
src/main/java/com/thmodel/dao/impl/RedPacketDaoImpl.java

@@ -0,0 +1,110 @@
+package com.thmodel.dao.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.RedPacketDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.RedPacket;
+
+public class RedPacketDaoImpl implements RedPacketDao {
+
+	@Override
+	public int insertRedPacket(int modelPk, int memberPk, double coin, int rState) {
+		//添加红包记录
+		
+		String sql = String.format("insert into RedPacket(ModelPK, MemberPK, RDate, coin, RState, AccFlag)values('%s', '%s', now(), '%s', '%s', 0)",
+									modelPk, memberPk, coin, rState);
+		DbConnection db = new DbConnection();
+		int pk = db.executeUpdate(sql);
+		return pk;
+	}
+
+	@Override
+	public int updateRedPacket(int pk, int modelPk) {
+		String sql = String.format("update RedPacket set RState = '2', AccFlag = '1' where pk='%s' and modelPk='%s'", pk, modelPk);
+		DbConnection db = new DbConnection();
+		int rows = db.executeUpdate(sql);
+		return rows;
+	}
+
+	@Override
+	public List<RedPacket> findRedPacketByMemberPk(int memberPk) {
+		List<RedPacket> list = new ArrayList<>();
+		try {
+			String sql = String.format("select * from RedPacket where memberpk='%s' order by rstate, rdate desc", memberPk);
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs != null) {
+				while(rs.next()) {
+					RedPacket red = new RedPacket();
+					red.setPk(rs.getInt("pk"));
+					red.setModelpk(rs.getInt("modelpk"));
+					red.setMemberpk(rs.getInt("memberpk"));
+					red.setRdate(rs.getDate("rdate"));
+					red.setCoin(rs.getDouble("coin"));
+					red.setRstate(rs.getString("Rstate"));
+					list.add(red);
+				}
+				db.close(rs);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return list;
+	}
+
+	@Override
+	public List<RedPacket> findRedPacketByModelPk(int modelPk) {
+		List<RedPacket> list = new ArrayList<>();
+		try {
+			String sql = String.format("select * from RedPacket where modelpk = '%s' order by rdate desc", modelPk);
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs != null) {
+				while(rs.next()) {
+					RedPacket red = new RedPacket();
+					red.setPk(rs.getInt("pk"));
+					red.setModelpk(rs.getInt("modelpk"));
+					red.setMemberpk(rs.getInt("memberpk"));
+					red.setRdate(rs.getDate("rdate"));
+					red.setCoin(rs.getDouble("coin"));
+					red.setRstate(rs.getString("Rstate"));
+					list.add(red);
+				}
+				db.close(rs);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return list;
+	}
+
+	@Override
+	public RedPacket findRedPacketByPk(int pk) {
+		String sql = String.format("select * from RedPacket where pk = %s", pk);
+		try {
+			RedPacket red = new RedPacket();
+			
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs != null && rs.next()) {
+				red.setPk(rs.getInt("pk"));
+				red.setModelpk(rs.getInt("modelpk"));
+				red.setMemberpk(rs.getInt("memberpk"));
+				red.setRdate(rs.getDate("rdate"));
+				red.setCoin(rs.getDouble("coin"));
+				red.setRstate(rs.getString("Rstate"));
+				db.close(rs);
+			}
+			return red;
+		} catch (SQLException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+}

+ 162 - 0
src/main/java/com/thmodel/dao/impl/VideoRecordDaoImpl.java

@@ -0,0 +1,162 @@
+package com.thmodel.dao.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.dao.VideoRecordDao;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.VideoRecord;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.MyDateUtil;
+
+import com.thmodel.page.Page;
+
+public class VideoRecordDaoImpl implements VideoRecordDao {
+
+	@Override
+	public int insertVideoRecord(int memberPk, int modelPk, String begDate,
+			int hasAnswer) {
+		String sql = "insert into VideoRecord(MemberPK, ModelPK, BegDate, duration, coin, HasAnswer)values('"+memberPk+"','"+modelPk+"','"+begDate+"', '0', '0', '"+hasAnswer+"')";
+		DbConnection db = new DbConnection();
+		int pk = db.executeUpdate(sql);
+		return pk;
+	}
+
+	@Override
+	public Page<List<Map<String, Object>>> getVideoRecordByModelPk(int modelPk, int index, int size) {
+		Page<List<Map<String, Object>>> page = new Page<List<Map<String, Object>>>();
+		try {
+			List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
+			String sql = "select vr.pk, vr.memberpk, vr.modelpk, vr.begdate, vr.duration, vr.coin, member.hphoto, member.pet from VideoRecord vr " 
+					+ " inner join memberinfo member on vr.memberpk = member.pk "
+					+ " where vr.modelpk = " + modelPk
+					+ " order by vr.begdate 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("pk", rs.getString("pk"));
+					map.put("memberpk", rs.getString("memberpk"));
+					map.put("modelpk", rs.getString("modelpk"));
+					map.put("begdate", MyDateUtil.format(rs.getDate("begdate"), MyDateUtil.DATE_FORMAT_1));
+					map.put("duration", (int)rs.getDouble("duration"));
+					map.put("coin", CommentUtils.DecimalFormatToString(rs.getDouble("coin")));
+					map.put("hphoto", rs.getString("hphoto"));
+					map.put("pet", rs.getString("pet"));
+					mapList.add(map);
+				}
+				db.close(rs);
+			}
+			page.setData(mapList);
+			return page;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	@Override
+	public Page<List<Map<String, Object>>> getVideoRecordByMemberpk(int memberpk, int index, int size) {
+		Page<List<Map<String, Object>>> page = new Page<List<Map<String, Object>>>();
+		try {
+			List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
+			String sql = "select vr.pk, vr.memberpk, vr.modelpk, vr.begdate, vr.duration, vr.coin, member.hphoto, member.pet"
+					+ " from VideoRecord vr "
+					+ " inner join modelinfo model on vr.modelpk = model.pk "
+					+ " inner join memberinfo member on model.memberpk = member.pk "
+					+ " where vr.memberpk = '" + memberpk + "' "
+					+ " order by vr.begdate 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("pk", rs.getString("pk"));
+					map.put("memberpk", rs.getString("memberpk"));
+					map.put("modelpk", rs.getString("modelpk"));
+					map.put("begdate", MyDateUtil.format(rs.getDate("begdate"), MyDateUtil.DATE_FORMAT_1));
+					map.put("duration", (int)rs.getDouble("duration"));
+					map.put("coin", CommentUtils.DecimalFormatToString(rs.getDouble("coin")));
+					map.put("hphoto", rs.getString("hphoto"));
+					map.put("pet", rs.getString("pet"));
+					mapList.add(map);
+				}
+				db.close(rs);
+			}
+			page.setData(mapList);
+			return page;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	@Override
+	public int updateVideoRecordByPk(int pk, String duration, String coin, String hasanswer, Integer AccFlag) {
+		String sql = "update VideoRecord set ";
+		if(duration!=null && !duration.equals("")) {
+			sql += " duration='"+duration+"',";
+		}
+		if(coin!=null && !coin.equals("")) {
+			sql += " coin='"+coin+"',";
+		}
+		if(hasanswer!=null && !hasanswer.equals("")) {
+			sql += " hasanswer='"+hasanswer+"',";
+		}
+		if(AccFlag!= null) {
+			sql += " AccFlag='"+AccFlag+"',";
+		}
+		sql = sql.substring(0, sql.lastIndexOf(","));
+		
+		sql += " where pk = " + pk;
+		DbConnection db = new DbConnection();
+		return db.executeUpdate(sql);
+	}
+
+	@Override
+	public VideoRecord findVideoRecordByPk(int pk) {
+		VideoRecord v = new VideoRecord();
+		try {
+			String sql = "select * from VideoRecord where pk = " + pk;
+			DbConnection db = new DbConnection();
+			CachedRowSet rs = db.executeQuery(sql);
+			if(rs != null && rs.next()) {
+				v.setPk(rs.getInt("pk"));
+				v.setBegdate(rs.getDate("Begdate"));
+				v.setCoin(rs.getDouble("coin"));
+				v.setDuration(rs.getDouble("duration"));
+				v.setHasanswer(rs.getInt("hasanswer"));
+				v.setMemberpk(rs.getInt("Memberpk"));
+				v.setModelpk(rs.getInt("Modelpk"));
+				v.setAccflag(rs.getInt("AccFlag"));
+				db.close(rs);
+			}
+			return v;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+
+}

+ 313 - 0
src/main/java/com/thmodel/dbconnection/DbConnection.java

@@ -0,0 +1,313 @@
+package com.thmodel.dbconnection;
+
+import java.io.InputStream;
+import java.sql.*;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sql.*;
+import javax.sql.rowset.CachedRowSet;
+
+import com.sun.rowset.CachedRowSetImpl;
+
+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();
+		}
+        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;
+        CachedRowSet crs = null;
+        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);
+            }
+            rs = stmt.executeQuery(sql);
+            crs = new CachedRowSetImpl();
+            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();
+			}
+        }
+        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();
+        	}
+            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 (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();
+			}
+        }
+        return Number;
+    }
+    
+    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();
+        } 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();
+			}
+        }
+        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();
+        	}
+        	
+            pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
+            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);
+            }
+        }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);
+		}
+    }
+    /**
+     * 查询返回值 为一个  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);
+    	}
+    }
+    /**
+     * 查询返回值 为一个  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);
+    	}
+    }
+    
+    public void close(CachedRowSet rs){
+    	try {
+			if(rs!=null){
+				rs.close();
+			}
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+    }
+}

+ 72 - 0
src/main/java/com/thmodel/entity/AccRecord.java

@@ -0,0 +1,72 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+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;
+	}
+	
+	
+	
+	
+	
+}

+ 100 - 0
src/main/java/com/thmodel/entity/AccountRecord.java

@@ -0,0 +1,100 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-24
+ * @version v1.0
+ * @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;
+	}
+	
+}

+ 129 - 0
src/main/java/com/thmodel/entity/BrokerInfor.java

@@ -0,0 +1,129 @@
+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;
+	}
+	
+}

+ 115 - 0
src/main/java/com/thmodel/entity/CashRecord.java

@@ -0,0 +1,115 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-24
+ * @version v1.0
+ * @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;
+	}
+	
+	
+}

+ 77 - 0
src/main/java/com/thmodel/entity/ChatRecord.java

@@ -0,0 +1,77 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 聊天记录
+ */
+public class ChatRecord {
+	
+	@JSONField(name="chatpk")
+	private int pk;
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date cdate;//时间
+	
+	private int modelpk;//人才PK
+	
+	private int memberpk;//会员pk
+	
+	private String chat;//聊天内容
+	
+	private String ctype;//类别
+	
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public Date getCdate() {
+		return cdate;
+	}
+
+	public void setCdate(Date cdate) {
+		this.cdate = cdate;
+	}
+
+	public int getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public int getMemberpk() {
+		return memberpk;
+	}
+
+	public void setMemberpk(int memberpk) {
+		this.memberpk = memberpk;
+	}
+
+	public String getChat() {
+		return chat;
+	}
+
+	public void setChat(String chat) {
+		this.chat = chat;
+	}
+
+	public String getCtype() {
+		return ctype;
+	}
+
+	public void setCtype(String ctype) {
+		this.ctype = ctype;
+	}
+	
+	
+	
+
+}

+ 49 - 0
src/main/java/com/thmodel/entity/HonorInfo.java

@@ -0,0 +1,49 @@
+package com.thmodel.entity;
+
+/**
+ * 人才荣誉
+ */
+public class HonorInfo {
+
+	private int pk;
+	
+	private int modelpk;//人才PK
+	
+	private String hdate;//概要日期
+	
+	private String Honor;
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public String getHdate() {
+		return hdate;
+	}
+
+	public void setHdate(String hdate) {
+		this.hdate = hdate;
+	}
+
+	public String getHonor() {
+		return Honor;
+	}
+
+	public void setHonor(String honor) {
+		Honor = honor;
+	}
+	
+	
+}

+ 308 - 0
src/main/java/com/thmodel/entity/MemberInfo.java

@@ -0,0 +1,308 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 会员/账号信息表
+ * @author Administrator
+ *
+ */
+public class MemberInfo {
+	
+	private int 	pk;
+	private int 	membtype;	//会员类别
+	private int		membclass;	//会员级别
+	private String 	qrcode;		//二维码编号
+	private String 	tel;		//帐号
+	private String  phone;		//电话号码
+	private String 	pass;		//密码
+	private String 	paypass;	//支付密码
+	private String 	pet;		//昵称
+	private String 	hphoto;		//头像
+	private String 	photo;		//照片
+	private int 	area;		//地区						
+	private String 	age;		//年龄				
+	private String 	id;			//身份证号				
+	private int 	islive;		//消息提醒
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date 	mdate;		//注册日期
+	private String 	token;		//消息令牌				
+	private int 	acc;		//积分
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date 	lastsign;	//最后一次签到					
+	private int 	signdays;	//连续签到多到天					
+	private int 	introducerpk;//推荐人pk					
+	private String 	identify;	//认证状态				
+	private String 	id_a;		//身份证正面				
+	private String 	id_b;		//身份证反面				
+	private String 	id_c;		//手持身份拍照				
+	private String 	wid;		//微信提现帐号				
+	private double 	coin_a;		//账户总币额(虚拟贝)			
+	private double 	coin_ir;	//红包收入币额		
+	private double 	coin_iv;	//聊天收到币额	
+	private double 	coin_is;	//服务收入币额			
+	private double 	coin_irr;	//红包分红币额			
+	private double 	coin_ivv;	//聊天分成币额		
+	private double 	coin_iss;	//服务分成币额		
+	private double 	coin_ill;	//队长收入币额
+	private double 	coin_i;		//冲值币额
+	private double 	coin_or;	//红包支付币额
+	private double 	coin_ov;	//聊天支付币额
+	private double 	coin_os;	//订单支付币额
+	private double 	coin_om;	//模卡支付币额
+	private double 	coin_o;		//提现支出币额
+	private double 	coin_oi;	//预支币额
+	
+	
+	public double getCoin_a() {
+		return coin_a;
+	}
+	public void setCoin_a(double coin_a) {
+		this.coin_a = coin_a;
+	}
+	public int getPk() {
+		return pk;
+	}
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+	public int getMembtype() {
+		return membtype;
+	}
+	public void setMembtype(int membtype) {
+		this.membtype = membtype;
+	}
+	public int getMembclass() {
+		return membclass;
+	}
+	public void setMembclass(int membclass) {
+		this.membclass = membclass;
+	}
+	public String getQrcode() {
+		return qrcode;
+	}
+	public void setQrcode(String qrcode) {
+		this.qrcode = qrcode;
+	}
+	public String getTel() {
+		return tel;
+	}
+	public void setTel(String tel) {
+		this.tel = tel;
+	}
+	public String getPass() {
+		return pass;
+	}
+	public void setPass(String pass) {
+		this.pass = pass;
+	}
+	public String getPaypass() {
+		return paypass;
+	}
+	public void setPaypass(String paypass) {
+		this.paypass = paypass;
+	}
+	public String getPet() {
+		return pet;
+	}
+	public void setPet(String pet) {
+		this.pet = pet;
+	}
+	public String getHphoto() {
+		return hphoto;
+	}
+	public void setHphoto(String hphoto) {
+		this.hphoto = hphoto;
+	}
+	public String getPhoto() {
+		return photo;
+	}
+	public void setPhoto(String photo) {
+		this.photo = photo;
+	}
+	public int getArea() {
+		return area;
+	}
+	public void setArea(int area) {
+		this.area = area;
+	}
+	public String getAge() {
+		return age;
+	}
+	public void setAge(String age) {
+		this.age = age;
+	}
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public int getIslive() {
+		return islive;
+	}
+	public void setIslive(int islive) {
+		this.islive = islive;
+	}
+	public Date getMdate() {
+		return mdate;
+	}
+	public void setMdate(Date mdate) {
+		this.mdate = mdate;
+	}
+	public String getToken() {
+		return token;
+	}
+	public void setToken(String token) {
+		this.token = token;
+	}
+	public int getAcc() {
+		return acc;
+	}
+	public void setAcc(int acc) {
+		this.acc = acc;
+	}
+	public Date getLastsign() {
+		return lastsign;
+	}
+	public void setLastsign(Date lastsign) {
+		this.lastsign = lastsign;
+	}
+	public int getSigndays() {
+		return signdays;
+	}
+	public void setSigndays(int signdays) {
+		this.signdays = signdays;
+	}
+	public int getIntroducerpk() {
+		return introducerpk;
+	}
+	public void setIntroducerpk(int introducerpk) {
+		this.introducerpk = introducerpk;
+	}
+	public String getIdentify() {
+		return identify;
+	}
+	public void setIdentify(String identify) {
+		this.identify = identify;
+	}
+	public String getId_a() {
+		return id_a;
+	}
+	public void setId_a(String id_a) {
+		this.id_a = id_a;
+	}
+	public String getId_b() {
+		return id_b;
+	}
+	public void setId_b(String id_b) {
+		this.id_b = id_b;
+	}
+	public String getId_c() {
+		return id_c;
+	}
+	public void setId_c(String id_c) {
+		this.id_c = id_c;
+	}
+	public String getWid() {
+		return wid;
+	}
+	public void setWid(String wid) {
+		this.wid = wid;
+	}
+	
+	public double getCoin_ir() {
+		return coin_ir;
+	}
+	public void setCoin_ir(double coin_ir) {
+		this.coin_ir = coin_ir;
+	}
+	public double getCoin_iv() {
+		return coin_iv;
+	}
+	public void setCoin_iv(double coin_iv) {
+		this.coin_iv = coin_iv;
+	}
+	public double getCoin_is() {
+		return coin_is;
+	}
+	public void setCoin_is(double coin_is) {
+		this.coin_is = coin_is;
+	}
+	public double getCoin_irr() {
+		return coin_irr;
+	}
+	public void setCoin_irr(double coin_irr) {
+		this.coin_irr = coin_irr;
+	}
+	public double getCoin_ivv() {
+		return coin_ivv;
+	}
+	public void setCoin_ivv(double coin_ivv) {
+		this.coin_ivv = coin_ivv;
+	}
+	public double getCoin_iss() {
+		return coin_iss;
+	}
+	public void setCoin_iss(double coin_iss) {
+		this.coin_iss = coin_iss;
+	}
+	public double getCoin_ill() {
+		return coin_ill;
+	}
+	public void setCoin_ill(double coin_ill) {
+		this.coin_ill = coin_ill;
+	}
+	public double getCoin_i() {
+		return coin_i;
+	}
+	public void setCoin_i(double coin_i) {
+		this.coin_i = coin_i;
+	}
+	public double getCoin_or() {
+		return coin_or;
+	}
+	public void setCoin_or(double coin_or) {
+		this.coin_or = coin_or;
+	}
+	public double getCoin_ov() {
+		return coin_ov;
+	}
+	public void setCoin_ov(double coin_ov) {
+		this.coin_ov = coin_ov;
+	}
+	public double getCoin_os() {
+		return coin_os;
+	}
+	public void setCoin_os(double coin_os) {
+		this.coin_os = coin_os;
+	}
+	public double getCoin_om() {
+		return coin_om;
+	}
+	public void setCoin_om(double coin_om) {
+		this.coin_om = coin_om;
+	}
+	public double getCoin_o() {
+		return coin_o;
+	}
+	public void setCoin_o(double coin_o) {
+		this.coin_o = coin_o;
+	}
+	public double getCoin_oi() {
+		return coin_oi;
+	}
+	public void setCoin_oi(double coin_oi) {
+		this.coin_oi = coin_oi;
+	}
+	public String getPhone() {
+		return phone;
+	}
+	public void setPhone(String phone) {
+		this.phone = phone;
+	}
+	
+	
+}

+ 39 - 0
src/main/java/com/thmodel/entity/MemberSign.java

@@ -0,0 +1,39 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 会员签到信息表
+ * @author Administrator
+ *
+ */
+public class MemberSign {
+	
+	private int 	pk;	
+	private int 	memberpk;	//会员ID
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date 	sdate;		//时间
+	
+	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 getSdate() {
+		return sdate;
+	}
+	public void setSdate(Date sdate) {
+		this.sdate = sdate;
+	}
+	
+	
+}

+ 96 - 0
src/main/java/com/thmodel/entity/ModelAct.java

@@ -0,0 +1,96 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才视频表
+ */
+public class ModelAct {
+	
+	private int pk;
+	
+	private int modelpk;//人才PK
+	
+	private int orderpk;//顺序
+	
+	private String caption;//视频标题
+	
+	private String pic;//视频图片
+	
+	private String video;//视频
+	
+	private String intro;//摘要
+	
+	private int ucount;//用户评价好数
+	
+	private int dcount;//用户评价差数
+	
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date adate;//日期
+	
+	
+	public int getPk() {
+		return pk;
+	}
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+	public int getModelpk() {
+		return modelpk;
+	}
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+	public int getOrderpk() {
+		return orderpk;
+	}
+	public void setOrderpk(int orderpk) {
+		this.orderpk = orderpk;
+	}
+	public String getCaption() {
+		return caption;
+	}
+	public void setCaption(String caption) {
+		this.caption = caption;
+	}
+	public String getPic() {
+		return pic;
+	}
+	public void setPic(String pic) {
+		this.pic = pic;
+	}
+	public String getVideo() {
+		return video;
+	}
+	public void setVideo(String video) {
+		this.video = video;
+	}
+	public String getIntro() {
+		return intro;
+	}
+	public void setIntro(String intro) {
+		this.intro = intro;
+	}
+	public int getUcount() {
+		return ucount;
+	}
+	public void setUcount(int ucount) {
+		this.ucount = ucount;
+	}
+	public int getDcount() {
+		return dcount;
+	}
+	public void setDcount(int dcount) {
+		this.dcount = dcount;
+	}
+	public Date getAdate() {
+		return adate;
+	}
+	public void setAdate(Date adate) {
+		this.adate = adate;
+	}
+	
+	
+}

+ 70 - 0
src/main/java/com/thmodel/entity/ModelCard.java

@@ -0,0 +1,70 @@
+package com.thmodel.entity;
+
+/**
+ *  模卡信息表
+ */
+public class ModelCard {
+	
+	private int pk;
+	
+	private String cardname;//模卡名称
+	
+	private String sample;//样例图片
+	
+	private String url;//模卡URL
+	
+	private double price;//模卡价币(按天)
+	
+	private double fee;//收入
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public String getCardname() {
+		return cardname;
+	}
+
+	public void setCardname(String cardname) {
+		this.cardname = cardname;
+	}
+
+	public String getSample() {
+		return sample;
+	}
+
+	public void setSample(String sample) {
+		this.sample = sample;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public double getPrice() {
+		return price;
+	}
+
+	public void setPrice(double price) {
+		this.price = price;
+	}
+
+	public double getFee() {
+		return fee;
+	}
+
+	public void setFee(double fee) {
+		this.fee = fee;
+	}
+	
+	
+	
+}

+ 378 - 0
src/main/java/com/thmodel/entity/ModelInfo.java

@@ -0,0 +1,378 @@
+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;
+	}
+
+	public int getEye() {
+		return eye;
+	}
+
+	public void setEye(int eye) {
+		this.eye = eye;
+	}
+
+	public int getHair() {
+		return hair;
+	}
+
+	public void setHair(int hair) {
+		this.hair = hair;
+	}
+
+	public String getAddr() {
+		return addr;
+	}
+
+	public void setAddr(String addr) {
+		this.addr = addr;
+	}
+
+	public int getBrokepk() {
+		return brokepk;
+	}
+
+	public void setBrokepk(int brokepk) {
+		this.brokepk = brokepk;
+	}
+
+	public int getBmemberpk() {
+		return bmemberpk;
+	}
+
+	public void setBmemberpk(int bmemberpk) {
+		this.bmemberpk = bmemberpk;
+	}
+
+	public String getStage() {
+		return stage;
+	}
+
+	public void setStage(String stage) {
+		this.stage = stage;
+	}
+
+	public int getStar() {
+		return star;
+	}
+
+	public void setStar(int star) {
+		this.star = star;
+	}
+
+	public int getFcount() {
+		return fcount;
+	}
+
+	public void setFcount(int fcount) {
+		this.fcount = fcount;
+	}
+
+	public String getLname() {
+		return lname;
+	}
+
+	public void setLname(String lname) {
+		this.lname = lname;
+	}
+
+	public int getUcount() {
+		return ucount;
+	}
+
+	public void setUcount(int ucount) {
+		this.ucount = ucount;
+	}
+
+	public int getDcount() {
+		return dcount;
+	}
+
+	public void setDcount(int dcount) {
+		this.dcount = dcount;
+	}
+
+	public double getVprice() {
+		return vprice;
+	}
+
+	public void setVprice(double vprice) {
+		this.vprice = vprice;
+	}
+
+	public int getIs_a() {
+		return is_a;
+	}
+
+	public void setIs_a(int is_a) {
+		this.is_a = is_a;
+	}
+
+	public double getRatio_r() {
+		return ratio_r;
+	}
+
+	public void setRatio_r(double ratio_r) {
+		this.ratio_r = ratio_r;
+	}
+
+	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 int getIs_v() {
+		return is_v;
+	}
+
+	public void setIs_v(int is_v) {
+		this.is_v = is_v;
+	}
+
+	public int getCardpk() {
+		return cardpk;
+	}
+
+	public void setCardpk(int cardpk) {
+		this.cardpk = cardpk;
+	}
+
+	public String getOccupation() {
+		return occupation;
+	}
+
+	public void setOccupation(String occupation) {
+		this.occupation = occupation;
+	}
+
+	public Date getRdate() {
+		return rdate;
+	}
+
+	public void setRdate(Date rdate) {
+		this.rdate = rdate;
+	}
+
+	public List getModelphoto() {
+		return modelphoto;
+	}
+
+	public void setModelphoto(List modelphoto) {
+		this.modelphoto = modelphoto;
+	}
+
+	public String getTel() {
+		return tel;
+	}
+
+	public void setTel(String tel) {
+		this.tel = tel;
+	}
+
+	public int getIsattention() {
+		return isattention;
+	}
+
+	public void setIsattention(int isattention) {
+		this.isattention = isattention;
+	}
+
+	public String getHphoto() {
+		return hphoto;
+	}
+
+	public void setHphoto(String hphoto) {
+		this.hphoto = hphoto;
+	}
+
+	public int getArea() {
+		return area;
+	}
+
+	public void setArea(int area) {
+		this.area = area;
+	}
+	
+
+	
+	
+	
+}

+ 53 - 0
src/main/java/com/thmodel/entity/ModelPhoto.java

@@ -0,0 +1,53 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才照片表
+ */
+public class ModelPhoto {
+	
+	@JSONField(name="modelphotopk")
+	private int pk;
+	private int modelpk;	//人才PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	public Date rdate;		//记录日期
+	private String photo;	//照片
+	private int ordid;		//顺序ID
+	
+	
+	public int getPk() {
+		return pk;
+	}
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+	public int getModelpk() {
+		return modelpk;
+	}
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+	public Date getRdate() {
+		return rdate;
+	}
+	public void setRdate(Date rdate) {
+		this.rdate = rdate;
+	}
+	public String getPhoto() {
+		return photo;
+	}
+	public void setPhoto(String photo) {
+		this.photo = photo;
+	}
+	public int getOrdid() {
+		return ordid;
+	}
+	public void setOrdid(int ordid) {
+		this.ordid = ordid;
+	}
+	
+	
+}

+ 99 - 0
src/main/java/com/thmodel/entity/ModelPrice.java

@@ -0,0 +1,99 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才服务定价表
+ * @author Administrator
+ *
+ */
+public class ModelPrice {
+	
+	
+	@JSONField(name="pricepk")
+	private int pk;
+	
+	private int modelpk;//人才PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date pdate;//定价日期
+	
+	private String pname;//服务名称
+	
+	private double price;//价格
+	
+	private String unit;//价格单位
+	
+	private int orderid;//排序
+	
+	private int skillpk;//技能标签PK
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public Date getPdate() {
+		return pdate;
+	}
+
+	public void setPdate(Date pdate) {
+		this.pdate = pdate;
+	}
+
+	public String getPname() {
+		return pname;
+	}
+
+	public void setPname(String pname) {
+		this.pname = pname;
+	}
+
+	public double getPrice() {
+		return price;
+	}
+
+	public void setPrice(double price) {
+		this.price = price;
+	}
+
+	public String getUnit() {
+		return unit;
+	}
+
+	public void setUnit(String unit) {
+		this.unit = unit;
+	}
+
+	public int getOrderid() {
+		return orderid;
+	}
+
+	public void setOrderid(int orderid) {
+		this.orderid = orderid;
+	}
+
+	public int getSkillpk() {
+		return skillpk;
+	}
+
+	public void setSkillpk(int skillpk) {
+		this.skillpk = skillpk;
+	}
+	
+	
+	
+	
+}

+ 85 - 0
src/main/java/com/thmodel/entity/ModelPrivate.java

@@ -0,0 +1,85 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才私密空间
+ */
+public class ModelPrivate {
+	
+	private int pk;
+	
+	private int modelpk;//人才PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date pdate;//日期
+	
+	private String intro;//这一刻的想法
+	
+	private int ucount;//用户评价好数
+	
+	private int dcount;//用户评价差数
+	
+	private int islikes;//是否点赞
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public Date getPdate() {
+		return pdate;
+	}
+
+	public void setPdate(Date pdate) {
+		this.pdate = pdate;
+	}
+
+	public String getIntro() {
+		return intro;
+	}
+
+	public void setIntro(String intro) {
+		this.intro = intro;
+	}
+
+	public int getUcount() {
+		return ucount;
+	}
+
+	public void setUcount(int ucount) {
+		this.ucount = ucount;
+	}
+
+	public int getDcount() {
+		return dcount;
+	}
+
+	public void setDcount(int dcount) {
+		this.dcount = dcount;
+	}
+
+	public int getIslikes() {
+		return islikes;
+	}
+
+	public void setIslikes(int islikes) {
+		this.islikes = islikes;
+	}
+	
+	
+	
+	
+}

+ 82 - 0
src/main/java/com/thmodel/entity/ModelPrivateDiscuss.java

@@ -0,0 +1,82 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才私密空间评价表
+ */
+public class ModelPrivateDiscuss {
+	
+	private int pk;
+	
+	private int privatepk;//空间pk
+	
+	private int parentpk;//上一级pk(本类)
+	
+	private int memberpk;//会员pk
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date idate;//日期
+	
+	private int isgood;//赞、评论   0:评论   1:点赞
+	
+	private String intro;//评论
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getPrivatepk() {
+		return privatepk;
+	}
+
+	public void setPrivatepk(int privatepk) {
+		this.privatepk = privatepk;
+	}
+
+	public int getParentpk() {
+		return parentpk;
+	}
+
+	public void setParentpk(int parentpk) {
+		this.parentpk = parentpk;
+	}
+
+	public int getMemberpk() {
+		return memberpk;
+	}
+
+	public void setMemberpk(int memberpk) {
+		this.memberpk = memberpk;
+	}
+
+	public Date getIdate() {
+		return idate;
+	}
+
+	public void setIdate(Date idate) {
+		this.idate = idate;
+	}
+
+	public int getIsgood() {
+		return isgood;
+	}
+
+	public void setIsgood(int isgood) {
+		this.isgood = isgood;
+	}
+
+	public String getIntro() {
+		return intro;
+	}
+
+	public void setIntro(String intro) {
+		this.intro = intro;
+	}
+	
+}

+ 48 - 0
src/main/java/com/thmodel/entity/ModelPrivateItem.java

@@ -0,0 +1,48 @@
+package com.thmodel.entity;
+
+/**
+ * 人才私密空间明细
+ */
+public class ModelPrivateItem {
+	
+	private int pk;
+	
+	private int privatepk;//空间PK
+	
+	private String url;
+	
+	private String ftype;//文件类型(链接、图片)
+
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getPrivatepk() {
+		return privatepk;
+	}
+
+	public void setPrivatepk(int privatepk) {
+		this.privatepk = privatepk;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getFtype() {
+		return ftype;
+	}
+
+	public void setFtype(String ftype) {
+		this.ftype = ftype;
+	}
+	
+}

+ 83 - 0
src/main/java/com/thmodel/entity/Nexus.java

@@ -0,0 +1,83 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-09-03
+ * @version v1.0
+ * @desc 会员模特的关系表
+ */
+public class Nexus {
+	
+	private int pk;
+	
+	private int memberpk;
+	
+	private int modelpk;
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date create_date;
+	
+	private String remarks;
+
+	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 getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public Date getCreate_date() {
+		return create_date;
+	}
+
+	public void setCreate_date(Date create_date) {
+		this.create_date = create_date;
+	}
+
+	public String getRemarks() {
+		return remarks;
+	}
+
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+	
+	public Nexus() { }
+	
+	public Nexus(int memberpk) {
+		super();
+		this.memberpk = memberpk;
+	}
+	
+	public Nexus(int pk, int memberpk, int modelpk, Date create_date, String remarks) {
+		super();
+		this.pk = pk;
+		this.memberpk = memberpk;
+		this.modelpk = modelpk;
+		this.create_date = create_date;
+		this.remarks = remarks;
+	}
+	
+	
+	
+}

+ 225 - 0
src/main/java/com/thmodel/entity/OrderRecord.java

@@ -0,0 +1,225 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+public class OrderRecord {
+	
+	private int pk;
+	
+	private int memberpk;//会员PK
+	
+	private int modelpk;//人才PK
+	
+	private int brokerpk;//经纪人PK
+	
+	private int lederpk;//队长PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date odate;//订单日期
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date sdate;//服务日期时间
+	
+	private int skillpk;//技能标签PK
+	
+	private double scount;//服务时长
+	
+	private String sname;//服务名称
+	
+	private double sprice;//价格
+	
+	private double coin;//支付费用
+	
+	/**
+	 * 0:待付款    1:待完成   2:进行中   3:已完成
+	 * 
+	 */
+	private String orderstate;//订单状态
+	
+	private String intro;//订单说明
+	
+	private double ec;//客户评价
+	
+	private String evaluate;//评价说明
+	
+	private String linkman;//联系人
+	
+	private String linkphone;//联系方式
+	
+	private String addr;//工作地点
+	
+	private int accflag;//支付状态
+	private int hasred;//是否已读
+
+	
+	public int getAccflag() {
+		return accflag;
+	}
+
+	public void setAccflag(int accflag) {
+		this.accflag = accflag;
+	}
+
+	public int getHasred() {
+		return hasred;
+	}
+
+	public void setHasred(int hasred) {
+		this.hasred = hasred;
+	}
+
+	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 getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public int getBrokerpk() {
+		return brokerpk;
+	}
+
+	public void setBrokerpk(int brokerpk) {
+		this.brokerpk = brokerpk;
+	}
+
+	public int getLederpk() {
+		return lederpk;
+	}
+
+	public void setLederpk(int lederpk) {
+		this.lederpk = lederpk;
+	}
+
+	public Date getOdate() {
+		return odate;
+	}
+
+	public void setOdate(Date odate) {
+		this.odate = odate;
+	}
+
+	public Date getSdate() {
+		return sdate;
+	}
+
+	public void setSdate(Date sdate) {
+		this.sdate = sdate;
+	}
+
+	public int getSkillpk() {
+		return skillpk;
+	}
+
+	public void setSkillpk(int skillpk) {
+		this.skillpk = skillpk;
+	}
+
+	public double getScount() {
+		return scount;
+	}
+
+	public void setScount(double scount) {
+		this.scount = scount;
+	}
+
+	public String getSname() {
+		return sname;
+	}
+
+	public void setSname(String sname) {
+		this.sname = sname;
+	}
+
+	public double getSprice() {
+		return sprice;
+	}
+
+	public void setSprice(double sprice) {
+		this.sprice = sprice;
+	}
+
+	public double getCoin() {
+		return coin;
+	}
+
+	public void setCoin(double coin) {
+		this.coin = coin;
+	}
+
+	public String getOrderstate() {
+		return orderstate;
+	}
+
+	public void setOrderstate(String orderstate) {
+		this.orderstate = orderstate;
+	}
+
+	public String getIntro() {
+		return intro;
+	}
+
+	public void setIntro(String intro) {
+		this.intro = intro;
+	}
+
+	public double getEc() {
+		return ec;
+	}
+
+	public void setEc(double ec) {
+		this.ec = ec;
+	}
+
+	public String getEvaluate() {
+		return evaluate;
+	}
+
+	public void setEvaluate(String evaluate) {
+		this.evaluate = evaluate;
+	}
+
+	public String getLinkman() {
+		return linkman;
+	}
+
+	public void setLinkman(String linkman) {
+		this.linkman = linkman;
+	}
+
+	public String getLinkphone() {
+		return linkphone;
+	}
+
+	public void setLinkphone(String linkphone) {
+		this.linkphone = linkphone;
+	}
+
+	public String getAddr() {
+		return addr;
+	}
+
+	public void setAddr(String addr) {
+		this.addr = addr;
+	}
+	
+	
+	
+}

+ 140 - 0
src/main/java/com/thmodel/entity/ParttyInfo.java

@@ -0,0 +1,140 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+public class ParttyInfo {
+	
+	private int pk;
+	private String pic;//图片
+	private String caption;//标题
+	private String intro;//活动简介
+	private String term;//参与条件
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date sbeg;//报名开始时间
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date sendt;//报名截止时间
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date beg;//活动开始时间
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date endt;//活动结束时间
+	private double meprice;//会员单价
+	private double moprice;//模特单价
+	private double brprice;//经纪人单价
+	
+	private int isbanner;//是否是横幅
+	private String banner;//横幅图片
+	
+	private int signcount;	//活动报名人数
+	private int issigndate;	//是否到活动开始报名时间之后
+	
+	private int issign;
+	
+	
+	
+	public int getSigncount() {
+		return signcount;
+	}
+	public void setSigncount(int signcount) {
+		this.signcount = signcount;
+	}
+	public int getPk() {
+		return pk;
+	}
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+	public String getPic() {
+		return pic;
+	}
+	public void setPic(String pic) {
+		this.pic = pic;
+	}
+	public String getCaption() {
+		return caption;
+	}
+	public void setCaption(String caption) {
+		this.caption = caption;
+	}
+	public String getIntro() {
+		return intro;
+	}
+	public void setIntro(String intro) {
+		this.intro = intro;
+	}
+	public String getTerm() {
+		return term;
+	}
+	public void setTerm(String term) {
+		this.term = term;
+	}
+	public Date getSbeg() {
+		return sbeg;
+	}
+	public void setSbeg(Date sbeg) {
+		this.sbeg = sbeg;
+	}
+	public Date getSendt() {
+		return sendt;
+	}
+	public void setSendt(Date sendt) {
+		this.sendt = sendt;
+	}
+	public Date getBeg() {
+		return beg;
+	}
+	public void setBeg(Date beg) {
+		this.beg = beg;
+	}
+	public Date getEndt() {
+		return endt;
+	}
+	public void setEndt(Date endt) {
+		this.endt = endt;
+	}
+	public double getMeprice() {
+		return meprice;
+	}
+	public void setMeprice(double meprice) {
+		this.meprice = meprice;
+	}
+	public double getMoprice() {
+		return moprice;
+	}
+	public void setMoprice(double moprice) {
+		this.moprice = moprice;
+	}
+	public double getBrprice() {
+		return brprice;
+	}
+	public void setBrprice(double brprice) {
+		this.brprice = brprice;
+	}
+	public int getIssign() {
+		return issign;
+	}
+	public void setIssign(int issign) {
+		this.issign = issign;
+	}
+	public int getIsbanner() {
+		return isbanner;
+	}
+	public void setIsbanner(int isbanner) {
+		this.isbanner = isbanner;
+	}
+	public String getBanner() {
+		return banner;
+	}
+	public void setBanner(String banner) {
+		this.banner = banner;
+	}
+	public int getIssigndate() {
+		return issigndate;
+	}
+	public void setIssigndate(int issigndate) {
+		this.issigndate = issigndate;
+	}
+
+	
+}

+ 61 - 0
src/main/java/com/thmodel/entity/RedPacket.java

@@ -0,0 +1,61 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 人才红包
+ * @author 刘迎奥
+ * @date 2018年7月6日
+ * @version v1.0
+ */
+public class RedPacket {
+	
+	private int pk;
+	private int modelpk;	//人才PK
+	private int memberpk;	//会员PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date rdate;		//时间
+	private double coin;	//红包
+	private String rstate;	//红包状态   1:发送/2:接收
+	
+	public int getPk() {
+		return pk;
+	}
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+	public int getModelpk() {
+		return modelpk;
+	}
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+	public int getMemberpk() {
+		return memberpk;
+	}
+	public void setMemberpk(int memberpk) {
+		this.memberpk = memberpk;
+	}
+	public Date getRdate() {
+		return rdate;
+	}
+	public void setRdate(Date rdate) {
+		this.rdate = rdate;
+	}
+	public double getCoin() {
+		return coin;
+	}
+	public void setCoin(double coin) {
+		this.coin = coin;
+	}
+	public String getRstate() {
+		return rstate;
+	}
+	public void setRstate(String rstate) {
+		this.rstate = rstate;
+	}
+	
+	
+}

+ 80 - 0
src/main/java/com/thmodel/entity/ReportInfo.java

@@ -0,0 +1,80 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+/**
+ * 举报信息
+ * @author 刘迎奥
+ * @date 2018-08-29
+ * @version v1.0
+ * @desc
+ */
+public class ReportInfo {
+	
+	
+	private int pk;
+	
+	/**
+	 * 被告
+	 */
+	private int appelleepk;
+	
+	/**
+	 * 原告
+	 */
+	private int accuserpk;
+	
+	/**
+	 * 描述
+	 */
+	private String reason;
+	
+	/**
+	 * 时间
+	 */
+	private Date createdate;
+	
+	
+	public int getPk() {
+		return pk;
+	}
+
+	public void setPk(int pk) {
+		this.pk = pk;
+	}
+
+	public int getAppelleepk() {
+		return appelleepk;
+	}
+
+	public void setAppelleepk(int appelleepk) {
+		this.appelleepk = appelleepk;
+	}
+
+	public int getAccuserpk() {
+		return accuserpk;
+	}
+
+	public void setAccuserpk(int accuserpk) {
+		this.accuserpk = accuserpk;
+	}
+
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+
+	public Date getCreatedate() {
+		return createdate;
+	}
+
+	public void setCreatedate(Date createdate) {
+		this.createdate = createdate;
+	}
+	
+	
+	
+}

+ 98 - 0
src/main/java/com/thmodel/entity/VideoRecord.java

@@ -0,0 +1,98 @@
+package com.thmodel.entity;
+
+import java.util.Date;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-26
+ * @version v1.0
+ * @desc 视频聊天记录
+ */
+public class VideoRecord {
+	
+	private int pk;
+	
+	private int memberpk;//会员PK
+	
+	private int modelpk;//人才PK
+	@JSONField(format="yyyy-MM-dd HH:mm:ss")
+	private Date begdate;//开始时间
+	
+	private double duration;//时长
+	
+	private double coin;//币额
+	
+	private int hasanswer;//是否接听
+	
+	//1表示我这边可以处理了,9表示我这边处理完毕
+	private int accflag;
+
+	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 getModelpk() {
+		return modelpk;
+	}
+
+	public void setModelpk(int modelpk) {
+		this.modelpk = modelpk;
+	}
+
+	public Date getBegdate() {
+		return begdate;
+	}
+
+	public void setBegdate(Date begdate) {
+		this.begdate = begdate;
+	}
+
+	public double getDuration() {
+		return duration;
+	}
+
+	public void setDuration(double duration) {
+		this.duration = duration;
+	}
+
+	public double getCoin() {
+		return coin;
+	}
+
+	public void setCoin(double coin) {
+		this.coin = coin;
+	}
+
+	public int getHasanswer() {
+		return hasanswer;
+	}
+
+	public void setHasanswer(int hasanswer) {
+		this.hasanswer = hasanswer;
+	}
+
+	public int getAccflag() {
+		return accflag;
+	}
+
+	public void setAccflag(int accflag) {
+		this.accflag = accflag;
+	}
+	
+	
+
+}

+ 39 - 0
src/main/java/com/thmodel/nimserver/CheckSumBuilder.java

@@ -0,0 +1,39 @@
+package com.thmodel.nimserver;
+
+import java.security.MessageDigest;
+
+public class CheckSumBuilder {
+	// 计算并获取CheckSum
+    public static String getCheckSum(String appSecret, String nonce, String curTime) {
+        return encode("sha1", appSecret + nonce + curTime);
+    }
+
+    // 计算并获取md5值
+    public static String getMD5(String requestBody) {
+        return encode("md5", requestBody);
+    }
+
+    private static String encode(String algorithm, String value) {
+        if (value == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
+            messageDigest.update(value.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+}

+ 46 - 0
src/main/java/com/thmodel/nimserver/NimConfig.java

@@ -0,0 +1,46 @@
+package com.thmodel.nimserver;
+
+/**
+ * 网易云  配置信息
+ * @author 刘迎奥
+ * @date 2018年7月20日
+ * @version v1.0
+ */
+public class NimConfig {
+	
+	//网易云通讯
+	public static final String appKey 				= "c545b95fd20d5a20d0d1220dc6831e4d";
+	public static final String appSecret 			= "571ba7139b67";
+	public static final String contentType_1 		= "application/x-www-form-urlencoded;charset=utf-8";
+	public static final String contentType_2 		= "application/json; charset=utf-8";
+	public static final String errorNeteaseMessage 	= "{\"desc\":\"error\",\"code\": 500}";
+	
+	public static final String eventType_1 = "1"; // 表示CONVERSATION消息,即会话类型的消息(目前包括P2P聊天消息,群组聊天消息,群组操作,好友操作)
+
+	public static final String eventType_2 = "2"; // 表示LOGIN消息,即用户登录事件的消息
+
+	public static final String eventType_3 = "3"; // 表示LOGOUT消息,即用户登出事件的消息
+
+	public static final String eventType_4 = "4"; // 表示CHATROOM消息,即聊天室中聊天的消息
+
+	public static final String eventType_5 = "5"; // 表示AUDIO/VEDIO/DataTunnel消息,即汇报实时音视频通话时长、白板事件时长的消息
+
+	public static final String eventType_6 = "6"; // 表示音视频/白板文件存储信息,即汇报音视频/白板文件的大小、下载地址等消息
+
+	public static final String eventType_7 = "7"; // 表示单聊消息撤回抄送
+
+	public static final String eventType_8 = "8"; // 表示群聊消息撤回抄送
+
+	public static final String eventType_9 = "9"; // 表示CHATROOM_INOUT信息,即汇报主播或管理员进出聊天室事件消息
+
+	public static final String eventType_10 = "10"; // 表示ECP_CALLBACK信息,即汇报专线电话通话结束回调抄送的消息
+
+	public static final String eventType_11 = "11"; // 表示SMS_CALLBACK信息,即汇报短信回执抄送的消息
+
+	public static final String eventType_12 = "12";// 表示SMS_REPLY信息,即汇报短信上行消息
+
+	public static final String eventType_13 = "13"; // 表示AVROOM_INOUT信息,即汇报用户进出音视频/白板房间的消息
+
+	public static final String eventType_14 = "14"; // 表示CHATROOM_QUEUE_OPERATE信息,即汇报聊天室队列操作的事件消息
+	
+}

+ 452 - 0
src/main/java/com/thmodel/nimserver/Nimserver.java

@@ -0,0 +1,452 @@
+package com.thmodel.nimserver;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import com.alibaba.fastjson.JSON;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * 网易通讯接口
+ * 只对接网易通讯
+ * @author 刘迎奥
+ * @date 2018年7月5日
+ * @version v1.0
+ */
+public class Nimserver {
+	
+	DefaultHttpClient httpClient = new DefaultHttpClient();
+	private String appKey = NimConfig.appKey;//开发者平台分配的appkey
+	private String appSecret = NimConfig.appSecret;
+	
+	public HttpPost init(String url, String contentType){
+
+		String nonce =  (int)(Math.random() * 1000000)+"";//随机数(最大长度128个字符)
+		String curTime = String.valueOf((new Date()).getTime() / 1000L);
+		String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
+		
+		HttpPost httpPost = new HttpPost(url);
+		// 设置请求的header
+		httpPost.addHeader("AppKey", appKey);
+		httpPost.addHeader("Nonce", nonce);
+		httpPost.addHeader("CurTime", curTime);
+		httpPost.addHeader("CheckSum", checkSum);
+		httpPost.addHeader("Content-Type", contentType);
+		return httpPost;
+	}
+	
+	
+	/**
+	 * 注册
+	 * @return
+	 */
+	public String createUser(String accid, String name){
+		try {
+			String url = "https://api.netease.im/nimserver/user/create.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			nvps.add(new BasicNameValuePair("name", name == null ? "" : name));
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 获取用户名片
+	 * @return
+	 */
+	public  String getUinfos(String[] accids){
+		try {
+			
+			String url = "https://api.netease.im/nimserver/user/getUinfos.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accids", JSON.toJSONString(accids)));
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			//{"code":200,"uinfos":[{"accid":"liuyingao","gender":0}]}
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 更新用户 token
+	 * @return
+	 */
+	public String refreshToken(String accid){
+		try {
+			
+			String url = "https://api.netease.im/nimserver/user/refreshToken.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 网易云通信ID更新
+	 * 可以修改指定的 token
+	 * @return
+	 */
+	public String update(String accid, String token, String props){
+		try {
+			
+			String url = "https://api.netease.im/nimserver/user/update.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			
+			if(token != null && !token.equals("")) {
+				nvps.add(new BasicNameValuePair("token", token));
+			}
+			
+			//json属性,第三方可选填,最大长度1024字符
+			if(props != null && !props.equals("")) {
+				nvps.add(new BasicNameValuePair("props", props));
+			}
+			
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 更新用户名片
+	 * @return
+	 */
+	public String updateUinfo(String accid, Map<String, String> paramMap){
+		try {
+			
+			String url = "https://api.netease.im/nimserver/user/updateUinfo.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			if(paramMap!=null) {
+				for (Entry<String, String> item : paramMap.entrySet()) {
+					String key = item.getKey();
+					String val = item.getValue();
+					nvps.add(new BasicNameValuePair(key, val));
+				}
+			}
+			
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	/**
+	 * 设置桌面端在线时,移动端是否需要推送
+	 * @param accid
+	 * @param donnopOpen
+	 * @return
+	 */
+	public  String setDonnop(String accid, String donnopOpen){
+		try {
+			
+			String url = "https://api.netease.im/nimserver/user/setDonnop.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			nvps.add(new BasicNameValuePair("donnopOpen", donnopOpen));
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 加好友
+	 * @param accid 加好友发起者accid
+	 * @param faccid 加好友接收者accid
+	 * @param type 1直接加好友,2请求加好友,3同意加好友,4拒绝加好友
+	 * @param msg 加好友对应的请求消息,第三方组装,最长256字符(不是必须参数)
+	 * @return
+	 */
+	public  String addFriend(String accid, String faccid, String type, String msg){
+		try {
+			String url = "https://api.netease.im/nimserver/friend/add.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			nvps.add(new BasicNameValuePair("faccid", faccid));
+			nvps.add(new BasicNameValuePair("type", type));
+			
+			if(msg!=null && !msg.equals("")){
+				nvps.add(new BasicNameValuePair("faccid", faccid));
+			}
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 更新好友相关信息
+	 * @param accid 发起者accid
+	 * @param faccid 要修改朋友的accid
+	 * @param alias 给好友增加备注名,限制长度128(不是必须参数)
+	 * @param ex 修改ex字段,限制长度256(不是必须参数)
+	 * @return
+	 */
+	public  String updateFriend(String accid, String faccid, String alias, String ex){
+		try {
+			String url = "https://api.netease.im/nimserver/friend/update.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			nvps.add(new BasicNameValuePair("faccid", faccid));
+			
+			if(alias!=null && !alias.equals("")){
+				nvps.add(new BasicNameValuePair("alias", alias));
+			}
+			if(ex!=null && !ex.equals("")){
+				nvps.add(new BasicNameValuePair("ex", ex));
+			}
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 删除好友
+	 * @param accid 发起者accid
+	 * @param faccid 要删除朋友的accid
+	 * @return
+	 */
+	public String deleteFriend(String accid, String faccid){
+		try {
+			String url = "https://api.netease.im/nimserver/friend/delete.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("accid", accid));
+			nvps.add(new BasicNameValuePair("faccid", faccid));
+			
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 发送普通消息
+	 * @param from 发送者accid,用户帐号,最大32字符,必须保证一个APP内唯一
+	 * @param ope 0:点对点个人消息,1:群消息(高级群),其他返回414
+	 * @param to ope==0是表示accid即用户id,ope==1表示tid即群id
+	 * @param type 	0 表示文本消息<br>
+					1 表示图片<br>
+					2 表示语音<br>
+					3 表示视频<br>
+					4 表示地理位置信息<br>
+					6 表示文件<br>
+					100 自定义消息类型(特别注意,对于未对接易盾反垃圾功能的应用,该类型的消息不会提交反垃圾系统检测)<br>
+	 * @param body 	请参考下方消息示例说明中对应消息的body字段,最大长度5000字符,为一个JSON串
+	 * @param paramMap
+	 * @return
+	 */
+	public String sendMsg(String from, String ope, String to, String type, String body, Map<String, String> paramMap){
+		try {
+			String url = "https://api.netease.im/nimserver/msg/sendMsg.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("from", from));
+			nvps.add(new BasicNameValuePair("ope", ope));
+			nvps.add(new BasicNameValuePair("to", to));
+			nvps.add(new BasicNameValuePair("type", type));
+			nvps.add(new BasicNameValuePair("body", body));
+			
+			for (Entry<String, String> item : paramMap.entrySet()) {
+				String key = item.getKey();
+				String val = item.getValue();
+				nvps.add(new BasicNameValuePair(key, val));
+			}
+			
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	/**
+	 * 发送自定义系统通知
+	 * @param from 发送者accid,用户帐号,最大32字符,APP内唯一
+	 * @param msgtype 	0:点对点自定义通知,1:群消息自定义通知,其他返回414
+	 * @param to 	msgtype==0是表示accid即用户id,msgtype==1表示tid即群id
+	 * @param attach 	自定义通知内容,第三方组装的字符串,建议是JSON串,最大长度4096字符
+	 * @param paramMap 
+	 * 			pushcontent	String	否	iOS推送内容,第三方自己组装的推送内容,不超过150字符
+	 *			payload		String	否	iOS推送对应的payload,必须是JSON,不能超过2k字符
+	 *			sound		String	否	如果有指定推送,此属性指定为客户端本地的声音文件名,长度不要超过30个字符,如果不指定,会使用默认声音
+	 *			save		int		否	1表示只发在线,2表示会存离线,其他会报414错误。默认会存离线
+	 *			option	String	否	
+	 *				发消息时特殊指定的行为选项,Json格式,可用于指定消息计数等特殊行为;option中字段不填时表示默认值。
+	 *				option示例:
+	 *				{"badge":false,"needPushNick":false,"route":false}
+	 *				字段说明:
+	 *				1. badge:该消息是否需要计入到未读计数中,默认true;
+	 *				2. needPushNick: 推送文案是否需要带上昵称,不设置该参数时默认false(ps:注意与sendMsg.action接口有别);
+	 *				3. route: 该消息是否需要抄送第三方;默认true (需要app开通消息抄送功能)
+	 * @return
+	 */
+	public String sendAttachMsg(String from, int msgtype, String to, String attach, Map<String, String> paramMap) {
+		try {
+			String url = "https://api.netease.im/nimserver/msg/sendAttachMsg.action";
+			//初始化
+			HttpPost httpPost = init(url, NimConfig.contentType_1);
+			
+			// 设置请求的参数
+			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+			nvps.add(new BasicNameValuePair("from", from));
+			nvps.add(new BasicNameValuePair("msgtype", msgtype+""));
+			nvps.add(new BasicNameValuePair("to", to));
+			nvps.add(new BasicNameValuePair("attach", attach));
+			
+			for (Entry<String, String> item : paramMap.entrySet()) {
+				String key = item.getKey();
+				String val = item.getValue();
+				nvps.add(new BasicNameValuePair(key, val));
+			}
+			
+			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+			
+			// 执行请求
+			HttpResponse response = httpClient.execute(httpPost);
+			
+			// 打印执行结果
+			String result = EntityUtils.toString(response.getEntity(), "utf-8");
+			return result;
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			return NimConfig.errorNeteaseMessage;
+		}
+	}
+	
+	
+	
+
+	
+}

+ 24 - 0
src/main/java/com/thmodel/page/Page.java

@@ -0,0 +1,24 @@
+package com.thmodel.page;
+
+//分页  bean
+public class Page<T> {
+	
+	private int count;
+	private T data;
+	
+	public int getCount() {
+		return count;
+	}
+	public void setCount(int count) {
+		this.count = count;
+	}
+	public T getData() {
+		return data;
+	}
+	public void setData(T data) {
+		this.data = data;
+	}
+	
+	
+	
+}

+ 31 - 0
src/main/java/com/thmodel/result/ResultProcedure.java

@@ -0,0 +1,31 @@
+package com.thmodel.result;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-08-20
+ * @version v1.0
+ * @desc 存储过程 返回值
+ */
+public class ResultProcedure {
+	
+	//<0表示失败, =0成功, >0表示已经计算过,无需重复计算
+	private int result;
+	
+	//<0[错误原因], =0['success'], >0['当前业务已经出来的提示内容']
+	private String message;
+	
+
+	public int getResult() {
+		return result;
+	}
+	public void setResult(int result) {
+		this.result = result;
+	}
+	public String getMessage() {
+		return message;
+	}
+	public void setMessage(String message) {
+		this.message = message;
+	}
+	
+}

+ 51 - 0
src/main/java/com/thmodel/service/AccountRecordService.java

@@ -0,0 +1,51 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 刘迎奥
+ * @date 2018-07-24
+ * @version v1.0
+ * @desc 结算记录
+ */
+public interface AccountRecordService {
+	
+	/**
+	 * 获取今日收入
+	 * @param memberpk
+	 * @return
+	 */
+	public double getTodayIncome(int memberpk);
+	
+	/**
+	 * 获取收入明细
+	 * @param memberpk
+	 * @return
+	 */
+	public Map<String, Object> getIncomeDetails(int memberpk, int year, int month, int index, int size);
+	
+	/**
+	 * 支出明细
+	 * @param memberpk
+	 * @return
+	 */
+	public List getPayDetails(int memberpk);
+	
+	/**
+	 * 充值明细
+	 * @param memberpk
+	 * @return
+	 */
+	public List getRechargeDetails(int memberpk);
+	
+	/**
+	 * 提现明细
+	 * @param memberpk
+	 * @param year
+	 * @param month
+	 * @return
+	 */
+	public Map<String, Object> getOutCashDetails(int memberpk, int year, int month, int index, int size);
+	
+}

+ 57 - 0
src/main/java/com/thmodel/service/ActivityService.java

@@ -0,0 +1,57 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.ParttyInfo;
+
+public interface ActivityService {
+	
+	/**
+	 * 最近的活动
+	 * @return
+	 */
+	public Map<String, Object> getPartty(int memberpk, int index, int size);
+	
+	/**
+	 * 我参加的活动
+	 * @param pk
+	 * @return
+	 */
+	public Map<String, Object> qryPartty(int pk, int index, int size);
+	
+	/**
+	 * 我没有参加的活动
+	 * @param pk
+	 * @return
+	 */
+	public Map<String, Object> qryNotPartty(int pk, int index, int size);
+	
+	/**
+	 * 活动报名
+	 * @param pk  会员PK
+	 * @param parttyPk  活动PK
+	 * @param people  参与人员
+	 * @param tel  联系方式
+	 * @param pCount  人数
+	 * @param fee  费用
+	 * @return 0:失败, 1:成功,2:已报名,3:余额不足,4:活动报名时间未开始,5:结算金额错误
+	 */
+	public Map<String, Object> enroll(int pk, int parttyPk, String people, String tel, int pCount, String fee);
+	
+	/**
+	 * 活动签到
+	 * @param pk 会员pk
+	 * @param parttyPk 活动pk
+	 * @return
+	 */
+	public boolean signPartty(int pk, int parttyPk);
+	
+	/**
+	 * 获取横幅活动
+	 * @return
+	 */
+	public List<Map<String, Object>> getBanner();
+	
+	
+}

+ 16 - 0
src/main/java/com/thmodel/service/CashRecordService.java

@@ -0,0 +1,16 @@
+package com.thmodel.service;
+
+import java.util.Map;
+
+public interface CashRecordService {
+	
+	/**
+	 * 提现记录
+	 * @param memberpk
+	 * @param year
+	 * @param month
+	 * @return
+	 */
+	public Map<String, Object> getOutCashDetails(int memberpk, int year, int month, int index, int size); 
+	
+}

+ 185 - 0
src/main/java/com/thmodel/service/MemberinfoService.java

@@ -0,0 +1,185 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.MemberSign;
+import com.thmodel.entity.Nexus;
+import com.thmodel.page.Page;
+
+//会员用户信息
+public interface MemberinfoService {
+	
+	/**
+	 * 判断电话/账号是否存在
+	 * @param tel
+	 * @return true不存在/false存在
+	 */
+	public boolean isTel(String tel);
+	
+	/**
+	 * 用户端注册
+	 * @param memberinfo
+	 * @return
+	 */
+	public int doRegister(MemberInfo memberinfo);
+	
+	/**
+	 * 模特端注册
+	 * @param memberinfo
+	 * @return
+	 */
+	public int doModelRegister(MemberInfo memberinfo);
+	
+	/**
+	 * 登录
+	 * @param username
+	 * @param pwd
+	 * @return
+	 */
+	public MemberInfo dologin(String username, String pwd);
+	
+	/**
+	 * 打卡签到
+	 * @param PK
+	 */
+	public Map<String, Object> docard(int PK);
+	
+	/**
+	 * 获取打卡记录
+	 * @param PK
+	 * @return
+	 */
+	public List<MemberSign> dogetcard(int PK);
+	
+	/**
+	 * 找回密码
+	 * 根据手机号/账号  获取密码
+	 * @param Tel
+	 * @return
+	 */
+	public String getPwdByTel(String Tel);
+	
+	/**
+	 * 修改密码
+	 * @param tel
+	 * @param pwd
+	 * @return
+	 */
+	public boolean updatepwd(int PK, String pwd);
+	
+	/**
+	 * 修改昵称
+	 * @param PK
+	 * @param Pet
+	 * @return
+	 */
+	public boolean updatePet(int PK, String Pet);
+	
+	/**
+	 * 修改地区
+	 * @param PK
+	 * @param Area
+	 * @return
+	 */
+	public boolean updateArea(int PK, int Area);
+	
+	/**
+	 * 修改会员头像
+	 * @param pk
+	 * @param hphoto
+	 * @return
+	 */
+	public boolean updateMemberhphoto(String pk, String hphoto);
+	
+	/**
+	 * 修改会员token
+	 * @param pk
+	 * @param token
+	 * @return
+	 */
+	public boolean updateMemberToken(int pk, String token);
+	
+	/**
+	 * 修改会员 手机号
+	 * @param pk
+	 * @param phone
+	 * @return
+	 */
+	public boolean updateMemberPhone(int pk, String phone);
+	
+	/**
+	 * 验证手机号有没有注册
+	 * @param phone
+	 * @return 1:已经存在 2:不存在 3:异常
+	 */
+	public int verifyPhone(String phone);
+	
+	/**
+	 * 根据会员pk
+	 * @param pk
+	 * @return
+	 */
+	public MemberInfo getUserInfo(int pk);
+	
+	/**
+	 * 根据会员pk  查询会员昵称
+	 * @param pk
+	 * @return
+	 */
+	public String getUserName(int pk);
+	
+	/**
+	 * 添加充值币额
+	 * @param memberpk
+	 * @param coin
+	 * @return
+	 */
+	public boolean addCoinI(int memberpk, double coin);
+	
+	/**
+	 * 根据手机号查询memberpk 会员pk
+	 * @param tel
+	 * @return
+	 */
+	public int getMemberpkByTel(String tel);
+	
+	/**
+	 * 根据手机号修改密码
+	 * @param mobile
+	 * @param pass
+	 * @return
+	 */
+	public boolean modifypwd(String mobile, String pass);
+	
+	/**
+	 * 添加屏蔽模特
+	 * @param nexus
+	 * @return
+	 */
+	public boolean addDefriendModel(Nexus nexus);
+	
+	/**
+	 * 移除屏蔽的模特
+	 * @param nexus
+	 * @return
+	 */
+	public boolean removeDefriendModel(Nexus nexus);
+	
+	/**
+	 * 查询屏蔽的模特列表
+	 * @param nexus
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public Page<List<Nexus>> getDefriendModel(Nexus nexus, int index, int size);
+	
+	/**
+	 * 查询全部屏蔽的模特列表
+	 * @param nexus
+	 * @return
+	 */
+	public List<Nexus> getAllNexus(Nexus nexus);
+}

+ 49 - 0
src/main/java/com/thmodel/service/ModelCardService.java

@@ -0,0 +1,49 @@
+package com.thmodel.service;
+
+import java.util.List;
+
+import com.thmodel.entity.ModelCard;
+
+/**
+ * 模卡
+ */
+public interface ModelCardService {
+	
+	/**
+	 * 获取模卡列表
+	 * @return
+	 */
+	public List<ModelCard> getMCard();
+	
+	/**
+	 * 设置人才的模卡
+	 * @param ModelPK 人才pk
+	 * @param ModelCardPK 模卡pk
+	 * @return
+	 */
+	public boolean setMCard(int ModelPK, int ModelCardPK);
+	
+	/**
+	 * 清除人才的模卡pk
+	 * @param ModelPK
+	 * @return
+	 */
+	public boolean clearMCard(int ModelPK);
+	
+	/**
+	 * 修改模卡
+	 * @param modelpk
+	 * @param name
+	 * @param age
+	 * @param area
+	 * @param hei
+	 * @param wei
+	 * @param wai
+	 * @param bust
+	 * @param hip
+	 * @param lname
+	 */
+	public boolean updateModelCard(int modelpk, String name, String age, String area, String hei, String wei, String wai,
+			String bust, String hip, String lname, String vprice);
+	
+}

+ 475 - 0
src/main/java/com/thmodel/service/ModelInfoService.java

@@ -0,0 +1,475 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.ChatRecord;
+import com.thmodel.entity.HonorInfo;
+import com.thmodel.entity.ModelAct;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.ModelPrice;
+import com.thmodel.entity.ReportInfo;
+import com.thmodel.page.Page;
+
+/**
+ * 人才信息
+ */
+public interface ModelInfoService {
+	
+	/**
+	 * 获取人才粉丝列表	10个
+	 * @param memberpk 当前会员pk
+	 * @return
+	 */
+	public Map<String, Object> dogetmodel(int memberpk, int index, int size);
+	
+	/**
+	 * 获取关注的人才信息(10个)
+	 * @return
+	 */
+	public Map<String, Object> getmodelfan(int pk, int index, int size);
+	
+	/**
+	 * 根据星级获取人才列表
+	 * @param memberpk
+	 * @param star
+	 * @return
+	 */
+	public Map<String, Object> getmodelstar(int memberpk, int star, int index, int size);
+	
+	/**
+	 * 获取人才视频列表
+	 * @param ModelPK
+	 * @return
+	 */
+	public List<ModelAct> geart(int ModelPK);
+	
+	/**
+	 * 获取人才粉丝列表
+	 * @param ModelPK
+	 * @return
+	 */
+	public List<Map<String, Object>> getfan(int ModelPK);
+	
+	/**
+	 * 获取人才定价表
+	 * @param ModelPK
+	 * @return
+	 */
+	public List<ModelPrice> getprice(int ModelPK);
+	
+	/**
+	 * 获取人才聊天记录(最近的50条)
+	 * @param ModelPK
+	 * @param PK
+	 * @return
+	 */
+	public List<ChatRecord> getchat(int ModelPK, Integer PK);
+	
+	/**
+	 * 提交人才聊天记录
+	 * @param CDate  时间
+	 * @param ModelPK  人才PK
+	 * @param MemberPK  会员PK
+	 * @param chat  内容
+	 * @param CType  类型
+	 * @return
+	 */
+	public boolean putchat(String CDate, String ModelPK, String MemberPK, String chat, String CType);
+	
+	/**
+	 * 获取人才荣誉
+	 * @param ModelPK 人才pk
+	 * @return
+	 */
+	public List<HonorInfo> getHonor(int ModelPK);
+	
+	/**
+	 * 获取人才荣誉名称列表
+	 * @param ModelPK 人才pk
+	 * @return
+	 */
+	public List<String> getHonorName(int ModelPK);
+	
+	/**
+	 * 人才为自己添加荣誉
+	 * 
+	 * @param ModelPK
+	 * @param Honor
+	 * "[{\"honor\":\"这是我的荣誉我\"}, {\"honor\":\"这是我的荣誉\"}, {\"honor\": \"honor3\"}]"
+	 * @return
+	 */
+	public boolean addHonor(int ModelPK, String Honors);
+	
+	/**
+	 * 根据经纪人pk查询经纪人信息
+	 * @return
+	 */
+	public Map<String, Object> getBroke(int BrokePK);
+	
+	/**
+	 * 根据经济人名称  查询经纪人列表
+	 * @param LikeName
+	 * @return
+	 */
+	public Map<String, Object> qryBroke(String LikeName, int index, int size);
+	
+	/**
+	 * 模特申请加入经济人
+	 * @param ModelPK    人才PK
+	 * @param BrokePK    经纪人PK
+	 * @param MemberPK   经纪会员PK
+	 * @return
+	 */
+	public boolean appBroke(int ModelPK, int BrokePK, int MemberPK);
+	
+	/**
+	 * 查找经济人的所有模特
+	 * @param memberpk
+	 * @param brokePk
+	 * @return
+	 */
+	public Map<String, Object> qryModel(int memberpk, int brokePk, int index, int size);
+	
+	/**
+	 * 根据名称检索人才信息
+	 * @param memberpk
+	 * @param likeName
+	 * @return
+	 */
+	public Map<String, Object> getQueryModel(int memberpk, String likeName, int index, int size);
+	
+	/**
+	 * 查找模特的所有私密空间(最近10条)
+	 * @param modelPk 人才PK
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> getPrivate(int modelPk, int memberpk, int index, int size);
+	
+	/**
+	 * 增加模特的私密空间
+	 * @param modelPk 人才PK
+	 * @param intro 这一刻的想法
+	 * @return
+	 */
+	public int addPrivate(int modelPk, String intro);
+	
+	/**
+	 * 增加私密空间明细
+	 * @param privatePk 空间PK
+	 * @param url 
+	 * @param fType 文件类型(链接、图片)
+	 */
+	public boolean addPrivateItem(int privatePk, String url, String fType);
+	
+	/**
+	 * 点赞模特的私密空间
+	 * @param privatePk 空间pk
+	 * @param memberPk 会员pk
+	 * @return
+	 */
+	public boolean praisePrivate(int privatePk, int memberPk);
+	
+	/**
+	 * 评论模特的私密空间
+	 * @param privatePk 空间pk
+	 * @param memberPk 会员pk
+	 * @param RecordInfoPK 父类pk
+	 * @param intro 评论内容
+	 * @return
+	 */
+	public boolean addPrivateRecord(int privatePk, int memberPk, int RecordInfoPK, String intro);
+	
+	/**
+	 * 获取人才的标签
+	 * @param modelPk 人才pk
+	 * @return
+	 */
+	public Map<String, Object> getModelFigure(int modelPk);
+	/**
+	 * 获取可配的形象标签
+	 * @return
+	 */
+	public List<Map<String, Object>> getFigures();
+	
+	/**
+	 * 查询符合标签的人才
+	 * @param memberpk 当前会员pk
+	 * @param figurePks 形象pk  1,2,3,4...
+	 * @return
+	 */
+	public Map<String, Object> queryFigureModel(int memberpk, String figurePks, int index, int size);
+	
+	/**
+	 * 查询我设定的人才标签
+	 * @param memberPk 会员pk
+	 * @param modelPk 人才pk
+	 * @return
+	 */
+	public List<Map<String, Object>> queryMyFigure(int memberPk, int modelPk);
+	
+	/**
+	 * * 设定人才标签
+	 * @param memberPk 会员pk
+	 * @param modelPk 人才pk
+	 * @param figurePks 形象pk 1,2,3,4...
+	 * @param isSelf 是否自评 0/1
+	 * @return
+	 */
+	public boolean setModelFigure(int memberPk, int modelPk, String figurePks, int isSelf);
+	
+	/**
+	 * 根据人才pk  查询人才信息
+	 * @param modelPk
+	 * @return
+	 */
+	public Map<String, Object> modelInfoByPk(int memberpk, int modelPk);
+	
+	/**
+	 * 查询私密空间的用户评论
+	 * @param privatePk
+	 * @return
+	 */
+	public Map<String, Object> queryPrivateRecord(int privatePk);
+
+	/**
+	 * 查询所有技能标签
+	 * @return
+	 */
+	public List<Map<String, Object>> querySkillFigure();
+
+	/**
+	 * 查询符合技能的人才
+	 * @param skillPks  技能pk	SkillPK, SkillPK, SkillPK…
+	 * @return
+	 */
+	public Map<String, Object> querySkillModel(int memberpk, String skillPks, int index , int size);
+	
+	/**
+	 * 分页获取人才评论数
+	 * @param privatePk 空间pk
+	 * @param index 第几页
+	 * @param size 每页显示多少条
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> findModelPrivateLimit(int privatePk, int index, int size);
+	
+	/**
+	 * 发现
+	 * @param memberPk 会员pk
+	 * @return
+	 */
+	public Page<List> findmodel(int memberPk, int index, int size);
+	
+	/**
+	 * 添加点赞/取消点赞
+	 * @param memberPk 会员pk
+	 * @param privatePk 空间PK
+	 * @param type 1点赞/2取消点赞
+	 * @return
+	 */
+	public boolean likes(int memberPk, int privatePk, int type);
+	
+	/**
+	 * 添加关注/取消关注
+	 * @param memberPk
+	 * @param modelPk
+	 * @param type
+	 * @return
+	 */
+	public boolean attention(int memberPk, int modelPk, int type);
+	
+	
+	/**
+	 * 获取人才的技能(模特端)
+	 * @param modelPk
+	 */
+	public List getSkillData(int modelPk);
+
+	/**
+	 * 添加技能(模特端)
+	 * @param skillpk
+	 * @param modelpk
+	 * @param skillphoto
+	 * @param price
+	 * @param unit
+	 * @param orderid
+	 * @return
+	 */
+	public boolean addSkill(int skillpk, int modelpk, String skillphoto, double price, String unit, int orderid);
+
+	
+	
+	/**
+	 * 修改技能(模特端)
+	 * @param pk
+	 * @param modelpk
+	 * @param skillpk
+	 * @param skillphoto
+	 * @param price
+	 * @param unit
+	 * @param orderid
+	 * @return
+	 */
+	public boolean updateSkill(int pk, int modelpk, String skillpk, String skillphoto, String price, String unit, String orderid);
+	
+	/**
+	 * 模特端登陆
+	 * @param mobile
+	 * @param pass
+	 */
+	public Map<String, Object> dologin(String mobile, String pass);
+	
+	/**
+	 * 获取人才的风格标签(自评)
+	 * @param modelpk
+	 * @return
+	 */
+	public List<Map<String, Object>> getModelStyle(int modelpk);
+	
+	/**
+	 * 设置人才的风格标签
+	 * @param modelpk
+	 * @param strs
+	 * @return
+	 */
+	public boolean setModelStyle(int modelpk, String stylepks);
+	
+	
+	/**
+	 * 删除人才技能
+	 * @param modelpk
+	 * @param skillpk
+	 * @return
+	 */
+	public boolean removeModelSkill(int modelpk, int skillpk);
+	
+	/**
+	 * 模特注册
+	 * @param memberpk 会员pk
+	 * @param name 会员名字
+	 * @return 人才pk
+	 */
+	public int doModelRegister(int memberpk, String name, int BrokePK, int BMemberPK);
+	
+	/**
+	 * 获取人才照片
+	 * @param modelpk
+	 * @return
+	 */
+	public List getModelPhoto(int modelpk);
+	
+	/**
+	 * 添加人才照片
+	 * @param modelpk 人才pk
+	 * @param photo 图片路径
+	 * @param ordid 排序
+	 * @return
+	 */
+	public boolean addModelPhoto(int modelpk, String photo, int ordid);
+	
+	/**
+	 * 删除人才照片 
+	 * @param modelphotopk 照片pk
+	 * @param modelpk 人才pk
+	 * @return
+	 */
+	public boolean deleteModelPhoto(String modelphotopks, int modelpk);
+	
+	/**
+	 * 获取 模特端 模卡资料
+	 * @param modelpk 人才pk
+	 * @return
+	 */
+	public List getModelData(int modelpk);
+	
+	/**
+	 * 模特端验证手机号是否注册
+	 * @param phone
+	 * @return true:未注册
+	 */
+	public boolean verifyModelPhone(String phone);
+	
+	/**
+	 * 获取空间动态总数量
+	 * @param privatePk
+	 * @return
+	 */
+	public int findModelPrivateCount(int privatePk);
+	
+	/**
+	 * 模特端刷新模特登录信息
+	 * @param modelpk
+	 * @return
+	 */
+	public Map<String, Object> getModelLoginInfo(int modelpk);
+	
+	/**
+	 * 获取空间点赞记录
+	 * @param privatePk
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public Page<List> findModelLikesLimit(int privatePk, int index, int size);
+
+	/**
+	 * 设置 模特 在线 离线 状态
+	 * @param modelpk
+	 * @param online
+	 * @return
+	 */
+	public boolean putOnline(int modelpk, int online);
+	
+	/**
+	 * 删除动态
+	 * @param privatepk
+	 * @return
+	 */
+	public boolean removeModelPrivate(int privatepk);
+	
+	/**
+	 * 根据 模特的会员pk 获取模特的视频聊天单价
+	 * @param memberpk
+	 * @return
+	 */
+	public Map<String, Object> getModelVPrice(int memberpk);
+	
+	/**
+	 * 修改模特的  是否有 订单的状态
+	 * @param modelpk
+	 * @return
+	 */
+	public boolean setModelHasRed(int modelpk, int hasred);
+	
+	/**
+	 * 判断模特是否存在
+	 * @param memberpk
+	 */
+	public boolean isModel(int memberpk);
+	
+	/**
+	 * 获取模特邀请码
+	 * @return
+	 */
+	public String getNewMemQrCode();
+	
+	/**
+	 * 添加举报记录
+	 * @param reportInfo
+	 * @return
+	 */
+	public boolean doAddReport(ReportInfo reportInfo);
+	
+	/**
+	 * 移除某条模特的动态评论
+	 * @param privatepk
+	 * @param modelprivatediscusspk
+	 */
+	public boolean removeComments(int privatepk, int modelprivatediscusspk);
+	
+
+	
+	
+	
+}

+ 41 - 0
src/main/java/com/thmodel/service/NimserverService.java

@@ -0,0 +1,41 @@
+package com.thmodel.service;
+
+/**
+ * 网易通讯  同步 数据
+ * @author 刘迎奥
+ * @date 2018年7月5日
+ * @version v1.0
+ */
+public interface NimserverService {
+	
+	/**
+	 * 注册
+	 * @param pk 会员pk
+	 * @param name 会员名称
+	 */
+	public String createUser(int pk, String name);
+	
+	/**
+	 * 更新用户 token
+	 * @param accid
+	 * @return
+	 */
+	public String refreshToken(int accid);
+	
+	/**
+	 * 网易云通信ID更新
+	 * 可以修改指定的 token
+	 * @param accid 必须
+	 * @param token 可空
+	 * @return
+	 */
+	public String update(int accid, String token);
+	
+	/**
+	 * 刷新token 
+	 * 如果账号没有就创建
+	 * @param accid
+	 * @param name
+	 */
+	public void refreshOrCreateToken(int accid, String name);
+}

+ 92 - 0
src/main/java/com/thmodel/service/OrderService.java

@@ -0,0 +1,92 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.OrderRecord;
+import com.thmodel.vo.OrderParam;
+
+import com.thmodel.page.Page;
+
+public interface OrderService {
+	
+	/**
+	 * 提交订单的参数
+	 * @param orderParam
+	 * @return
+	 */
+	public int putOrder(OrderParam model);
+	
+	/**
+	 * 取最近20笔订单
+	 * @param memberPk 会员pk
+	 * @param state 状态
+	 * @return
+	 */
+	public Page getOrder(int memberPk, String state, int index, int size);
+	
+	/**
+	 * 订单评价
+	 * @param orderPk
+	 * @param ec
+	 * @param evaluate
+	 * @return
+	 */
+	public boolean ecorder(int orderPk, String ec, String evaluate);
+	
+	/**
+	 * 模特取消订单
+	 * @param orderpk 订单pk
+	 * @param modelpk 人才pk
+	 * @param state 
+	 * @return
+	 */
+	public boolean cancelOrderModel(int orderpk, int modelpk);
+	
+	/**
+	 * 模特 确认接单
+	 * @param orderpk
+	 * @param modelpk
+	 * @return
+	 */
+	public boolean confirMorderModel(int orderpk, int modelpk);
+	
+	/**
+	 * 支付订单
+	 * @param orderpk
+	 * @return
+	 */
+	public Map<String, Object> payOrder(int orderpk);
+	
+	/**
+	 * 用户 取消订单
+	 * @param orderpk
+	 * @return
+	 */
+	public Map<String, Object> cancelOrder(int orderpk);
+
+	/**
+	 * 模特->结算订单
+	 * @param orderpk
+	 * @return
+	 */
+	public Map<String, Object> settlementOrder(int orderpk);
+	
+	/**
+	 * 获取订单详情
+	 * @param orderpk
+	 * @return
+	 */
+	public Map getOrderInfo(int orderpk);
+	
+	/**
+	 * 获取模特端 订单
+	 * @param memberPk
+	 * @param state
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public Page getModelOrder(int memberPk, String state, int index, int size);
+	
+}

+ 97 - 0
src/main/java/com/thmodel/service/PayService.java

@@ -0,0 +1,97 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.entity.RedPacket;
+
+public interface PayService {
+	
+	/**
+	 * 发送红包
+	 * @param modelPk
+	 * @param memberPk
+	 * @param coin
+	 * @return
+	 */
+	public int giveRed(int modelPk, int memberPk, double coin);
+	
+	/**
+	 * 接收红包
+	 * @param redPacketPk
+	 * @param memberPk
+	 * @return
+	 */
+	public boolean receiveRed(int redPacketPk, int memberPk);
+
+	/**
+	 * 获取发送的红包列表
+	 * @param modelPk
+	 * @return
+	 */
+	public List<RedPacket> getGiveRedList(int modelPk);
+
+	/**
+	 * 获取我收到的红包列表
+	 * @param memberPk
+	 * @return
+	 */
+	public List<RedPacket> getReceiveRedList(int memberPk);
+	
+	/**
+	 * 支付宝提现
+	 * @param modelpk 模特pk
+	 * @param fee 冲值提现金额
+	 * @param abs 订单摘要
+	 * @param intro 支付说明
+	 * @return 0:参数错误 1:提交成功 2:余额不足 3:提交失败(参数错误)
+	 */
+	public int aliPayOutCash(int modelpk, double fee, String abs, String intro);
+	
+	/**
+	 * 获取取现记录
+	 * @param memberpk
+	 * @param type
+	 * @param state
+	 * @return
+	 */
+	public List getOutCash(int memberpk, String type, String state);
+	
+	/**
+	 * 提交充值记录
+	 * @param memberpk 模特会员pk
+	 * @param abs 订单摘要
+	 * @param intro 支付说明
+	 * @param totalAmount 冲值提现金额
+	 * @param id 订单号
+	 * @return
+	 */
+	public int aliPaySubmitOrder(int memberpk, String abs, String intro, String totalAmount, String id);
+	
+	
+	/**
+	 * 支付宝支付成功回调(修改状态)
+	 * @param pk
+	 * @param orderno
+	 * @return
+	 */
+	public boolean aliPayCallback(int pk, String orderno, String result);
+	
+	/**
+	 * 提现页面加载
+	 * @param modelpk
+	 * @return
+	 */
+	public Map<String, Object> aliPayOutCashLoad(int modelpk);
+	
+	/**
+	 * 修改提现支付宝信息
+	 * @param modelpk
+	 * @param name
+	 * @param alipayid
+	 * @return
+	 */
+	public boolean aliPayOutCashModify(int modelpk, String name, String alipayid);
+
+	
+}

+ 25 - 0
src/main/java/com/thmodel/service/UtilServer.java

@@ -0,0 +1,25 @@
+package com.thmodel.service;
+
+import java.util.List;
+
+public interface UtilServer {
+	
+	/**
+	 * 获取地区列表
+	 * @return
+	 */
+	public List getAreaList();
+	
+	/**
+	 * 获取形象标签列表
+	 * @return
+	 */
+	public List getStyleList();
+	
+	/**
+	 * 获取技能标签
+	 * @return
+	 */
+	public List getSkillList();
+
+}

+ 58 - 0
src/main/java/com/thmodel/service/VideoRecordService.java

@@ -0,0 +1,58 @@
+package com.thmodel.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.page.Page;
+
+/**
+ * 视频
+ */
+public interface VideoRecordService {
+	
+	/**
+	 * 提交  视频聊天
+	 * @param memberPk  会员pk
+	 * @param modelPk  人才pk
+	 * @param begDate  开始时间
+	 * @param hasAnswer  是否接听
+	 * @return
+	 */
+	public int begVChat(int pk, int modelPK, String begDate, int hasAnswer);
+	
+	/**
+	 * 提交  接听聊天
+	 * @param videoPk 视频PK	为0表示一发起就接听
+	 * @param memberPk 会员PK
+	 * @param modelPk 人才PK
+	 * @param begDate 开始时间
+	 * @param hasAnswer 是否接听
+	 * @return
+	 */
+	public int ansVChat(int videoPk, int memberPk, int modelPk, String begDate, int hasAnswer);
+	
+	/**
+	 * 获取视频订单
+	 * @param modelpk
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> getVideoRecordOrderList(int modelpk, int index, int size);
+	
+	/**
+	 * 获取用户端视频订单
+	 * @param memberpk
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public Page<List<Map<String, Object>>> getMemberVideoRecordOrderList(int memberpk, int index, int size);
+	
+	/**
+	 * 视频聊天结束
+	 * @param videopk
+	 * @param duration
+	 * @param coin
+	 * @return
+	 */
+	public boolean endVChat(int videopk, String duration, double coin);
+}

+ 122 - 0
src/main/java/com/thmodel/service/impl/AccountRecordServiceImpl.java

@@ -0,0 +1,122 @@
+package com.thmodel.service.impl;
+
+import com.thmodel.dao.impl.AccountRecordDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.service.AccountRecordService;
+import com.thmodel.util.MyDateUtil;
+
+import com.thmodel.page.Page;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.dao.AccountRecordDao;
+
+public class AccountRecordServiceImpl implements AccountRecordService{
+	
+	private static AccountRecordDao accountRecordDao = new AccountRecordDaoImpl();
+	
+	@Override
+	public double getTodayIncome(int memberpk) {
+		double todayIncome = 0;
+		if(memberpk > 0) {
+			todayIncome = accountRecordDao.findTodayIncome(memberpk);
+		}
+		return todayIncome;
+	}
+	
+	@Override
+	public Map<String, Object> getIncomeDetails(int memberpk, int year, int month, int index, int size) {
+		if(memberpk > 0) {
+			Map<String, Object> resultMap = new HashMap<String, Object>();
+			
+			String[] atypes = {
+					AccountConstants.ACCOUNTRECORD_A_TYPE_1,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_2,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_3,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_4,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_5,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_6,
+					AccountConstants.ACCOUNTRECORD_A_TYPE_7
+			};
+			
+			String monthStr = month + "";
+			monthStr = monthStr.length() > 1 ? monthStr : "0" + monthStr;
+			
+			String beginDate = year + "-" + monthStr + "-01";
+			
+			String endDate = MyDateUtil.getLastDayOfMonth(year, month);
+			
+			//收入明细
+			Page<List<AccountRecord>> page = accountRecordDao.findAccountRecordByMemberpkSTypeAType(memberpk, beginDate, endDate, null, atypes, index, size);
+			
+			double incomecoin = accountRecordDao.findIncome(memberpk, beginDate, endDate, null, atypes);
+			double allcoin = accountRecordDao.findIncome(memberpk, null, null, null, atypes);
+			
+			resultMap.put("data", page);
+			resultMap.put("incomecoin", incomecoin);
+			resultMap.put("allcoin", allcoin);
+			
+			return resultMap;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List getPayDetails(int memberpk) {
+		if(memberpk > 0) {
+			return accountRecordDao.findAccountRecordBymemberpkAndAType(memberpk, null);
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public List getRechargeDetails(int memberpk) {
+		if(memberpk > 0) {
+			return accountRecordDao.findAccountRecordBymemberpkAndAType(memberpk, null);
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public Map<String, Object> getOutCashDetails(int memberpk, int year, int month, int index, int size) {
+		if(memberpk > 0) {
+			Map<String, Object> resultMap = new HashMap<String, Object>();
+			
+			
+			String[] atypes = {
+					AccountConstants.ACCOUNTRECORD_A_TYPE_12
+			};
+			
+			String monthStr = month + "";
+			monthStr = monthStr.length() > 1 ? monthStr : "0" + monthStr;
+			
+			String beginDate = year + "-" + monthStr + "-01";
+			
+			String endDate = MyDateUtil.getLastDayOfMonth(year, month);
+			
+			//支出明细
+			Page<List<AccountRecord>> page = accountRecordDao.findAccountRecordByMemberpkSTypeAType(memberpk, beginDate, endDate, null, atypes, index, size);
+			
+			double outcashcoin = accountRecordDao.findIncome(memberpk, beginDate, endDate, null, atypes);
+			
+			double allcoin = accountRecordDao.findIncome(memberpk, null, null, null, atypes);
+			
+			resultMap.put("data", page);
+			resultMap.put("outcashcoin", outcashcoin);
+			resultMap.put("allcoin", allcoin);
+			
+			return resultMap;
+		} else {
+			return null;
+		}
+	}
+
+	
+	
+}

+ 126 - 0
src/main/java/com/thmodel/service/impl/ActivityServiceImpl.java

@@ -0,0 +1,126 @@
+package com.thmodel.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.constants.SystemPayConstants;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ParttyInfoDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ParttyInfoDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.ParttyInfo;
+import com.thmodel.result.ResultProcedure;
+import com.thmodel.service.ActivityService;
+
+public class ActivityServiceImpl implements ActivityService {
+	
+	private static ParttyInfoDao parttyInfoDao = new ParttyInfoDaoImpl();
+	private static MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+	
+	@Override
+	public Map<String, Object> getPartty(int memberpk, int index, int size) {
+		return parttyInfoDao.findPartty(memberpk, index, size);
+	}
+
+	@Override
+	public Map<String, Object> qryPartty(int pk, int index, int size) {
+		if(pk > 0){
+			return parttyInfoDao.findParttyByMemberPk(pk, index, size);
+		}else{
+			return null;
+		}
+	}
+	
+	@Override
+	public Map<String, Object> qryNotPartty(int pk, int index, int size) {
+		if(pk > 0){
+			return parttyInfoDao.findParttyNotMemberPk(pk, index, size);
+		}else{
+			return null;
+		}
+	}
+
+	@Override
+	public Map<String, Object> enroll(int pk, int parttyPk, String people, String tel,
+			int pCount, String fee) {
+		
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		String msg = "";
+		//0:失败, 1:成功,2:已报名,3:余额不足,4:活动报名时间未开始
+		int result = 0;
+		if(pk>0 && parttyPk>0){
+			//判断活动是否已参加
+			int isJoin = parttyInfoDao.isJoinParttyInfo(pk, parttyPk);
+			if(isJoin == 0)
+			{
+				//判断是否在 报名期间内
+				boolean isParttySign = parttyInfoDao.isParttySign(parttyPk);
+				
+				//在活动报名时间之间
+				if(isParttySign) {
+					MemberInfo memberpk = memberinfoDao.findMemberinfoByPK(pk);
+					if(memberpk.getCoin_a() >= Double.parseDouble(fee)) {
+						int result_pk = parttyInfoDao.insertParttyInfo(pk, parttyPk, people, tel, pCount, fee);	
+						if(result_pk > 0)
+						{
+							/*boolean isPaySuccess = sysPay.payToActivity(pk, Double.parseDouble(fee));
+							if(isPaySuccess) {
+								//支付成功
+								AccountRecord ar = new AccountRecord(pk, AccountConstants.ACCOUNTRECORD_S_TYPE_5, result_pk, AccountConstants.ACCOUNTRECORD_A_TYPE_13, Double.parseDouble(fee), "活动报名支付");
+								sysPay.insertAccountRecord(ar);
+							}*/
+							SystemPayConstants sysPay = new SystemPayConstants();
+							ResultProcedure rp = sysPay.procedure(SystemPayConstants.PROCEDURE_TABLENAME_PARTTYSIGN, result_pk);
+							
+							int resultcode = rp.getResult();
+							String message = rp.getMessage();
+							if(resultcode == 0 ) {
+								result = 1;
+							}else {
+								result = 5;
+								msg = message;
+							}
+						}
+					}else {
+						//余额不足
+						result = 3;
+					}
+				} else {
+					//当前时间不是活动报名时间
+					result = 4;
+				}
+			}
+			else if(isJoin > 0)
+			{//已参加活动
+				result = 2;
+			}
+		}
+		resultMap.put("result", result);
+		resultMap.put("message", msg);
+		return resultMap;
+	}
+
+	@Override
+	public boolean signPartty(int pk, int parttyPk) {
+		boolean flag = false;
+		if(pk > 0 && parttyPk > 0){
+			int rows = parttyInfoDao.updateParttySignSetSign(pk, parttyPk);
+			if(rows > 0){
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public List<Map<String, Object>> getBanner() {
+		return parttyInfoDao.findParttyInfoByBanner();
+	}
+	
+	
+	
+}

+ 57 - 0
src/main/java/com/thmodel/service/impl/CashRecordServiceImpl.java

@@ -0,0 +1,57 @@
+package com.thmodel.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.constants.PayConstants;
+import com.thmodel.dao.CashRecordDao;
+import com.thmodel.dao.impl.CashRecordDaoImpl;
+import com.thmodel.entity.CashRecord;
+import com.thmodel.service.CashRecordService;
+import com.thmodel.util.MyDateUtil;
+
+import com.thmodel.page.Page;
+
+public class CashRecordServiceImpl implements CashRecordService {
+	
+	private static CashRecordDao cashRecordDao = new CashRecordDaoImpl();
+	
+	@Override
+	public Map<String, Object> getOutCashDetails(int memberpk, int year, int month, int index, int size) {
+		if(memberpk > 0) {
+			Map<String, Object> resultMap = new HashMap<String, Object>();
+			
+			
+			String[] pstates = {
+					PayConstants.STATE_4,
+					PayConstants.STATE_5,
+					PayConstants.STATE_6
+			};
+			
+			String monthStr = month + "";
+			monthStr = monthStr.length() > 1 ? monthStr : "0" + monthStr;
+			
+			String beginDate = year + "-" + monthStr + "-01";
+			
+			String endDate = MyDateUtil.getLastDayOfMonth(year, month);
+			
+			//支出明细
+			Page<List<CashRecord>> page = cashRecordDao.findCashRecordByMemberpkDatePTypePState(memberpk, beginDate, endDate, null, pstates, index, size);
+			
+			double outcashcoin = cashRecordDao.findOutCashFee(memberpk, beginDate, endDate, null, new String[] {PayConstants.STATE_5});
+			
+			double allcoin = cashRecordDao.findOutCashFee(memberpk, null, null, null, new String[] {PayConstants.STATE_5});
+			
+			resultMap.put("data", page);
+			resultMap.put("outcashcoin", outcashcoin);
+			resultMap.put("allcoin", allcoin);
+			
+			return resultMap;
+		} else {
+			return null;
+		}
+	}
+	
+}

+ 408 - 0
src/main/java/com/thmodel/service/impl/MemberinfoServiceImpl.java

@@ -0,0 +1,408 @@
+package com.thmodel.service.impl;
+
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.CachedRowSet;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.AccRecordDao;
+import com.thmodel.dao.MemberSignDao;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.impl.AccRecordDaoImpl;
+import com.thmodel.dao.impl.MemberSignDaoImpl;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.MemberSign;
+import com.thmodel.entity.Nexus;
+import com.thmodel.nimserver.Nimserver;
+import com.thmodel.page.Page;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.NimserverService;
+import com.thmodel.util.CommentUtils;
+
+public class MemberinfoServiceImpl implements MemberinfoService{
+	
+	MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();//会员信息
+	MemberSignDao memberSignDao = new MemberSignDaoImpl();//会员签到记录
+	AccRecordDao accRecordDao = new AccRecordDaoImpl();//积分历史表
+	Nimserver nimserver = new Nimserver();//网易通讯
+	NimserverService nimserverService = new NimserverServiceImpl();
+	private static ModelInfoService modelInfoService = new ModelInfoServiceImpl();
+	
+	@Override
+	public boolean isTel(String tel) {
+		boolean flag = false;
+		if(CommentUtils.isNull(tel)){
+			int count = memberinfoDao.getCountToMemberinfoByTel(tel);
+			if(count == 0){
+				flag = true;
+			}
+		}else{
+			//电话/账号不能为空
+			flag = false;
+		}
+		return flag;
+	}
+	
+	@Override
+	public int doRegister(MemberInfo memberinfo) {
+		//注册
+		if(CommentUtils.isNull(memberinfo.getTel()) && CommentUtils.isNull(memberinfo.getPass())){
+			int pk = memberinfoDao.insertMemberinfoByRegister(memberinfo);
+			return pk;
+		}else{
+			return -1;
+		}
+	}
+
+	@Override
+	public MemberInfo dologin(String username, String pwd) {
+		//登录
+		if(username != null || pwd!= null){
+			
+			//登录刷新token
+			MemberInfo memberInfo = memberinfoDao.login(username, pwd);
+			if(memberInfo != null) {
+				int pk = memberInfo.getPk();
+				String pet = memberInfo.getPet();
+				nimserverService.refreshOrCreateToken(pk, pet);
+				return memberinfoDao.login(username, pwd);
+			}else {
+				return null;
+			}
+		}else{
+			return null;
+		}
+	}
+
+	@Override
+	public Map<String, Object> docard(int PK) {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
+		
+		//打卡签到
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		
+		Date date=new Date();
+		Calendar calendar = Calendar.getInstance();  
+        calendar.setTime(date);  
+        calendar.add(Calendar.DAY_OF_MONTH, -1);  
+        date = calendar.getTime();  
+		String sysDate = sdf.format(new Date());
+		String prevDate = sdf2.format(date);
+		//System.out.println("当前系统时间---------:"+sysDate);			//yyyy-MM-dd HH:mm:ss
+		//System.out.println("当前系统时间前一天 ----:"+prevDate);			//yyyy-MM-dd
+		
+		//-----------------------------------最有一次签到时间和连续签到天数 begin-----------------------------------
+		//判断今天有没有签过到
+		int currDaysignCount = memberSignDao.findMemberSignByPkLikeSDate(PK, new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
+		
+		//判断昨天有没有签过到
+		int yesterdayCount = memberSignDao.findMemberSignByPkLikeSDate(PK, prevDate);//count大于0:昨天签过到
+		if(yesterdayCount>0){//昨天签过到
+			if(currDaysignCount>0){//今天已经签过到了
+				memberSignDao.updateMemberInfoToLastSignByPk(PK, sysDate);//今天已经签过,只修改最后一次签到时间
+			}else{
+				memberSignDao.updateMemberInfoToLastSignAndSignDaysByPk(PK, sysDate, "IFNULL(SignDays, 0)+1");//昨天签过到	累加连续签到天数
+			}
+		}else{//昨天没有签过到  跟新最后一次签到时间和连续签到天数
+			if(currDaysignCount>0){//今天已经签过到了
+				memberSignDao.updateMemberInfoToLastSignByPk(PK, sysDate);//今天已经签过,只修改最后一次签到时间
+			}else{
+				memberSignDao.updateMemberInfoToLastSignAndSignDaysByPk(PK, sysDate, "1");//今天没有签过到(昨天也没有签到),修改最后一次签到时间   和   连续签到天数(连续签到天数:1)
+			}
+		}
+		//-----------------------------------最有一次签到时间和连续签到天数 end -----------------------------------
+		
+		//会员签到信息表  添加一条记录
+		memberSignDao.insertMemberSign(PK, sysDate);//rows>0 签到成功
+		
+		//打卡签到暂时不加积分
+		
+		Map<String, Object> map = resultMap = memberinfoDao.docard(PK);
+		
+		return resultMap;
+	}
+
+	@Override
+	public List<MemberSign> dogetcard(int PK) {
+		//签到记录
+		if(PK>0){
+			List<MemberSign> list = memberSignDao.findMemberSignByMemberPK(PK);
+			return list;
+		}else{
+			return null;
+		}
+	}
+
+	@Override
+	public boolean updatepwd(int PK, String pwd) {
+		//修改密码
+		boolean flag = false;
+		if(PK > 0 && pwd != null && !pwd.equals("")){
+			int rows = memberinfoDao.updatePassword(PK, pwd);
+			if(rows > 0){
+				flag = true; 
+			}else{
+				flag = false;
+			}
+		}else{
+			flag = false;
+		}
+		return flag;
+	}
+
+	@Override
+	public String getPwdByTel(String Tel) {
+		//找回密码
+		if(CommentUtils.isNull(Tel)){
+			String pwd = memberinfoDao.findPwdByTel(Tel);
+			return pwd;
+		}else{
+			return null;
+		}
+		
+	}
+
+	@Override
+	public boolean updatePet(int PK, String Pet) {
+		//修改昵称
+		boolean flag = false;
+		if(PK > 0 && Pet != null && !Pet.equals("")){
+			int rows = memberinfoDao.updatePetByPK(PK, Pet);
+			//MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(PK);
+			//===================== 网易通讯 同步名称 begin =====================
+			Map<String, String> paramMap = new HashMap<String, String>();
+			paramMap.put("name", Pet);
+			String result = nimserver.updateUinfo(PK+"", paramMap);
+			System.err.println(result);
+			//===================== 网易通讯 同步名称 end =====================
+			
+			if(rows > 0){
+				flag = true; 
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateArea(int PK, int Area) {
+		//修改地区
+		boolean flag = false;
+		if(PK > 0 && Area > 0){
+			int rows = memberinfoDao.updateAreaByPK(PK, Area);
+			if(rows > 0){
+				flag = true; 
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateMemberhphoto(String pk, String hphoto) {
+		boolean flag = false;
+		
+		int memberPk = Integer.parseInt(pk);
+		if(memberPk > 0) {
+			int rows = memberinfoDao.updateMemberhphotoByPk(memberPk, hphoto);
+			if(rows > 0){
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateMemberToken(int pk, String token) {
+		boolean flag = false;
+		if(pk > 0) {
+			int rows = memberinfoDao.updateMemberTokenByPk(pk, token);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateMemberPhone(int pk, String phone) {
+		boolean flag = false;
+		if(pk > 0) {
+			int rows = memberinfoDao.updateMemberPhoneByPk(pk, phone);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public int verifyPhone(String phone) {
+		//1:已经存在 2:不存在 3:异常
+		int code = 0; 
+		if(phone != null && !phone.equals("")) {
+			int count = memberinfoDao.getCountToMemberinfoByTel(phone);
+			if(count > 0) {
+				code = 1;
+			}else {
+				code = 2;
+			}
+		} else {
+			code = 3;
+		}
+		return code;
+	}
+
+	@Override
+	public MemberInfo getUserInfo(int pk) {
+		if(pk > 0) {
+			MemberInfo memberinfo = memberinfoDao.getMemberInfoByPk(pk);
+			return memberinfo;
+		}else {
+			return null;
+		}
+	}
+
+	@Override
+	public String getUserName(int pk) {
+		if(pk > 0) {
+			String pet = memberinfoDao.findMemberPetByPk(pk);
+			return pet;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean addCoinI(int memberpk, double coin) {
+		boolean flag = false;
+		if(memberpk > 0 && coin > 0) {
+			int rows = memberinfoDao.addMemberCoinI(memberpk, coin);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public int doModelRegister(MemberInfo memberinfo) {
+		DbConnection db = new DbConnection();
+		CachedRowSet rs = null;
+		String sql = "";
+		try {
+			//注册
+			if(CommentUtils.isNull(memberinfo.getTel()) && CommentUtils.isNull(memberinfo.getPass())){
+				//经济人PK
+				int register_brokepk = 1;
+				//经济人会员PK
+				int register_bmemberpk = 1;
+				
+				//根据推荐人   指定注册人的经纪人
+				int introducerpk = memberinfo.getIntroducerpk();
+				MemberInfo member = memberinfoDao.findMemberinfoByPK(introducerpk);
+				int membtype = member.getMembtype();
+				
+				//推荐人是经纪人
+				if (membtype == Constants.MEMTYPE_JinJiRen) {
+					sql = "select pk, memberpk from BrokerInfor where memberpk = " + introducerpk;
+					rs = db.executeQuery(sql);
+					if(rs!=null && rs.next()) {
+						register_brokepk = rs.getInt("pk");
+						register_bmemberpk = rs.getInt("memberpk");
+					}
+				}
+				//推荐人是模特
+				else if(membtype == Constants.MEMTYPE_Model) {
+					sql = "select BrokePK, BMemberPK from modelinfo where MemberPK = " + introducerpk;
+					rs = db.executeQuery(sql);
+					if(rs!=null && rs.next()) {
+						register_brokepk = rs.getInt("brokepk");
+						register_bmemberpk = rs.getInt("bmemberpk");
+					}
+				}
+				
+				int pk = memberinfoDao.insertMemberinfoByModelRegister(memberinfo);
+				if(pk > 0) {
+					//添加模特账号
+					modelInfoService.doModelRegister(pk, memberinfo.getPet(), register_brokepk, register_bmemberpk);
+				}
+				return pk;
+			}else{
+				return -1;
+			}
+		} catch (SQLException e) {
+			return -2;
+		} finally{
+			db.close(rs);
+		}
+	}
+
+	@Override
+	public int getMemberpkByTel(String tel) {
+		return memberinfoDao.findMemberpkByTel(tel);
+	}
+
+	@Override
+	public boolean modifypwd(String mobile, String pass) {
+		boolean flag = false;
+		if(mobile!=null && !mobile.equals("") && pass!=null && !mobile.equals("")) {
+			int rows = memberinfoDao.updateMemberSetPassByPhone(mobile, pass);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean addDefriendModel(Nexus nexus) {
+		boolean flag = false;
+		if(nexus.getMemberpk() > 0 && nexus.getModelpk() > 0) {
+			int i = memberinfoDao.insertNexus(nexus);
+			if(i > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean removeDefriendModel(Nexus nexus) {
+		boolean flag = false;
+		if(nexus.getPk() > 0) {
+			int i = memberinfoDao.deleteNexus(nexus);
+			if(i > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Page<List<Nexus>> getDefriendModel(Nexus nexus, int index, int size) {
+		if(nexus.getMemberpk() > 0) {
+			return memberinfoDao.findNexusByPage(nexus, index, size);
+		}else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<Nexus> getAllNexus(Nexus nexus) {
+		if(nexus.getMemberpk() > 0) {
+			return memberinfoDao.findNexusAll(nexus);
+		}else {
+			return null;
+		}
+	}
+
+}

+ 99 - 0
src/main/java/com/thmodel/service/impl/ModelCardServiceImpl.java

@@ -0,0 +1,99 @@
+package com.thmodel.service.impl;
+
+import java.util.List;
+
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelCardDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelCardDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.entity.ModelCard;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.ModelCardService;
+
+public class ModelCardServiceImpl implements ModelCardService{
+	
+	private static ModelCardDao modelCardDao = new ModelCardDaoImpl();//模卡dao
+	private static ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();//人才dao
+	private static MemberinfoDao memberInfoDao = new MemberinfoDaoImpl();//人才dao
+	
+	MemberinfoService memberinfoService = new MemberinfoServiceImpl();
+	
+	@Override
+	public List<ModelCard> getMCard() {
+		List<ModelCard> list = modelCardDao.findModelCardAll();
+		return list;
+	}
+
+	@Override
+	public boolean setMCard(int ModelPK, int ModelCardPK) {
+		boolean flag = false;
+		if(ModelPK > 0 &&  ModelCardPK> 0){
+			int rows = modelInfoDao.updateModelInfoSetCardPK(ModelPK, ModelCardPK);
+			if(rows > 0){
+				flag = true;
+			}else{
+				flag = false;
+			}
+		}else{
+			flag = false;
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean clearMCard(int ModelPK) {
+		boolean flag = false;
+		if(ModelPK > 0 ){
+			int rows = modelInfoDao.updateModelInfoClearMCard(ModelPK);
+			if(rows > 0){
+				flag = true;
+			}else{
+				flag = false;
+			}
+		}else{
+			flag = false;
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateModelCard(int modelpk, String name, String age, String area, String hei, String wei, String wai,
+			String bust, String hip, String lname, String vprice) {
+ 		boolean flag = false;
+		if(modelpk > 0) {
+			
+			if(!name.equals("") || !age.equals("") || !area.equals("")) {
+				
+				//修改名字同步网易云
+				if(!name.equals("")) {
+					int memberpk = modelInfoDao.getMemberpkByModelpk(modelpk);
+					if(memberpk > 0) {
+						memberinfoService.updatePet(memberpk, name);	
+					}
+				}
+				
+				int rows = memberInfoDao.updateMemberInfoByModelPk(modelpk, name, age, area);
+				if(rows > 0) {
+					flag = true;
+				}else {
+					flag = false;
+				}
+			}
+			if(!hei.equals("") || !wei.equals("") || !wai.equals("") || !bust.equals("") || !hip.equals("") || !lname.equals("") || !vprice.equals("")) {
+				int rows = modelInfoDao.updateModelInfoByModelPk(modelpk, hei, wei, wai, bust, hip, lname, null, vprice);
+				if(rows > 0) {
+					flag = true;
+				}else {
+					flag = false;
+				}
+			}
+		}
+		return flag;
+		
+	}
+	
+	
+	
+}

+ 886 - 0
src/main/java/com/thmodel/service/impl/ModelInfoServiceImpl.java

@@ -0,0 +1,886 @@
+package com.thmodel.service.impl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.constants.Recursion;
+import com.thmodel.dao.DataTypeInfoDao;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.impl.DataTypeInfoDaoImpl;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.ChatRecord;
+import com.thmodel.entity.HonorInfo;
+import com.thmodel.entity.ModelAct;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.ModelPhoto;
+import com.thmodel.entity.ModelPrice;
+import com.thmodel.entity.ModelPrivate;
+import com.thmodel.entity.ModelPrivateDiscuss;
+import com.thmodel.entity.ModelPrivateItem;
+import com.thmodel.entity.ReportInfo;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.MyDateUtil;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+import com.thmodel.page.Page;
+
+public class ModelInfoServiceImpl implements ModelInfoService {
+
+	private static ModelInfoDao 				modelinfodao 			= new ModelInfoDaoImpl();
+	
+	private static MemberinfoDao 				memberinfoDao 			= new MemberinfoDaoImpl();
+	
+	private static DataTypeInfoDao 				dataTypeInfoDao 		= new DataTypeInfoDaoImpl();
+	
+	private static NimserverServiceImpl 		nimserverService 		= new NimserverServiceImpl();
+
+	@Override
+	public Map<String, Object> dogetmodel(int memberpk, int index, int size) {
+
+		return modelinfodao.getmodel(memberpk, index, size);
+		
+	}
+
+	@Override
+	public Map<String, Object> getmodelfan(int pk, int index, int size) {
+
+		if (pk > 0) {
+			return modelinfodao.getmodelfan(pk, index, size);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public Map<String, Object> getmodelstar(int memberpk, int star, int index, int size) {
+		if (star >= 0) {
+			return modelinfodao.modelstar(memberpk, star, index, size);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<ModelAct> geart(int ModelPK) {
+		if (ModelPK > 0) {
+			return modelinfodao.getModelActListByModelPK(ModelPK);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<Map<String, Object>> getfan(int ModelPK) {
+		if (ModelPK > 0) {
+			return modelinfodao.getfan(ModelPK);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<ModelPrice> getprice(int ModelPK) {
+		if (ModelPK > 0) {
+			return modelinfodao.getprice(ModelPK);
+		} else {
+			return null;
+
+		}
+	}
+
+	@Override
+	public List<ChatRecord> getchat(int ModelPK, Integer PK) {
+
+		if (ModelPK > 0) {
+			return modelinfodao.findChatRecordByModelPkAndMemberPK(ModelPK, PK);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public boolean putchat(String CDate, String ModelPK, String MemberPK, String chat, String CType) {
+		int pk = modelinfodao.insertChatRecord(CDate, ModelPK, MemberPK, chat, CType);
+		if (pk > 0) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	@Override
+	public List<HonorInfo> getHonor(int ModelPK) {
+		if (ModelPK > 0) {
+			List<HonorInfo> list = modelinfodao.findHonorInfoByModelPk(ModelPK);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<String> getHonorName(int ModelPK) {
+		List<String> resultList = new ArrayList<String>();
+		if (ModelPK > 0) {
+			List<HonorInfo> list = modelinfodao.findHonorInfoByModelPk(ModelPK);
+			for (HonorInfo honorInfo : list) {
+				resultList.add(honorInfo.getHonor());
+			}
+			return resultList;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean addHonor(int ModelPK, String Honors) {
+		boolean flag = false;
+		if (ModelPK > 0 && CommentUtils.isNull(Honors)) {
+			
+			//解析Honors
+			//格式		"[{\"honor\":\"这是我的荣誉我\"}, {\"honor\":\"这是我的荣誉\"}, {\"honor\": \"honor3\"}]"
+			List<String> honorList = new ArrayList<String>();
+			JSONArray JsonArr = JSONArray.fromObject( Honors );	
+			JSONObject tmpJson;
+			for (int i=0; i<JsonArr.size(); i++ )
+			{ 
+				tmpJson = (JSONObject)JsonArr.get(i);
+				String value = tmpJson.getString("honor");
+				if(value!=null && !value.equals("")) {
+					honorList.add(value);
+				}
+			}
+			
+			if(honorList.size() > 0) {
+				
+				//删除这个模特的所有荣誉
+				modelinfodao.deleteHonorInfo(ModelPK);
+				
+				int pk = modelinfodao.insertHonorInfo(ModelPK, honorList);
+				if (pk > 0) {
+					flag = true;
+				}
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> getBroke(int BrokePK) {
+		if (BrokePK > 0) {
+			Map<String, Object> resultMap = modelinfodao.findBrokeInforByPk(BrokePK);// 查询经纪人信息
+			return resultMap;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public Map<String, Object> qryBroke(String LikeName, int index, int size) {
+		
+		return modelinfodao.findBrokeInforLikeName(LikeName, index, size);
+
+	}
+
+	@Override
+	public boolean appBroke(int ModelPK, int BrokePK, int MemberPK) {
+		boolean flag = false;
+		if (ModelPK > 0 && BrokePK > 0 && MemberPK > 0) {
+			int rows = modelinfodao.updateModelInfoSetBrokeByPk(ModelPK, BrokePK, MemberPK);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> qryModel(int memberpk, int brokePk, int index, int size) {
+		if (brokePk > 0) {
+			return modelinfodao.findModelByBrokePk(memberpk, brokePk, index, size);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public Map<String, Object> getQueryModel(int memberpk, String likeName, int index, int size) {
+		return modelinfodao.findModelInfoByName(memberpk, likeName, index, size);
+	}
+
+	@Override
+	public Page<List<Map<String, Object>>> getPrivate(int modelPk, int memberpk, int index, int size) {
+		
+		Page<List<Map<String, Object>>> resultPage = new Page<List<Map<String, Object>>>();
+		
+		//data
+		List<Map<String, Object>> resultMapList = new ArrayList<Map<String, Object>>();
+		if (modelPk > 0) {
+			Page<List<ModelPrivate>> page = modelinfodao.findModelPrivateByModelPk(modelPk, memberpk, index, size);
+			int count = page.getCount();
+			
+			List<ModelPrivate> privateList = page.getData();// 空间动态
+			
+			List<ModelPrivateItem> privateItemList = null;// 空间明细(图片)
+			List<ModelPrivateDiscuss> privateInfoList = null;// 点赞列表
+			List<ModelPrivateDiscuss> privateDiscussList = null;// 空间评论
+			
+			Date pdatePrev = null;// 记录上一个的时间
+			
+			if(index > 1) {
+				//不是第一页
+				int prev_index = index - 1;
+				
+				StringBuffer sql = new StringBuffer();
+				sql.append("select * from (");
+				sql.append("	select * from (");
+				sql.append("		select pdate from modelprivate where modelpk = 2 order by pdate desc");
+				sql.append("	)t0_  limit "+((prev_index - 1) * size)+", "+ size);
+				sql.append(")t1_ order by pdate limit 1");
+				
+				pdatePrev = new DbConnection().queryOneDate(sql.toString());
+				
+			}
+			for (ModelPrivate modelPrivate : privateList) {
+				int privatePk = modelPrivate.getPk();
+				privateItemList = modelinfodao.findModelPrivateItemByPrivatePk(privatePk);
+
+				privateInfoList = modelinfodao.getPraiseByPrivatePk(privatePk);
+
+				privateDiscussList = modelinfodao.findModelPrivateDiscussByPrivatePk(privatePk);
+
+				Map<String, Object> resultMap = new HashMap<String, Object>();
+				resultMap.put("privatepk", privatePk);
+				resultMap.put("islikes", modelPrivate.getIslikes());
+				resultMap.put("pdate", MyDateUtil.format(modelPrivate.getPdate(), MyDateUtil.DATE_FORMAT_1));
+				resultMap.put("intro", modelPrivate.getIntro());
+
+				// 判断是否跟上一个相同
+				boolean isDay = MyDateUtil.isSameDay(pdatePrev, modelPrivate.getPdate());
+				pdatePrev = modelPrivate.getPdate();
+				resultMap.put("isditto", isDay ? 1 : 0);
+
+				List<Map<String, Object>> result_iteminfoList = new ArrayList<Map<String, Object>>();
+				for (ModelPrivateItem mpi : privateItemList) {
+					Map<String, Object> map = new HashMap<String, Object>();
+					map.put("iteminfopk", mpi.getPk());
+					map.put("url", mpi.getUrl());
+					map.put("ftype", mpi.getFtype());
+					result_iteminfoList.add(map);
+				}
+
+				List<Map<String, Object>> result_privateInfoList = new ArrayList<Map<String, Object>>();
+				for (ModelPrivateDiscuss mpd : privateInfoList) {
+					Map<String, Object> map = new HashMap<String, Object>();
+					map.put("memberpk", mpd.getMemberpk());
+					map.put("idate", MyDateUtil.format(mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
+					result_privateInfoList.add(map);
+				}
+
+				List<Map<String, Object>> result_recordInfoList = Recursion.getRecordInfo(privateDiscussList);
+
+				resultMap.put("iteminfo", result_iteminfoList);
+				resultMap.put("privateinfo", result_privateInfoList);
+				resultMap.put("recordinfo", result_recordInfoList);
+
+				resultMapList.add(resultMap);
+			}
+			resultPage.setData(resultMapList);
+			resultPage.setCount(count);
+			return resultPage;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public int addPrivate(int modelPk, String intro) {
+		int pk = 0;
+		if (modelPk > 0) {
+			pk = modelinfodao.insertModelPrivate(modelPk, intro);
+		}
+		return pk;
+	}
+
+	@Override
+	public boolean addPrivateItem(int privatePk, String url, String fType) {
+		boolean flag = false;
+		if (privatePk > 0) {
+			int pk = modelinfodao.insertModelPrivateItem(privatePk, url, fType);
+			if (pk > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean praisePrivate(int privatePk, int memberPk) {
+		boolean flag = false;
+		if (privatePk > 0 && memberPk > 0) {
+			
+			//判断是否点赞
+			// 先判断有没有点赞 false 没有点赞
+			boolean isLikes = modelinfodao.findLikes(memberPk, privatePk);
+			if(!isLikes) {
+				int pk = modelinfodao.praisePrivate(privatePk, memberPk);
+				if (pk > 0) {
+					flag = true;
+				}
+			}else {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean addPrivateRecord(int privatePk, int memberPk, int RecordInfoPK, String intro) {
+		boolean flag = false;
+		if (privatePk > 0 && memberPk > 0) {
+			int pk = modelinfodao.insertModelPrivateDiscuss(privatePk, memberPk, RecordInfoPK, intro);
+			if (pk > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> getModelFigure(int modelPk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		if (modelPk > 0) {
+
+			// 获取自评
+			List<Map<String, Object>> selfFigureList = modelinfodao.findSelfFigure(modelPk);
+
+			// 获取用户印象
+			List<Map<String, Object>> customImageList = modelinfodao.findCustomImage(modelPk);
+
+			// 用户评价(不是自评就是用户评价)
+			List<Map<String, Object>> customFigureList = modelinfodao.findCustomFigure(modelPk);
+
+			resultMap.put("selffigure", selfFigureList);
+			resultMap.put("customimage", customImageList);
+			resultMap.put("customfigure", customFigureList);
+		}
+		return resultMap;
+	}
+
+	@Override
+	public List<Map<String, Object>> getFigures() {
+		return dataTypeInfoDao.findDataTypeInfoByTypeName(Constants.data_type_4);// 形象标签
+	}
+
+	@Override
+	public Map<String, Object> queryFigureModel(int memberpk, String figurePks, int index, int size) {
+		if (figurePks.length() > 0) {
+			// 如果首字母是逗号,去除
+			figurePks = figurePks.substring(0, 1).equals(",") ? figurePks.substring(1, figurePks.length()) : figurePks;
+			// 如果最后一个字母是逗号,去除
+			figurePks = figurePks.substring(figurePks.length() - 1, figurePks.length()).equals(",")
+					? figurePks.substring(0, figurePks.length() - 1)
+					: figurePks;
+
+			return modelinfodao.findModelByFigurePks(memberpk, figurePks, index, size);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public List<Map<String, Object>> queryMyFigure(int memberPk, int modelPk) {
+
+		if (memberPk > 0 && modelPk > 0) {
+			return modelinfodao.findModelFigureByModelPkAndMemberPk(memberPk, modelPk);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public boolean setModelFigure(int memberPk, int modelPk, String figurePks, int isSelf) {
+		boolean flag = false;
+		if (memberPk > 0 && modelPk > 0 && figurePks.length() > 0 && (isSelf == 0 || isSelf == 1)) {
+			// 如果首字母是逗号,去除
+			figurePks = figurePks.substring(0, 1).equals(",") ? figurePks.substring(1, figurePks.length()) : figurePks;
+			// 如果最后一个字母是逗号,去除
+			figurePks = figurePks.substring(figurePks.length() - 1, figurePks.length()).equals(",")
+					? figurePks.substring(0, figurePks.length() - 1)
+					: figurePks;
+			int rows = modelinfodao.insertModelFigure(memberPk, modelPk, figurePks, isSelf);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> modelInfoByPk(int memberpk, int modelPk) {
+		if (modelPk > 0) {
+			return  modelinfodao.findModelInfoByPk(memberpk, modelPk);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public Map<String, Object> queryPrivateRecord(int privatePk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		if (privatePk > 0) {
+
+			List<ModelPrivateDiscuss> privateInfoList = modelinfodao.getPraiseByPrivatePk(privatePk);// 点赞列表
+			List<ModelPrivateDiscuss> privateDiscussList = modelinfodao.findModelPrivateDiscussByPrivatePk(privatePk);// 评论列表
+
+			List<Map<String, Object>> privateInfoMapList = new ArrayList<Map<String, Object>>();
+			List<Map<String, Object>> recordInfoMapList = Recursion.getRecordInfo(privateDiscussList);
+
+			for (ModelPrivateDiscuss mpd : privateInfoList) {
+				Map<String, Object> map = new HashMap<String, Object>();
+				map.put("memberpk", mpd.getMemberpk());
+				map.put("idate", MyDateUtil.format(mpd.getIdate(), MyDateUtil.DATE_FORMAT_1));
+				privateInfoMapList.add(map);
+			}
+			resultMap.put("privateinfo", privateInfoMapList);
+			resultMap.put("recordinfo", recordInfoMapList);
+			return resultMap;
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public List<Map<String, Object>> querySkillFigure() {
+		List<Map<String, Object>> list = dataTypeInfoDao.findDataTypeInfoByTypeName(Constants.data_type_5);// "技能标签"
+		return list;
+	}
+
+	@Override
+	public Map<String, Object> querySkillModel(int memberpk, String skillPks, int index , int size) {
+		if (skillPks.length() > 0) {
+			// 如果首字母是逗号,去除
+			skillPks = skillPks.substring(0, 1).equals(",") ? skillPks.substring(1, skillPks.length()) : skillPks;
+			// 如果最后一个字母是逗号,去除
+			skillPks = skillPks.substring(skillPks.length() - 1, skillPks.length()).equals(",")
+					? skillPks.substring(0, skillPks.length() - 1)
+					: skillPks;
+					
+			return modelinfodao.findDataTypeInfoByPkOrTypeName(memberpk, skillPks, Constants.data_type_5, index, size);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public Page<List<Map<String, Object>>> findModelPrivateLimit(int privatePk, int index, int size) {
+		if (privatePk > 0) {
+			return modelinfodao.findModelPrivateLimit(privatePk, index, size);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public Page<List> findmodel(int memberPk, int index, int size) {
+
+		if (memberPk > 0) {
+			return modelinfodao.findModelInfoAndPhotoInfoList(memberPk, index, size);
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public boolean likes(int memberPk, int privatePk, int type) {
+		boolean flag = false;
+
+		// type 1点赞/2取消点赞
+		if (type == 1) {
+			// 先判断有没有点赞 false 没有点赞
+			boolean isLikes = modelinfodao.findLikes(memberPk, privatePk);
+			if (!isLikes) {
+				int pk = modelinfodao.praisePrivate(privatePk, memberPk);
+				if (pk > 0) {
+					flag = true;
+				}
+			} else {
+				flag = true;
+			}
+
+		} else if (type == 2) {
+			// 先判断有没有点赞 true 已经点赞
+			boolean isLikes = modelinfodao.findLikes(memberPk, privatePk);
+			if (isLikes) {
+				int rows = modelinfodao.notPraisePrivate(privatePk, memberPk);
+				if (rows > 0) {
+					flag = true;
+				}
+			} else {
+				// 没有点赞 但也给返回成功
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean attention(int memberPk, int modelPk, int type) {
+		boolean flag = false;
+
+		// type 1关注/2取消关注
+		if (type == 1) {
+			// 先判断有没有关注 false 没有关注
+			boolean isLikes = modelinfodao.findAttention(memberPk, modelPk);
+			if (!isLikes) {
+				int pk = modelinfodao.insertModelFan(memberPk, modelPk);
+				modelinfodao.updateModelFanSetFCount(modelPk);
+				if (pk > 0) {
+					flag = true;
+				}
+			} else {
+				flag = true;
+			}
+
+		} else if (type == 2) {
+			// 先判断有没有关注 true 已经关注
+			boolean isLikes = modelinfodao.findAttention(memberPk, modelPk);
+			if (isLikes) {
+				int rows = modelinfodao.deleteModelFan(memberPk, modelPk);
+				modelinfodao.updateModelFanSetFCount(modelPk);
+				if (rows > 0) {
+					flag = true;
+				}
+			} else {
+				// 没有关注 但也给返回成功
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public List getSkillData(int modelPk) {
+		if (modelPk > 0) {
+			List<Map<String, Object>> list = modelinfodao.getSkillData(modelPk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean addSkill(int skillpk, int modelpk, String skillphoto, double price, String unit, int orderid) {
+		boolean flag = false;
+		if (skillpk > 0 && price > 0) {
+			int rows = modelinfodao.insertModelPrice(skillpk, modelpk, skillphoto, price, unit, orderid);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean updateSkill(int pk, int modelpk, String skillpk, String skillphoto, String price, String unit,
+			String orderid) {
+		boolean flag = false;
+		if (pk > 0 && modelpk > 0) {
+			int rows = modelinfodao.updateModelPrice(pk, modelpk, skillpk, skillphoto, price, unit, orderid);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> dologin(String username, String pwd) {
+		// 登录
+		if (username != null || pwd != null) {
+			
+			//登录刷新token
+			Map<String, Object> loginInfo = modelinfodao.login(username, pwd);
+			if(loginInfo != null) {
+				int pk = (int) loginInfo.get("pk");
+				String pet = (String) loginInfo.get("pet");
+				nimserverService.refreshOrCreateToken(pk, pet);
+				return modelinfodao.login(username, pwd);
+			} else {
+				return null;
+			}
+			
+		} else {
+			return null;
+		}
+
+	}
+
+	@Override
+	public List<Map<String, Object>> getModelStyle(int modelpk) {
+		if (modelpk > 0) {
+			List<Map<String, Object>> list = modelinfodao.findSelfFigure(modelpk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean setModelStyle(int modelpk, String stylepks) {
+		boolean flag = false;
+		if (modelpk > 0 && stylepks.length() > 0) {
+			// 分割成String数组
+			String[] stylepkArr = stylepks.split(",");
+			if (stylepkArr.length > 0) {
+
+				int[] stylepkArrInt = new int[stylepkArr.length];
+
+				// 转换成int数组
+				for (int i = 0; i < stylepkArr.length; i++) {
+					stylepkArrInt[i] = Integer.parseInt(stylepkArr[i]);
+				}
+
+				// 删除人才的所有风格标签
+				modelinfodao.deleteModelStyleAll(modelpk);
+
+				// 添加人才的所有标签
+				int rows = modelinfodao.insertModelStyle(modelpk, stylepkArrInt);
+				if (rows > 0) {
+					flag = true;
+				}
+			}
+
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean removeModelSkill(int modelpk, int skillpk) {
+		boolean flag = false;
+		if (modelpk > 0 && skillpk > 0) {
+			int rows = modelinfodao.deleteModelPrice(modelpk, skillpk);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public int doModelRegister(int memberpk, String name, int BrokePK, int BMemberPK) {
+		int modelpk = modelinfodao.insertModelInfo(memberpk, name, BrokePK, BMemberPK);
+		return modelpk;
+	}
+
+	@Override
+	public List getModelPhoto(int modelpk) {
+		if (modelpk > 0) {
+			List<ModelPhoto> list = modelinfodao.findModelPhotoByModelPk(modelpk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean addModelPhoto(int modelpk, String photo, int ordid) {
+		boolean flag = false;
+		if(modelpk > 0 && photo!=null && !photo.equals("")) {
+			
+			String[] photos = photo.split(",");
+			int pk = modelinfodao.insertModelPhoto(modelpk, photos, ordid);
+			if(pk > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean deleteModelPhoto(String modelphotopks, int modelpk) {
+		boolean flag = false;
+		if(modelphotopks.length() > 0 && modelpk > 0) {
+			int rows = modelinfodao.deleteModelPhoto(modelphotopks, modelpk);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public List getModelData(int modelpk) {
+		if(modelpk > 0) {
+			List list = modelinfodao.getModelData(modelpk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean verifyModelPhone(String phone) {
+		
+		boolean flag = false; 
+		if(phone != null && !phone.equals("")) {
+			int count = modelinfodao.verifyModelPhone(phone);
+			if(count == 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public int findModelPrivateCount(int privatePk) {
+		//获取订单 总数量
+		
+		if(privatePk > 0) {
+			return modelinfodao.findModelPrivateCount(privatePk);
+		} else {
+			return 0;
+		}
+		
+	}
+
+	@Override
+	public Map<String, Object> getModelLoginInfo(int modelpk) {
+		if (modelpk > 0) {
+			return modelinfodao.getModelLoginInfo(modelpk);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public Page<List> findModelLikesLimit(int privatePk, int index, int size) {
+		if (privatePk > 0) {
+			return modelinfodao.findModelLikesLimit(privatePk, index, size);
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public boolean putOnline(int modelpk, int online) {
+		boolean flag = false;
+		if(modelpk > 0) {
+			int rows = modelinfodao.updateModelOnlineByModelpk(modelpk, online);
+			if(rows >= 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean removeModelPrivate(int privatepk) {
+		boolean flag = false;
+		if(privatepk > 0) {
+			int rows = modelinfodao.deleteModelPrivateByPk(privatepk);
+			if(rows > 0) {
+				modelinfodao.deleteModelPrivateItemByPrivatepk(privatepk);
+				modelinfodao.deleteModelPrivateDiscussByPrivatepk(privatepk);
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> getModelVPrice(int memberpk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		
+		String msg = "";
+		double vprice = 0;
+		
+		int modelpk = modelinfodao.getModelpkByMemberpk(memberpk);
+		if(modelpk > 0) {
+			msg = Constants.success;
+			ModelInfo model = modelinfodao.findModelByPk(modelpk);
+			vprice = model.getVprice();
+		} else {
+			msg = Constants.fail;
+		}
+		resultMap.put("msg", msg);
+		resultMap.put("vprice", vprice);
+		resultMap.put("modelpk", modelpk);
+		
+		return resultMap;
+	}
+
+	@Override
+	public boolean setModelHasRed(int modelpk, int hasred) {
+		boolean flag = false;
+		if(modelpk > 0 && (hasred == 1 || hasred == 0)) {
+			int rows = modelinfodao.updateModelSetHasRedByModel(modelpk, hasred);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean isModel(int memberpk) {
+		boolean flag = false;
+		if(memberpk > 0) {
+			int count = memberinfoDao.findMemberIsModel(memberpk);
+			if(count > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public String getNewMemQrCode() {
+		return memberinfoDao.getNewMemQrCode();
+	}
+
+	@Override
+	public boolean doAddReport(ReportInfo reportInfo) {
+		boolean flag = false;
+		if(reportInfo != null && reportInfo.getAccuserpk() > 0 && reportInfo.getAppelleepk() > 0) {
+			reportInfo.setReason(reportInfo.getReason() == null ? "" : reportInfo.getReason());
+			int rows = memberinfoDao.insertReportInfo(reportInfo);
+			if(rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean removeComments(int privatepk, int modelprivatediscusspk) {
+		boolean flag = false;
+		if(privatepk > 0 && modelprivatediscusspk > 0) {
+			int i = memberinfoDao.deleteModelPrivateDiscuss(modelprivatediscusspk, privatepk);
+			if(i > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+	
+
+}

+ 86 - 0
src/main/java/com/thmodel/service/impl/NimserverServiceImpl.java

@@ -0,0 +1,86 @@
+package com.thmodel.service.impl;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.thmodel.nimserver.Nimserver;
+import com.thmodel.service.NimserverService;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+
+public class NimserverServiceImpl implements NimserverService {
+	
+	Nimserver nimserver = new Nimserver();
+	MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+	//返回json
+	private String returnJson = null;
+	//返回code
+	private String code= null;
+	
+	@Override
+	public String createUser(int pk, String name) {
+			
+		returnJson = nimserver.createUser(pk+"", name);
+		
+		//{"code":200,"info":{"token":"e18fa4bc53cd1e4953b0a4244d027efa","accid":"18","name":"经纪人002"}}
+		JSONObject resultJson = JSONObject.parseObject(returnJson);
+		code = resultJson.get("code").toString();
+		if(code.equals("200")) {
+			JSONObject infoJson = JSONObject.parseObject(resultJson.get("info").toString());
+			String token = infoJson.get("token").toString();
+			//反写token
+			memberinfoDao.updateMemberTokenByPk(pk, token);
+		}
+		return returnJson;
+	}
+
+	@Override
+	public String refreshToken(int pk) {
+		
+		//{"code":200,"info":{"token":"e3e5ce6656f678fb0dd7928f41b0b8c0","accid":"30"}}
+		returnJson = nimserver.refreshToken(pk+"");
+		JSONObject resultJson = JSONObject.parseObject(returnJson);
+		code = resultJson.get("code").toString();
+		if(code.equals("200")) {
+			JSONObject infoJson = JSONObject.parseObject(resultJson.get("info").toString());
+			String token = infoJson.get("token").toString();
+			//反写更新token
+			memberinfoDao.updateMemberTokenByPk(pk, token);
+		}
+		return returnJson;
+	}
+
+	@Override
+	public String update(int accid, String token) {
+		returnJson = nimserver.update(accid+"", token, null);
+		//反写更新token
+		memberinfoDao.updateMemberTokenByPk(accid, token);
+		return returnJson;
+	}
+	
+	
+	@Override
+	public void refreshOrCreateToken(int accid, String name) {
+		String token = "";
+		String result = nimserver.getUinfos(new String[]{accid+""});
+		JSONObject resultJson = JSONObject.parseObject(result);
+		String code = resultJson.get("code").toString();
+		if(code.equals("200")) {
+			String result_refreshToken = nimserver.refreshToken(accid+"");
+			JSONObject refreshToken_Json = JSONObject.parseObject(result_refreshToken);
+			if(refreshToken_Json.get("code").toString().equals("200")) {
+				JSONObject infoObj = (JSONObject) refreshToken_Json.get("info");
+				token = (String)infoObj.get("token");
+			}
+		} else {
+			String result_createUser = nimserver.createUser(accid+"", name);
+			JSONObject createUser_Json = JSONObject.parseObject(result_createUser);
+			if(createUser_Json.get("code").toString().equals("200")) {
+				JSONObject infoObj = (JSONObject) createUser_Json.get("info");
+				token = (String)infoObj.get("token");
+			}
+		}
+		//反写更新token
+		memberinfoDao.updateMemberTokenByPk(accid, token);
+	}
+
+}

+ 339 - 0
src/main/java/com/thmodel/service/impl/OrderServiceImpl.java

@@ -0,0 +1,339 @@
+package com.thmodel.service.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.constants.OrderConstants;
+import com.thmodel.constants.SystemPayConstants;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.OrderRecordDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dao.impl.OrderRecordDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.OrderRecord;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.OrderService;
+import com.thmodel.util.MyDateUtil;
+import com.thmodel.vo.OrderParam;
+
+import com.thmodel.page.Page;
+import com.thmodel.result.ResultProcedure;
+
+public class OrderServiceImpl implements OrderService {
+
+	private static OrderRecordDao orderRecordDao = new OrderRecordDaoImpl();
+	private static ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+	private static MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+
+	@Override
+	public int putOrder(OrderParam model) {
+		// 返回生成的订单编号
+		int pk = orderRecordDao.insertOrderRecord(model);
+		return pk;
+	}
+
+	@Override
+	public Page getOrder(int memberPk, String state, int index, int size) {
+		if (memberPk > 0) {
+			// 全部订单
+			if (state.equals("all")) {
+				return orderRecordDao.findOrderRecordByMemberPk(memberPk, null, index, size);
+			}
+			// 待付款
+			else if (state.equals("1")) {
+				String state_0 = OrderConstants.STATE_CODE_0;
+				return orderRecordDao.findOrderRecordByMemberPk(memberPk, null, index, size, state_0);
+			}
+			// 进行中
+			else if (state.equals("2")) {
+				String state_1 = OrderConstants.STATE_CODE_1;
+				String state_3 = OrderConstants.STATE_CODE_3;
+				return orderRecordDao.findOrderRecordByMemberPk(memberPk, null, index, size, state_1, state_3);
+			}
+			// 已完成
+			else if (state.equals("3")) {
+				String state_5 = OrderConstants.STATE_CODE_5;
+				String state_6 = OrderConstants.STATE_CODE_6;
+				return orderRecordDao.findOrderRecordByMemberPk(memberPk, null, index, size, state_5, state_6);
+			}
+			//取消(用户取消,模特取消)
+			else if(state.equals("4")) {
+				String state_2 = OrderConstants.STATE_CODE_2;
+				String state_4 = OrderConstants.STATE_CODE_4;
+				return orderRecordDao.findOrderRecordByMemberPk(memberPk, null, index, size, state_2, state_4);
+			}
+			else {
+				return null;
+			}
+
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public Page getModelOrder(int modelpk, String state, int index, int size) {
+		if (modelpk > 0) {
+			// 全部订单
+			if (state.equals("all")) {
+				String state_1 = OrderConstants.STATE_CODE_1;
+				String state_3 = OrderConstants.STATE_CODE_3;
+				String state_4 = OrderConstants.STATE_CODE_4;
+				String state_5 = OrderConstants.STATE_CODE_5;
+				String state_6 = OrderConstants.STATE_CODE_6;
+				return orderRecordDao.findOrderRecordByMemberPk(null, modelpk, index, size, state_1, state_3, state_4, state_5, state_6);
+			}
+			// 待接单
+			else if (state.equals("1")) {
+				String state_1 = OrderConstants.STATE_CODE_1;
+				return orderRecordDao.findOrderRecordByMemberPk(null, modelpk, index, size, state_1);
+			}
+			// 进行中
+			else if (state.equals("2")) {
+				String state_3 = OrderConstants.STATE_CODE_3;
+				return orderRecordDao.findOrderRecordByMemberPk(null, modelpk, index, size, state_3);
+			}
+			// 已完成
+			else if (state.equals("3")) {
+				String state_5 = OrderConstants.STATE_CODE_5;
+				String state_6 = OrderConstants.STATE_CODE_6;
+				return orderRecordDao.findOrderRecordByMemberPk(null, modelpk, index, size, state_5, state_6);
+			}
+			else {
+				return null;
+			}
+
+		} else {
+			return null;
+		}
+	}
+	
+
+	@Override
+	public boolean ecorder(int orderPk, String ec, String evaluate) {
+		boolean flag = false;
+		if (orderPk > 0) {
+			int rows = orderRecordDao.updateOrderComment(orderPk, ec, evaluate);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean cancelOrderModel(int orderpk, int modelpk) {
+		//模特取消扣除模特的钱?
+		boolean flag = false;
+		if (orderpk > 0 && modelpk > 0) {
+			// 获取当前订单信息
+			OrderRecord order = orderRecordDao.findOrderRecordByPk(orderpk);
+			
+			int memberpk = order.getMemberpk();
+			double order_coin = order.getCoin();
+			
+			String setState = OrderConstants.STATE_CODE_4;// 模特取消
+			String whereState_1 = OrderConstants.STATE_CODE_1;// 当这个订单状态为 已付款 时
+			String whereState_3 = OrderConstants.STATE_CODE_3;//
+			int rows = orderRecordDao.updateOrderRecordSetStateModelpk(orderpk, modelpk, 0,setState, whereState_1, whereState_3);
+			if (rows > 0) {
+				flag = true;
+				//把订单里面的钱返还给用户
+				//memberinfoDao.updateMemberCoinOToCoinA_Disable()
+				//memberinfoDao.updateMemberCoinOToCoinA(memberpk, order_coin, order_coin);
+				SystemPayConstants sysPay = new SystemPayConstants();
+				sysPay.executeYuZhi_minus(memberpk, order_coin);
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean confirMorderModel(int orderpk, int modelpk) {
+		boolean flag = false;
+		if (orderpk > 0 && modelpk > 0) {
+			String setState = OrderConstants.STATE_CODE_3; // 模特接单
+			String whereState = OrderConstants.STATE_CODE_1;// 当这个订单状态为 客户下单 时
+			
+			int rows = orderRecordDao.updateOrderRecordSetStateModelpk(orderpk, modelpk, 1, setState, whereState);
+			if (rows > 0) {
+				flag = true;
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> payOrder(int orderpk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		boolean flag = false;
+		String desc = "";
+		if (orderpk > 0) {
+
+			// 获取当前订单信息
+			OrderRecord order = orderRecordDao.findOrderRecordByPk(orderpk);
+			
+			int order_memberpk = order.getMemberpk(); // 会员pk
+			double order_coin = order.getCoin(); // 订单金额
+			/*
+			 * int order_modelpk = order.getModelpk(); //人才pk int order_model_memberpk =
+			 * modelInfoDao.getMemberpkByModelpk(order_modelpk);//模特的会员pk
+			 */
+
+			int memberpk = order.getMemberpk();
+			
+			// 订单付款,放到预付款金额里面
+			SystemPayConstants systemPayConstants = new SystemPayConstants();
+			boolean pay_flag = systemPayConstants.executeYuZhi_add(order_memberpk, order_coin);
+			if(pay_flag) {
+				//支付成功
+				
+				String setState = OrderConstants.STATE_CODE_1; // 用户付款
+				// 当这个订单的状态为 这几个 时
+				String whereState_1 = OrderConstants.STATE_CODE_0;
+				int rows = orderRecordDao.updateOrderRecordSetStateMemberpk(orderpk, memberpk, setState, whereState_1);
+				if (rows > 0) {
+					flag = true;
+					modelInfoDao.updateModelSetHasRedByModel(order.getModelpk(), 1);
+				}
+			}else {
+				desc = "余额不足";
+			}
+			
+		}
+		resultMap.put("flag", flag);
+		resultMap.put("orderstate", OrderConstants.getOrderState(orderRecordDao.findOrderRecordByPk(orderpk).getOrderstate()));
+		resultMap.put("desc", desc);
+		
+		return resultMap;
+	}
+
+	@Override
+	public Map<String, Object> cancelOrder(int orderpk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		boolean flag = false;
+		String orderstate = "";
+		if (orderpk > 0) {
+			// 获取当前订单信息
+			OrderRecord order = orderRecordDao.findOrderRecordByPk(orderpk);
+			
+			int memberpk = order.getMemberpk();
+			double order_coin = order.getCoin();
+			String setState = OrderConstants.STATE_CODE_2;// 未付款状态
+			
+			// 当订单状态为一下几种状态 时 可以取消订单
+			String whereState_0 = OrderConstants.STATE_CODE_0;//未付款
+			
+			
+			int rows = orderRecordDao.updateOrderRecordSetStateMemberpk(orderpk, memberpk, setState, whereState_0);
+			if (rows > 0) {
+				flag = true;
+				
+				//把订单里面的钱返还给用户   扣除手续费
+				//updateMemberCoinOToCoinA_Disable()
+				//memberinfoDao.updateMemberCoinOToCoinA(memberpk, order_coin, plus_coin_a);
+				
+				SystemPayConstants sysPay = new SystemPayConstants();
+				sysPay.executeYuZhi_minus(memberpk, order_coin);
+				
+			}
+		}
+		orderstate = OrderConstants.getOrderState(orderRecordDao.findOrderRecordByPk(orderpk).getOrderstate());
+		resultMap.put("flag", flag);
+		resultMap.put("orderstate", orderstate);
+		
+		return resultMap;
+	}
+
+	@Override
+	public Map<String, Object> settlementOrder(int orderpk) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		boolean flag = false;
+		String desc = "";
+		// 获取当前订单信息
+		OrderRecord order = orderRecordDao.findOrderRecordByPk(orderpk);
+		
+		//判断时间是否到订单结束时间?
+		boolean isEndTime = orderRecordDao.isOrderEndTime(order.getPk());
+		if(isEndTime) {
+			if (orderpk > 0) {
+				int accflag = order.getAccflag();
+				//可以结算
+				if(accflag == 1) {
+					int memberpk = order.getMemberpk();
+		
+					String setState = OrderConstants.STATE_CODE_5;// 订单结算
+					String whereState_3 = OrderConstants.STATE_CODE_3;
+					
+					SystemPayConstants sysPay = new SystemPayConstants();
+					ResultProcedure rp = sysPay.procedure(SystemPayConstants.PROCEDURE_TABLENAME_ORDERRECORD, orderpk);
+					/*
+					//订单金额
+					double order_coin = order.getCoin();
+					int order_modelpk = order.getModelpk();
+					//订单模特 的 对应的会员pk
+					int modelMemberpk = modelInfoDao.getMemberpkByModelpk(order_modelpk);
+					//模特收入金额
+					double modelIncome = order_coin;
+					//把订单的钱转给模特;
+					sysPay.systemPay(memberpk, modelMemberpk, 2, modelIncome);
+					//添加模特收入记录
+					AccountRecord ar = new AccountRecord();
+					ar.setMemberpk(modelMemberpk);
+					ar.setStype(AccountConstants.ACCOUNTRECORD_S_TYPE_4);
+					ar.setLinkpk(orderpk);
+					ar.setAtype(AccountConstants.ACCOUNTRECORD_A_TYPE_3);
+					ar.setCoin(modelIncome);
+					ar.setAbs("订单收入记录");
+					sysPay.insertAccountRecord(ar);
+					
+					//添加用户支出记录
+					AccountRecord ar2 = new AccountRecord();
+					ar2.setMemberpk(memberpk);
+					ar2.setStype(AccountConstants.ACCOUNTRECORD_S_TYPE_4);
+					ar2.setLinkpk(orderpk);
+					ar2.setAtype(AccountConstants.ACCOUNTRECORD_A_TYPE_10);
+					ar2.setCoin(order_coin);
+					ar2.setAbs("订单支出记录");
+					sysPay.insertAccountRecord(ar2);
+					*/
+					if(rp.getResult() == 0) {
+						int rows = orderRecordDao.updateOrderRecordSetStateMemberpk(orderpk, memberpk, setState, whereState_3);
+						if (rows > 0) {
+							flag = true;
+							desc = "结算成功";
+						} else {
+							desc = "结算失败,数据异常";
+						}
+					} else {
+						desc = rp.getMessage();
+					}
+				} else {
+					desc = "结算失败,状态异常";
+				}
+			}
+		} else {
+			desc = "未到订单结束时间";
+		}
+		resultMap.put("flag", flag);
+		resultMap.put("desc", desc);
+		return resultMap;
+	}
+
+	@Override
+	public Map getOrderInfo(int orderpk) {
+		if(orderpk > 0) {
+			return orderRecordDao.getOrderInfo(orderpk);
+		} else {
+			return null;
+		}
+	}
+
+	
+
+}

+ 286 - 0
src/main/java/com/thmodel/service/impl/PayServiceImpl.java

@@ -0,0 +1,286 @@
+package com.thmodel.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.constants.Constants;
+import com.thmodel.constants.PayConstants;
+import com.thmodel.constants.SystemPayConstants;
+import com.thmodel.dao.CashRecordDao;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.RedPacketDao;
+import com.thmodel.dao.impl.CashRecordDaoImpl;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dao.impl.RedPacketDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.CashRecord;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.RedPacket;
+import com.thmodel.result.ResultProcedure;
+import com.thmodel.service.PayService;
+
+public class PayServiceImpl implements PayService {
+
+	private static RedPacketDao 		redPacketDao 		= 	new RedPacketDaoImpl();
+	private static MemberinfoDao 		memberinfoDao 		= 	new MemberinfoDaoImpl();
+	private static ModelInfoDao			modelinfoDao 		=	new ModelInfoDaoImpl(); 
+	private static CashRecordDao 		cashRecordDao 		= 	new CashRecordDaoImpl();
+	private static com.thmodel.service.MemberinfoService	memberinfoService 	= 	new MemberinfoServiceImpl();
+
+	@Override
+	public int giveRed(int modelPk, int memberPk, double coin) {
+
+		// 1:发送成功;2:发送失败;3:余额不足
+		int result = 0;
+		// 发红包
+		if (modelPk > 0 && modelPk > 0 && coin > 0) {
+			MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(memberPk);
+			double coinAll = memberinfo.getCoin_a();//发红包者 的 账户总余额
+			double coinOi = memberinfo.getCoin_oi();//冻结金额
+			// 账户余额 大于 发红包的金额
+			if (coinAll - coinOi > coin) {
+				//int rows = memberinfoDao.updateMemberToGiveRed_Disable(memberPk, coin);
+				
+				SystemPayConstants sysPay = new SystemPayConstants();
+				boolean flag = sysPay.executeYuZhi_add(memberPk, coin);
+				
+				if (flag) {
+					// 修改支付金额成功
+					// 1:发送/2:接收
+					int pk = redPacketDao.insertRedPacket(modelPk, memberPk, coin, 1);
+					if (pk > 0) {
+						result = 1;
+					} else {
+						result = 2;
+					}
+				} else {
+					// 修改支付金额失败
+					result = 2;
+				}
+			} else {
+				// 余额不足
+				result = 3;
+			}
+		} else {
+			// 参数异常
+			result = 2;
+		}
+		return result;
+	}
+
+	@Override
+	public boolean receiveRed(int redPacketPk, int modelPk) {
+		// 收红包
+		boolean flag = false;
+		if (redPacketPk > 0 && modelPk > 0) {
+			
+			//获取红包信息
+			RedPacket redPacket = redPacketDao.findRedPacketByPk(redPacketPk);
+			
+			double coin = redPacket.getCoin();// 发红包的金额
+			int memberPk = redPacket.getMemberpk();// 发红包的会员pk
+			
+			// 修改金额
+			//int rows = memberinfoDao.updateMemberToReceiveRed_Disable(redPacketPk, modelPk, memberPk, coin);
+			
+			
+			// 修改红包状态
+			int rows = redPacketDao.updateRedPacket(redPacketPk, modelPk);
+			if (rows > 0) {
+				SystemPayConstants sysPay = new SystemPayConstants();
+				ResultProcedure rp = sysPay.procedure(SystemPayConstants.PROCEDURE_TABLENAME_REDPACKET, redPacketPk);
+				if(rp.getResult() == 0 ) {
+					flag = true;
+				}
+				
+				/*//记录 红包收入  
+				int model_memberpk = modelinfoDao.getMemberpkByModelpk(modelPk);//模特的会员pk
+				AccountRecord ar = new AccountRecord(model_memberpk, AccountConstants.ACCOUNTRECORD_S_TYPE_2, redPacketPk, AccountConstants.ACCOUNTRECORD_A_TYPE_1, coin, "接收红包,关联红包pk");
+				sysPay.insertAccountRecord(ar);
+				
+				//记录 红包支出  
+				AccountRecord ar2 = new AccountRecord(memberPk, AccountConstants.ACCOUNTRECORD_S_TYPE_2, redPacketPk, AccountConstants.ACCOUNTRECORD_A_TYPE_8, coin, "发送红包,关联红包pk");
+				sysPay.insertAccountRecord(ar2);*/
+					
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public List<RedPacket> getGiveRedList(int modelPk) {
+
+		if (modelPk > 0) {
+			List<RedPacket> list = redPacketDao.findRedPacketByModelPk(modelPk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public List<RedPacket> getReceiveRedList(int memberPk) {
+
+		if (memberPk > 0) {
+			List<RedPacket> list = redPacketDao.findRedPacketByMemberPk(memberPk);
+			return list;
+		} else {
+			return null;
+		}
+	}
+
+	@Override
+	public int aliPayOutCash(int modelpk, double fee, String abs, String intro) {
+
+		/*
+		 * 0:参数错误 1:提交成功 2:余额不足 3:提交失败(参数错误)
+		 */
+		int code = 0;
+		if (modelpk > 0 && fee > 0) {
+			
+			int memberpk = modelinfoDao.getMemberpkByModelpk(modelpk);
+			
+			ModelInfo modelinfo = modelinfoDao.findModelByPk(modelpk);
+			MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(memberpk);
+			MemberInfo member = memberinfoDao.findMemberinfoByPK(memberpk);
+			
+			double coin_a = member.getCoin_a();//账户余额
+			double coin_oi = member.getCoin_oi();//冻结金额
+			
+			if (fee <= coin_a - coin_oi) {
+				CashRecord cashRecord = new CashRecord();
+				cashRecord.setMemberpk(memberpk);
+				cashRecord.setFee(fee);
+				cashRecord.setAbs(abs);
+				cashRecord.setIntro(intro);
+				cashRecord.setWid(memberinfo.getWid());
+				cashRecord.setPtype(PayConstants.TYPE_ALIPAY);
+				cashRecord.setPstate(PayConstants.STATE_4);
+				cashRecord.setUsername(modelinfo.getName());
+				cashRecord.setPhone(memberinfo.getPhone());
+				cashRecord.setAccflag(0);
+				int pk = cashRecordDao.insertCashRecord(cashRecord);
+				if (pk > 0) {
+					//提现记录提交 成功
+					
+					//减去余额里的钱
+					memberinfoDao.updateMemberInfoToOutCash(memberpk, fee);
+					
+					code = 1;
+				} else {
+					code = 3;
+				}
+			} else {
+				code = 2;
+			}
+
+		} else {
+			code = 0;
+		}
+
+		return code;
+	}
+
+	@Override
+	public List getOutCash(int memberpk, String type, String state) {
+		if(memberpk > 0) {
+			return cashRecordDao.findCashRecord(memberpk, type, state);
+		}else {
+			return null;
+		}
+	}
+
+	@Override
+	public int aliPaySubmitOrder(int memberpk, String abs, String intro, String totalAmount, String id) {
+		int pk = 0;
+		double fee = Double.parseDouble(totalAmount);
+		if(memberpk > 0 && fee > 0) 
+		{
+			CashRecord cashRecord = new CashRecord();
+			cashRecord.setMemberpk(memberpk);
+			cashRecord.setFee(fee);
+			cashRecord.setAbs(abs);
+			cashRecord.setIntro(intro);
+			cashRecord.setWid(id);
+			cashRecord.setPtype(PayConstants.TYPE_ALIPAY);
+			cashRecord.setPstate(PayConstants.STATE_1);
+			cashRecord.setAccflag(0);
+			pk = cashRecordDao.insertCashRecord(cashRecord);
+		}
+		else
+		{
+			pk = -1;
+		}
+		return pk;		
+	}
+
+	@Override
+	public boolean aliPayCallback(int pk, String orderno, String result) {
+		boolean flag = false;
+		if(pk > 0 && orderno!=null && !orderno.equals("")) {
+			String state = "";
+			if(result.equalsIgnoreCase(Constants.success)) {
+				state = PayConstants.STATE_2;
+			} else if(result.equalsIgnoreCase(Constants.fail)){
+				state = PayConstants.STATE_3;
+			}
+			//修改充值记录状态
+			int rows = cashRecordDao.updateCashRecordSetStateByPkAndWid(pk, orderno, state, 9);
+			
+			//获取充值记录信息
+			CashRecord orderInfo = cashRecordDao.findCashRecordByPkAndWid(pk, orderno);
+			if(rows > 0 && result.equalsIgnoreCase(Constants.success)) {
+				//将充值的金额累加的到用户账号里
+				flag = memberinfoService.addCoinI(orderInfo.getMemberpk(), orderInfo.getFee());
+				SystemPayConstants sysPay = new SystemPayConstants();
+				AccountRecord ar = new AccountRecord(orderInfo.getMemberpk(), AccountConstants.accountrecord_S_TYPE_1, pk, AccountConstants.ACCOUNTRECORD_A_TYPE_7, orderInfo.getFee(), "支付宝充值收入:100%");
+				sysPay.insertAccountRecord(ar);
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public Map<String, Object> aliPayOutCashLoad(int modelpk) {
+		
+		if(modelpk > 0 ) {
+			Map<String, Object> resultMap = new HashMap<String, Object>();
+			
+			ModelInfo modelinfo = modelinfoDao.findModelByPk(modelpk);
+			MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(modelinfo.getMemberpk());
+			
+			resultMap.put("name", modelinfo.getName());
+			resultMap.put("alipayid", memberinfo.getWid());
+			resultMap.put("coin_a", memberinfo.getCoin_a());
+			resultMap.put("coin_use", memberinfo.getCoin_a() - memberinfo.getCoin_oi());
+			
+			return resultMap;
+		}else {
+			return null;
+		}
+		
+	}
+
+	@Override
+	public boolean aliPayOutCashModify(int modelpk, String name, String alipayid) {
+		
+		boolean flag = false;
+		if(modelpk > 0) {
+			int memberpk = modelinfoDao.getMemberpkByModelpk(modelpk);
+			int rows = memberinfoDao.updateMemberWidByMemberpk(memberpk, alipayid);
+			if(rows > 0) {
+				rows = modelinfoDao.updateModelInfoByModelPk(modelpk, null, null, null, null, null, null, name, null);
+				if(rows > 0) {
+					flag = true;
+				}
+			}
+		}
+		return flag;
+	}
+
+}

+ 35 - 0
src/main/java/com/thmodel/service/impl/UtilServerImpl.java

@@ -0,0 +1,35 @@
+package com.thmodel.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.DataTypeInfoDao;
+import com.thmodel.dao.impl.DataTypeInfoDaoImpl;
+import com.thmodel.service.UtilServer;
+
+public class UtilServerImpl implements UtilServer{
+	
+	private static DataTypeInfoDao dataTypeInfoDao = new DataTypeInfoDaoImpl();
+	
+	@Override
+	public List getAreaList() {
+		List<Map<String, Object>> list = dataTypeInfoDao.findDataTypeInfoByTypeName(Constants.data_type_1);
+		return list;
+	}
+
+	@Override
+	public List getStyleList() {
+		List<Map<String, Object>> list = dataTypeInfoDao.findDataTypeInfoByTypeName(Constants.data_type_4);
+		return list;
+	}
+
+	@Override
+	public List getSkillList() {
+		List<Map<String, Object>> list = dataTypeInfoDao.findDataTypeInfoByTypeName(Constants.data_type_5);
+		return list;
+	}
+	
+	
+	
+}

+ 113 - 0
src/main/java/com/thmodel/service/impl/VideoRecordServiceImpl.java

@@ -0,0 +1,113 @@
+package com.thmodel.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import com.thmodel.constants.AccountConstants;
+import com.thmodel.constants.SystemPayConstants;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.VideoRecordDao;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dao.impl.VideoRecordDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.VideoRecord;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.VideoRecordService;
+
+import com.thmodel.page.Page;
+import com.thmodel.result.ResultProcedure;
+
+public class VideoRecordServiceImpl implements VideoRecordService{
+	
+	private static VideoRecordDao videoRecordDao = new VideoRecordDaoImpl();
+	
+	private static ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+	
+	private static SystemPayConstants systemPayConstants =  new SystemPayConstants();
+	
+	@Override
+	public int begVChat(int pk, int modelPk, String begDate, int hasAnswer) {
+		int result_pk = 0;
+		if(pk > 0 && modelPk >0){
+			result_pk = videoRecordDao.insertVideoRecord(pk, modelPk, begDate, hasAnswer);
+		}else {
+			result_pk = -1; 
+		}
+		return result_pk;
+	}
+	
+	@Override
+	public int ansVChat(int videoPk, int memberPk, int modelPk,
+			String begDate, int hasAnswer) {
+		int result_pk = 0;
+		if(memberPk > 0 && modelPk >0){
+			result_pk = videoRecordDao.insertVideoRecord(memberPk, modelPk, begDate, hasAnswer);
+		}else {
+			result_pk = -1; 
+		}
+		return result_pk;
+	}
+
+	@Override
+	public Page<List<Map<String, Object>>> getVideoRecordOrderList(int modelpk, int index, int size) {
+		if(modelpk > 0) {
+			return videoRecordDao.getVideoRecordByModelPk(modelpk, index, size);
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public Page<List<Map<String, Object>>> getMemberVideoRecordOrderList(int memberpk, int index, int size) {
+		if(memberpk > 0) {
+			return videoRecordDao.getVideoRecordByMemberpk(memberpk, index, size);
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public boolean endVChat(int videopk, String duration, double coin) {
+		boolean flag = false;
+		if(videopk > 0) {
+			VideoRecord videoRecord = videoRecordDao.findVideoRecordByPk(videopk);
+			if(videoRecord.getAccflag() != 9) {
+				
+				//修改视频订单信息
+				int rows = videoRecordDao.updateVideoRecordByPk(videopk, duration, coin+"", null, 1);
+				if(rows > 0) {
+					//订单提交成功
+					
+					ResultProcedure resultProcedure = systemPayConstants.procedure(SystemPayConstants.PROCEDURE_TABLENAME_VIDEORECORD, videopk);
+					System.out.println(resultProcedure.getResult());
+					System.out.println(resultProcedure.getMessage());
+					/*
+					VideoRecord videoOrder = videoRecordDao.findVideoRecordByPk(videopk);
+					int payMemberpk = videoOrder.getMemberpk();
+					//获取人才的对应会员pk
+					int incomeMemberpk = modelInfoDao.getMemberpkByModelpk(videoOrder.getModelpk());
+					//付款
+					systemPayConstants.systemPay(payMemberpk, incomeMemberpk, 1, coin);
+					
+					
+					//记录视频订单支出
+					AccountRecord ar = new AccountRecord(payMemberpk, AccountConstants.ACCOUNTRECORD_S_TYPE_3, 0, AccountConstants.ACCOUNTRECORD_A_TYPE_9, coin, null);
+					systemPayConstants.insertAccountRecord(ar);
+					
+					//记录视频订单收入
+					AccountRecord ar2 = new AccountRecord(incomeMemberpk, AccountConstants.ACCOUNTRECORD_S_TYPE_3, 0, AccountConstants.ACCOUNTRECORD_A_TYPE_2, coin, null);
+					systemPayConstants.insertAccountRecord(ar2);
+					*/
+					flag = true;
+				}
+			}else {
+				System.out.println("已处理完毕");
+			}
+		}
+		return flag;
+	}
+
+	
+	
+}

+ 192 - 0
src/main/java/com/thmodel/servlet/ActivityServlet.java

@@ -0,0 +1,192 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.thmodel.constants.ActivityConstants;
+import com.thmodel.constants.Constants;
+import com.thmodel.entity.ParttyInfo;
+import com.thmodel.service.ActivityService;
+import com.thmodel.service.impl.ActivityServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+import net.sf.json.JSONObject;
+
+/**
+ * 活动接口请求名:activity
+ */
+public class ActivityServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 5068821465060006582L;
+	
+	private static ActivityService activityService = new ActivityServiceImpl(); 
+
+	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 {
+			//10最近的活动
+			if(action.equals("dogetpartty")){
+				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;
+				
+				Map<String, Object> map = activityService.getPartty(memberpk, index, size);
+				
+				List<ParttyInfo> list = (List<ParttyInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//10.1	我已参加的活动
+			else if(action.equals("doqrypartty")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//会员pk
+				
+				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 = activityService.qryPartty(pk, index, size);
+				
+				List<ParttyInfo> list = (List<ParttyInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//10.1.1	我未参加的活动
+			else if(action.equals("doqrynotpartty")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//会员pk
+				
+				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 = activityService.qryNotPartty(pk, index, size);
+
+				List<ParttyInfo> list = (List<ParttyInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//10.2	活动报名
+			else if(action.equals("doenroll")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+				int parttyPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ParttyPK")));
+				String people = CommentUtils.myToString(request.getParameter("people"));
+				String tel = CommentUtils.myToString(request.getParameter("Tel"));
+				int pCount = Integer.parseInt(CommentUtils.myToString(request.getParameter("pCount")));
+				String fee = CommentUtils.myToString(request.getParameter("Fee"));
+				
+				Map<String, Object> map = activityService.enroll(pk, parttyPk, people, tel, pCount, fee);
+				int code = (int) map.get("result");
+				
+				if(code == 1){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_SUCCESS);
+				} else if(code == 2) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_1);
+				} else if(code == 0){
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_FAIL);
+				} else if(code == 3) {
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_3);
+				} else if(code == 4) {
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_7);
+				} else if(code == 4){
+					String message = (String)map.get("message");
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", message);
+				} else {
+					resultJson.put("msg", Constants.error);
+					resultJson.put("desc", ActivityConstants.ACTIVITY_DESC_ERROR);
+				}
+			}
+			
+			//10.3	活动签到
+			else if(action.equals("dosignpartty")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));
+				int parttyPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ParttyPK")));
+				boolean flag = activityService.signPartty(pk, parttyPk);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//10.4	获取横幅活动
+			else if(action.equalsIgnoreCase("doGetBanner")) {
+				List<Map<String, Object>> list = activityService.getBanner();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} 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);
+		}
+	}
+
+}

+ 498 - 0
src/main/java/com/thmodel/servlet/MemberInfoServlet.java

@@ -0,0 +1,498 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.thmodel.service.CashRecordService;
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.CashRecordDao;
+import com.thmodel.dao.impl.CashRecordDaoImpl;
+import com.thmodel.entity.AccountRecord;
+import com.thmodel.entity.CashRecord;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.MemberSign;
+import com.thmodel.entity.Nexus;
+import com.thmodel.entity.ReportInfo;
+import com.thmodel.service.AccountRecordService;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.impl.AccountRecordServiceImpl;
+import com.thmodel.service.impl.CashRecordServiceImpl;
+import com.thmodel.service.impl.MemberinfoServiceImpl;
+import com.thmodel.service.impl.ModelInfoServiceImpl;
+import com.thmodel.service.impl.NimserverServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+import com.thmodel.service.NimserverService;
+
+import net.sf.json.JSONObject;
+import com.thmodel.page.Page;
+/**
+ * 会员信息接口请求名:memberInfo
+ * @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");
+				}
+			}
+			
+
+			//获取收入明细
+			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);
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}*/
+			//充值明细
+			/*else if(action.equalsIgnoreCase("getrechargedetails")) {
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+				List list = accountRecordService.getRechargeDetails(memberpk);
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					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);
+			
+		}
+	}
+
+}

+ 91 - 0
src/main/java/com/thmodel/servlet/ModelCardServlet.java

@@ -0,0 +1,91 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.entity.ModelCard;
+import com.thmodel.service.ModelCardService;
+import com.thmodel.service.impl.ModelCardServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+/**
+ * 模卡接口请求名:modelCard
+ * @author Administrator
+ *
+ */
+public class ModelCardServlet extends HttpServlet {
+	
+	private static ModelCardService modelCardService = new ModelCardServiceImpl();
+	
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		// 支持跨域
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+		
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+		
+		JSONObject resultJson = new JSONObject();
+		try {
+			//5	获取模卡列表
+			if(action.equals("dogetmcard")){
+				List<ModelCard> list = modelCardService.getMCard();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//5.1	设定我的模卡
+			else if(action.equals("dosetmcard")){
+				int ModelPK = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				int ModelCardPK = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelCardPK")));//模卡PK
+				boolean flag = modelCardService.setMCard(ModelPK, ModelCardPK);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//5.2	清除我的模卡
+			else if(action.equals("doclearmcard")){
+				int ModelPK = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				boolean flag = modelCardService.clearMCard(ModelPK);
+				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);
+		}
+	}
+
+}

+ 737 - 0
src/main/java/com/thmodel/servlet/ModelInfoServlet.java

@@ -0,0 +1,737 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+import com.thmodel.page.Page;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.entity.ChatRecord;
+import com.thmodel.entity.HonorInfo;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.ModelAct;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.ModelPrice;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.impl.ModelInfoServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+/**
+ * 人才信息接口请求名:modelInfo
+ * @author Administrator
+ *
+ */
+public class ModelInfoServlet extends HttpServlet {
+	
+	private static final long serialVersionUID = 7268358089898373965L;
+	
+	private static ModelInfoService modelInfoService = new ModelInfoServiceImpl();
+	
+	private static ModelInfoDao modelinfodao = new ModelInfoDaoImpl();
+	private static MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		// 支持跨域
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+		
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+		
+		JSONObject resultJson = new JSONObject();
+		try {
+			//4	获取推荐的人才信息(10个)(用于主页)
+			if(action.equalsIgnoreCase("dogetmodel")){
+				
+				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;
+				
+				Map<String, Object> map = modelInfoService.dogetmodel(memberpk, index, size);
+
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.1	获取关注的人才信息(10个)
+			else if(action.equalsIgnoreCase("dogetmodelfan")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//会员pk
+				
+				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 = modelInfoService.getmodelfan(pk, index, size);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.2	获取星级的人才信息(10个)
+			else if(action.equalsIgnoreCase("dogetmodelstar")){
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+				int star = Integer.parseInt(CommentUtils.myToString(request.getParameter("Star")));
+				
+				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 = modelInfoService.getmodelstar(memberpk, star, index, size);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.3	获取人才的视频列表
+			else if(action.equalsIgnoreCase("dogeart")){
+				//人才PK:	ModelPK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				List<ModelAct> list = modelInfoService.geart(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.4	获取人才粉丝列表
+			else if(action.equalsIgnoreCase("dogetfan")){
+				//人才PK:	ModelPK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				List<Map<String, Object>> list = modelInfoService.getfan(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.5	获取人才技能 ---------------------------此接口 即将 作废
+			else if(action.equalsIgnoreCase("dogetprice")){
+				//人才PK:	ModelPK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				List list = modelInfoService.getSkillData(modelPk);
+				//modelInfoService.getprice(modelPk);   此方法 即将 作废
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.6	获取人才聊天记录(最近的50条)
+			else if(action.equalsIgnoreCase("dogetchat")){
+				/** 人才PK:	ModelPK
+				  * 会员PK:	PK
+				  *(如果会员PK为空,则查询当前人才的所有聊天记录)
+				  */
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				Integer pk = CommentUtils.myToInteger(request.getParameter("PK"));
+				List<ChatRecord> list = modelInfoService.getchat(modelPk, pk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.7	提交人才聊天记录
+			else if(action.equalsIgnoreCase("doputchat")){
+				//文字、语音、图片
+				String cDate = CommentUtils.myToString(request.getParameter("CDate"));//时间
+				String modelPk = CommentUtils.myToString(request.getParameter("ModelPK"));//人才PK
+				String memberPk = CommentUtils.myToString(request.getParameter("MemberPK"));//会员PK
+				String chat = CommentUtils.myToString(request.getParameter("chat"));//聊天内容
+				String cType = CommentUtils.myToString(request.getParameter("CType"));//类别
+				
+				boolean flag = modelInfoService.putchat(cDate, modelPk, memberPk, chat, cType);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.8	获取人才的荣誉信息
+			else if(action.equalsIgnoreCase("dogethonor")){
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				List<HonorInfo> list = modelInfoService.getHonor(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.8.1	获取人才的荣誉信息
+			else if(action.equalsIgnoreCase("dogethonorname")){
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				List<String> list = modelInfoService.getHonorName(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.9	人才增加自己的荣誉
+			else if(action.equalsIgnoreCase("doaddhonor")){
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				String honors = CommentUtils.myToString(request.getParameter("Honor"));//荣誉
+				boolean flag = modelInfoService.addHonor(modelPk, honors);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.10	获取经济人信息
+			else if(action.equalsIgnoreCase("dogetbroke")){
+				int brokePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("BrokePK")));
+				
+				Map<String, Object> map = modelInfoService.getBroke(brokePk);
+				if(map != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.11	根据经济人名称查找经济人
+			else if(action.equalsIgnoreCase("doqrybroke")){
+				String likeName = CommentUtils.myToString(request.getParameter("LikeName"));//名称
+				
+				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 = modelInfoService.qryBroke(likeName, index, size);
+
+				List<Map> list = (List<Map>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.12	模特申请加入经济人
+			else if(action.equalsIgnoreCase("doappbroke")){
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				int brokePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("BrokePK")));
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("MemberPK")));
+				boolean flag = modelInfoService.appBroke(modelPk, brokePk, memberPk);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.13	查找经济人的所有模特
+			else if(action.equalsIgnoreCase("doqrymodel")){
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+				int brokePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("BrokePK")));
+				
+				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 = modelInfoService.qryModel(memberpk, brokePk, index, size);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+		
+			//4.13.1	根据名称  模糊查询人才信息
+			else if(action.equalsIgnoreCase("dogetquerymodel")){
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+				String likeName = CommentUtils.myToString(request.getParameter("LikeName"));//名称
+				
+				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 = modelInfoService.getQueryModel(memberpk, likeName, index, size);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.14	查找模特的所有私密空间(10)
+			else if(action.equalsIgnoreCase("dogetprivate")){
+				//人才PK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));
+				//当前会员的pk
+				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;
+				
+				
+				//先获取模特会员账号pk
+				int model_memberpk = modelinfodao.getMemberpkByModelpk(modelPk);
+				MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(model_memberpk);
+				//获取模特头像
+				String hphoto = memberinfo.getHphoto();
+				
+				//空间动态
+				Page<List<Map<String, Object>>> page = modelInfoService.getPrivate(modelPk, memberpk, index, size);
+				
+				if(page != null){
+					List<Map<String, Object>> list = page.getData();
+					int count = page.getCount();
+					
+					resultJson.put("msg", Constants.success);
+					resultJson.put("hphoto", hphoto);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", count);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.15	增加模特的私密空间
+			else if(action.equalsIgnoreCase("doaddprivate")){
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				String intro = CommentUtils.myToString(request.getParameter("Intro"));
+				int pk = modelInfoService.addPrivate(modelPk, intro);
+				if(pk > 0 ){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("privatepk", pk);
+					
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.16	增加私密空间明细
+			else if(action.equalsIgnoreCase("doaddprivateitem")){
+				String modelPk = CommentUtils.myToString(request.getParameter("ModelPK"));//人才PK
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PrivatePK")));//空间PK
+				String url = CommentUtils.myToString(request.getParameter("URL"));//可以是多个
+				String fType = CommentUtils.myToString(request.getParameter("FType"));//文件类型(链接、图片)
+				boolean flag = modelInfoService.addPrivateItem(privatePk, url, fType);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.17	点赞模特的私密空间
+			else if(action.equalsIgnoreCase("dopraiseprivate")){
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PrivatePK")));//空间PK
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//会员PK
+				boolean flag = modelInfoService.praisePrivate(privatePk, memberPk);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.18	评论模特的私密空间
+			else if(action.equalsIgnoreCase("doaddprivaterecord")){
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PrivatePK")));//空间PK
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("PK")));//会员
+				int RecordInfoPK = CommentUtils.myToInt(request.getParameter("RecordInfoPK"));
+				String intro = CommentUtils.myToString(request.getParameter("Intro"));
+				boolean flag = modelInfoService.addPrivateRecord(privatePk, memberPk, RecordInfoPK, intro);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.19	获取人才的标签
+			else if(action.equalsIgnoreCase("dogetmodelfigure")){
+				int modelPk = CommentUtils.myToInt(request.getParameter("ModelPK"));//人才PK
+				Map<String, Object> map = modelInfoService.getModelFigure(modelPk);
+				if(map != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+			
+			//4.20	获取可配的形象标签
+			else if(action.equalsIgnoreCase("dogetfigures")){
+				List<Map<String, Object>> list = modelInfoService.getFigures();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.21	查询符合标签的人才
+			else if(action.equalsIgnoreCase("doqryfiguremodel")){
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));//会员
+				//形象pk  FigurePK,FigurePK,FigurePK,FigurePK...
+				String figurePks = CommentUtils.myToString(request.getParameter("FigurePK"));
+				
+				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 = modelInfoService.queryFigureModel(memberpk, figurePks, index, size);
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.22	查询我设定的人才标签
+			else if(action.equalsIgnoreCase("doqrymyfigure")){
+				int memberPk = CommentUtils.myToInt(request.getParameter("PK"));//会员pk
+				int modelPk = CommentUtils.myToInt(request.getParameter("ModelPK"));//人才PK
+				List<Map<String, Object>> list = modelInfoService.queryMyFigure(memberPk, modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.23	设定人才标签
+			else if(action.equalsIgnoreCase("dosetmodelfigure")){
+				int memberPk = CommentUtils.myToInt(request.getParameter("PK"));//会员pk
+				int modelPk = CommentUtils.myToInt(request.getParameter("ModelPK"));//人才PK
+				int isSelf = CommentUtils.myToInt(request.getParameter("IsSelf"));//人才PK
+				//形象pk  FigurePK,FigurePK,FigurePK,FigurePK...
+				String figurePks = CommentUtils.myToString(request.getParameter("FigurePK"));
+				boolean flag = modelInfoService.setModelFigure(memberPk, modelPk, figurePks, isSelf);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.23.1	根据人才pk 查询人才信息
+			else if(action.equalsIgnoreCase("domodelinfobypk")){
+				int memberpk = CommentUtils.myToInt(request.getParameter("memberpk"));//当前会员PK
+				int modelPk = CommentUtils.myToInt(request.getParameter("ModelPK"));//人才PK
+				
+				Map<String, Object> map = modelInfoService.modelInfoByPk(memberpk, modelPk);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.24	查询私密空间的用户评论
+			else if(action.equalsIgnoreCase("doqryprivaterecord")){
+				int privatePk = CommentUtils.myToInt(request.getParameter("PrivatePK"));//空间PK
+				Map<String, Object> map = modelInfoService.queryPrivateRecord(privatePk);
+				if(map != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.25	查询所有技能标签
+			else if(action.equalsIgnoreCase("doqryskillfigure")){
+				List<Map<String, Object>> list = modelInfoService.querySkillFigure();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.26	查询符合技能的人才
+			else if(action.equalsIgnoreCase("doqryskillmodel")){
+				//技能pk	SkillPK, SkillPK, SkillPK…
+				String skillPks = CommentUtils.myToString(request.getParameter("SkillPK"));
+				
+				int memberpk = CommentUtils.myToInt(request.getParameter("memberpk"));//当前会员PK
+				
+				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 = modelInfoService.querySkillModel(memberpk, skillPks, index, size);
+				
+				List<ModelInfo> list = (List<ModelInfo>) map.get("data");
+				int count = (int) map.get("count");
+				
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", JsonUtils.tofastjson(count));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.27	分页显示评论
+			else if(action.equalsIgnoreCase("findmodelprivatelimit")) {
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("privatePk")));
+				
+				int index = CommentUtils.myToInt(request.getParameter("index"));
+				int size = CommentUtils.myToInt(request.getParameter("size")) ;
+				
+				index = index == 0 ? 1 : index;
+				size = size == 0 ? 10 : size;
+				
+				Page<List<Map<String, Object>>> page = modelInfoService.findModelPrivateLimit(privatePk, index, size);
+				
+				//获取评论总数量
+				//int count = modelInfoService.findModelPrivateCount(privatePk);
+				
+				if(page != null){
+					int count = page.getCount();
+					List<Map<String, Object>> list = page.getData();
+					
+					resultJson.put("msg", Constants.success);
+					resultJson.put("count", count);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//4.27.1 分页显示点赞记录
+			else if(action.equalsIgnoreCase("findmodellikeslimit")) {
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("privatePk")));
+				
+				int index = CommentUtils.myToInt(request.getParameter("index"));
+				int size = CommentUtils.myToInt(request.getParameter("size")) ;
+				
+				index = index == 0 ? 1 : index;
+				size = size == 0 ? 10 : size;
+				
+				Page<List> page = modelInfoService.findModelLikesLimit(privatePk, index, size);
+				
+				int count = page.getCount();
+				
+				List<Map<String, Object>> list = page.getData();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", count);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.28	发现模块
+			else if(action.equalsIgnoreCase("findmodel")) {
+				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;
+				
+				Page<List> page = modelInfoService.findmodel(memberPk, index, size);
+				int count = page.getCount();
+				List<Map<String, Object>> list = page.getData();
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+					resultJson.put("count", count);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.29	个人中心信息获取全部
+			
+			//doGetHonorName
+			//doGetPrice
+			//doGetModelFigure
+			else if(action.equalsIgnoreCase("findmodelallinfo")) {
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
+				System.out.println(modelPk);
+				
+				if(modelPk > 0) {
+					//doGetHonorName
+					List<String> doGetHonorName = modelInfoService.getHonorName(modelPk);
+					//doGetPrice
+					List doGetPrice = modelInfoService.getSkillData(modelPk);
+					//doGetModelFigure
+					Map<String, Object> doGetModelFigure = modelInfoService.getModelFigure(modelPk);
+					
+					resultJson.put("msg", Constants.success);
+					resultJson.put("dogethonorname", JsonUtils.tofastjson(doGetHonorName));
+					resultJson.put("dogetprice", JsonUtils.tofastjson(doGetPrice));
+					resultJson.put("dogetmodelfigure", JsonUtils.tofastjson(doGetModelFigure));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//点赞
+			else if(action.equalsIgnoreCase("likes")) {
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberPk")));//会员pk
+				int privatePk = Integer.parseInt(CommentUtils.myToString(request.getParameter("privatePk")));//空间pk
+				int type = Integer.parseInt(CommentUtils.myToString(request.getParameter("type")));// 1点赞/2取消点赞
+				if(type == 1 || type == 2) {
+					boolean flag = modelInfoService.likes(memberPk, privatePk, type);
+					if(flag){
+						resultJson.put("msg", Constants.success);
+					}else{
+						resultJson.put("msg", Constants.fail);
+					}
+				}else {
+					resultJson.put("msg", Constants.error);
+				}
+			}
+			//关注
+			else if(action.equalsIgnoreCase("attention")) {
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberPk")));//会员pk
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelPk")));//人才pk
+				int type = Integer.parseInt(CommentUtils.myToString(request.getParameter("type")));//1关注/2取消关注
+				if(type == 1 || type == 2) {
+					boolean flag = modelInfoService.attention(memberPk, modelPk, type);
+					if(flag){
+						resultJson.put("msg", Constants.success);
+					}else{
+						resultJson.put("msg", Constants.fail);
+					}
+				}else {
+					resultJson.put("msg", Constants.error);
+				}
+			}
+			
+
+			//修改模特 在线/离线 状态
+			else if(action.equalsIgnoreCase("doPutOnline")) {
+				//模特pk
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				int online = Integer.parseInt(CommentUtils.myToString(request.getParameter("online")));
+				
+				boolean flag = modelInfoService.putOnline(modelpk, online);
+				
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取模特的视频聊天单价
+			else if(action.equalsIgnoreCase("doGetModelVPrice")) {
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));//会员pk
+				
+				Map<String, Object> resultMap = modelInfoService.getModelVPrice(memberpk);
+				String msg = (String)resultMap.get("msg");
+				int modelpk = (int)resultMap.get("modelpk");
+				double vprice = (double)resultMap.get("vprice");
+				
+				resultJson.put("msg", msg);
+				resultJson.put("vprice", vprice);
+				resultJson.put("modelpk", modelpk);
+			}
+			
+		} catch (Exception e) {
+			System.out.println("catch error : " + e.getMessage());
+			resultJson.put("msg", Constants.error);
+		} finally{
+			if(action.equalsIgnoreCase("")){
+				resultJson.put("msg", Constants.error);
+				resultJson.put("value", "参数action不能为空!");
+			}
+			JsonUtils.printWriter(response, resultJson);
+		}
+	}
+
+}

+ 435 - 0
src/main/java/com/thmodel/servlet/OrderServlet.java

@@ -0,0 +1,435 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+import com.thmodel.page.Page;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.constants.OrderConstants;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.VideoRecordDao;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dao.impl.VideoRecordDaoImpl;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.ModelInfo;
+import com.thmodel.entity.VideoRecord;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.OrderService;
+import com.thmodel.service.VideoRecordService;
+import com.thmodel.service.impl.ModelInfoServiceImpl;
+import com.thmodel.service.impl.OrderServiceImpl;
+import com.thmodel.service.impl.VideoRecordServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+import com.thmodel.util.MyDateUtil;
+import com.thmodel.vo.OrderParam;
+
+/**
+ * 订单接口请求名:order
+ * @author 刘迎奥
+ * @version v1.0
+ */
+public class OrderServlet extends HttpServlet {
+	
+	private static final long serialVersionUID = 1L;
+	
+	private static OrderService orderService = new OrderServiceImpl();
+	private static VideoRecordService videoRecordService = new VideoRecordServiceImpl();
+	private static ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+	
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		// 支持跨域
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+		
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+		
+		JSONObject resultJson = new JSONObject();
+		try {
+			
+			//9 订单
+			//http://localhost:8080/thmodel/order?action=doputorder&PK=1&ModelPK=2&BrokerPK=3&LederPK=0&ODate=2018-06-28&SDate=2018-06-28&SCount=4&SName=阿萨德&SPrice=29&coin=29&OrderState=0&intro=asdsafaasdfa&skillpk=1&linkman=liuyingao&linkphone=15856985698&addr=阿斯蒂芬
+			if(action.equals("doputorder")){
+				String memberpk = CommentUtils.myToString(request.getParameter("PK"));			//会员PK
+				String modelpk = CommentUtils.myToString(request.getParameter("ModelPK"));		//人才PK
+				String brokerpk = CommentUtils.myToString(request.getParameter("BrokerPK"));	//经纪人PK
+				String lederpk = CommentUtils.myToString(request.getParameter("LederPK"));		//队长PK
+				//String odate = CommentUtils.myToString(request.getParameter("ODate"));			//订单日期
+				String odate = MyDateUtil.format(new Date(), MyDateUtil.DATE_FORMAT_1);			//订单日期
+				String sdate = CommentUtils.myToString(request.getParameter("SDate"));			//服务日期时间
+				String scount = CommentUtils.myToString(request.getParameter("SCount"));		//服务时长
+				String sname = CommentUtils.myToString(request.getParameter("SName"));			//服务名称
+				String sprice = CommentUtils.myToString(request.getParameter("SPrice"));		//价格
+				String coin = CommentUtils.myToString(request.getParameter("coin"));			//支付费用
+				//String orderstate = CommentUtils.myToString(request.getParameter("OrderState"));//订单状态
+				String orderstate = OrderConstants.STATE_CODE_0;
+				
+				String intro = CommentUtils.myToString(request.getParameter("intro"));			//订单说明
+				
+				String skillpk = CommentUtils.myToString(request.getParameter("skillpk"));		//技能标签PK
+				String linkman = CommentUtils.myToString(request.getParameter("linkman"));		//联系人
+				String linkphone = CommentUtils.myToString(request.getParameter("linkphone"));	//联系方式
+				String addr = CommentUtils.myToString(request.getParameter("addr"));			//工作地点
+				
+				scount = scount.replaceAll("小时", "");
+				
+				OrderParam op = new OrderParam(memberpk, modelpk, brokerpk, lederpk, odate, sdate, scount, sname, sprice, coin, orderstate, intro, skillpk, linkman, linkphone, addr);
+				
+				int pk = orderService.putOrder(op);
+				if(pk > 0){
+					int model_memberpk = modelInfoDao.getMemberpkByModelpk(Integer.parseInt(modelpk));
+					resultJson.put("msg", Constants.success);
+					resultJson.put("orderpk", pk);
+					resultJson.put("model_memberpk", model_memberpk);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+			
+			//9.1  用户端:获取订单
+			else if(action.equalsIgnoreCase("dogetorder")){
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("pk")));//会员PK
+				String state = CommentUtils.myToString(request.getParameter("state"));//订单状态
+				
+				int index = CommentUtils.myToInt(request.getParameter("index"));
+				int size = CommentUtils.myToInt(request.getParameter("size")) ;
+				
+				index = index == 0 ? 1 : index;
+				size = size == 0 ? 10 : size;
+				/*
+					all:全部订单
+					1:待付款
+					2:进行中
+					3:已完成
+					4:取消(用户取消/模特取消)
+				*/
+				
+				if(state.equals("all") || state.equals("1") || state.equals("2") || state.equals("3") || state.equals("4")) {
+					Page page = orderService.getOrder(memberPk, state, index, size);
+					
+					if(page != null){
+						
+						int count = page.getCount();
+						List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
+						
+						resultJson.put("msg", Constants.success);
+						resultJson.put("data", JsonUtils.tofastjson(list));
+						resultJson.put("count", JsonUtils.tofastjson(count));
+					} else {
+						resultJson.put("msg", Constants.fail);
+					}
+				} else {
+					resultJson.put("msg", Constants.error);
+				}
+			}
+			
+			//模特端: 获取订单
+			else if(action.equalsIgnoreCase("dogetmodelorder")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//会员PK
+				String state = CommentUtils.myToString(request.getParameter("state"));//订单状态
+				
+				int index = CommentUtils.myToInt(request.getParameter("index"));
+				int size = CommentUtils.myToInt(request.getParameter("size")) ;
+				
+				index = index == 0 ? 1 : index;
+				size = size == 0 ? 10 : size;
+				
+				/*
+					all:全部订单
+					1:待接单
+					2:进行中
+					3:已完成
+				*/
+				if(state.equals("all") || state.equals("1") || state.equals("2") || state.equals("3")) {
+					Page page = orderService.getModelOrder(modelpk, state, index, size);
+
+					if(page != null){
+						resultJson.put("msg", Constants.success);
+						
+						int count = page.getCount();
+						List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
+						resultJson.put("count", JsonUtils.tofastjson(count));
+						resultJson.put("data", JsonUtils.tofastjson(list));
+					} else {
+						resultJson.put("msg", Constants.fail);
+					}
+				} else {
+					resultJson.put("msg", Constants.error);
+				}
+			}
+				
+			
+			//查看订单详情
+			else if(action.equalsIgnoreCase("doGetOrderInfo")) {
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));//订单PK
+				
+				Map map = orderService.getOrderInfo(orderpk);
+				if(map != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//9.2订单评价
+			else if(action.equalsIgnoreCase("doecorder")){
+				
+				int orderPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));//订单PK
+				String ec = CommentUtils.myToString(request.getParameter("ec"));//客户评价
+				String evaluate = CommentUtils.myToString(request.getParameter("evaluate"));//评价说明
+				boolean flag = orderService.ecorder(orderPk, ec, evaluate);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+			
+			//6.获取视频订单 -模特端
+			else if(action.equalsIgnoreCase("getvideorecordorder")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				
+				int index = CommentUtils.myToInt(request.getParameter("index"));
+				int size = CommentUtils.myToInt(request.getParameter("size")) ;
+				
+				index = index == 0 ? 1 : index;
+				size = size == 0 ? 10 : size;
+				
+				Page<List<Map<String, Object>>> page = videoRecordService.getVideoRecordOrderList(modelpk, index, size);
+				List<Map<String, Object>> list = page.getData();
+				int count = page.getCount();
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("count", count);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取客户端  视屏订单列表
+			else if (action.equalsIgnoreCase("getMemberVideoRecordOrder")) {
+				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;
+				
+				Page<List<Map<String, Object>>> page = videoRecordService.getMemberVideoRecordOrderList(memberpk, index, size);
+				List<Map<String, Object>> list = page.getData();
+				int count = page.getCount();
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("count", count);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//模特 取消 订单
+			else if (action.equals("cancelordermodel")) {
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				boolean flag = orderService.cancelOrderModel(orderpk, modelpk);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//模特 确定 订单
+			else if(action.equals("confirmordermodel")) {
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				boolean flag = orderService.confirMorderModel(orderpk, modelpk);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//9.3 会员 支付 订单
+			else if(action.equals("domemberpayorder")) {
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));
+				Map<String, Object> map = orderService.payOrder(orderpk);
+				
+				boolean flag = (boolean) map.get("flag");
+				String orderstate = (String) map.get("orderstate");
+				String desc = (String) map.get("desc");
+				if (flag) {
+					
+					resultJson.put("msg", Constants.success);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+				resultJson.put("orderstate", orderstate);
+				resultJson.put("desc", desc);
+			}
+			
+			//9.4 会员 取消 订单
+			else if(action.equals("domembercancelorder")) {
+				
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));
+				
+				Map<String, Object> map = orderService.cancelOrder(orderpk);
+				
+				boolean flag = (boolean) map.get("flag");
+				String orderstate = (String) map.get("orderstate");
+				resultJson.put("orderstate", orderstate);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//模特 ->订单结算
+			else if(action.equals("dosettlementorder")) {
+				//订单pk
+				int orderpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("orderpk")));
+				
+				Map<String, Object> resultMap = orderService.settlementOrder(orderpk);
+				String desc = (String)resultMap.get("desc");
+				boolean flag = (boolean)resultMap.get("flag");
+				
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+				resultJson.put("desc", desc);
+			}
+			
+			
+			//6视频聊天
+			else if(action.equals("dobegvchat")){
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("pk")));//会员PK
+				int modelPK = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//人才PK
+				String begDate = CommentUtils.myToString(request.getParameter("begdate"));//开始时间
+				int hasAnswer = Integer.parseInt(CommentUtils.myToString(request.getParameter("hasanswer")));//是否接听
+				
+				int videopk = videoRecordService.begVChat(pk, modelPK, begDate, hasAnswer);
+				if(videopk > 0){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("videopk", videopk + "");
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//6.1接听聊天
+			if(action.equals("doansvchat")){
+				//暂时没用
+				int videoPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("videopk")));	//视频PK	为0表示一发起就接听
+				
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("pk")));		//会员PK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));	//人才PK
+				String begDate = CommentUtils.myToString(request.getParameter("begdate"));					//开始时间
+				int hasAnswer = Integer.parseInt(CommentUtils.myToString(request.getParameter("hasanswer")));//是否接听
+				
+				int videopk = videoRecordService.ansVChat(videoPk, memberPk, modelPk, begDate, hasAnswer);
+				if(videopk > 0){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("videopk", videopk+"");
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//6.2视频聊天结束
+			else if(action.equals("doendvchat")){
+				int videopk = Integer.parseInt(CommentUtils.myToString(request.getParameter("videopk")));//视频PK
+				String duration = CommentUtils.myToString(request.getParameter("duration"));//时长
+				
+				//获取订单信息
+				VideoRecordDao videoRecordDao = new VideoRecordDaoImpl();
+				VideoRecord videoOrder = videoRecordDao.findVideoRecordByPk(videopk);
+				
+				//获取订单的人才信息
+				ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+				ModelInfo modelInfo = modelInfoDao.findModelByPk(videoOrder.getModelpk());
+				
+				//获取订单人才的会员信息
+				MemberinfoDao  memberinfoDao = new MemberinfoDaoImpl();
+				MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(modelInfo.getMemberpk());
+				
+				double coin = Double.parseDouble(duration) * modelInfo.getVprice();
+				
+				
+				boolean flag = videoRecordService.endVChat(videopk, duration, coin);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//6.3视频聊天费用探测
+			else if(action.equals("dovchattest")){
+				int videopk = Integer.parseInt(CommentUtils.myToString(request.getParameter("videopk")));//视频PK
+				String duration = CommentUtils.myToString(request.getParameter("duration"));//时长
+				
+				//获取订单信息
+				VideoRecordDao videoRecordDao = new VideoRecordDaoImpl();
+				VideoRecord videoOrder = videoRecordDao.findVideoRecordByPk(videopk);
+				
+				//获取订单的人才信息
+				ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+				ModelInfo modelInfo = modelInfoDao.findModelByPk(videoOrder.getModelpk());
+				
+				
+				
+				double coin = Double.parseDouble(duration) * modelInfo.getVprice();
+				
+				boolean flag = videoRecordService.endVChat(videopk, duration, coin);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+					
+					resultJson.put("coin", coin);
+					
+					//获取订单会员信息
+					MemberinfoDao  memberinfoDao = new MemberinfoDaoImpl();
+					MemberInfo memberinfo = memberinfoDao.findMemberinfoByPK(videoOrder.getMemberpk());
+					resultJson.put("coinfee", memberinfo.getCoin_a());
+				}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("desc", "参数action不能为空!");
+			}
+			JsonUtils.printWriter(response, resultJson);
+		}
+	}
+
+}

+ 285 - 0
src/main/java/com/thmodel/servlet/PayServlet.java

@@ -0,0 +1,285 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+
+import com.thmodel.alipay.AliPay;
+import com.thmodel.constants.Constants;
+import com.thmodel.constants.PayConstants;
+import com.thmodel.dao.CashRecordDao;
+import com.thmodel.dao.MemberinfoDao;
+import com.thmodel.dao.impl.CashRecordDaoImpl;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.entity.CashRecord;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.entity.RedPacket;
+import com.thmodel.service.PayService;
+import com.thmodel.service.impl.PayServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+
+/**
+ * pay
+ * 
+ * @author Administrator
+ *
+ */
+public class PayServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	private static PayService 			payService 				= 	new PayServiceImpl();
+	private static AliPay 				alipay 					= 	new AliPay();
+	private static MemberinfoDao		memberinfoDao			=	new MemberinfoDaoImpl();
+	private static CashRecordDao		cashRecordDao			=	new CashRecordDaoImpl();
+
+	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+		doPost(request, response);
+	}
+
+	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+		response.setHeader("Access-Control-Allow-Origin", "*");
+
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+
+		JSONObject resultJson = new JSONObject();
+		try {
+			
+			//阿里支付  生成订单
+			if(action.equals("alipay")) {
+				
+				System.out.println("================== ali pay action begin ==================");
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));//会员pk
+				String abs = CommentUtils.myToString(request.getParameter("abs"));//摘要
+				String intro = CommentUtils.myToString(request.getParameter("intro"));//说明
+				
+				//支付宝参数
+				String body = CommentUtils.myToString(request.getParameter("body"));
+				String subject = CommentUtils.myToString(request.getParameter("subject"));
+				String timeoutExpress = CommentUtils.myToString(request.getParameter("timeoutexpress"));
+				String totalAmount = CommentUtils.myToString(request.getParameter("totalamount"));
+				
+				String outTradeNo = alipay.getAliPayOrderId();//订单号
+				
+				//提交充值记录
+				int pk = payService.aliPaySubmitOrder(memberpk, abs, intro, totalAmount, outTradeNo);
+				if(pk > 0) {
+					String responseBody = alipay.aliPayOrder(body, subject, timeoutExpress, totalAmount, outTradeNo, pk);
+					if(responseBody!=null) {
+						resultJson.put("data", responseBody);
+						resultJson.put("paypk", pk);
+						resultJson.put("outtradeno", outTradeNo);
+						resultJson.put("msg", Constants.success);
+					}
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+				System.out.println("================== ali pay action end ==================");
+				
+			} 
+			
+			//支付宝支付成功回调(修改状态为支付成功)
+			else if(action.equals("alipaycallback")){
+				
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("pk")));//充值记录pk
+				String orderno = CommentUtils.myToString(request.getParameter("outtradeno"));//订单号wid
+				String result = CommentUtils.myToString(request.getParameter("result"));//支付结果
+				
+				String source = CommentUtils.myToString(request.getParameter("source"));//来源
+				
+				String sql = "insert into log(pk, orderno, result, source)values('"+pk+"','"+orderno+"','"+result+"','"+source+"')";
+				new DbConnection().executeUpdate(sql);
+				
+				boolean flag = payService.aliPayCallback(pk, orderno, result);
+				
+				//查询
+				CashRecord cashRecord = cashRecordDao.findCashRecordOne(pk);
+				MemberInfo member = memberinfoDao.findMemberinfoByPK(cashRecord.getMemberpk());
+				resultJson.put("coin_a", member.getCoin_a());
+				
+				if (flag) {
+					resultJson.put("msg", Constants.success);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+
+			// 微信冲值
+			else if (action.equals("doincash")) {
+				String PK = CommentUtils.myToString(request.getParameter("PK"));
+				String Fee = CommentUtils.myToString(request.getParameter("Fee"));
+				String Abstract = CommentUtils.myToString(request.getParameter("Abstract"));
+				String Intro = CommentUtils.myToString(request.getParameter("Intro"));
+				String OpenID = CommentUtils.myToString(request.getParameter("OpenID"));
+			}
+			
+			//提现加载
+			else if(action.equals("alipayoutcashload")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				Map<String, Object> map = payService.aliPayOutCashLoad(modelpk);
+				
+				if(map != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//支付宝提现信息修改
+			else if(action.equals("alipayoutcashmodify")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				String name = CommentUtils.myToString(request.getParameter("name"));
+				String alipayid = CommentUtils.myToString(request.getParameter("alipayid"));
+				
+				boolean flag = payService.aliPayOutCashModify(modelpk, name, alipayid);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			
+			//支付宝提现  提交申请
+			else if(action.equals("alipayoutcash")) {
+				
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//模特pk
+				
+				double fee =Double.parseDouble(CommentUtils.myToString(request.getParameter("fee")));//提现金额
+				String abs = CommentUtils.myToString(request.getParameter("abs"));//摘要
+				String intro =CommentUtils.myToString(request.getParameter("intro"));//说明
+				
+				//0:参数错误 1:提交成功 2:余额不足 3:提交失败(参数错误)
+				int code = payService.aliPayOutCash(modelpk, fee, abs, intro);
+				
+				String result = PayConstants.getSubmitCode(code);
+				if(code == 1) {
+					Map<String, Object> map = payService.aliPayOutCashLoad(modelpk);
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", result);
+					resultJson.put("data", map);
+				} else {
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", result);
+				}
+			}
+
+			// 冲值记录(最近20笔)
+			else if (action.equals("dogetincash")) {
+				String PK = CommentUtils.myToString(request.getParameter("PK"));
+			}
+
+			// 取现记录
+			else if (action.equals("dogetoutcash")) {
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));//会员pk
+				String type = CommentUtils.myToString(request.getParameter("type"));
+				String state = CommentUtils.myToString(request.getParameter("state"));
+				if(type.equals("1") || type.equals("2")) {
+					if(type.equals("1")) {
+						type = PayConstants.TYPE_ALIPAY;
+					}else if(type.equals("2")) {
+						type = PayConstants.TYPE_WX;
+					}
+					List list = payService.getOutCash(memberpk, type, state);
+					if(list!=null) {
+						resultJson.put("msg", Constants.success);
+						resultJson.put("data", JsonUtils.tofastjson(list));
+					} else {
+						resultJson.put("msg", Constants.fail);
+					}
+				}else{
+					resultJson.put("msg", Constants.error);
+				}
+			}
+			
+			//获取发送的红包列表
+			else if(action.equals("getgiveredorderlist")) {
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPk")));//人才pk
+				List<RedPacket> list = payService.getGiveRedList(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取我收到的红包列表
+			else if(action.equals("getreceiveredlist")) {
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("MemberPk")));//会员PK
+				List<RedPacket> list = payService.getReceiveRedList(memberPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//发红包
+			else if (action.equals("givered")) {
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPk")));//人才pk
+				int memberPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("MemberPk")));//会员PK
+				double coin = Double.parseDouble(CommentUtils.myToString(request.getParameter("coin")));// 红包
+				
+				int code = payService.giveRed(modelPk, memberPk, coin);
+				
+				// 1:发送成功;2:发送失败;3:余额不足
+				if (code == 1) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", "发送成功");
+				} else if (code == 2) {
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", "可用余额不足");
+				} else if (code == 3) {
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", "余额不足");
+				}
+			}
+
+			// 接收红包
+			else if (action.equals("receivered")) {
+				int redPacketPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("RedPacketPk"))); // 红包PK
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPk"))); // 会员PK
+				boolean flag = payService.receiveRed(redPacketPk, modelPk);
+				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 is null");
+			}
+			response.setCharacterEncoding("utf-8");
+			PrintWriter out = response.getWriter();
+			System.out.println(""+resultJson.toString());
+			out.print(resultJson.toString());
+			out.flush();
+			out.close();
+		}
+	}
+
+
+}

+ 211 - 0
src/main/java/com/thmodel/servlet/UploadServlet.java

@@ -0,0 +1,211 @@
+package com.thmodel.servlet;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.impl.MemberinfoServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+import com.thmodel.util.MD5Util;
+
+/**
+ * 上传图片
+ */
+public class UploadServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
+
+	protected void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+
+	protected void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		String resultJson = "";
+		try {
+			System.out.println("start");
+			resultJson = upload(request);
+			System.out.println(resultJson); 
+		} catch (Exception e) {
+			e.printStackTrace();
+			System.out.println("Exception  ");
+			JsonUtils.printWriter(response, Constants.upload_fail);
+		} finally {
+			JsonUtils.printWriter(response, resultJson);
+		}
+	}
+
+	public String upload(HttpServletRequest request) throws Exception {
+		InputStream fin = null;
+		
+		String action = "";
+		String memberPk = "";
+		
+		//tomcat绝对路径
+    	String pathRoot = request.getRealPath("/");
+		
+		boolean isMultipart = ServletFileUpload.isMultipartContent(request);//判断是否是表单文件类型
+        DiskFileItemFactory factory = new DiskFileItemFactory();
+        ServletFileUpload sfu = new ServletFileUpload(factory);
+        List items = sfu.parseRequest(request);// 从request得到所有上传域的列表
+        for (Iterator iter = items.iterator(); iter.hasNext();) {
+            FileItem fileitem = (FileItem) iter.next();
+            
+            // 判读不是普通表单域即是file
+            if (!fileitem.isFormField()) {
+            	// 操作fileitem文件步骤,可以获取大小、路径
+                // 定义图片流
+                fin = fileitem.getInputStream();
+                //文件大小
+                //long fileSize = fileitem.getSize();
+            } else {
+            	String fieldName = fileitem.getFieldName();
+           	 	String value = fileitem.getString("UTF-8");
+           	 	if(fieldName.equals("action")) {
+           	 		action = value;
+           	 	} else if(fieldName.equals("memberpk")) {
+           	 		memberPk = value;
+           	 	}
+           	 	
+            }
+        }
+        
+        if(action.equals("hp")) {
+        	String path = getRelativeImgPath(pathRoot, "hphoto");
+        	String allPath = pathRoot + path;
+        	//文件写入服务器
+        	String isPath = printFile(fin, allPath);
+        	if(isPath!=null) {
+	        	boolean flag = memberinfoService.updateMemberhphoto(memberPk, path);
+	            if(flag) {
+	            	return upload_success(path);
+	            }else {
+	            	return Constants.upload_fail;
+	            }
+        	} else {
+        		return Constants.upload_fail;
+        	}
+        }
+        
+        //上传工作照片
+        else if(action.equals("skillphoto")){
+        	String path = getRelativeImgPath(pathRoot, "skillphoto");
+        	String allPath = pathRoot + path;
+        	//文件写入服务器
+        	String isPath = printFile(fin, allPath);
+        	if(isPath != null) {
+        		return upload_success(path);
+        	}else {
+        		return Constants.upload_fail;
+        	}
+        }
+        
+        //普通上传
+        else if(action.equals("photo")){
+        	String path = getRelativeImgPath(pathRoot, "photo");
+        	String allPath = pathRoot + path;
+        	//文件写入服务器
+        	String isPath = printFile(fin, allPath);
+        	if(isPath != null) {
+        		return upload_success(path);
+        	}else {
+        		return Constants.upload_fail;
+        	}
+        }
+        
+        else
+        {
+        	String path = getRelativeImgPath(pathRoot, "photo");
+        	String allPath = pathRoot + path;
+        	//文件写入服务器
+        	String isPath = printFile(fin, allPath);
+        	if(isPath != null) {
+        		return upload_success(path);
+        	}else {
+        		return Constants.upload_fail;
+        	}
+        }
+        
+	}
+	
+	/**
+	 * 获取文件保存服务器相对路径
+	 * @param pathRoot 服务器路径 
+	 * @param name 文件夹名称
+	 * @return
+	 */
+	public String getRelativeImgPath(String pathRoot, String name) {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+		// 相对路径
+		String relativePath = "upload/" + name + "/" + sdf.format(new Date()) + "/";
+		File file = new File(pathRoot + relativePath);
+		if(!file.exists()){  
+			file.mkdirs();  
+		}  
+		String uuid = MD5Util.MD5(UUID.randomUUID().toString() + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString());
+		// 文件名
+		String imgName = uuid + ".jpg";
+		String relativeImgPath = relativePath + imgName;
+		return relativeImgPath;
+	}
+
+	/**
+	 * 写入图片
+	 * 
+	 * @param fin
+	 * @param path
+	 *            全路径
+	 * @return 成功:全路径/失败:null
+	 */
+	public String printFile(InputStream fin, String path) {
+		try {
+			// 定义图片输出流
+			FileOutputStream fout = new FileOutputStream(path);
+			// 写文件
+			byte[] b = new byte[1024];
+			int length = 0;
+			while ((length = fin.read(b)) > 0) {
+				fout.write(b, 0, length);
+			}
+
+			// 关闭数据流
+			fin.close();
+			fout.close();
+			System.out.println("file:" + path);
+			return path;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+
+	}
+	
+	public String upload_success(String path) {
+		//return path;
+		return "{\"msg\":\""+ Constants.success +"\", \"img\":\""+ path+"\"}";
+	}
+	
+}

+ 60 - 0
src/main/java/com/thmodel/servlet/VideoRecordServlet.java

@@ -0,0 +1,60 @@
+package com.thmodel.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.service.VideoRecordService;
+import com.thmodel.service.impl.VideoRecordServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+/**
+ * 视频接口请求名:videoRecord
+ * @author Administrator
+ *
+ */
+public class VideoRecordServlet extends HttpServlet {
+	
+	private static final long serialVersionUID = -7038365835253591501L;
+	
+	private static VideoRecordService videoRecordService = new VideoRecordServiceImpl();
+	
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+	
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		// 支持跨域
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+		
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+		
+		JSONObject resultJson = new JSONObject();
+		try {
+			
+			
+		} 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);
+		}
+	}
+
+}

+ 438 - 0
src/main/java/com/thmodel/servlet/model/ModelServlet.java

@@ -0,0 +1,438 @@
+package com.thmodel.servlet.model;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.impl.MemberinfoDaoImpl;
+import com.thmodel.entity.MemberInfo;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.ModelCardService;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.NimserverService;
+import com.thmodel.service.impl.MemberinfoServiceImpl;
+import com.thmodel.service.impl.ModelCardServiceImpl;
+import com.thmodel.service.impl.ModelInfoServiceImpl;
+import com.thmodel.service.impl.NimserverServiceImpl;
+import com.thmodel.service.UtilServer;
+import com.thmodel.service.impl.UtilServerImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+
+import net.sf.json.JSONObject;
+
+/**
+ * /model 模特端专用接口
+ * 
+ * @author 刘迎奥
+ * @date 2018年7月13日
+ * @version v1.0
+ */
+public class ModelServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+	
+	private static UtilServer utilServer = new UtilServerImpl(); 
+	private static ModelInfoService modelInfoService = new ModelInfoServiceImpl();
+	private static ModelCardService modelCardService = new ModelCardServiceImpl();
+	private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
+	private static NimserverService nimserverService = new NimserverServiceImpl();
+	private static com.thmodel.dao.MemberinfoDao memberinfoDao = new MemberinfoDaoImpl();
+	
+	public ModelServlet() {
+		super();
+	}
+
+	protected void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doPost(request, response);
+	}
+
+	protected 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.equals("getskilldata")) {
+				int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				List list = modelInfoService.getSkillData(modelPk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//2.添加技能
+			else if(action.equals("addskill")) {
+				int skillpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("skillpk")));
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				String skillphoto = CommentUtils.myToString(request.getParameter("skillphoto"));
+				double price = Double.parseDouble(CommentUtils.myToString(request.getParameter("price")));
+				String unit = CommentUtils.myToString(request.getParameter("unit"));
+				int orderid = CommentUtils.myToInt(request.getParameter("orderid"));
+				
+				boolean flag = modelInfoService.addSkill(skillpk, modelpk, skillphoto, price, unit, orderid);
+				
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//3.修改技能
+			else if(action.equals("updateskill")) {
+				
+				int pk = Integer.parseInt(CommentUtils.myToString(request.getParameter("pk")));
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				String skillpk = CommentUtils.myToString(request.getParameter("skillpk"));
+				String skillphoto = CommentUtils.myToString(request.getParameter("skillphoto"));
+				String price = CommentUtils.myToString(request.getParameter("price"));
+				String unit = CommentUtils.myToString(request.getParameter("unit"));
+				String orderid = CommentUtils.myToString(request.getParameter("orderid"));
+				
+				boolean flag = modelInfoService.updateSkill(pk, modelpk, skillpk, skillphoto, price, unit, orderid);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//4.修改模卡资料
+			else if(action.equals("updatemodelcard")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				//member
+				String name = CommentUtils.myToString(request.getParameter("name"));//姓名
+				String age = CommentUtils.myToString(request.getParameter("age"));//年龄
+				String area = CommentUtils.myToString(request.getParameter("area"));//地区
+				//model
+				String hei = CommentUtils.myToString(request.getParameter("hei"));//身高
+				String wei = CommentUtils.myToString(request.getParameter("wei"));//体重
+				String wai = CommentUtils.myToString(request.getParameter("wai"));		//腰围
+				String bust = CommentUtils.myToString(request.getParameter("bust"));	//胸围
+				String hip = CommentUtils.myToString(request.getParameter("hip"));		//臀围
+				String lname = CommentUtils.myToString(request.getParameter("lname"));	//个性签名
+				String vprice = CommentUtils.myToString(request.getParameter("vprice"));//聊天视频单价
+				
+				boolean flag = modelCardService.updateModelCard(modelpk, name, age, area, hei, wei, wai, bust, hip, lname, vprice);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+			
+			//5.获取地区标签
+			else if(action.equals("getarea")) {
+				List list = utilServer.getAreaList();
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取全部形象标签(风格标签)
+			else if(action.equals("getstyle")) {
+				List list = utilServer.getStyleList();
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//模特注册
+			else if(action.equals("domodelregister")) {
+				String mobile = CommentUtils.myToString(request.getParameter("mobile"));//手机
+				String pass = CommentUtils.myToString(request.getParameter("pass"));//密码
+				String pet = CommentUtils.myToString(request.getParameter("pet"));//昵称
+				String QRCode = CommentUtils.myToString(request.getParameter("introducerpk"));//推荐人
+				
+				int introducerpk = memberinfoDao.findMemberpkByQRcode(QRCode);
+				//boolean introducerIsModel = modelInfoService.isModel(introducerpk);
+				if(introducerpk > 0 ) {
+					int pk = 0;
+					boolean istel = memberinfoService.isTel(mobile);
+					if(istel) {
+						//手机号不存在
+						MemberInfo memberinfo = new MemberInfo();
+						memberinfo.setTel(mobile);
+						memberinfo.setPass(pass);
+						memberinfo.setPet(pet);
+						memberinfo.setIntroducerpk(introducerpk);
+						
+						//添加会员账号
+						pk = memberinfoService.doModelRegister(memberinfo);
+						if (pk > 0) {
+							// 注册成功
+
+							// 创建网易通讯账号
+							nimserverService.createUser(pk, pet);
+							resultJson.put("msg", Constants.success);
+							resultJson.put("pk", pk);
+						} else {
+							resultJson.put("msg", Constants.fail);
+						}
+					} else {
+						//手机号存在
+						
+						// 判断是否是模特
+						boolean isModel = modelInfoService.verifyModelPhone(mobile);
+						if(isModel) {
+							//不是模特
+							resultJson.put("desc", Constants.DESC_USER_1);
+							resultJson.put("msg", Constants.fail);
+						}else {
+							//是模特
+							resultJson.put("desc", Constants.DESC_USER_2);
+							resultJson.put("msg", Constants.fail);
+						}
+					}
+				} else {
+					resultJson.put("desc", Constants.DESC_USER_8);
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			
+			//模特端登陆
+			else if(action.equals("modellogin")) {
+				
+				String mobile = CommentUtils.myToString(request.getParameter("mobile").toString());
+				String pass = CommentUtils.myToString(request.getParameter("pass").toString());
+				
+				// 判断是否是模特
+				boolean isModel = modelInfoService.verifyModelPhone(mobile);
+				if(isModel) {
+					//未注册
+					resultJson.put("msg", Constants.fail);
+					resultJson.put("desc", Constants.DESC_USER_3);
+				} else {
+					Map<String, Object> map = modelInfoService.dologin(mobile, pass);
+					if(map != null){
+						resultJson.put("msg", Constants.success);
+						resultJson.put("data", JsonUtils.tofastjson(map));
+					}else{
+						resultJson.put("msg", Constants.fail);
+						resultJson.put("desc", Constants.DESC_USER_0);
+					}					
+				}
+				
+			}
+			
+			//模特端刷新模特登录信息
+			else if(action.equals("getmodeluserinfo")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				
+				Map<String, Object> map = modelInfoService.getModelLoginInfo(modelpk);
+				if(map != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(map));
+				}else{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取技能标签
+			else if(action.equals("getskill")) {
+				List list = utilServer.getSkillList();
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取人才风格标签
+			else if(action.equals("getmodelstyle")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				List<Map<String, Object>> list = modelInfoService.getModelStyle(modelpk);
+				if(list != null) {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+				
+			}
+			
+			//设置风格标签
+			else if(action.equals("dosetmodelstyle")) {
+				//替换之前的
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				String stylepks = CommentUtils.myToString(request.getParameter("stylepks"));
+				boolean flag = modelInfoService.setModelStyle(modelpk, stylepks);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//删除技能人才技能
+			else if(action.equals("removemodelskill")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//人才pk
+				int skillpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("skillpk")));//技能pk
+				boolean flag = modelInfoService.removeModelSkill(modelpk, skillpk);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取模特图片
+			else if(action.equals("getmodelphoto")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				List list = modelInfoService.getModelPhoto(modelpk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//添加模特图片
+			else if(action.equals("addmodelphoto")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				String photo = CommentUtils.myToString(request.getParameter("photo"));
+				int ordid = CommentUtils.myToInt(request.getParameter("ordid"));
+				boolean flag = modelInfoService.addModelPhoto(modelpk, photo, ordid);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//删除模特图片
+			else if(action.equals("deletemodelphoto")) {
+				String modelphotopks = CommentUtils.myToString(request.getParameter("modelphotopk"));//照片表主键pk
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//人才pk
+				boolean flag = modelInfoService.deleteModelPhoto(modelphotopks, modelpk);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取模特端 模卡资料接口
+			else if(action.equals("getmodeldata")) {
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//人才pk
+				List list = modelInfoService.getModelData(modelpk);
+				if(list != null){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("data", JsonUtils.tofastjson(list));
+				} else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//模特端验证手机号是否注册
+			/*else if(action.equals("verifymodelphone")) {
+				String phone = CommentUtils.myToString(request.getParameter("Phone"));
+				boolean flag = modelInfoService.verifyModelPhone(phone);
+				if(flag){
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", "未注册");
+				} else {
+					resultJson.put("msg", Constants.success);
+					resultJson.put("desc", "已注册");
+				}
+			}*/
+			
+			//删除朋友圈动态
+			else if(action.equalsIgnoreCase("doRemoveModelPrivate")) {
+				int privatepk = Integer.parseInt(CommentUtils.myToString(request.getParameter("privatepk")));//空间 某一条动态的pk
+				
+				boolean flag = modelInfoService.removeModelPrivate(privatepk);
+				
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//移除是否有新的订单消息
+			else if(action.equalsIgnoreCase("doRemoveModelHasRed")) {
+				
+				int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));
+				
+				boolean flag = modelInfoService.setModelHasRed(modelpk, 0);
+				if(flag) {
+					resultJson.put("msg", Constants.success);
+				}else {
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			
+			//获取邀请码
+			else if(action.equalsIgnoreCase("getInviteCode")) {
+				
+				int memberpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("memberpk")));
+				
+				String QRCode = modelInfoService.getNewMemQrCode();
+				
+				if(QRCode != null && !QRCode.equals("")) 
+				{
+					resultJson.put("msg", Constants.success);
+					resultJson.put("code", QRCode);
+				}
+				else
+				{
+					resultJson.put("msg", Constants.fail);
+				}
+			}
+			//删除某条评论
+			else if(action.equalsIgnoreCase("doRemoveComments")) {
+				int modelprivatediscusspk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelprivatediscusspk")));//某条评论pk
+				int privatepk = Integer.parseInt(CommentUtils.myToString(request.getParameter("privatepk")));//空间动态pk
+				boolean flag = modelInfoService.removeComments(privatepk, modelprivatediscusspk);
+				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);
+		}
+
+	}
+	
+}

+ 391 - 0
src/main/java/com/thmodel/servlet/netease/NeteaseServlet.java

@@ -0,0 +1,391 @@
+package com.thmodel.servlet.netease;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+import com.thmodel.constants.Constants;
+import com.thmodel.dao.ModelInfoDao;
+import com.thmodel.dao.impl.ModelInfoDaoImpl;
+import com.thmodel.dbconnection.DbConnection;
+import com.thmodel.nimserver.CheckSumBuilder;
+import com.thmodel.nimserver.NimConfig;
+import com.thmodel.nimserver.Nimserver;
+import com.thmodel.service.MemberinfoService;
+import com.thmodel.service.ModelInfoService;
+import com.thmodel.service.impl.MemberinfoServiceImpl;
+import com.thmodel.service.impl.ModelInfoServiceImpl;
+import com.thmodel.util.CommentUtils;
+import com.thmodel.util.JsonUtils;
+import com.thmodel.util.PropertyUtil;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.io.IOUtils;
+
+
+/**
+ * netease
+ */
+public class NeteaseServlet extends HttpServlet {
+	private static final long serialVersionUID = 1L;
+	
+	private static Nimserver nimserver = new Nimserver();
+	private static MemberinfoService memberinfoService = new MemberinfoServiceImpl();
+	private static ModelInfoService modelinfoService = new ModelInfoServiceImpl();
+	private static ModelInfoDao modelInfoDao = new ModelInfoDaoImpl();
+	
+	
+    public NeteaseServlet() {
+        super();
+    }
+	
+	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+		doPost(request, response);
+	}
+
+	
+	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+		
+		// 支持跨域
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		
+		response.setContentType("text/html; charset=UTF-8");
+		request.setCharacterEncoding("UTF-8");
+		
+		String action = request.getParameter("action") == null ? "" : request.getParameter("action").toLowerCase();
+		
+		String resultJson = "";
+		try {
+			
+			//创建用户
+			// http://localhost:8080/thmodel/netease?action=createuser&accid=admin
+			if(action.equals("createuser")){
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				String name = CommentUtils.myToString(request.getParameter("name"));
+				resultJson = nimserver.createUser(accid, name);
+				
+				/*JSONObject jsonObject = JSON.parseObject(resultJson);
+				String code = jsonObject.get("code").toString();
+				if(code.equals("200")) {
+					JSONObject info = JSON.parseObject(jsonObject.get("info").toString());
+					String token = info.get("token").toString();
+					
+					memberinfoService.updateMemberToken(Integer.parseInt(accid), token);
+				}*/
+			}
+			
+			//获取用户名片
+			// http://localhost:8080/thmodel/netease?action=getuinfos&accids=liuyingao,hongyang
+			else if(action.equals("getuinfos")) {
+				String accids = CommentUtils.myToString(request.getParameter("accids"));
+				String[] accidArray = accids.split(",");
+				resultJson = nimserver.getUinfos(accidArray);
+			}
+			
+			//更新用户名片
+			// http://localhost:8080/thmodel/netease?action=updateuinfo&accid=liuyingao&name=%E5%88%98%E8%BF%8E%E5%A5%A52&icon=1111
+			else if(action.equals("updateuinfo")) {
+				Map<String, String> paramMap = new HashMap<String, String>();
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				//用户昵称,最大长度64字符
+				String name = CommentUtils.myToString(request.getParameter("name"));
+				if(name!=null && !name.equals("")) {
+					paramMap.put("name", name);
+				}
+				//用户头像,最大长度1024字节
+				String icon = CommentUtils.myToString(request.getParameter("icon"));
+				if(icon!=null && !icon.equals("")) {
+					paramMap.put("icon", icon);
+				}
+				//用户签名,最大长度256字符
+				String sign = CommentUtils.myToString(request.getParameter("sign"));
+				if(sign!=null && !sign.equals("")) {
+					paramMap.put("sign", sign);
+				}
+				//	用户email,最大长度64字符
+				String email = CommentUtils.myToString(request.getParameter("email"));
+				if(email!=null && !email.equals("")) {
+					paramMap.put("email", email);
+				}
+				//	用户生日,最大长度16字符
+				String birth = CommentUtils.myToString(request.getParameter("birth"));
+				if(birth!=null && !birth.equals("")) {
+					paramMap.put("birth", birth);
+				}
+				//用户mobile,最大长度32字符
+				String mobile = CommentUtils.myToString(request.getParameter("mobile"));
+				if(mobile!=null && !mobile.equals("")) {
+					paramMap.put("mobile", mobile);
+				}
+				//用户性别,0表示未知,1表示男,2女表示女,其它会报参数错误
+				String gender = CommentUtils.myToString(request.getParameter("gender"));
+				if(gender!=null && !gender.equals("")) {
+					paramMap.put("gender", gender);
+				}
+				//用户名片扩展字段,最大长度1024字符,用户可自行扩展,建议封装成JSON字符串
+				String ex = CommentUtils.myToString(request.getParameter("ex"));
+				if(ex!=null && !ex.equals("")) {
+					paramMap.put("ex", ex);
+				}
+				
+				resultJson = nimserver.updateUinfo(accid, paramMap);
+			}
+			
+			//设置桌面端在线时,移动端是否需要推送
+			// http://localhost:8080/thmodel/netease?action=setdonnop&accid=liuyingao&donnopOpen=false
+			else if(action.equals("setdonnop")) {
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				String donnopOpen = CommentUtils.myToString(request.getParameter("donnopOpen"));
+				resultJson = nimserver.setDonnop(accid, donnopOpen);
+			}
+			
+			//加好友
+			// http://localhost:8080/thmodel/netease?action=addfriend&accid=liuyingao&faccid=admin&type=1&msg=nihao
+			else if(action.equals("addfriend")) {
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				String faccid = CommentUtils.myToString(request.getParameter("faccid"));
+				String type = CommentUtils.myToString(request.getParameter("type"));
+				String msg = CommentUtils.myToString(request.getParameter("msg"));
+				
+				resultJson = nimserver.addFriend(accid, faccid, type, msg);
+			}
+			//更新好友相关信息
+			//	http://localhost:8080/thmodel/netease?action=updatefriend&accid=liuyingao&faccid=admin&alias=备注管理员
+			else if(action.equals("updatefriend")) {
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				String faccid = CommentUtils.myToString(request.getParameter("faccid"));
+				String alias = CommentUtils.myToString(request.getParameter("alias"));
+				String ex = CommentUtils.myToString(request.getParameter("ex"));
+				
+				resultJson = nimserver.updateFriend(accid, faccid, alias, ex);
+				
+			}
+			
+			//删除好友
+			// http://localhost:8080/thmodel/netease?action=deletefriend&accid=liuyingao&faccid=admin
+			else if(action.equals("deletefriend")) {
+				String accid = CommentUtils.myToString(request.getParameter("accid"));
+				String faccid = CommentUtils.myToString(request.getParameter("faccid"));
+				resultJson = nimserver.deleteFriend(accid, faccid);
+			}
+			
+			//发送推送通知  个人(发红包通知)
+			else if(action.equals("sendattachredmsg")) {
+				String from = CommentUtils.myToString(request.getParameter("from"));//发送者会员pk
+				int msgtype = 0;
+				String to = CommentUtils.myToString(request.getParameter("to"));//发送给谁会员pk
+				String num = CommentUtils.myToString(request.getParameter("num"));//红包数量
+				
+				String fromName = memberinfoService.getUserName(Integer.parseInt(from));//发送者 姓名
+				String toName = memberinfoService.getUserName(Integer.parseInt(to));//发送给谁的 姓名
+				
+				String pushcontent = fromName + "发送给" + toName + num + "红包";//通知栏提示消息
+				String attach = pushcontent;//消息发送内容
+				Map<String, String> paramMap = new HashMap<String, String>();
+				paramMap.put("pushcontent", pushcontent);
+				resultJson = nimserver.sendAttachMsg(from, msgtype, to, attach, paramMap);
+				
+			}
+			
+			else if(action.equalsIgnoreCase("sendMsg")) {
+				
+				String from = CommentUtils.myToString(request.getParameter("from"));
+				String ope = CommentUtils.myToString(request.getParameter("ope"));
+				String to = CommentUtils.myToString(request.getParameter("to"));
+				String type = CommentUtils.myToString(request.getParameter("type"));
+				String body = CommentUtils.myToString(request.getParameter("body"));
+				
+				Map<String, String> paramMap = new HashMap<String, String>();
+				
+				//
+				String antispam = CommentUtils.myToString(request.getParameter("antispam"));
+				if(antispam!=null && !antispam.equals("")) {
+					paramMap.put("antispam", antispam);
+				}
+				
+				//
+				String antispamCustom = CommentUtils.myToString(request.getParameter("antispamCustom"));
+				if(antispamCustom!=null && !antispamCustom.equals("")) {
+					paramMap.put("antispamCustom", antispamCustom);
+				}
+				
+				//
+				String option = CommentUtils.myToString(request.getParameter("option"));
+				if(option!=null && !option.equals("")) {
+					paramMap.put("option", option);
+				}
+				
+				//
+				String pushcontent = CommentUtils.myToString(request.getParameter("pushcontent"));
+				if(pushcontent!=null && !pushcontent.equals("")) {
+					paramMap.put("pushcontent", pushcontent);
+				}
+				
+				//
+				String payload = CommentUtils.myToString(request.getParameter("payload"));
+				if(payload!=null && !payload.equals("")) {
+					paramMap.put("payload", payload);
+				}
+				
+				//
+				String ext = CommentUtils.myToString(request.getParameter("ext"));
+				if(ext!=null && !ext.equals("")) {
+					paramMap.put("ext", ext);
+				}
+				
+				//
+				String forcepushlist = CommentUtils.myToString(request.getParameter("forcepushlist"));
+				if(forcepushlist!=null && !forcepushlist.equals("")) {
+					paramMap.put("forcepushlist", forcepushlist);
+				}
+				
+				//
+				String forcepushcontent = CommentUtils.myToString(request.getParameter("forcepushcontent"));
+				if(forcepushcontent!=null && !forcepushcontent.equals("")) {
+					paramMap.put("forcepushcontent", forcepushcontent);
+				}
+				
+				//
+				String forcepushall = CommentUtils.myToString(request.getParameter("forcepushall"));
+				if(forcepushall!=null && !forcepushall.equals("")) {
+					paramMap.put("forcepushall", forcepushall);
+				}
+				
+				//
+				String bid = CommentUtils.myToString(request.getParameter("bid"));
+				if(bid!=null && !bid.equals("")) {
+					paramMap.put("bid", bid);
+				}
+				//
+				String useYidun = CommentUtils.myToString(request.getParameter("useYidun"));
+				if(useYidun!=null && !useYidun.equals("")) {
+					paramMap.put("useYidun", useYidun);
+				}
+				//
+				String markRead = CommentUtils.myToString(request.getParameter("markRead"));
+				if(markRead!=null && !markRead.equals("")) {
+					paramMap.put("markRead", markRead);
+				}
+				
+				resultJson = nimserver.sendMsg(from, ope, to, type, body, paramMap);
+						
+			}
+			
+			
+			//自定义发送通知内容
+			else if(action.equalsIgnoreCase("sendAttachMsg")) {
+				String from = CommentUtils.myToString(request.getParameter("from"));//发送者会员pk
+				int msgtype = 0;
+				String to = CommentUtils.myToString(request.getParameter("to"));//发送给谁会员pk
+				String pushcontent = CommentUtils.myToString(request.getParameter("pushcontent"));//通知栏提示消息
+				String attach = pushcontent;//消息发送内容
+				Map<String, String> paramMap = new HashMap<String, String>();
+				paramMap.put("pushcontent", pushcontent);
+				resultJson = nimserver.sendAttachMsg(from, msgtype, to, attach, paramMap);
+				System.out.println(resultJson);
+			}
+			
+			
+			else if(action.equalsIgnoreCase("mockClient")) {
+				//JSONObject result = new JSONObject();
+		        try {
+		        	String mockClient = PropertyUtil.getProperty("mockclient");
+		        	if(mockClient.equalsIgnoreCase("true")) {
+			        	String appSecret = NimConfig.appSecret;
+			        	
+			        	 // 获取部分request header,并打印
+			            String ContentType = NimConfig.contentType_1;
+			            String AppKey = NimConfig.appKey;
+			            String CurTime = String.valueOf((new Date()).getTime() / 1000L);
+			            String MD5 = request.getHeader("MD5");
+			            String nonce =  (int)(Math.random() * 1000000)+"";//随机数(最大长度128个字符)
+			            String CheckSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,CurTime);
+			            
+			            String requestHeaders = "request headers: ContentType = {"+ContentType+"}, AppKey = {"+AppKey+"}, CurTime = {"+CurTime+"}, " + "MD5 = {"+MD5+"}, CheckSum = {"+CheckSum+"}";
+			            
+			            // 获取请求体
+			            byte[] body = readBody(request);
+			            if (body == null) {
+			                System.out.println("request wrong, empty body!");
+			                //result.put("code", 414);
+			            }
+			           
+			            // 将请求体转成String格式,并打印
+			            //{"code":"200","clientType":"IOS","clientIp":"180.111.100.112","accid":"11","sdkVersion":"47","eventType":"2","timestamp":"1534240616391"}
+			            String requestBody = new String(body, "utf-8");
+			            
+			            String Body = "request body = {"+requestBody+"}";
+			            // 获取计算过的md5及checkSum
+			            String verifyMD5 = CheckSumBuilder.getMD5(requestBody);
+			            String verifyChecksum = CheckSumBuilder.getCheckSum(appSecret, verifyMD5, CurTime);
+			            String mm = "verifyMD5 = {"+verifyMD5+"}, verifyChecksum = {"+verifyChecksum+"}";
+			            //比较md5、checkSum是否一致,以及后续业务处理
+			            // result.put("code", 200);
+			            
+			           
+			            JSONObject jsonObject = JSONObject.fromObject(requestBody);
+			            
+			            String code = jsonObject.get("code").toString();
+			            String eventType = jsonObject.get("eventType").toString();
+			            String accid = jsonObject.get("accid").toString();
+			            
+			            int modelpk = modelInfoDao.getModelpkByMemberpk(Integer.parseInt(accid));
+			            if(code.equals("200") && modelpk > 0) {
+			            	//modelpk > 0  是模特
+				            //用户登录事件
+				            if(NimConfig.eventType_2.equalsIgnoreCase(eventType)) 
+				            {
+				            	modelinfoService.putOnline(modelpk, Constants.IS_A_ONLINE);
+				            }
+				            //用户登出事件
+				            else if(NimConfig.eventType_3.equalsIgnoreCase(eventType)) 
+				            {
+				            	modelinfoService.putOnline(modelpk, Constants.IS_A_OFFLINE);
+				            }
+				            
+				            if(eventType.equals(NimConfig.eventType_2) || eventType.equals(NimConfig.eventType_3)) {
+				            	 new DbConnection().executeUpdate(String.format("insert into imlog(AppKey, CurTime, MD5, CheckSum, ContentType, Body, appSecret, verifyMD5, verifyChecksum, systemDate)values('%s','%s','%s','%s','%s','%s','%s','%s','%s', now())", 
+										  														   AppKey, CurTime, MD5, CheckSum, ContentType, requestBody, appSecret, verifyMD5, verifyChecksum ));
+				            }
+			            
+			            }
+		        	}
+		        } catch (Exception ex) {
+		        	System.out.println(ex.getMessage());
+		            //result.put("code", 414);
+		        }
+			}
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			resultJson = NimConfig.errorNeteaseMessage;
+		} finally{
+			JsonUtils.printWriter(response, resultJson);
+		}
+	}
+
+	
+	 private byte[] readBody(HttpServletRequest request) {
+		try {
+			InputStream inputStream = request.getInputStream();
+			DataInputStream dataInputStream = new DataInputStream(inputStream);
+			int totalBytes = request.getContentLength();
+			byte[] bytes = new byte[totalBytes];
+			dataInputStream.readFully(bytes);
+			dataInputStream.close();
+			return bytes;
+		} catch (IOException e) {
+			return null;
+		}
+    }
+	 
+}

+ 302 - 0
src/main/java/com/thmodel/util/CommentUtils.java

@@ -0,0 +1,302 @@
+package com.thmodel.util;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CommentUtils {
+	
+	public static String DecimalFormatToString(double d, String... format) {
+		String fm = null;
+		if(format != null && format.length > 0) 
+		{
+			fm = format[0];
+		}
+		else {
+			fm = "#0.00";
+		}
+		DecimalFormat df2 = new DecimalFormat(fm);
+		df2.setRoundingMode(RoundingMode.DOWN);//向零方向舍入的舍入模式
+		return df2.format(d); 
+	}
+	public static void main(String[] args) {
+		
+		String s = DecimalFormatToString(0.0000);
+		System.out.println(s);
+	}
+     
+	/**
+	 * 值为空时返回默认值
+	 * @param value
+	 * @param defaultValue
+	 * @return
+	 */
+	public static String emptyToDefault(String value, String defaultValue) {
+		if(value!=null && !value.equals("") && !value.equals("null")) {
+			return value.trim();
+		}else {
+			return defaultValue;
+		}
+	}
+	
+	/**
+	 * 转换成字符串 并判断非空
+	 * 
+	 * @param value
+	 * @return
+	 */
+	public static String myToString(String value) {
+		String result = value + "";
+		if (value == null || value.equals("null") || value.equals("undefined")) {
+			result = "";
+		} else {
+			result = value + "";
+		}
+		return result;
+	}
+	
+	/**
+	 * double类型的字符串 去掉小数部分
+	 * @param stringDouble
+	 * @return
+	 */
+	public static String stringDoubleToInt(String stringDouble) {
+		try {
+			if(stringDouble != null && !stringDouble.equals("")) {
+				return stringDouble.substring(0, stringDouble.lastIndexOf("."));
+			} else {
+				return "0";
+			}
+		} catch (Exception e) {
+			System.out.println("StringDoubleToInt  to  catch");
+			return "0";
+		}
+	}
+	
+	/**
+	 * 组装分页  的  sql 语句
+	 * mysql
+	 * @param sql
+	 * @param index
+	 * @param size
+	 * @return
+	 */
+	public static String pagingToMysql(String sql, int index, int size) {
+		return "select * from ("+sql+")paging0_ limit "+((index-1) * size)+", "+size;
+	}
+	
+	/**
+	 * 组装分页 查询  总数量    的  sql 语句
+	 * mysql
+	 * @param sql
+	 * @return
+	 */
+	public static String pagingToMysqlCount(String sql) {
+		return "select count(1) from ("+sql+")paging1_";
+	}
+
+	public static Integer myToInteger(String value) {
+		Integer result = null;
+		if (value == null || value.equals("") || value.equals("null") || value.equals("undefined")) {
+			result = null;
+		} else {
+			try {
+				result = Integer.parseInt(value);
+			} catch (NumberFormatException e) {
+				System.out.println("CommentUtils.class  NumberFormatException: " + e.getMessage());
+				result = null;
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * 转换成int类型 为空或异常为0
+	 * 
+	 * @param value
+	 * @return
+	 */
+	public static int myToInt(String value) {
+		int result = 0;
+		if (value == null || value.equals("") || value.equals("null") || value.equals("undefined")) {
+			result = 0;
+		} else {
+			try {
+				result = Integer.parseInt(value);
+			} catch (NumberFormatException e) {
+				System.out.println("CommentUtils.class  NumberFormatException: " + e.getMessage());
+				result = 0;
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * 非空判断
+	 * 
+	 * @return
+	 */
+	public static boolean isNull(Object obj) {
+		boolean flag = false;
+		if (obj != null && !obj.equals("") && !obj.equals("null") && !obj.equals("undefined")) {
+			flag = true;
+		}
+		return flag;
+	}
+
+	public static String ratioTransform(double money) {
+		BigDecimal moneyDev = new BigDecimal(money).setScale(2, RoundingMode.HALF_UP);
+
+		return moneyDev.toString();
+	}
+
+	@SuppressWarnings("unchecked")
+	public static Map<String, Object> requestToHashMap(HttpServletRequest request) {
+
+		String agent = request.getHeader("user-agent");
+
+		Map<String, String[]> map = request.getParameterMap();
+		Iterator<Entry<String, String[]>> iterator = map.entrySet().iterator();
+		Map<String, Object> map_params = new HashMap<String, Object>();
+		while (iterator.hasNext()) {
+			Entry<String, String[]> entry = iterator.next();
+			String key = entry.getKey();
+			String value = ((String[]) entry.getValue())[0];
+			if (agent != null && agent.equals("android")) {
+
+			} else {
+				if (value != null) {
+
+				}
+			}
+
+			map_params.put(key.toLowerCase(), value);
+
+		}
+		if (map != null) {
+			printMap(map);
+		}
+
+		return map_params;
+
+	}
+
+	public static String getRandomNumFive() {
+		String base = "0123456789";
+		int base_length = base.length();
+		StringBuffer sb = new StringBuffer(6);
+		for (int i = 0; i < 6; i++) {
+			sb.append(base.charAt(new Random().nextInt(base_length)));
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * 打印参数
+	 * 
+	 * @param map
+	 */
+	public static void printMap(Map<String, String[]> map) {
+		if (map == null) {
+			throw new RuntimeException("printParament map is null");
+		}
+
+		Iterator<Entry<String, String[]>> iterator = map.entrySet().iterator();
+		while (iterator.hasNext()) {
+			Entry<String, String[]> entry = iterator.next();
+			String key = entry.getKey();
+			Object value = entry.getValue();
+			if (value instanceof Object[]) {
+				printArray(value);
+			} else {
+			}
+		}
+
+	}
+
+	/**
+	 * 打印数组
+	 * 
+	 * @param value
+	 */
+	private static void printArray(Object value) {
+
+		if (value == null) {
+			throw new RuntimeException("printArray value is null");
+		}
+		if (value instanceof String[]) {
+			for (String s : (String[]) value) {
+				// System.out.println("s:" + s);
+			}
+		}
+	}
+
+	public static <T> void printList_Bean(List<T> mlist) {
+		if (mlist == null) {
+			throw new RuntimeException("printList_Bean list is null");
+		}
+		for (int i = 0; mlist != null && i < mlist.size(); i++) {
+			T t = mlist.get(i);
+
+			printBean(t);
+		}
+
+	}
+
+	public static <T> void printBean(T t) {
+		if (t == null) {
+			throw new RuntimeException("printBean t is null");
+		}
+		Class cls_t = t.getClass();
+
+		Field[] fs = cls_t.getDeclaredFields();
+
+		for (int j = 0; fs != null && j < fs.length; j++) {
+			Field field = fs[j];
+			field.setAccessible(true);
+			try {
+				Object obj_field = field.get(t);
+
+				String name = field.getName();
+
+			} catch (IllegalArgumentException e) {
+				e.printStackTrace();
+			} catch (IllegalAccessException e) {
+				e.printStackTrace();
+			}
+
+		}
+
+	}
+
+	public static boolean isEmpty(List l) {
+		return (l == null) || (l.isEmpty());
+	}
+
+	public static boolean isEmpty(Object[] objs) {
+		return (objs == null) || (objs.length == 0);
+	}
+
+	public static String getCharLengthByCount(String str, int count) {
+		if (count > 0) {
+			StringBuffer sb = new StringBuffer();
+			sb.append("");
+			for (int i = 0; i < count; i++) {
+				sb.append(str);
+			}
+			return sb.toString();
+		} else {
+			return "";
+		}
+	}
+
+}

+ 64 - 0
src/main/java/com/thmodel/util/DBRecordsPack.java

@@ -0,0 +1,64 @@
+package com.thmodel.util;
+
+
+import java.sql.*;
+import java.util.*;
+
+import com.thmodel.dbconnection.DbConnection;
+
+import net.sf.json.JSONObject;
+
+//将数据集打包为json格式,供前台使用
+
+public class DBRecordsPack {
+	public static String LastError="";
+	public static List<JSONObject> Pack( javax.sql.rowset.CachedRowSet rs  )//方法1
+	{
+		LastError = "";
+		List<JSONObject> jsonList = new ArrayList<JSONObject>(); 
+		int i;
+		String fieldValue;
+	    
+	    try {
+			if ( (rs==null) || !rs.next() )
+			{
+			  JSONObject jsonObj =  new JSONObject();
+			  jsonObj.put("result","failed");
+			}
+			else
+			{
+			  rs.previous();
+			  ResultSetMetaData metaData = rs.getMetaData();
+			  while ( rs.next() )
+			  {
+			    JSONObject tmpJson =  new JSONObject();
+			    tmpJson.put("result","success");
+			    for (i=1; i<=metaData.getColumnCount(); i++)
+			    {
+			    	fieldValue = rs.getString( i );
+			    	if (fieldValue==null) fieldValue="";
+			    	tmpJson.put( metaData.getColumnName(i).toLowerCase(), fieldValue );
+			    }
+			    jsonList.add(tmpJson);
+			  }
+			}
+		} catch (SQLException e) {
+			LastError = e.getMessage();
+			e.printStackTrace();
+		}
+	    if (rs!=null)
+			try {
+				rs.close();
+			} catch (SQLException e) {
+				e.printStackTrace();
+			}
+	    return jsonList;
+	}
+	
+	public static List<JSONObject> Pack( DbConnection db, String sql ) //方法2
+	{
+		javax.sql.rowset.CachedRowSet rs = db.executeQuery( sql );
+		return Pack( rs );
+	}
+}
+

+ 159 - 0
src/main/java/com/thmodel/util/JsonUtils.java

@@ -0,0 +1,159 @@
+package com.thmodel.util;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.serializer.ValueFilter;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+
+public class JsonUtils
+{
+    
+    public static PrintWriter getPrintWriter(HttpServletResponse response)
+    {
+        try
+        {
+            response.setContentType("text/html; charset=utf-8");
+            return response.getWriter();
+            
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException("JsonUtils,getPrintWriter", e);
+        }
+    }
+    
+   
+    public static void PrintWriter(PrintWriter printWriter,JSONObject jsonObject)
+    {
+        if (printWriter == null)
+            throw new RuntimeException("JsonUtils PrintWriter is null");
+        
+        printWriter.print(jsonObject);
+        printWriter.close();
+        printWriter = null;
+        
+    }
+    
+    public static <T> JSONObject ToJsonObject(String result, String message, T t)
+    {
+        if (!StringUtils.isNotBlank(result))
+        {
+            throw new RuntimeException("result is null or not params");
+        }
+        
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("result", result);
+        if (StringUtils.isNotBlank(message))
+        {
+            jsonObject.put("message", message);
+        }
+        if (t != null)
+        {
+            if (t instanceof ArrayList)
+            {
+                jsonObject.put("list", JSONArray.fromObject(t));
+            }
+            else if (t instanceof HashMap)
+            {
+                jsonObject.put("list", JSONArray.fromObject(t));
+            }
+            else if(t instanceof Integer)
+            {
+            	jsonObject.put("value", t);
+            }
+            else if(t instanceof String)
+            {
+            	jsonObject.put("value", t);
+            }
+            else
+            {
+                jsonObject.put(t.getClass().getSimpleName(), JSONObject.fromObject(t));
+            }
+            
+        }
+        
+        return jsonObject;
+    }
+    
+    /**
+     * 过滤器
+     * 空值/null  显示空字符串
+     * 注意,这个参数要放到要转换的json值后面,其他枚举类型前面
+     */
+    private static ValueFilter filter = new ValueFilter() {
+        @Override
+        public Object process(Object obj, String s, Object v) {
+            if (v == null)
+                return "";
+            return v;
+        }
+    };
+    /**
+     * alibaba转json
+     * @param obj
+     * @return
+     */
+    public static String tofastjson(Object obj){
+    	//SerializerFeature.WriteNonStringValueAsString  所有类型加 双引号 修饰
+    	String json = JSON.toJSONString(obj, filter, SerializerFeature.WriteNonStringValueAsString);
+    	return json;
+    }
+    
+    /**
+     * alibaba out.print(String)打印
+     * @param response
+     * @param json
+     */
+    public static void printWriter(HttpServletResponse response, String json){
+    	try {
+    		response.setCharacterEncoding("utf-8");
+			PrintWriter out = response.getWriter();
+			if(out == null){
+				System.out.println("JsonUtils.class : PrintWriter out is null");
+			}else{
+				out.print(json);
+				out.flush();
+				out.close();
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw new RuntimeException("JsonUtils.class : error");
+		}
+    }
+    /**
+     * alibaba out.print(JSONObject)打印
+     * @param response
+     * @param jsonObject
+     */
+    public static void printWriter(HttpServletResponse response, JSONObject jsonObject){
+    	try {
+    		response.setCharacterEncoding("utf-8");
+    		PrintWriter out = response.getWriter();
+    		if(out == null){
+    			System.out.println("JsonUtils.class : PrintWriter out is null");
+    		}else{
+    			String json = JSON.toJSONString(jsonObject);
+    			out.print(json);
+    			out.flush();
+    			out.close();
+    		}
+    	} catch (IOException e) {
+    		e.printStackTrace();
+    		throw new RuntimeException("JsonUtils.class : error");
+    	}
+    }
+    
+}

+ 41 - 0
src/main/java/com/thmodel/util/MD5Util.java

@@ -0,0 +1,41 @@
+package com.thmodel.util;
+
+import java.security.MessageDigest;
+
+/**
+ * 相关描述:MD5加密
+ * @Author:tangchang
+ * @Time:2012-6-21 上午12:01:22
+ * @Version 1.0
+ */
+public class MD5Util {
+	public final static String MD5(String s) {
+		char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+		try {
+			byte[] btInput = s.getBytes("utf-8");
+			// 获得MD5摘要算法的 MessageDigest 对象
+			MessageDigest mdInst = MessageDigest.getInstance("MD5");
+			// 使用指定的字节更新摘要
+			mdInst.update(btInput);
+			// 获得密文
+			byte[] md = mdInst.digest();
+			// 把密文转换成十六进制的字符串形式
+			int j = md.length;
+			char str[] = new char[j * 2];
+			int k = 0;
+			for (int i = 0; i < j; i++) {
+				byte byte0 = md[i];
+				str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+				str[k++] = hexDigits[byte0 & 0xf];
+			}
+			return new String(str);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	public static void main(String[] args) {
+		System.out.println(MD5Util.MD5("123456"));
+	}
+}

+ 449 - 0
src/main/java/com/thmodel/util/MyDateUtil.java

@@ -0,0 +1,449 @@
+package com.thmodel.util;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+/**
+ * 
+ * 时间工具类
+ * 
+ * @version [V1.00, 2018年6月11日]
+ * @see [相关类/方法]
+ * @since V1.00
+ */
+public final class MyDateUtil
+{
+    public static final String DATE_FORMAT_1 = "yyyy-MM-dd HH:mm:ss";
+    
+    public static final String DATE_FORMAT_2 = "yyyy-MM-dd";
+    
+    public static final String DATE_FORMAT_3 = "yyyyMMdd";
+    
+    public static final String DATE_FORMAT_4 = "MMdd";
+    
+    public static final String DATE_FORMAT_5 = "yyyyMM";
+    
+    public static final String DATE_FORMAT_6 = "yyyyMMddHHmmss";
+    
+    public static final String DATE_FORMAT_7 = "HH:mm";
+    
+    public static final String DATE_FORMAT_8 = "yyyy 年 MM 月 dd 日";
+    
+    public static final String DATE_FORMAT_9 = "yyyyMMddHHmmssSSS";
+    
+    public static final String DATE_FORMAT_10 = "yyyy";
+    
+    public static final String DATE_FORMAT_11 = "yyyy-MM-dd HH:mm";
+    
+    public static final String DATE_FORMAT_12 = "yyyy年MM月";
+
+
+    public static final String DATE_FORMAT_13 = "yyyy.MM.dd";
+
+    public static String getTimesBySs()
+    {
+        String time = getTimeMillis();
+        long time_l = Long.parseLong(time);
+        String timestamps=String.valueOf(time_l/1000);
+        return timestamps;
+    }
+    
+    public static String getDateAfter(Date d, int day)
+    {
+        Calendar now = Calendar.getInstance();
+        now.setTime(d);
+        now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
+        return format(now.getTime(), DATE_FORMAT_1);
+    }
+    /**
+     * @brief 两个时间之间的天数
+     *
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    public static int getDays(String startDate, String endDate, String fmt)
+    {
+        if (startDate == null || startDate.equals(" "))
+            return 0;
+        if (endDate == null || endDate.equals(" "))
+            return 0;
+        // 转换为标准时间
+        SimpleDateFormat myFormatter = new SimpleDateFormat(fmt);
+        Date date = null;
+        Date mydate = null;
+        try
+        {
+            date = myFormatter.parse(startDate);
+            mydate = myFormatter.parse(endDate);
+        }
+        catch (Exception e)
+        {
+        }
+        long day = (mydate.getTime() - date.getTime()) / (24 * 60 * 60 * 1000);
+        return (int) day;
+    }
+
+
+
+    /**
+     * 上个月 
+     * <功能详细描述>
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static String getLastMonth()
+    {
+        Calendar c = Calendar.getInstance();
+        c.add(Calendar.MONTH, -1);
+        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM");
+        String time = format.format(c.getTime());
+        return time;
+    }
+    
+    public static String getNowMonth()
+    {
+        Calendar c = Calendar.getInstance();
+        c.add(Calendar.MONTH, 0);
+        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM");
+        String time = format.format(c.getTime());
+        return time;
+    }
+    /**
+     * 修改成新的样式
+     * <功能详细描述>
+     * 
+     * @param date
+     * @param oldFmt
+     * @param newFmt
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static String chgFmt(String date, String oldFmt, String newFmt)
+    {
+        Date d = toDate(date, oldFmt);
+        SimpleDateFormat fmt = new SimpleDateFormat(newFmt);
+        return fmt.format(d);
+    }
+    
+    /**
+     * 格式化样式
+     * <功能详细描述>
+     * 
+     * @param date
+     * @param fmt
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static String format(Date date, String fmt)
+    {
+        try {
+        	if(date!=null){
+				SimpleDateFormat fmter = new SimpleDateFormat(fmt);
+				return fmter.format(date);
+        	}else{
+        		return "";
+        	}
+		} catch (Exception e) {
+			System.out.println("MyDateUtil.class:时间类型转换异常!");
+			return "";
+		}
+    }
+    
+    public static String getDate(String format, int offset)
+    {
+        return getTime(format, 5, offset);
+    }
+    
+    public static String getDate(String format)
+    {
+        return getDate(format, 0);
+    }
+    
+  
+    
+    public static String getWeekOfDate(Date dt)
+    {
+        String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(dt);
+        
+        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if (w < 0)
+            w = 0;
+            
+        return weekDays[w];
+    }
+    
+    public static Date toDate(String date, String format)
+    {
+        SimpleDateFormat fmt = new SimpleDateFormat(format);
+        try
+        {
+            return fmt.parse(date);
+        }
+        catch (ParseException e)
+        {
+            return null;
+        }
+    }
+    
+    public static String getTime(String format, int offsetType, int offset)
+    {
+        SimpleDateFormat fmt = new SimpleDateFormat(format);
+        Calendar cal = Calendar.getInstance();
+        cal.add(offsetType, offset);
+        return fmt.format(cal.getTime());
+    }
+    
+    public static Date getDate(int offsetType, int offset)
+    {
+        Calendar cal = Calendar.getInstance();
+        cal.add(offsetType, offset);
+        return cal.getTime();
+    }
+    
+    public static Date getDateS(int offset)
+    {
+        Calendar cal = Calendar.getInstance();
+        cal.add(5, offset);
+        return cal.getTime();
+    }
+    
+    public static boolean parse(String date, String format)
+    {
+        try
+        {
+            SimpleDateFormat fmt = new SimpleDateFormat(format);
+            @SuppressWarnings("unused")
+            Date date_begin = fmt.parse(date);
+            return true;
+        }
+        catch (Exception e)
+        {
+            return false;
+        }
+    }
+    
+    /**
+     * 判断begin 是否在 end 之前
+     * @param begin
+     * @param end
+     * @param format
+     * @return
+     */
+    public static boolean compareTime(Date begin, Date end, String format)
+    {
+        try
+        {
+            SimpleDateFormat fmt = new SimpleDateFormat(format);
+            Date date_begin = begin;
+            Date date_end = end;
+            int result = date_begin.compareTo(date_end);
+            if (result < 0)
+                return true;
+            else
+                return false;
+        }
+        catch (Exception e)
+        {
+            return false;
+        }
+    }
+    
+    public static boolean compareTime(String begin, String end, String format)
+    {
+        try
+        {
+            SimpleDateFormat fmt = new SimpleDateFormat(format);
+            Date date_begin = fmt.parse(begin);
+            Date date_end = fmt.parse(end);
+            int result = date_begin.compareTo(date_end);
+            if (result < 0)
+                return true;
+            else
+                return false;
+        }
+        catch (Exception e)
+        {
+            return false;
+        }
+    }
+    
+    public static boolean compareTime(long time, int dayoffset)
+    {
+        Calendar curtime = GregorianCalendar.getInstance(Locale.getDefault());
+        curtime.add(5, dayoffset);
+        
+        return curtime.getTimeInMillis() >= time;
+    }
+    
+    public static String getTimeMillis()
+    {
+        return Calendar.getInstance(Locale.CHINA).getTimeInMillis() + "";
+    }
+    
+    public static Timestamp getCurrentTime()
+    {
+        return new Timestamp(Calendar.getInstance(Locale.CHINA).getTimeInMillis());
+    }
+    
+    public static Date getCurrentDate()
+    {
+        return Calendar.getInstance(Locale.CHINA).getTime();
+    }
+    
+    public static String getNowTime(String format)
+    {
+        return format(new Date(), format);
+    }
+    
+    public static boolean isDateIn(String currentDate, String startDate, String endDate)
+    {
+        if ((currentDate.compareTo(startDate) >= 0) && (currentDate.compareTo(endDate) <= 0))
+        {
+            return true;
+        }
+        return false;
+    }
+    
+    // 获取本月第一天
+    public static String getMonthFirstDay()
+    {
+        Calendar cale = Calendar.getInstance();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        String firstday;
+        // 获取前月的第一天
+        cale = Calendar.getInstance();
+        cale.add(Calendar.MONTH, 0);
+        cale.set(Calendar.DAY_OF_MONTH, 1);
+        firstday = format.format(cale.getTime());
+        return firstday;
+    }
+
+    // 获取本周第一天
+    public static String getWeekDay()
+    {
+        Calendar cale = Calendar.getInstance();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        String firstday;
+        // 获取前月的第一天
+        cale = Calendar.getInstance();
+        cale.add(Calendar.WEEK_OF_MONTH, 0);
+        cale.set(Calendar.DAY_OF_WEEK, 1);
+        firstday = format.format(cale.getTime());
+        return firstday;
+    }
+    /**
+     * 获取某年某月最后一天
+     * @param year
+     * @param month
+     * @return
+     */
+    public static String getLastDayOfMonth(int year,int month)
+	{
+		Calendar cal = Calendar.getInstance();
+		//设置年份
+		cal.set(Calendar.YEAR,year);
+		//设置月份
+		cal.set(Calendar.MONTH, month-1);
+		//获取某月最大天数
+		int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+		//设置日历中月份的最大天数
+		cal.set(Calendar.DAY_OF_MONTH, lastDay);
+		//格式化日期
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		String lastDayOfMonth = sdf.format(cal.getTime());
+		
+		return lastDayOfMonth;
+	}
+    public static Date  getLastMonth(Date date)
+    {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.MONTH, -1);
+        return calendar.getTime();
+        
+    }
+    
+    public static Date  getNextMonth(Date date)
+    {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.MONTH, 1);
+        return calendar.getTime();
+        
+    }
+    
+    public static String getNextDay(Date date)
+    {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        date = calendar.getTime();
+        return format.format(date);
+    }
+    public static String getDateForLong(String dateFormat2, long parseLong)
+    {
+        SimpleDateFormat format = new SimpleDateFormat(dateFormat2);
+        return format.format(parseLong);
+    }
+    public static boolean compareTimeSame(String end, String begin, String format)
+    {
+        try
+        {
+            SimpleDateFormat fmt = new SimpleDateFormat(format);
+            Date date_begin = fmt.parse(begin);
+            Date date_end = fmt.parse(end);
+            Calendar c_begin = Calendar.getInstance();
+            Calendar c_end = Calendar.getInstance();
+            c_begin.setTime(date_begin);
+            c_end.setTime(date_end);
+            if(c_begin.get(Calendar.YEAR)==c_end.get(Calendar.YEAR) 
+                && c_begin.get(Calendar.MONTH)==c_end.get(Calendar.MONTH)
+                && c_begin.get(Calendar.DAY_OF_MONTH)==c_end.get(Calendar.DAY_OF_MONTH))
+            {
+                return true;
+            }
+            else
+                return false;
+        }
+        catch (ParseException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return false;
+    }
+    /**
+     * 判断两个date 是否是同一天
+     * @param date1
+     * @param date2
+     * @return
+     */
+    public static boolean isSameDay(Date date1, Date date2) {
+        if(date1 != null && date2 != null) {
+            Calendar cal1 = Calendar.getInstance();
+            cal1.setTime(date1);
+            Calendar cal2 = Calendar.getInstance();
+            cal2.setTime(date2);
+            if(cal1 != null && cal2 != null) {
+                return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6);
+            } else {
+            	return false;
+            }
+        } else {
+            return false;
+        }
+    }
+  
+
+}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません