瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

Trick 6 年之前
父節點
當前提交
03aee9b869
共有 60 個文件被更改,包括 2015 次插入586 次删除
  1. 12 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleInfoDO.java
  2. 0 75
      common/common-entity/src/main/java/com/yihu/jw/entity/base/role/BaseRoleModuleDO.java
  3. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/role/RoleDO.java
  4. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasModuleFunctionDO.java
  5. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java
  6. 4 3
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java
  7. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  8. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  9. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java
  10. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java
  11. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java
  12. 8 6
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  13. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java
  14. 16 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleInfoVO.java
  15. 0 78
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/BaseRoleModuleVO.java
  16. 2 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasModuleFunctionVO.java
  17. 2 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/team/BaseTeamMemberVO.java
  18. 2 0
      gateway/ag-basic/src/main/resources/application.yml
  19. 2 2
      svr/svr-base/doc/es/服务包执行日志记录索引.txt
  20. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseModuleRoleDao.java
  21. 5 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgSaasDao.java
  22. 9 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgUserDao.java
  23. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java
  24. 0 21
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/role/BaseRoleModuleDao.java
  25. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java
  26. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/user/UserDao.java
  27. 88 51
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java
  28. 0 104
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/BaseRoleModuleEndpoint.java
  29. 102 65
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java
  30. 127 17
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java
  31. 234 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java
  32. 4 21
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  33. 25 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseModuleRoleService.java
  34. 15 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgSaasService.java
  35. 32 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgUserService.java
  36. 5 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java
  37. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java
  38. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTreeNode.java
  39. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/TreeNode.java
  40. 0 22
      svr/svr-base/src/main/java/com/yihu/jw/base/service/role/BaseRoleModuleService.java
  41. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  42. 108 10
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  43. 436 57
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  44. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java
  45. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java
  46. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java
  47. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java
  48. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java
  49. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java
  50. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java
  51. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java
  52. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  53. 2 2
      svr/svr-manage/src/main/resources/webapp/html/login/login.html
  54. 3 3
      svr/svr-manage/src/main/resources/webapp/html/system/role/html/menuRole.html
  55. 3 3
      svr/svr-manage/src/main/resources/webapp/html/system/role/html/userRole.html
  56. 2 2
      svr/svr-manage/src/main/resources/webapp/html/version/server/html/userVersion.html
  57. 25 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  58. 71 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/HttpClientUtil.java
  59. 574 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/ImUtill.java
  60. 18 0
      svr/svr-wlyy-specialist/src/main/resources/application.yml

+ 12 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleInfoDO.java

