| 
															
																@ -1,5 +1,7 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																package com.yihu.jw.healthyhouse.service.user; 
															 | 
															
															 | 
															
																package com.yihu.jw.healthyhouse.service.user; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.fasterxml.jackson.databind.ObjectMapper; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.sms.SmsGatewayDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.exception.business.ManageException; 
															 | 
															
															 | 
															
																import com.yihu.jw.exception.business.ManageException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.healthyhouse.cache.WlyyRedisVerifyCodeService; 
															 | 
															
															 | 
															
																import com.yihu.jw.healthyhouse.cache.WlyyRedisVerifyCodeService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.healthyhouse.constant.LoginInfo; 
															 | 
															
															 | 
															
																import com.yihu.jw.healthyhouse.constant.LoginInfo; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -7,6 +9,7 @@ import com.yihu.jw.healthyhouse.constant.UserConstant; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.healthyhouse.model.user.User; 
															 | 
															
															 | 
															
																import com.yihu.jw.healthyhouse.model.user.User; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.wlyy.HouseUserContant; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.wlyy.HouseUserContant; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.security.MD5; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.security.MD5; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.mysql.query.BaseJpaService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Value; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Value; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.http.*; 
															 | 
															
															 | 
															
																import org.springframework.http.*; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -17,6 +20,7 @@ import org.springframework.util.MultiValueMap; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.web.client.RestTemplate; 
															 | 
															
															 | 
															
																import org.springframework.web.client.RestTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import javax.servlet.http.HttpServletRequest; 
															 | 
															
															 | 
															
																import javax.servlet.http.HttpServletRequest; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import java.io.IOException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.text.ParseException; 
															 | 
															
															 | 
															
																import java.text.ParseException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.text.SimpleDateFormat; 
															 | 
															
															 | 
															
																import java.text.SimpleDateFormat; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.util.Date; 
															 | 
															
															 | 
															
																import java.util.Date; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -29,7 +33,7 @@ import java.util.Map; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 * @created 2018/9/18 20:02 
															 | 
															
															 | 
															
																 * @created 2018/9/18 20:02 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 */ 
															 | 
															
															 | 
															
																 */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																@Service 
															 | 
															
															 | 
															
																@Service 
															 | 
														
													
												
													
														
															| 
															 | 
															
																public class LoginService { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																public class LoginService  extends BaseJpaService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private UserService userService; 
															 | 
															
															 | 
															
																    private UserService userService; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -211,6 +215,43 @@ public class LoginService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public ResponseEntity<HashMap> sendDemoSms(String clientId, String type, String phone) throws ParseException, ManageException, IOException { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //发送短信获取验证码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String resultStr = "{\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "    \"obj\": {\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"id\": \"4028cb816615a019016615b662b10003\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"createTime\": \"2018-09-26 19:49:26\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"createUser\": null,\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"createUserName\": null,\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"updateTime\": \"2018-09-26 19:49:26\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"updateUser\": null,\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"updateUserName\": null,\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"clientId\": \"EwC0iRSrcS\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"smsGatewayId\": \"402803f9657fa37b01657fb58b9b0000\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"requestIp\": \"127.0.0.1\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"mobile\": \"18250165552\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"content\": \"【i健康综合管理平台】您使用的是i健康综合管理平台短信模板,您的验证码是329931,请于10分钟内正确输入!\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"deadline\": \"2018-09-26 19:59:26\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"captcha\": \"329931\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "        \"type\": \"login\"\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "    },\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "    \"message\": \"success\",\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "    \"status\": 200\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "}"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String captcha = randomInt(6); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        resultStr = resultStr.replaceAll("329931",captcha); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        ObjectMapper objectMapper = new ObjectMapper(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        HashMap<String, Object> result = objectMapper.readValue(resultStr,HashMap.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Long expire = 600L; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            wlyyRedisVerifyCodeService.store(clientId, phone, captcha, expire.intValue()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            HttpHeaders headers = new HttpHeaders(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            headers.set("Cache-Control", "no-store"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            headers.set("Pragma", "no-cache"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return new ResponseEntity<>(result, headers, HttpStatus.OK); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 管理员手机登录 
															 | 
															
															 | 
															
																     * 管理员手机登录 
															 |