提交 670a2680 编写于 作者: yongbo.wang's avatar yongbo.wang

Merge branch 'release' into 'master'

Release



See merge request !3
流水线 #16476 已失败 于阶段
in 0 second
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId> <artifactId>pica-cloud-account-client</artifactId>
<version>1.0.1</version>
<name>pica-cloud-account-client</name> <name>pica-cloud-account-client</name>
<packaging>jar</packaging> <packaging>jar</packaging>
...@@ -27,11 +28,17 @@ ...@@ -27,11 +28,17 @@
<dependency> <dependency>
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId> <artifactId>pica-cloud-account-common</artifactId>
<version>1.0.0</version> <version>1.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId> <artifactId>spring-cloud-netflix-core</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.18.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.pica.cloud.foundation</groupId> <groupId>com.pica.cloud.foundation</groupId>
...@@ -64,32 +71,10 @@ ...@@ -64,32 +71,10 @@
<repository> <repository>
<id>nexus</id> <id>nexus</id>
<name>Pica 3rdParty Repository</name> <name>Pica 3rdParty Repository</name>
<url>http://192.168.110.42:8082/repository/pica-3rdParty/</url> <url>http://192.168.141.133:8082/repository/pica-3rdParty/</url>
</repository> </repository>
<snapshotRepository>
<id>snapshots</id>
<name>Nexus Snapshots Repository</name>
<uniqueVersion>false</uniqueVersion>
<layout>legacy</layout>
<url>http://192.168.110.42:8082/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement> </distributionManagement>
<repositories>
<repository>
<id>nexus</id>
<url>http://192.168.110.42:8082/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<build> <build>
<finalName>pica-cloud-account-client</finalName> <finalName>pica-cloud-account-client</finalName>
</build> </build>
......
package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author andong
* @create 2019/7/19
*/
@FeignClient(name = "13201-pica-cloud-account")
public interface AccountInfoClient {
@PostMapping("/account/info/count")
PicaResponse<Integer> getCount(@RequestBody AccountInfoReq req);
@PostMapping("/account/info/doctorIds")
PicaResponse<List<Integer>> getDoctorIds(@RequestBody AccountInfoReq req);
}
package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.EncryptEntity;
import com.pica.cloud.account.account.common.req.LoginResult;
import com.pica.cloud.account.account.common.req.OCINRequest;
import com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* Created on 2019/10/16 17:28
* author:crs
* Description:RegisterClient
*/
@FeignClient(name = "13201-pica-cloud-account")
public interface RegisterClient {
@PostMapping(value = "/account/register")
PicaResponse<LoginResult> register(@RequestBody EncryptEntity entity);
@PostMapping(value = "/account/register/ocin")
PicaResponse register(@RequestBody OCINRequest ocinRequest);
}
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId> <artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1</version>
<name>pica-cloud-account-common</name> <name>pica-cloud-account-common</name>
<packaging>jar</packaging> <packaging>jar</packaging>
...@@ -21,11 +22,19 @@ ...@@ -21,11 +22,19 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
</properties> </properties>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.14</version>
</dependency>
</dependencies>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>nexus</id> <id>nexus</id>
<name>Pica 3rdParty Repository</name> <name>Pica 3rdParty Repository</name>
<url>http://192.168.110.42:8082/repository/pica-3rdParty/</url> <url>http://192.168.141.133:8082/repository/pica-3rdParty/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
......
package com.pica.cloud.account.account.common.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @author andong
* @create 2019/7/18
*/
@ApiModel
public class AccountInfoReq {
@ApiModelProperty("省ID")
private Long provinceId;
@ApiModelProperty("市ID")
private Long cityId;
@ApiModelProperty("区ID")
private Long countyId;
@ApiModelProperty("技术职称ID")
private List<Long> titleIds;
@ApiModelProperty("医院等级编号")
private List<Integer> levelGrades;
public AccountInfoReq() {}
public AccountInfoReq(Long provinceId, Long cityId, Long countyId, List<Long> titleIds, List<Integer> levelGrades) {
this.provinceId = provinceId;
this.cityId = cityId;
this.countyId = countyId;
this.titleIds = titleIds;
this.levelGrades = levelGrades;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public Long getCountyId() {
return countyId;
}
public void setCountyId(Long countyId) {
this.countyId = countyId;
}
public List<Long> getTitleIds() {
return titleIds;
}
public void setTitleIds(List<Long> titleIds) {
this.titleIds = titleIds;
}
public List<Integer> getLevelGrades() {
return levelGrades;
}
public void setLevelGrades(List<Integer> levelGrades) {
this.levelGrades = levelGrades;
}
}
package com.pica.cloud.account.account.common.req;
/**
* 加解密数据模型
*/
public class EncryptEntity {
/**
* 加密后的密文
*/
private String key;
/**
* 加密后的数据
*/
private String content;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
// @Override
// public String toString() {
// return "EncryptEntity{" +
// "key='" + key + '\'' +
// ", content='" + content + '\'' +
// '}';
// }
}
package com.pica.cloud.account.account.common.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Created on 2019/10/9 17:41
* author:crs
* Description: 登录状态返回
*/
@ApiModel
public class LoginResult {
@ApiModelProperty("token")
private String token;
@ApiModelProperty("用户id")
private Long userId;
@ApiModelProperty("是否绑定")
private String bindFlag;
@ApiModelProperty("联合登录id")
private String unionId;
@ApiModelProperty("是否完善过信息,1.信息未补全, 2信息已补全,3已补全密码")
private int entireFlag;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBindFlag() {
return bindFlag;
}
public void setBindFlag(String bindFlag) {
this.bindFlag = bindFlag;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public int getEntireFlag() {
return entireFlag;
}
public void setEntireFlag(int entireFlag) {
this.entireFlag = entireFlag;
}
}
package com.pica.cloud.account.account.common.req;
import io.swagger.annotations.ApiModelProperty;
/**
* Created on 2019/10/16 16:46
* author:crs
* Description:ocin项目
*/
public class OCINRequest {
public String mobile;
private String name;
private Integer hospitalId;
private Integer flag;
@ApiModelProperty("产品线类型")
private Integer productType;
@ApiModelProperty("渠道来源")
private Integer sourceType;
@ApiModelProperty("登录ip")
private String loginIp;
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getHospitalId() {
return hospitalId;
}
public void setHospitalId(Integer hospitalId) {
this.hospitalId = hospitalId;
}
public Integer getFlag() {
return flag;
}
public void setFlag(Integer flag) {
this.flag = flag;
}
public Integer getProductType() {
return productType;
}
public void setProductType(Integer productType) {
this.productType = productType;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
}
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
<artifactId>pica-cloud-service-starter</artifactId> <artifactId>pica-cloud-service-starter</artifactId>
<version>1.2.5-SNAPSHOT</version> <version>1.2.5-SNAPSHOT</version>
<exclusions> <exclusions>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-redis</artifactId>
</exclusion>
<exclusion> <exclusion>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
...@@ -70,6 +74,46 @@ ...@@ -70,6 +74,46 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-utils</artifactId>
<version>2.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-entity</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--zipkin dependencies begin--> <!--zipkin dependencies begin-->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
...@@ -79,6 +123,33 @@ ...@@ -79,6 +123,33 @@
<groupId>org.springframework.kafka</groupId> <groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId> <artifactId>spring-kafka</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-encryption-client</artifactId>
<version>1.0.2</version>
<exclusions>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-entity</artifactId>
</exclusion>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
...@@ -98,13 +169,15 @@ ...@@ -98,13 +169,15 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<repositories> <repositories>
<repository> <repository>
<id>nexus</id> <id>nexus</id>
<url>http://192.168.110.42:8082/repository/maven-public/</url> <url>http://192.168.141.133:8082/repository/maven-public/</url>
<releases> <releases>
<enabled>true</enabled> <enabled>true</enabled>
<updatePolicy>never</updatePolicy> <updatePolicy>never</updatePolicy>
...@@ -119,7 +192,7 @@ ...@@ -119,7 +192,7 @@
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>nexus</id> <id>nexus</id>
<url>http://192.168.110.42:8082/repository/maven-public/</url> <url>http://192.168.141.133:8082/repository/maven-public/</url>
<releases> <releases>
<enabled>true</enabled> <enabled>true</enabled>
<updatePolicy>never</updatePolicy> <updatePolicy>never</updatePolicy>
......
...@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication(scanBasePackages = "com.pica.cloud", exclude = {XxlJobConfiguration.class}) @SpringBootApplication(scanBasePackages = "com.pica.cloud", exclude = {XxlJobConfiguration.class})
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableSwagger2 @EnableSwagger2
@EnableFeignClients @EnableFeignClients(basePackages = "com.pica.cloud")
@MapperScan("com.pica.cloud.account.account.server.mapper") @MapperScan("com.pica.cloud.account.account.server.mapper")
@EnableTransactionManagement @EnableTransactionManagement
public class App { public class App {
......
package com.pica.cloud.account.account.server;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.req.PatientReq;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.RSAUtil;
import org.springframework.boot.autoconfigure.SpringBootApplication;
public class Test {
public static void main(String[] args) throws Exception {
// String json="{\"key\":\"密钥\",\"content\": {\"mobilePhone\" : \"1302412588\", \"flag\": \"1\"}}\n" +
// " }";
//获取验证码参数
BaseRequest request = new BaseRequest();
request.setFlag(1);
request.setMobile("13024112070");
String string = JSONObject.toJSONString(request);
System.out.println(string);
EncryptEntity encryptEntity = new EncryptEntity();
encryptEntity.setContent(string);
System.out.println(JSONObject.toJSONString(encryptEntity));
System.out.println("------------------------------>");
//获取注册参数
// BaseRequest register = null;
// register = new BaseRequest();
// register.setMobile("13024112588");
// register.setPassword("qq123456");
// register.setAuthCode("111111");
// String registerString = JSONObject.toJSONString(register);
// System.out.println(registerString);
// EncryptEntity registerEncryptEntity = new EncryptEntity();
// registerEncryptEntity.setContent(registerString);
// System.out.println(JSONObject.toJSONString(registerEncryptEntity));
// System.out.println("------------------------------>");
//
// //修改用户信息接口
// PatientReq req=new PatientReq();
// req.setAddress("测试数据");
// req.setEmail("2586622608@qq.com");
// req.setTelephone("座机号码");
// String json = JSONObject.toJSONString(req);
// System.out.println(json);
// EncryptEntity patientReqEncryptEntity = new EncryptEntity();
// patientReqEncryptEntity.setContent(json);
// System.out.println(JSONObject.toJSONString(patientReqEncryptEntity));
// Doctor doctor = new Doctor();
// doctor.setName("crs");
// doctor.setMobilePhone("13024112222");
// doctor.setPassword("qq123456");
// doctor.setCard("412702195468146814821");
// doctor.setCityName("上海市");
// String doctorJson = JSONObject.toJSONString(doctor);
// System.out.println(doctorJson);
// String mobile = jsonObject.getString("mobile");
// String authCode = jsonObject.getString("authCode");
// String password = jsonObject.getString("password");
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("mobile","13024112565");
// jsonObject.put("authCode","13024112565");
// jsonObject.put("password","qq123456");
// System.out.println(jsonObject.toJSONString());
// System.out.println("--------------------》");
//
//
// EncryptEntity encryptEntity1 = new EncryptEntity();
// encryptEntity1.setContent("content");
// encryptEntity1.setKey("awgvsfgwgv");
// String encryptEntity1Json = JSONObject.toJSONString(encryptEntity1);
// System.out.println(encryptEntity1Json);
System.out.println("--------------------登录接口-------------");
String publicKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB";
BaseRequest login = new BaseRequest();
login.setMobile("13024112588");
login.setPassword("d0dcbf0d12a6b1e7fbfa2ce5848f3eff");
String con = JSONObject.toJSONString(login);
String contentResult = AESUtil.aesEncrypt(con, "YCPQPx4qpQjEjDea");
String keyResult = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest = new EncryptEntity();
encryptTest.setContent(contentResult);
encryptTest.setKey(keyResult);
System.out.println(JSONObject.toJSONString(encryptTest));
System.out.println("--------------------修改密码接口-------------");
BaseRequest changePwd = new BaseRequest();
changePwd.setOldPwd("D0DCBF0D12A6B1E7FBFA2CE5848F3EFF");
changePwd.setPassword("0B9A75D6A88721A4BCF94F0FD668C56B");
String changePwdStr = JSONObject.toJSONString(changePwd);
System.out.println(changePwdStr);
String contentResult1 = AESUtil.aesEncrypt(changePwdStr, "YCPQPx4qpQjEjDea");
String keyResult1 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest1 = new EncryptEntity();
encryptTest1.setContent(contentResult1);
encryptTest1.setKey(keyResult1);
System.out.println(JSONObject.toJSONString(encryptTest1));
System.out.println("--------------------获取验证码接口-------------");
BaseRequest authCode = new BaseRequest();
authCode.setFlag(3);
authCode.setMobile("13024112092");
String authCodeStr = JSONObject.toJSONString(authCode);
System.out.println(authCodeStr);
String contentResult2 = AESUtil.aesEncrypt(authCodeStr, "YCPQPx4qpQjEjDea");
String keyResult2 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest2 = new EncryptEntity();
encryptTest2.setContent(contentResult2);
encryptTest2.setKey(keyResult2);
System.out.println(JSONObject.toJSONString(encryptTest2));
System.out.println("--------------------注册接口-------------");
//获取注册参数
BaseRequest register = null;
register = new BaseRequest();
register.setMobile("13024112092");
register.setPassword("D0DCBF0D12A6B1E7FBFA2CE5848F3EFF");
register.setAuthCode("843895");
String registerString3 = JSONObject.toJSONString(register);
String contentResult3 = AESUtil.aesEncrypt(registerString3, "YCPQPx4qpQjEjDea");
String keyResult3 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest3 = new EncryptEntity();
encryptTest3.setContent(contentResult3);
encryptTest3.setKey(keyResult3);
System.out.println(JSONObject.toJSONString(encryptTest3));
System.out.println("--------------------一键登录接口-------------");
BaseRequest loginRegister = null;
loginRegister = new BaseRequest();
loginRegister.setMobile("13024112081");
loginRegister.setAuthCode("163173");
String registerString4 = JSONObject.toJSONString(loginRegister);
String contentResult4 = AESUtil.aesEncrypt(registerString4, "YCPQPx4qpQjEjDea");
String keyResult4 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest4 = new EncryptEntity();
encryptTest4.setContent(contentResult4);
encryptTest4.setKey(keyResult4);
System.out.println(JSONObject.toJSONString(encryptTest4));
System.out.println("--------------------获取图片验证码接口-------------");
BaseRequest authCodeImage = new BaseRequest();
authCodeImage.setFlag(1);
authCodeImage.setMobile("13957290846");
authCodeImage.setCaptchaAnswer("94a8f");
authCodeImage.setCaptchaToken("2abb0a9063f2eb563db560f7ff34fba6");
String authCodeStr7 = JSONObject.toJSONString(authCodeImage);
System.out.println(authCodeStr7);
String contentResult7 = AESUtil.aesEncrypt(authCodeStr7, "YCPQPx4qpQjEjDea");
String keyResult7 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest7 = new EncryptEntity();
encryptTest7.setContent(contentResult7);
encryptTest7.setKey(keyResult7);
System.out.println(JSONObject.toJSONString(encryptTest7));
System.out.println("--------------------忘记密码-------------");
BaseRequest forgetPwd = new BaseRequest();
forgetPwd.setPassword("0B9A75D6A88721A4BCF94F0FD668C56B");
forgetPwd.setMobile("13024112092");
forgetPwd.setAuthCode("095502");
String changePwdStr9 = JSONObject.toJSONString(forgetPwd);
System.out.println(changePwdStr9);
String contentResult9 = AESUtil.aesEncrypt(changePwdStr9, "YCPQPx4qpQjEjDea");
String keyResult9 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity encryptTest9 = new EncryptEntity();
encryptTest9.setContent(contentResult9);
encryptTest9.setKey(keyResult9);
System.out.println(JSONObject.toJSONString(encryptTest9));
System.out.println("--------------------修改手机号-------------");
BaseRequest changeMobile = new BaseRequest();
changeMobile.setMobile("13024112092");
changeMobile.setAuthCode("623849");
String string1 = JSONObject.toJSONString(changeMobile);
System.out.println(string1);
String changeMobileContent = AESUtil.aesEncrypt(string1, "YCPQPx4qpQjEjDea");
String changeMobileKey = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
EncryptEntity changeMobileEntity = new EncryptEntity();
changeMobileEntity.setKey(changeMobileKey);
changeMobileEntity.setContent(changeMobileContent);
System.out.println(JSONObject.toJSONString(changeMobileEntity));
}
}
package com.pica.cloud.account.account.server.configuration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
@Configuration
@RefreshScope
public class PropertiesConfiguration {
@Value("${pica.cloud.message.url}")
private String messageUrl;
public String getMessageUrl() {
return messageUrl;
}
public void setMessageUrl(String messageUrl) {
this.messageUrl = messageUrl;
}
}
package com.pica.cloud.account.account.server.constants;
/**
* @author andong
* @create 2018/12/11
*/
public class Constants {
private Constants() {
}
public static final String SEND_MESSAGE = "/sms/send";
/**
* 批量短信url
*/
public static final String BATCH_SEND_MESSAGE = "/sms/send_batch_dif";
//token
public static final String TOKEN = "token";
//用户id
public static final String USER_ID = "userId";
//是否绑定
public static final String BIND_FLAG = "bindFlag";
//联合登录id
public static final String UNION_ID = "unionId";
//用户是否完善过信息
public static final String USER_ENTIRE_FLAG = "entireFlag";
/**
* 请求头信息
*/
public static final String HEADER_MOBILE = "mobile";
public static final String HEADER_USER_TYPE = "游客";
public static final String HEADER_BROWSER = "browser";
public static final String HEADER_OPERATOR_SYSTEM = "os";
public static final String HEADER_TERMINAL_TYPE = "terminalType";
public static final String HEADER_SYS_CODE = "sysCode";
public static final String HEADER_SYS_SOURCE = "app";
public static final String HEADER_GUEST_ID = "guest_id";
public static final String HEADER_IP = "ip";
/**
* 时间格式化
*/
public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
}
package com.pica.cloud.account.account.server.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.configuration.PropertiesConfiguration;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.util.PICAPSendMsgModel;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.utils.constants.SysCode;
import com.pica.cloud.foundation.utils.controller.BaseController;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.HttpClientUtil;
import com.pica.cloud.foundation.utils.utils.MD5Util;
import com.pica.cloud.foundation.utils.utils.json.Object2Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
* controller基类
*
* @author andong
* @create 2019/5/21
*/
public abstract class AccountBaseController extends BaseController {
private static final String KEY_PREFIX = "token-doctor-";
private Logger logger = LoggerFactory.getLogger(AccountBaseController.class);
@Autowired
private PropertiesConfiguration configuration;
//从token获取医生ID
public long getDoctorIdByToken() {
try {
PicaUser picaUser = super.fetchPicaUser();
return picaUser.getId().longValue();
} catch (Exception ex) {
throw new PicaException(PicaResultCode.LOGIN_FAILE);
}
}
//获取deviceInfo信息
public String getDeviceInfo(String key) {
String deviceInfo = super.getDeviceInfo();
if (StringUtils.isBlank(key) || StringUtils.isBlank(deviceInfo)) {
return StringUtils.EMPTY;
}
try {
JSONObject jsonObject = JSONObject.parseObject(deviceInfo);
return jsonObject.getString(key);
} catch (Exception ex) {
return StringUtils.EMPTY;
}
}
//保存token,并返回token值(web或app,不包含h5)
public String saveToken(String token, PicaUser picaUser) {
if (StringUtils.isNotEmpty(token)) {
picaUser.setToken(token);
}
String sysCode = super.getSysCode();
if ("9".equals(sysCode)) {
sysCode = "saas";
} else if ("10".equals(sysCode)) {
sysCode = "app";
}
String tokenValue = super.getRedisClient().get(KEY_PREFIX + picaUser.getId().toString() + "-" + sysCode);
if (StringUtils.isNotBlank(tokenValue)) {
return tokenValue.replace("token-", ""); //token已经存在则直接返回
}
try {
Map<String, String> data = Object2Map.objectToMapString("yyyy-MM-dd HH:mm:ss", picaUser, new String[0]);
data.put("sysCode", sysCode);
return super.getRedisClient().saveToken(data, 365 * 24 * 3600); //token有效期365天
} catch (Exception ex) {
logger.error("保存token失败,doctorId: {}", picaUser.getId());
return StringUtils.EMPTY;
}
}
//发送手机短信
public void sendMobileMessage(String mobile, String content, long senderId) {
String sysCodeStr = super.getSysCode();
int sysCode = 10; //默认移动端
if (StringUtils.isNotBlank(sysCodeStr)) {
try {
sysCode = Integer.parseInt(sysCodeStr);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
String messageUrl = configuration.getMessageUrl() + Constants.SEND_MESSAGE;
PICAPSendMsgModel picapSendMsgModel = new PICAPSendMsgModel();
picapSendMsgModel.setContent(content);
picapSendMsgModel.setMobile(mobile);
picapSendMsgModel.setUserId((int) senderId);
ArrayList<String> params = new ArrayList();
params.add("");
params.add(String.valueOf(sysCode));
picapSendMsgModel.setParams(params);
picapSendMsgModel.setTmplId(17636);
picapSendMsgModel.setSign("");
picapSendMsgModel.setExt("");
picapSendMsgModel.setExtend("");
picapSendMsgModel.setSupplementFlag(true);
picapSendMsgModel.setSms_entity_id(0);
long currentTimeMillis = System.currentTimeMillis();
picapSendMsgModel.setTime(String.valueOf(currentTimeMillis));
picapSendMsgModel.setKey(MD5Util.MD5("pica" + currentTimeMillis));
picapSendMsgModel.setSysCode(SysCode.APP.sysCode());
picapSendMsgModel.setSysName(SysCode.APP.sysName());
String postData = JSON.toJSONString(picapSendMsgModel);
String jsonObj = HttpClientUtil.httpExecute(messageUrl, postData);
if (StringUtils.isNotBlank(jsonObj)) {
logger.info("发送短信成功,返回结果:{}", jsonObj);
} else {
logger.error("发送短信失败");
}
}
/**
* 账户信息
*
* @return
*/
public AccountUser getAccountUser() {
//把所有请求头信息都封装到当前模型中
String token = this.getToken();
AccountUser accountUser = super.getRedisClient().getToken(token, AccountUser.class);
accountUser.setLoginFrom(this.getSourceType());
accountUser.setLoginPlatform(this.getProductType());
accountUser.setLoginIp(super.getIpAddr());
return accountUser;
}
/**
* 获取账户id
*
* @return
*/
public Integer getAcctId() {
try {
AccountUser accountUser = getAccountUser();
return accountUser.getAcctId();
} catch (Exception e) {
e.printStackTrace();
throw new AccountException(AccountExceptionEnum.PICA_LOGIN_AGAIN);
}
}
/**
* 产品线类型:productType: 1.云鹊医(默认值) 2云鹊健康
*
* @return
*/
public Integer getProductType() {
HttpServletRequest request = super.getRequest();
String str = request.getHeader("productType");
if (StringUtils.isNotEmpty(str)) {
return Integer.parseInt(str);
}
return null;
}
/**
* 终端来源 sourceType:1.android 2.ios 3.web 4.wechat(例如微信小程序) 5.h5
*
* @return
*/
public Integer getSourceType() {
HttpServletRequest request = super.getRequest();
String str = request.getHeader("sourceType");
if (StringUtils.isNotEmpty(str)) {
return Integer.parseInt(str);
}
return null;
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.mapper.AccountMapper;
import com.pica.cloud.account.account.server.req.AccountReq;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.account.account.server.service.CaptchaService;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.constants.CommonConstants;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import com.pica.cloud.foundation.utils.utils.json.Object2Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
/**
* 账号相关controller
*
* @author andong
* @create 2019/5/20
*/
@Api(description = "账号管理")
@RestController
@RequestMapping("/account")
public class AccountController extends AccountBaseController {
private final String AUTH_CODE_PREFIX = "authCode-";
private Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
private AccountService accountService;
@Autowired
private CaptchaService captchaService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
@GetMapping("/test")
public String test() {
return "test";
}
@ApiOperation("获取登录验证码")
@GetMapping("/authCode")
public PicaResponse<String> getAuthCode(@ApiParam(value = "手机号", required = true) @RequestParam("mobilePhone") String mobilePhone,
@ApiParam(value = "验证码类型 0默认 1注册 2修改密码 4微信登录绑定手机 5修改手机 6重置密码 7患者招募提交问卷(效验") @RequestParam(value = "flag", defaultValue = "0") String flag,
@ApiParam(value = "图形验证码token", required = true) @RequestParam("captchaToken") String captchaToken,
@ApiParam(value = "图形验证码答案", required = true) @RequestParam("captchaAnswer") String captchaAnswer) {
//校验图形验证码
if (!captchaService.acknowledge(captchaToken, captchaAnswer)) {
return PicaResponse.toResponse(null, PicaResultCode.PARAM_IS_INVALID.code(), "图形验证码错误");
}
this.checkMobilePhone(mobilePhone);
String authCode = CommonUtil.createValidateCode(); //随机生成验证码
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
long senderId = 0L;
if (Integer.parseInt(flag) != 7) {
//判断账号是否已经存在
Account account = accountService.getByMobilePhone(mobilePhone);
senderId = account == null ? 0L : account.getId();
}
//验证码保存到redis,失效时间10分钟
redisClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600);
//发送短信
super.sendMobileMessage(mobilePhone, message, senderId);
return PicaResponse.toResponse(StringUtils.EMPTY);
}
@ApiOperation("教培项目校验短信验证码")
@GetMapping("/check/authCode")
public PicaResponse checkAuthCode(@ApiParam(value = "手机号", required = true) @RequestParam("mobilePhone") String mobilePhone,
@ApiParam(value = "验证码类型 0默认 1注册 2修改密码 4微信登录绑定手机 5修改手机 6重置密码 7患者招募提交问卷(效验") @RequestParam(value = "flag", defaultValue = "0") String flag,
@ApiParam(value = "短信验证码", required = true) @RequestParam("authCode") String authCode) {
this.checkMobilePhone(mobilePhone);
AccountReq accountReq = new AccountReq();
accountReq.setMobilePhone(mobilePhone);
accountReq.setFlag(flag);
accountReq.setAuthCode(authCode);
this.checkAuthCode(accountReq);
return PicaResponse.toResponse();
}
@ApiOperation("微信登录")
@PostMapping("/login/wechat")
public PicaResponse<String> wechatLogin(@RequestBody AccountReq req) {
if (StringUtils.isBlank(req.getUnionid())) {
return PicaResponse.toResponse(null, PicaResultCode.PARAM_IS_INVALID.code(), "缺少unionid");
}
Account account = accountService.getByUnionid(req.getUnionid()); //获取账号信息
if (account == null) {
return PicaResponse.toResponse(null, PicaResultCode.RESULE_DATA_NONE.code(), "该unionid未绑定云鹊医账号");
}
//已经绑定过云鹊医账号,登录成功,返回token
String deviceType = super.getDeviceInfo("device_type"); //1:pc 2:android 3:ios
String newToken = this.generateToken(account, deviceType);
return PicaResponse.toResponse(newToken);
}
@ApiOperation("密码或验证码登录")
@PostMapping("/login")
public PicaResponse<String> login(@RequestBody AccountReq req) {
this.checkMobilePhone(req.getMobilePhone());
Account account = accountService.getByMobilePhone(req.getMobilePhone()); //获取账号信息
if (account == null) {
return PicaResponse.toResponse(null, PicaResultCode.RESULE_DATA_NONE.code(), "未注册,请验证码登录");
}
if (StringUtils.isBlank(req.getPassword())) { //验证码登录
req.setFlag("0");
this.checkAuthCode(req); //校验验证码
} else { //密码登录
if (!StringUtils.equals(req.getPassword(), account.getPassword())) {
return PicaResponse.toResponse(null, PicaResultCode.PARAM_IS_INVALID.code(), "请输入正确的密码");
}
}
//更新最后登录时间
Account update = new Account();
update.setId(account.getId());
update.setLastLoginTime(new Date());
if (StringUtils.isBlank(account.getUnionid()) && StringUtils.isNotBlank(req.getUnionid())) {
update.setUnionid(req.getUnionid()); //绑定微信unionid
update.setModifyId(account.getId());
update.setModifyTime(new Date());
}
accountService.updateAccountById(update);
//登录成功,清除旧token,生成新token
String deviceType = super.getDeviceInfo("device_type"); //1:pc 2:android 3:ios
String newToken = this.generateToken(account, deviceType);
return PicaResponse.toResponse(newToken);
}
// @ApiOperation("注册")
// @PostMapping("/register")
public PicaResponse<LoginResult> register(@RequestBody AccountReq req) {
this.checkMobilePhone(req.getMobilePhone());
this.checkAuthCode(req);
String deviceType = super.getDeviceInfo("device_type"); //1:pc 2:android 3:ios
Account account = new Account();
account.setMobilePhone(EncryptUtils.encryptContent(req.getMobilePhone(), EncryptConstants.ENCRYPT_TYPE_MOBILE));
switch (deviceType) { //注册来源
case "1":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_3); //pc
break;
case "2":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_1); //android
break;
case "3":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_2); //ios
break;
default:
account.setRegisterSource(7); //H5注册
}
//创建账号
accountService.createAccount(account);
//生成token并返回
String newToken = this.generateToken(account, deviceType);
LoginResult result = new LoginResult();
result.setToken(newToken);
return PicaResponse.toResponse(result);
}
@ApiOperation("H5端一键登录功能,无需完善信息")
@PostMapping("/login-register/v1")
public PicaResponse loginRegister(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
this.checkMobilePhone(request.getMobile());
AccountReq req = new AccountReq();
req.setMobilePhone(request.getMobile());
req.setPassword(null);//登录或注册,只能使用验证码
req.setAuthCode(request.getAuthCode());
req.setFlag("0");
req.setUnionid(request.getUnionId());
//判断账号是否已经存在
Account account = accountService.getByMobilePhone(req.getMobilePhone());
if (account != null) {
PicaResponse response = this.login(req); //登录
if (response.getData() != null) {
LoginResult result = new LoginResult();
result.setToken(response.getData().toString());
return PicaResponse.toResponse(result);
}
return response;
} else {
return this.register(req); //注册
}
}
//手机格式校验
private void checkMobilePhone(String mobilePhone) {
if (StringUtils.isBlank(mobilePhone) || !ValidateUtils.isMobile(mobilePhone)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "请输入正确的手机号");
}
}
//获取验证码redis key
private String getAuthCodeKey(String mobilePhone, String flag) {
logger.info(AUTH_CODE_PREFIX + flag + "-" + EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE));
return AUTH_CODE_PREFIX + flag + "-" + EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
}
//校验验证码
private void checkAuthCode(AccountReq req) {
String flag = StringUtils.isBlank(req.getFlag()) ? "0" : req.getFlag();
if (StringUtils.isBlank(req.getAuthCode())) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
String authCodeKey = this.getAuthCodeKey(req.getMobilePhone(), flag);
logger.info(authCodeKey);
String cacheCode = redisClient.get(authCodeKey); //从redis获取验证码
if (StringUtils.isBlank(cacheCode)) {
throw new PicaException(PicaResultCode.RESULE_DATA_NONE.code(), "短信验证码已过期,请重新获取");
}
if (!StringUtils.equals(req.getAuthCode(), cacheCode)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
redisClient.del(authCodeKey); //清除验证码
}
//生成H5 token
private String generateH5Token(Account account) {
String newToken = StringUtils.EMPTY;
try {
//先清除旧token
String tokenValue = "token-doctor-" + account.getId().toString();
String oldToken = redisClient.get(tokenValue + "-h5");
if (StringUtils.isNotBlank(oldToken)) {
redisClient.del(oldToken);
}
//生成新token
int expiredSeconds = 30 * 24 * 60 * 60; //H5 token有效期30天
newToken = UUID.randomUUID().toString().replace("-", "").toUpperCase();
String tokenKey = "token-" + newToken;
redisClient.set(tokenKey, tokenValue, expiredSeconds);
redisClient.set(tokenValue + "-h5", tokenKey, expiredSeconds);
//用户数据放入缓存
String userData = redisClient.hget(tokenValue, "id");
if (StringUtils.isEmpty(userData)) {
PicaUser picaUser = new PicaUser();
picaUser.setToken(newToken);
picaUser.setId(account.getId().intValue());
picaUser.setMobile(account.getMobilePhone());
picaUser.setName(EncryptUtils.decryptContent(account.getMobilePhone(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY).replaceAll("(\\d{3})\\d{4}(\\w{4})", "$1****$2"));
picaUser.setCreated_time(account.getCreatTime());
Map<String, String> data = Object2Map.objectToMapString("yyyy-MM-dd HH:mm:ss", picaUser, new String[0]);
data.put("sysCode", "h5");
data.forEach((key, value) -> {
value = value == null ? "" : value;
redisClient.hset(tokenValue, key, value);
});
}
} catch (Exception ex) {
logger.error("生成H5 token异常:{}" + ex.getMessage(), ex);
}
return newToken;
}
//清除旧token,生成新token
private String generateToken(Account account, String deviceType) {
String newToken;
switch (deviceType) { //设备信息
case "1": //pc
//TODO
newToken = StringUtils.EMPTY;
break;
case "2": //android
case "3": //ios
//TODO 更新设备信息
newToken = StringUtils.EMPTY;
break;
default: //H5
newToken = this.generateH5Token(account);
}
return newToken;
}
/**
* 旧的注册接口,下个版本可以去掉
* @param req
* @return
*/
@ApiOperation("H5端一键登录功能,无需完善信息 旧接口")
@PostMapping("/login-register")
public PicaResponse<String> loginRegister(@RequestBody AccountReq req) {
this.checkMobilePhone(req.getMobilePhone());
req.setPassword(null); //登录或注册,只能使用验证码
//判断账号是否已经存在
Account account = accountService.getByMobilePhone(req.getMobilePhone());
if (account != null) {
return this.login(req); //登录
} else {
return this.registerOld(req); //注册
}
}
public PicaResponse<String> registerOld(@RequestBody AccountReq req) {
this.checkMobilePhone(req.getMobilePhone());
this.checkAuthCode(req);
String deviceType = super.getDeviceInfo("device_type"); //1:pc 2:android 3:ios
Account account = new Account();
account.setMobilePhone(EncryptUtils.encryptContent(req.getMobilePhone(), EncryptConstants.ENCRYPT_TYPE_MOBILE));
switch (deviceType) { //注册来源
case "1":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_3); //pc
break;
case "2":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_1); //android
break;
case "3":
account.setRegisterSource(CommonConstants.SYSTEM_TYPE_P024_NO_2); //ios
break;
default:
account.setRegisterSource(7); //H5注册
}
//创建账号
accountService.createAccount(account);
//生成token并返回
String newToken = this.generateToken(account, deviceType);
return PicaResponse.toResponse(newToken);
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.account.account.server.service.AccountInfoService;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
/**
* @author andong
* @create 2019/7/18
*/
@Api(description = "账号信息")
@RestController
@RequestMapping("/info")
public class AccountInfoController {
@Autowired
private AccountInfoService accountInfoService;
@ApiOperation("获取用户数量")
@PostMapping("/count")
public PicaResponse<Integer> getCount(@RequestBody AccountInfoReq req) {
if (req == null || (req.getProvinceId() == null && req.getCityId() == null && req.getCountyId() == null
&& CollectionUtils.isEmpty(req.getTitleIds()) && CollectionUtils.isEmpty(req.getLevelGrades()))) {
return PicaResponse.toResponse(accountInfoService.getTotalCount());
}
return PicaResponse.toResponse(accountInfoService.getCount(req));
}
@ApiOperation("获取医生ID列表")
@PostMapping("/doctorIds")
public PicaResponse<List<Integer>> getDoctorIds(@RequestBody AccountInfoReq req) {
if (req == null || (req.getProvinceId() == null && req.getCityId() == null && req.getCountyId() == null
&& CollectionUtils.isEmpty(req.getTitleIds()) && CollectionUtils.isEmpty(req.getLevelGrades()))) {
return PicaResponse.toResponse(Collections.emptyList());
}
return PicaResponse.toResponse(accountInfoService.getDoctorIds(req));
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author andong
* @create 2019/6/6
*/
@Api(description = "用户状态")
@RestController
@RequestMapping("/status")
public class AccountStatusController extends AccountBaseController {
@Autowired
private AccountService accountService;
@ApiOperation("获取用户状态信息")
@GetMapping("")
public PicaResponse<Account> getStatus() {
long doctorId = super.getDoctorIdByToken();
Account account = accountService.getById(doctorId);
return PicaResponse.toResponse(account);
}
@ApiOperation("获取用户缓存")
@GetMapping("/cache")
public PicaResponse<Map<String, String>> getCache(@RequestParam("id") long id) {
return PicaResponse.toResponse(accountService.getCache(id));
}
@ApiOperation("刷新用户缓存")
@GetMapping("/cache/refresh")
public PicaResponse refreshCache(@RequestParam("id") long id, @RequestParam(value = "token", required = false) Long token) {
if (id < 0 && (token == null || token.longValue() != 1564736008307L)) {
return PicaResponse.toResponse();
}
new Thread(() -> accountService.refreshCache(id)).start();
return PicaResponse.toResponse();
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.AccountUnionEntity;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.account.account.server.service.AccountUnionService;
import com.pica.cloud.account.account.server.service.CaptchaService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(description = "短信验证码资源")
@RestController
public class AutoCodeController extends AccountBaseController {
private final String AUTH_CODE_PREFIX = "authCode-";
private Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private AccountUnionService accountUnionService;
@Autowired
private CaptchaService captchaService;
@Autowired
private AccountService accountService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
@ApiOperation("获取短信验证码,无需图形验证码,如app端")
@PostMapping(value = "/authCode")
public PicaResponse getAuthCode(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
AccountUtils.checkMobilePhone(request.getMobile());
processSysCode(request.getMobile(), request.getFlag());
return PicaResponse.toResponse();
}
@ApiOperation("获取短信验证码,需要图形验证码,如H5端和PC端;验证码类型 0默认 1注册 2微信登录绑定手机 3修改手机 4重置密码 5忘记密码 7患者招募提交问卷(效验)")
@PostMapping("/account/authCode")
public PicaResponse<String> getAuthCodeWithCaptcha(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String mobilePhone = request.getMobile();
String flag = request.getFlag() + "";
String captchaToken = request.getCaptchaToken();
String captchaAnswer = request.getCaptchaAnswer();
//校验图形验证码
if (!captchaService.acknowledge(captchaToken, captchaAnswer)) {
return PicaResponse.toResponse(null, PicaResultCode.PARAM_IS_INVALID.code(), "图形验证码错误");
}
this.checkMobilePhone(mobilePhone);
String authCode = CommonUtil.createValidateCode(); //随机生成验证码
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
//判断账号是否已经存在
Integer accountIdByMobilePhone = accountService.getAccountIdByMobilePhone(mobilePhone);
long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone;
//验证码保存到redis,失效时间10分钟
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600);
logger.info(this.getAuthCodeKey(mobilePhone, flag));
//发送短信
super.sendMobileMessage(mobilePhone, message, senderId);
return PicaResponse.toResponse(StringUtils.EMPTY);
}
@ApiOperation("微信获取验证码")
@PostMapping(value = "/authCode/wechat")
public PicaResponse getWChatSysCode(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setFlag(AccountTypeEnum.SYSCODE_TYPE_WE_CHAT.getCode());
AccountUtils.checkMobilePhone(request.getMobile());
AccountUnionEntity accountUnionEntity = accountUnionService.selectInfoByUnionId(request.getUnionId());
if (accountUnionEntity != null) {
processSysCode(request.getMobile(), request.getFlag());
return PicaResponse.toResponse();
}
throw new AccountException(AccountExceptionEnum.PICA_UNBIND_MOBILE);
}
/**
* 验证码发送逻辑
* 1)随机数生成验证码;
* 2)验证码失效时间十分钟;
* 3)同一个业务一个手机号一分钟只能发送一次:提示:请X秒后重试.(用手机号区别用户,用flag区别业务类型)
*
* @param mobilePhone
* @param flag
*/
private void processSysCode(String mobilePhone, Integer flag) {
String authCodeKey = this.getAuthCodeKey(mobilePhone, flag.toString());
String authCodeKeySecure = authCodeKey + "-secure";
//如果存在,说明刚刚发送过验证码
if (cacheClient.exists(authCodeKey)) {
Long time = cacheClient.get(this.getAuthCodeKey(mobilePhone, flag.toString()) + "-secure", Long.class);
if (time == null) {
processSendAuthCode(mobilePhone, flag, authCodeKeySecure);
} else {
int remainTime = 59 - (int) (System.currentTimeMillis() - time) / 1000;
if (remainTime > 0) {
throw new AccountException(AccountExceptionEnum.PICA_SYSCODE_RETRY.getCode(),
AccountExceptionEnum.PICA_SYSCODE_RETRY.getMessage().replace("X", String.valueOf(remainTime)));
} else {
processSendAuthCode(mobilePhone, flag, authCodeKeySecure);
}
}
} else {
processSendAuthCode(mobilePhone, flag, authCodeKeySecure);
}
}
/**
* 调用发送验证码的接口
*
* @param mobilePhone
* @param flag
* @param authCodeKeySecure
*/
private void processSendAuthCode(String mobilePhone, Integer flag, String authCodeKeySecure) {
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
Integer accountIdByMobilePhone = accountService.getAccountIdByMobilePhone(mobilePhone);
long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone;
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag.toString()), authCode, 600);
logger.info("验证码缓存信息----->:"+this.getAuthCodeKey(mobilePhone, flag.toString()));
cacheClient.set(authCodeKeySecure, System.currentTimeMillis(), 60);
super.sendMobileMessage(mobilePhone, message, senderId);
}
//获取验证码redis key
private String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + AESUtil.encryptV0(mobilePhone);
}
//手机格式校验
private void checkMobilePhone(String mobilePhone) {
if (StringUtils.isBlank(mobilePhone) || !ValidateUtils.isMobile(mobilePhone)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "请输入正确的手机号");
}
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.service.CaptchaService;
import com.pica.cloud.account.account.server.util.captcha.CaptchaToken;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author andong
* @create 2019/8/9
*/
@Api(description = "图形验证码")
@RestController
@RequestMapping("/account")
public class CaptchaController {
@Autowired
private CaptchaService captchaService;
@ApiOperation("获取图形验证码")
@GetMapping("/captcha")
public PicaResponse<CaptchaToken> captcha(@ApiParam("图片宽度") @RequestParam(value = "width", required = false) Integer width,
@ApiParam("图片高度") @RequestParam(value = "height", required = false) Integer height) {
width = (width == null || width.intValue() <= 0) ? 160 : width;
height = (height == null || height.intValue() <= 0) ? 40 : height;
CaptchaToken captchaToken = captchaService.generateToken(width, height);
return PicaResponse.toResponse(captchaToken);
}
/*
@ApiOperation("校验图形验证码")
@GetMapping("/acknowledge")
public PicaResponse<Boolean> acknowledge(@ApiParam("token") @RequestParam("token") String token,
@ApiParam("answer") @RequestParam("answer") String answer) {
boolean valid = captchaService.acknowledge(token, answer);
return PicaResponse.toResponse(valid);
}
*/
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.util.RSAUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created on 2019/9/16 15:29
* author:crs
* Description:H5端获取公钥资源
*/
@Api(description = "密钥接口资源")
@RestController
public class CipherController {
@Value("${rsapublickey}")
private String rsaPublicKey;
@ApiOperation("获取公钥Key接口")
@GetMapping(value = "/cipher/key")
public PicaResponse<String> getPublicKey() {
return PicaResponse.toResponse(rsaPublicKey);
}
}
package com.pica.cloud.account.account.server.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/demo")
@Api(value = "冒烟测试", description = "测试 db,redis,config, zipkin, job")
public class DemoController {
@GetMapping("/test")
public String trace() {
return "test";
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* Created on 2019/9/10 18:51
* author:crs
* Description:云鹊医 获取用户信息资源
*/
@Api(description = "云鹊医用户信息信息资源")
@RestController
@RequestMapping("/doctor")
public class DoctorController extends AccountBaseController {
@Autowired
private DoctorService doctorService;
@ApiOperation("获取医生信息用接口")
@GetMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse<Doctor> getDoctorInfo() {
AccountUser accountUser = null;
try {
accountUser = super.getAccountUser();
} catch (Exception e) {
throw new AccountException(AccountExceptionEnum.PICA_LOGIN_AGAIN);
}
Integer userId = accountUser.getId();
Doctor doctorInfo = doctorService.getDoctorInfo(userId);
String mobilePhone = doctorInfo.getMobilePhone();
String dencrypt = EncryptUtils.decryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE, super.getToken());
mobilePhone = dencrypt.substring(0, 3) + "****" + dencrypt.substring(7, 11);
doctorInfo.setMobilePhone(mobilePhone);
return PicaResponse.toResponse(doctorInfo);
}
@ApiOperation("修改医生信息接口")
@PutMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse modifyDoctorInfo(@RequestBody Doctor doctor) {
doctorService.modifyDoctorInfo(doctor);
return PicaResponse.toResponse();
}
/**
* 当前医生是哪个admin账户添加的
*
* @param doctor
* @return
*/
@ApiOperation("客服系统新增医生")
@PostMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse addDoctorInfo(@RequestBody Doctor doctor) {
if (doctor != null && doctor.getMobilePhone() != null) {
AccountUtils.checkMobilePhone(doctor.getMobilePhone());
AccountUtils.checkPassword(doctor.getPassword());
Integer userId = doctorService.addDoctorInfo(doctor);
return PicaResponse.toResponse(userId);
} else {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
}
@ApiOperation("客服系统删除医生信息")
@DeleteMapping(value = "/delete/{id}")
public PicaResponse deleteDoctor(@PathVariable("id") Integer id) {
doctorService.deleteDoctorInfo(id);
return PicaResponse.toResponse();
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.TokenService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Api(description = "登录资源")
@RestController
public class LoginController extends AccountBaseController {
@Autowired
private LoginService loginService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
@Autowired
private AccountLogUtils picaLogUtils;
@Autowired
private AccountUtils accountUtils;
@Autowired
private TokenService tokenService;
@Autowired
private DoctorService doctorService;
/**
* 密码登录接口
*
* @param entity
* @return
* @throws Exception
*/
@ApiOperation("密码登录接口")
@PostMapping("/login")
public PicaResponse<LoginResult> loginByPassword(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
request.setLoginIp(super.getIpAddr());
AccountUtils.checkMobilePhone(request.getMobile());
AccountUtils.checkPassword(request.getPassword());
LoginResult login = loginService.login(request);
return PicaResponse.toResponse(login);
}
/**
* 一键登录
*
* @param entity
* @return
* @throws Exception
*/
@ApiOperation("PC,App端一键登录接口,需要完善信息")
@PostMapping(value = "/login-register")
public PicaResponse<LoginResult> loginAndRegister(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
accountUtils.checkMobilePhoneAndAuthCode(request.getMobile(), AccountTypeEnum.SYSCODE_TYPE_LOGIN.getCode() + "",request.getAuthCode());
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
request.setLoginIp(super.getIpAddr());
LoginResult login =loginService.loginAndRegister(request);
return PicaResponse.toResponse(login);
}
@ApiOperation("微信登录接口")
@PostMapping(value = "/login/wechat")
public PicaResponse<LoginResult> loginByWeChat(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
request.setLoginIp(super.getIpAddr());
LoginResult result = loginService.loginByWeChat(request);
return PicaResponse.toResponse(result);
}
@ApiOperation("微信登录第二步接口")
@PostMapping(value = "/login/wechat/step2")
public PicaResponse<LoginResult> loginByWeChatStep(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
accountUtils.checkMobilePhoneAndAuthCode(request.getMobile(), AccountTypeEnum.SYSCODE_TYPE_WE_CHAT.getCode() + "", request.getAuthCode());
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
request.setLoginIp(super.getIpAddr());
LoginResult result = loginService.loginByWeChatStep(request);
return PicaResponse.toResponse(result);
}
/**
* 绑定微信接口
*
* @param entity
* @return
* @throws Exception
*/
@ApiOperation("绑定微信接口")
@PostMapping("/login/wechat/bind")
public PicaResponse bindWeChat(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setAccId(super.getAcctId());
loginService.bindWeChat(request);
return PicaResponse.toResponse();
}
@ApiOperation("微信解除绑定接口")
@PutMapping("/login/wechat/unbind")
public PicaResponse unbindWeChat() {
Integer acctId = super.getAcctId();
loginService.unbindWeChat(acctId);
return PicaResponse.toResponse();
}
/**
* 退出登录接口,返回一个随机token
* 1)登录状态调用,2)清除token
*
* @return
*/
@ApiOperation(value = "退出登录接口")
@GetMapping("/logout")
public PicaResponse<String> loginOut() {
String token = super.getToken();
if (StringUtils.isNotEmpty(token)) {
Long doctorId = super.getDoctorIdByToken();
Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue());
Integer acctId = doctorInfo.getAcctId();
redisClient.deleteToken(token);
Map<String, Object> headersMap = super.getHeaders();
String newToken = tokenService.getToken(headersMap);
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, super.getProductType(), super.getSourceType(),
AccountTypeEnum.LOGIN_OUT.getCode(), super.getIpAddr(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
picaLogUtils.info(entity);
return PicaResponse.toResponse(newToken);
} else {
throw new AccountException(AccountExceptionEnum.PICA_LOGIN_AGAIN);
}
}
@ApiOperation(value = "web登录获取用户信息")
@GetMapping("/login/web")
public PicaResponse<LoginResultWeb> getLoginResult() {
LoginResultWeb resultWeb = new LoginResultWeb();
long doctorId = super.getDoctorIdByToken();
if (doctorId <= 0) {
resultWeb.setIsExist(2);
return PicaResponse.toResponse(resultWeb);
}
PICAPDoctor doctor = loginService.queryDoctor(doctorId);
resultWeb.setPicapDoctor(doctor);
if (doctor.getStatus() != null) {
resultWeb.setCertifyDoc(doctor.getStatus().intValue());
}
return PicaResponse.toResponse(resultWeb);
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.AccountInfoService;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.ModifyMobileService;
import com.pica.cloud.account.account.server.service.impl.AccountServiceImpl;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@Api(description = "修改手机号资源")
@RestController
public class ModifyMobileController extends AccountBaseController {
@Autowired
private AccountUtils accountUtils;
@Autowired
private ModifyMobileService modifyMobileService;
@Autowired
private DoctorService doctorService;
@Autowired
private AccountServiceImpl accountService;
@ApiOperation("修改手机号")
@PostMapping("/mobile/modify")
public PicaResponse modifyMobile(@RequestBody EncryptEntity entity) throws Exception {
Long doctorId = super.getDoctorIdByToken();
Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue());
String mobilePhone = doctorInfo.getMobilePhone();
Integer acctId = modifyMobileService.getAcctIdByMobile(mobilePhone);
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String mobile = request.getMobile();
accountUtils.checkMobilePhoneAndAuthCode(mobile, AccountTypeEnum.SYSCODE_TYPE_MODIFY_MOBILE.getCode() + "", request.getAuthCode());
//判断当前手机号是否已经注册过
AccountInfoEntity accountInfoEntity = accountService.getAccountByMobilePhone(mobile);
if (accountInfoEntity == null) {
modifyMobileService.modify(acctId, mobile);
return PicaResponse.toResponse();
} else {
return PicaResponse.toResponse(null,AccountExceptionEnum.PICA_ALREADY_REGISTER.getCode(),AccountExceptionEnum.PICA_ALREADY_REGISTER.getMessage());
}
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.PasswordService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(description = "密码资源")
@RestController
@RequestMapping("/password")
public class PasswordController extends AccountBaseController {
@Autowired
private PasswordService passwordService;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private AccountUtils accountUtils;
@Autowired
private DoctorService doctorService;
/**
* 修改密码
*
* @return
*/
@ApiOperation("修改密码接口")
@PostMapping(value = "/modify")
public PicaResponse modifyPassword(@RequestBody EncryptEntity entity) throws Exception {
Long doctorId= super.getDoctorIdByToken();
Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue());
String mobile = doctorInfo.getMobilePhone();
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobile);
if (accountInfoEntity != null) {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String oldPwd = request.getOldPwd();
String password = request.getPassword();
if (!StringUtils.isEmpty(password) && !StringUtils.isEmpty(oldPwd)) {
if (!password.equals(oldPwd)) {
passwordService.modifyPassword(mobile, oldPwd, password);
return PicaResponse.toResponse();
} else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_EQUAL);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_NULL);
}
}
return null;
}
/**
* 忘记密码
*
* @return
*/
@ApiOperation("忘记密码接口")
@PostMapping(value = "/reset")
public PicaResponse forgetPassword(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
accountUtils.checkMobilePhoneAndAuthCode(request.getMobile(), AccountTypeEnum.SYSCODE_TYPE_RESET_PASSWORD.getCode() + "", request.getAuthCode());
if (StringUtils.isEmpty(request.getPassword())) {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR);
}
passwordService.forgetPassword(request);
return PicaResponse.toResponse();
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.req.PatientReq;
import com.pica.cloud.account.account.server.service.PatientInfoService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(description = "云鹊健康用户信息资源")
@RestController
@RequestMapping(value = "/patient")
public class PatientInfoController extends AccountBaseController {
@Autowired
private PatientInfoService patientInfoService;
/**
* 获取用户信息接口,产品线不同,用户信息不同(云鹊医,云鹊健康)
*
* @return
*/
@ApiOperation("获取居民信息")
@GetMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse getUserInfo() {
AccountUser accountUser = super.getAccountUser();
AccountPatientInfoEntity userInfo = null;
Integer loginFrom = accountUser.getLoginFrom();
Integer userId = accountUser.getId();
if (loginFrom == 2) {
userInfo = patientInfoService.getUserInfo(userId);
}
return PicaResponse.toResponse(userInfo);
}
/**
* 修改用户信息接口
*
* @return
*/
@ApiOperation("修改居民信息")
@PutMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse putUserInfo(@RequestBody EncryptEntity entity) throws Exception {
Integer id = super.getAccountUser().getId();
PatientReq request = CryptoUtil.decrypt(entity, PatientReq.class);
request.setId(id);
request.setAcctId(super.getAcctId());
AccountPatientInfoEntity accountPatientInfoEntity = new AccountPatientInfoEntity();
BeanUtils.copyProperties(accountPatientInfoEntity, request);
patientInfoService.updateUserInfo(accountPatientInfoEntity);
return PicaResponse.toResponse();
}
@ApiOperation("客服系统添加居民信息")
@PostMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse addPatientInfo(AccountPatientInfoEntity entity) {
Integer userId = super.getAccountUser().getId();
AccountUtils.checkMobilePhone(entity.getMobilePhone());
if (StringUtils.isBlank(entity.getName())) {
patientInfoService.addPatientInfo(entity, userId);
} else {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
return PicaResponse.toResponse();
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.common.req.OCINRequest;
import com.pica.cloud.account.account.server.service.RegisterService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(description = "注册资源")
@RestController
@RequestMapping("/register")
public class RegisterController extends AccountBaseController {
@Autowired
private RegisterService registerService;
@Autowired
private AccountUtils accountUtils;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
@ApiOperation("PC端,移动端注册接口")
@PostMapping(value = "")
public PicaResponse<LoginResult> register(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String mobile = request.getMobile();
//接口幂等性处理(redis中没有就进行注册逻辑,如果已经存在,就不处理)
String authCode = request.getAuthCode();
String flag = AccountTypeEnum.SYSCODE_TYPE_REGISTER.getCode() + "";
accountUtils.checkMobilePhoneAndAuthCode(mobile, flag, authCode);
accountUtils.checkPassword(request.getPassword());
LoginResult result = null;
request.setFlag(AccountTypeEnum.SYSCODE_TYPE_REGISTER.getCode());
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
request.setLoginIp(super.getIpAddr());
result = registerService.register(request);
return PicaResponse.toResponse(result);
}
//"sourceType":6 表示长海项目
@ApiOperation("OCIN项目")
@PostMapping(value = "/ocin")
public PicaResponse register(@RequestBody OCINRequest ocinRequest) {
registerService.ocinRegister(ocinRequest);
return PicaResponse.toResponse();
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.service.TokenService;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* Created on 2019/9/10 9:35
* author:crs
* Description:获取随机token
*/
@Api(description = "获取游客token")
@RestController
public class TokenController extends AccountBaseController {
@Autowired
private TokenService tokenService;
@ApiOperation(value = "获取token接口")
@GetMapping(value = "/token")
public PicaResponse<String> getRandomToken() {
Map<String, Object> headersMap = super.getHeaders();
String token = tokenService.getToken(headersMap);
return PicaResponse.toResponse(token);
}
}
package com.pica.cloud.account.account.server.entity;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* 账号
* @author andong
* @create 2019/5/20
*/
public class Account {
private Long id;
private Integer acctId;
private Integer sex;
private String name;
private String mobilePhone;
@ApiModelProperty("认证状态 1未认证,2认证中,3认证通过,4认证不通过,5验证码认证,6 重新认证中,7 重新认证失败")
private Integer status;
private String avatarImageUrl;
private String email;
private String qrcode;
private String nickname;
private String personalSign;
private Integer deleteFlag;
private Long creatId;
private Date creatTime;
private Long modifyId;
private Date modifyTime;
private String password;
private String info;
@ApiModelProperty("1信息未补全,2信息已补全,3已补全密码")
private Integer entireFlag;
private Date regTime;
private Date lastLoginTime;
private String unionid;
private Integer registerSource;
private String comment;
private Integer registerType;
private Date firstLoginTime;
private String card;
private Date birthday;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getAvatarImageUrl() {
return avatarImageUrl;
}
public void setAvatarImageUrl(String avatarImageUrl) {
this.avatarImageUrl = avatarImageUrl;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getPersonalSign() {
return personalSign;
}
public void setPersonalSign(String personalSign) {
this.personalSign = personalSign;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Long getCreatId() {
return creatId;
}
public void setCreatId(Long creatId) {
this.creatId = creatId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Long getModifyId() {
return modifyId;
}
public void setModifyId(Long modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public Integer getEntireFlag() {
return entireFlag;
}
public void setEntireFlag(Integer entireFlag) {
this.entireFlag = entireFlag;
}
public Date getRegTime() {
return regTime;
}
public void setRegTime(Date regTime) {
this.regTime = regTime;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public Integer getRegisterSource() {
return registerSource;
}
public void setRegisterSource(Integer registerSource) {
this.registerSource = registerSource;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Integer getRegisterType() {
return registerType;
}
public void setRegisterType(Integer registerType) {
this.registerType = registerType;
}
public Date getFirstLoginTime() {
return firstLoginTime;
}
public void setFirstLoginTime(Date firstLoginTime) {
this.firstLoginTime = firstLoginTime;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AccountInfoEntity {
private Integer id;
private String mobilePhone;
private String password;
private Integer registerProduct;
private Integer registerSource;
private String name;
private Integer age;
private Date birthday;
private Integer sex;
private String idCard;
private Date regTime;
private Integer deleteFlag;
private Integer createdId;
private Date createdTime;
private Integer modifiedId;
private Date modifiedTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getRegisterProduct() {
return registerProduct;
}
public void setRegisterProduct(Integer registerProduct) {
this.registerProduct = registerProduct;
}
public Integer getRegisterSource() {
return registerSource;
}
public void setRegisterSource(Integer registerSource) {
this.registerSource = registerSource;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public Date getRegTime() {
return regTime;
}
public void setRegTime(Date regTime) {
this.regTime = regTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AccountPatientInfoEntity {
private Integer id;
private Integer acctId;
private String villageName;
private String mobilePhone;
private String name;
private Long villageId;
private String townName;
private Long townId;
private String countyName;
private Long countyId;
private String cityName;
private Long cityId;
private String provinceName;
private Long provinceId;
private Long country;
private String headImgUrl;
private String address;
private String patientAddress;
private String telephone;
private String socialCard;
private String workUnit;
private String healthFileNumber;
private String paymentType;
private String remarks;
private String email;
private String nation;
private Integer createId;
private Date createTime;
private Integer modifyId;
private Date modifyTime;
private int deleteFlag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public String getVillageName() {
return villageName;
}
public void setVillageName(String villageName) {
this.villageName = villageName == null ? null : villageName.trim();
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public String getTownName() {
return townName;
}
public void setTownName(String townName) {
this.townName = townName == null ? null : townName.trim();
}
public Long getTownId() {
return townId;
}
public void setTownId(Long townId) {
this.townId = townId;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName == null ? null : countyName.trim();
}
public Long getCountyId() {
return countyId;
}
public void setCountyId(Long countyId) {
this.countyId = countyId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName == null ? null : cityName.trim();
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName == null ? null : provinceName.trim();
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getCountry() {
return country;
}
public void setCountry(Long country) {
this.country = country;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl == null ? null : headImgUrl.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getPatientAddress() {
return patientAddress;
}
public void setPatientAddress(String patientAddress) {
this.patientAddress = patientAddress == null ? null : patientAddress.trim();
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim();
}
public String getSocialCard() {
return socialCard;
}
public void setSocialCard(String socialCard) {
this.socialCard = socialCard == null ? null : socialCard.trim();
}
public String getWorkUnit() {
return workUnit;
}
public void setWorkUnit(String workUnit) {
this.workUnit = workUnit == null ? null : workUnit.trim();
}
public String getHealthFileNumber() {
return healthFileNumber;
}
public void setHealthFileNumber(String healthFileNumber) {
this.healthFileNumber = healthFileNumber == null ? null : healthFileNumber.trim();
}
public String getPaymentType() {
return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType == null ? null : paymentType.trim();
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation == null ? null : nation.trim();
}
public Integer getCreateId() {
return createId;
}
public void setCreateId(Integer createId) {
this.createId = createId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public int getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(int deleteFlag) {
this.deleteFlag = deleteFlag;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AccountUnionEntity {
private Integer id;
private Long acctId;
private Integer unionType;
private String unionId;
private Integer deleteFlag;
private Integer createdId;
private Date createdTime;
private Integer modifiedId;
private Date modifiedTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getAcctId() {
return acctId;
}
public void setAcctId(Long acctId) {
this.acctId = acctId;
}
public Integer getUnionType() {
return unionType;
}
public void setUnionType(Integer unionType) {
this.unionType = unionType;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId == null ? null : unionId.trim();
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import com.pica.cloud.foundation.utils.entity.PicaUser;
public class AccountUser extends PicaUser {
//账户id
private Integer acctId;
//渠道来源
private Integer loginFrom;
//平台来源
private Integer loginPlatform;
//账户名
private String acctName;
//登录ip
private String loginIp;
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getLoginFrom() {
return loginFrom;
}
public void setLoginFrom(Integer loginFrom) {
this.loginFrom = loginFrom;
}
public Integer getLoginPlatform() {
return loginPlatform;
}
public void setLoginPlatform(Integer loginPlatform) {
this.loginPlatform = loginPlatform;
}
public String getAcctName() {
return acctName;
}
public void setAcctName(String acctName) {
this.acctName = acctName;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AccountWeChatInfoEntity {
private Integer id;
private String unionid;
private String openid;
private String nickname;
private String headImgUrl;
private int sex;
private String country;
private String province;
private String city;
private String language;
private Integer type;
private String privilege;
private Integer subscribe;
private Date subscribeTime;
private String remark;
private String groupid;
private String tagidList;
private Integer deleteFlag;
private Integer createdId;
private Date createdTime;
private Integer modifiedId;
private Date modifiedTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getPrivilege() {
return privilege;
}
public void setPrivilege(String privilege) {
this.privilege = privilege;
}
public Integer getSubscribe() {
return subscribe;
}
public void setSubscribe(Integer subscribe) {
this.subscribe = subscribe;
}
public Date getSubscribeTime() {
return subscribeTime;
}
public void setSubscribeTime(Date subscribeTime) {
this.subscribeTime = subscribeTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getGroupid() {
return groupid;
}
public void setGroupid(String groupid) {
this.groupid = groupid;
}
public String getTagidList() {
return tagidList;
}
public void setTagidList(String tagidList) {
this.tagidList = tagidList;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AgreementEntity {
private Long id;
private Integer agreement_type;
private String version;
private String agreement_content;
private Integer delete_flag;
private Long created_id;
private Date created_time;
private Long modified_id;
private Date modified_time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getAgreement_type() {
return agreement_type;
}
public void setAgreement_type(Integer agreement_type) {
this.agreement_type = agreement_type;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version == null ? null : version.trim();
}
public Integer getDelete_flag() {
return delete_flag;
}
public void setDelete_flag(Integer delete_flag) {
this.delete_flag = delete_flag;
}
public Long getCreated_id() {
return created_id;
}
public void setCreated_id(Long created_id) {
this.created_id = created_id;
}
public Date getCreated_time() {
return created_time;
}
public void setCreated_time(Date created_time) {
this.created_time = created_time;
}
public Long getModified_id() {
return modified_id;
}
public void setModified_id(Long modified_id) {
this.modified_id = modified_id;
}
public Date getModified_time() {
return modified_time;
}
public void setModified_time(Date modified_time) {
this.modified_time = modified_time;
}
public String getAgreement_content() {
return agreement_content;
}
public void setAgreement_content(String agreement_content) {
this.agreement_content = agreement_content == null ? null : agreement_content.trim();
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class AgreementLogEntity {
private Long id;
private Long doctor_id;
private Integer agreement_type;
private String version;
private Integer delete_flag;
private Long created_id;
private Date created_time;
private Long modified_id;
private Date modified_time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getDoctor_id() {
return doctor_id;
}
public void setDoctor_id(Long doctor_id) {
this.doctor_id = doctor_id;
}
public Integer getAgreement_type() {
return agreement_type;
}
public void setAgreement_type(Integer agreement_type) {
this.agreement_type = agreement_type;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version == null ? null : version.trim();
}
public Integer getDelete_flag() {
return delete_flag;
}
public void setDelete_flag(Integer delete_flag) {
this.delete_flag = delete_flag;
}
public Long getCreated_id() {
return created_id;
}
public void setCreated_id(Long created_id) {
this.created_id = created_id;
}
public Date getCreated_time() {
return created_time;
}
public void setCreated_time(Date created_time) {
this.created_time = created_time;
}
public Long getModified_id() {
return modified_id;
}
public void setModified_id(Long modified_id) {
this.modified_id = modified_id;
}
public Date getModified_time() {
return modified_time;
}
public void setModified_time(Date modified_time) {
this.modified_time = modified_time;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class Doctor {
private Integer id;
private Integer acctId;
private Integer sex;
private String name;
private Integer age;
private String mobilePhone;
private String tel;
private Integer status;
private Integer type;
private Integer hospitalId;
private Integer departmentId;
private Integer titleId;
private String hospital;
private String department;
private String title;
private String certImageUrl;
private String avatarImageUrl;
private Date authTime;
private String honor;
private String skills;
private Integer thumbUpNum;
private String email;
private String qrcode;
private String nickname;
private String personalSign;
private Integer deleteFlag;
private Integer creatId;
private Date creatTime;
private Integer modifyId;
private Date modifyTime;
private Integer praiseNum;
private String password;
private String info;
private String rank;
private Long province;
private String provinceName;
private Long city;
private String cityName;
private Long county;
private String countyName;
private Long town;
private String townName;
private String inviteCode;
private Date inviteStartTime;
private String gaoxueyaPassword;
private Integer smsSendNum;
private Integer totalSmsSendNum;
private Integer entireFlag;
private Integer doctorProjectType;
private Date regTime;
private Date lastLoginTime;
private String unionid;
private Integer registerSource;
private String comment;
private Integer administerTitleId;
private String administerTitle;
private Integer registerType;
private Date firstLoginTime;
private String card;
private Date birthday;
private Integer showFlag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone == null ? null : mobilePhone.trim();
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel == null ? null : tel.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getHospitalId() {
return hospitalId;
}
public void setHospitalId(Integer hospitalId) {
this.hospitalId = hospitalId;
}
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public Integer getTitleId() {
return titleId;
}
public void setTitleId(Integer titleId) {
this.titleId = titleId;
}
public String getHospital() {
return hospital;
}
public void setHospital(String hospital) {
this.hospital = hospital == null ? null : hospital.trim();
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department == null ? null : department.trim();
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public String getCertImageUrl() {
return certImageUrl;
}
public void setCertImageUrl(String certImageUrl) {
this.certImageUrl = certImageUrl == null ? null : certImageUrl.trim();
}
public String getAvatarImageUrl() {
return avatarImageUrl;
}
public void setAvatarImageUrl(String avatarImageUrl) {
this.avatarImageUrl = avatarImageUrl == null ? null : avatarImageUrl.trim();
}
public Date getAuthTime() {
return authTime;
}
public void setAuthTime(Date authTime) {
this.authTime = authTime;
}
public String getHonor() {
return honor;
}
public void setHonor(String honor) {
this.honor = honor == null ? null : honor.trim();
}
public String getSkills() {
return skills;
}
public void setSkills(String skills) {
this.skills = skills == null ? null : skills.trim();
}
public Integer getThumbUpNum() {
return thumbUpNum;
}
public void setThumbUpNum(Integer thumbUpNum) {
this.thumbUpNum = thumbUpNum;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode == null ? null : qrcode.trim();
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname == null ? null : nickname.trim();
}
public String getPersonalSign() {
return personalSign;
}
public void setPersonalSign(String personalSign) {
this.personalSign = personalSign == null ? null : personalSign.trim();
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatId() {
return creatId;
}
public void setCreatId(Integer creatId) {
this.creatId = creatId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Integer getPraiseNum() {
return praiseNum;
}
public void setPraiseNum(Integer praiseNum) {
this.praiseNum = praiseNum;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info == null ? null : info.trim();
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank == null ? null : rank.trim();
}
public Long getProvince() {
return province;
}
public void setProvince(Long province) {
this.province = province;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName == null ? null : provinceName.trim();
}
public Long getCity() {
return city;
}
public void setCity(Long city) {
this.city = city;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName == null ? null : cityName.trim();
}
public Long getCounty() {
return county;
}
public void setCounty(Long county) {
this.county = county;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName == null ? null : countyName.trim();
}
public Long getTown() {
return town;
}
public void setTown(Long town) {
this.town = town;
}
public String getTownName() {
return townName;
}
public void setTownName(String townName) {
this.townName = townName == null ? null : townName.trim();
}
public String getInviteCode() {
return inviteCode;
}
public void setInviteCode(String inviteCode) {
this.inviteCode = inviteCode == null ? null : inviteCode.trim();
}
public Date getInviteStartTime() {
return inviteStartTime;
}
public void setInviteStartTime(Date inviteStartTime) {
this.inviteStartTime = inviteStartTime;
}
public String getGaoxueyaPassword() {
return gaoxueyaPassword;
}
public void setGaoxueyaPassword(String gaoxueyaPassword) {
this.gaoxueyaPassword = gaoxueyaPassword == null ? null : gaoxueyaPassword.trim();
}
public Integer getSmsSendNum() {
return smsSendNum;
}
public void setSmsSendNum(Integer smsSendNum) {
this.smsSendNum = smsSendNum;
}
public Integer getTotalSmsSendNum() {
return totalSmsSendNum;
}
public void setTotalSmsSendNum(Integer totalSmsSendNum) {
this.totalSmsSendNum = totalSmsSendNum;
}
public Integer getEntireFlag() {
return entireFlag;
}
public void setEntireFlag(Integer entireFlag) {
this.entireFlag = entireFlag;
}
public Integer getDoctorProjectType() {
return doctorProjectType;
}
public void setDoctorProjectType(Integer doctorProjectType) {
this.doctorProjectType = doctorProjectType;
}
public Date getRegTime() {
return regTime;
}
public void setRegTime(Date regTime) {
this.regTime = regTime;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid == null ? null : unionid.trim();
}
public Integer getRegisterSource() {
return registerSource;
}
public void setRegisterSource(Integer registerSource) {
this.registerSource = registerSource;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment == null ? null : comment.trim();
}
public Integer getAdministerTitleId() {
return administerTitleId;
}
public void setAdministerTitleId(Integer administerTitleId) {
this.administerTitleId = administerTitleId;
}
public String getAdministerTitle() {
return administerTitle;
}
public void setAdministerTitle(String administerTitle) {
this.administerTitle = administerTitle == null ? null : administerTitle.trim();
}
public Integer getRegisterType() {
return registerType;
}
public void setRegisterType(Integer registerType) {
this.registerType = registerType;
}
public Date getFirstLoginTime() {
return firstLoginTime;
}
public void setFirstLoginTime(Date firstLoginTime) {
this.firstLoginTime = firstLoginTime;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card == null ? null : card.trim();
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getShowFlag() {
return showFlag;
}
public void setShowFlag(Integer showFlag) {
this.showFlag = showFlag;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import com.pica.cloud.foundation.utils.utils.date.DateAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
/**
* Created on 2019/9/10 17:52
* author:crs
* Description:医生基本信息
*/
public class DoctorEntity {
private Integer id;
private Integer sex;
private String name = "";
private String mobile_phone = "";
private Integer status;
private Integer type;
private Integer hospital_id;
private Integer department_id;
private Integer title_id;
private String cert_image_url = "";
private String avatar_image_url = "";
@XmlJavaTypeAdapter(DateAdapter.class)
protected Date auth_time;
@XmlJavaTypeAdapter(DateAdapter.class)
protected Date invite_start_time;
private String honor = "";
private String skills = "";
private Integer thumb_up_num;
private String email = "";
private String qrcode = "";
private String nickname = "";
private String personal_sign = "";
private Integer praise_num;
private String password = "";
private String gaoxueya_password = "";
private String info = "";
private String rank = "";
private Long town;
private String town_name = "";
private Long county;
private String county_name = "";
private Long city;
private String city_name = "";
private Integer province;
private String province_name = "";
private String hospital = "";
private String department = "";
private String title = "";
private String card = "";
private String invite_code = "";
private int entire_flag;// 1未补全 2补全
private int sms_send_num;// 发送短信数量
private int total_sms_send_num;// 可发送短信总量
private int doctor_project_type;// 医生项目分类
// private String open_id;
private String unionid = "";
private Integer administer_title_id; // 行政职称id
private String administer_title; // 行政职称
private String school_name; // 学校名称
private Integer major_id; // 专业id
private String major_name; // 专业名称
private String education_id; // 学历no,p_constants表的no
private String education_name; // 学历名称
private String year; // 入学年份
protected Date birthday; //出生年月
private Integer register_source; // 注册来源 1.android, 2.ios, 3.saas, 4.wechat, 5.hypertension, 6.kf
private Integer register_type; // 注册类型 1医学生 2非医学生
private String token;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile_phone() {
return mobile_phone;
}
public void setMobile_phone(String mobile_phone) {
this.mobile_phone = mobile_phone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getHospital_id() {
return hospital_id;
}
public void setHospital_id(Integer hospital_id) {
this.hospital_id = hospital_id;
}
public Integer getDepartment_id() {
return department_id;
}
public void setDepartment_id(Integer department_id) {
this.department_id = department_id;
}
public Integer getTitle_id() {
return title_id;
}
public void setTitle_id(Integer title_id) {
this.title_id = title_id;
}
public String getCert_image_url() {
return cert_image_url;
}
public void setCert_image_url(String cert_image_url) {
this.cert_image_url = cert_image_url;
}
public String getAvatar_image_url() {
return avatar_image_url;
}
public void setAvatar_image_url(String avatar_image_url) {
this.avatar_image_url = avatar_image_url;
}
public Date getAuth_time() {
return auth_time;
}
public void setAuth_time(Date auth_time) {
this.auth_time = auth_time;
}
public Date getInvite_start_time() {
return invite_start_time;
}
public void setInvite_start_time(Date invite_start_time) {
this.invite_start_time = invite_start_time;
}
public String getHonor() {
return honor;
}
public void setHonor(String honor) {
this.honor = honor;
}
public String getSkills() {
return skills;
}
public void setSkills(String skills) {
this.skills = skills;
}
public Integer getThumb_up_num() {
return thumb_up_num;
}
public void setThumb_up_num(Integer thumb_up_num) {
this.thumb_up_num = thumb_up_num;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getPersonal_sign() {
return personal_sign;
}
public void setPersonal_sign(String personal_sign) {
this.personal_sign = personal_sign;
}
public Integer getPraise_num() {
return praise_num;
}
public void setPraise_num(Integer praise_num) {
this.praise_num = praise_num;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getGaoxueya_password() {
return gaoxueya_password;
}
public void setGaoxueya_password(String gaoxueya_password) {
this.gaoxueya_password = gaoxueya_password;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public Long getTown() {
return town;
}
public void setTown(Long town) {
this.town = town;
}
public String getTown_name() {
return town_name;
}
public void setTown_name(String town_name) {
this.town_name = town_name;
}
public Long getCounty() {
return county;
}
public void setCounty(Long county) {
this.county = county;
}
public String getCounty_name() {
return county_name;
}
public void setCounty_name(String county_name) {
this.county_name = county_name;
}
public Long getCity() {
return city;
}
public void setCity(Long city) {
this.city = city;
}
public String getCity_name() {
return city_name;
}
public void setCity_name(String city_name) {
this.city_name = city_name;
}
public Integer getProvince() {
return province;
}
public void setProvince(Integer province) {
this.province = province;
}
public String getProvince_name() {
return province_name;
}
public void setProvince_name(String province_name) {
this.province_name = province_name;
}
public String getHospital() {
return hospital;
}
public void setHospital(String hospital) {
this.hospital = hospital;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card;
}
public String getInvite_code() {
return invite_code;
}
public void setInvite_code(String invite_code) {
this.invite_code = invite_code;
}
public int getEntire_flag() {
return entire_flag;
}
public void setEntire_flag(int entire_flag) {
this.entire_flag = entire_flag;
}
public int getSms_send_num() {
return sms_send_num;
}
public void setSms_send_num(int sms_send_num) {
this.sms_send_num = sms_send_num;
}
public int getTotal_sms_send_num() {
return total_sms_send_num;
}
public void setTotal_sms_send_num(int total_sms_send_num) {
this.total_sms_send_num = total_sms_send_num;
}
public int getDoctor_project_type() {
return doctor_project_type;
}
public void setDoctor_project_type(int doctor_project_type) {
this.doctor_project_type = doctor_project_type;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public Integer getAdminister_title_id() {
return administer_title_id;
}
public void setAdminister_title_id(Integer administer_title_id) {
this.administer_title_id = administer_title_id;
}
public String getAdminister_title() {
return administer_title;
}
public void setAdminister_title(String administer_title) {
this.administer_title = administer_title;
}
public String getSchool_name() {
return school_name;
}
public void setSchool_name(String school_name) {
this.school_name = school_name;
}
public Integer getMajor_id() {
return major_id;
}
public void setMajor_id(Integer major_id) {
this.major_id = major_id;
}
public String getMajor_name() {
return major_name;
}
public void setMajor_name(String major_name) {
this.major_name = major_name;
}
public String getEducation_id() {
return education_id;
}
public void setEducation_id(String education_id) {
this.education_id = education_id;
}
public String getEducation_name() {
return education_name;
}
public void setEducation_name(String education_name) {
this.education_name = education_name;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getRegister_source() {
return register_source;
}
public void setRegister_source(Integer register_source) {
this.register_source = register_source;
}
public Integer getRegister_type() {
return register_type;
}
public void setRegister_type(Integer register_type) {
this.register_type = register_type;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.pica.cloud.account.account.server.entity;
/**
* 加解密数据模型
*/
public class EncryptEntity {
/**
* 加密后的密文
*/
private String key;
/**
* 加密后的数据
*/
private String content;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
// @Override
// public String toString() {
// return "EncryptEntity{" +
// "key='" + key + '\'' +
// ", content='" + content + '\'' +
// '}';
// }
}
package com.pica.cloud.account.account.server.entity;
import com.pica.cloud.account.account.server.log.AccountLogEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel
public class LogLoginEntity extends AccountLogEntity {
private Integer id;
private Integer acctId;
private String acctName;
private int productType;
private int sourceType;
private int loginType;
private String loginIp;
private Date loginTime;
//成功,失败
@ApiModelProperty("登陆状态")
private int loginStatus;
private Integer createId;
private Date createTime;
private Integer modifyId;
private Date modifyTime;
private int deleteFlag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public String getAcctName() {
return acctName;
}
public void setAcctName(String acctName) {
this.acctName = acctName;
}
public int getProductType() {
return productType;
}
public void setProductType(int productType) {
this.productType = productType;
}
public int getSourceType() {
return sourceType;
}
public void setSourceType(int sourceType) {
this.sourceType = sourceType;
}
public int getLoginType() {
return loginType;
}
public void setLoginType(int loginType) {
this.loginType = loginType;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public Date getLoginTime() {
return loginTime;
}
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
public int getLoginStatus() {
return loginStatus;
}
public void setLoginStatus(int loginStatus) {
this.loginStatus = loginStatus;
}
public Integer getCreateId() {
return createId;
}
public void setCreateId(Integer createId) {
this.createId = createId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public int getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(int deleteFlag) {
this.deleteFlag = deleteFlag;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import com.pica.cloud.account.account.server.log.AccountLogEntity;
import java.util.Date;
public class LogPWDModifyEntity extends AccountLogEntity {
private Integer id;
private String mobilePhone;
private Date modifiedTime;
private Integer modifiedId;
private String oldPwd;
private String newPwd;
private Integer deleteFlag;
private Integer createdId;
private Date createdTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone == null ? null : mobilePhone.trim();
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public String getOldPwd() {
return oldPwd;
}
public void setOldPwd(String oldPwd) {
this.oldPwd = oldPwd == null ? null : oldPwd.trim();
}
public String getNewPwd() {
return newPwd;
}
public void setNewPwd(String newPwd) {
this.newPwd = newPwd == null ? null : newPwd.trim();
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import com.pica.cloud.account.account.server.log.AccountLogEntity;
import java.util.Date;
public class LogUserInfoEntity extends AccountLogEntity {
private Integer id;
private Integer acctId;
private String villageName;
private Long villageId;
private String townName;
private Long townId;
private String countyName;
private Long countyId;
private String cityName;
private Long cityId;
private String provinceName;
private Long provinceId;
private Long country;
private String headImgUrl;
private String address;
private String patientAddress;
private String telephone;
private String socialCard;
private String workUnit;
private String healthFileNumber;
private String paymentType;
private String remarks;
private String email;
private String nation;
private Integer createId;
private Date createTime;
private Integer modifyId;
private Date modifyTime;
private int deleteFlag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public String getVillageName() {
return villageName;
}
public void setVillageName(String villageName) {
this.villageName = villageName == null ? null : villageName.trim();
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public String getTownName() {
return townName;
}
public void setTownName(String townName) {
this.townName = townName == null ? null : townName.trim();
}
public Long getTownId() {
return townId;
}
public void setTownId(Long townId) {
this.townId = townId;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName == null ? null : countyName.trim();
}
public Long getCountyId() {
return countyId;
}
public void setCountyId(Long countyId) {
this.countyId = countyId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName == null ? null : cityName.trim();
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName == null ? null : provinceName.trim();
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getCountry() {
return country;
}
public void setCountry(Long country) {
this.country = country;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl == null ? null : headImgUrl.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getPatientAddress() {
return patientAddress;
}
public void setPatientAddress(String patientAddress) {
this.patientAddress = patientAddress == null ? null : patientAddress.trim();
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim();
}
public String getSocialCard() {
return socialCard;
}
public void setSocialCard(String socialCard) {
this.socialCard = socialCard == null ? null : socialCard.trim();
}
public String getWorkUnit() {
return workUnit;
}
public void setWorkUnit(String workUnit) {
this.workUnit = workUnit == null ? null : workUnit.trim();
}
public String getHealthFileNumber() {
return healthFileNumber;
}
public void setHealthFileNumber(String healthFileNumber) {
this.healthFileNumber = healthFileNumber == null ? null : healthFileNumber.trim();
}
public String getPaymentType() {
return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType == null ? null : paymentType.trim();
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation == null ? null : nation.trim();
}
public Integer getCreateId() {
return createId;
}
public void setCreateId(Integer createId) {
this.createId = createId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public int getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(int deleteFlag) {
this.deleteFlag = deleteFlag;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Created on 2019/10/9 17:41
* author:crs
* Description: 登录状态返回
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class LoginResult {
@ApiModelProperty("token")
private String token;
@ApiModelProperty("用户id")
private Long userId;
@ApiModelProperty("是否绑定")
private String bindFlag;
@ApiModelProperty("联合登录id")
private String unionId;
@ApiModelProperty("是否完善过信息,1.信息未补全, 2信息已补全,3已补全密码")
private int entireFlag;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBindFlag() {
return bindFlag;
}
public void setBindFlag(String bindFlag) {
this.bindFlag = bindFlag;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public int getEntireFlag() {
return entireFlag;
}
public void setEntireFlag(int entireFlag) {
this.entireFlag = entireFlag;
}
}
package com.pica.cloud.account.account.server.entity;
import io.swagger.annotations.ApiModel;
/**
* @author andong
* @create 2019/10/16
*/
@ApiModel
public class LoginResultWeb {
private int certifyDoc = 1;
private int isExist = 1;
private PICAPDoctor picapDoctor;
public int getCertifyDoc() {
return certifyDoc;
}
public void setCertifyDoc(int certifyDoc) {
this.certifyDoc = certifyDoc;
}
public int getIsExist() {
return isExist;
}
public void setIsExist(int isExist) {
this.isExist = isExist;
}
public PICAPDoctor getPicapDoctor() {
return picapDoctor;
}
public void setPicapDoctor(PICAPDoctor picapDoctor) {
this.picapDoctor = picapDoctor;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
/**
* @author andong
* @create 2019/10/16
*/
public class PICAPDoctor {
private Integer id;
private Integer sex;
private String name;
private String mobile_phone;
private Integer status;
private Integer type;
private Integer hospital_id;
private Integer department_id;
private Integer title_id;
private String cert_image_url;
private String avatar_image_url;
protected Date auth_time;
protected Date rejected_time;
private String honor;
private String skills;
private String card;
private Integer thumb_up_num;
private String email;
private String qrcode;
private String nickname;
private String personal_sign;
private Integer praise_num;
private String password;
private String gaoxueya_password;
private String info;
private String rank;
private Long county;
private Long city;
private Integer province;
private String hospital;
private String department;
private String title;
private String invite_code;
private Integer entire_flag;
private Integer doctor_project_type;
private Integer sms_send_num;
private Integer total_sms_send_num;
private String province_name;
private String city_name;
private String county_name;
protected Date invite_start_time;
private Long town;
private String town_name;
private Integer register_source;
private Integer register_type;
private Integer administer_title_id;
private String administer_title;
protected Date birthday;
protected String birthdayStr = "";
protected Integer age = 0;
protected PICAPDoctorEducation doctorEducation;
private Integer delete_flag;
private Integer creat_id;
protected Date creat_time;
private Integer modify_id;
protected Date modify_time;
private Integer create_id;
protected Date create_time;
public Date getBirthday() {
return this.birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getAge() {
return this.age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getBirthdayStr() {
return this.birthdayStr;
}
public void setBirthdayStr(String birthdayStr) {
this.birthdayStr = birthdayStr;
}
public String getCard() {
return this.card;
}
public void setCard(String card) {
this.card = card;
}
public PICAPDoctorEducation getDoctorEducation() {
return this.doctorEducation;
}
public void setDoctorEducation(PICAPDoctorEducation doctorEducation) {
this.doctorEducation = doctorEducation;
}
public Integer getRegister_type() {
return this.register_type;
}
public void setRegister_type(Integer register_type) {
this.register_type = register_type;
}
public String getAdminister_title() {
return this.administer_title;
}
public void setAdminister_title(String administer_title) {
this.administer_title = administer_title;
}
public Integer getAdminister_title_id() {
return this.administer_title_id;
}
public void setAdminister_title_id(Integer administer_title_id) {
this.administer_title_id = administer_title_id;
}
public Integer getRegister_source() {
return this.register_source;
}
public void setRegister_source(Integer register_source) {
this.register_source = register_source;
}
public Integer getTotal_sms_send_num() {
return this.total_sms_send_num;
}
public void setTotal_sms_send_num(Integer total_sms_send_num) {
this.total_sms_send_num = total_sms_send_num;
}
public Integer getSms_send_num() {
return this.sms_send_num;
}
public void setSms_send_num(Integer sms_send_num) {
this.sms_send_num = sms_send_num;
}
public Integer getDoctor_project_type() {
return this.doctor_project_type;
}
public void setDoctor_project_type(Integer doctor_project_type) {
this.doctor_project_type = doctor_project_type;
}
public String getGaoxueya_password() {
return this.gaoxueya_password;
}
public void setGaoxueya_password(String gaoxueya_password) {
this.gaoxueya_password = gaoxueya_password;
}
public String getInvite_code() {
return this.invite_code;
}
public void setInvite_code(String invite_code) {
this.invite_code = invite_code;
}
public Integer getEntire_flag() {
return this.entire_flag;
}
public void setEntire_flag(Integer entire_flag) {
this.entire_flag = entire_flag;
}
public Date getAuth_time() {
return this.auth_time;
}
public void setAuth_time(Date auth_time) {
this.auth_time = auth_time;
}
public Date getRejected_time() {
return this.rejected_time;
}
public void setRejected_time(Date rejected_time) {
this.rejected_time = rejected_time;
}
public Long getCounty() {
return this.county;
}
public void setCounty(Long county) {
this.county = county;
}
public Long getCity() {
return this.city;
}
public void setCity(Long city) {
this.city = city;
}
public Integer getProvince() {
return this.province;
}
public void setProvince(Integer province) {
this.province = province;
}
public String getHospital() {
return this.hospital;
}
public void setHospital(String hospital) {
this.hospital = hospital;
}
public String getDepartment() {
return this.department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSex() {
return this.sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile_phone() {
return this.mobile_phone;
}
public void setMobile_phone(String mobile_phone) {
this.mobile_phone = mobile_phone;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getType() {
return this.type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getHospital_id() {
return this.hospital_id;
}
public void setHospital_id(Integer hospital_id) {
this.hospital_id = hospital_id;
}
public Integer getDepartment_id() {
return this.department_id;
}
public void setDepartment_id(Integer department_id) {
this.department_id = department_id;
}
public Integer getTitle_id() {
return this.title_id;
}
public void setTitle_id(Integer title_id) {
this.title_id = title_id;
}
public String getCert_image_url() {
return this.cert_image_url;
}
public void setCert_image_url(String cert_image_url) {
this.cert_image_url = cert_image_url;
}
public String getAvatar_image_url() {
return this.avatar_image_url;
}
public void setAvatar_image_url(String avatar_image_url) {
this.avatar_image_url = avatar_image_url;
}
public String getHonor() {
return this.honor;
}
public void setHonor(String honor) {
this.honor = honor;
}
public String getSkills() {
return this.skills;
}
public void setSkills(String skills) {
this.skills = skills;
}
public Integer getThumb_up_num() {
return this.thumb_up_num;
}
public void setThumb_up_num(Integer thumb_up_num) {
this.thumb_up_num = thumb_up_num;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getQrcode() {
return this.qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
public String getNickname() {
return this.nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getPersonal_sign() {
return this.personal_sign;
}
public void setPersonal_sign(String personal_sign) {
this.personal_sign = personal_sign;
}
public Integer getPraise_num() {
return this.praise_num;
}
public void setPraise_num(Integer praise_num) {
this.praise_num = praise_num;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getInfo() {
return this.info;
}
public void setInfo(String info) {
this.info = info;
}
public String getRank() {
return this.rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public Date getInvite_start_time() {
return this.invite_start_time;
}
public void setInvite_start_time(Date invite_start_time) {
this.invite_start_time = invite_start_time;
}
public String getProvince_name() {
return this.province_name;
}
public void setProvince_name(String province_name) {
this.province_name = province_name;
}
public String getCity_name() {
return this.city_name;
}
public void setCity_name(String city_name) {
this.city_name = city_name;
}
public String getCounty_name() {
return this.county_name;
}
public void setCounty_name(String county_name) {
this.county_name = county_name;
}
public Long getTown() {
return this.town;
}
public void setTown(Long town) {
this.town = town;
}
public String getTown_name() {
return this.town_name;
}
public void setTown_name(String town_name) {
this.town_name = town_name;
}
public Integer getCreate_id() {
return this.create_id;
}
public void setCreate_id(Integer create_id) {
this.create_id = create_id;
}
public Date getCreate_time() {
return this.create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Integer getDelete_flag() {
return this.delete_flag;
}
public void setDelete_flag(Integer delete_flag) {
this.delete_flag = delete_flag;
}
public Integer getCreat_id() {
return this.creat_id;
}
public void setCreat_id(Integer creat_id) {
this.creat_id = creat_id;
}
public Date getCreat_time() {
return this.creat_time;
}
public void setCreat_time(Date creat_time) {
this.creat_time = creat_time;
}
public Integer getModify_id() {
return this.modify_id;
}
public void setModify_id(Integer modify_id) {
this.modify_id = modify_id;
}
public Date getModify_time() {
return this.modify_time;
}
public void setModify_time(Date modify_time) {
this.modify_time = modify_time;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
/**
* @author andong
* @create 2019/10/16
*/
public class PICAPDoctorEducation {
private static final long serialVersionUID = 1L;
private Integer id = 0;
private Integer doctor_id = 0;
private String school_name = "";
private Integer major_id = 0;
private String major_name = "";
private String education_id = "";
private String education_name = "";
private String year = "";
private Integer delete_flag;
private Integer creat_id;
protected Date creat_time;
private Integer modify_id;
protected Date modify_time;
private Integer create_id;
protected Date create_time;
public String getMajor_name() {
return this.major_name;
}
public void setMajor_name(String major_name) {
this.major_name = major_name;
}
public String getEducation_name() {
return this.education_name;
}
public void setEducation_name(String education_name) {
this.education_name = education_name;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getDoctor_id() {
return this.doctor_id;
}
public void setDoctor_id(Integer doctor_id) {
this.doctor_id = doctor_id;
}
public String getSchool_name() {
return this.school_name;
}
public void setSchool_name(String school_name) {
this.school_name = school_name;
}
public Integer getMajor_id() {
return this.major_id;
}
public void setMajor_id(Integer major_id) {
this.major_id = major_id;
}
public String getEducation_id() {
return this.education_id;
}
public void setEducation_id(String education_id) {
this.education_id = education_id;
}
public String getYear() {
return this.year;
}
public void setYear(String year) {
this.year = year;
}
public Integer getCreate_id() {
return this.create_id;
}
public void setCreate_id(Integer create_id) {
this.create_id = create_id;
}
public Date getCreate_time() {
return this.create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Integer getDelete_flag() {
return this.delete_flag;
}
public void setDelete_flag(Integer delete_flag) {
this.delete_flag = delete_flag;
}
public Integer getCreat_id() {
return this.creat_id;
}
public void setCreat_id(Integer creat_id) {
this.creat_id = creat_id;
}
public Date getCreat_time() {
return this.creat_time;
}
public void setCreat_time(Date creat_time) {
this.creat_time = creat_time;
}
public Integer getModify_id() {
return this.modify_id;
}
public void setModify_id(Integer modify_id) {
this.modify_id = modify_id;
}
public Date getModify_time() {
return this.modify_time;
}
public void setModify_time(Date modify_time) {
this.modify_time = modify_time;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class WeChatEntity {
/** 获取到的凭证 */
private String access_token;
/** 凭证有效时间,单位:秒 */
private int expires_in;
/** 用户刷新access_token */
private String refresh_token;
/** 用户唯一标识,请注意,在未关注公众号时,用户访问公众号的网页,也会产生一个用户和公众号唯一的OpenID */
private String openid;
/** 用户授权的作用域,使用逗号(,)分隔 */
private String scope;
private Date createdAt;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public int getExpires_in() {
return expires_in;
}
public void setExpires_in(int expires_in) {
this.expires_in = expires_in;
}
public String getRefresh_token() {
return refresh_token;
}
public void setRefresh_token(String refresh_token) {
this.refresh_token = refresh_token;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
}
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class WeChatUserInfoEntity {
/** 是否订阅该公众号标识 */
private Integer subscribe;
/** 用户标识 */
private String openid;
/** 昵称 */
private String nickname;
/** 性别 */
private Integer sex;
/** 用户所在城市 */
private String city;
/** 用户所在省份 */
private String province;
/** 国家*/
private String country;
/** 用户的语言 */
private String language;
/** 用户头像 */
private String headimgurl;
/** 用户关注时间 */
private Date subscribe_time;
/** 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段 */
private String unionid;
private String remark;
private Integer groupid;
private String tagid_list;
private String privilege;
public Integer getSubscribe() {
return subscribe;
}
public void setSubscribe(Integer subscribe) {
this.subscribe = subscribe;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getHeadimgurl() {
return headimgurl;
}
public void setHeadimgurl(String headimgurl) {
this.headimgurl = headimgurl;
}
public Date getSubscribe_time() {
return subscribe_time;
}
public void setSubscribe_time(Date subscribe_time) {
this.subscribe_time = subscribe_time;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getGroupid() {
return groupid;
}
public void setGroupid(Integer groupid) {
this.groupid = groupid;
}
public String getTagid_list() {
return tagid_list;
}
public void setTagid_list(String tagid_list) {
this.tagid_list = tagid_list;
}
public String getPrivilege() {
return privilege;
}
public void setPrivilege(String privilege) {
this.privilege = privilege;
}
}
package com.pica.cloud.account.account.server.enums;
/**
* Created on 2019/10/11 19:08
* author:crs
* Description:账户协议类型
*/
public enum AccountAgreementEnum {
USER_AGREEMENT(1, "用户协议"),
PRIVACY_AGREEMENT(5, "隐私协议");
private int code;
private String desc;
AccountAgreementEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
package com.pica.cloud.account.account.server.enums;
/**
* Created on 2019/8/27
* author:crs
* Description:账户常用异常类型定义
*/
public enum AccountExceptionEnum {
PICA_NOT_EMPTY("216501", "字段非空提示信息"),
PICA_MOBILE_ERROR("216502", "请输入正确的手机号"),
PICA_SYSCODE_ERROR("216503", "短信验证码错误"),
PICA_SYSCODE_EXPIRE("216504", "短信验证码已过期,请重新获取"),
PICA_SYSCODE_RESET("216505", "请X秒后重试(获取验证码),请重新获取"),
PICA_SYSCODE_LATER("216506", "验证码获取过于频繁,请隔天后重试"),
PICA_ALREADY_REGISTER("216507", "该手机号已注册,请直接登录"),
PICA_NOT_REGISTER("216508", "未注册,请先注册"),
PICA_PASSWORD_ERROR("216509", "请输入正确的密码"),
PICA_IMAGE_PASSWORD_ERROR("216511", "图形验证码错误"),
PICA_LOGIN_AGAIN("216512", "请重新登录"),
PICA_PASSWORD_NULL("216513", "密码不能为空"),
PICA_PASSWORD_EQUAL("216514", "旧密码与新密码不能相同"),
PICA_UNBIND_MOBILE("216515", "该手机号未绑定微信"),
PICA_MOBILE_SAME("216516", "新手机号与旧手机号不能相同"),
PICA_PARAMS_ERROR("216517", "传递参数有误"),
PICA_SYSCODE_RETRY("216518", "请X秒后重试"),
PICA_NOT_EXIST("216519", "该用户不存在"),
PICA_REGISTER_FAIL("216520", "注册失败");
private String code;
private String message;
AccountExceptionEnum(String code, String message) {
this.code = code;
this.message = message;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.pica.cloud.account.account.server.enums;
/**
* Created on 2019/8/27
* author:crs
* Description:账户常用枚举类型
*/
public enum AccountTypeEnum {
//登录类型枚举(记录登录日志时使用)
LOGIN_CODE(1, "验证码登录"),
LOGIN_PWD(2, "密码登录"),
LOGIN_WE_CHAT(3, "微信登录"),
LOGIN_OUT(4, "退出登录"),
LOGIN_REGISTER(5, "注册登录"),
//登录态相关枚举
LOGIN_STATUS_SUCCESS(1, "登录成功"),
LOGIN_STATUS_FAILURE(2, "登录失败"),
//产品来源相关枚举
PRODUCT_TYPE_DOCTOR(1, "云鹊医产品系"),
PRODUCT_TYPE_HEALTH(2, "云鹊健康产品系"),
//终端类型
DEVICE_TYPE_ANDROID(1, "安卓"),
DEVICE_TYPE_IOS(2, "ios"),
DEVICE_TYPE_WEB(3, "web"),
DEVICE_TYPE_H5(4, "H5"),
DEVICE_TYPE_ADMIN(5, "admin"),
//验证码获取类型: flag:0登录(默认)1注册 2微信登录绑定手机 3修改手机 4重置密码
SYSCODE_TYPE_LOGIN(0, "登录"),
SYSCODE_TYPE_REGISTER(1, "注册"),
SYSCODE_TYPE_WE_CHAT(2, "微信登录绑定手机"),
SYSCODE_TYPE_MODIFY_MOBILE(3, "修改手机号"),
SYSCODE_TYPE_RESET_PASSWORD(4, "重置密码"),
//联合登录类型
UNION_LOGIN_WE_CHAT(1, "微信"),
UNION_LOGIN_QQ(2, "QQ"),
union_login_blog(3, "微博"),
//微信绑定状态
BIND_STATUS_SUCCESS(1, "已绑定"),
BIND_STATUS_FAILURE(0, "未绑定"),
//日志类型枚举
LOG_TYPE_LOGIN(1, "登录日志"),
LOG_TYPE_PASSWORD(2, "密码更新日志"),
LOG_TYPE_USER_INFO(3, "用户信息更新日志");
private int code;
private String type;
AccountTypeEnum(int code, String type) {
this.code = code;
this.type = type;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.pica.cloud.account.account.server.exception;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
/**
* Created on 2019/9/2
* author:crs
* Description:账户异常基类定义
*/
public class AccountException extends PicaException {
public AccountException(String code, String msg) {
super(code, msg);
}
public AccountException(PicaResultCode picaResultCode) {
super(picaResultCode);
}
public AccountException(AccountExceptionEnum exceptionType) {
super(exceptionType.getCode(), exceptionType.getMessage());
}
}
package com.pica.cloud.account.account.server.job;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.foundation.redis.ICacheClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* Created on 2019/10/29 15:37
* author:crs
* Description:doctor表重复记录处理
*/
@Component
public class DoctorRepeatDataJob {
private final String KEY = "cache_process_doctor_repeat";
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
@Autowired
private DoctorMapper doctorMapper;
/**
* 1、使用分布式锁保证一个微服务执行;
* 2、定时任务;
*/
@Scheduled(cron = "0 0 0 1/1 * ?")
public void processDoctorRepeatData() {
Long result = cacheClient.setnx(KEY, "1");
//如果为1说明获取到分布式锁
if (result == 1) {
//10分钟后锁过期
cacheClient.expire(KEY, 60 * 10);
logger.info("开始执行刷新doctor表中重复的记录");
int row = doctorMapper.processDoctorRepeatData();
logger.info("此次数据刷新影响的行数:{}", row);
try {
//防止任务一秒跑完,其他机器的时间晚了几秒
Thread.sleep(30*1000);
} catch (InterruptedException ex) {
logger.error(ex.getMessage(), ex);
}
//释放锁
cacheClient.del(KEY);
}
}
}
package com.pica.cloud.account.account.server.log;
/**
* Created on 2019/08/27
* author:crs
* Description:日志模型父类,主要用于定义日志模型
*/
public class AccountLogEntity {
//标记当前记录的是哪种日志
private int logType;
public int getLogType() {
return logType;
}
public void setLogType(int logType) {
this.logType = logType;
}
}
package com.pica.cloud.account.account.server.log;
import com.pica.cloud.account.account.server.entity.LogLoginEntity;
import com.pica.cloud.account.account.server.entity.LogPWDModifyEntity;
import java.util.Date;
/**
* Created on 2019/08/27
* author:crs
* Description:主要用于帮助创建pojo
*/
public class AccountLogEntityUtils {
/**
* 获取登录日志实例
*
* @param acctId
* @param productType
* @param sourceType
* @return
*/
public static LogLoginEntity getLogLoginEntity(Integer acctId, Integer productType, Integer sourceType,
int code, String ipAddr, int code1, int code2) {
LogLoginEntity entity = new LogLoginEntity();
Date currentTime = new Date();
entity.setAcctId(acctId);
entity.setCreateId(acctId);
entity.setCreateTime(currentTime);
entity.setModifyId(acctId);
entity.setModifyTime(currentTime);
entity.setDeleteFlag(1);
entity.setLoginTime(currentTime);
entity.setProductType(productType);
entity.setSourceType(sourceType);
entity.setLoginType(code);
entity.setLoginIp(ipAddr);
entity.setLoginStatus(code1);
entity.setLogType(code2);
return entity;
}
/**
* 获取密码修改实例
*
* @param acctId
* @return
*/
public static LogPWDModifyEntity getLogPWDModifyEntity(Integer acctId, String mobile, String oldpwd, String newPwd, Integer logType) {
LogPWDModifyEntity entity = new LogPWDModifyEntity();
Date currentTime = new Date();
entity.setCreatedId(acctId);
entity.setCreatedTime(currentTime);
entity.setDeleteFlag(1);
entity.setModifiedId(acctId);
entity.setModifiedTime(currentTime);
entity.setMobilePhone(mobile);
entity.setOldPwd(oldpwd);
entity.setNewPwd(newPwd);
entity.setLogType(logType);
return entity;
}
}
package com.pica.cloud.account.account.server.log;
import com.pica.cloud.account.account.server.entity.LogLoginEntity;
import com.pica.cloud.account.account.server.entity.LogPWDModifyEntity;
import com.pica.cloud.account.account.server.entity.LogUserInfoEntity;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.mapper.LogLoginMapper;
import com.pica.cloud.account.account.server.mapper.LogPWDModifyMapper;
import com.pica.cloud.account.account.server.mapper.LogUserInfoMapper;
import com.pica.cloud.account.account.server.util.BeanUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created on 2019/08/27
* author:crs
* Description:异步任务处理日志记录
*/
public class AccountLogTask implements Runnable {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private LogLoginMapper loginLogMapper;
private LogPWDModifyMapper logPWDModifyMapper;
private LogUserInfoMapper logUserInfoMapper;
/**
* 日志类型
*/
private int type;
/**
* 日志内容
*/
private AccountLogEntity picaLogEntity;
AccountLogTask(AccountLogEntity picaLogEntity) {
this.picaLogEntity = picaLogEntity;
type = picaLogEntity.getLogType();
loginLogMapper = BeanUtil.getBean(LogLoginMapper.class);
logPWDModifyMapper = BeanUtil.getBean(LogPWDModifyMapper.class);
logUserInfoMapper = BeanUtil.getBean(LogUserInfoMapper.class);
}
@Override
public void run() {
try {
logger.info("log record......");
if (type == AccountTypeEnum.LOG_TYPE_LOGIN.getCode()) {
logger.info("login record......");
loginLogMapper.insert((LogLoginEntity) picaLogEntity);
} else if (type == AccountTypeEnum.LOG_TYPE_PASSWORD.getCode()) {
logPWDModifyMapper.insert((LogPWDModifyEntity) picaLogEntity);
} else if (type == AccountTypeEnum.LOG_TYPE_USER_INFO.getCode()) {
logUserInfoMapper.insertSelective((LogUserInfoEntity) picaLogEntity);
}
} catch (Exception e) {
logger.error("log record......"+e.getMessage(),e);
}
}
}
package com.pica.cloud.account.account.server.log;
import com.pica.cloud.account.account.server.util.ExecutorServiceUtils;
import org.springframework.stereotype.Component;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created on 2019/08/27
* author:crs
* Description:日志操作工具类
*/
@Component
public class AccountLogUtils {
/**
* 日志记录方法
*
* @param accountLogEntity
*/
public void info(AccountLogEntity accountLogEntity) {
ExecutorServiceUtils.getExecutor().submit(new AccountLogTask(accountLogEntity));
}
}
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
public interface AccountInfoDetailMapper {
/**
* 通过电话号码查询账号信息
*
* @param mobile
* @return
*/
AccountInfoEntity selectByMobile(String mobile);
/**
* 通过电话号码查询账号id
*
* @param mobile
* @return
*/
Integer selectAcctIdByMobile(String mobile);
/**
* 插入注册人信息
*
* @param acctId
*/
void updateCreateInfo(int acctId);
/**
* 修改手机号
*
* @param record
* @return
*/
void updateMobileByPrimaryKey(AccountInfoEntity record);
/**
* 修改用户密码
*
* @param record
* @return
*/
void updatePasswordByPrimaryKey(AccountInfoEntity record);
AccountInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountInfoEntity record);
int updateByPrimaryKey(AccountInfoEntity record);
int deleteByPrimaryKey(Integer id);
int insert(AccountInfoEntity record);
int insertSelective(AccountInfoEntity record);
void updateDeleteByPrimaryKey(Integer acctId);
}
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author andong
* @create 2019/7/18
*/
@Mapper
public interface AccountInfoMapper {
//查询账号总数
int getTotalCount();
//根据条件查询账号数量
int getCount(AccountInfoReq req);
//根据条件查询医生ID
List<Integer> getDoctorIds(AccountInfoReq req);
}
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.Account;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 账号Mapper
* @author andong
* @create 2019/5/20
*/
@Mapper
public interface AccountMapper {
//根据id获取账号
Account selectById(long id);
//新增账号
void insertSelective(Account account);
//更新账号
int updateByIdSelective(Account account);
//根据手机号获取账号
Account getByMobilePhone(@Param("mobilePhone") String mobilePhone);
//根据微信unionid获取账号
Account getByUnionid(@Param("unionid") String unionid);
List<Map<String, Object>> getHospitalInfoByPage(@Param("id") Long id, @Param("offset") int offset, @Param("size") int size);
}
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
public interface AccountPatientInfoMapper {
/**
* 通过userId查询居民信息
*
* @param id userId
* @return
*/
AccountPatientInfoEntity selectByPrimaryKey(Integer id);
/**
* 通过用户id查询居民信息
*
* @param id 用户id
* @return
*/
AccountPatientInfoEntity selectByUserId(Integer id);
/**
* 通过账户id查询账户信息
*
* @param acctId
* @return
*/
AccountPatientInfoEntity selectByAcctId(Integer acctId);
/**
* 更新居民信息接口
*
* @param record 居民信息模型
* @return
*/
int updateByPrimaryKeySelective(AccountPatientInfoEntity record);
int insertSelective(AccountPatientInfoEntity record);
int updateByPrimaryKey(AccountPatientInfoEntity record);
int deleteByPrimaryKey(Integer id);
int insert(AccountPatientInfoEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AccountUnionEntity;
public interface AccountUnionMapper {
/**
* 解除绑定关系
*
* @param acctId 账户id
* @return
*/
int updateUnbindByAcctId(Integer acctId);
/**
* 是否绑定过手机号
*
* @param unionId 联合id
* @return
*/
AccountUnionEntity selectByUnionId(String unionId);
int deleteByPrimaryKey(Integer id);
int insert(AccountUnionEntity record);
int insertSelective(AccountUnionEntity record);
AccountUnionEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountUnionEntity record);
int updateByPrimaryKey(AccountUnionEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
public interface AccountWeChatInfoMapper {
/**
* UnionId 是否存在
* @param id 联合id
* @return
*/
AccountWeChatInfoEntity selectByUnionId(String id);
int deleteByPrimaryKey(Integer id);
int insert(AccountWeChatInfoEntity record);
int insertSelective(AccountWeChatInfoEntity record);
AccountWeChatInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountWeChatInfoEntity record);
int updateByPrimaryKey(AccountWeChatInfoEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AgreementEntity;
public interface AgreementEntityMapper {
int deleteByPrimaryKey(Long id);
int insert(AgreementEntity record);
int insertSelective(AgreementEntity record);
AgreementEntity selectByPrimaryKey(Long id);
/**
* 根据协议类型查询协议
*
* @param agreementType
* @return
*/
Integer selectByType(int agreementType);
int updateByPrimaryKeySelective(AgreementEntity record);
int updateByPrimaryKeyWithBLOBs(AgreementEntity record);
int updateByPrimaryKey(AgreementEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AgreementLogEntity;
public interface AgreementLogEntityMapper {
int deleteByPrimaryKey(Long id);
int insert(AgreementLogEntity record);
int insertSelective(AgreementLogEntity record);
AgreementLogEntity selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AgreementLogEntity record);
int updateByPrimaryKey(AgreementLogEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.DoctorEntity;
import com.pica.cloud.account.account.server.entity.PICAPDoctor;
import org.apache.ibatis.annotations.Param;
public interface DoctorMapper {
/**
* 获取医生信息
*
* @param mobile 手机号
* @return
*/
Doctor getDoctorInfoByMobile(String mobile);
/**
* 通过账户信息查询用户id
*
* @param acctId
* @return
*/
Long selectUserIdByAcctId(Integer acctId);
/**
* 通过id获取医生信息
*
* @param id
* @return
*/
Doctor selectByPrimaryKey(Integer id);
/**
* 更新医生信息
*
* @param record
* @return
*/
int updateByPrimaryKeySelective(Doctor record);
/**
* 通过账户id更新用户信息
*
* @param doctor
*/
void updateByAcctId(Doctor doctor);
/**
* 处理重复的记录(相同手机号多条记录一致)
*/
int processDoctorRepeatData();
void updateByMobile(Doctor doctor);
int deleteByPrimaryKey(Integer id);
int insert(Doctor record);
int insertSelective(Doctor record);
int updateByPrimaryKey(Doctor record);
/**
* 绑定微信
*
* @param acctId
* @param unionId
* @return
*/
int bindWeChat(@Param("acctId") int acctId, @Param("unionId") String unionId);
/**
* 解绑微信
*
* @param acctId
* @return
*/
int unbindWeChat(@Param("acctId") int acctId);
PICAPDoctor queryDoctor(long doctorId);
void updateDeleteByPrimaryKey(Integer id);
/**
* 通过手机号获取用户id
* @param mobile
* @return
*/
//Long selectDoctorIdByMobile(String mobile);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.LogLoginEntity;
public interface LogLoginMapper {
int deleteByPrimaryKey(Integer id);
int insert(LogLoginEntity record);
int insertSelective(LogLoginEntity record);
LogLoginEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(LogLoginEntity record);
int updateByPrimaryKey(LogLoginEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.LogPWDModifyEntity;
public interface LogPWDModifyMapper {
int deleteByPrimaryKey(Integer id);
int insert(LogPWDModifyEntity record);
int insertSelective(LogPWDModifyEntity record);
LogPWDModifyEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(LogPWDModifyEntity record);
int updateByPrimaryKey(LogPWDModifyEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.LogUserInfoEntity;
public interface LogUserInfoMapper {
int deleteByPrimaryKey(Integer id);
int insert(LogUserInfoEntity record);
int insertSelective(LogUserInfoEntity record);
LogUserInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(LogUserInfoEntity record);
int updateByPrimaryKey(LogUserInfoEntity record);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.queue;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created on 2019/9/11 17:27
* author:crs
* Description:消息队列配置
*/
@Configuration
public class QueueConfig {
public final static String QUEUE_NAME = "register_queue_account_13201";
public final static String EXCHANGE_NAME = "register_exchange";
public final static String ROUTE_KEY_NAME = "register_finish";
/**
* 创建一个消息队列
*
* @return
*/
@Bean
public Queue queue() {
return new Queue(QUEUE_NAME, true, false, true);
}
/**
* 创建交换机
*
* @return
*/
@Bean
public TopicExchange directExchange() {
return new TopicExchange(EXCHANGE_NAME);
}
/**
* 把消息队里和交换机进行绑定
*
* @return
*/
@Bean
public Binding binding() {
return BindingBuilder.bind(queue()).to(directExchange()).with(ROUTE_KEY_NAME);
}
}
package com.pica.cloud.account.account.server.queue;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created on 2019/9/11 17:37
* author:crs
* Description:消息生产者
*/
@Component
public class QueueProducer {
@Autowired
private AmqpTemplate amqpTemplate;
/**
* 发送消息
*
* @param message
*/
public void send(byte[] message) {
amqpTemplate.convertAndSend(QueueConfig.EXCHANGE_NAME, QueueConfig.ROUTE_KEY_NAME, message);
}
}
package com.pica.cloud.account.account.server.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author andong
* @create 2019/5/21
*/
@ApiModel
public class AccountReq {
@ApiModelProperty("手机号")
private String mobilePhone;
@ApiModelProperty("密码(32位大写MD5加密)")
private String password;
@ApiModelProperty("验证码")
private String authCode;
@ApiModelProperty("微信unionid")
private String unionid;
@ApiModelProperty("验证码类型")
private String flag;
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getAuthCode() {
return authCode;
}
public void setAuthCode(String authCode) {
this.authCode = authCode;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
}
package com.pica.cloud.account.account.server.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Created on 2019/8/27
* author:crs
* Description:请求参数封装类
*/
@ApiModel
public class BaseRequest {
@ApiModelProperty("账户id")
private Integer accId;
private String mobile;
private String password;
@ApiModelProperty("旧密码")
private String oldPwd;
private String authCode;
private int flag;
@ApiModelProperty("产品线类型")
private int productType;
@ApiModelProperty("渠道来源")
private int sourceType;
@ApiModelProperty("登录ip")
private String loginIp;
@ApiModelProperty("联合id")
private String unionId;
@ApiModelProperty("微信code")
private String weChatCode;
@ApiModelProperty("微信登录类型")
private Integer weChatLoginType;
@ApiModelProperty("图片验证码token")
private String captchaToken;
@ApiModelProperty("图片验证码答案")
private String captchaAnswer;
public String getCaptchaToken() {
return captchaToken;
}
public void setCaptchaToken(String captchaToken) {
this.captchaToken = captchaToken;
}
public String getCaptchaAnswer() {
return captchaAnswer;
}
public void setCaptchaAnswer(String captchaAnswer) {
this.captchaAnswer = captchaAnswer;
}
public Integer getAccId() {
return accId;
}
public void setAccId(Integer accId) {
this.accId = accId;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getOldPwd() {
return oldPwd;
}
public void setOldPwd(String oldPwd) {
this.oldPwd = oldPwd;
}
public String getAuthCode() {
return authCode;
}
public void setAuthCode(String authCode) {
this.authCode = authCode;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public int getProductType() {
return productType;
}
public void setProductType(int productType) {
this.productType = productType;
}
public int getSourceType() {
return sourceType;
}
public void setSourceType(int sourceType) {
this.sourceType = sourceType;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getWeChatCode() {
return weChatCode;
}
public void setWeChatCode(String weChatCode) {
this.weChatCode = weChatCode;
}
public Integer getWeChatLoginType() {
return weChatLoginType;
}
public void setWeChatLoginType(Integer weChatLoginType) {
this.weChatLoginType = weChatLoginType;
}
}
package com.pica.cloud.account.account.server.req;
import java.util.Date;
/**
* Created on 2019/09/02
* author:crs
* Description:居民信息类
*/
public class PatientReq {
private Integer id;
private Integer acctId;
private String villageName;
private Long villageId;
private String townName;
private Long townId;
private String countyName;
private Long countyId;
private String cityName;
private Long cityId;
private String provinceName;
private Long provinceId;
private Long country;
private String headImgUrl;
private String address;
private String patientAddress;
private String telephone;
private String socialCard;
private String workUnit;
private String healthFileNumber;
private String paymentType;
private String remarks;
private String email;
private String nation;
private Integer createId;
private Date createTime;
private Integer modifyId;
private Date modifyTime;
private int deleteFlag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public String getVillageName() {
return villageName;
}
public void setVillageName(String villageName) {
this.villageName = villageName;
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public String getTownName() {
return townName;
}
public void setTownName(String townName) {
this.townName = townName;
}
public Long getTownId() {
return townId;
}
public void setTownId(Long townId) {
this.townId = townId;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public Long getCountyId() {
return countyId;
}
public void setCountyId(Long countyId) {
this.countyId = countyId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getCountry() {
return country;
}
public void setCountry(Long country) {
this.country = country;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPatientAddress() {
return patientAddress;
}
public void setPatientAddress(String patientAddress) {
this.patientAddress = patientAddress;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getSocialCard() {
return socialCard;
}
public void setSocialCard(String socialCard) {
this.socialCard = socialCard;
}
public String getWorkUnit() {
return workUnit;
}
public void setWorkUnit(String workUnit) {
this.workUnit = workUnit;
}
public String getHealthFileNumber() {
return healthFileNumber;
}
public void setHealthFileNumber(String healthFileNumber) {
this.healthFileNumber = healthFileNumber;
}
public String getPaymentType() {
return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public Integer getCreateId() {
return createId;
}
public void setCreateId(Integer createId) {
this.createId = createId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public int getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(int deleteFlag) {
this.deleteFlag = deleteFlag;
}
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import java.util.List;
/**
* @author andong
* @create 2019/7/18
*/
public interface AccountInfoService {
//查询账号总数
int getTotalCount();
//根据条件查询账号数量
int getCount(AccountInfoReq req);
//根据条件查询医生ID
List<Integer> getDoctorIds(AccountInfoReq req);
}
package com.pica.cloud.account.account.server.service;
import ch.qos.logback.core.rolling.helper.IntegerTokenConverter;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import java.util.Map;
/**
* @author andong
* @create 2019/5/20
*/
public interface AccountService {
//根据ID获取账号
Account getById(long id);
//根据手机号获取账号
Account getByMobilePhone(String mobilePhone);
//根据微信unionid获取账号
Account getByUnionid(String unionid);
//创建账号
void createAccount(Account account);
//更新账号信息
void updateAccountById(Account account);
Map<String, String> getCache(long id);
void refreshCache(long id);
AccountInfoEntity getAccountByMobilePhone(String mobilePhone);
Integer getAccountIdByMobilePhone(String mobilePhone);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.AccountUnionEntity;
public interface AccountUnionService {
/**
* 通过unionId查询绑定信息
*
* @param unionId 联合id
* @return
*/
AccountUnionEntity selectInfoByUnionId(String unionId);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.util.captcha.CaptchaToken;
/**
* @author Laurence Cao
*
*/
public interface CaptchaService {
/**
* 生成验证码的令牌及图片(json时为base64编码)
*
* @return
*/
CaptchaToken generateToken(int width, int height);
/**
* 确认令牌与回答字符串是一致的,无论成功与否都将失效令牌
*
* @param token
* @param answer
* @return
*/
boolean acknowledge(String token, String answer);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.Doctor;
/**
* Created on 2019/9/11 11:01
* author:crs
* Description:医生信息接口
*/
public interface DoctorService {
/**
* 获取用户信息
*
* @param id 用户id
* @return
*/
Doctor getDoctorInfo(Integer id);
/**
* 修改医生信息
*
* @param doctor 待修改数据
*/
void modifyDoctorInfo(Doctor doctor);
/**
* 修改医生信息
*
* @param id 待修改数据
*/
void deleteDoctorInfo(Integer id);
/**
* 客服系统新增医生用户
*
* @param doctor 新的医生数据
*/
Integer addDoctorInfo(Doctor doctor);
/**
* doctor绑定微信
* @param acctId
* @param unionId
*/
void bindWeChat(int acctId, String unionId);
/**
* doctor解绑微信
* @param acctId
*/
void unbindWeChat(int acctId);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.entity.PICAPDoctor;
import com.pica.cloud.account.account.server.req.BaseRequest;
public interface LoginService {
/**
* 密码登录功能
*
* @param request 参数模型
* @return
*/
LoginResult login(BaseRequest request);
/**
* 一键登录功能
*
* @param request 参数模型
* @return
*/
LoginResult loginAndRegister(BaseRequest request);
/**
* 微信登录
*
* @param baseRequest 参数模型
*/
LoginResult loginByWeChat(BaseRequest baseRequest);
/**
* 微信登陆第二步
*
* @param request 参数模型
* @return
*/
LoginResult loginByWeChatStep(BaseRequest request);
/**
* 解除绑定
*
* @param acctId 账户id
*/
void unbindWeChat(Integer acctId);
/**
* 绑定微信接口
*
* @param request 参数模型
*/
void bindWeChat(BaseRequest request);
PICAPDoctor queryDoctor(long doctorId);
}
package com.pica.cloud.account.account.server.service;
public interface ModifyMobileService {
/**
* 修改手机号
*
* @param acctId 账户id
* @param mobile 手机号
*/
void modify(Integer acctId, String mobile);
Integer getAcctIdByMobile(String phone);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.req.BaseRequest;
public interface PasswordService {
/**
* 修改密码
*
* @param mobile 账户id
* @param oldPwd 旧密码
* @param pwd 新密码
*/
void modifyPassword(String mobile, String oldPwd, String pwd);
/**
* 忘记密码
*
* @param request 参数模型
*/
void forgetPassword(BaseRequest request);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
public interface PatientInfoService {
/**
* 更新用户信息接口
*
* @param accountPatientInfoEntity 更新信息
*/
void updateUserInfo(AccountPatientInfoEntity accountPatientInfoEntity);
/**
* 获取用户信息接口
*
* @param userId 用户id
* @return
*/
AccountPatientInfoEntity getUserInfo(Integer userId);
/**
* 获取用户信息接口
*
* @param acctId 账户id
* @return
*/
AccountPatientInfoEntity getUserInfoByAcctId(Integer acctId);
/**
* 添加居民用户
*
* @param entity 居民信息
*/
void addPatientInfo(AccountPatientInfoEntity entity, Integer userId);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.common.req.OCINRequest;
import com.pica.cloud.foundation.entity.PicaResponse;
public interface RegisterService {
/**
* 注册
*
* @param baseRequest 参数模型
* @return token和userId
*/
LoginResult register(BaseRequest baseRequest);
/**
* 长海项目医生注册
*
* @param request
*/
void ocinRegister(OCINRequest request);
}
package com.pica.cloud.account.account.server.service;
import java.util.Map;
/**
* Created on 2019/9/11 11:52
* author:crs
* Description:获取随机token
*/
public interface TokenService {
String getToken(Map<String, Object> map);
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.account.account.server.mapper.AccountInfoMapper;
import com.pica.cloud.account.account.server.service.AccountInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author andong
* @create 2019/7/18
*/
@Service
public class AccountInfoServiceImpl implements AccountInfoService {
@Autowired
private AccountInfoMapper accountInfoMapper;
@Override
public int getTotalCount() {
return accountInfoMapper.getTotalCount();
}
@Override
public int getCount(AccountInfoReq req) {
return accountInfoMapper.getCount(req);
}
@Override
public List<Integer> getDoctorIds(AccountInfoReq req) {
return accountInfoMapper.getDoctorIds(req);
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.AccountMapper;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.redis.ICacheClient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author andong
* @create 2019/5/20
*/
@Service
public class AccountServiceImpl implements AccountService {
private static final String KEY_PREFIX = "token-doctor-";
private static Logger logger = LoggerFactory.getLogger(AccountServiceImpl.class);
@Autowired
private AccountMapper accountMapper;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
@Value("${doubleWritingMode}")
private boolean doubleWritingMode;
//根据ID获取账号
@Override
public Account getById(long id) {
return accountMapper.selectById(id);
}
//根据手机号获取账号
@Override
public Account getByMobilePhone(String mobilePhone) {
String encryptMobilePhone = EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
return accountMapper.getByMobilePhone(encryptMobilePhone);
}
@Override
public AccountInfoEntity getAccountByMobilePhone(String mobilePhone) {
String encryptMobilePhone = EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
return accountInfoDetailMapper.selectByMobile(encryptMobilePhone);
}
@Override
public Integer getAccountIdByMobilePhone(String mobilePhone) {
String encryptMobilePhone = EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
return accountInfoDetailMapper.selectAcctIdByMobile(encryptMobilePhone);
}
//根据微信unionid获取账号
public Account getByUnionid(String unionid) {
return accountMapper.getByUnionid(unionid);
}
//创建账号
@Override
@Transactional
public void createAccount(Account account) {
//账户表
AccountInfoEntity accountInfo = new AccountInfoEntity();
Date currentTime = new Date();
accountInfo.setMobilePhone(account.getMobilePhone());
accountInfo.setPassword("");
accountInfo.setCreatedTime(currentTime);
accountInfo.setCreatedId(0);
accountInfo.setModifiedId(0);
accountInfo.setModifiedTime(currentTime);
accountInfo.setRegTime(currentTime);
accountInfo.setDeleteFlag(1);
accountInfo.setSex(0);
accountInfo.setRegisterProduct(1);
accountInfo.setRegisterSource(5);
accountInfoDetailMapper.insertSelective(accountInfo);
Integer acctId = accountInfo.getId();
//doctor表,存入用户id
if (doubleWritingMode) {
account.setMobilePhone(account.getMobilePhone());
account.setDeleteFlag(1);
account.setCreatId(0L);
account.setModifyId(0L);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setModifyTime(currentTime);
account.setFirstLoginTime(currentTime);
account.setLastLoginTime(currentTime);
accountMapper.insertSelective(account);
}
}
//更新账号信息
@Override
@Transactional
public void updateAccountById(Account account) {
accountMapper.updateByIdSelective(account);
}
@Override
public Map<String, String> getCache(long id) {
String key = KEY_PREFIX + id;
Map<String, String> map = new HashMap();
map.put("id", cacheClient.hget(key, "id"));
map.put("hospital_id", cacheClient.hget(key, "hospital_id"));
map.put("hospital", cacheClient.hget(key, "hospital"));
return map;
}
@Override
public void refreshCache(long id) {
int offset = 0;
final int size = 5000;
if (id >= 0) { //刷新单个医生缓存信息
List<Map<String, Object>> list = accountMapper.getHospitalInfoByPage(id, offset, size);
if (CollectionUtils.isNotEmpty(list)) {
Map<String, Object> doctorMap = list.get(0);
this.refresh(doctorMap);
}
} else { //刷新全部医生缓存信息
int errorCount = 0; //异常次数
List<Map<String, Object>> list = accountMapper.getHospitalInfoByPage(null, offset, size);
while (CollectionUtils.isNotEmpty(list)) {
for (Map<String, Object> doctorMap : list) {
int result = this.refresh(doctorMap);
errorCount += result;
}
if (errorCount >= 10000) {
break; //错误次数超过一定数量停止任务
}
logger.info("更新用户缓存信息已完成数量:{}", offset + list.size());
offset += size;
list = accountMapper.getHospitalInfoByPage(null, offset, size);
}
logger.info("更新用户缓存信息全部完成!");
}
}
//更新缓存中hospital_id,hospital信息
//成功返回0,失败返回1
private int refresh(Map<String, Object> doctorMap) {
String doctorId = doctorMap.get("id").toString();
String hospitalId = doctorMap.get("hospital_id") == null ? StringUtils.EMPTY : doctorMap.get("hospital_id").toString();
String hospital = doctorMap.get("hospital") == null ? StringUtils.EMPTY : doctorMap.get("hospital").toString();
String key = KEY_PREFIX + doctorId;
try {
String cacheId = cacheClient.hget(key, "id");
if (StringUtils.isBlank(cacheId)) {
return 0; //未找到用户缓存数据,不做更新
}
cacheClient.hset(key, "hospital_id", StringUtils.isEmpty(hospitalId) ? "0" : hospitalId);
cacheClient.hset(key, "hospital", hospital);
return 0;
} catch (Exception ex) {
return 1;
}
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountUnionEntity;
import com.pica.cloud.account.account.server.mapper.AccountUnionMapper;
import com.pica.cloud.account.account.server.service.AccountUnionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AccountUnionServiceImpl implements AccountUnionService {
@Autowired
private AccountUnionMapper accountUnionMapper;
@Override
public AccountUnionEntity selectInfoByUnionId(String unionId) {
return accountUnionMapper.selectByUnionId(unionId);
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.service.CaptchaService;
import com.pica.cloud.account.account.server.util.MemcachedClientWrapper;
import com.pica.cloud.account.account.server.util.captcha.CaptchaGenerator;
import com.pica.cloud.account.account.server.util.captcha.CaptchaToken;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
/**
* @author Laurence Cao
*
*/
@Component
public class CaptchaServiceImpl implements CaptchaService {
private final int size = 5;
private final String CAPTCHA_PREFIX = "captcha-";
@Autowired
private CaptchaGenerator agent;
@Autowired
MemcachedClientWrapper cache;
@Override
public CaptchaToken generateToken(int width, int height) {
String origin = agent.generateChars(size);
byte[] buf = agent.createCaptcha(origin, width, height);
CaptchaToken ret = new CaptchaToken();
ret.setBuf(buf);
ret.setOrigin(origin);
ret.setToken(DigestUtils.md5Hex(UUID.randomUUID().toString()));
cache.set(CAPTCHA_PREFIX + ret.getToken(), origin);
return ret;
}
@Override
public boolean acknowledge(String token, String answer) {
String origin = cache.get(CAPTCHA_PREFIX + token);
cache.remove(CAPTCHA_PREFIX + token);
if (origin != null && answer != null) {
return origin.compareToIgnoreCase(answer) == 0;
}
return false;
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
/**
* Created on 2019/9/11 11:02
* author:crs
* Description:医生相关Service
*/
@Service
public class DoctorServiceImpl implements DoctorService {
@Autowired
private DoctorMapper doctorMapper;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Override
public Doctor getDoctorInfo(Integer id) {
return doctorMapper.selectByPrimaryKey(id);
}
@Override
public void modifyDoctorInfo(Doctor doctor) {
Integer id = doctor.getId();
if (id == null) {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
Doctor entity = doctorMapper.selectByPrimaryKey(id);
if (entity == null) {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
}
String mobilePhone = doctor.getMobilePhone();
if (!StringUtils.isBlank(mobilePhone)) {
AccountUtils.checkMobilePhone(doctor.getMobilePhone());
}
doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone));
doctor.setModifyTime(new Date());
doctorMapper.updateByPrimaryKeySelective(doctor);
}
@Transactional()
@Override
public void deleteDoctorInfo(Integer id) {
//p_doctor表修改记录状态
Doctor doctor = doctorMapper.selectByPrimaryKey(id);
if (doctor != null) {
Integer acctId = doctor.getAcctId();
doctorMapper.updateDeleteByPrimaryKey(id);
accountInfoDetailMapper.updateDeleteByPrimaryKey(acctId);
} else {
throw new AccountException(AccountExceptionEnum.PICA_NOT_REGISTER);
}
}
/**
* 客服管理后台添加医生
* 1)当前医生信息是否存在,如果已经存在直接抛出异常;
* 2)账户表和医生表;
* 3)手机号进行加密存储;
* 4)账户基本信息的处理:姓名,性别,年龄,生日,身份证号;
*
* @param doctor 新的医生数据
*/
@Override
@Transactional
public Integer addDoctorInfo(Doctor doctor) {
String mobilePhone = doctor.getMobilePhone();
String mobileEncrypt = AESUtil.encryptV0(mobilePhone);
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobileEncrypt);
if (accountInfoEntity != null) {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER);
}
String password = doctor.getPassword();
Date currentTime = new Date();
AccountInfoEntity entity = new AccountInfoEntity();
entity.setMobilePhone(mobileEncrypt);
entity.setPassword(password);
entity.setCreatedTime(currentTime);
entity.setModifiedTime(currentTime);
entity.setModifiedId(0);
entity.setRegisterProduct(1);
entity.setRegTime(currentTime);
entity.setRegisterSource(3);
entity.setCreatedId(0);
entity.setDeleteFlag(1);
entity.setSex(doctor.getSex());
entity.setName(doctor.getName());
entity.setIdCard(doctor.getCard());
entity.setAge(doctor.getAge());
entity.setBirthday(doctor.getBirthday());
accountInfoDetailMapper.insertSelective(entity);
doctor.setAcctId(entity.getId());
doctor.setMobilePhone(mobileEncrypt);
doctor.setModifyId(0);
doctor.setCreatId(0);
doctor.setCreatTime(currentTime);
doctor.setModifyTime(new Date());
doctor.setDeleteFlag(1);
doctorMapper.insertSelective(doctor);
return doctor.getId();
}
@Override
@Transactional
public void bindWeChat(int acctId, String unionId) {
doctorMapper.bindWeChat(acctId, unionId);
}
@Override
@Transactional
public void unbindWeChat(int acctId) {
doctorMapper.unbindWeChat(acctId);
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.*;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.RegisterService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.TokenUtils;
import com.pica.cloud.account.account.server.util.WeChatUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.redis.ICacheClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class LoginServiceImpl implements LoginService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private AccountUnionMapper accountUnionMapper;
@Autowired
private AccountWeChatInfoMapper accountWeChatInfoMapper;
@Autowired
private AccountPatientInfoMapper accountPatientInfoMapper;
@Autowired
private AccountLogUtils picaLogUtils;
@Autowired
private TokenUtils tokenUtils;
@Autowired
private RegisterService registerService;
@Autowired
private DoctorMapper doctorInfoMapper;
@Autowired
private AccountUtils accountUtils;
@Autowired
private DoctorService doctorService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
@Value("${doubleWritingMode}")
private boolean doubleWritingMode;
@Value("${weChatAppID}")
private String appId;
@Value("${weChatAppSecret}")
private String appSecret;
@Value("${weChatURL}")
private String weChatURL;
private static final String DEFAULT_DOCTOR_PICTURE_URL = "/File/doctor_default.png";
public static Map<String, String> PIC_TYPE_MAP = new HashMap();
static {
PIC_TYPE_MAP.put("jpg", "FFD8FF");
PIC_TYPE_MAP.put("jpeg", "FFD8FF");
PIC_TYPE_MAP.put("png", "89504E47");
PIC_TYPE_MAP.put("gif", "47494638");
PIC_TYPE_MAP.put("bmp", "424D");
PIC_TYPE_MAP.put("png", "89504E470D0a1a0a0000");
PIC_TYPE_MAP.put("bmp", "424d228c010000000000");
PIC_TYPE_MAP.put("bmp", "424d8240090000000000");
PIC_TYPE_MAP.put("bmp", "424d8e1b030000000000");
}
@Override
public LoginResult login(BaseRequest request) {
String mobile = request.getMobile();
String encrypt = AESUtil.encryptV0(mobile);
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(encrypt);
if (accountInfoEntity != null) {
String oldPwd = accountInfoEntity.getPassword();
String password = request.getPassword();
if (password.equals(oldPwd)) {
Date currentTime = new Date();
Integer acctId = accountInfoEntity.getId();
int productType = request.getProductType();
int sourceType = request.getSourceType();
Doctor doctorInfo=doctorInfoMapper.getDoctorInfoByMobile(encrypt);
Integer userId = 0;
if (productType == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
userId = doctorInfo.getId();
} else if (productType == AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
AccountPatientInfoEntity accountPatientInfoEntity = accountPatientInfoMapper.selectByAcctId(acctId);
userId = accountPatientInfoEntity.getId();
}
Account account = new Account();
account.setId(userId.longValue());
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId.longValue());
if (productType == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
result.setEntireFlag(doctorInfo.getEntireFlag());
}
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, productType, sourceType,
AccountTypeEnum.LOGIN_PWD.getCode(), request.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(),
AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
picaLogUtils.info(entity);
return result;
} else {
logger.info("login failure:" + mobile);
throw new PicaException(AccountExceptionEnum.PICA_PASSWORD_ERROR.getCode(), AccountExceptionEnum.PICA_PASSWORD_ERROR.getMessage());
}
} else {
throw new PicaException(AccountExceptionEnum.PICA_NOT_REGISTER.getCode(), AccountExceptionEnum.PICA_NOT_REGISTER.getMessage());
}
}
@Override
public LoginResult loginAndRegister(BaseRequest baseRequest) {
String mobile = baseRequest.getMobile();
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(mobile));
if (accountInfoEntity == null) {
return registerService.register(baseRequest);
} else {
return processLogin(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_CODE.getCode());
}
}
/**
* 登录逻辑处理
*
* @param baseRequest
*/
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType) {
Date currentTime = new Date();
Long userId = accountUtils.getUserIdByAcctId(baseRequest.getProductType(), acctId);
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(baseRequest.getMobile());
account.setRegisterSource(baseRequest.getSourceType());
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
//是否完善过个人信息(云鹊医app才需要)
if (baseRequest.getProductType() == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue());
result.setEntireFlag(doctorEntity.getEntireFlag());
}
//记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
;
picaLogUtils.info(entity);
return result;
}
@Override
public LoginResult loginByWeChat(BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
//todo:微信登录获取个人信息
Map map = new HashMap();
map.put("access_token", weChatEntity.getAccess_token());
map.put("openid", weChatEntity.getOpenid());
Map weChatUserInfo = WeChatUtils.getWeChatUserInfo(map, weChatURL);
WeChatUserInfoEntity weChatUserInfoEntity = WeChatUtils.mergeWechatUserInfo(weChatUserInfo, weChatEntity.getOpenid());
String unionId = weChatUserInfoEntity.getUnionid();
AccountUnionEntity accountUnionEntity = accountUnionMapper.selectByUnionId(unionId);
if (accountUnionEntity != null) {
//是否绑定逻辑的判断
Long acctId = accountUnionEntity.getAcctId();
Long userId = accountUtils.getUserIdByAcctId(request.getProductType(), acctId.intValue());
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId.intValue());
account.setCreatTime(new Date());
//account.setMobilePhone(request.getMobile());
account.setMobilePhone("");
account.setRegisterSource(request.getSourceType());
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setBindFlag(AccountTypeEnum.BIND_STATUS_SUCCESS.getCode()+"");
return result;
} else {
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
if (entity == null) {
processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType());
}
LoginResult result = new LoginResult();
result.setUnionId(unionId);
result.setBindFlag(AccountTypeEnum.BIND_STATUS_FAILURE.getCode()+"");
return result;
}
}
@Override
public LoginResult loginByWeChatStep(BaseRequest request) {
//判断当前手机号是否注册过,注册过,直接登录;没有注册过,进行注册操操作
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile()));
LoginResult result;
if (accountInfoEntity == null) {
result = registerService.register(request);
if (doubleWritingMode) {
//双写模式下,要在doctor表存储unionId
if (result.getUserId()!=null) {
Doctor doctor = new Doctor();
doctor.setId(result.getUserId().intValue());
doctor.setUnionid(request.getUnionId());
doctorInfoMapper.updateByPrimaryKeySelective(doctor);
}
}
} else {
result = processLogin(request, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_WE_CHAT.getCode());
}
AccountInfoEntity accountInfo = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile()));
Integer acctId = accountInfo.getId();
processAccountUnion(acctId, request.getUnionId());
return result;
}
@Override
@Transactional
public void unbindWeChat(Integer acctId) {
accountUnionMapper.updateUnbindByAcctId(acctId);
if (doubleWritingMode) {
doctorService.unbindWeChat(acctId);
}
}
@Override
@Transactional
public void bindWeChat(BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
Map map = new HashMap();
map.put("access_token", weChatEntity.getAccess_token());
map.put("openid", weChatEntity.getOpenid());
Map weChatUserInfo = WeChatUtils.getWeChatUserInfo(map, weChatURL);
WeChatUserInfoEntity weChatUserInfoEntity = WeChatUtils.mergeWechatUserInfo(weChatUserInfo, weChatEntity.getOpenid());
String unionId = weChatUserInfoEntity.getUnionid();
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
if (entity == null) {
processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType());
}
processAccountUnion(request.getAccId(), unionId);
}
/**
* 把unionId存储到联合登录表中
*
* @param acctId
* @param unionId
*/
private void processAccountUnion(Integer acctId, String unionId) {
AccountUnionEntity accountUnionEntity = new AccountUnionEntity();
accountUnionEntity.setAcctId(acctId.longValue());
accountUnionEntity.setDeleteFlag(1);
accountUnionEntity.setUnionId(unionId);
accountUnionEntity.setCreatedTime(new Date());
accountUnionEntity.setModifiedTime(new Date());
accountUnionEntity.setCreatedId(acctId);
accountUnionEntity.setModifiedId(acctId);
accountUnionEntity.setUnionType(AccountTypeEnum.UNION_LOGIN_WE_CHAT.getCode());
accountUnionMapper.insertSelective(accountUnionEntity);
if (doubleWritingMode) { //双写模式
doctorService.bindWeChat(acctId, unionId);
}
}
private void processWeChatInfoUser(WeChatUserInfoEntity weChatUserInfoEntity, int type) {
AccountWeChatInfoEntity accountWeChatInfoEntity = new AccountWeChatInfoEntity();
Date currentTime = new Date();
accountWeChatInfoEntity.setCreatedId(0);
accountWeChatInfoEntity.setCreatedTime(currentTime);
accountWeChatInfoEntity.setDeleteFlag(1);
accountWeChatInfoEntity.setGroupid(weChatUserInfoEntity.getGroupid() + "");
accountWeChatInfoEntity.setType(type);
accountWeChatInfoEntity.setModifiedId(0);
accountWeChatInfoEntity.setModifiedTime(currentTime);
accountWeChatInfoEntity.setOpenid(weChatUserInfoEntity.getOpenid());
accountWeChatInfoEntity.setUnionid(weChatUserInfoEntity.getUnionid());
accountWeChatInfoEntity.setPrivilege(weChatUserInfoEntity.getPrivilege());
accountWeChatInfoEntity.setRemark(weChatUserInfoEntity.getRemark());
accountWeChatInfoEntity.setSubscribe(weChatUserInfoEntity.getSubscribe());
accountWeChatInfoEntity.setSubscribeTime(weChatUserInfoEntity.getSubscribe_time());
accountWeChatInfoEntity.setTagidList(weChatUserInfoEntity.getTagid_list());
accountWeChatInfoEntity.setCity(weChatUserInfoEntity.getCity());
accountWeChatInfoEntity.setNickname(weChatUserInfoEntity.getNickname());
accountWeChatInfoEntity.setHeadImgUrl(weChatUserInfoEntity.getHeadimgurl());
accountWeChatInfoEntity.setCountry(weChatUserInfoEntity.getCountry());
accountWeChatInfoEntity.setSex(weChatUserInfoEntity.getSex());
accountWeChatInfoEntity.setProvince(weChatUserInfoEntity.getProvince());
accountWeChatInfoEntity.setLanguage(weChatUserInfoEntity.getLanguage());
accountWeChatInfoMapper.insertSelective(accountWeChatInfoEntity);
}
public PICAPDoctor queryDoctor(long doctorId) {
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(doctorId);
if (doctor == null) {
doctor = new PICAPDoctor();
}
doctor.setAvatar_image_url(this.processDoctorAvatar(doctor.getAvatar_image_url()));
return doctor;
}
private String processDoctorAvatar(String avatar_image_url) {
if (StringUtils.isEmpty(avatar_image_url)) {
return DEFAULT_DOCTOR_PICTURE_URL;
} else {
int pos = avatar_image_url.lastIndexOf(".");
if (pos < 0) {
return DEFAULT_DOCTOR_PICTURE_URL;
} else {
String ext = avatar_image_url.substring(pos + 1, avatar_image_url.length()).toLowerCase();
return !PIC_TYPE_MAP.containsKey(ext) ? DEFAULT_DOCTOR_PICTURE_URL : avatar_image_url;
}
}
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.service.ModifyMobileService;
import com.pica.cloud.account.account.server.util.AESUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service
public class ModifyMobileServiceImpl implements ModifyMobileService {
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private DoctorMapper doctorMapper;
@Value("${doubleWritingMode}")
private boolean doubleWritingMode;
@Override
@Transactional
public void modify(Integer acctId, String mobile) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId);
if (entity != null) {
String mobilePhone = entity.getMobilePhone();
if (StringUtils.isNotEmpty(mobilePhone) && AESUtil.decryptV0(mobilePhone).equals(mobile)) {
throw new AccountException(AccountExceptionEnum.PICA_MOBILE_SAME);
}
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setMobilePhone(AESUtil.encryptV0(mobile));
accountInfoDetailMapper.updateMobileByPrimaryKey(accountInfoEntity);
if (doubleWritingMode) {
//更新p_doctor表中用户的手机号
Date currentTime = new Date();
Doctor doctor = new Doctor();
doctor.setAcctId(acctId);
doctor.setModifyTime(currentTime);
doctor.setModifyId(acctId);
doctor.setMobilePhone(AESUtil.encryptV0(mobile));
doctorMapper.updateByAcctId(doctor);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
}
}
@Override
public Integer getAcctIdByMobile(String phone) {
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(phone);
return accountInfoEntity.getId();
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.LogPWDModifyEntity;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.PasswordService;
import com.pica.cloud.account.account.server.util.AESUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service
public class PasswordServiceImpl implements PasswordService {
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private DoctorMapper doctorMapper;
@Autowired
private AccountLogUtils picaLogUtils;
@Value("${doubleWritingMode}")
private boolean doubleWritingMode;
@Override
@Transactional
public void modifyPassword(String mobile, String oldPwd, String pwd) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByMobile(mobile);
if (entity != null) {
if (entity.getPassword().equals(oldPwd)) {
Date currentTime = new Date();
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(entity.getId());
accountInfoEntity.setModifiedId(entity.getId());
accountInfoEntity.setModifiedTime(currentTime);
accountInfoEntity.setPassword(pwd);
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
if (doubleWritingMode) {
processDoubleWrite(mobile, pwd);
}
//密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(entity.getId(), entity.getMobilePhone(),
oldPwd, pwd, AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
} else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
}
}
@Override
@Transactional
public void forgetPassword(BaseRequest request) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile()));
if (entity != null) {
String password = request.getPassword();
Integer accId = entity.getId();
Date currentTime = new Date();
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(accId);
accountInfoEntity.setModifiedId(accId);
accountInfoEntity.setModifiedTime(currentTime);
accountInfoEntity.setPassword(password);
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
if (doubleWritingMode) {
processDoubleWrite(AESUtil.encryptV0(request.getMobile()), password);
}
//密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(accId, entity.getMobilePhone(),
"", request.getPassword(), AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
} else {
//未注册,请先注册
throw new AccountException(AccountExceptionEnum.PICA_NOT_REGISTER);
}
}
/**
* 双写模式,把密码存储到p_doctor表
*
* @param mobile
* @param password
*/
private void processDoubleWrite(String mobile, String password) {
Date currentTime = new Date();
Doctor doctor = new Doctor();
doctor.setPassword(password);
doctor.setMobilePhone(mobile);
doctor.setModifyTime(currentTime);
doctor.setModifyId(0);
doctorMapper.updateByMobile(doctor);
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
import com.pica.cloud.account.account.server.entity.LogUserInfoEntity;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper;
import com.pica.cloud.account.account.server.service.PatientInfoService;
import com.pica.cloud.account.account.server.util.AESUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
@Service
public class PatientInfoServerImpl implements PatientInfoService {
@Autowired
private AccountPatientInfoMapper accountPatientInfoMapper;
@Autowired
private AccountLogUtils accountLogUtils;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Override
public void updateUserInfo(AccountPatientInfoEntity accountPatientInfoEntity) {
accountPatientInfoEntity.setModifyTime(new Date());
accountPatientInfoEntity.setModifyId(accountPatientInfoEntity.getAcctId());
accountPatientInfoMapper.updateByPrimaryKeySelective(accountPatientInfoEntity);
//用户信息更新日志
Integer userId = accountPatientInfoEntity.getId();
AccountPatientInfoEntity userInfo = getUserInfo(userId);
LogUserInfoEntity logUserInfoEntity = new LogUserInfoEntity();
try {
BeanUtils.copyProperties(logUserInfoEntity, userInfo);
Date currentTime = new Date();
logUserInfoEntity.setCreateTime(currentTime);
logUserInfoEntity.setModifyTime(currentTime);
logUserInfoEntity.setLogType(AccountTypeEnum.LOG_TYPE_USER_INFO.getCode());
accountLogUtils.info(logUserInfoEntity);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
@Override
public AccountPatientInfoEntity getUserInfo(Integer userId) {
return accountPatientInfoMapper.selectByUserId(userId);
}
@Override
public AccountPatientInfoEntity getUserInfoByAcctId(Integer acctId) {
return accountPatientInfoMapper.selectByAcctId(acctId);
}
@Override
@Transactional
public void addPatientInfo(AccountPatientInfoEntity entity, Integer userId) {
String mobilePhone = entity.getMobilePhone();
Date currentTime = new Date();
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setMobilePhone(mobilePhone);
accountInfoEntity.setCreatedTime(currentTime);
accountInfoEntity.setModifiedTime(currentTime);
accountInfoEntity.setModifiedId(userId);
accountInfoEntity.setCreatedId(userId);
accountInfoEntity.setDeleteFlag(1);
//居民:姓名和手机号
accountInfoEntity.setName(entity.getName());
accountInfoDetailMapper.insertSelective(accountInfoEntity);
entity.setAcctId(accountInfoEntity.getId());
entity.setMobilePhone(AESUtil.encryptV0(entity.getMobilePhone()));
entity.setModifyId(userId);
entity.setModifyTime(currentTime);
accountPatientInfoMapper.insertSelective(entity);
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.common.req.OCINRequest;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.AccountAgreementEnum;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.*;
import com.pica.cloud.account.account.server.queue.QueueProducer;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.RegisterService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.ExecutorServiceUtils;
import com.pica.cloud.account.account.server.util.TokenUtils;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.concurrent.ExecutorService;
@Service
public class RegisterServiceImpl implements RegisterService {
private final String REPEAT_REGISTER_PREFIX = "repeat-register—";
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private AccountPatientInfoMapper accountUserInfoMapper;
@Autowired
private AccountMapper accountMapper;
@Autowired
private AccountLogUtils picaLogUtils;
@Autowired
private AccountUtils accountUtils;
@Autowired
private TokenUtils tokenUtils;
@Autowired
private QueueProducer queueProducer;
@Autowired
private AgreementEntityMapper agreementEntityMapper;
@Autowired
private AgreementLogEntityMapper agreementLogEntityMapper;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
/**
* 1)注册功能:默认未完善信息;
* 2)注册成功后发送mq消息,让别的服务初始化数据;
* 3)记录登录日志;
*
* @param baseRequest 参数模型
* @return
*/
@Override
public LoginResult register(BaseRequest baseRequest) {
String mobile = baseRequest.getMobile();
//对注册接口做幂等性处理:注册成功,删除缓存,注册失败提示用户
String exist = redisClient.get(REPEAT_REGISTER_PREFIX + mobile);
if (StringUtils.isBlank(exist)) {
String mobileEncrypt = AESUtil.encryptV0(mobile);
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobileEncrypt);
if (accountInfoEntity == null) {
redisClient.set(REPEAT_REGISTER_PREFIX + mobile, mobile, 30);
try {
Date currentTime = new Date();
int productType = baseRequest.getProductType();
int sourceType = baseRequest.getSourceType();
String password = baseRequest.getPassword();
AccountInfoEntity accountInfo = new AccountInfoEntity();
accountInfo.setMobilePhone(mobileEncrypt);
if (StringUtils.isEmpty(password)) {
password = "";
}
accountInfo.setPassword(password);
accountInfo.setCreatedTime(currentTime);
accountInfo.setCreatedId(0);
accountInfo.setModifiedId(0);
accountInfo.setModifiedTime(currentTime);
accountInfo.setRegTime(currentTime);
accountInfo.setDeleteFlag(1);
accountInfo.setSex(0);
accountInfo.setRegisterProduct(productType);
accountInfo.setRegisterSource(sourceType);
accountInfoDetailMapper.insertSelective(accountInfo);
Integer acctId = accountInfo.getId();
accountInfoDetailMapper.updateCreateInfo(acctId);
if (productType == AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
AccountPatientInfoEntity accountPatientInfoEntity = new AccountPatientInfoEntity();
accountPatientInfoEntity.setAcctId(acctId);
accountPatientInfoEntity.setDeleteFlag(1);
accountPatientInfoEntity.setCreateId(acctId);
accountPatientInfoEntity.setModifyId(acctId);
accountPatientInfoEntity.setCreateTime(currentTime);
accountPatientInfoEntity.setModifyTime(currentTime);
accountUserInfoMapper.insertSelective(accountPatientInfoEntity);
} else {
Account account = new Account();
account.setAcctId(acctId);
account.setMobilePhone(mobileEncrypt);
account.setDeleteFlag(1);
account.setCreatId(0L);
account.setModifyId(0L);
account.setCreatTime(currentTime);
account.setModifyTime(currentTime);
account.setFirstLoginTime(currentTime);
account.setLastLoginTime(currentTime);
account.setPassword(password);
accountMapper.insertSelective(account);
}
Long userId = accountUtils.getUserIdByAcctId(productType, acctId);
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setEntireFlag(1);
/* ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
try {
dos.writeLong(userId);
} catch (IOException e) {
e.printStackTrace();
}
queueProducer.send(bos.toByteArray());*/
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, productType, baseRequest.getSourceType(),
AccountTypeEnum.LOGIN_REGISTER.getCode(), baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(),
AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
picaLogUtils.info(entity);
processAgreement(userId);
redisClient.del(REPEAT_REGISTER_PREFIX + mobile);
return result;
} catch (Exception e) {
//向上抛出异常,让异常处理框架捕获到
throw new AccountException(AccountExceptionEnum.PICA_REGISTER_FAIL);
} finally {
//如果在注册过程中抛出异常,就删除redis中的注册标记
redisClient.del(REPEAT_REGISTER_PREFIX + mobile);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER);
}
}
/**
* 长海项目医生自动注册,并完善信息
*
* @param request
*/
@Override
public void ocinRegister(OCINRequest request) {
String mobile = request.getMobile();
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobile);
if (accountInfoEntity == null) {
Date currentTime = new Date();
int productType = request.getProductType();
int sourceType = request.getSourceType();
AccountInfoEntity accountInfo = new AccountInfoEntity();
accountInfo.setMobilePhone(mobile);
accountInfo.setPassword("");
accountInfo.setCreatedTime(currentTime);
accountInfo.setCreatedId(0);
accountInfo.setModifiedId(0);
accountInfo.setModifiedTime(currentTime);
accountInfo.setRegTime(currentTime);
accountInfo.setDeleteFlag(1);
accountInfo.setSex(0);
accountInfo.setRegisterProduct(productType);
accountInfo.setRegisterSource(sourceType);
accountInfoDetailMapper.insertSelective(accountInfo);
Integer acctId = accountInfo.getId();
accountInfoDetailMapper.updateCreateInfo(acctId);
//数据插入医生表中
Account account = new Account();
account.setAcctId(acctId);
account.setMobilePhone(mobile);
account.setDeleteFlag(1);
account.setCreatId(0L);
account.setModifyId(0L);
account.setCreatTime(currentTime);
account.setModifyTime(currentTime);
account.setFirstLoginTime(currentTime);
account.setLastLoginTime(currentTime);
account.setPassword("");
accountMapper.insertSelective(account);
Long userId = accountUtils.getUserIdByAcctId(productType, acctId);
processAgreement(userId);
/*PrefectInfoReq prefectInfoReq = new PrefectInfoReq();
prefectInfoReq.setDoctorId(userId);
prefectInfoReq.setHospitalId(request.getHospitalId().longValue());
prefectInfoReq.setName(request.getName());
doctorServiceClient.prefectInfo(prefectInfoReq);
*/
} else {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER.getCode(), AccountExceptionEnum.PICA_ALREADY_REGISTER.getCode());
}
}
/**
* 异步处理协议信息
* 1)从协议表中获取最新的协议信息;
* 2)将协议加入到用户协议表中
*/
private void processAgreement(Long userId) {
ExecutorService executor = ExecutorServiceUtils.getExecutor();
executor.submit(() -> {
//用户协议
Date currentTime = new Date();
Integer userVersion = agreementEntityMapper.selectByType(AccountAgreementEnum.USER_AGREEMENT.getCode());
AgreementLogEntity userAgreementLogEntity = new AgreementLogEntity();
userAgreementLogEntity.setAgreement_type(AccountAgreementEnum.USER_AGREEMENT.getCode());
userAgreementLogEntity.setDoctor_id(userId);
userAgreementLogEntity.setVersion(userVersion.toString());
userAgreementLogEntity.setCreated_id(userId);
userAgreementLogEntity.setCreated_time(currentTime);
userAgreementLogEntity.setModified_id(userId);
userAgreementLogEntity.setModified_time(currentTime);
userAgreementLogEntity.setDelete_flag(1);
agreementLogEntityMapper.insert(userAgreementLogEntity);
//隐私协议
Integer privateVersion = agreementEntityMapper.selectByType(AccountAgreementEnum.PRIVACY_AGREEMENT.getCode());
AgreementLogEntity privateAgreementLogEntity = new AgreementLogEntity();
privateAgreementLogEntity.setAgreement_type(AccountAgreementEnum.PRIVACY_AGREEMENT.getCode());
privateAgreementLogEntity.setDoctor_id(userId);
privateAgreementLogEntity.setVersion(privateVersion.toString());
privateAgreementLogEntity.setCreated_id(userId);
privateAgreementLogEntity.setCreated_time(currentTime);
privateAgreementLogEntity.setModified_id(userId);
privateAgreementLogEntity.setModified_time(currentTime);
privateAgreementLogEntity.setDelete_flag(1);
agreementLogEntityMapper.insert(privateAgreementLogEntity);
});
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.service.TokenService;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import static com.pica.cloud.foundation.utils.utils.json.Object2Map.objectToMapString;
/**
* Created on 2019/9/11 13:10
* author:crs
* Description:获取随机token
*/
@Service
public class TokenServiceImpl implements TokenService {
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
@Override
public String getToken(Map<String, Object> headersMap) {
String mobile = new StringBuilder("9").append(CommonUtil.getRandom(10)).toString();
headersMap.put(Constants.HEADER_MOBILE, mobile);
if (!CollectionUtils.isEmpty(headersMap)) {
PicaUser picaUser = new PicaUser();
picaUser.setCreated_time(new Date());
picaUser.setMobile((String) headersMap.get(Constants.HEADER_MOBILE));
picaUser.setName(Constants.HEADER_USER_TYPE);
picaUser.setId(0);
picaUser.setBrowser_ver((String) headersMap.get(Constants.HEADER_BROWSER));
picaUser.setOs_name((String) headersMap.get(Constants.HEADER_OPERATOR_SYSTEM));
picaUser.setTerminal_type((String) headersMap.get(Constants.HEADER_TERMINAL_TYPE));
picaUser.setIp_addr((String) headersMap.get(Constants.HEADER_IP));
try {
Map<String, String> map = objectToMapString(Constants.TIME_FORMAT, picaUser, new String[0]);
map.put(Constants.HEADER_SYS_CODE, Constants.HEADER_SYS_SOURCE);
map.put(Constants.HEADER_GUEST_ID, UUID.randomUUID().toString().replace("-", "").toUpperCase());
String token = redisClient.saveToken(map, 21600);
return token;
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
}
package com.pica.cloud.account.account.server.util;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import sun.misc.BASE64Decoder;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
/**
* Created on 2019/10/21 13:20
* author:crs
* Description:AESUtil
*/
public class AESUtil {
//密钥 (需要前端和后端保持一致)
private static final String KEY = "abcdefgabcdefg12";
//算法
private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding";
public static final String privateKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJrqPdInBev+ksvBvo+rymL1K0+r5" +
"a+bq+74tZAHWE2oKVaTSNCbkacXoqPRpzaCqCwyy61zeGExppfZBm8tf6AVAcL+58YF0Fuk+0N4ZaxAi2wx//GqqWQs+Rzt5VPJ+yaulAzs" +
"Eb0tW9o9Vc9VRxl8k0Fpi5Hj5J/pmLZrIj+FAgMBAAECgYAj+0A8rZ+sfsat2ORgDnDFp1hV+wEwVqIKsW3KdEpIT0S6vR7uhRPBkbXPAwU" +
"pnhNdoLa6JNXTDWs6XcgmzpSTx32WS3450+h1QNdLL+doiEinWxGijvp+UN7CadoeFBnLml3gGjPpTMeDheialQExwwvVKKe4+0VjO4zPDG" +
"nrAQJBAM3luGYrweNcFxvVsfQG6cpR/C0DeykyojN0Kbq+3/S+wG1y53Ak1HKz4OHftC4liYNXWy9W1fQ/MSbdVaSka+UCQQDAnJmYwmJ64" +
"I35T+GmgA0r505BCuYZG9pNyrjdko7n5+DaalRWSXuAwXb2SJbFHvWmVEgZOnVRhPdFgZUGP4shAkAjmG1SrInuhoMwOrdzGqbcZWQVXB60" +
"tp44CwMT19/b7gZSZaUBTDy2P8bHBeeeerrVTArlmjuO6EXVFDq0JgDJAkBLlCdhHcVu2fZbwdCVeOGyPI0kUJaBe8BpjgaESyHwNbixe8+" +
"kHCluGHwJn+opZ0CVB7VS0PGAD2DH0VUcooqBAkEAvLBZTnNcM/I2xbV6euw9gpEw7uLkT/94McLQOuZjKPWPHKDQOqa+y+CRPYuxIhQsFK" +
"mlTze7cR+/4QUANvGAow==";
/**
* aes解密
* @param encrypt 内容
* @return
* @throws Exception
public static String aesDecrypt(String encrypt) {
try {
return aesDecrypt(encrypt, KEY);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
*/
/**
* aes加密
* @param content
* @return
* @throws Exception
public static String aesEncrypt(String content) {
try {
return aesEncrypt(content, KEY);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
*/
/**
* 将byte[]转为各种进制的字符串
* @param bytes byte[]
* @param radix 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制
* @return 转换后的字符串
*/
public static String binary(byte[] bytes, int radix){
return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数
}
/**
* base 64 encode
* @param bytes 待编码的byte[]
* @return 编码后的base 64 code
*/
public static String base64Encode(byte[] bytes){
return Base64.encodeBase64String(bytes);
}
/**
* base 64 decode
* @param base64Code 待解码的base 64 code
* @return 解码后的byte[]
* @throws Exception
*/
public static byte[] base64Decode(String base64Code) throws Exception{
return StringUtils.isEmpty(base64Code) ? null : new BASE64Decoder().decodeBuffer(base64Code);
}
/**
* AES加密
* @param content 待加密的内容
* @param encryptKey 加密密钥
* @return 加密后的byte[]
* @throws Exception
*/
public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES"));
return cipher.doFinal(content.getBytes("utf-8"));
}
/**
* AES加密为base 64 code
* @param content 待加密的内容
* @param encryptKey 加密密钥
* @return 加密后的base 64 code
* @throws Exception
*/
public static String aesEncrypt(String content, String encryptKey) throws Exception {
return base64Encode(aesEncryptToBytes(content, encryptKey));
}
/**
* AES解密
* @param encryptBytes 待解密的byte[]
* @param decryptKey 解密密钥
* @return 解密后的String
* @throws Exception
*/
public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
byte[] decryptBytes = cipher.doFinal(encryptBytes);
return new String(decryptBytes);
}
/**
* 将base 64 code AES解密
* @param encryptStr 待解密的base 64 code
* @param decryptKey 解密密钥
* @return 解密后的string
* @throws Exception
*/
public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception {
return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey);
}
/**
* 旧的加解密逻辑
* @param data
* @return
*/
public static String encryptV0(String data) {
return EncryptCreateUtil.encrypt(data);
}
public static String decryptV0(String data) {
return EncryptCreateUtil.dencrypt(data);
}
/**
* 测试
*/
public static void main(String[] args) throws Exception {
String KEY="zJJ$c5md3$yuuhWW";
System.out.println("-------------加密---------");
String content = "13024112588";
System.out.println("加密前:" + content);
System.out.println("加密密钥和解密密钥:" + KEY);
System.out.println("-------------解密---------");
String encrypt = aesEncrypt(content, KEY);
System.out.println("加密后:" + encrypt);
String decrypt = aesDecrypt(encrypt, KEY);
System.out.println("解密后:" + decrypt);
//请求参数解密处理
// String encrypt="DC7Sc7ydClKJztuIz/E/5fXuQ8hqdr4W8mxL/XACtqT2wzK3jBiRXnoPOvR9lANIinXInrdbY5rCIwTiI9DeWFiwPP7cSF0cjnQOY11oJLjVg9qV9VZQXbFyDYVhRv8bbto5hD4evryzbdPTq6A23fD5LmXFYnWKdbSzZfFUl/w=";
// String decrypt = RSAUtil.decrypt(encrypt,privateKey);
// System.out.println(decrypt);
// //System.out.println("YCPQPx4qpQjEjDea");
// String content="z9zZyUYwKkYy08l0s1qH9CSnoNnXZbbhHVbAUwGIsOXKPGeTkZFnbL1HYJQXBdKqGzKZt8E5lDzdTGUiUVkkK8GO27fsSrRMewY5T6ndSuo=";
// String result = AESUtil.aesDecrypt(content, decrypt);
// System.out.println(result);
}
}
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.controller.AccountController;
import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* 账户工具类
*/
@Component
public class AccountUtils {
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
private Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
private AccountPatientInfoMapper accountPatientInfoMapper;
@Autowired
private DoctorMapper doctorInfoMapper;
private static final String AUTH_CODE_PREFIX = "authCode-";
private static final String AUTH_CODE_COUNT_PREFIX = "authCode-count-";
//手机格式校验
public static void checkMobilePhone(String mobilePhone) {
if (StringUtils.isBlank(mobilePhone) || !ValidateUtils.isMobile(mobilePhone)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "请输入正确的手机号");
}
}
//手机格式校验
public static void checkPassword(String password) {
if (StringUtils.isBlank(password)) {
throw new PicaException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), AccountExceptionEnum.PICA_NOT_EMPTY.getMessage());
}
}
//获取验证码redis key
public static String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + AESUtil.encryptV0(mobilePhone);
}
//校验验证码
public void checkAuthCode(String mobile, String type, String sysCode) {
String flag = org.apache.commons.lang.StringUtils.isBlank(type) ? "0" : type;
if (org.apache.commons.lang.StringUtils.isBlank(sysCode)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
String authCodeKey = AccountUtils.getAuthCodeKey(mobile, flag);
String cacheCode = cacheClient.get(authCodeKey); //从redis获取验证码
if (org.apache.commons.lang.StringUtils.isBlank(cacheCode)) {
throw new PicaException(PicaResultCode.RESULE_DATA_NONE.code(), "短信验证码已过期,请重新获取");
}
if (!org.apache.commons.lang.StringUtils.equals(sysCode, cacheCode)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
//清除验证码
cacheClient.del(authCodeKey);
}
//手机号和验证码校验
public void checkMobilePhoneAndAuthCode(String mobile, String type, String sysCode) {
if (StringUtils.isBlank(mobile) || !ValidateUtils.isMobile(mobile)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "请输入正确的手机号");
}
String flag = org.apache.commons.lang.StringUtils.isBlank(type) ? "0" : type;
if (org.apache.commons.lang.StringUtils.isBlank(sysCode)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
String authCodeKey = AccountUtils.getAuthCodeKey(mobile, flag);
//验证码3次校验测试不通过,直接删除
String authCodeCount = AUTH_CODE_COUNT_PREFIX + flag + "-" + AESUtil.encryptV0(mobile);
logger.info("验证码缓存信息----->:"+this.getAuthCodeKey(mobile, flag));
if (cacheClient.exists(authCodeCount) && Integer.parseInt(cacheClient.get(authCodeCount)) > 2) {
cacheClient.del(authCodeKey);
}
String cacheCode = cacheClient.get(authCodeKey); //从redis获取验证码
if (org.apache.commons.lang.StringUtils.isBlank(cacheCode)) {
//第四次删除计数器
cacheClient.del(authCodeCount);
throw new PicaException(PicaResultCode.RESULE_DATA_NONE.code(), "短信验证码已失效,请重新获取");
}
if (!org.apache.commons.lang.StringUtils.equals(sysCode, cacheCode)) {
cacheClient.incr(authCodeCount);
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "短信验证码错误");
}
cacheClient.del(authCodeKey);
}
/**
* 请求参数解密、反序列化
*
* @param params
* @param zClass
* @param <T>
* @return
*/
public static <T> T getRequestEntity(String params, Class<T> zClass) throws Exception {
String json = AESUtil.decryptV0(params);
return JSONObject.parseObject(json, zClass);
}
/**
* 获取终端来源
*
* @param registerSource
* @return
*/
public static String getSourceType(Integer registerSource) {
String sourceType = StringUtils.EMPTY;
switch (registerSource) {
case 3:
sourceType = "web";
break;
case 4:
sourceType = "h5";
break;
case 5:
sourceType = "admin";
break;
default:
sourceType = "app";
}
return sourceType;
}
/**
* 通过产品线类型获取用户id
*
* @param productType
* @param AcctId
* @return
*/
public Long getUserIdByAcctId(Integer productType, Integer AcctId) {
Long userId = null;
if (productType == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
userId = doctorInfoMapper.selectUserIdByAcctId(AcctId);
} else if (productType == AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
AccountPatientInfoEntity accountPatientInfoEntity = accountPatientInfoMapper.selectByAcctId(AcctId);
userId = accountPatientInfoEntity.getId().longValue();
}
return userId;
}
/**
* 校验手机号是否注册过
*
* @param mobile
*/
// public boolean checkRegisterMobile(String mobile) {
// String encrypt = AESUtil.encryptV0(mobile);
// AccountContact accountContact = accountContactServer.selectByMobile(encrypt);
// return (accountContact != null && accountContact.getAcctId() != null);
// }
}
package com.pica.cloud.account.account.server.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class BeanUtil implements ApplicationContextAware {
private static ApplicationContext context;
@Override
public void setApplicationContext(ApplicationContext paramApplicationContext)
throws BeansException {
context = paramApplicationContext;
}
public static ApplicationContext getContext() {
return context;
}
public static Object getBean(String beanName) {
return context.getBean(beanName);
}
public static <T> T getBean(Class<T> beanClass) {
return context.getBean(beanClass);
}
}
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest;
/**
* 加解密工具类
*/
public class CryptoUtil {
/**
* 加密数据
*
* @param data
* @return
* @throws Exception
*/
// public static EncryptEntity encrypt(String data) throws Exception {
// //1、产生AES密钥
// String keyString = AESUtil.generateKeyString();
// //2、用AES法加密数据
// String content = AESUtil.encrypt(keyString, data);
// //3、用RSA加密AES密钥
// String finalKey = RSAUtil.encrypt(keyString);
// EncryptEntity encryptEntity = new EncryptEntity();
// encryptEntity.setContent(content);
// // TODO: 2019/8/27 :获取验证码接口
//// encryptEntity.setKey(finalKey);
// return encryptEntity;
// }
/**
* 解密数据
*
* @param key
* @param data
* @return
*/
// public static String decrypt(String key, String data) throws Exception {
// //获取解密密钥
// String decryptKey = RSAUtil.decrypt(key);
// //解密数据
// String content = AESUtil.decrypt(decryptKey, data);
// return content;
// }
/**
* 解密数据
*
* @param encryptEntity·
* @return
* @throws Exception
*/
public static <T> T decrypt(EncryptEntity encryptEntity, Class<T> zClass) throws Exception {
//获取解密密钥
String decryptKey = RSAUtil.decrypt(encryptEntity.getKey());
//解密数据
String content = AESUtil.aesDecrypt(encryptEntity.getContent(),decryptKey);
//反序列化成对象
T request = JSONObject.parseObject(content, zClass);
return request;
// T request = JSONObject.parseObject(encryptEntity.getContent(), zClass);
// return request;
}
}
package com.pica.cloud.account.account.server.util;
public class DateEntityUtils {
// TODO: 2019/8/29 封装通用性data
// public static <T> T processTime(T t) {
//
//
// }
}
package com.pica.cloud.account.account.server.util;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created on 2019/10/11 18:58
* author:crs
* Description:线程池工具类
*/
public class ExecutorServiceUtils {
private static ExecutorService executorService = Executors.newFixedThreadPool(30);
public static ExecutorService getExecutor() {
return executorService;
}
}
package com.pica.cloud.account.account.server.util;
import net.spy.memcached.AddrUtil;
import net.spy.memcached.ConnectionFactoryBuilder;
import net.spy.memcached.MemcachedClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**
* @author Laurence Cao
*
*/
@Component
public class MemcachedClientWrapper {
private final int EXPIRE = 5 * 60; // 5 minutes
private MemcachedClient cli;
public MemcachedClientWrapper(@Value("${memcached.url}") String url) {
try {
cli = new MemcachedClient(new ConnectionFactoryBuilder().setProtocol(ConnectionFactoryBuilder.Protocol.BINARY).build(), AddrUtil.getAddresses(url));
} catch (IOException e) {
e.printStackTrace();
}
}
public String get(String token) {
return (String)cli.get(token);
}
public void set(String token, String answer) {
cli.set(token, EXPIRE, answer);
}
public void remove(String token) {
cli.delete(token);
}
}
package com.pica.cloud.account.account.server.util;
/**
* Created on 2019/9/11 17:20
* author:crs
* Description:主要用于发送消息
*/
public class MessageUtils {
private final static String QUEUE_NAME = "queue_register";
private final static String EXCHANGE_NAME = "exchange_register";
}
package com.pica.cloud.account.account.server.util;
public class MobileSmsEntityContent {
private String mobile;
private Integer sms_entity_id;//业务相关 id 例如患教通知 list
private String content;
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getSms_entity_id() {
return sms_entity_id;
}
public void setSms_entity_id(Integer sms_entity_id) {
this.sms_entity_id = sms_entity_id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
package com.pica.cloud.account.account.server.util;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
/**
* 证书信任管理器(用于https请求)
*
* @author bo.dang
* @date 2014-12-04
*/
public class MyX509TrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.util;
import java.io.Serializable;
/**
* 设备信息
* @author Victor
*/
public class PICAPDeviceInfo implements Serializable {
private static final long serialVersionUID = -2700102686964780189L;
private String device_brand; //终端品牌名称
private String device_model; //设备型号 1 android 2 ios
private Integer device_type = 0; //设备类型 2.android, 3.ioss
private String system_level; //android os版本的SDKlevel, iOS的系统版本号
private String device_ip; //IP地址
private String resolution_wh; //分辨率_宽度_高度
private String device_imei; //imei信息
private String device_ops; //运营商
private String device_net; //联网情况(wifi,3G.4G)
private String app_channel; //App下载来源:0-pc,1-iosappstore,2-yingyongbao,3-lenovo,4-qcode
private String app_version; //App应用版本号
private String app_mac; //手机mac地址,
private String app_uuid; //ios uuid?android:uid
private String browser_ver; // 浏览器版本
public String getDevice_brand() {
return device_brand;
}
public void setDevice_brand(String device_brand) {
this.device_brand = device_brand;
}
public String getDevice_model() {
return device_model;
}
public void setDevice_model(String device_model) {
this.device_model = device_model;
}
public Integer getDevice_type() {
return device_type;
}
public void setDevice_type(Integer device_type) {
this.device_type = device_type;
}
public String getSystem_level() {
return system_level;
}
public void setSystem_level(String system_level) {
this.system_level = system_level;
}
public String getDevice_ip() {
return device_ip;
}
public void setDevice_ip(String device_ip) {
this.device_ip = device_ip;
}
public String getResolution_wh() {
return resolution_wh;
}
public void setResolution_wh(String resolution_wh) {
this.resolution_wh = resolution_wh;
}
public String getDevice_imei() {
return device_imei;
}
public void setDevice_imei(String device_imei) {
this.device_imei = device_imei;
}
public String getDevice_ops() {
return device_ops;
}
public void setDevice_ops(String device_ops) {
this.device_ops = device_ops;
}
public String getDevice_net() {
return device_net;
}
public void setDevice_net(String device_net) {
this.device_net = device_net;
}
public String getApp_channel() {
return app_channel;
}
public void setApp_channel(String app_channel) {
this.app_channel = app_channel;
}
public String getApp_version() {
return app_version;
}
public void setApp_version(String app_version) {
this.app_version = app_version;
}
public String getApp_mac() {
return app_mac;
}
public void setApp_mac(String app_mac) {
this.app_mac = app_mac;
}
public String getApp_uuid() {
return app_uuid;
}
public void setApp_uuid(String app_uuid) {
this.app_uuid = app_uuid;
}
public String getBrowser_ver() {
return browser_ver;
}
public void setBrowser_ver(String browser_ver) {
this.browser_ver = browser_ver;
}
@Override
public String toString() {
return "PICAPDeviceInfo [device_brand=" + device_brand + ", device_model=" + device_model + ", device_type="
+ device_type + ", system_level=" + system_level + ", device_ip=" + device_ip + ", resolution_wh="
+ resolution_wh + ", device_imei=" + device_imei + ", device_ops=" + device_ops + ", device_net="
+ device_net + ", app_channel=" + app_channel + ", app_version=" + app_version + ", app_mac=" + app_mac
+ ", app_uuid=" + app_uuid + ", browser_ver=" + browser_ver + "]";
}
}
package com.pica.cloud.account.account.server.util;
import java.util.ArrayList;
/**
* Created by PicaHelth on 2017/8/18.
* 发送短信调用serviceImpl使用对象
*/
public class PICAPSendMsgModel {
//大汉三通发送短信内容
private String content;
//手机
private String mobile;
//发送日志创建人,可为空
private Integer userId;
//腾讯发送消息模内容
private ArrayList<String> params;
//腾讯发送短信模板id
private Integer tmplId;
//发送短信签名:DHST 或者 YQY 或者 "" -----根据sign获取 短信标题
private String sign;
//腾讯发送字段
private String extend;
private String ext;
//发送消息实体Id,当发送患教和患者消息推送时设置
private Integer sms_entity_id;
//设备信息
private PICAPDeviceInfo deviceInfo;
//标识可配置
private String key;
//系统code
private int sysCode;
//系统名称
private String sysName;
//批次号
private String batch_no;
public String getBatch_no() {
return batch_no;
}
public void setBatch_no(String batch_no) {
this.batch_no = batch_no;
}
/**
* 当前时间long
*/
private String time;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getSysCode() {
return sysCode;
}
public void setSysCode(int sysCode) {
this.sysCode = sysCode;
}
public String getSysName() {
return sysName;
}
public void setSysName(String sysName) {
this.sysName = sysName;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Integer getSms_entity_id() {
return sms_entity_id;
}
public void setSms_entity_id(Integer sms_entity_id) {
this.sms_entity_id = sms_entity_id;
}
//是否触发短信补发,默认为false不补发,如果要补发,设置为true
private boolean supplementFlag;
//线程读取数据库中失败短信的sql执行的时间间隔,默认 15秒
private Long timeInterval;
public Long getTimeInterval() {
return timeInterval;
}
public void setTimeInterval(Long timeInterval) {
this.timeInterval = timeInterval;
}
public boolean isSupplementFlag() {
return supplementFlag;
}
public void setSupplementFlag(boolean supplementFlag) {
this.supplementFlag = supplementFlag;
}
public String getExtend() {
return extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public String getExt() {
return ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public ArrayList<String> getParams() {
return params;
}
public void setParams(ArrayList<String> params) {
this.params = params;
}
public Integer getTmplId() {
return tmplId;
}
public void setTmplId(Integer tmplId) {
this.tmplId = tmplId;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public PICAPDeviceInfo getDeviceInfo() {
return deviceInfo;
}
public void setDeviceInfo(PICAPDeviceInfo deviceInfo) {
this.deviceInfo = deviceInfo;
}
}
package com.pica.cloud.account.account.server.util;
import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.crypto.Cipher;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
/**
* RSA加解密工具类
*/
@Component
public class RSAUtil {
private static Map<Integer, String> keyMap = new HashMap<>();
public static String rsaprivatekey;
public static String rsapublickey;
@Value("${rsaprivatekey}")
public String rsaprivatekeyTemp;
@Value("${rsapublickey}")
public String rsapublickeyTemp;
@PostConstruct
public void init() {
RSAUtil.rsaprivatekey = rsaprivatekeyTemp;
RSAUtil.rsapublickey = rsapublickeyTemp;
}
/**
* 加密方法
*
* @param keyString
* @return
*/
public static String encrypt(String keyString) throws Exception {
return encrypt(keyString, rsapublickey);
}
/**
* 解密方法
*
* @param key
* @return
*/
public static String decrypt(String key) throws Exception {
return decrypt(key, rsaprivatekey);
}
/**
* 随机生成密钥对
*
* @throws NoSuchAlgorithmException
*/
public static void genKeyPair() throws NoSuchAlgorithmException {
// KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
// 初始化密钥对生成器,密钥大小为96-1024位
keyPairGen.initialize(1024, new SecureRandom());
// 生成一个密钥对,保存在keyPair中
KeyPair keyPair = keyPairGen.generateKeyPair();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); // 得到私钥
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); // 得到公钥
String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded()));
// 得到私钥字符串
String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded())));
// 将公钥和私钥保存到Map
keyMap.put(0, publicKeyString); //0表示公钥
keyMap.put(1, privateKeyString); //1表示私钥
}
/**
* RSA公钥加密
*
* @param str 加密字符串
* @param publicKey 公钥
* @return 密文
* @throws Exception 加密过程中的异常信息
*/
public static String encrypt(String str, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes("UTF-8")));
return outStr;
}
/**
* RSA私钥解密
*
* @param str 加密字符串
* @param privateKey 私钥
* @return 铭文
* @throws Exception 解密过程中的异常信息
*/
public static String decrypt(String str, String privateKey) throws Exception {
//64位解码加密后的字符串
byte[] inputByte = Base64.decodeBase64(str.getBytes("UTF-8"));
//base64编码的私钥
byte[] decoded = Base64.decodeBase64(privateKey);
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
//RSA解密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, priKey);
String outStr = new String(cipher.doFinal(inputByte));
return outStr;
}
public static void main(String[] args) throws Exception {
//生成公钥和私钥
//genKeyPair();
// keyMap.put(0, publicKey);
// keyMap.put(1, privateKey);
// //加密字符串
// String message = "df723820";
// System.out.println("随机生成的公钥为:" + keyMap.get(0));
// System.out.println("随机生成的私钥为:" + keyMap.get(1));
// String messageEn = encrypt(message, keyMap.get(0));
// System.out.println(message + "\t加密后的字符串为:" + messageEn);
// String messageDe = decrypt(messageEn, keyMap.get(1));
// System.out.println("还原后的字符串为:" + messageDe);
genKeyPair();
String s = keyMap.get(0);
System.out.println(s);
String s1 = keyMap.get(1);
System.out.println(s1);
String key1 = "";
String key2 = "";
}
}
package com.pica.cloud.account.account.server.util;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.foundation.redis.ICacheClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
/**
* Token工具类
*/
@Component
public class TokenUtils {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
/**
* 校验token的状态
*
* @param token
* @return
*/
public boolean checkTokenStatus(String token) {
String str = cacheClient.get("token-" + token);
return StringUtils.isBlank(str);
}
/**
* 获取新的token
*
* @param account
* @return
*/
public String generateToken(Account account) {
Integer registerSource = account.getRegisterSource();
String newToken = "";
try {
//用户id
String value = "token-doctor-" + account.getId().toString();
// 根据不同的产品线设置token有效期
int expiredSeconds = 24 * 60 * 60;
if (registerSource != 3 && registerSource != 5) {
expiredSeconds = expiredSeconds * 30;
}
newToken = UUID.randomUUID().toString().replace("-", "").toUpperCase();
String Key = "token-" + newToken;
//存储token对应的用户id,数据结构如:(token-FF9FCB0D93A642328A01C279701B7607:token-doctor-1)
cacheClient.set(Key, value, expiredSeconds);
//存储不同终端对应的token,数据结构如:(token-doctor-12345678-app:token-FF9FCB0D93A642328A01C279701B7607)
String sourceType = AccountUtils.getSourceType(registerSource);
cacheClient.set(value + "-" + sourceType, Key, expiredSeconds);
//用户数据放入redis缓存
String userData = cacheClient.hget(value, "id");
if (org.apache.commons.lang3.StringUtils.isEmpty(userData)) {
Map<String, String> data = new HashMap<>();
data.put("token", newToken);
data.put("id", account.getId() + "");
data.put("acctId", account.getAcctId() + "");
data.put("mobile", account.getMobilePhone());
data.put("name", account.getMobilePhone().replaceAll("(\\d{3})\\d{4}(\\w{4})", "$1****$2"));
data.put("created_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(account.getCreatTime()));
data.put("sysCode", sourceType);
Iterator<Map.Entry<String, String>> iterator = data.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> map = iterator.next();
String key = map.getKey();
String valueInfo = map.getValue();
//存储token:(token-doctor-1:用户数据)
cacheClient.hset(value, key, valueInfo);
}
} else {
cacheClient.hset(value, "token", newToken);
}
} catch (Exception ex) {
logger.error("生成token异常:{}" + ex.getMessage(), ex);
}
return newToken;
}
}
package com.pica.cloud.account.account.server.util;
import com.pica.cloud.account.account.server.entity.WeChatEntity;
import com.pica.cloud.foundation.utils.constants.WeChatConstants;
import com.pica.cloud.foundation.utils.utils.JsonUtil;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import com.pica.cloud.foundation.utils.utils.date.DateTimeUtils;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ConnectException;
import java.net.URL;
import java.util.Date;
//import com.picahealth.common.utils.DateTimeUtils;
//import com.picahealth.common.utils.JsonUtil;
//import com.picahealth.common.utils.StringUtil;
//import com.picahealth.wit.wechat.constants.WeChatConstants;
//import com.picahealth.wit.wechat.entity.AccessToken;
//import com.picahealth.wit.wechat.entity.JsapiTicket;
//import com.picahealth.wit.wechat.entity.Menu;
//import static com.picahealth.wechat.wechat.thread.AccessTokenThread.appid;
//import static com.picahealth.wechat.wechat.thread.AccessTokenThread.appsecret;
//import static com.picahealth.wechat.wechat.thread.AccessTokenThread.appid;
//import static com.picahealth.wechat.wechat.thread.AccessTokenThread.appsecret;
//import static com.picahealth.wechat.wechat.thread.AccessTokenThread.jsapiTicket;
/**
* 公众平台通用接口工具类
*
* @author bo.dang
* @date 2013-08-09
*/
public class WeChatToolUtil {
private static Logger logger = LoggerFactory.getLogger(WeChatToolUtil.class);
/** access_token */
public static String access_token;
public static WeChatEntity accessToken;
/** 获取access_token的时间 */
private static Date get_access_token_time;
/**
* 发起https请求并获取结果
*
* @param requestUrl 请求地址
* @param requestMethod 请求方式(GET、POST)
* @param outputStr 提交的数据
* @return JSONObject(通过JSONObject.get(key)的方式获取json对象的属性值)
*/
public static JSONObject httpRequest(String requestUrl, String requestMethod, String outputStr) {
JSONObject jsonObject = null;
StringBuffer buffer = new StringBuffer();
try {
// 创建SSLContext对象,并使用我们指定的信任管理器初始化
TrustManager[] tm = { new MyX509TrustManager() };
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tm, new java.security.SecureRandom());
// 从上述SSLContext对象中得到SSLSocketFactory对象
SSLSocketFactory ssf = sslContext.getSocketFactory();
URL url = new URL(requestUrl);
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
httpUrlConn.setSSLSocketFactory(ssf);
httpUrlConn.setDoOutput(true);
httpUrlConn.setDoInput(true);
httpUrlConn.setUseCaches(false);
// 设置请求方式(GET/POST)
httpUrlConn.setRequestMethod(requestMethod);
if ("GET".equalsIgnoreCase(requestMethod))
httpUrlConn.connect();
// 当有数据需要提交时
if (null != outputStr) {
OutputStream outputStream = httpUrlConn.getOutputStream();
// 注意编码格式,防止中文乱码
outputStream.write(outputStr.getBytes("UTF-8"));
outputStream.close();
}
// 将返回的输入流转换成字符串
InputStream inputStream = httpUrlConn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
inputStream = null;
httpUrlConn.disconnect();
logger.info(buffer.toString());
jsonObject = JSONObject.fromObject(buffer.toString());
} catch (ConnectException ce) {
logger.error("Weixin server connection timed out.");
} catch (Exception e) {
logger.error("https request error:{}", e);
}
return jsonObject;
}
/**
* 获取access_token
*
* @param appid 凭证
* @param appsecret 密钥
* @return
*/
public static WeChatEntity getAccessToken(String appid, String appsecret) {
WeChatEntity accessToken = null;
String requestUrl = WeChatConstants.ACCESS_TOKEN_URL.replace("APPID", appid).replace("APPSECRET", appsecret);
JSONObject jsonObject = httpRequest(requestUrl, "GET", null);
// 如果请求成功
if (null != jsonObject) {
try {
access_token = jsonObject.getString("access_token");
if(!StringUtil.isEmpty(access_token)){
get_access_token_time = new Date();
accessToken = JsonUtil.toGsonBean(jsonObject.toString(), WeChatEntity.class);
/*
accessToken.setAccess_token(jsonObject.getString("access_token"));
accessToken.setExpires_in(jsonObject.getInt("expires_in"));*/
}
else {
get_access_token_time = new Date();
}
} catch (JSONException e) {
accessToken = null;
// 获取token失败
logger.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
}
}
else {
// 获取token失败
logger.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
}
WeChatToolUtil.accessToken = accessToken;
return accessToken;
}
/**
* 校验accessToken是否过期
* @param access_token
* @return
*/
// public static WeChatEntity checkAccessTokencheckAccessToken(String access_token){
//
//
// WeChatEntity accessToken = WeChatToolUtil.accessToken;
//
// if(WeChatToolUtil.isExpired() || StringUtil.isEmpty(access_token)){
//
// accessToken = WeChatToolUtil.getAccessToken(appId, WeChatConstants.APP_SECRET);
// }
//
//
// return accessToken;
//
// }
// /**
// * 获得jsapi_ticket
// * @return
// */
// public static JsapiTicket getJsapi_ticket(){
//
// //AccessToken accessToken = getAccessToken(WeChatConstants.APP_ID, WeChatConstants.APP_SECRET);
//
// String requestUrl = WeChatConstants.GET_JSAPI_TICKET.replace("ACCESS_TOKEN", access_token);
// JSONObject jsonObject = httpRequest(requestUrl, "GET", null);
// JsapiTicket jsapiTicket = null;
// if(StringUtil.isNotNull(jsonObject)){
// jsapiTicket = JsonUtil.toGsonBean(jsonObject.toString(), JsapiTicket.class);
// }
//
// return jsapiTicket;
//
// }
//
// /**
// * 签名算法
// * @param url
// * @return
// */
// public static Map<String, String> sign(String url){
// //String jsapi_ticket = getJsapi_ticket();
// return Sign.sign(jsapiTicket.getTicket(), url);
// }
//
// /**
// * 创建菜单
// *
// * @param menu 菜单实例
// * @param accessToken 有效的access_token
// * @return 0表示成功,其他值表示失败
// */
// public static int createMenu(Menu menu, String accessToken) {
// int result = 0;
//
// // 拼装创建菜单的url
// String url = WeChatConstants.MENU_CREATE_URL.replace("ACCESS_TOKEN", accessToken);
// // 将菜单对象转换成json字符串
// String jsonMenu = JSONObject.fromObject(menu).toString();
// // 调用接口创建菜单
// JSONObject jsonObject = httpRequest(url, "POST", jsonMenu);
//
// if (null != jsonObject) {
// if (0 != jsonObject.getInt("errcode")) {
// result = jsonObject.getInt("errcode");
// logger.error("创建菜单失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
// }
// }
//
// return result;
// }
// /**
// * 设置所属行业
// *
// * @param menu 菜单实例
// * @param accessToken 有效的access_token
// * @return 0表示成功,其他值表示失败
// */
// public static int setIndustry(, String accessToken) {
// int result = 0;
//
// // 拼装创建菜单的url
// String url = WeChatConstants.MENU_CREATE_URL.replace("ACCESS_TOKEN", accessToken);
// // 将菜单对象转换成json字符串
// String jsonMenu = JSONObject.fromObject(menu).toString();
// // 调用接口创建菜单
// JSONObject jsonObject = httpRequest(url, "POST", jsonMenu);
//
// if (null != jsonObject) {
// if (0 != jsonObject.getInt("errcode")) {
// result = jsonObject.getInt("errcode");
// logger.error("创建菜单失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
// }
// }
//
// return result;
// }
/**
* 判断是否是QQ表情
*
* @param content
* @return
*/
// public static boolean isQqFace(String content) {
// boolean result = false;
//
// // 判断QQ表情的正则表达式
// String qqfaceRegex = "/::\\)|/::~|/::B|/::\\||/:8-\\)|/::<|/::$|/::X|/::Z|/::'\\(|/::-\\||/::@|/::P|/::D|/::O|/::\\(|/::\\+|/:--b|/::Q|/::T|/:,@P|/:,@-D|/::d|/:,@o|/::g|/:\\|-\\)|/::!|/::L|/::>|/::,@|/:,@f|/::-S|/:\\?|/:,@x|/:,@@|/::8|/:,@!|/:!!!|/:xx|/:bye|/:wipe|/:dig|/:handclap|/:&-\\(|/:B-\\)|/:<@|/:@>|/::-O|/:>-\\||/:P-\\(|/::'\\||/:X-\\)|/::\\*|/:@x|/:8\\*|/:pd|/:<W>|/:beer|/:basketb|/:oo|/:coffee|/:eat|/:pig|/:rose|/:fade|/:showlove|/:heart|/:break|/:cake|/:li|/:bome|/:kn|/:footb|/:ladybug|/:shit|/:moon|/:sun|/:gift|/:hug|/:strong|/:weak|/:share|/:v|/:@\\)|/:jj|/:@@|/:bad|/:lvu|/:no|/:ok|/:love|/:<L>|/:jump|/:shake|/:<O>|/:circle|/:kotow|/:turn|/:skip|/:oY|/:#-0|/:hiphot|/:kiss|/:<&|/:&>";
// Pattern p = Pattern.compile(qqfaceRegex);
// Matcher m = p.matcher(content);
// if (m.matches()) {
// result = true;
// }
// return result;
// }
/**
* 判断access_token是否过期
*/
public static Boolean isExpired(){
if(null != get_access_token_time){
logger.info("判断access_token是否过期 get_access_token_time:{} currentTime:{}", DateTimeUtils.DateTimeFormater.format(get_access_token_time), DateTimeUtils.currentDateTime());
return DateTimeUtils.compare2Date(new Date(), DateTimeUtils.addDateSeconds(get_access_token_time, (7200-60) * 1000));
}
else {
return true;
}
}
// /**
// * 判断access_token是否过期
// */
// public static Boolean isExpired(Date createdAt, Integer expireIn){
// if(null != createdAt){
// logger.info("判断access_token是否过期 createdAt time:{} currentTime:{}", DateTimeUtils.DateTimeFormater.format(createdAt), DateTimeUtils.currentDateTime());
// return DateTimeUtils.compare2Date(new Date(), DateTimeUtils.addDateSeconds(createdAt, (expireIn - 60) * 1000));
// }
// else {
// return true;
// }
// }
/**
* 系统启动时取得AccessToken
* @return
*/
// public static WeChatEntity initWechatAccessToken(String appid, String appsecret){
//
// accessToken = WeChatToolUtil.getAccessToken(appid, appsecret);
// if (null != accessToken) {
// logger.info("获取access_token成功,有效时长{}秒 access_token:{}", accessToken.getExpires_in(), accessToken.getAccess_token());
// // 获取权限签名
// jsapiTicket = WeChatToolUtil.getJsapi_ticket();
// if (StringUtil.isNotNull(jsapiTicket)) {
// logger.info("获取jsapi_ticket成功,有效时长{}秒 jsapi_ticket:{}", jsapiTicket.getExpires_in(), jsapiTicket.getTicket());
// }
// }
//
// return accessToken;
// }
/* // 文本消息
if (msgType.equals(MessageUtil.REQ_MESSAGE_TYPE_TEXT)) {
// 文本消息内容
String content = requestMap.get("Content");
// 判断用户发送的是否是单个QQ表情
if(XiaoqUtil.isQqFace(content)) {
// 回复文本消息
TextMessage textMessage = new TextMessage();
textMessage.setToUserName(fromUserName);
textMessage.setFromUserName(toUserName);
textMessage.setCreateTime(new Date().getTime());
textMessage.setMsgType(MessageUtil.RESP_MESSAGE_TYPE_TEXT);
textMessage.setFuncFlag(0);
// 用户发什么QQ表情,就返回什么QQ表情
textMessage.setContent(content);
// 将文本消息对象转换成xml字符串
respMessage = MessageUtil.textMessageToXml(textMessage);
}
}*/
}
\ No newline at end of file
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSON;
import com.pica.cloud.account.account.server.entity.WeChatEntity;
import com.pica.cloud.account.account.server.entity.WeChatUserInfoEntity;
import com.pica.cloud.foundation.utils.constants.WeChatConstants;
import com.pica.cloud.foundation.utils.utils.JsonUtil;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WeChatUtils {
private static Logger logger = LoggerFactory.getLogger(WeChatUtils.class);
public static WeChatEntity getAuthorizationInfo(String appId, String appSecret, String code) {
logger.info("网页授权获取access_token: code:{}", code);
String requestUrl = WeChatConstants.AUTH_ACCESS_TOKEN_URL.replace("APPID", appId).replace("SECRET", appSecret).replace("CODE", code);
JSONObject jsonObject = WeChatToolUtil.httpRequest(requestUrl, "GET", null);
WeChatEntity accessToken = null;
// 如果请求成功
if (null != jsonObject) {
try {
accessToken = JsonUtil.toGsonBean(jsonObject.toString(), WeChatEntity.class);
logger.info("网页授权获取access_token: access_token:{} openid:{}", accessToken.getAccess_token(), accessToken.getOpenid());
} catch (JSONException e) {
// 获取token失败
logger.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
}
} else {
// 获取token失败
logger.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
}
return accessToken;
}
public static Map getWeChatUserInfo(Map map, String url) {
String param = "access_token=" + map.get("access_token") + "&openid=" + map.get("openid") + "&lang=zh_CN";
List<NameValuePair> nameValuePairs = URLEncodedUtils.parse(param, Charset.forName("utf-8"));
HttpGet method = null;
try {
url = url + param;
URL url1 = new URL(url);
URI uri = new URI(url1.getProtocol(), url1.getHost(), url1.getPath(), url1.getQuery(), null);
method = new HttpGet(uri);
// 建立一个NameValuePair数组,用于存储欲传送的参数
method.addHeader("Content-type", "application/json; charset=utf-8");
method.setHeader("Accept", "application/json");
HttpResponse response = HttpClients.createDefault().execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) {
String body = EntityUtils.toString(response.getEntity(), "utf-8");
return JSON.parseObject(body, Map.class);
} else {
logger.warn("微信获取用户信息(包括UnionID)失败,param:{}, result:{}", JSON.toJSONString(map), JSON.toJSONString(response));
return new HashMap();
}
} catch (IOException e) {
logger.error("微信获取access_token异常,param:{}", JSON.toJSONString(map), e);
return new HashMap();
} catch (URISyntaxException e) {
logger.error("异常抛出exception ", e);
} finally {
if (method != null) {
method.releaseConnection();
}
}
return new HashMap();
}
public static WeChatUserInfoEntity mergeWechatUserInfo(Map map, String openid){
WeChatUserInfoEntity user = new WeChatUserInfoEntity();
user.setOpenid(openid);
user.setLanguage("zh_CN");
if (StringUtil.isNotNull(map) && map.size() > 0) {
user.setSubscribe((Integer) map.get("subscribe"));
user.setNickname((String) (map.get("nickname")));
user.setSex((Integer) map.get("sex"));
user.setLanguage((String) map.get("language"));
user.setCity((String) map.get("city"));
user.setProvince((String) map.get("province"));
user.setCountry((String) map.get("country"));
user.setHeadimgurl((String) map.get("headimgurl"));
user.setSubscribe_time(new Date(map.get("subscribe_time") == null ? 1501052712L : Long.valueOf(map.get("subscribe_time").toString())));
user.setRemark((String) map.get("remark"));
user.setUnionid((String) map.get("unionid"));
user.setGroupid((Integer) map.get("groupid"));
user.setTagid_list(JSON.toJSONString(map.get("tagid_list")));
}
return user;
}
}
package com.pica.cloud.account.account.server.util.captcha;
import org.apache.commons.io.IOUtils;
import java.awt.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* @author Laurence Cao
*
*/
public class CaptchaContext {
final Random rnd = ThreadLocalRandom.current();
final int fontCount = 4;
public int width;
public int height;
public float fontSize;
public boolean showGrid;
public int gridSize = 1 + rnd.nextInt(10);
public int rotationAmplitude = rnd.nextInt(10);
public int scaleAmplitude = 2 * rotationAmplitude;
public Font font;
static byte[][] fontDatas = new byte[4][];
static {
try {
InputStream fontStream = CaptchaGenerator.class.getClassLoader().getResourceAsStream("1.ttf");
fontDatas[0] = IOUtils.toByteArray(fontStream);
fontStream.close();
fontStream = CaptchaGenerator.class.getClassLoader().getResourceAsStream("2.ttf");
fontDatas[1] = IOUtils.toByteArray(fontStream);
fontStream.close();
fontStream = CaptchaGenerator.class.getClassLoader().getResourceAsStream("3.ttf");
fontDatas[2] = IOUtils.toByteArray(fontStream);
fontStream.close();
fontStream = CaptchaGenerator.class.getClassLoader().getResourceAsStream("4.ttf");
fontDatas[3] = IOUtils.toByteArray(fontStream);
fontStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public CaptchaContext(int width, int height, int fontSize, boolean showGrid) throws FontFormatException, IOException {
this.width = width;
this.height = height;
this.fontSize = fontSize;
this.showGrid = showGrid;
int index = ThreadLocalRandom.current().nextInt(0, fontCount);
this.font = Font.createFont(Font.TRUETYPE_FONT, new ByteArrayInputStream(fontDatas[index]));
}
public int rndGridSize() {
return 1 + rnd.nextInt(10);
}
public int rndRotationAmplitude() {
return rnd.nextInt(10);
}
public int rndScaleAmplitude() {
return rnd.nextInt(20);
}
public float rndFontSize() {
return fontSize + rnd.nextFloat();
}
}
package com.pica.cloud.account.account.server.util.captcha;
import com.google.common.collect.Range;
import com.google.common.collect.RangeMap;
import com.google.common.collect.TreeRangeMap;
import org.springframework.stereotype.Component;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* @author Laurence Cao
*
*/
@Component
public class CaptchaGenerator {
protected RangeMap<Integer, CaptchaContext> ctxs = TreeRangeMap.create();
protected List<Generator> gens = new ArrayList();
class NumberLetterGenerator implements Generator {
@Override
public String generateChars(int size) {
return CaptchaUtil.generateUUIDText(size);
}
}
public CaptchaGenerator() throws FontFormatException, IOException {
int h = 40;
ctxs.put(Range.closedOpen(0, h), new CaptchaContext(h * 4, h, (int) (h * 1.2), true));
h *= 2;
ctxs.put(Range.closedOpen(h / 2, h), new CaptchaContext(h * 4, h, (int) (h * 1.2), true));
h *= 2;
ctxs.put(Range.closedOpen(h / 2, Integer.MAX_VALUE), new CaptchaContext(h * 4, h, (int) (h * 1.2), true));
gens.add(new NumberLetterGenerator());
}
@SuppressWarnings("unused")
public byte[] createCaptcha(String text, int width, int height) {
CaptchaContext ctx = ctxs.get(height);
if (ctx == null) {
ctx = ctxs.get(0);
}
return CaptchaUtil.generateImage(text, ctx);
}
public String generateChars(int size) {
int idx = ThreadLocalRandom.current().nextInt(gens.size());
Generator gen = gens.get(idx);
return gen.generateChars(size);
}
}
package com.pica.cloud.account.account.server.util.captcha;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Base64;
/**
* @author Laurence Cao
*
*/
public class CaptchaToken {
/**
* 代表此验证码的唯一标识符,超时和一次使用均会失效
*/
protected String token;
/**
* 代表此验证码的实际图片,以字节码方式提供
*/
@JsonIgnore
protected byte[] buf;
/**
* 原始随机字符串
*/
@JsonIgnore
protected String origin;
/**
* base64编码的图片
*/
protected String content;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public byte[] getBuf() {
return buf;
}
public void setBuf(byte[] buf) {
this.buf = buf;
setContent(Base64.getEncoder().encodeToString(this.buf));
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
}
package com.pica.cloud.account.account.server.util.captcha;
import org.apache.commons.io.IOUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
/**
* @author Laurence Cao
*
*/
public class CaptchaUtil {
final static int MAXSIZE = UUID.randomUUID().toString().replace("_", "").length();
static byte[] imageData;
static {
try {
InputStream imageStream = CaptchaUtil.class.getClassLoader().getResourceAsStream("1.png");
imageData = IOUtils.toByteArray(imageStream);
imageStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String generateUUIDText(int count) {
int pos = count < MAXSIZE ? count : MAXSIZE;
pos = pos <= 0 ? 5 : pos;
return UUID.randomUUID().toString().replace("_", "").substring(0, pos);
}
public static byte[] generateImage(String text, CaptchaContext ctx) {
byte[] ret = null;
try {
BufferedImage img = createCaptcha(text, ctx);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(img, "png", baos);
baos.flush();
ret = baos.toByteArray();
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
return ret;
}
public static BufferedImage createCaptcha(String src, CaptchaContext ctx) throws IOException{
char[] text = src == null ? new char[0] : src.toCharArray();
if (text == null || text.length == 0) {
throw new IllegalArgumentException("No captcha text given");
}
//BufferedImage image = new BufferedImage(ctx.width, ctx.height, BufferedImage.TYPE_INT_RGB);
BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageData));
Graphics2D g2d = image.createGraphics();
//g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//g2d.setBackground(Color.WHITE);
g2d.setColor(Color.BLACK);
//clearCanvas(g2d, ctx);
//if (ctx.showGrid) {
// drawGrid(g2d, ctx);
//}
ctx.height = image.getHeight();
int charMaxWidth = (int) ((image.getWidth() * 0.8) / text.length);
int xPos = (int) (image.getWidth() * 0.1);
for (char ch : text) {
drawCharacter(g2d, ctx, ch, xPos, charMaxWidth);
xPos += charMaxWidth;
}
g2d.dispose();
return image;
}
/**
* Clears the canvas.
*/
private static void clearCanvas(Graphics2D g2d, CaptchaContext ctx) {
g2d.clearRect(0, 0, ctx.width, ctx.height);
}
/**
* Draws the background grid.
*/
private static void drawGrid(Graphics2D g2d, CaptchaContext ctx) {
for (int y = 2; y < ctx.height; y += ctx.gridSize) {
g2d.drawLine(0, y, ctx.width - 1, y);
}
for (int x = 2; x < ctx.width; x += ctx.gridSize) {
g2d.drawLine(x, 0, x, ctx.height - 1);
}
}
/**
* Draws a single character.
*
* @param g2d {@link Graphics2D} context
* @param ch character to draw
* @param x left x position of the character
* @param boxWidth width of the box
*/
private static void drawCharacter(Graphics2D g2d, CaptchaContext ctx, char ch, int x, int boxWidth) {
ThreadLocalRandom rnd = ThreadLocalRandom.current();
double degree = (rnd.nextDouble() * ctx.rndRotationAmplitude() * 2) - ctx.rndRotationAmplitude();
double scale = 1 - (rnd.nextDouble() * ctx.rndScaleAmplitude() / 100);
Graphics2D cg2d = (Graphics2D)g2d.create();
cg2d.setFont(ctx.font.deriveFont(ctx.rndFontSize()));
cg2d.translate(x + (boxWidth / 2), ctx.height / 2);
cg2d.rotate(degree * Math.PI / 90);
cg2d.scale(scale, scale);
FontMetrics fm = cg2d.getFontMetrics();
int charWidth = fm.charWidth(ch);
int charHeight = fm.getAscent() + fm.getDescent();
cg2d.drawString(String.valueOf(ch), -(charWidth / 2), fm.getAscent() - (charHeight / 2));
cg2d.dispose();
}
}
package com.pica.cloud.account.account.server.util.captcha;
/**
* @author Laurence Cao
*
*/
public interface Generator {
/**
* generate string by fixed size
*
* @param size
* @return
*/
String generateChars(int size);
}
server.port=13201 server.port=13201
server.context-path=/account server.context-path=/account
spring.application.name=${server.port}-pica-cloud-account spring.application.name=${server.port}-pica-cloud-account
#config server settings #config server settings
spring.cloud.config.name=com.pica.cloud.account spring.cloud.config.name=com.pica.cloud.account
spring.cloud.config.profile=dev spring.cloud.config.profile=dev
...@@ -9,27 +8,46 @@ spring.cloud.config.label=publish ...@@ -9,27 +8,46 @@ spring.cloud.config.label=publish
spring.cloud.config.discovery.enabled=true spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=config-server spring.cloud.config.discovery.service-id=config-server
spring.data.mongodb.uri=mongodb://pica_user:2wsx3edc@192.168.140.30:27017/picadb
spring.application.doctor.name=11101-pica-cloud-doctor
#eureka settings #eureka settings
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.client.service-url.defaultZone=http://192.168.110.120:7891/eureka/,http://192.168.110.121:7891/eureka/ eureka.client.service-url.defaultZone=http://192.168.110.120:7891/eureka/,http://192.168.110.121:7891/eureka/
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/${server.context-path}/swagger-ui.html
eureka.instance.lease-renewal-interval-in-seconds=10 eureka.instance.lease-renewal-interval-in-seconds=10
eureka.instance.lease-expiration-duration-in-seconds=10 eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress} eureka.instance.hostname=${spring.cloud.client.ipAddress}
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
#logback settings #logback settings
logging.level.ROOT=INFO logging.level.ROOT=INFO
logging.path=c:/tomcat-log/${spring.application.name} logging.path=c:/tomcat-log/${spring.application.name}
#job settings #job settings
#xxl.job.executor.appname=pica-cloud-${server.port}-account-job #xxl.job.executor.appname=pica-cloud-${server.port}-account-job
#feign settings #feign settings
feign.hystrix.enabled=false #feign.hystrix.enabled=false
ribbon.ReadTimeout=120000 ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=60000 ribbon.ConnectTimeout=60000
#------------ Please don't change above configurations ------------ #------------ Please don't change above configurations ------------
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
\ No newline at end of file #spring.jackson.default-property-inclusion=non_null
memcached.url=192.168.130.230:11211
#微信登陆
weChatAppID=wx5103ed453ef2dbe8
weChatAppSecret=6faa9bef3302786c08b2baf278613f38
weChatURL=https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode=true
#rabbitmq settings
spring.rabbitmq.host=192.168.110.206
spring.rabbitmq.port=5672
spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost
management.security.enabled=false
management.endpoint.health.show-details=always
server.port=13201 server.port=13201
server.context-path=/account server.context-path=/account
spring.application.name=${server.port}-pica-cloud-account spring.application.name=${server.port}-pica-cloud-account
spring.application.doctor.name=11101-pica-cloud-doctor
#config server settings #config server settings
spring.cloud.config.name=com.pica.cloud.account spring.cloud.config.name=com.pica.cloud.account
...@@ -12,7 +13,7 @@ spring.cloud.config.discovery.service-id=prd-config-server ...@@ -12,7 +13,7 @@ spring.cloud.config.discovery.service-id=prd-config-server
#eureka settings #eureka settings
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.client.service-url.defaultZone=http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.14:7891/eureka,http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.15:7891/eureka,http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.16:7891/eureka eureka.client.service-url.defaultZone=http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.14:7891/eureka,http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.15:7891/eureka,http://pica-ms-prd:~!QAZ2wsx3331805prd@172.19.137.16:7891/eureka
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/${server.context-path}/swagger-ui.html
eureka.instance.lease-renewal-interval-in-seconds=10 eureka.instance.lease-renewal-interval-in-seconds=10
eureka.instance.lease-expiration-duration-in-seconds=10 eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress} eureka.instance.hostname=${spring.cloud.client.ipAddress}
...@@ -26,10 +27,24 @@ logging.path=/opt/tomcat-log/${spring.application.name} ...@@ -26,10 +27,24 @@ logging.path=/opt/tomcat-log/${spring.application.name}
#xxl.job.executor.appname=pica-cloud-${server.port}-account-job #xxl.job.executor.appname=pica-cloud-${server.port}-account-job
#feign settings #feign settings
feign.hystrix.enabled=false #feign.hystrix.enabled=false
ribbon.ReadTimeout=120000 ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=60000 ribbon.ConnectTimeout=60000
#------------ Please don't change above configurations ------------ #------------ Please don't change above configurations ------------
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
\ No newline at end of file
memcached.url=172.19.121.31:11211
#微信登陆
weChatAppID=wx5103ed453ef2dbe8
weChatAppSecret=6faa9bef3302786c08b2baf278613f38
weChatURL=https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode=true
management.security.enabled=false
management.endpoint.health.show-details=always
server.port=13201 server.port=13201
server.context-path=/account server.context-path=/account
spring.application.name=${server.port}-pica-cloud-account spring.application.name=${server.port}-pica-cloud-account
spring.application.doctor.name=11101-pica-cloud-doctor
#config server settings #config server settings
spring.cloud.config.name=com.pica.cloud.account spring.cloud.config.name=com.pica.cloud.account
spring.cloud.config.profile=test1 spring.cloud.config.profile=test1
...@@ -12,7 +12,7 @@ spring.cloud.config.discovery.service-id=config-server ...@@ -12,7 +12,7 @@ spring.cloud.config.discovery.service-id=config-server
#eureka settings #eureka settings
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.client.service-url.defaultZone=http://192.168.110.128:7891/eureka,http://192.168.110.129:7891/eureka eureka.client.service-url.defaultZone=http://192.168.110.128:7891/eureka,http://192.168.110.129:7891/eureka
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/${server.context-path}/swagger-ui.html
eureka.instance.lease-renewal-interval-in-seconds=10 eureka.instance.lease-renewal-interval-in-seconds=10
eureka.instance.lease-expiration-duration-in-seconds=10 eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress} eureka.instance.hostname=${spring.cloud.client.ipAddress}
...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name} ...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name}
#xxl.job.executor.appname=pica-cloud-${server.port}-account-job #xxl.job.executor.appname=pica-cloud-${server.port}-account-job
#feign settings #feign settings
feign.hystrix.enabled=false #feign.hystrix.enabled=false
ribbon.ReadTimeout=120000 ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=60000 ribbon.ConnectTimeout=60000
#------------ Please don't change above configurations ------------ #------------ Please don't change above configurations ------------
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
\ No newline at end of file
memcached.url=192.168.130.230:11211
#微信登陆
weChatAppID=wx5103ed453ef2dbe8
weChatAppSecret=6faa9bef3302786c08b2baf278613f38
weChatURL=https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode=true
#rabbitmq settings
spring.rabbitmq.host=192.168.110.206
spring.rabbitmq.port=5672
spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost
\ No newline at end of file
server.port=13201 server.port=13201
server.context-path=/account server.context-path=/account
spring.application.name=${server.port}-pica-cloud-account spring.application.name=${server.port}-pica-cloud-account
spring.application.doctor.name=11101-pica-cloud-doctor
#config server settings #config server settings
spring.cloud.config.name=com.pica.cloud.account spring.cloud.config.name=com.pica.cloud.account
spring.cloud.config.profile=test2 spring.cloud.config.profile=test2
...@@ -11,8 +11,8 @@ spring.cloud.config.discovery.service-id=config-server ...@@ -11,8 +11,8 @@ spring.cloud.config.discovery.service-id=config-server
#eureka settings #eureka settings
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.client.service-url.defaultZone=http://192.168.120.91:7891/eureka eureka.client.service-url.defaultZone=http://10.98.0.3:7891/eureka,http://10.98.0.4:7891/eureka,http://10.98.0.5:7891/eureka
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/${server.context-path}/swagger-ui.html
eureka.instance.lease-renewal-interval-in-seconds=10 eureka.instance.lease-renewal-interval-in-seconds=10
eureka.instance.lease-expiration-duration-in-seconds=10 eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress} eureka.instance.hostname=${spring.cloud.client.ipAddress}
...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name} ...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name}
#xxl.job.executor.appname=pica-cloud-${server.port}-account-job #xxl.job.executor.appname=pica-cloud-${server.port}-account-job
#feign settings #feign settings
feign.hystrix.enabled=false #feign.hystrix.enabled=false
ribbon.ReadTimeout=120000 ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=60000 ribbon.ConnectTimeout=60000
#------------ Please don't change above configurations ------------ #------------ Please don't change above configurations ------------
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
\ No newline at end of file
memcached.url=192.168.130.230:11211
#微信登陆
weChatAppID=wx5103ed453ef2dbe8
weChatAppSecret=6faa9bef3302786c08b2baf278613f38
weChatURL=https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode=true
#rabbitmq settings
spring.rabbitmq.host=192.168.110.206
spring.rabbitmq.port=5672
spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost
\ No newline at end of file
server.port=13201 server.port=13201
server.context-path=/account server.context-path=/account
spring.application.name=${server.port}-pica-cloud-account spring.application.name=${server.port}-pica-cloud-account
spring.application.doctor.name=11101-pica-cloud-doctor
#config server settings #config server settings
spring.cloud.config.name=com.pica.cloud.account spring.cloud.config.name=com.pica.cloud.account
spring.cloud.config.profile=uat spring.cloud.config.profile=uat
...@@ -12,7 +12,7 @@ spring.cloud.config.discovery.service-id=config-server ...@@ -12,7 +12,7 @@ spring.cloud.config.discovery.service-id=config-server
#eureka settings #eureka settings
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.client.service-url.defaultZone=http://pica-ms:~!QAZ2wsx3331805@192.168.110.137:7891/eureka,http://pica-ms:~!QAZ2wsx3331805@192.168.110.138:7891/eureka eureka.client.service-url.defaultZone=http://pica-ms:~!QAZ2wsx3331805@192.168.110.137:7891/eureka,http://pica-ms:~!QAZ2wsx3331805@192.168.110.138:7891/eureka
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}/${server.context-path}/swagger-ui.html
eureka.instance.lease-renewal-interval-in-seconds=10 eureka.instance.lease-renewal-interval-in-seconds=10
eureka.instance.lease-expiration-duration-in-seconds=10 eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress} eureka.instance.hostname=${spring.cloud.client.ipAddress}
...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name} ...@@ -26,10 +26,27 @@ logging.path=/opt/tomcat-log/${spring.application.name}
#xxl.job.executor.appname=pica-cloud-${server.port}-account-job #xxl.job.executor.appname=pica-cloud-${server.port}-account-job
#feign settings #feign settings
feign.hystrix.enabled=false #feign.hystrix.enabled=false
ribbon.ReadTimeout=120000 ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=60000 ribbon.ConnectTimeout=60000
#------------ Please don't change above configurations ------------ #------------ Please don't change above configurations ------------
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
\ No newline at end of file
memcached.url=192.168.130.230:11211
#微信登陆
weChatAppID=wx5103ed453ef2dbe8
weChatAppSecret=6faa9bef3302786c08b2baf278613f38
weChatURL=https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode=true
#rabbitmq settings
spring.rabbitmq.host=192.168.110.206
spring.rabbitmq.port=5672
spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost
\ No newline at end of file
spring.profiles.active=dev spring.profiles.active=dev
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR"/>
<result column="password" property="password" jdbcType="VARCHAR"/>
<result column="register_product" property="registerProduct" jdbcType="INTEGER"/>
<result column="register_source" property="registerSource" jdbcType="INTEGER"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="age" property="age" jdbcType="TINYINT"/>
<result column="birthday" property="birthday" jdbcType="DATE"/>
<result column="sex" property="sex" jdbcType="TINYINT"/>
<result column="id_card" property="idCard" jdbcType="VARCHAR"/>
<result column="reg_time" property="regTime" jdbcType="TIMESTAMP"/>
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER"/>
<result column="created_id" property="createdId" jdbcType="INTEGER"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modifiedId" jdbcType="INTEGER"/>
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, mobile_phone, password, register_product, register_source, name, age, birthday,
sex, id_card, reg_time, delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from account_info
where id = #{id,jdbcType=INTEGER} and delete_flag=1
</select>
<!--通过电话号码查询账号信息-->
<select id="selectByMobile" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from account_info
where mobile_phone = #{mobile} and delete_flag=1 limit 1
</select>
<!--通过电话号码查询账号信息-->
<select id="selectAcctIdByMobile" resultType="java.lang.Integer" parameterType="java.lang.String">
select id
from account_info
where mobile_phone = #{mobile} and delete_flag=1
</select>
<!--插入注册人信息-->
<update id="updateCreateInfo" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
</update>
<!--逻辑删除用户-->
<update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer">
update account_info set delete_flag=2,modified_time=now(), modified_id=#{acctId} where id=#{acctId}
</update>
<!--更新用户的手机号-->
<update id="updateMobileByPrimaryKey"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set modified_id=#{id}, modified_time=#{modifiedTime},mobile_phone=#{mobilePhone} where id=#{id} and delete_flag=1
</update>
<!--修改用户的密码-->
<update id="updatePasswordByPrimaryKey"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set modified_id=#{id}, modified_time=now(),password=#{password} where id=#{id} and delete_flag=1
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from account_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
insert into account_info (id, mobile_phone, password,
register_product, register_source, name,
age, birthday, sex, id_card,
reg_time, delete_flag, created_id,
created_time, modified_id, modified_time
)
values (#{id,jdbcType=INTEGER}, #{mobilePhone,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{registerProduct,jdbcType=INTEGER}, #{registerSource,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{age,jdbcType=TINYINT}, #{birthday,jdbcType=DATE}, #{sex,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR},
#{regTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER},
#{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity"
useGeneratedKeys="true" keyProperty="id">
insert into account_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="mobilePhone != null">
mobile_phone,
</if>
<if test="password != null">
password,
</if>
<if test="registerProduct != null">
register_product,
</if>
<if test="registerSource != null">
register_source,
</if>
<if test="name != null">
name,
</if>
<if test="age != null">
age,
</if>
<if test="birthday != null">
birthday,
</if>
<if test="sex != null">
sex,
</if>
<if test="idCard != null">
id_card,
</if>
<if test="regTime != null">
reg_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="createdId != null">
created_id,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="modifiedId != null">
modified_id,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null">
#{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null">
#{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="age != null">
#{age,jdbcType=TINYINT},
</if>
<if test="birthday != null">
#{birthday,jdbcType=DATE},
</if>
<if test="sex != null">
#{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null">
#{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null">
#{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info
<set>
<if test="mobilePhone != null">
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null">
register_product = #{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null">
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age,jdbcType=TINYINT},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null">
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null">
reg_time = #{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info
set mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
register_product = #{registerProduct,jdbcType=INTEGER},
register_source = #{registerSource,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
age = #{age,jdbcType=TINYINT},
birthday = #{birthday,jdbcType=DATE},
sex = #{sex,jdbcType=TINYINT},
id_card = #{idCard,jdbcType=VARCHAR},
reg_time = #{regTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountInfoMapper">
<select id="getTotalCount" resultType="int">
select count(1) from p_doctor where delete_flag = 1
</select>
<select id="getCount" resultType="int">
select count(1)
from p_doctor d join p_hospital h on d.hospital_id = h.id
where d.delete_flag = 1 and h.delete_flag = 1
<if test="provinceId != null">
and h.province_id = #{provinceId}
</if>
<if test="cityId != null">
and h.city_id = #{cityId}
</if>
<if test="countyId != null">
and h.county_id = #{countyId}
</if>
<if test="titleIds != null and titleIds.size > 0">
and d.title_id in
<foreach item="item" collection="titleIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="levelGrades != null and levelGrades.size > 0">
and h.level_grade in
<foreach item="item" collection="levelGrades" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</select>
<select id="getDoctorIds" resultType="int">
select d.id
from p_doctor d join p_hospital h on d.hospital_id = h.id
where d.delete_flag = 1 and h.delete_flag = 1
<if test="provinceId != null">
and h.province_id = #{provinceId}
</if>
<if test="cityId != null">
and h.city_id = #{cityId}
</if>
<if test="countyId != null">
and h.county_id = #{countyId}
</if>
<if test="titleIds != null and titleIds.size > 0">
and d.title_id in
<foreach item="item" collection="titleIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="levelGrades != null and levelGrades.size > 0">
and h.level_grade in
<foreach item="item" collection="levelGrades" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.Account">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sex" jdbcType="INTEGER" property="sex" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
<result column="acct_id" jdbcType="INTEGER" property="acctId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="avatar_image_url" jdbcType="VARCHAR" property="avatarImageUrl" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="qrcode" jdbcType="VARCHAR" property="qrcode" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="personal_sign" jdbcType="VARCHAR" property="personalSign" />
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
<result column="creat_id" jdbcType="INTEGER" property="creatId" />
<result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
<result column="modify_id" jdbcType="INTEGER" property="modifyId" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="info" jdbcType="VARCHAR" property="info" />
<result column="entire_flag" jdbcType="INTEGER" property="entireFlag" />
<result column="reg_time" jdbcType="DATE" property="regTime" />
<result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
<result column="unionid" jdbcType="VARCHAR" property="unionid" />
<result column="register_source" jdbcType="INTEGER" property="registerSource" />
<result column="comment" jdbcType="VARCHAR" property="comment" />
<result column="register_type" jdbcType="INTEGER" property="registerType" />
<result column="first_login_time" jdbcType="TIMESTAMP" property="firstLoginTime" />
<result column="card" jdbcType="VARCHAR" property="card" />
<result column="birthday" jdbcType="DATE" property="birthday" />
</resultMap>
<sql id="Base_Column_List">
id, sex, name, mobile_phone, status, avatar_image_url, email, qrcode, nickname, personal_sign, delete_flag,
creat_id, creat_time, modify_id, modify_time, password, info, entire_flag, reg_time, last_login_time,
unionid, register_source, comment, register_type, first_login_time, card, birthday
</sql>
<select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from p_doctor
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Account" useGeneratedKeys="true" keyProperty="id">
insert into p_doctor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sex != null">
sex,
</if>
<if test="name != null">
name,
</if>
<if test="mobilePhone != null">
mobile_phone,
</if>
<if test="avatarImageUrl != null">
avatar_image_url,
</if>
<if test="acctId != null">
acct_id,
</if>
<if test="email != null">
email,
</if>
<if test="qrcode != null">
qrcode,
</if>
<if test="nickname != null">
nickname,
</if>
<if test="personalSign != null">
personal_sign,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="creatId != null">
creat_id,
</if>
<if test="creatTime != null">
creat_time,
</if>
<if test="modifyId != null">
modify_id,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="password != null">
password,
</if>
<if test="info != null">
info,
</if>
<if test="entireFlag != null">
entire_flag,
</if>
<if test="regTime != null">
reg_time,
</if>
<if test="lastLoginTime != null">
last_login_time,
</if>
<if test="unionid != null">
unionid,
</if>
<if test="registerSource != null">
register_source,
</if>
<if test="comment != null">
comment,
</if>
<if test="registerType != null">
register_type,
</if>
<if test="firstLoginTime != null">
first_login_time,
</if>
<if test="card != null">
card,
</if>
<if test="birthday != null">
birthday,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sex != null">
#{sex,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="avatarImageUrl != null">
#{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if test="acctId != null">
#{acctId,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="qrcode != null">
#{qrcode,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
</if>
<if test="personalSign != null">
#{personalSign,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null">
#{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null">
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="info != null">
#{info,jdbcType=VARCHAR},
</if>
<if test="entireFlag != null">
#{entireFlag,jdbcType=INTEGER},
</if>
<if test="regTime != null">
#{regTime,jdbcType=DATE},
</if>
<if test="lastLoginTime != null">
#{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="unionid != null">
#{unionid,jdbcType=VARCHAR},
</if>
<if test="registerSource != null">
#{registerSource,jdbcType=INTEGER},
</if>
<if test="comment != null">
#{comment,jdbcType=VARCHAR},
</if>
<if test="registerType != null">
#{registerType,jdbcType=INTEGER},
</if>
<if test="firstLoginTime != null">
#{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="card != null">
#{card,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
#{birthday,jdbcType=DATE},
</if>
</trim>
</insert>
<update id="updateByIdSelective" parameterType="com.pica.cloud.account.account.server.entity.Account">
update p_doctor
<set>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="avatarImageUrl != null">
avatar_image_url = #{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="qrcode != null">
qrcode = #{qrcode,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="personalSign != null">
personal_sign = #{personalSign,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null">
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null">
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="info != null">
info = #{info,jdbcType=VARCHAR},
</if>
<if test="entireFlag != null">
entire_flag = #{entireFlag,jdbcType=INTEGER},
</if>
<if test="regTime != null">
reg_time = #{regTime,jdbcType=DATE},
</if>
<if test="lastLoginTime != null">
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="unionid != null">
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if test="registerSource != null">
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="comment != null">
comment = #{comment,jdbcType=VARCHAR},
</if>
<if test="registerType != null">
register_type = #{registerType,jdbcType=INTEGER},
</if>
<if test="firstLoginTime != null">
first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="card != null">
card = #{card,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=DATE},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getByMobilePhone" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from p_doctor
where mobile_phone = #{mobilePhone} and delete_flag = 1 limit 1
</select>
<select id="getByUnionid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from p_doctor
where unionid = #{unionid} and delete_flag = 1
limit 1
</select>
<select id="getHospitalInfoByPage" resultType="map">
select id, hospital_id, hospital
from p_doctor
where delete_flag = 1
<if test="id != null">
and id = #{id}
</if>
limit #{offset}, #{size}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountUnionMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountUnionEntity">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="acct_id" property="acctId" jdbcType="BIGINT"/>
<result column="union_type" property="unionType" jdbcType="INTEGER"/>
<result column="union_id" property="unionId" jdbcType="VARCHAR"/>
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER"/>
<result column="created_id" property="createdId" jdbcType="INTEGER"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modifiedId" jdbcType="INTEGER"/>
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, acct_id, union_type, union_id, delete_flag, created_id, created_time, modified_id,
modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from account_union
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过unionId查询用户信息-->
<select id="selectByUnionId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from account_union
where union_id = #{unionId}
</select>
<!--解除绑定关系-->
<update id="updateUnbindByAcctId" parameterType="java.lang.Integer">
update account_union
set delete_flag = 2
where acct_id = #{acctId,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from account_union
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountUnionEntity">
insert into account_union (id, acct_id, union_type,
union_id, delete_flag, created_id,
created_time, modified_id, modified_time
)
values (#{id,jdbcType=INTEGER}, #{acctId,jdbcType=BIGINT}, #{unionType,jdbcType=INTEGER},
#{unionId,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER},
#{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountUnionEntity">
insert into account_union
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="acctId != null">
acct_id,
</if>
<if test="unionType != null">
union_type,
</if>
<if test="unionId != null">
union_id,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="createdId != null">
created_id,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="modifiedId != null">
modified_id,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="acctId != null">
#{acctId,jdbcType=BIGINT},
</if>
<if test="unionType != null">
#{unionType,jdbcType=INTEGER},
</if>
<if test="unionId != null">
#{unionId,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.pica.cloud.account.account.server.entity.AccountUnionEntity">
update account_union
<set>
<if test="acctId != null">
acct_id = #{acctId,jdbcType=BIGINT},
</if>
<if test="unionType != null">
union_type = #{unionType,jdbcType=INTEGER},
</if>
<if test="unionId != null">
union_id = #{unionId,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountUnionEntity">
update account_union
set acct_id = #{acctId,jdbcType=BIGINT},
union_type = #{unionType,jdbcType=INTEGER},
union_id = #{unionId,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="acct_id" property="acctId" jdbcType="INTEGER"/>
<result column="village_name" property="villageName" jdbcType="VARCHAR"/>
<result column="village_id" property="villageId" jdbcType="BIGINT"/>
<result column="town_name" property="townName" jdbcType="VARCHAR"/>
<result column="town_id" property="townId" jdbcType="BIGINT"/>
<result column="county_name" property="countyName" jdbcType="VARCHAR"/>
<result column="county_id" property="countyId" jdbcType="BIGINT"/>
<result column="city_name" property="cityName" jdbcType="VARCHAR"/>
<result column="city_id" property="cityId" jdbcType="BIGINT"/>
<result column="province_name" property="provinceName" jdbcType="VARCHAR"/>
<result column="province_id" property="provinceId" jdbcType="BIGINT"/>
<result column="country" property="country" jdbcType="BIGINT"/>
<result column="head_img_url" property="headImgUrl" jdbcType="VARCHAR"/>
<result column="address" property="address" jdbcType="VARCHAR"/>
<result column="patient_address" property="patientAddress" jdbcType="VARCHAR"/>
<result column="telephone" property="telephone" jdbcType="VARCHAR"/>
<result column="social_card" property="socialCard" jdbcType="VARCHAR"/>
<result column="work_unit" property="workUnit" jdbcType="VARCHAR"/>
<result column="health_file_number" property="healthFileNumber" jdbcType="VARCHAR"/>
<result column="payment_type" property="paymentType" jdbcType="VARCHAR"/>
<result column="remarks" property="remarks" jdbcType="VARCHAR"/>
<result column="email" property="email" jdbcType="VARCHAR"/>
<result column="nation" property="nation" jdbcType="VARCHAR"/>
<result column="create_id" property="createId" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="modify_id" property="modifyId" jdbcType="INTEGER"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="delete_flag" property="deleteFlag" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id, acct_id, village_name, village_id, town_name, town_id, county_name, county_id,
city_name, city_id, province_name, province_id, country, head_img_url, address, patient_address,
telephone, social_card, work_unit, health_file_number, payment_type, remarks, email,
nation, create_id, create_time, modify_id, modify_time, delete_flag
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from p_patient
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过用户id查询信息-->
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from p_patient
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过账户id查询信息-->
<select id="selectByAcctId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from p_patient
where acct_id = #{AcctId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from p_patient
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity">
insert into p_patient (id, acct_id, village_name,
village_id, town_name, town_id,
county_name, county_id, city_name,
city_id, province_name, province_id,
country, head_img_url, address,
patient_address, telephone, social_card,
work_unit, health_file_number, payment_type,
remarks, email, nation,
create_id, create_time, modify_id,
modify_time, delete_flag)
values (#{id,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}, #{villageName,jdbcType=VARCHAR},
#{villageId,jdbcType=BIGINT}, #{townName,jdbcType=VARCHAR}, #{townId,jdbcType=BIGINT},
#{countyName,jdbcType=VARCHAR}, #{countyId,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR},
#{cityId,jdbcType=BIGINT}, #{provinceName,jdbcType=VARCHAR}, #{provinceId,jdbcType=BIGINT},
#{country,jdbcType=BIGINT}, #{headImgUrl,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{patientAddress,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{socialCard,jdbcType=VARCHAR},
#{workUnit,jdbcType=VARCHAR}, #{healthFileNumber,jdbcType=VARCHAR}, #{paymentType,jdbcType=VARCHAR},
#{remarks,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{nation,jdbcType=VARCHAR},
#{createId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity"
useGeneratedKeys="true" keyProperty="id">
insert into p_patient
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="acctId != null">
acct_id,
</if>
<if test="villageName != null">
village_name,
</if>
<if test="villageId != null">
village_id,
</if>
<if test="townName != null">
town_name,
</if>
<if test="townId != null">
town_id,
</if>
<if test="countyName != null">
county_name,
</if>
<if test="countyId != null">
county_id,
</if>
<if test="cityName != null">
city_name,
</if>
<if test="cityId != null">
city_id,
</if>
<if test="provinceName != null">
province_name,
</if>
<if test="provinceId != null">
province_id,
</if>
<if test="country != null">
country,
</if>
<if test="headImgUrl != null">
head_img_url,
</if>
<if test="address != null">
address,
</if>
<if test="patientAddress != null">
patient_address,
</if>
<if test="telephone != null">
telephone,
</if>
<if test="socialCard != null">
social_card,
</if>
<if test="workUnit != null">
work_unit,
</if>
<if test="healthFileNumber != null">
health_file_number,
</if>
<if test="paymentType != null">
payment_type,
</if>
<if test="remarks != null">
remarks,
</if>
<if test="email != null">
email,
</if>
<if test="nation != null">
nation,
</if>
<if test="createId != null">
create_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="modifyId != null">
modify_id,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="acctId != null">
#{acctId,jdbcType=INTEGER},
</if>
<if test="villageName != null">
#{villageName,jdbcType=VARCHAR},
</if>
<if test="villageId != null">
#{villageId,jdbcType=BIGINT},
</if>
<if test="townName != null">
#{townName,jdbcType=VARCHAR},
</if>
<if test="townId != null">
#{townId,jdbcType=BIGINT},
</if>
<if test="countyName != null">
#{countyName,jdbcType=VARCHAR},
</if>
<if test="countyId != null">
#{countyId,jdbcType=BIGINT},
</if>
<if test="cityName != null">
#{cityName,jdbcType=VARCHAR},
</if>
<if test="cityId != null">
#{cityId,jdbcType=BIGINT},
</if>
<if test="provinceName != null">
#{provinceName,jdbcType=VARCHAR},
</if>
<if test="provinceId != null">
#{provinceId,jdbcType=BIGINT},
</if>
<if test="country != null">
#{country,jdbcType=BIGINT},
</if>
<if test="headImgUrl != null">
#{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="patientAddress != null">
#{patientAddress,jdbcType=VARCHAR},
</if>
<if test="telephone != null">
#{telephone,jdbcType=VARCHAR},
</if>
<if test="socialCard != null">
#{socialCard,jdbcType=VARCHAR},
</if>
<if test="workUnit != null">
#{workUnit,jdbcType=VARCHAR},
</if>
<if test="healthFileNumber != null">
#{healthFileNumber,jdbcType=VARCHAR},
</if>
<if test="paymentType != null">
#{paymentType,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
#{remarks,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="nation != null">
#{nation,jdbcType=VARCHAR},
</if>
<if test="createId != null">
#{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity">
update p_patient
<set>
<if test="acctId != null">
acct_id = #{acctId,jdbcType=INTEGER},
</if>
<if test="villageName != null">
village_name = #{villageName,jdbcType=VARCHAR},
</if>
<if test="villageId != null">
village_id = #{villageId,jdbcType=BIGINT},
</if>
<if test="townName != null">
town_name = #{townName,jdbcType=VARCHAR},
</if>
<if test="townId != null">
town_id = #{townId,jdbcType=BIGINT},
</if>
<if test="countyName != null">
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if test="countyId != null">
county_id = #{countyId,jdbcType=BIGINT},
</if>
<if test="cityName != null">
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if test="cityId != null">
city_id = #{cityId,jdbcType=BIGINT},
</if>
<if test="provinceName != null">
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if test="provinceId != null">
province_id = #{provinceId,jdbcType=BIGINT},
</if>
<if test="country != null">
country = #{country,jdbcType=BIGINT},
</if>
<if test="headImgUrl != null">
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="patientAddress != null">
patient_address = #{patientAddress,jdbcType=VARCHAR},
</if>
<if test="telephone != null">
telephone = #{telephone,jdbcType=VARCHAR},
</if>
<if test="socialCard != null">
social_card = #{socialCard,jdbcType=VARCHAR},
</if>
<if test="workUnit != null">
work_unit = #{workUnit,jdbcType=VARCHAR},
</if>
<if test="healthFileNumber != null">
health_file_number = #{healthFileNumber,jdbcType=VARCHAR},
</if>
<if test="paymentType != null">
payment_type = #{paymentType,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="nation != null">
nation = #{nation,jdbcType=VARCHAR},
</if>
<if test="createId != null">
create_id = #{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity">
update p_patient
set acct_id = #{acctId,jdbcType=INTEGER},
village_name = #{villageName,jdbcType=VARCHAR},
village_id = #{villageId,jdbcType=BIGINT},
town_name = #{townName,jdbcType=VARCHAR},
town_id = #{townId,jdbcType=BIGINT},
county_name = #{countyName,jdbcType=VARCHAR},
county_id = #{countyId,jdbcType=BIGINT},
city_name = #{cityName,jdbcType=VARCHAR},
city_id = #{cityId,jdbcType=BIGINT},
province_name = #{provinceName,jdbcType=VARCHAR},
province_id = #{provinceId,jdbcType=BIGINT},
country = #{country,jdbcType=BIGINT},
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
patient_address = #{patientAddress,jdbcType=VARCHAR},
telephone = #{telephone,jdbcType=VARCHAR},
social_card = #{socialCard,jdbcType=VARCHAR},
work_unit = #{workUnit,jdbcType=VARCHAR},
health_file_number = #{healthFileNumber,jdbcType=VARCHAR},
payment_type = #{paymentType,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
nation = #{nation,jdbcType=VARCHAR},
create_id = #{createId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountWeChatInfoMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="unionid" property="unionid" jdbcType="VARCHAR" />
<result column="openid" property="openid" jdbcType="VARCHAR" />
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
<result column="head_img_url" property="headImgUrl" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="TINYINT" />
<result column="country" property="country" jdbcType="VARCHAR" />
<result column="province" property="province" jdbcType="VARCHAR" />
<result column="city" property="city" jdbcType="VARCHAR" />
<result column="language" property="language" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="privilege" property="privilege" jdbcType="VARCHAR" />
<result column="subscribe" property="subscribe" jdbcType="INTEGER" />
<result column="subscribe_time" property="subscribeTime" jdbcType="TIMESTAMP" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="groupid" property="groupid" jdbcType="VARCHAR" />
<result column="tagid_list" property="tagidList" jdbcType="VARCHAR" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="created_id" property="createdId" jdbcType="INTEGER" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" />
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, unionid, openid, nickname, head_img_url, sex, country, province, city, language,
type, privilege, subscribe, subscribe_time, remark, groupid, tagid_list, delete_flag,
created_id, created_time, modified_id, modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from account_wechat_info
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过UnionId获取微信信息-->
<select id="selectByUnionId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from account_wechat_info
where unionid = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from account_wechat_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity" >
insert into account_wechat_info (id, unionid, openid,
nickname, head_img_url, sex,
country, province, city,
language, type, privilege,
subscribe, subscribe_time, remark,
groupid, tagid_list, delete_flag,
created_id, created_time, modified_id,
modified_time)
values (#{id,jdbcType=INTEGER}, #{unionid,jdbcType=VARCHAR}, #{openid,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{headImgUrl,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT},
#{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR},
#{language,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{privilege,jdbcType=VARCHAR},
#{subscribe,jdbcType=INTEGER}, #{subscribeTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR},
#{groupid,jdbcType=VARCHAR}, #{tagidList,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER},
#{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity" >
insert into account_wechat_info
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="unionid != null" >
unionid,
</if>
<if test="openid != null" >
openid,
</if>
<if test="nickname != null" >
nickname,
</if>
<if test="headImgUrl != null" >
head_img_url,
</if>
<if test="sex != null" >
sex,
</if>
<if test="country != null" >
country,
</if>
<if test="province != null" >
province,
</if>
<if test="city != null" >
city,
</if>
<if test="language != null" >
language,
</if>
<if test="type != null" >
type,
</if>
<if test="privilege != null" >
privilege,
</if>
<if test="subscribe != null" >
subscribe,
</if>
<if test="subscribeTime != null" >
subscribe_time,
</if>
<if test="remark != null" >
remark,
</if>
<if test="groupid != null" >
groupid,
</if>
<if test="tagidList != null" >
tagid_list,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createdId != null" >
created_id,
</if>
<if test="createdTime != null" >
created_time,
</if>
<if test="modifiedId != null" >
modified_id,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="unionid != null" >
#{unionid,jdbcType=VARCHAR},
</if>
<if test="openid != null" >
#{openid,jdbcType=VARCHAR},
</if>
<if test="nickname != null" >
#{nickname,jdbcType=VARCHAR},
</if>
<if test="headImgUrl != null" >
#{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="sex != null" >
#{sex,jdbcType=TINYINT},
</if>
<if test="country != null" >
#{country,jdbcType=VARCHAR},
</if>
<if test="province != null" >
#{province,jdbcType=VARCHAR},
</if>
<if test="city != null" >
#{city,jdbcType=VARCHAR},
</if>
<if test="language != null" >
#{language,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=INTEGER},
</if>
<if test="privilege != null" >
#{privilege,jdbcType=VARCHAR},
</if>
<if test="subscribe != null" >
#{subscribe,jdbcType=INTEGER},
</if>
<if test="subscribeTime != null" >
#{subscribeTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null" >
#{remark,jdbcType=VARCHAR},
</if>
<if test="groupid != null" >
#{groupid,jdbcType=VARCHAR},
</if>
<if test="tagidList != null" >
#{tagidList,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity" >
update account_wechat_info
<set >
<if test="unionid != null" >
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if test="openid != null" >
openid = #{openid,jdbcType=VARCHAR},
</if>
<if test="nickname != null" >
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="headImgUrl != null" >
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="sex != null" >
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="country != null" >
country = #{country,jdbcType=VARCHAR},
</if>
<if test="province != null" >
province = #{province,jdbcType=VARCHAR},
</if>
<if test="city != null" >
city = #{city,jdbcType=VARCHAR},
</if>
<if test="language != null" >
language = #{language,jdbcType=VARCHAR},
</if>
<if test="type != null" >
type = #{type,jdbcType=INTEGER},
</if>
<if test="privilege != null" >
privilege = #{privilege,jdbcType=VARCHAR},
</if>
<if test="subscribe != null" >
subscribe = #{subscribe,jdbcType=INTEGER},
</if>
<if test="subscribeTime != null" >
subscribe_time = #{subscribeTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="groupid != null" >
groupid = #{groupid,jdbcType=VARCHAR},
</if>
<if test="tagidList != null" >
tagid_list = #{tagidList,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity" >
update account_wechat_info
set unionid = #{unionid,jdbcType=VARCHAR},
openid = #{openid,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
sex = #{sex,jdbcType=TINYINT},
country = #{country,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
language = #{language,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
privilege = #{privilege,jdbcType=VARCHAR},
subscribe = #{subscribe,jdbcType=INTEGER},
subscribe_time = #{subscribeTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR},
groupid = #{groupid,jdbcType=VARCHAR},
tagid_list = #{tagidList,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AgreementEntityMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AgreementEntity">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="agreement_type" property="agreement_type" jdbcType="INTEGER"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="delete_flag" property="delete_flag" jdbcType="INTEGER"/>
<result column="created_id" property="created_id" jdbcType="BIGINT"/>
<result column="created_time" property="created_time" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modified_id" jdbcType="BIGINT"/>
<result column="modified_time" property="modified_time" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.pica.cloud.account.account.server.entity.AgreementEntity"
extends="BaseResultMap">
<result column="agreement_content" property="agreement_content" jdbcType="LONGVARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, agreement_type, version, delete_flag, created_id, created_time, modified_id,
modified_time
</sql>
<sql id="Blob_Column_List">
agreement_content
</sql>
<!--通过类型获取用户同意的协议的版本-->
<select id="selectByType" parameterType="Integer" resultType="Integer">
select version from doctor_agreement
where agreement_type = #{agreementType}
</select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from doctor_agreement
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from doctor_agreement
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AgreementEntity">
insert into doctor_agreement (id, agreement_type, version,
delete_flag, created_id, created_time,
modified_id, modified_time, agreement_content
)
values (#{id,jdbcType=BIGINT}, #{agreement_type,jdbcType=INTEGER}, #{version,jdbcType=VARCHAR},
#{delete_flag,jdbcType=INTEGER}, #{created_id,jdbcType=BIGINT}, #{created_time,jdbcType=TIMESTAMP},
#{modified_id,jdbcType=BIGINT}, #{modified_time,jdbcType=TIMESTAMP}, #{agreement_content,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AgreementEntity">
insert into doctor_agreement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="agreement_type != null">
agreement_type,
</if>
<if test="version != null">
version,
</if>
<if test="delete_flag != null">
delete_flag,
</if>
<if test="created_id != null">
created_id,
</if>
<if test="created_time != null">
created_time,
</if>
<if test="modified_id != null">
modified_id,
</if>
<if test="modified_time != null">
modified_time,
</if>
<if test="agreement_content != null">
agreement_content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="agreement_type != null">
#{agreement_type,jdbcType=INTEGER},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="delete_flag != null">
#{delete_flag,jdbcType=INTEGER},
</if>
<if test="created_id != null">
#{created_id,jdbcType=BIGINT},
</if>
<if test="created_time != null">
#{created_time,jdbcType=TIMESTAMP},
</if>
<if test="modified_id != null">
#{modified_id,jdbcType=BIGINT},
</if>
<if test="modified_time != null">
#{modified_time,jdbcType=TIMESTAMP},
</if>
<if test="agreement_content != null">
#{agreement_content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.pica.cloud.account.account.server.entity.AgreementEntity">
update doctor_agreement
<set>
<if test="agreement_type != null">
agreement_type = #{agreement_type,jdbcType=INTEGER},
</if>
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
<if test="delete_flag != null">
delete_flag = #{delete_flag,jdbcType=INTEGER},
</if>
<if test="created_id != null">
created_id = #{created_id,jdbcType=BIGINT},
</if>
<if test="created_time != null">
created_time = #{created_time,jdbcType=TIMESTAMP},
</if>
<if test="modified_id != null">
modified_id = #{modified_id,jdbcType=BIGINT},
</if>
<if test="modified_time != null">
modified_time = #{modified_time,jdbcType=TIMESTAMP},
</if>
<if test="agreement_content != null">
agreement_content = #{agreement_content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs"
parameterType="com.pica.cloud.account.account.server.entity.AgreementEntity">
update doctor_agreement
set agreement_type = #{agreement_type,jdbcType=INTEGER},
version = #{version,jdbcType=VARCHAR},
delete_flag = #{delete_flag,jdbcType=INTEGER},
created_id = #{created_id,jdbcType=BIGINT},
created_time = #{created_time,jdbcType=TIMESTAMP},
modified_id = #{modified_id,jdbcType=BIGINT},
modified_time = #{modified_time,jdbcType=TIMESTAMP},
agreement_content = #{agreement_content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AgreementEntity">
update doctor_agreement
set agreement_type = #{agreement_type,jdbcType=INTEGER},
version = #{version,jdbcType=VARCHAR},
delete_flag = #{delete_flag,jdbcType=INTEGER},
created_id = #{created_id,jdbcType=BIGINT},
created_time = #{created_time,jdbcType=TIMESTAMP},
modified_id = #{modified_id,jdbcType=BIGINT},
modified_time = #{modified_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AgreementLogEntityMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AgreementLogEntity" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="doctor_id" property="doctor_id" jdbcType="BIGINT" />
<result column="agreement_type" property="agreement_type" jdbcType="INTEGER" />
<result column="version" property="version" jdbcType="VARCHAR" />
<result column="delete_flag" property="delete_flag" jdbcType="INTEGER" />
<result column="created_id" property="created_id" jdbcType="BIGINT" />
<result column="created_time" property="created_time" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modified_id" jdbcType="BIGINT" />
<result column="modified_time" property="modified_time" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, doctor_id, agreement_type, version, delete_flag, created_id, created_time, modified_id,
modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from doctor_agreement_log
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from doctor_agreement_log
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AgreementLogEntity" >
insert into doctor_agreement_log (id, doctor_id, agreement_type,
version, delete_flag, created_id,
created_time, modified_id, modified_time)
values (#{id,jdbcType=BIGINT}, #{doctor_id,jdbcType=BIGINT}, #{agreement_type,jdbcType=INTEGER},
#{version,jdbcType=VARCHAR}, #{delete_flag,jdbcType=INTEGER}, #{created_id,jdbcType=BIGINT},
#{created_time,jdbcType=TIMESTAMP}, #{modified_id,jdbcType=BIGINT}, #{modified_time,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AgreementLogEntity" >
insert into doctor_agreement_log
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="doctor_id != null" >
doctor_id,
</if>
<if test="agreement_type != null" >
agreement_type,
</if>
<if test="version != null" >
version,
</if>
<if test="delete_flag != null" >
delete_flag,
</if>
<if test="created_id != null" >
created_id,
</if>
<if test="created_time != null" >
created_time,
</if>
<if test="modified_id != null" >
modified_id,
</if>
<if test="modified_time != null" >
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="doctor_id != null" >
#{doctor_id,jdbcType=BIGINT},
</if>
<if test="agreement_type != null" >
#{agreement_type,jdbcType=INTEGER},
</if>
<if test="version != null" >
#{version,jdbcType=VARCHAR},
</if>
<if test="delete_flag != null" >
#{delete_flag,jdbcType=INTEGER},
</if>
<if test="created_id != null" >
#{created_id,jdbcType=BIGINT},
</if>
<if test="created_time != null" >
#{created_time,jdbcType=TIMESTAMP},
</if>
<if test="modified_id != null" >
#{modified_id,jdbcType=BIGINT},
</if>
<if test="modified_time != null" >
#{modified_time,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.AgreementLogEntity" >
update doctor_agreement_log
<set >
<if test="doctor_id != null" >
doctor_id = #{doctor_id,jdbcType=BIGINT},
</if>
<if test="agreement_type != null" >
agreement_type = #{agreement_type,jdbcType=INTEGER},
</if>
<if test="version != null" >
version = #{version,jdbcType=VARCHAR},
</if>
<if test="delete_flag != null" >
delete_flag = #{delete_flag,jdbcType=INTEGER},
</if>
<if test="created_id != null" >
created_id = #{created_id,jdbcType=BIGINT},
</if>
<if test="created_time != null" >
created_time = #{created_time,jdbcType=TIMESTAMP},
</if>
<if test="modified_id != null" >
modified_id = #{modified_id,jdbcType=BIGINT},
</if>
<if test="modified_time != null" >
modified_time = #{modified_time,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AgreementLogEntity" >
update doctor_agreement_log
set doctor_id = #{doctor_id,jdbcType=BIGINT},
agreement_type = #{agreement_type,jdbcType=INTEGER},
version = #{version,jdbcType=VARCHAR},
delete_flag = #{delete_flag,jdbcType=INTEGER},
created_id = #{created_id,jdbcType=BIGINT},
created_time = #{created_time,jdbcType=TIMESTAMP},
modified_id = #{modified_id,jdbcType=BIGINT},
modified_time = #{modified_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.DoctorMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.Doctor">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="sex" property="sex" jdbcType="INTEGER"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR"/>
<result column="tel" property="tel" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="hospital_id" property="hospitalId" jdbcType="INTEGER"/>
<result column="department_id" property="departmentId" jdbcType="INTEGER"/>
<result column="title_id" property="titleId" jdbcType="INTEGER"/>
<result column="hospital" property="hospital" jdbcType="VARCHAR"/>
<result column="department" property="department" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="cert_image_url" property="certImageUrl" jdbcType="VARCHAR"/>
<result column="avatar_image_url" property="avatarImageUrl" jdbcType="VARCHAR"/>
<result column="auth_time" property="authTime" jdbcType="TIMESTAMP"/>
<result column="honor" property="honor" jdbcType="VARCHAR"/>
<result column="skills" property="skills" jdbcType="VARCHAR"/>
<result column="thumb_up_num" property="thumbUpNum" jdbcType="INTEGER"/>
<result column="email" property="email" jdbcType="VARCHAR"/>
<result column="qrcode" property="qrcode" jdbcType="VARCHAR"/>
<result column="nickname" property="nickname" jdbcType="VARCHAR"/>
<result column="personal_sign" property="personalSign" jdbcType="VARCHAR"/>
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER"/>
<result column="creat_id" property="creatId" jdbcType="INTEGER"/>
<result column="creat_time" property="creatTime" jdbcType="TIMESTAMP"/>
<result column="modify_id" property="modifyId" jdbcType="INTEGER"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="praise_num" property="praiseNum" jdbcType="INTEGER"/>
<result column="password" property="password" jdbcType="VARCHAR"/>
<result column="info" property="info" jdbcType="VARCHAR"/>
<result column="rank" property="rank" jdbcType="VARCHAR"/>
<result column="province" property="province" jdbcType="BIGINT"/>
<result column="province_name" property="provinceName" jdbcType="VARCHAR"/>
<result column="city" property="city" jdbcType="BIGINT"/>
<result column="city_name" property="cityName" jdbcType="VARCHAR"/>
<result column="county" property="county" jdbcType="BIGINT"/>
<result column="county_name" property="countyName" jdbcType="VARCHAR"/>
<result column="town" property="town" jdbcType="BIGINT"/>
<result column="town_name" property="townName" jdbcType="VARCHAR"/>
<result column="invite_code" property="inviteCode" jdbcType="VARCHAR"/>
<result column="invite_start_time" property="inviteStartTime" jdbcType="TIMESTAMP"/>
<result column="gaoxueya_password" property="gaoxueyaPassword" jdbcType="VARCHAR"/>
<result column="sms_send_num" property="smsSendNum" jdbcType="INTEGER"/>
<result column="total_sms_send_num" property="totalSmsSendNum" jdbcType="INTEGER"/>
<result column="entire_flag" property="entireFlag" jdbcType="INTEGER"/>
<result column="doctor_project_type" property="doctorProjectType" jdbcType="INTEGER"/>
<result column="reg_time" property="regTime" jdbcType="DATE"/>
<result column="last_login_time" property="lastLoginTime" jdbcType="TIMESTAMP"/>
<result column="unionid" property="unionid" jdbcType="VARCHAR"/>
<result column="register_source" property="registerSource" jdbcType="INTEGER"/>
<result column="comment" property="comment" jdbcType="VARCHAR"/>
<result column="administer_title_id" property="administerTitleId" jdbcType="INTEGER"/>
<result column="administer_title" property="administerTitle" jdbcType="VARCHAR"/>
<result column="register_type" property="registerType" jdbcType="INTEGER"/>
<result column="first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
<result column="card" property="card" jdbcType="VARCHAR"/>
<result column="birthday" property="birthday" jdbcType="DATE"/>
<result column="show_flag" property="showFlag" jdbcType="INTEGER"/>
<result column="acct_id" property="acctId" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, sex, name, mobile_phone, tel, status, type, hospital_id, department_id, title_id,
hospital, department, title, cert_image_url, avatar_image_url, auth_time, honor,
skills, thumb_up_num, email, qrcode, nickname, personal_sign, delete_flag, creat_id,
creat_time, modify_id, modify_time, praise_num, password, info, rank, province, province_name,
city, city_name, county, county_name, town, town_name, invite_code, invite_start_time,
gaoxueya_password, sms_send_num, total_sms_send_num, entire_flag, doctor_project_type,
reg_time, last_login_time, unionid, register_source, comment, administer_title_id,
administer_title, register_type, first_login_time, card, birthday, show_flag, acct_id
</sql>
<!--通过账户id查询用户信息-->
<select id="selectUserIdByAcctId" parameterType="java.lang.Integer" resultType="java.lang.Long">
SELECT id
FROM p_doctor
where acct_id = #{acctId}
and delete_flag = 1
</select>
<!--刷新重复的记录-->
<update id="processDoctorRepeatData">
update p_doctor set delete_flag=2, modify_id=101432928, modify_time=now() where id in (
select id from (select pd.id from account_info pd
inner JOIN (SELECT mobile_phone,MIN(id) as id FROM account_info WHERE delete_flag=1 and mobile_phone is not null GROUP BY mobile_phone having count(*)>1) inn
on pd.id <![CDATA[!= ]]> inn.id and pd.mobile_phone = inn.mobile_phone) ttt )
</update>
<!--通过手机号查询用户id-->
<select id="selectDoctorIdByMobile" parameterType="java.lang.String" resultType="java.lang.Long">
SELECT id
FROM p_doctor
where mobile_phone = #{mobile}
and delete_flag = 1
</select>
<!--通过手机号码查询医生信息-->
<select id="getDoctorInfoByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM p_doctor
where mobile_phone = #{phone}
and delete_flag = 1
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from p_doctor
where id = #{id,jdbcType=INTEGER} and delete_flag=1
</select>
<!--删除用户-->
<update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer">
update p_doctor set delete_flag=2,modify_time=now(), modify_id=#{id} where id=#{id} limit 1
</update>
<!--根据手机号获取数据-->
<!--<select id="getDoctorInfoByMobile" resultType="com.pica.cloud.account.account.server.entity.DoctorEntity"-->
<!--parameterType="java.lang.String">-->
<!--SELECT aa.id, aa.sex, aa.unionid, aa.name, aa.mobile_phone, aa.status, aa.type, aa.hospital_id, aa.department_id,-->
<!--aa.title_id, ifnull(bb.name,aa.hospital) as hospital,-->
<!--ifnull(pde.name,aa.department) as department, ifnull(pt.name,aa.title) as title, aa.cert_image_url,-->
<!--aa.avatar_image_url, aa.auth_time, aa.invite_start_time, aa.honor, aa.skills, aa.thumb_up_num, aa.email,-->
<!--aa.qrcode, aa.nickname, aa.personal_sign, aa.delete_flag, aa.creat_id, aa.creat_time, aa.modify_id,-->
<!--aa.modify_time, aa.praise_num, aa.password, aa.info, aa.rank, aa.province, aa.city, aa.county,-->
<!--aa.province_name, aa.city_name, aa.county_name,-->
<!--aa.invite_code, aa.gaoxueya_password, aa.sms_send_num, aa.total_sms_send_num, aa.entire_flag, aa.doctor_project_type,-->
<!--aa.administer_title_id, aa.administer_title,-->
<!--pded.school_name, pded.major_id, pded.major_name, pded.education_id, pded.education_name, pded.year-->
<!--FROM-->
<!--p_doctor aa-->
<!--left join-->
<!--p_hospital bb-->
<!--on aa.hospital_id = bb.id and bb.delete_flag=1-->
<!--left join-->
<!--p_title pt-->
<!--on aa.title_id = pt.title_id-->
<!--left join-->
<!--p_department pde-->
<!--on aa.department_id = pde.id-->
<!--left join-->
<!--p_doctor_education pded-->
<!--on pded.doctor_id = aa.id-->
<!--where aa.mobile_phone = #{mobile}-->
<!--and aa.delete_flag = 1-->
<!--limit 0,1-->
<!--</select>-->
<update id="updateByMobile" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor set password=#{password},modify_time=now(), modify_id=#{modifyId} where mobile_phone=#{mobilePhone} and delete_flag=1 limit 1
</update>
<!--通过账户id更新用户信息-->
<update id="updateByAcctId" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor
<set>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="tel != null">
tel = #{tel,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="hospitalId != null">
hospital_id = #{hospitalId,jdbcType=INTEGER},
</if>
<if test="departmentId != null">
department_id = #{departmentId,jdbcType=INTEGER},
</if>
<if test="titleId != null">
title_id = #{titleId,jdbcType=INTEGER},
</if>
<if test="hospital != null">
hospital = #{hospital,jdbcType=VARCHAR},
</if>
<if test="department != null">
department = #{department,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="certImageUrl != null">
cert_image_url = #{certImageUrl,jdbcType=VARCHAR},
</if>
<if test="avatarImageUrl != null">
avatar_image_url = #{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if test="authTime != null">
auth_time = #{authTime,jdbcType=TIMESTAMP},
</if>
<if test="honor != null">
honor = #{honor,jdbcType=VARCHAR},
</if>
<if test="skills != null">
skills = #{skills,jdbcType=VARCHAR},
</if>
<if test="thumbUpNum != null">
thumb_up_num = #{thumbUpNum,jdbcType=INTEGER},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="qrcode != null">
qrcode = #{qrcode,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="personalSign != null">
personal_sign = #{personalSign,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null">
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null">
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="praiseNum != null">
praise_num = #{praiseNum,jdbcType=INTEGER},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="info != null">
info = #{info,jdbcType=VARCHAR},
</if>
<if test="rank != null">
rank = #{rank,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=BIGINT},
</if>
<if test="provinceName != null">
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=BIGINT},
</if>
<if test="cityName != null">
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if test="county != null">
county = #{county,jdbcType=BIGINT},
</if>
<if test="countyName != null">
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if test="town != null">
town = #{town,jdbcType=BIGINT},
</if>
<if test="townName != null">
town_name = #{townName,jdbcType=VARCHAR},
</if>
<if test="inviteCode != null">
invite_code = #{inviteCode,jdbcType=VARCHAR},
</if>
<if test="inviteStartTime != null">
invite_start_time = #{inviteStartTime,jdbcType=TIMESTAMP},
</if>
<if test="gaoxueyaPassword != null">
gaoxueya_password = #{gaoxueyaPassword,jdbcType=VARCHAR},
</if>
<if test="smsSendNum != null">
sms_send_num = #{smsSendNum,jdbcType=INTEGER},
</if>
<if test="totalSmsSendNum != null">
total_sms_send_num = #{totalSmsSendNum,jdbcType=INTEGER},
</if>
<if test="entireFlag != null">
entire_flag = #{entireFlag,jdbcType=INTEGER},
</if>
<if test="doctorProjectType != null">
doctor_project_type = #{doctorProjectType,jdbcType=INTEGER},
</if>
<if test="regTime != null">
reg_time = #{regTime,jdbcType=DATE},
</if>
<if test="lastLoginTime != null">
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="unionid != null">
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if test="registerSource != null">
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="comment != null">
comment = #{comment,jdbcType=VARCHAR},
</if>
<if test="administerTitleId != null">
administer_title_id = #{administerTitleId,jdbcType=INTEGER},
</if>
<if test="administerTitle != null">
administer_title = #{administerTitle,jdbcType=VARCHAR},
</if>
<if test="registerType != null">
register_type = #{registerType,jdbcType=INTEGER},
</if>
<if test="firstLoginTime != null">
first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="card != null">
card = #{card,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="showFlag != null">
show_flag = #{showFlag,jdbcType=INTEGER},
</if>
<if test="acctId != null">
acct_id = #{acctId,jdbcType=INTEGER},
</if>
</set>
where acct_id = #{acctId,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from p_doctor
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
insert into p_doctor (id, sex, name,
mobile_phone, tel, status,
type, hospital_id, department_id,
title_id, hospital, department,
title, cert_image_url, avatar_image_url,
auth_time, honor, skills,
thumb_up_num, email, qrcode,
nickname, personal_sign, delete_flag,
creat_id, creat_time, modify_id,
modify_time, praise_num, password,
info, rank, province,
province_name, city, city_name,
county, county_name, town,
town_name, invite_code, invite_start_time,
gaoxueya_password, sms_send_num, total_sms_send_num,
entire_flag, doctor_project_type, reg_time,
last_login_time, unionid, register_source,
comment, administer_title_id, administer_title,
register_type, first_login_time, card,
birthday, show_flag, acct_id
)
values (#{id,jdbcType=INTEGER}, #{sex,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{mobilePhone,jdbcType=VARCHAR}, #{tel,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{hospitalId,jdbcType=INTEGER}, #{departmentId,jdbcType=INTEGER},
#{titleId,jdbcType=INTEGER}, #{hospital,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR},
#{title,jdbcType=VARCHAR}, #{certImageUrl,jdbcType=VARCHAR}, #{avatarImageUrl,jdbcType=VARCHAR},
#{authTime,jdbcType=TIMESTAMP}, #{honor,jdbcType=VARCHAR}, #{skills,jdbcType=VARCHAR},
#{thumbUpNum,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR}, #{qrcode,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{personalSign,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{creatId,jdbcType=INTEGER}, #{creatTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{praiseNum,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR},
#{info,jdbcType=VARCHAR}, #{rank,jdbcType=VARCHAR}, #{province,jdbcType=BIGINT},
#{provinceName,jdbcType=VARCHAR}, #{city,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR},
#{county,jdbcType=BIGINT}, #{countyName,jdbcType=VARCHAR}, #{town,jdbcType=BIGINT},
#{townName,jdbcType=VARCHAR}, #{inviteCode,jdbcType=VARCHAR}, #{inviteStartTime,jdbcType=TIMESTAMP},
#{gaoxueyaPassword,jdbcType=VARCHAR}, #{smsSendNum,jdbcType=INTEGER}, #{totalSmsSendNum,jdbcType=INTEGER},
#{entireFlag,jdbcType=BIT}, #{doctorProjectType,jdbcType=INTEGER}, #{regTime,jdbcType=DATE},
#{lastLoginTime,jdbcType=TIMESTAMP}, #{unionid,jdbcType=VARCHAR}, #{registerSource,jdbcType=INTEGER},
#{comment,jdbcType=VARCHAR}, #{administerTitleId,jdbcType=INTEGER}, #{administerTitle,jdbcType=VARCHAR},
#{registerType,jdbcType=INTEGER}, #{firstLoginTime,jdbcType=TIMESTAMP}, #{card,jdbcType=VARCHAR},
#{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor"
useGeneratedKeys="true" keyProperty="id">
insert into p_doctor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sex != null">
sex,
</if>
<if test="name != null">
name,
</if>
<if test="mobilePhone != null">
mobile_phone,
</if>
<if test="tel != null">
tel,
</if>
<if test="status != null">
status,
</if>
<if test="type != null">
type,
</if>
<if test="hospitalId != null">
hospital_id,
</if>
<if test="departmentId != null">
department_id,
</if>
<if test="titleId != null">
title_id,
</if>
<if test="hospital != null">
hospital,
</if>
<if test="department != null">
department,
</if>
<if test="title != null">
title,
</if>
<if test="certImageUrl != null">
cert_image_url,
</if>
<if test="avatarImageUrl != null">
avatar_image_url,
</if>
<if test="authTime != null">
auth_time,
</if>
<if test="honor != null">
honor,
</if>
<if test="skills != null">
skills,
</if>
<if test="thumbUpNum != null">
thumb_up_num,
</if>
<if test="email != null">
email,
</if>
<if test="qrcode != null">
qrcode,
</if>
<if test="nickname != null">
nickname,
</if>
<if test="personalSign != null">
personal_sign,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="creatId != null">
creat_id,
</if>
<if test="creatTime != null">
creat_time,
</if>
<if test="modifyId != null">
modify_id,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="praiseNum != null">
praise_num,
</if>
<if test="password != null">
password,
</if>
<if test="info != null">
info,
</if>
<if test="rank != null">
rank,
</if>
<if test="province != null">
province,
</if>
<if test="provinceName != null">
province_name,
</if>
<if test="city != null">
city,
</if>
<if test="cityName != null">
city_name,
</if>
<if test="county != null">
county,
</if>
<if test="countyName != null">
county_name,
</if>
<if test="town != null">
town,
</if>
<if test="townName != null">
town_name,
</if>
<if test="inviteCode != null">
invite_code,
</if>
<if test="inviteStartTime != null">
invite_start_time,
</if>
<if test="gaoxueyaPassword != null">
gaoxueya_password,
</if>
<if test="smsSendNum != null">
sms_send_num,
</if>
<if test="totalSmsSendNum != null">
total_sms_send_num,
</if>
<if test="entireFlag != null">
entire_flag,
</if>
<if test="doctorProjectType != null">
doctor_project_type,
</if>
<if test="regTime != null">
reg_time,
</if>
<if test="lastLoginTime != null">
last_login_time,
</if>
<if test="unionid != null">
unionid,
</if>
<if test="registerSource != null">
register_source,
</if>
<if test="comment != null">
comment,
</if>
<if test="administerTitleId != null">
administer_title_id,
</if>
<if test="administerTitle != null">
administer_title,
</if>
<if test="registerType != null">
register_type,
</if>
<if test="firstLoginTime != null">
first_login_time,
</if>
<if test="card != null">
card,
</if>
<if test="birthday != null">
birthday,
</if>
<if test="showFlag != null">
show_flag,
</if>
<if test="acctId != null">
acct_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="sex != null">
#{sex,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="tel != null">
#{tel,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="hospitalId != null">
#{hospitalId,jdbcType=INTEGER},
</if>
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
<if test="titleId != null">
#{titleId,jdbcType=INTEGER},
</if>
<if test="hospital != null">
#{hospital,jdbcType=VARCHAR},
</if>
<if test="department != null">
#{department,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="certImageUrl != null">
#{certImageUrl,jdbcType=VARCHAR},
</if>
<if test="avatarImageUrl != null">
#{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if test="authTime != null">
#{authTime,jdbcType=TIMESTAMP},
</if>
<if test="honor != null">
#{honor,jdbcType=VARCHAR},
</if>
<if test="skills != null">
#{skills,jdbcType=VARCHAR},
</if>
<if test="thumbUpNum != null">
#{thumbUpNum,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="qrcode != null">
#{qrcode,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
</if>
<if test="personalSign != null">
#{personalSign,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null">
#{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null">
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="praiseNum != null">
#{praiseNum,jdbcType=INTEGER},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="info != null">
#{info,jdbcType=VARCHAR},
</if>
<if test="rank != null">
#{rank,jdbcType=VARCHAR},
</if>
<if test="province != null">
#{province,jdbcType=BIGINT},
</if>
<if test="provinceName != null">
#{provinceName,jdbcType=VARCHAR},
</if>
<if test="city != null">
#{city,jdbcType=BIGINT},
</if>
<if test="cityName != null">
#{cityName,jdbcType=VARCHAR},
</if>
<if test="county != null">
#{county,jdbcType=BIGINT},
</if>
<if test="countyName != null">
#{countyName,jdbcType=VARCHAR},
</if>
<if test="town != null">
#{town,jdbcType=BIGINT},
</if>
<if test="townName != null">
#{townName,jdbcType=VARCHAR},
</if>
<if test="inviteCode != null">
#{inviteCode,jdbcType=VARCHAR},
</if>
<if test="inviteStartTime != null">
#{inviteStartTime,jdbcType=TIMESTAMP},
</if>
<if test="gaoxueyaPassword != null">
#{gaoxueyaPassword,jdbcType=VARCHAR},
</if>
<if test="smsSendNum != null">
#{smsSendNum,jdbcType=INTEGER},
</if>
<if test="totalSmsSendNum != null">
#{totalSmsSendNum,jdbcType=INTEGER},
</if>
<if test="entireFlag != null">
#{entireFlag,jdbcType=BIT},
</if>
<if test="doctorProjectType != null">
#{doctorProjectType,jdbcType=INTEGER},
</if>
<if test="regTime != null">
#{regTime,jdbcType=DATE},
</if>
<if test="lastLoginTime != null">
#{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="unionid != null">
#{unionid,jdbcType=VARCHAR},
</if>
<if test="registerSource != null">
#{registerSource,jdbcType=INTEGER},
</if>
<if test="comment != null">
#{comment,jdbcType=VARCHAR},
</if>
<if test="administerTitleId != null">
#{administerTitleId,jdbcType=INTEGER},
</if>
<if test="administerTitle != null">
#{administerTitle,jdbcType=VARCHAR},
</if>
<if test="registerType != null">
#{registerType,jdbcType=INTEGER},
</if>
<if test="firstLoginTime != null">
#{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="card != null">
#{card,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
#{birthday,jdbcType=DATE},
</if>
<if test="showFlag != null">
#{showFlag,jdbcType=INTEGER},
</if>
<if test="acctId != null">
#{acctId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor
<set>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="tel != null">
tel = #{tel,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="hospitalId != null">
hospital_id = #{hospitalId,jdbcType=INTEGER},
</if>
<if test="departmentId != null">
department_id = #{departmentId,jdbcType=INTEGER},
</if>
<if test="titleId != null">
title_id = #{titleId,jdbcType=INTEGER},
</if>
<if test="hospital != null">
hospital = #{hospital,jdbcType=VARCHAR},
</if>
<if test="department != null">
department = #{department,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="certImageUrl != null">
cert_image_url = #{certImageUrl,jdbcType=VARCHAR},
</if>
<if test="avatarImageUrl != null">
avatar_image_url = #{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if test="authTime != null">
auth_time = #{authTime,jdbcType=TIMESTAMP},
</if>
<if test="honor != null">
honor = #{honor,jdbcType=VARCHAR},
</if>
<if test="skills != null">
skills = #{skills,jdbcType=VARCHAR},
</if>
<if test="thumbUpNum != null">
thumb_up_num = #{thumbUpNum,jdbcType=INTEGER},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="qrcode != null">
qrcode = #{qrcode,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="personalSign != null">
personal_sign = #{personalSign,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null">
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null">
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null">
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="praiseNum != null">
praise_num = #{praiseNum,jdbcType=INTEGER},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="info != null">
info = #{info,jdbcType=VARCHAR},
</if>
<if test="rank != null">
rank = #{rank,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=BIGINT},
</if>
<if test="provinceName != null">
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=BIGINT},
</if>
<if test="cityName != null">
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if test="county != null">
county = #{county,jdbcType=BIGINT},
</if>
<if test="countyName != null">
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if test="town != null">
town = #{town,jdbcType=BIGINT},
</if>
<if test="townName != null">
town_name = #{townName,jdbcType=VARCHAR},
</if>
<if test="inviteCode != null">
invite_code = #{inviteCode,jdbcType=VARCHAR},
</if>
<if test="inviteStartTime != null">
invite_start_time = #{inviteStartTime,jdbcType=TIMESTAMP},
</if>
<if test="gaoxueyaPassword != null">
gaoxueya_password = #{gaoxueyaPassword,jdbcType=VARCHAR},
</if>
<if test="smsSendNum != null">
sms_send_num = #{smsSendNum,jdbcType=INTEGER},
</if>
<if test="totalSmsSendNum != null">
total_sms_send_num = #{totalSmsSendNum,jdbcType=INTEGER},
</if>
<if test="entireFlag != null">
entire_flag = #{entireFlag,jdbcType=INTEGER},
</if>
<if test="doctorProjectType != null">
doctor_project_type = #{doctorProjectType,jdbcType=INTEGER},
</if>
<if test="regTime != null">
reg_time = #{regTime,jdbcType=DATE},
</if>
<if test="lastLoginTime != null">
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="unionid != null">
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if test="registerSource != null">
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="comment != null">
comment = #{comment,jdbcType=VARCHAR},
</if>
<if test="administerTitleId != null">
administer_title_id = #{administerTitleId,jdbcType=INTEGER},
</if>
<if test="administerTitle != null">
administer_title = #{administerTitle,jdbcType=VARCHAR},
</if>
<if test="registerType != null">
register_type = #{registerType,jdbcType=INTEGER},
</if>
<if test="firstLoginTime != null">
first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="card != null">
card = #{card,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="showFlag != null">
show_flag = #{showFlag,jdbcType=INTEGER},
</if>
<if test="acctId != null">
acct_id = #{acctId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor
set sex = #{sex,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
tel = #{tel,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
type = #{type,jdbcType=INTEGER},
hospital_id = #{hospitalId,jdbcType=INTEGER},
department_id = #{departmentId,jdbcType=INTEGER},
title_id = #{titleId,jdbcType=INTEGER},
hospital = #{hospital,jdbcType=VARCHAR},
department = #{department,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
cert_image_url = #{certImageUrl,jdbcType=VARCHAR},
avatar_image_url = #{avatarImageUrl,jdbcType=VARCHAR},
auth_time = #{authTime,jdbcType=TIMESTAMP},
honor = #{honor,jdbcType=VARCHAR},
skills = #{skills,jdbcType=VARCHAR},
thumb_up_num = #{thumbUpNum,jdbcType=INTEGER},
email = #{email,jdbcType=VARCHAR},
qrcode = #{qrcode,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
personal_sign = #{personalSign,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
creat_id = #{creatId,jdbcType=INTEGER},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
praise_num = #{praiseNum,jdbcType=INTEGER},
password = #{password,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
rank = #{rank,jdbcType=VARCHAR},
province = #{province,jdbcType=BIGINT},
province_name = #{provinceName,jdbcType=VARCHAR},
city = #{city,jdbcType=BIGINT},
city_name = #{cityName,jdbcType=VARCHAR},
county = #{county,jdbcType=BIGINT},
county_name = #{countyName,jdbcType=VARCHAR},
town = #{town,jdbcType=BIGINT},
town_name = #{townName,jdbcType=VARCHAR},
invite_code = #{inviteCode,jdbcType=VARCHAR},
invite_start_time = #{inviteStartTime,jdbcType=TIMESTAMP},
gaoxueya_password = #{gaoxueyaPassword,jdbcType=VARCHAR},
sms_send_num = #{smsSendNum,jdbcType=INTEGER},
total_sms_send_num = #{totalSmsSendNum,jdbcType=INTEGER},
entire_flag = #{entireFlag,jdbcType=INTEGER},
doctor_project_type = #{doctorProjectType,jdbcType=INTEGER},
reg_time = #{regTime,jdbcType=DATE},
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
unionid = #{unionid,jdbcType=VARCHAR},
register_source = #{registerSource,jdbcType=INTEGER},
comment = #{comment,jdbcType=VARCHAR},
administer_title_id = #{administerTitleId,jdbcType=INTEGER},
administer_title = #{administerTitle,jdbcType=VARCHAR},
register_type = #{registerType,jdbcType=INTEGER},
first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},
card = #{card,jdbcType=VARCHAR},
birthday = #{birthday,jdbcType=DATE},
show_flag = #{showFlag,jdbcType=INTEGER},
acct_id = #{acctId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="bindWeChat">
update p_doctor
set unionid = #{unionId}
where acct_id = #{acctId}
</update>
<update id="unbindWeChat">
update p_doctor
set unionid = ''
where acct_id = #{acctId}
</update>
<select id="queryDoctor" resultType="com.pica.cloud.account.account.server.entity.PICAPDoctor"
parameterType="java.lang.Long">
SELECT aa.id, aa.sex, aa.name, aa.mobile_phone, aa.status,
aa.type, aa.hospital_id, aa.department_id, aa.title_id,aa.card,
aa.hospital as hospital, aa.department, aa.title, aa.cert_image_url,
aa.avatar_image_url, aa.auth_time, aa.honor, aa.skills, aa.thumb_up_num, aa.email,
aa.qrcode, aa.nickname, aa.personal_sign, aa.delete_flag, aa.creat_id, aa.creat_time,
aa.modify_id, aa.modify_time, aa.praise_num, aa.password, aa.info, aa.rank, aa.province,
aa.city, aa.county, aa.invite_code, aa.gaoxueya_password, aa.sms_send_num, aa.total_sms_send_num,
aa.entire_flag, aa.doctor_project_type,aa.invite_start_time
FROM p_doctor aa
where aa.id = #{doctorId} and aa.delete_flag = 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.LogLoginMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.LogLoginEntity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="acct_id" property="acctId" jdbcType="INTEGER" />
<result column="acct_name" property="acctName" jdbcType="VARCHAR" />
<result column="product_type" property="productType" jdbcType="TINYINT" />
<result column="source_type" property="sourceType" jdbcType="TINYINT" />
<result column="login_type" property="loginType" jdbcType="TINYINT" />
<result column="login_ip" property="loginIp" jdbcType="VARCHAR" />
<result column="login_time" property="loginTime" jdbcType="TIMESTAMP" />
<result column="login_status" property="loginStatus" jdbcType="TINYINT" />
<result column="create_id" property="createId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="modify_id" property="modifyId" jdbcType="INTEGER" />
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
<result column="delete_flag" property="deleteFlag" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, acct_id, acct_name, product_type, source_type, login_type, login_ip, login_time,
login_status, create_id, create_time, modify_id, modify_time, delete_flag
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log_login
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log_login
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.LogLoginEntity" >
insert into log_login ( acct_id, acct_name,
product_type, source_type, login_type,
login_ip, login_time, login_status,
create_id, create_time, modify_id,
modify_time, delete_flag)
values (#{acctId,jdbcType=INTEGER}, #{acctName,jdbcType=VARCHAR},
#{productType,jdbcType=TINYINT}, #{sourceType,jdbcType=TINYINT}, #{loginType,jdbcType=TINYINT},
#{loginIp,jdbcType=VARCHAR}, #{loginTime,jdbcType=TIMESTAMP}, #{loginStatus,jdbcType=TINYINT},
#{createId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.LogLoginEntity" >
insert into log_login
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="acctId != null" >
acct_id,
</if>
<if test="acctName != null" >
acct_name,
</if>
<if test="productType != null" >
product_type,
</if>
<if test="sourceType != null" >
source_type,
</if>
<if test="loginType != null" >
login_type,
</if>
<if test="loginIp != null" >
login_ip,
</if>
<if test="loginTime != null" >
login_time,
</if>
<if test="loginStatus != null" >
login_status,
</if>
<if test="createId != null" >
create_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="modifyId != null" >
modify_id,
</if>
<if test="modifyTime != null" >
modify_time,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="acctId != null" >
#{acctId,jdbcType=INTEGER},
</if>
<if test="acctName != null" >
#{acctName,jdbcType=VARCHAR},
</if>
<if test="productType != null" >
#{productType,jdbcType=TINYINT},
</if>
<if test="sourceType != null" >
#{sourceType,jdbcType=TINYINT},
</if>
<if test="loginType != null" >
#{loginType,jdbcType=TINYINT},
</if>
<if test="loginIp != null" >
#{loginIp,jdbcType=VARCHAR},
</if>
<if test="loginTime != null" >
#{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="loginStatus != null" >
#{loginStatus,jdbcType=TINYINT},
</if>
<if test="createId != null" >
#{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.LogLoginEntity" >
update log_login
<set >
<if test="acctId != null" >
acct_id = #{acctId,jdbcType=INTEGER},
</if>
<if test="acctName != null" >
acct_name = #{acctName,jdbcType=VARCHAR},
</if>
<if test="productType != null" >
product_type = #{productType,jdbcType=TINYINT},
</if>
<if test="sourceType != null" >
source_type = #{sourceType,jdbcType=TINYINT},
</if>
<if test="loginType != null" >
login_type = #{loginType,jdbcType=TINYINT},
</if>
<if test="loginIp != null" >
login_ip = #{loginIp,jdbcType=VARCHAR},
</if>
<if test="loginTime != null" >
login_time = #{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="loginStatus != null" >
login_status = #{loginStatus,jdbcType=TINYINT},
</if>
<if test="createId != null" >
create_id = #{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.LogLoginEntity" >
update log_login
set acct_id = #{acctId,jdbcType=INTEGER},
acct_name = #{acctName,jdbcType=VARCHAR},
product_type = #{productType,jdbcType=TINYINT},
source_type = #{sourceType,jdbcType=TINYINT},
login_type = #{loginType,jdbcType=TINYINT},
login_ip = #{loginIp,jdbcType=VARCHAR},
login_time = #{loginTime,jdbcType=TIMESTAMP},
login_status = #{loginStatus,jdbcType=TINYINT},
create_id = #{createId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.LogPWDModifyMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.LogPWDModifyEntity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR" />
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" />
<result column="old_pwd" property="oldPwd" jdbcType="VARCHAR" />
<result column="new_pwd" property="newPwd" jdbcType="VARCHAR" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="created_id" property="createdId" jdbcType="INTEGER" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, mobile_phone, modified_time, modified_id, old_pwd, new_pwd, delete_flag, created_id,
created_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log_pwd_modify
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log_pwd_modify
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.LogPWDModifyEntity" >
insert into log_pwd_modify (mobile_phone, modified_time,
modified_id, old_pwd, new_pwd,
delete_flag, created_id, created_time
)
values (#{mobilePhone,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{oldPwd,jdbcType=VARCHAR}, #{newPwd,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.LogPWDModifyEntity" >
insert into log_pwd_modify
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="mobilePhone != null" >
mobile_phone,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
<if test="modifiedId != null" >
modified_id,
</if>
<if test="oldPwd != null" >
old_pwd,
</if>
<if test="newPwd != null" >
new_pwd,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createdId != null" >
created_id,
</if>
<if test="createdTime != null" >
created_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="mobilePhone != null" >
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="oldPwd != null" >
#{oldPwd,jdbcType=VARCHAR},
</if>
<if test="newPwd != null" >
#{newPwd,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.LogPWDModifyEntity" >
update log_pwd_modify
<set >
<if test="mobilePhone != null" >
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="oldPwd != null" >
old_pwd = #{oldPwd,jdbcType=VARCHAR},
</if>
<if test="newPwd != null" >
new_pwd = #{newPwd,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.LogPWDModifyEntity" >
update log_pwd_modify
set mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
old_pwd = #{oldPwd,jdbcType=VARCHAR},
new_pwd = #{newPwd,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.LogUserInfoMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.LogUserInfoEntity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="acct_id" property="acctId" jdbcType="INTEGER" />
<result column="village_name" property="villageName" jdbcType="VARCHAR" />
<result column="village_id" property="villageId" jdbcType="BIGINT" />
<result column="town_name" property="townName" jdbcType="VARCHAR" />
<result column="town_id" property="townId" jdbcType="BIGINT" />
<result column="county_name" property="countyName" jdbcType="VARCHAR" />
<result column="county_id" property="countyId" jdbcType="BIGINT" />
<result column="city_name" property="cityName" jdbcType="VARCHAR" />
<result column="city_id" property="cityId" jdbcType="BIGINT" />
<result column="province_name" property="provinceName" jdbcType="VARCHAR" />
<result column="province_id" property="provinceId" jdbcType="BIGINT" />
<result column="country" property="country" jdbcType="BIGINT" />
<result column="head_img_url" property="headImgUrl" jdbcType="VARCHAR" />
<result column="address" property="address" jdbcType="VARCHAR" />
<result column="patient_address" property="patientAddress" jdbcType="VARCHAR" />
<result column="telephone" property="telephone" jdbcType="VARCHAR" />
<result column="social_card" property="socialCard" jdbcType="VARCHAR" />
<result column="work_unit" property="workUnit" jdbcType="VARCHAR" />
<result column="health_file_number" property="healthFileNumber" jdbcType="VARCHAR" />
<result column="payment_type" property="paymentType" jdbcType="VARCHAR" />
<result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="email" property="email" jdbcType="VARCHAR" />
<result column="nation" property="nation" jdbcType="VARCHAR" />
<result column="create_id" property="createId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="modify_id" property="modifyId" jdbcType="INTEGER" />
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
<result column="delete_flag" property="deleteFlag" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, acct_id, village_name, village_id, town_name, town_id, county_name, county_id,
city_name, city_id, province_name, province_id, country, head_img_url, address, patient_address,
telephone, social_card, work_unit, health_file_number, payment_type, remarks, email,
nation, create_id, create_time, modify_id, modify_time, delete_flag
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log_user_info_modify
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log_user_info_modify
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.LogUserInfoEntity" >
insert into log_user_info_modify (id, acct_id, village_name,
village_id, town_name, town_id,
county_name, county_id, city_name,
city_id, province_name, province_id,
country, head_img_url, address,
patient_address, telephone, social_card,
work_unit, health_file_number, payment_type,
remarks, email, nation,
create_id, create_time, modify_id,
modify_time, delete_flag)
values (#{id,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}, #{villageName,jdbcType=VARCHAR},
#{villageId,jdbcType=BIGINT}, #{townName,jdbcType=VARCHAR}, #{townId,jdbcType=BIGINT},
#{countyName,jdbcType=VARCHAR}, #{countyId,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR},
#{cityId,jdbcType=BIGINT}, #{provinceName,jdbcType=VARCHAR}, #{provinceId,jdbcType=BIGINT},
#{country,jdbcType=BIGINT}, #{headImgUrl,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{patientAddress,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{socialCard,jdbcType=VARCHAR},
#{workUnit,jdbcType=VARCHAR}, #{healthFileNumber,jdbcType=VARCHAR}, #{paymentType,jdbcType=VARCHAR},
#{remarks,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{nation,jdbcType=VARCHAR},
#{createId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.LogUserInfoEntity" >
insert into log_user_info_modify
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="acctId != null" >
acct_id,
</if>
<if test="villageName != null" >
village_name,
</if>
<if test="villageId != null" >
village_id,
</if>
<if test="townName != null" >
town_name,
</if>
<if test="townId != null" >
town_id,
</if>
<if test="countyName != null" >
county_name,
</if>
<if test="countyId != null" >
county_id,
</if>
<if test="cityName != null" >
city_name,
</if>
<if test="cityId != null" >
city_id,
</if>
<if test="provinceName != null" >
province_name,
</if>
<if test="provinceId != null" >
province_id,
</if>
<if test="country != null" >
country,
</if>
<if test="headImgUrl != null" >
head_img_url,
</if>
<if test="address != null" >
address,
</if>
<if test="patientAddress != null" >
patient_address,
</if>
<if test="telephone != null" >
telephone,
</if>
<if test="socialCard != null" >
social_card,
</if>
<if test="workUnit != null" >
work_unit,
</if>
<if test="healthFileNumber != null" >
health_file_number,
</if>
<if test="paymentType != null" >
payment_type,
</if>
<if test="remarks != null" >
remarks,
</if>
<if test="email != null" >
email,
</if>
<if test="nation != null" >
nation,
</if>
<if test="createId != null" >
create_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="modifyId != null" >
modify_id,
</if>
<if test="modifyTime != null" >
modify_time,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="acctId != null" >
#{acctId,jdbcType=INTEGER},
</if>
<if test="villageName != null" >
#{villageName,jdbcType=VARCHAR},
</if>
<if test="villageId != null" >
#{villageId,jdbcType=BIGINT},
</if>
<if test="townName != null" >
#{townName,jdbcType=VARCHAR},
</if>
<if test="townId != null" >
#{townId,jdbcType=BIGINT},
</if>
<if test="countyName != null" >
#{countyName,jdbcType=VARCHAR},
</if>
<if test="countyId != null" >
#{countyId,jdbcType=BIGINT},
</if>
<if test="cityName != null" >
#{cityName,jdbcType=VARCHAR},
</if>
<if test="cityId != null" >
#{cityId,jdbcType=BIGINT},
</if>
<if test="provinceName != null" >
#{provinceName,jdbcType=VARCHAR},
</if>
<if test="provinceId != null" >
#{provinceId,jdbcType=BIGINT},
</if>
<if test="country != null" >
#{country,jdbcType=BIGINT},
</if>
<if test="headImgUrl != null" >
#{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="address != null" >
#{address,jdbcType=VARCHAR},
</if>
<if test="patientAddress != null" >
#{patientAddress,jdbcType=VARCHAR},
</if>
<if test="telephone != null" >
#{telephone,jdbcType=VARCHAR},
</if>
<if test="socialCard != null" >
#{socialCard,jdbcType=VARCHAR},
</if>
<if test="workUnit != null" >
#{workUnit,jdbcType=VARCHAR},
</if>
<if test="healthFileNumber != null" >
#{healthFileNumber,jdbcType=VARCHAR},
</if>
<if test="paymentType != null" >
#{paymentType,jdbcType=VARCHAR},
</if>
<if test="remarks != null" >
#{remarks,jdbcType=VARCHAR},
</if>
<if test="email != null" >
#{email,jdbcType=VARCHAR},
</if>
<if test="nation != null" >
#{nation,jdbcType=VARCHAR},
</if>
<if test="createId != null" >
#{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.LogUserInfoEntity" >
update log_user_info_modify
<set >
<if test="acctId != null" >
acct_id = #{acctId,jdbcType=INTEGER},
</if>
<if test="villageName != null" >
village_name = #{villageName,jdbcType=VARCHAR},
</if>
<if test="villageId != null" >
village_id = #{villageId,jdbcType=BIGINT},
</if>
<if test="townName != null" >
town_name = #{townName,jdbcType=VARCHAR},
</if>
<if test="townId != null" >
town_id = #{townId,jdbcType=BIGINT},
</if>
<if test="countyName != null" >
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if test="countyId != null" >
county_id = #{countyId,jdbcType=BIGINT},
</if>
<if test="cityName != null" >
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if test="cityId != null" >
city_id = #{cityId,jdbcType=BIGINT},
</if>
<if test="provinceName != null" >
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if test="provinceId != null" >
province_id = #{provinceId,jdbcType=BIGINT},
</if>
<if test="country != null" >
country = #{country,jdbcType=BIGINT},
</if>
<if test="headImgUrl != null" >
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
</if>
<if test="address != null" >
address = #{address,jdbcType=VARCHAR},
</if>
<if test="patientAddress != null" >
patient_address = #{patientAddress,jdbcType=VARCHAR},
</if>
<if test="telephone != null" >
telephone = #{telephone,jdbcType=VARCHAR},
</if>
<if test="socialCard != null" >
social_card = #{socialCard,jdbcType=VARCHAR},
</if>
<if test="workUnit != null" >
work_unit = #{workUnit,jdbcType=VARCHAR},
</if>
<if test="healthFileNumber != null" >
health_file_number = #{healthFileNumber,jdbcType=VARCHAR},
</if>
<if test="paymentType != null" >
payment_type = #{paymentType,jdbcType=VARCHAR},
</if>
<if test="remarks != null" >
remarks = #{remarks,jdbcType=VARCHAR},
</if>
<if test="email != null" >
email = #{email,jdbcType=VARCHAR},
</if>
<if test="nation != null" >
nation = #{nation,jdbcType=VARCHAR},
</if>
<if test="createId != null" >
create_id = #{createId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.LogUserInfoEntity" >
update log_user_info_modify
set acct_id = #{acctId,jdbcType=INTEGER},
village_name = #{villageName,jdbcType=VARCHAR},
village_id = #{villageId,jdbcType=BIGINT},
town_name = #{townName,jdbcType=VARCHAR},
town_id = #{townId,jdbcType=BIGINT},
county_name = #{countyName,jdbcType=VARCHAR},
county_id = #{countyId,jdbcType=BIGINT},
city_name = #{cityName,jdbcType=VARCHAR},
city_id = #{cityId,jdbcType=BIGINT},
province_name = #{provinceName,jdbcType=VARCHAR},
province_id = #{provinceId,jdbcType=BIGINT},
country = #{country,jdbcType=BIGINT},
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
patient_address = #{patientAddress,jdbcType=VARCHAR},
telephone = #{telephone,jdbcType=VARCHAR},
social_card = #{socialCard,jdbcType=VARCHAR},
work_unit = #{workUnit,jdbcType=VARCHAR},
health_file_number = #{healthFileNumber,jdbcType=VARCHAR},
payment_type = #{paymentType,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
nation = #{nation,jdbcType=VARCHAR},
create_id = #{createId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册