@ -37,6 +37,11 @@ public class BaseDoctorRoleInfoDO extends IntegerIdentityEntity {
	 */
	private String del;
	/**
	 * 角色说明
	 */
	private String description;
	@Column(name = "saasid")
    public String getSaasid() {
@ -70,6 +75,12 @@ public class BaseDoctorRoleInfoDO extends IntegerIdentityEntity {
        this.del = del;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 0 - 75
common/common-entity/src/main/java/com/yihu/jw/entity/base/role/BaseRoleModuleDO.java

@ -1,75 +0,0 @@
package com.yihu.jw.entity.base.role;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 业务模块角色实体
 * 
 * @author litaohong on  2018年10月23日
 *
 */
@Entity
@Table(name = "base_role_module")
public class BaseRoleModuleDO extends IntegerIdentityEntity {
    /**
	 * 角色标识
	 */
	private String code;
    /**
	 * 角色名称
	 */
	private String name;
    /**
	 * 业务模块id,多个用逗号分割
	 */
	private String moduleId;
    /**
	 * 状态,0失效,1有效
	 */
	private String del;
	@Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@Column(name = "module_id")
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/role/RoleDO.java

@ -14,6 +14,16 @@ import javax.persistence.Table;
@Table(name = "base_role")
public class RoleDO extends UuidIdentityEntityWithOperator {
	// 基础三大类角色,对应base_role中code的值,如果有改,务必保持同步
	public enum BaseRoleType{
		// 超级管理员
		admin,
		// 租户管理员
		saasAdmin,
		//机构管理员
		hosAdmin
	}
	/**
	 * 角色代码
	 */

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasModuleFunctionDO.java

@ -22,11 +22,11 @@
//    private String functionId;
//
//    @Column(name = "saas_id", nullable = false, length = 50)
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java

@ -52,11 +52,11 @@ public class BaseTeamDO extends UuidIdentityEntityWithOperator {
     */
    private String del;
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    @Column(name = "org_code")
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
@ -83,7 +83,7 @@ public class BaseTeamDO extends UuidIdentityEntityWithOperator {
        return leaderCode;
    }
    public void setLeaderCode(String leaderId) {
    public void setLeaderCode(String leaderCode) {
        this.leaderCode = leaderCode;
    }

+ 4 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity.base.team;
import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -15,7 +16,7 @@ import java.util.Date;
*/
@Entity
@Table(name = "base_team_member")
public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
public class BaseTeamMemberDO extends IntegerIdentityEntityWithOperator {
    /**
	* 团队ID
@ -38,7 +39,7 @@ public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
    private String del;
	@Column(name = "team_id")
	@Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
@ -54,7 +55,7 @@ public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
        this.orgCode = orgCode;
    }
	@Column(name = "doctor_id")
	@Column(name = "doctor_code")
    public String getDoctorCode() {
        return doctorCode;
    }

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -30,11 +30,11 @@
//    private String del;//1:有效;0:删除',
//
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -28,11 +28,11 @@
//    private String teamCode;//团队code',
//
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java

@ -28,11 +28,11 @@
//    private String article;//文章
//
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java

@ -35,11 +35,11 @@
//    private String content;//咨询内容
//
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java

@ -34,11 +34,11 @@
//    private String del;//1:有效;0:删除
//
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 8 - 6
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -160,6 +160,11 @@ public class BaseRequestMapping {
        public static final String CHECK_USERNAME = "/check_username";
        public static final String CHECK_MOBILE = "/check_mobile";
        public static final String findUserBaseInfo = "/findUserBaseInfo";
        public static final String resetPwd = "/resetPwd";
        public static final String queryOne = "/queryOne";
        public static final String orgTreeInfo = "/orgTreeInfo";
        public static final String userInfoList = "/userInfoList";
        public static final String lockOrUnlock = "/lockOrUnlock";
    }
    /**
@ -419,6 +424,7 @@ public class BaseRequestMapping {
     */
    public static class BaseDoctorRoleInfo extends Basic {
        public static final String PREFIX  = "/baseDoctorRoleInfo";
        public static final String enableOrDis  = "/enableOrDis";
    }
/**
     * 医生模块角色关联表
@ -493,6 +499,8 @@ public class BaseRequestMapping {
        public static final String queryMemberList  = "/queryMemberList";
        public static final String queryOne  = "/getTeamById";
        public static final String getTeamTree  = "/getTeamTree";
        public static final String teamInfoList  = "/teamInfoList";
        public static final String enableOrDis  = "/enableOrDis";
    }
@ -634,12 +642,6 @@ public class BaseRequestMapping {
    public static class MqMessageSubscriber extends Basic {
        public static final String PREFIX  = "/mq_message_subscriber";
    }
    /**
     * 业务模块角色
     */
    public static class BaseRoleModule extends Basic {
        public static final String PREFIX  = "/baseRoleModule";
    }
    /**
     * 功能菜单角色

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java

@ -87,6 +87,7 @@ public class SpecialistMapping {
        public static final String planListByPatient = "/planListByPatient";
        public static final String patientCount = "/patientCount";
        public static final String selectByIds = "/selectByIds";
        public static final String sendToFamilyDoctor = "/sendToFamilyDoctor";
    }
    public static class serviceItem{

+ 16 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleInfoVO.java

@ -24,27 +24,32 @@ public class BaseDoctorRoleInfoVO extends IntegerIdentityVO{
    /**
	 * saasid,不同租户各自医生的业务模块角色信息独立
	 */
	@ApiModelProperty(value = "saasid,不同租户各自医生的业务模块角色信息独立", example = "模块1")
	@ApiModelProperty(value = "saasid,不同租户各自医生的业务模块角色信息独立", example = "参考租户")
    private String saasid;
    /**
	 * 角色code
	 */
	@ApiModelProperty(value = "角色code", example = "模块1")
	@ApiModelProperty(value = "角色code", example = "")
    private String code;
    /**
	 * 角色名称:全科医生、专科医生、健康管理师、管理员等
	 */
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "模块1")
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "")
    private String name;
    /**
	 * 作废标识,1正常,0作废
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "")
    private String del;
    /**
     * 角色说明
     */
    @ApiModelProperty(value = "角色说明", example = "")
    private String description;
    public String getSaasid() {
        return saasid;
@ -75,4 +80,11 @@ public class BaseDoctorRoleInfoVO extends IntegerIdentityVO{
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 0 - 78
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/BaseRoleModuleVO.java

@ -1,78 +0,0 @@
package com.yihu.jw.restmodel.base.role;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 业务模块角色vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年10月23日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseRoleModuleVO", description = "业务模块角色")
public class BaseRoleModuleVO extends IntegerIdentityVO{
    /**
	 * 角色标识
	 */
	@ApiModelProperty(value = "角色标识", example = "模块1")
    private String code;
    /**
	 * 角色名称
	 */
	@ApiModelProperty(value = "角色名称", example = "模块1")
    private String name;
    /**
	 * 业务模块id,多个用逗号分割
	 */
	@ApiModelProperty(value = "业务模块id,多个用逗号分割", example = "模块1")
    private String moduleId;
    /**
	 * 状态,0失效,1有效
	 */
	@ApiModelProperty(value = "状态,0失效,1有效", example = "模块1")
    private String del;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasModuleFunctionVO.java

@ -22,11 +22,11 @@
//    @ApiModelProperty(value = "功能ID", example = "402303ee656498890sd24s9ad2wa00sd")
//    private String functionId;
//
//    public String getOrgCode() {
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setOrgCode(String saasId) {
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/team/BaseTeamMemberVO.java

@ -1,5 +1,6 @@
package com.yihu.jw.restmodel.base.team;
import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -19,7 +20,7 @@ import java.util.Date;
 * @since 1.
 */
@ApiModel(value = "BaseTeamMemberVO", description = "团队成员")
public class BaseTeamMemberVO extends UuidIdentityVOWithOperator {
public class BaseTeamMemberVO extends IntegerIdentityEntityWithOperator {
    /**
	 * 团队ID

+ 2 - 0
gateway/ag-basic/src/main/resources/application.yml

@ -49,6 +49,8 @@ zuul:
    svr-healthy-house:
      path: /healthyHouse/**
      serviceId: svr-healthy-house
---
spring:
  profiles: jwdev

+ 2 - 2
svr/svr-base/doc/es/服务包执行日志记录索引.txt

@ -15,7 +15,7 @@ POST http://172.19.103.68:9200/base_service_package_log/base_service_package_log
                "type": "string",
                "index": "not_analyzed"
            },
			"orgCode": {
			"leaderCode": {
				"type": "string",
				"index": "not_analyzed"
			},"sevicePackageId": {
@ -57,7 +57,7 @@ POST http://172.19.103.68:9200/base_service_package_log/base_service_package_log
字段说明:
"id": code
"createTime": 时间
"orgCode": saasid
"leaderCode": saasid
"sevicePackageId": 服务包id
"sevicePackageDetailId": 服务包明细id
"userCode": 医生或者患者code

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseModuleRoleDao.java

@ -2,8 +2,11 @@ package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Set;
/**
 * 
@ -18,4 +21,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface BaseModuleRoleDao extends PagingAndSortingRepository<BaseModuleRoleDO, Integer>, JpaSpecificationExecutor<BaseModuleRoleDO>  {
    @Query("select id from BaseModuleRoleDO where id = ?1")
    Set<Object> findModuleIdList(Integer id);
}

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgSaasDao.java

@ -4,9 +4,11 @@ import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
@ -25,6 +27,9 @@ public interface BaseOrgSaasDao extends PagingAndSortingRepository<BaseOrgSaasDO
    List<BaseOrgSaasDO> findBySaasid(String saasId);
    @Query("select distinct orgCode from BaseOrgSaasDO where saasid = ?1")
    Set<String> findOrgCodeListBySaasid(String saasid);
    @Modifying
    @Query("delete from BaseOrgSaasDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);

+ 9 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgUserDao.java

@ -2,9 +2,11 @@ package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
@ -22,4 +24,11 @@ import java.util.List;
public interface BaseOrgUserDao extends PagingAndSortingRepository<BaseOrgUserDO, String>, JpaSpecificationExecutor<BaseOrgUserDO>  {
    List<BaseOrgUserDO> findAllByOrgCode(String orgCode);
    @Query("select id from BaseOrgUserDO where userId = ?1")
    Set<Object> findIdListByUserId(String userId);
    @Query("select orgCode from BaseOrgUserDO where userId = ?1")
    Set<String> findorgCodeListByUserId(String userId);
}

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java

@ -10,6 +10,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
@ -29,7 +30,7 @@ public interface OrgTreeDao extends PagingAndSortingRepository<OrgTree, Integer>
    List<OrgTree> findByLevelLessThanEqual(Integer level);
    OrgTree findByCodeAndLevel(String code,Integer level);
    List<OrgTree> findAllByLevelAndCodeIn(String level,Set<String> code );
    OrgTree findByCodeAndParentCode(String code,String parentCode);

+ 0 - 21
svr/svr-base/src/main/java/com/yihu/jw/base/dao/role/BaseRoleModuleDao.java

@ -1,21 +0,0 @@
package com.yihu.jw.base.dao.role;
import com.yihu.jw.entity.base.role.BaseRoleModuleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 
 * 业务模块角色 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月23日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseRoleModuleDao extends PagingAndSortingRepository<BaseRoleModuleDO, Integer>, JpaSpecificationExecutor<BaseRoleModuleDO>  {
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java

@ -24,8 +24,8 @@ import java.util.Set;
 */
public interface BaseTeamMemberDao extends PagingAndSortingRepository<BaseTeamMemberDO, String>, JpaSpecificationExecutor<BaseTeamMemberDO>  {
    @Query("select doc.name,doc.idcard,doc.id from BaseDoctorDO doc where doc.id in (select team.doctorCode from BaseTeamMemberDO team where team.orgCode = ?1 and team.teamCode = ?2)")
    List<Map<String,Object>> getTeamMemberList();
    @Query("select doc.name as name,doc.idcard as idcard ,doc.id as doctorCode from BaseDoctorDO doc where doc.id in (select team.doctorCode from BaseTeamMemberDO team where team.teamCode = ?1)")
    List<Map<String,Object>> getTeamMemberList(String teamCode);
    @Query("select id from BaseTeamMemberDO where teamCode = ?1")
    Set<Object> findIdListByTeamCode(String teamCode);

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/user/UserDao.java

@ -23,4 +23,5 @@ public interface UserDao extends PagingAndSortingRepository<UserDO, String>, Jpa
    boolean existsByUsername(String username);
    UserDO findByUsername(String username);
}

+ 88 - 51
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java

@ -1,6 +1,8 @@
package com.yihu.jw.base.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.doctor.BaseDoctorRoleInfoService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorRoleInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -15,64 +17,64 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 业务模块角色字典(给医生用的)控制器
*
* @version
* <pre>
 * 业务模块角色字典(给医生用的)控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
* @since 1.
*/
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.PREFIX)
@Api(value = "业务模块角色字典(给医生用的)管理", description = "业务模块角色字典(给医生用的)管理服务接口", tags = {"wlyy基础服务 - 业务模块角色字典(给医生用的)管理服务接口"})
public class BaseDoctorRoleInfoEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseDoctorRoleInfoService baseDoctorRoleInfoService;
    @Autowired
    private BaseDoctorRoleInfoService baseDoctorRoleInfoService;
@PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseDoctorRoleInfoVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BaseDoctorRoleInfoDO baseDoctorRoleInfo = toEntity(jsonData, BaseDoctorRoleInfoDO.class);
    baseDoctorRoleInfo = baseDoctorRoleInfoService.save(baseDoctorRoleInfo);
    return success(baseDoctorRoleInfo, BaseDoctorRoleInfoVO.class);
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.CREATE)
    @ApiOperation(value = "创建")
    public Envelop create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData", required = true)  String jsonData )throws Exception {
        JSONObject jsonObject = baseDoctorRoleInfoService.createRoleInfo(jsonData,getUserAgent());
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseDoctorRoleInfoService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        baseDoctorRoleInfoService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorRoleInfoVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        BaseDoctorRoleInfoDO baseDoctorRoleInfo = toEntity(jsonData, BaseDoctorRoleInfoDO.class);
        if (null == baseDoctorRoleInfo.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseDoctorRoleInfo = baseDoctorRoleInfoService.save(baseDoctorRoleInfo);
        return success(baseDoctorRoleInfo, BaseDoctorRoleInfoVO.class);
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "filters", required = true)  String jsonData ) throws Exception {
        JSONObject jsonObject = baseDoctorRoleInfoService.updateRoleInfo(jsonData);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
        @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseDoctorRoleInfoVO> page (
    @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.PAGE)
    @ApiOperation(value = "获取角色信息列表分页")
    public PageEnvelop<BaseDoctorRoleInfoVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -83,22 +85,57 @@ public ObjEnvelop<BaseDoctorRoleInfoVO> create (
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts, page, size);
                int count = (int)baseDoctorRoleInfoService.getCount(filters);
                return success(baseDoctorRoleInfos, count, page, size, BaseDoctorRoleInfoVO.class);
         }
        List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts, page, size);
        int count = (int) baseDoctorRoleInfoService.getCount(filters);
        return success(baseDoctorRoleInfos, count, page, size, BaseDoctorRoleInfoVO.class);
    }
         @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseDoctorRoleInfoVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts);
                  return success(baseDoctorRoleInfos, BaseDoctorRoleInfoVO.class);
         }
    @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.LIST)
    @ApiOperation(value = "获取角色信息列表,无分页")
    public ListEnvelop<BaseDoctorRoleInfoVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts);
        return success(baseDoctorRoleInfos, BaseDoctorRoleInfoVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BaseTeam.queryOne)
    @ApiOperation(value = "查询某一个角色")
    public Envelop getTeamById(
            @ApiParam(name = "roleId", value = "根据角色标识查询某一个角色信息")
            @RequestParam(value = "roleId", required = true) Integer roleId) throws Exception {
        JSONObject team = baseDoctorRoleInfoService.getOneRoleInfo(roleId);
        if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(team.getString("msg"));
        }
        return success(team.getJSONObject("msg"));
    }
    /**
     * 生效或失效某个角色
     *
     * @param id
     * @param status
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.enableOrDis)
    @ApiOperation(value = "生效或失效某个角色")
    public Envelop enableOrDisableOrg(
            @ApiParam(name = "id", value = "角色Id")
            @RequestParam(value = "id", required = true) Integer id,
            @ApiParam(name = "status", value = "生效或失效标识")
            @RequestParam(value = "status", required = true) String status) throws Exception {
        JSONObject jsonObject = baseDoctorRoleInfoService.enableOrDisable(id, status);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
 }
}

+ 0 - 104
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/BaseRoleModuleEndpoint.java

@ -1,104 +0,0 @@
package com.yihu.jw.base.endpoint.role;
import com.yihu.jw.base.service.role.BaseRoleModuleService;
import com.yihu.jw.entity.base.role.BaseRoleModuleDO;
import com.yihu.jw.restmodel.base.role.BaseRoleModuleVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
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.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 业务模块角色控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月23日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.BaseRoleModule.PREFIX)
@Api(value = "业务模块角色管理", description = "业务模块角色管理服务接口", tags = {"wlyy基础服务 - 业务模块角色管理服务接口"})
public class BaseRoleModuleEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseRoleModuleService baseRoleModuleService;
@PostMapping(value = BaseRequestMapping.BaseRoleModule.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseRoleModuleVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BaseRoleModuleDO baseRoleModule = toEntity(jsonData, BaseRoleModuleDO.class);
    baseRoleModule = baseRoleModuleService.save(baseRoleModule);
    return success(baseRoleModule, BaseRoleModuleVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BaseRoleModule.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseRoleModuleService.delete(ids.split(","));
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseRoleModule.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseRoleModuleVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        BaseRoleModuleDO baseRoleModule = toEntity(jsonData, BaseRoleModuleDO.class);
        if (null == baseRoleModule.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseRoleModule = baseRoleModuleService.save(baseRoleModule);
        return success(baseRoleModule, BaseRoleModuleVO.class);
        }
        @GetMapping(value = BaseRequestMapping.BaseRoleModule.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseRoleModuleVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<BaseRoleModuleDO> baseRoleModules = baseRoleModuleService.search(fields, filters, sorts, page, size);
                int count = (int)baseRoleModuleService.getCount(filters);
                return success(baseRoleModules, count, page, size, BaseRoleModuleVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BaseRoleModule.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseRoleModuleVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<BaseRoleModuleDO> baseRoleModules = baseRoleModuleService.search(fields, filters, sorts);
                  return success(baseRoleModules, BaseRoleModuleVO.class);
         }
 }

+ 102 - 65
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java

@ -43,7 +43,7 @@ public class BaseTeamEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建团队")
    public Envelop create(
            @ApiParam(name = " jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
            @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        String msg = baseTeamService.createTeam(jsonData);
        if (StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS, msg)) {
            return success(msg);
@ -64,7 +64,7 @@ public class BaseTeamEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新团队")
    public Envelop update(
            @ApiParam(name = " jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
            @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        JSONObject jsonObject = baseTeamService.updateTeam(jsonData);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
@ -72,73 +72,110 @@ public class BaseTeamEndpoint extends EnvelopRestEndpoint {
        return success(jsonObject.getString("msg"));
    }
        @GetMapping(value = BaseRequestMapping.BaseTeam.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseTeamVO> page (
                @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
                @RequestParam(value = "fields", required = false) String fields,
                @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
                @RequestParam(value = "filters", required = false) String filters,
                @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
                @RequestParam(value = "sorts", required = false) String sorts,
        @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
        @RequestParam(value = "page") int page,
        @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
        @RequestParam(value = "size") int size) throws Exception {
            List<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts, page, size);
            int count = (int) baseTeamService.getCount(filters);
            return success(baseTeams, count, page, size, BaseTeamVO.class);
        }
    @GetMapping(value = BaseRequestMapping.BaseTeam.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<BaseTeamVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts, page, size);
        int count = (int) baseTeamService.getCount(filters);
        return success(baseTeams, count, page, size, BaseTeamVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<BaseTeamVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts);
        return success(baseTeams, BaseTeamVO.class);
    }
        @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
        @ApiOperation(value = "获取列表")
        public ListEnvelop<BaseTeamVO> list (
                @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
                @RequestParam(value = "fields", required = false) String fields,
                @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
                @RequestParam(value = "filters", required = false) String filters,
                @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
                @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
            List<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts);
            return success(baseTeams, BaseTeamVO.class);
    @GetMapping(value = BaseRequestMapping.BaseTeam.queryMemberList)
    @ApiOperation(value = "查看团队成员列表")
    public Envelop getTeamMemberList(
            @ApiParam(name = "teamCode", value = "团队标识")
            @RequestParam(value = "teamCode", required = true) String teamCode) throws Exception {
        JSONObject baseTeams = baseTeamService.getTeamMemberList(teamCode);
        if (baseTeams.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(baseTeams.getString("msg"));
        }
        return success(baseTeams.getJSONArray("msg"));
    }
    @GetMapping(value = BaseRequestMapping.BaseTeam.queryOne)
    @ApiOperation(value = "查询某一个团队")
    public Envelop getTeamById(
            @ApiParam(name = "teamCode", value = "根据团队标识查询某一个团队信息")
            @RequestParam(value = "teamCode", required = true) String teamId) throws Exception {
        JSONObject team = baseTeamService.getTeamById(teamId);
        if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(team.getString("msg"));
        }
        return success(team.getJSONObject("msg"));
    }
         @GetMapping(value = BaseRequestMapping.BaseTeam.queryMemberList)
         @ApiOperation(value = "查看团队成员列表")
         public Envelop getTeamMemberList (
             @ApiParam(name = "orgCode", value = "机构标识")
             @RequestParam(value = "orgCode", required = true) String orgCode,
             @ApiParam(name = "teamCode", value = "团队标识")
             @RequestParam(value = "teamCode", required = true) String teamCode) throws Exception {
             JSONObject baseTeams = baseTeamService.getTeamMemberList(orgCode, teamCode);
             if (baseTeams.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(baseTeams.getString("msg"));
             }
            return success(baseTeams.getJSONArray("msg"));
         }
    @GetMapping(value = BaseRequestMapping.BaseTeam.getTeamTree)
    @ApiOperation(value = "团队机构/科室/医生树形结构")
    public Envelop generateOneOrgDeptDoctorTree(
            @ApiParam(name = "jsonData", value = "json,包含团队机构,团队机构名称,已勾选的医生")
            @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        JSONObject team = baseTeamService.generateOneOrgDeptDoctorTree(jsonData);
        if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(team.getString("msg"));
        }
        return success(team.getJSONArray("msg"));
    }
         @GetMapping(value = BaseRequestMapping.BaseTeam.queryOne)
         @ApiOperation(value = "查询某一个团队")
         public Envelop getTeamById (
             @ApiParam(name = "teamCode", value = "根据团队标识查询某一个团队信息")
             @RequestParam(value = "teamCode", required = true) String teamId) throws Exception {
             JSONObject team = baseTeamService.getTeamById(teamId);
             if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(team.getString("msg"));
             }
             return success(team.getJSONObject("msg"));
         }
    @PostMapping(value = BaseRequestMapping.BaseTeam.teamInfoList)
    @ApiOperation(value = "获取团队信息列表")
    public PageEnvelop queryBaseOrgInfolist(
            @ApiParam(name = "teamName", value = "团队名称")
            @RequestParam(value = "teamName", required = false) String teamName,
            @ApiParam(name = "orgCode", value = "机构代码")
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = baseTeamService.getTeamInfoList(teamName, orgCode, status, page, size,getUserAgent());
        return success(result.getJSONArray("msg"), result.getInteger("count"), page, size);
    }
         @GetMapping(value = BaseRequestMapping.BaseTeam.getTeamTree)
         @ApiOperation(value = "团队机构/科室/医生树形结构")
         public Envelop generateOneOrgDeptDoctorTree (
             @ApiParam(name = "jsonData", value = "json,包含团队机构,团队机构名称,已勾选的医生")
             @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
             JSONObject team = baseTeamService.generateOneOrgDeptDoctorTree(jsonData);
             if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(team.getString("msg"));
             }
             return success(team.getJSONArray("msg"));
         }
    /**
     * 生效或失效某个团队
     *
     * @param id
     * @param status
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseTeam.enableOrDis)
    @ApiOperation(value = "生效或失效某个团队")
    public Envelop enableOrDisableOrg(
            @ApiParam(name = "id", value = "团队标识")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "生效或失效标识")
            @RequestParam(value = "status", required = true) String status) throws Exception {
        JSONObject jsonObject =  baseTeamService.enableOrDis(id, status);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
}

+ 127 - 17
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.base.endpoint.user;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.restmodel.base.user.UserVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -32,14 +33,16 @@ public class UserEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private UserService userService;
    @PostMapping(value = BaseRequestMapping.User.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.User.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<UserVO> create (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        UserDO userDO = toEntity(jsonData, UserDO.class);
        userDO = userService.registerWithIdcard(userDO);
        return success(userDO, UserVO.class);
    public Envelop create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject =  userService.createUser(jsonData);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
    @PostMapping(value = BaseRequestMapping.User.DELETE)
@ -51,17 +54,16 @@ public class UserEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.User.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.User.UPDATE)
    @ApiOperation(value = "更新")
    public Envelop update (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        UserDO userDO = toEntity(jsonData, UserDO.class);
        if (null == userDO.getId()) {
            return failed("ID不能为空", Envelop.class);
            @ApiParam(name = " jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject =  userService.updateUser(jsonData);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        userDO = userService.save(userDO);
        return success(userDO);
        return success(jsonObject.getString("msg"));
    }
    @GetMapping(value = BaseRequestMapping.User.PAGE)
@ -100,7 +102,7 @@ public class UserEndpoint extends EnvelopRestEndpoint {
    public Envelop checkName (
            @ApiParam(name = "username", value = "用户名", required = true)
            @RequestParam(value = "username", required = false) String username) throws Exception {
        if (userService.existUserName(username)) {
        if (userService.existUsername(username)) {
            return success("inavailable");
        } else {
            return success("available");
@ -122,7 +124,115 @@ public class UserEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.User.findUserBaseInfo)
    @ApiOperation(value = "获取登录基本信息")
    public ObjEnvelop<Map<String,Object>> findUserBaseInfo(@ApiParam(name = "id", value = "用户id", required = true)
                                                               @RequestParam(value = "id", required = false)String id){
                                                               @RequestParam(value = "id", required = false)String id) throws Exception {
        return success(BaseRequestMapping.User.api_success,userService.findUserBaseInfo(id));
    }
    /**
     * 获取单个用户信息
     *
     * @param id
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.User.queryOne)
    @ApiOperation(value = "获取单个用户信息")
    public Envelop doctorHosplist(
            @ApiParam(name = "id", value = "获取单个用户信息")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        JSONObject jsonObject = userService.getOneUserInfo(id);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getJSONObject("msg"));
    }
    /**
     * 获取用户管理机构树 省/市/区/机构 树形结构数据
     *
     * @param saasid
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.User.orgTreeInfo)
    @ApiOperation(value = "获取用户管理机构树 省/市/区/机构 树形结构数据")
    public Envelop getOrgDutyTree(
            @ApiParam(name = "saasid", value = "saasid")
            @RequestParam(value = "saasid", required = false) String saasid,
            @ApiParam(name = "userId", value = "userId")
            @RequestParam(value = "userId", required = false) String userId,
            @ApiParam(name = "roleCode", value = "roleCode")
            @RequestParam(value = "roleCode", required = false) String roleCode) throws Exception {
        JSONObject jsonObject = userService.generateUserOrgTree(saasid,userId,roleCode);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.get("msg"));
    }
    /**
     * 获取用户信息列表
     *
     * @param saasid
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.User.userInfoList)
    @ApiOperation(value = "获取用户信息列表")
    public PageEnvelop userInfoList(
            @ApiParam(name = "realName", value = "realName")
            @RequestParam(value = "realName", required = false) String realName,
            @ApiParam(name = "saasid", value = "saasid")
            @RequestParam(value = "saasid", required = false) String saasid,
            @ApiParam(name = "roleCode", value = "roleCode")
            @RequestParam(value = "roleCode", required = false) String roleCode,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = userService.userInfoList(realName,saasid, roleCode,page,size);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
    /**
     * 生效或失效某个用户
     *
     * @param id
     * @param status
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.User.lockOrUnlock)
    @ApiOperation(value = "生效或失效某个用户")
    public Envelop enableOrDisableOrg(
            @ApiParam(name = "id", value = "用户标识")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "生效或失效标识")
            @RequestParam(value = "status", required = true) boolean status) throws Exception {
        JSONObject jsonObject =  userService.lockOrUnlocakUser(id, status);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    /**
     * 重置密码
     *
     * @param id
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.User.resetPwd)
    @ApiOperation(value = "重置密码")
    public Envelop resetPwd(
            @ApiParam(name = "id", value = "用户标识")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        JSONObject jsonObject =  userService.resetPassword(id);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
}

+ 234 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java

@ -1,9 +1,41 @@
package com.yihu.jw.base.service.doctor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.dao.doctor.BaseModuleRoleDao;
import com.yihu.jw.base.dao.role.BaseRoleMenuDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.service.org.BaseOrgSaasService;
import com.yihu.jw.base.service.org.BaseOrgUserService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.role.BaseRoleMenuService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.*;
/**
 * 
@ -19,4 +51,206 @@ import org.springframework.stereotype.Service;
 */
@Service
public class BaseDoctorRoleInfoService extends BaseJpaService<BaseDoctorRoleInfoDO, BaseDoctorRoleInfoDao> {
    @Autowired
    private BaseDoctorRoleInfoDao baseDoctorRoleInfoDao;
    @Autowired
    private SaasDao saasDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseModuleRoleService baseModuleRoleService;
    @Value("${configDefault.saasId}")
    private String defaultSaasId;
    /**
     * 创建角色信息
     *
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject createRoleInfo(String jsonData,JSONObject userAgent) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject role = jsonObject.getJSONObject("role");
        JSONArray module = jsonObject.getJSONArray("module");
        if (null == role || CollectionUtils.isEmpty(module) ) {
            result.put("msg", "parameter role or module of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //组装角色信息
        BaseDoctorRoleInfoDO roleInfoDO = null;
        try {
            roleInfoDO = objectMapper.readValue(role.toJSONString(), BaseDoctorRoleInfoDO.class);
        } catch (IOException e) {
            result.put("msg", "convert role jsonObject to BaseDoctorRoleInfoDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        roleInfoDO.setCode(randomString(30));
        this.save(roleInfoDO);
        //组装角色与模块的关联关系
        List<BaseModuleRoleDO> moduleRoleDOList = new ArrayList<>();
        BaseModuleRoleDO moduleRoleDO = null;
        for (Object obj : module) {
            try {
                moduleRoleDO = objectMapper.readValue(obj.toString(), BaseModuleRoleDO.class);
                moduleRoleDO.setRoleCode(roleInfoDO.getCode());
                moduleRoleDOList.add(moduleRoleDO);
            } catch (IOException e) {
                result.put("msg", "convert org jsonObject to BaseOrgUserDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result;
            }
        }
        baseModuleRoleService.batchInsert(moduleRoleDOList);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", moduleRoleDO);
        return result;
    }
    /**
     * 修改角色
     *
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject updateRoleInfo(String jsonData) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject role = jsonObject.getJSONObject("role");
        JSONArray module = jsonObject.getJSONArray("module");
        if (null == role || CollectionUtils.isEmpty(module) ) {
            result.put("msg", "parameter role or module of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //修改角色信息
        BaseDoctorRoleInfoDO roleInfoDO = null;
        BaseDoctorRoleInfoDO oldRoleInfo = null;
        try {
            roleInfoDO = objectMapper.readValue(role.toJSONString(), BaseDoctorRoleInfoDO.class);
        } catch (IOException e) {
            result.put("msg", "convert user jsonObject to UserDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        try {
            oldRoleInfo = baseDoctorRoleInfoDao.findOne(roleInfoDO.getId());
        } catch (Exception e) {
            result.put("msg", "not role exist for id:" + roleInfoDO.getId());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        roleInfoDO.setCode(oldRoleInfo.getCode());
        roleInfoDO.setSaasid(oldRoleInfo.getSaasid());
        this.save(roleInfoDO);
        //修改角色与模块关联关系
        Set<Object> roleIdList = baseModuleRoleService.findModuleIdList(roleInfoDO.getId());
        BaseModuleRoleDO moduleRoleDO = null;
        try {
            for (Object obj : module) {
                moduleRoleDO = objectMapper.readValue(obj.toString(), BaseModuleRoleDO.class);
                moduleRoleDO.setRoleCode(roleInfoDO.getCode());
                if (roleIdList.contains(moduleRoleDO.getId())) {
                    roleIdList.remove(moduleRoleDO.getId());
                }
                baseModuleRoleService.save(moduleRoleDO);
            }
        } catch (IOException e) {
            result.put("msg", "convert module jsonObject to BaseModuleRoleDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        // 表示没有删除,只有修改
        if (roleIdList.size() > 0) {
            baseModuleRoleService.delete(roleIdList.toArray());
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", roleInfoDO);
        return result;
    }
    /**
     * 获取单个角色信息
     * @param roleId 角色id
     * @return
     */
    public JSONObject getOneRoleInfo(Integer roleId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(roleId)){
            result.put("msg","parameter roleId is null ");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        //角色基本信息
        BaseDoctorRoleInfoDO roleInfoDO = baseDoctorRoleInfoDao.findOne(roleId);
        if(null == roleInfoDO){
            result.put("msg","Role not exist for id:" + roleId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",roleInfoDO);
        return result;
    }
    /**
     * 生效或失效单个角色
     * @param roleId
     * @param del
     * @return
     */
    public JSONObject enableOrDisable(Integer roleId,String del){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(roleId) || StringUtils.isEmpty(del)){
            result.put("msg","parameter id or del is null");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        BaseDoctorRoleInfoDO roleInfoDO = baseDoctorRoleInfoDao.findOne(roleId);
        if( null == roleInfoDO ){
            result.put("msg","role not exist for id:" + roleId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        roleInfoDO.setDel(del);
        this.save(roleInfoDO);
        result.put("response",ConstantUtils.SUCCESS);
        return result;
    }
}

+ 4 - 21
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -114,8 +114,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        //医生归属业务模块角色信息
        String[] paramNames = {"doctorCode","del"};
        Object[] paramValue = {doctorId,"1"};
        String[] paramNames = {"doctorCode"};
        Object[] paramValue = {doctorId};
        List<BaseDoctorRoleDO> roleList = baseDoctorRoleService.findByFields(paramNames,paramValue);
        if(CollectionUtils.isEmpty(roleList)){
            result.put("msg","doctor role not exist for id:" + doctorId);
@ -475,7 +475,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        result.put("response", ConstantUtils.SUCCESS);
        // 不同医院职务可以相同
        result.put("msg", objectMapper.readValue(makeTree(orgTreeList,true),JSONArray.class));
        result.put("msg", objectMapper.readValue(orgTreeService.makeTree(orgTreeList,true,false),JSONArray.class));
        return result;
    }
@ -557,27 +557,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        result.put("response", ConstantUtils.SUCCESS);
        //不同医院科室可以相同
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList,true),JSONArray.class));
        result.put("msg",objectMapper.readValue(orgTreeService.makeTree(orgTreeList,true,false),JSONArray.class));
        return result;
    }
    /**
     * 构建树形结构
     * @return
     */
    public String makeTree(List<OrgTree> orgTreeList,boolean isAllowedRepeat){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes,isAllowedRepeat);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        filter.getExcludes().add("orderNum");
        filter.getExcludes().add("level");
        return JSONObject.toJSONString(treeNode, filter);
    }
    /**
     * 获取某一科室下的医生列表
     * @param deptCode

+ 25 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseModuleRoleService.java

@ -3,8 +3,14 @@ package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseModuleRoleDao;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.xml.ws.Action;
import java.util.HashSet;
import java.util.Set;
/**
 * 
 * 业务模块与业务模块角色关联信息服务service
@ -19,4 +25,23 @@ import org.springframework.stereotype.Service;
 */
@Service
public class BaseModuleRoleService extends BaseJpaService<BaseModuleRoleDO, BaseModuleRoleDao> {
    @Autowired
    private BaseModuleRoleDao baseModuleRoleDao;
    /**
     * 根据角色id获取角色对应的模块Id列表
     *
     * @param roleId
     * @return
     */
    public Set<Object> findModuleIdList(Integer roleId) {
        Set<Object> result = new HashSet<>();
        if (null == roleId) {
            return result;
        }
        return baseModuleRoleDao.findModuleIdList(roleId);
    }
}

+ 15 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgSaasService.java

@ -9,7 +9,9 @@ import org.springframework.stereotype.Service;
import javax.xml.ws.Action;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 
@ -36,4 +38,17 @@ public class BaseOrgSaasService extends BaseJpaService<BaseOrgSaasDO, BaseOrgSaa
        }
        return baseOrgSaasDao.findBySaasid(saasId);
    }
    /**
     * 查找某一个租户下的机构id列表
     * @param saasId
     * @return
     */
    public Set<String> findOrgCodeListBySaasid(String saasId){
        Set<String> result =  new HashSet<>();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgSaasDao.findOrgCodeListBySaasid(saasId);
    }
}

+ 32 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgUserService.java

@ -8,7 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 
@ -32,4 +34,34 @@ public class BaseOrgUserService extends BaseJpaService<BaseOrgUserDO, BaseOrgUse
        List<BaseOrgUserDO> result = new ArrayList<>();
        return StringUtils.isEmpty(orgCode) ? result : baseOrgUserDao.findAllByOrgCode(orgCode);
    }
    /**
     * 根据用户标识获取用户关联的机构Id列表
     *
     * @param userId
     * @return
     */
    public Set<Object> findIdListByUserId(String userId) {
        Set<Object> result = new HashSet<>();
        if (StringUtils.isEmpty(userId)) {
            return result;
        }
        return baseOrgUserDao.findIdListByUserId(userId);
    }
    /**
     * 根据用户标识获取用户关联的机构code列表
     *
     * @param userId
     * @return
     */
    public Set<String> findorgCodeListByUserId(String userId) {
        Set<String> result = new HashSet<>();
        if (StringUtils.isEmpty(userId)) {
            return result;
        }
        return baseOrgUserDao.findorgCodeListByUserId(userId);
    }
}

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java

@ -61,6 +61,11 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        return this.parentCode;
    }
    @Override
    public Integer extractLevel() {
        return this.level;
    }
    @Override
    public Integer extractOrderNum() {
        return null;

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java

@ -13,10 +13,12 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
@ -181,4 +183,24 @@ public class OrgTreeService extends BaseJpaService<OrgTree, OrgTreeDao> {
        }
        return orgTreeDao.findOrgListByParentCode(townCode);
    }
    /**
     * 构建树形结构
     * @return
     */
    public String makeTree(List<OrgTree> orgTreeList,boolean isAllowedRepeat,boolean showLevel){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes,isAllowedRepeat);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        filter.getExcludes().add("orderNum");
        if(!showLevel){
            filter.getExcludes().add("level");
        }
        return JSONObject.toJSONString(treeNode, filter);
    }
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTreeNode.java

@ -36,6 +36,7 @@ public class SimpleTreeNode {
        this.nodeName = obj.extractNodeName();
        this.parentNodeId = obj.extractNodeParentId();
        this.checked = obj.extractChecked();
        this.level = obj.extractLevel();
    }
    public void addChild(SimpleTreeNode treeNode){
        this.children.add(treeNode);

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/TreeNode.java

@ -5,5 +5,6 @@ public interface TreeNode {
    String extractNodeName();
    String extractNodeParentId();
    Integer extractOrderNum();
    Integer extractLevel();
    boolean extractChecked();
}

+ 0 - 22
svr/svr-base/src/main/java/com/yihu/jw/base/service/role/BaseRoleModuleService.java

@ -1,22 +0,0 @@
package com.yihu.jw.base.service.role;
import com.yihu.jw.base.dao.role.BaseRoleModuleDao;
import com.yihu.jw.entity.base.role.BaseRoleModuleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 
 * 业务模块角色服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月23日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseRoleModuleService extends BaseJpaService<BaseRoleModuleDO, BaseRoleModuleDao> {
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -459,7 +459,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
//        List<DictHospitalDeptDO> hospitalDeptDOList = new ArrayList<>(dictHospitalDeptDOList.size());
//        dictHospitalDeptDOList.forEach(dict->{
//            DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
//            deptDO.setOrgCode(saasId);
//            deptDO.setLeaderCode(saasId);
//            deptDO.setName(dict.getName());
//            deptDO.setCode(dict.getCode());
//            deptDO.setCreateTime(new Date());

+ 108 - 10
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -8,6 +8,7 @@ import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
@ -17,6 +18,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,10 +58,10 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorService baseDoctorService;
    private DictHospitalDeptService dictHospitalDeptService;
    @Autowired
    private DictHospitalDeptService dictHospitalDeptService;
    private OrgTreeService orgTreeService;
    /**
     * 新增团队
@ -135,6 +137,7 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        try {
            for(Object object : teamMembers){
                baseTeamMemberDO = objectMapper.readValue(object.toString(),BaseTeamMemberDO.class);
                baseTeamMemberDO.setTeamCode(baseTeamDO.getId());
                if(roleIdList.contains(baseTeamMemberDO.getId())){
                    roleIdList.remove(baseTeamMemberDO.getId());
                }
@ -144,7 +147,9 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
            result.put("msg","convert teamMember jsonObject to BaseTeamMemberDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
        }
        baseTeamMemberService.delete(roleIdList.toArray());
        if(roleIdList.size() > 0){
            baseTeamMemberService.delete(roleIdList.toArray());
        }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseTeamDO);
        return result;
@ -153,18 +158,17 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    /**
     * 查看团队成员 (姓名,身份证)
     * @param orgCode
     * @param teamCode
     * @param teamId
     * @return
     */
    public JSONObject getTeamMemberList(String orgCode,String teamCode) throws Exception {
    public JSONObject getTeamMemberList(String teamId) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(orgCode) || StringUtils.isEmpty(teamCode)){
            result.put("msg","parameter orgCode or orgCode is null");
        if(StringUtils.isEmpty(teamId)){
            result.put("msg","parameter teamId is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        List<Map<String,Object>> list = baseTeamMemberDao.getTeamMemberList();
        List<Map<String,Object>> list = baseTeamMemberDao.getTeamMemberList(teamId);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
@ -218,6 +222,7 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        orgTree.setParentCode("");
        orgTree.setCode(orgCode);
        orgTree.setName(orgName);
        orgTree.setLevel(1);
        orgTreeList.add(orgTree);
@ -228,6 +233,7 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
            deptTree.setParentCode(orgCode);
            deptTree.setCode(one.getCode());
            deptTree.setName(one.getName());
            deptTree.setLevel(2);
            orgTreeList.add(deptTree);
        });
@ -267,18 +273,110 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
            deptTree.setParentCode(orgCode);
            deptTree.setCode(String.valueOf(deptDoctorMap.get(key).get("deptCode")));
            deptTree.setName(String.valueOf(deptDoctorMap.get(key).get("deptName")));
            deptTree.setLevel(2);
            OrgTree doctorTree = new OrgTree();
            doctorTree.setParentCode(String.valueOf(deptDoctorMap.get(key).get("deptCode")));
            doctorTree.setCode(String.valueOf(deptDoctorMap.get(key).get("doctorCode")));
            doctorTree.setName(String.valueOf(deptDoctorMap.get(key).get("doctorName")));
            doctorTree.setLevel(3);
            orgTreeList.add(deptTree);
            orgTreeList.add(doctorTree);
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",objectMapper.readValue(baseDoctorService.makeTree(orgTreeList,false),JSONArray.class));
        result.put("msg",objectMapper.readValue(orgTreeService.makeTree(orgTreeList,false,true),JSONArray.class));
        return result;
    }
    /**
     * 团队信息列表
     * @param teamName
     * @param orgCode
     * @param status
     * @param page
     * @param size
     * @return
     * @throws Exception
     */
    public JSONObject getTeamInfoList(String teamName,String orgCode,String status,int page,int size,JSONObject userAgent) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String teamNameValue = null == teamName ? "" : teamName;
        String orgCodeValue = null == orgCode ? "" : orgCode;
        String statusValue = null == status ? "" : status;
        String sql = " " +
                "SELECT " +
                "  team.id as teamId, " +
                "  team.name as name, " +
                "  case team.del when 0 then '已失效' when 1 then '生效中' end status, " +
                "  org.name as orgName " +
                "FROM " +
                "  base_team team, " +
                "  base_org org " +
                "WHERE " +
                "  team.org_code = org.code " +
                "  and (team.name like '{teamName}' or '' ='{teamName}') " +
                "  and (team.org_code = '{orgCode}' or '' = '{orgCode}') " +
                "  and ( team.del = '{status}' or '' = '{status}') " +
                " ORDER BY team.create_time DESC " +
                " limit {start},{end} ";
        String finalSql = sql
                .replace("{teamName}","%" + teamNameValue + "%")
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue)
                .replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT " +
                "  count(team.id) " +
                "FROM " +
                "  base_team team, " +
                "  base_org org " +
                "WHERE " +
                "  team.org_code = org.code " +
                "  AND (team.name LIKE '{teamName}' OR '' = '{teamName}') " +
                "  AND (team.org_code = '{orgCode}' OR '' = '{orgCode}') " +
                "  AND (team.del = '{status}' OR '' = '{status}')";
        String finalCountSql = countSql
                .replace("{teamName}","%" + teamNameValue + "%")
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
        int count = jdbcTemplate.queryForObject(finalCountSql,Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
    /**
     * 生效或失效单个团队
     * @param teamId
     * @param del
     * @return
     */
    public JSONObject enableOrDis(String teamId,String del){
        JSONObject result = new JSONObject();
        if(org.springframework.util.StringUtils.isEmpty(teamId) || org.springframework.util.StringUtils.isEmpty(del)){
            result.put("msg","teamId id or status is null");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        BaseTeamDO teamDO = baseTeamDao.findOne(teamId);
        if( null == teamDO ){
            result.put("msg","teamId not exist for id:" + teamId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        teamDO.setDel(del);
        this.save(teamDO);
        result.put("response",ConstantUtils.SUCCESS);
        return result;
    }
}

+ 436 - 57
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -1,10 +1,19 @@
package com.yihu.jw.base.service.user;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.role.BaseRoleMenuDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.service.org.BaseOrgSaasService;
import com.yihu.jw.base.service.org.BaseOrgUserService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.user.UserDO;
@ -12,13 +21,16 @@ import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
/**
 * Service - 后台管理员
@ -38,6 +50,22 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseOrgUserService baseOrgUserService;
    @Autowired
    private OrgTreeService orgTreeService;
    @Autowired
    private BaseOrgSaasService baseOrgSaasService;
    @Value("${configDefault.saasId}")
    private String defaultSaasId;
    public UserDO registerWithIdcard(UserDO userDO) {
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
@ -53,6 +81,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    /**
     * 手机号作为账号,初始密码为手机号后6位
     *
     * @param userDO
     * @return
     */
@ -63,7 +92,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password =  userDO.getMobile().substring(0, 5);
            password = userDO.getMobile().substring(0, 5);
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
@ -72,6 +101,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    /**
     * 根据用户手机号查找(手机号为登录账号)
     *
     * @param mobile
     * @return
     */
@ -81,6 +111,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    /**
     * 根据id查找用户
     *
     * @param id
     * @return
     */
@ -90,11 +121,12 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    /**
     * 判断手机号是否存在
     *
     * @param mobile
     * @return
     */
    public Boolean existMobile(String mobile){
        if(StringUtils.isEmpty(mobile)) {
    public Boolean existMobile(String mobile) {
        if (StringUtils.isEmpty(mobile)) {
            return null;
        }
        return userDao.existsByMobile(mobile);
@ -114,80 +146,427 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    /**
     * 用户管理,获取用户基本信息列表
     * @param name 模糊查询
     *
     * @param name   模糊查询
     * @param saasId 精准匹配,为空查全部
     * @param roleId 精准匹配,为空查全部
     * @return
     */
    public List<Map<String,Object>> queryBaseUserInfoList(String name,String saasId,String roleId){
        List<Map<String,Object>> result = new ArrayList<>();
    public List<Map<String, Object>> queryBaseUserInfoList(String name, String saasId, String roleId) {
        List<Map<String, Object>> result = new ArrayList<>();
        return result;
    }
    public Map<String,Object> findUserBaseInfo(String id){
    public Map<String, Object> findUserBaseInfo(String id) throws Exception {
        Map<String,Object> userinfo = new HashedMap();
        Map<String, Object> userinfo = new HashedMap();
        UserDO user = userDao.findOne(id);
        RoleDO role = roleDao.findByCode(user.getRoleCode());
        if(user!=null){
            userinfo.put("id",user.getId());
            userinfo.put("name",user.getName());
        userinfo.put("id", user.getId());
        userinfo.put("name", user.getName());
        userinfo.put("role", role.getName());
        userinfo.put("roleCode", role.getCode());
        userinfo.put("system", role.getSystem());
        if (user != null) {
            userinfo.put("id", user.getId());
            userinfo.put("name", user.getName());
        }
        //获取角色
        RoleDO role = roleDao.findOne(user.getRoleCode());
        if(role!=null){
            userinfo.put("role",role.getId());
            userinfo.put("roleCode",role.getCode());
            userinfo.put("system",role.getSystem());
            if("admin".equals(role.getCode())){
            }else if("saasAdmin".equals(role.getCode())){
                if(org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())){
                    SaasDO saas = saasDao.findOne(user.getSaasId());
                    Map<String,Object> ss = new HashedMap();
                    ss.put("id",saas.getId());
                    ss.put("name",saas.getName());
                    userinfo.put("saas",ss);
        if (role != null) {
            userinfo.put("role", role.getId());
            userinfo.put("roleCode", role.getCode());
            userinfo.put("system", role.getSystem());
            if ("admin".equals(role.getCode())) {
                if ("admin".equals(role.getCode())) {
                } else if ("saasAdmin".equals(role.getCode())) {
                } else if ("saasAdmin".equals(role.getCode())) {
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())) {
                        SaasDO saas = saasDao.findOne(user.getSaasId());
                        Map<String, Object> ss = new HashedMap();
                        ss.put("id", saas.getId());
                        ss.put("name", saas.getName());
                        userinfo.put("saas", ss);
                    }
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())) {
                        SaasDO saas = saasDao.findOne(user.getSaasId());
                        Map<String, Object> ss = new HashedMap();
                        ss.put("id", saas.getId());
                        ss.put("name", saas.getName());
                        userinfo.put("saas", ss);
                    }
                } else if ("hosAdmin".equals(role.getCode())) {
                    String sql = "SELECT " +
                            " g.code AS orgCode, " +
                            " g.province_code AS provinceCode, " +
                            " g.province_name AS privinceName, " +
                            " g.city_code AS cityCode, " +
                            " g.city_name AS cityName, " +
                            " g.town_code AS townCode, " +
                            " g.town_name AS townName, " +
                            " g.street_code AS streetCode, " +
                            " g.street_name AS streetName, " +
                            " g.name, " +
                            " address " +
                            " FROM " +
                            " base_org g " +
                            " JOIN base_org_user u ON g.`code` = u.org_code " +
                            " WHERE  " +
                            " u.user_id = '" + id + "'";
                    List<Map<String, Object>> org = jdbcTemplate.queryForList(sql);
                    if (org != null && org.size() > 0) {
                        userinfo.put("org", org.get(0));
                    } else {
                        userinfo.put("org", null);
                    }
                }
            }
        }
            return userinfo;
    }
            }else if("hosAdmin".equals(role.getCode())){
                String sql = "SELECT " +
                        " g.code AS orgCode, " +
                        " g.province_code AS provinceCode, " +
                        " g.province_name AS privinceName, " +
                        " g.city_code AS cityCode, " +
                        " g.city_name AS cityName, " +
                        " g.town_code AS townCode, " +
                        " g.town_name AS townName, " +
                        " g.street_code AS streetCode, " +
                        " g.street_name AS streetName, " +
                        " g.name, " +
                        " address " +
                        " FROM " +
                        " base_org g " +
                        " JOIN base_org_user u ON g.`code` = u.org_code " +
                        " WHERE  " +
                        " u.user_id = '"+id+"'";
                List<Map<String,Object>> org = jdbcTemplate.queryForList(sql);
                if(org!=null&&org.size()>0){
                    userinfo.put("org",org.get(0));
                }else{
                    userinfo.put("org",null);
    /**
     * 创建用户
     *
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject createUser(String jsonData) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject user = jsonObject.getJSONObject("user");
        JSONArray org = jsonObject.getJSONArray("org");
        //归属租户为默认租户,表示用户为超级管理员,不需要机构
        if (null == user || CollectionUtils.isEmpty(org) && !user.getString("saasId").equalsIgnoreCase(defaultSaasId)) {
            result.put("msg", "parameter user or org of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //组装用户信息
        UserDO userDO = null;
        try {
            userDO = objectMapper.readValue(user.toJSONString(), UserDO.class);
        } catch (IOException e) {
            result.put("msg", "convert user jsonObject to UserDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        registerWithIdcard(userDO);
        //组装用户与机构的关联关系
        List<BaseOrgUserDO> orgList = new ArrayList<>();
        BaseOrgUserDO orgUserDO = null;
        if(!CollectionUtils.isEmpty(org)){
            for (Object obj : org) {
                try {
                    orgUserDO = objectMapper.readValue(obj.toString(), BaseOrgUserDO.class);
                    orgUserDO.setUserId(userDO.getId());
                    orgList.add(orgUserDO);
                } catch (IOException e) {
                    result.put("msg", "convert org jsonObject to BaseOrgUserDO failed," + e.getCause());
                    result.put("response", ConstantUtils.FAIL);
                    return result;
                }
            }
            baseOrgUserService.batchInsert(orgList);
        }
        JSONObject returnMsg = new JSONObject();
        returnMsg.put("username",userDO.getUsername());
        returnMsg.put("password",userDO.getSalt());
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", returnMsg);
        return result;
    }
    /**
     * 修改用户
     *
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject updateUser(String jsonData) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject user = jsonObject.getJSONObject("user");
        JSONArray org = jsonObject.getJSONArray("org");
        if (null == user ||  CollectionUtils.isEmpty(org) && !user.getString("saasId").equalsIgnoreCase(defaultSaasId)) {
            result.put("msg", "parameter user or org of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //修改用户信息
        UserDO userDO = null;
        try {
            userDO = objectMapper.readValue(user.toJSONString(), UserDO.class);
            UserDO oldUser = userDao.findOne(userDO.getId());
            userDO.setPassword(oldUser.getPassword());
        } catch (IOException e) {
            result.put("msg", "convert user jsonObject to UserDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        this.save(userDO);
        if (!CollectionUtils.isEmpty(org)) {
            //修改用户机构关联关系
            Set<Object> roleIdList = baseOrgUserService.findIdListByUserId(userDO.getId());
            BaseOrgUserDO orgUserDO = null;
            try {
                for (Object obj : org) {
                    orgUserDO = objectMapper.readValue(obj.toString(), BaseOrgUserDO.class);
                    orgUserDO.setUserId(userDO.getId());
                    if (roleIdList.contains(orgUserDO.getId())) {
                        roleIdList.remove(orgUserDO.getId());
                    }
                    orgUserDO.setUserId(userDO.getId());
                    baseOrgUserService.save(orgUserDO);
                }
            } catch (IOException e) {
                result.put("msg", "convert org jsonObject to BaseOrgUserDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result;
            }
            // 表示没有删除,只有修改
            if (roleIdList.size() > 0) {
                baseOrgUserService.delete(roleIdList.toArray());
            }
        }
        return userinfo;
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", userDO);
        return result;
    }
//    public Map<String,Object> findUserMenu(String id){
//
//    }
    /**
     * 获取单个用户信息
     * @param userId 用户id
     * @return
     */
    public JSONObject getOneUserInfo(String userId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(userId)){
            result.put("msg","parameter userId is null ");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        //用户基本信息
        UserDO user = userDao.findOne(userId);
        if(null == user){
            result.put("msg","User not exist for id:" + userId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",user);
        return result;
    }
    /**
     * 租户只能给用户归属到自己租户底下的机构
     * 机构管理员只能属于一个租户
     * @param saasid
     * @param userId
     * @return
     */
    public JSONObject generateUserOrgTree(String saasid,String userId,String roleCode) throws IOException {
        JSONObject result = new JSONObject();
        List<OrgTree> orgList = new ArrayList<>();
        // 有归属租户加载saas底下的所有机构树列表,角色为机构管理员时不需要选管理机构
        if(!StringUtils.isEmpty(saasid) && !StringUtils.endsWithIgnoreCase(RoleDO.BaseRoleType.admin.toString(),roleCode)){
            StringBuilder sql = new StringBuilder("SELECT " +
                    "  tree.* " +
                    " FROM " +
                    "  org_tree tree, " +
                    "  base_org org, " +
                    "  base_org_saas saas " +
                    " WHERE " +
                    "  org.code = saas.org_code " +
                    " and  saas.saasid = '{saasid}' " +
                    " and  (tree.code = org.code or tree.code = org.province_code or tree.code = org.city_code or tree.code = town_code) " +
                    " ORDER BY tree.name;");
            orgList = jdbcTemplate.query(sql.toString().replace("{saasid}",saasid),new BeanPropertyRowMapper(OrgTree.class));
        } else if(!StringUtils.isEmpty(userId)){// 用户不为空表示修改,需要筛选出用户已经选择过的机构,设置checked为true
            Set<String> codeSet = baseOrgUserService.findorgCodeListByUserId(userId);
            orgList.forEach( one -> {
                if(codeSet.contains(one.getCode())){
                    one.setChecked(true);
                }
            });
          /*  StringBuilder sql = new StringBuilder("SELECT tree.* " +
                    "FROM " +
                    "  org_tree tree, " +
                    "  base_org org, " +
                    "  base_org_user user " +
                    "WHERE " +
                    "  org.code = user.org_code " +
                    "  AND user.user_id = '{userId}' " +
                    "  and (tree.code = org.code OR tree.code = org.province_code OR tree.code = org.city_code OR tree.code = town_code) " +
                    "ORDER BY tree.name;");
            orgList = jdbcTemplate.query(sql.toString().replace("{userId}",userId),new BeanPropertyRowMapper(OrgTree.class));*/
        }
        if(!CollectionUtils.isEmpty(orgList)){
            String tree = orgTreeService.makeTree(orgList,false,true);
            result.put("msg",objectMapper.readValue(tree,JSONArray.class));
        }else{
            result.put("msg",orgList);
        }
        result.put("response", ConstantUtils.SUCCESS);
        return result;
    }
    /**
     * 用户重置密码
     * @param userId
     * @return
     */
    public JSONObject resetPassword(String userId){
        JSONObject result = new JSONObject();
        UserDO user = userDao.findOne(userId);
        if(null == user){
            result.put("response", ConstantUtils.FAIL);
            result.put("msg","user not exist for id : " + userId);
            return result;
        }
        registerWithIdcard(user);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg", user.getSalt());
        return result;
    }
    /**
     * 判断用户账号是否存在
     * @param code
     * @return
     */
    public Boolean existUsername(String code){
        if(StringUtils.isEmpty(code)) {
            return null;
        }
        return userDao.existsByUsername(code);
    }
    /**
     * 生效或失效单个用户
     * @param userId
     * @param lock
     * @return
     */
    public JSONObject lockOrUnlocakUser(String userId,boolean lock){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(lock)){
            result.put("msg","parameter id or del is null");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        UserDO user = userDao.findOne(userId);
        if( null == user ){
            result.put("msg","user not exist for id:" + userId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        user.setLocked(lock);
        user.setLockedDate(new Date());
        this.save(user);
        result.put("response",ConstantUtils.SUCCESS);
        return result;
    }
    /**
     * 用户信息列表
     * @param name
     * @param saasid
     * @param roleCode
     * @param page
     * @param size
     * @return
     * @throws Exception
     */
    public JSONObject userInfoList(String name,String saasid,String roleCode,int page,int size) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String realName = null == name ? "" : name;
        String saasidValue = null == saasid ? "" : saasid;
        String roleCodeValue = null == roleCode ? "" : roleCode;
        String sql = "SELECT " +
                "  user.id as id, " +
                "  user.name as realName, " +
                "  user.username as username, " +
                "  case user.locked when 0 then '已失效' when 1 then '生效中' end status, " +
                "  user.mobile, " +
                "  saas.name as saasName, " +
                "  role.name as roleName " +
                " FROM " +
                "  base_user user, " +
                "  base_saas saas, " +
                "  base_role role " +
                " WHERE " +
                "  user.saas_id = saas.id " +
                "  AND " +
                "  user.role_code = role.code " +
                " and (user.name like '{realName}' or '' ='{realName}') " +
                "  and (saas.id = '{saasid}' or '' = '{saasid}') " +
                "  and ( user.role_code = '{roleCode}' or '' = '{roleCode}') " +
                " ORDER BY user.create_time DESC" +
                "  limit {start},{end} ";
        String finalSql = sql
                .replace("{realName}","%" + realName + "%")
                .replace("{saasid}",saasidValue)
                .replace("{roleCode}",roleCodeValue)
                .replace("{start}",String.valueOf(start))
                .replace("{end}",String.valueOf(end));
        String countSql = "SELECT " +
                "  count(user.id) " +
                "FROM " +
                "  base_user user, " +
                "  base_saas saas, " +
                "  base_role role " +
                "WHERE " +
                "  user.saas_id = saas.id " +
                "  AND " +
                "  user.role_code = role.code " +
                " and (user.name like '{realName}' or '' ='{realName}') " +
                "  and (saas.id = '{saasid}' or '' = '{saasid}') " +
                "  and ( user.role_code = '{roleCode}' or '' = '{roleCode}') ";
        String finalCountSql = countSql
                .replace("{realName}", "%" + realName + "%")
                .replace("{saasid}",  saasidValue )
                .replace("{roleCode}",  roleCodeValue );
        List<Map<String, Object>> list = jdbcTemplate.queryForList(finalSql);
        Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java

@ -31,7 +31,7 @@
//        if (StringUtils.isEmpty(baseLoginAccountDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseLoginAccountDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseLoginAccountDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseLoginAccountDao.save(baseLoginAccountDO);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java

@ -62,7 +62,7 @@
//        //保存账户基础信息
//        BaseEmployDO employeeDO = new BaseEmployDO();
//        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
//        employeeDO.setOrgCode(saasId);
//        employeeDO.setLeaderCode(saasId);
//        employeeDO.setName(name);
//        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
//        employeeDO.setIdcard(idcard);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java

@ -106,7 +106,7 @@
//        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
//        sms.setDeadline(s.parse(vc.getCreateTimeString()));
//        sms.setStatus(1);
//        sms.setOrgCode(saasId);
//        sms.setLeaderCode(saasId);
//        //5、 调用发送信息的接口
////        String result = httpClientUtil.post(smsHttpVo.getUrl(), buildSmsParams(sms.getContent(), mobile), "GBK");
////        JSONObject json = toJson(result);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java

@ -74,7 +74,7 @@
//    public Envelop getMenuListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findAllBySaasId(baseMenuDO.getOrgCode()));
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findAllBySaasId(baseMenuDO.getLeaderCode()));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
@ -85,7 +85,7 @@
//    public Envelop deleteMenusBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            baseMenuService.deleteBaseMenusBySaasId(baseMenuDO.getOrgCode());
//            baseMenuService.deleteBaseMenusBySaasId(baseMenuDO.getLeaderCode());
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_delete);
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java

@ -78,7 +78,7 @@
////    public Envelop getOneRoleBySaasIdAndName(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findBySaasIdAndName(baseRoleDO.getName(),baseRoleDO.getOrgCode()));
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findBySaasIdAndName(baseRoleDO.getName(),baseRoleDO.getLeaderCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
@ -89,7 +89,7 @@
////    public Envelop getRoleListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getOrgCode()));
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getLeaderCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
@ -143,7 +143,7 @@
////    public Envelop deleteRolesBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            baseRoleService.deleteBaseRolesBySaasId(baseRoleDO.getOrgCode());
////            baseRoleService.deleteBaseRolesBySaasId(baseRoleDO.getLeaderCode());
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_delete);
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java

@ -33,7 +33,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
@ -49,7 +49,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
@ -96,7 +96,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseMenuDO.setStatus(-1);

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java

@ -32,7 +32,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getName())) {
@ -51,7 +51,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseRoleDao.save(baseRoleDO);
@ -135,7 +135,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseRoleDO.setStatus(-1);

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java

@ -44,7 +44,7 @@
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getOrgCode())) {
//        if (StringUtils.isEmpty(employeeDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
@ -61,7 +61,7 @@
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getOrgCode())) {
//        if (StringUtils.isEmpty(employeeDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
@ -144,7 +144,7 @@
//        if (StringUtils.isEmpty(employDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employDO.getOrgCode())) {
//        if (StringUtils.isEmpty(employDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        employDO.setStatus(-1);

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -104,7 +104,7 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
//            planDO.setPurchaseNum(purchase.getPurchaseNum());
//            planDO.setOrderNo(orderNo);
//            planDO.setOrderId(orderId);
//            planDO.setOrgCode(getCode());
//            planDO.setLeaderCode(getCode());
//            planDO.setStatus(IotDeviceQualityInspectionPlanDO.QualityPlanStatus.create.getValue());
//            planDO.setDeviceName(purchase.getDeviceName());
//            planDO.setPurchaseId(purchase.getId());

+ 2 - 2
svr/svr-manage/src/main/resources/webapp/html/login/login.html

@ -67,8 +67,8 @@
            success: function (data) {
                //保存用户信息到缓存中
                setUserCode(data.obj.code);
                if(data.obj.orgCode!=undefined){
                    setSaasId(data.obj.orgCode)
                if(data.obj.leaderCode!=undefined){
                    setSaasId(data.obj.leaderCode)
                }
                window.location.href = server+'/index/index.html';
            },

+ 3 - 3
svr/svr-manage/src/main/resources/webapp/html/system/role/html/menuRole.html

@ -26,7 +26,7 @@
    </form>
</div>
<script>
    var roleCode = $("#myModal").attr("data-code");
    var roleModuleCode = $("#myModal").attr("data-code");
    var existMenuCodes = "";
    getExistMenuCodes();
    $("#divTree").jstree({
@ -51,7 +51,7 @@
        var menuCodes = codeArr.join(",");
       var data = {
            menuCodes:menuCodes,
            roleCode:roleCode
            roleModuleCode:roleModuleCode
        };
        do_get(server+"/manage/menuRole/change",data,function(data){
            reloadPrivilege();
@ -65,7 +65,7 @@
    function getExistMenuCodes(){
        var url = server+"/manage/menuRole/getMenuRoles";
        var data={
            roleCode:roleCode
            roleModuleCode:roleModuleCode
        }
        do_get(url,data,function(data){
            existMenuCodes = data;

+ 3 - 3
svr/svr-manage/src/main/resources/webapp/html/system/role/html/userRole.html

@ -54,7 +54,7 @@
            "data": function (d) {
                d.name = $("#userName").val();
                d.userCode = userCode;
                d.orgCode = orgCode;
                d.leaderCode = leaderCode;
            }
        },
        "aoColumns": [{
@ -121,7 +121,7 @@
        var url=server+"/manage/userRole/changeUserRole";
        var data={
            userCode:userCode,
            roleCode:code,
            roleModuleCode:code,
            usercode:usercode
        };
        do_get(url,data,function(data){
@ -136,7 +136,7 @@
        $.ajax({
            url:server+"/manage/userRole/getUserCodes",
            type: 'GET',
            data: {userCode:userCode,roleCode:code},
            data: {userCode:userCode,roleModuleCode:code},
            success: function(data){
                selectedCode = data.obj;
            },

+ 2 - 2
svr/svr-manage/src/main/resources/webapp/html/version/server/html/userVersion.html

@ -44,7 +44,7 @@
<script>
    var table;
    var userCode = window.localStorage.getItem("userCode");
    var orgCode = window.localStorage.getItem("orgCode");
    var leaderCode = window.localStorage.getItem("leaderCode");
    var serverCode = $("#myModal-add-info").attr("data-code");
    var user_codes = [];//记录当前版本已有的用户
    getUserCodes();
@ -70,7 +70,7 @@
                        "dataSrc": "detailModelList",
                        "data": function (d) {
                            d.userCode = userCode;
                            d.orgCode = orgCode;
                            d.leaderCode = leaderCode;
                            d.name =$("#userName").val();
                            d.mobile=$("#mobile").val();
                        }

+ 25 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -18,6 +18,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.service.rehabilitation.RehabilitationPlanService;
import com.yihu.jw.util.DataUtils;
import com.yihu.jw.util.ImUtill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -46,6 +47,8 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
    private Tracer tracer;
    @Autowired
    private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
    @Autowired
    private ImUtill imUtill;
    @PostMapping(value = SpecialistMapping.rehabilitation.createRehabilitationPlanTemplate)
    @ApiOperation(value = "康复服务套餐模板创建")
@ -274,4 +277,26 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = SpecialistMapping.rehabilitation.sendToFamilyDoctor)
    @ApiOperation(value = "给家医发送居民的康复计划")
    public Envelop sendBusinessCard(@ApiParam(name = "doctorCode", value = "专医code")
                                   @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                   @ApiParam(name = "doctorName", value = "专医名字")
                                   @RequestParam(value = "doctorName", required = true) String doctorName,
                                   @ApiParam(name = "sessionId", value = "会话id", defaultValue = "")
                                   @RequestParam(value = "sessionId", required = true) String sessionId,
                                   @ApiParam(name = "businessType", value = "businessType", defaultValue = "1")
                                   @RequestParam(value = "businessType", required = true) String businessType,
                                   @ApiParam(name = "contentJsonStr", value = "contentJsonStr")
                                   @RequestParam(value = "contentJsonStr", required = true) String contentJsonStr){
        try {
            imUtill.sendImMsg(doctorCode,doctorName,sessionId,ImUtill.ContentType.Rehabilitation.getValue(),contentJsonStr,businessType);
            return Envelop.getSuccess(SpecialistMapping.api_success);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 71 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/HttpClientUtil.java

@ -1,11 +1,21 @@
package com.yihu.jw.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
/**
 * Created by hmf on 2018/9/3.
 */
@ -22,4 +32,65 @@ public class HttpClientUtil {
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    public  String postBody(String url, org.json.JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    public  void putBody(String url, org.json.JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        restTemplate.put(url, formEntity, String.class);
    }
    /**
     * 发送get请求
     *
     * @param url     请求地址
     * @param chatSet 编码格式
     * @return
     */
    public  String get(String url, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            HttpGet httpget = new HttpGet(url);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}

+ 574 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/ImUtill.java

@ -0,0 +1,574 @@
package com.yihu.jw.util;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
 * Created by 卓 on 2017/1/13.
 */
@Component
public class ImUtill {
    @Autowired
    private HttpClientUtil HttpClientUtil;
    @Value("${im.im_list_get}")
    private String im_host;
    public enum ContentType {
        plainText("信息", "1"),
        image("图片信息", "2"),
        audio("创建处方", "3"),
        article("文章信息", "4"),
        goTo("跳转信息,求组其他医生或者邀请其他医生发送的推送消息", "5"),
        topicBegin("议题开始", "6"),
        topicEnd("议题结束", "7"),
        personalCard("个人名片", "18"),
        messageForward("消息转发", "19"),
        topicInto("进入议题", "14"),
        video("视频", "12"),
        system("系统消息", "13"),
        prescriptionCheck("续方审核消息消息", "15"),
        prescriptionBloodStatus("续方咨询血糖血压咨询消息", "16"),
        prescriptionFollowupContent("续方咨询随访问卷消息", "17"),
        Rehabilitation("康复计划发送","20");
        private String name;
        private String value;
        ContentType(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    /**
     * 发送消息
     * @param senderId 发送者的code
     * @param receiverId 接受者code
     * @param contentType 消息类型 1二维码内容
     * @param content 消息内容
     * @return
     */
    public String sendMessage(String senderId,String receiverId,String contentType,String content){
        String imAddr = im_host + "api/v2/message/send";
        JSONObject params = new JSONObject();
        params.put("sender_id", senderId);
        params.put("sender_name", receiverId);
        params.put("content_type", contentType);
        params.put("content", content);
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 获取医生统计数据
     * status reply 为空值是是该医生总咨询量
     *
     * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode
     * @param status
     * @param reply
     * @return
     */
    public String getConsultData(String user, Integer adminTeamCode, Integer status, Integer reply) {
        String imAddr = im_host + "api/v2/sessions/topics/count/reply";
        imAddr = imAddr + "?user=" + user;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (adminTeamCode != null) {
            imAddr += ("&adminTeamCode=" + adminTeamCode);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    public void updateTopics(String topicId, String jsonValue) {
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id", topicId);
        params.put("data", jsonValue);
        HttpClientUtil.putBody(imAddr, params);
    }
    /**
     * 当前医生下当前团队列表接口
     * 获取团队内医生的健康咨询状况
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     *
     * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode 行政团队code
     * @param page
     * @param pagesize
     * @param status
     * @param reply
     * @return
     */
    public String getTeamConsultByStatus(String user, Integer adminTeamCode, Integer status, Integer reply, int page, int pagesize) {
        String imAddr = im_host + "api/v2/sessions/healthTeamTopics";
        imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
        if (adminTeamCode != null) {
            imAddr += ("&adminTeamCode=" + adminTeamCode);
        }
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 列表接口
     * 获取团队内医生的健康咨询状况
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     *
     * @param user     团队就把团队的医生合并起来用,隔开(医生编码)
     * @param page
     * @param pagesize
     * @param status
     * @param reply
     * @return
     */
    public String getConsultByStatus(String user, Integer status, Integer reply, int page, int pagesize) {
        String imAddr = im_host + "api/v2/sessions/healthTopics";
        imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 咨询列表
     * @param user
     * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * @param reply
     * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
     * @param page
     * @param pagesize
     * @return
     */
    public String getConsultByStatusAndType(String user,Integer status,Integer reply,Integer type,String patientName,String startTime,String endTime,int page,int pagesize){
        String imAddr = im_host + "api/v2/sessions/topicListByType";
        imAddr = imAddr + "?user="+user + "&page=" + page + "&pagesize=" + pagesize;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        if (type != null) {
            imAddr += ("&type=" + type);
        }
        if (patientName != null) {
            imAddr += ("&patientName=" + patientName);
        }
        if (startTime != null) {
            imAddr += ("&startTime=" + startTime);
        }
        if (endTime != null) {
            imAddr += ("&endTime=" + endTime);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 咨询列表总数
     * @param user
     * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * @param reply
     * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
     * @return
     */
    public String getConsultCountByStatusAndType(String user,Integer status,Integer reply,Integer type,String patientName,String startTime,String endTime){
        String imAddr = im_host + "api/v2/sessions/topicListCountByType";
        imAddr = imAddr + "?user="+user;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        if (type != null) {
            imAddr += ("&type=" + type);
        }
        if (patientName != null) {
            imAddr += ("&patientName=" + patientName);
        }
        if (startTime != null) {
            imAddr += ("&startTime=" + startTime);
        }
        if (endTime != null) {
            imAddr += ("&endTime=" + endTime);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 发送消息给IM
     *
     * @param from        来自
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
        params.put("content_type", contentType);
        params.put("content", content);
        params.put("session_id", sessionId);
        params.put("business_type", businessType);
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 更新会话状态
     *
     * @param sessionId 会话ID
     * @param status    状态
     */
    public String updateSessionStatus(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 更新会话状态
     *
     * @param sessionId 会话ID
     * @param status    状态
     */
    public String updateTopicEvaluate(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 发送消息给IM
     *
     * @param from        来自
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent) {
        String url = im_host + "api/v2/sessions/topic/" + topicId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
        params.put("content_type", contentType);
        params.put("content", content);
        params.put("topic_id", topicId);
        params.put("agent", agent);
        String response = HttpClientUtil.postBody(url, params);
        return response;
    }
    /**
     * 发送进入im消息
     *
     * @param from
     * @param sessionId
     * @param topicId
     * @return
     */
    public String sendIntoTopicIM(String from, String sessionId, String topicId, String content, String intoUser, String intoUserName) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/into";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("topic_id", topicId);
        params.put("into_user", intoUser);
        params.put("into_user_name", intoUserName);
        params.put("content", content);
        String response = HttpClientUtil.postBody(url, params);
        return response;
    }
    /**
     * 结束议题
     *
     * @param topicId     议题ID
     * @param endUser     结束人
     * @param endUserName 结束人名字
     * @param sessionId   会话ID
     */
    public JSONObject endTopics(String sessionId, String endUser, String endUserName, String topicId) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/ended";
        JSONObject params = new JSONObject();
        params.put("session_id", sessionId);
        params.put("end_user", endUser);
        params.put("end_user_name", endUserName);
        params.put("topic_id", topicId);
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        } catch (Exception e) {
            return null;
        }
        return obj;
    }
    /**
     * 议题邀请人员
     *
     * @param user      结束人名字
     * @param sessionId 会话ID
     */
    public void updateTopicUser(String sessionId, String user) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participants/" + user;
        JSONObject params = new JSONObject();
        params.put("user", user + ":" + 0);
        HttpClientUtil.putBody(imAddr, params);
    }
    /**
     * 创建议题
     *
     * @param topicId      议题ID
     * @param topicName    议题名称
     * @param participants 成员
     */
    public JSONObject createTopics(String sessionId, String topicId, String topicName, JSONObject participants, JSONObject messages, String sessionType) {
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id", topicId);
        params.put("topic_name", topicName);
        params.put("participants", participants.toString());
        params.put("messages", messages.toString());
        params.put("session_id", sessionId);
        params.put("session_type", sessionType);
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        } catch (Exception e) {
            return null;
        }
        return obj;
    }
    /**
     * 判断会话是否存在
     */
    public Boolean sessionIsExist(String sessionId) {
        Boolean re = false;
        String url = im_host + "api/v2/sessions/isExist?session_id="+sessionId;
        JSONObject params = new JSONObject();
        String ret = HttpClientUtil.get(url, "UTF-8");
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
            if(obj.getInt("status")==200&&sessionId.equals(obj.getString("sessionId"))){
                re = true;
            }
        } catch (Exception e) {
            return null;
        }
        return re;
    }
    /**
     * 创建会话(system)
     */
    public JSONObject createSession(JSONObject participants, String sessionType, String sessionName, String sessionId) {
        String imAddr = im_host + "api/v2/sessions";
        JSONObject params = new JSONObject();
        params.put("participants", participants.toString());
        params.put("session_name", sessionName);
        params.put("session_type", sessionType);
        params.put("session_id", sessionId);
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        } catch (Exception e) {
            return null;
        }
        return obj;
    }
    /**
     * 获取会话实例的消息对象
     *
     * @param senderId
     * @param senderName
     * @param title
     * @param description
     * @param images
     * @param agent
     * @return
     */
    public JSONObject getCreateTopicMessage(String senderId, String senderName, String title, String description, String images, String agent) {
        JSONObject messages = new JSONObject();
        messages.put("description", description);
        messages.put("title", title);
        messages.put("img", images);
        messages.put("sender_id", senderId);
        messages.put("sender_name", senderName);
        messages.put("agent", agent);
        return messages;
    }
    public JSONObject getTopicMessage(String topicId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host
                + "api/v2/sessions/topic/" + topicId + "/messages?topic_id=" + topicId + "&end=" + startMsgId
                + "&start=" + (endMsgId == null ? "" : endMsgId) + "&page=" + page + "&pagesize=" + pagesize + "&user=" + uid;
        try {
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONObject obj = new JSONObject(ret);
            if (obj.getInt("status") == -1) {
                throw new RuntimeException(obj.getString("message"));
            } else {
                return obj.getJSONObject("data");
            }
        } catch (Exception e) {
            return null;
        }
    }
    public JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/messages?session_id=" + sessionId + "&user=" + uid + "&start_message_id=" + startMsgId + "&end_message_id=" + endMsgId + "&page=" + page + "&pagesize=" + pagesize;
        try {
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONArray obj = new JSONArray(ret);
            return obj;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 删除对应的成员信息在MUC模式中
     *
     * @param userId
     * @param oldUserId
     * @param sessionId
     * @return
     */
    public JSONObject deleteMucUser(String userId, String oldUserId, String sessionId) throws Exception {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participant/update";
        try {
            JSONObject params = new JSONObject();
            params.put("user_id", userId);
            params.put("old_user_id", oldUserId);
            params.put("session_id", sessionId);
            String ret = HttpClientUtil.postBody(url, params);
            JSONObject obj = new JSONObject(ret);
            if (obj.getInt("status") == -1) {
                throw new RuntimeException("人员更换失败!");
            } else {
                return obj;
            }
        } catch (Exception e) {
            throw new RuntimeException("人员更换失败!");
        }
    }
    /**
     * 获取议题
     *
     * @param topicId
     * @return
     */
    public JSONObject getTopic(String topicId) throws Exception {
        String url = im_host + "api/v2/sessions/topics/" + topicId + "?topic_id=" + topicId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            JSONObject obj = new JSONObject(ret);
            if (obj.getInt("status") == -1) {
                throw new RuntimeException("获取议题失败!");
            } else {
                return obj;
            }
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    /**
     * 获取会话成员
     *
     * @param sessionId
     * @return
     * @throws Exception
     */
    public JSONArray getParticipants(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            return new JSONArray(ret);
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    /**
     * 获取会话成员
     *
     * @param sessionId
     * @return
     * @throws Exception
     */
    public JSONArray getSessions(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            return new JSONArray(ret);
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    public static final String SESSION_TYPE_MUC = "1";
    public static final String SESSION_TYPE_P2P = "2";
    public static final String SESSION_TYPE_GROUP = "3";
    public static final String SESSION_TYPE_SYSTEM = "0";
    public static final String SESSION_TYPE_PRESCRIPTION = "8";//续方
    public static final String SESSION_STATUS_PROCEEDINGS = "0";
    public static final String SESSION_STATUS_END = "1";
    public static final String CONTENT_TYPE_TEXT = "1";
}

+ 18 - 0
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -96,6 +96,11 @@ wechat:
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
---
spring:
  profiles: jwtest
@ -124,6 +129,11 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  data_base_name: im_new
---
spring:
  profiles: jwdevtest
@ -152,6 +162,10 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  data_base_name: im_new
---
spring:
  profiles: prod
@ -179,3 +193,7 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fwlyy
  accId: gh_ffd64560fb21
im:
  im_list_get: http://27.155.101.77:3000/
  data_base_name: im