LiTaohong 6 lat temu
rodzic
commit
5c89715080
89 zmienionych plików z 4130 dodań i 639 usunięć
  1. 0 5
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHealthProblemDO.java
  2. 15 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictMedicineDO.java
  3. 138 126
      common/common-entity/src/main/java/com/yihu/jw/entity/base/population/BasePopulationDO.java
  4. 27 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/population/BaseYearDO.java
  5. 145 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/BaseEmailTemplateConfigDO.java
  6. 24 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasDO.java
  7. 110 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasThemeDO.java
  8. 47 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasThemeExtendDO.java
  9. 4 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasTypeDictDO.java
  10. 37 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java
  11. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/system/SystemDictEntryDO.java
  12. 11 25
      common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxGraphicMessageDO.java
  13. 8 0
      common/common-exception/src/main/java/com/yihu/jw/exception/code/BaseErrorCode.java
  14. 36 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  15. 10 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/dict/SystemDictEntryVO.java
  16. 130 121
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/population/BasePopulationVO.java
  17. 136 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/BaseEmailTemplateConfigVO.java
  18. 44 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasThemeExtendVO.java
  19. 107 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasThemeVO.java
  20. 3 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasTypeDictVO.java
  21. 32 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java
  22. 20 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasVO.java
  23. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxComboVO.java
  24. 5 14
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxGraphicMessageVO.java
  25. 240 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxWechatSingleVO.java
  26. 4 0
      gateway/ag-basic/pom.xml
  27. 1 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  28. 4 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  29. 2 2
      server/svr-configuration/src/main/resources/bootstrap.yml
  30. 1 1
      server/svr-discovery/pom.xml
  31. 3 3
      server/svr-discovery/src/main/resources/application.yml
  32. 44 0
      svr/svr-base/pom.xml
  33. 11 8
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseCityDao.java
  34. 10 8
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseProvinceDao.java
  35. 11 8
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseTownDao.java
  36. 3 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictDiseaseDao.java
  37. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHealthProblemDao.java
  38. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java
  39. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java
  40. 4 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictJobTitleDao.java
  41. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictMedicineDao.java
  42. 6 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  43. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/population/BaseYearDao.java
  44. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/BaseEmailTemplateConfigDao.java
  45. 13 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasThemeDao.java
  46. 13 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasThemeExtendDao.java
  47. 13 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java
  48. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java
  49. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java
  50. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java
  51. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxGraphicSceneDao.java
  52. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxGraphicSceneGroupDao.java
  53. 66 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelReader.java
  54. 71 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelWriter.java
  55. 546 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/ExcelUtils.java
  56. 224 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsg.java
  57. 64 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsgReader.java
  58. 12 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/errorCode/ErrorCodeEndpoint.java
  59. 144 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java
  60. 13 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  61. 322 58
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BasePopulationEndpoint.java
  62. 73 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BaseYearEndpoint.java
  63. 37 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/BaseEmailTemplateConfigEndpoint.java
  64. 126 20
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java
  65. 12 8
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasTypeDictEndpoint.java
  66. 5 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WeChatQrcodeController.java
  67. 122 72
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatController.java
  68. 13 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatCoreController.java
  69. 12 7
      svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseCityService.java
  70. 12 7
      svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseProvinceService.java
  71. 12 7
      svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseTownService.java
  72. 10 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/errorCode/ErrorCodeService.java
  73. 35 15
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  74. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTreeNode.java
  75. 0 12
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java
  76. 91 7
      svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BasePopulationService.java
  77. 42 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BaseYearService.java
  78. 26 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/BaseEmailTemplateConfigService.java
  79. 272 25
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  80. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasThemeExtendService.java
  81. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasThemeService.java
  82. 21 22
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasTypeDictService.java
  83. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java
  84. 63 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WeChatQrcodeService.java
  85. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatCoreService.java
  86. 62 17
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java
  87. 14 0
      svr/svr-base/src/main/resources/application.yml
  88. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  89. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 0 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHealthProblemDO.java

@ -37,11 +37,6 @@ public class DictHealthProblemDO extends IntegerIdentityEntity {
     */
    private String chronicFlag;
    /**
     * 是否传染病 1-是,0-否
     */
    private String infectiousFlag;
    /**
	 * 描述
	 */

+ 15 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictMedicineDO.java

@ -21,6 +21,11 @@ public class DictMedicineDO extends IntegerIdentityEntity {
	 */
	private String code;
    /**
     * saasId
     */
    private String saasId;
    /**
	 * 药品中文名
	 */
@ -80,7 +85,16 @@ public class DictMedicineDO extends IntegerIdentityEntity {
        this.code = code;
    }
	@Column(name = "name")
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }

+ 138 - 126
common/common-entity/src/main/java/com/yihu/jw/entity/base/population/BasePopulationDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@ -17,217 +18,228 @@ import java.util.Date;
@Entity
@Table(name = "base_population")
public class BasePopulationDO extends UuidIdentityEntityWithOperator {
    //saas化的id
    @Column(name = "saas_id",nullable = false)
    private String  saasId;
    //租户名称
    @Column(name = "saas_name")
    private String  saasName;
    //租户创建时间
    @Column(name = "saas_create_time")
    private Date  saasCreateTime;
    //所属省代码
    @Column(name = "province_code")
    private String  provinceCode;
    //省份名称
    @Column(name = "province_name")
    private String  provinceName;
    //城市编码
    @Column(name = "city_code")
    private String  cityCode;
    //城市名称
    @Column(name = "city_name")
    private String  cityName;
    //所属区代码
    @Column(name = "district_code")
    private String  districtCode;
    //区名
    @Column(name = "district_name")
    private String  districtName;
    //户籍人口数
    @Column(name = "regis_population_num")
    private Integer  regisPopulationNum ;
    //常住人口数
    @Column(name = "population_num")
    private Integer  populationNum;
    //类别 0是省,1是市,2是区,3是机构
    @Column(name = "type")
    private String  type;
    //时间(年份)
    @Column(name = "year")
    private String  year;
    // 高血压人口数,HBP为医学简称
    @Column(name = "hbp_num")
    private Integer  hbpNum;
    // 糖尿病人口数,DM为医学简称
    @Column(name = "dm_num")
    private Integer  dmNum;
    //高血压任务数
    @Column(name = "hbp_task_num")
    private Integer  hbpTaskNum;
    //糖尿病任务数
    @Column(name = "dm_task_num")
    private Integer  dmTaskNum;
    //任务数
    @Column(name = "task_num")
    private Integer  taskNum;
    //慢病人数
    @Column(name = "ncd_num")
    private Integer ncdNum;
    /**
	 * saas化的id
	 */
	private String saasId;
    /**
	 * 所属省代码
	 */
	private String provinceCode;
    /**
	 * 所属市代码
	 */
	private String cityCode;
    /**
	 * 所属区代码
	 */
	private String districtCode;
    /**
	 * 所属具体名称
	 */
	private String name;
    /**
	 * 人口数
	 */
	private Integer populationNum;
    /**
	 * 类别 0是省,1是市,2是区,3是机构
	 */
	private String type;
    /**
	 * 每年的人口数
	 */
	private Integer year;
    /**
	 * 高血压发病数,HBP为医学简称
	 */
	private Integer hbpNum;
    /**
	 * 糖尿病发病数,DM为医学简称
	 */
	private Integer dmNum;
    /**
	 * 65岁以上老年人口数
	 */
	private Integer olderThan65Num;
    /**
	 * 高血压任务数
	 */
	private Integer hbpTaskNum;
    /**
	 * 糖尿病任务数
	 */
	private Integer dmTaskNum;
    /**
	 * 65岁以上老年人口任务数
	 */
	private Integer olderThan65TaskNum;
    /**
	 * 户籍人口任务数
	 */
	private Integer taskNum;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@Column(name = "province_code")
    public String getSaasName() {
        return saasName;
    }
    public void setSaasName(String saasName) {
        this.saasName = saasName;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@Column(name = "city_code")
    public String getCityCode() {
        return cityCode;
    public String getProvinceName() {
        return provinceName;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
	@Column(name = "district_code")
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    public String getDistrictName() {
        return districtName;
    }
    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }
    public void setName(String name) {
        this.name = name;
    public Integer getRegisPopulationNum() {
        return regisPopulationNum;
    }
    public void setRegisPopulationNum(Integer regisPopulationNum) {
        this.regisPopulationNum = regisPopulationNum;
    }
	@Column(name = "population_num")
    public Integer getPopulationNum() {
        return populationNum;
    }
    public void setPopulationNum(Integer populationNum) {
        this.populationNum = populationNum;
    }
	@Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@Column(name = "year")
    public Integer getYear() {
    public String getYear() {
        return year;
    }
    public void setYear(Integer year) {
    public void setYear(String year) {
        this.year = year;
    }
	@Column(name = "hbp_num")
    public Integer getHbpNum() {
        return hbpNum;
    }
    public void setHbpNum(Integer hbpNum) {
        this.hbpNum = hbpNum;
    }
	@Column(name = "dm_num")
    public Integer getDmNum() {
        return dmNum;
    }
    public void setDmNum(Integer dmNum) {
        this.dmNum = dmNum;
    }
	@Column(name = "older_than_65_num")
    public Integer getOlderThan65Num() {
        return olderThan65Num;
    }
    public void setOlderThan65Num(Integer olderThan65Num) {
        this.olderThan65Num = olderThan65Num;
    }
	@Column(name = "hbp_task_num")
    public Integer getHbpTaskNum() {
        return hbpTaskNum;
    }
    public void setHbpTaskNum(Integer hbpTaskNum) {
        this.hbpTaskNum = hbpTaskNum;
    }
	@Column(name = "dm_task_num")
    public Integer getDmTaskNum() {
        return dmTaskNum;
    }
    public void setDmTaskNum(Integer dmTaskNum) {
        this.dmTaskNum = dmTaskNum;
    }
	@Column(name = "older_than_65_task_num")
    public Integer getOlderThan65TaskNum() {
        return olderThan65TaskNum;
    }
    public void setOlderThan65TaskNum(Integer olderThan65TaskNum) {
        this.olderThan65TaskNum = olderThan65TaskNum;
    }
	@Column(name = "task_num")
    public Integer getTaskNum() {
        return taskNum;
    }
    public void setTaskNum(Integer taskNum) {
        this.taskNum = taskNum;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
    @Transient
    public String getAddress() {
        String address = "";
        if (this.getProvinceName() != null) {
            address += this.getProvinceName();
        }
        if (this.getCityName() != null) {
            address += this.getCityName();
        }
        if (this.getDistrictName()!= null) {
            address += this.getDistrictName();
        }
        return address;
    }
}

+ 27 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/population/BaseYearDO.java

@ -0,0 +1,27 @@
package com.yihu.jw.entity.base.population;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by zdm on 2018/10/12.
 */
@Entity
@Table(name = "base_year")
public class BaseYearDO extends UuidIdentityEntityWithOperator {
    //年份
    @Column(name = "year",nullable = false)
    private String  year;
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
}

+ 145 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/BaseEmailTemplateConfigDO.java

@ -0,0 +1,145 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by zdm on 2018/10/16.
 */
@Entity
@Table(name = "base_email_template_config")
public class BaseEmailTemplateConfigDO extends UuidIdentityEntityWithOperator {
    @Column(name = "template_name")
    private String templateName; // T '自定义模板名称
    @Column(name = "first")
    private String first; //
    @Column(name = "code")
    private String code; //
    @Column(name = "url")
    private String url; // 转链接
    @Column(name = "remark")
    private String remark; //
    @Column(name = "keyword1")
    private String keyword1; // 自定义文本1
    @Column(name = "keyword2")
    private String keyword2; // 自定义文本2
    @Column(name = "keyword3")
    private String keyword3; // 自定义文本3
    @Column(name = "keyword4")
    private String keyword4; // 自定义文本4
    @Column(name = "keyword5")
    private String keyword5; // 自定义文本5
    @Column(name = "keyword6")
    private String keyword6; // 自定义文本6
    @Column(name = "keyword7")
    private String keyword7; // 自定义文本7
    @Column(name = "status")
    private Integer status; // 状态 1:正常 0:删除
    public String getTemplateName() {
        return templateName;
    }
    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }
    public String getFirst() {
        return first;
    }
    public void setFirst(String first) {
        this.first = first;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getKeyword1() {
        return keyword1;
    }
    public void setKeyword1(String keyword1) {
        this.keyword1 = keyword1;
    }
    public String getKeyword2() {
        return keyword2;
    }
    public void setKeyword2(String keyword2) {
        this.keyword2 = keyword2;
    }
    public String getKeyword3() {
        return keyword3;
    }
    public void setKeyword3(String keyword3) {
        this.keyword3 = keyword3;
    }
    public String getKeyword4() {
        return keyword4;
    }
    public void setKeyword4(String keyword4) {
        this.keyword4 = keyword4;
    }
    public String getKeyword5() {
        return keyword5;
    }
    public void setKeyword5(String keyword5) {
        this.keyword5 = keyword5;
    }
    public String getKeyword6() {
        return keyword6;
    }
    public void setKeyword6(String keyword6) {
        this.keyword6 = keyword6;
    }
    public String getKeyword7() {
        return keyword7;
    }
    public void setKeyword7(String keyword7) {
        this.keyword7 = keyword7;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 24 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasDO.java

@ -26,11 +26,13 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
        auditPassed,
		//审核不通过
        auditNotPassed,
        //已暂停
        stoped,
		//已删除
		delete
    }
	private String name; //系统名称
	private Status status; //状态  0待审核 1审核通过 2审核不通过 3已删除
	private Status status; // 状态(0-待审核 1-审核通过(启用) 2-审核不通过 3-已暂停)
	private String remark; //备注
	private String logo; //远程fastDFS文件地址
    private Integer type; //类型
@ -41,6 +43,7 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
	private String businessLicense; //营业执照url
	private String systemName; //系统名称
	private String areaNumber; //行政区划代码
	private String themeColor; //主题色
    //审核不通过的原因
    private String auditFailedReason;
    //管理员姓名
@ -49,6 +52,8 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
    List<BaseOrgDO> orgList;
    //业务模块
    List<SaasModuleDO> saasModuleList;
    //主题风格
    List<SaasThemeDO> saasThemeList;
	@Column(name = "name", nullable = false, length = 200)
	public String getName() {
@ -193,4 +198,22 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "theme_color")
    public String getThemeColor() {
        return themeColor;
    }
    public void setThemeColor(String themeColor) {
        this.themeColor = themeColor;
    }
    @Transient
    public List<SaasThemeDO> getSaasThemeList() {
        return saasThemeList;
    }
    public void setSaasThemeList(List<SaasThemeDO> saasThemeList) {
        this.saasThemeList = saasThemeList;
    }
}

+ 110 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasThemeDO.java

@ -0,0 +1,110 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
 * 租户主题风格
 * @author yeshijie on 2018/10/16.
 */
@Entity
@Table(name = "base_saas_theme")
public class SaasThemeDO extends UuidIdentityEntity{
    private String saasId;//saas_id
    private String type;//组件类型(1单张图文广告,2多图图文广告,3标题,4中心指标1,5中心指标2)
    private String img;//图片url
    private String title;//标题
    private String content;//内容/解释说明
    private String url;//跳转url
    private String font;//字体大小
    private Integer sort;//排序
    List<SaasThemeExtendDO> themeExtendList;//主题扩展
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "font")
    public String getFont() {
        return font;
    }
    public void setFont(String font) {
        this.font = font;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Transient
    public List<SaasThemeExtendDO> getThemeExtendList() {
        return themeExtendList;
    }
    public void setThemeExtendList(List<SaasThemeExtendDO> themeExtendList) {
        this.themeExtendList = themeExtendList;
    }
}

+ 47 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasThemeExtendDO.java

@ -0,0 +1,47 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 主题风格扩展表(type=2时存多图)
 * @author yeshijie on 2018/10/16.
 */
@Entity
@Table(name = "base_saas_theme_extend")
public class SaasThemeExtendDO extends UuidIdentityEntity {
    private String themeId;//theme_id
    private String img;//图片地址
    private String url;//url地址
    @Column(name = "theme_id")
    public String getThemeId() {
        return themeId;
    }
    public void setThemeId(String themeId) {
        this.themeId = themeId;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
}

+ 4 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasTypeDictDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -19,11 +20,14 @@ public class SaasTypeDictDO extends UuidIdentityEntityWithOperator{
        effective
    }
    //Saas类型编码
    @Column(name = "code")
    private Integer code;
    //Saas类型名称
    @Column(name = "name")
    private String name;
    //状态(1生效中,0已失效)
    @Column(name = "status")
    private Status status;
    public Integer getCode() {

+ 37 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java

@ -0,0 +1,37 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Entity
@Table(name = "base_saas_user")
public class SaasUserDO extends UuidIdentityEntity {
    private String saasId;//租户ID
    private String userId;//用户账号
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/system/SystemDictEntryDO.java

@ -18,6 +18,8 @@ public class SystemDictEntryDO extends UuidIdentityEntity {
	private String dictCode;
	//编码
	private String code;
	//租户id
	private String saasId;
	//拼音码
	private String pyCode;
	//值
@ -36,6 +38,15 @@ public class SystemDictEntryDO extends UuidIdentityEntity {
		this.dictCode = dictCode;
	}
	@Column(name = "saasId")
	public String getSaasId() {
		return saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
	@Column(name = "code", nullable = false, length = 50)
	public String getCode() {
		return code;

+ 11 - 25
common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxGraphicMessageDO.java

@ -15,14 +15,22 @@ import java.util.Date;
@Table(name = "wx_graphic_message")
public class WxGraphicMessageDO extends UuidIdentityEntityWithOperator implements java.io.Serializable {
    private String code;
    private String wechatId;//微信id
    private String title;//标题
    private String description;//描述
    private String url;//图文消息url值
    private String picUrl;//图片地址
    private String remark;//备注
    private Integer status;  //状态 -1删除 0 冻结 1可用
    @Column(name = "wechat_id", length = 50)
    public String getWechatId() {
        return wechatId;
    }
    public void setWechatId(String wechatId) {
        this.wechatId = wechatId;
    }
    @Column(name = "title", length = 200)
    public String getTitle() {
        return title;
@ -59,21 +67,7 @@ public class WxGraphicMessageDO extends UuidIdentityEntityWithOperator implement
        this.picUrl = picUrl;
    }
    @Column(name = "remark", length = 1000)
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "status", length = 2000)
    public Integer getStatus() {
        return status;
    }
@ -82,12 +76,4 @@ public class WxGraphicMessageDO extends UuidIdentityEntityWithOperator implement
        this.status = status;
    }
    @Column(name = "code", length = 50)
    public String getCode() {
        return code;
    }
    @Column(name = "code", length = 50)
    public void setCode(String code) {
        this.code = code;
    }
}

+ 8 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/code/BaseErrorCode.java

@ -47,6 +47,14 @@ public class BaseErrorCode {
         * 该名称已被占用
         */
        public static final String NAME_IS_EXIST = "-101003";
        /**
         * 验证码错误
         */
        public static final String CAPTCHA_IS_ERROR = "-101004";
        /**
         * 该租户已注册过,请直接
         */
        public static final String NAME_IS_EXIST2 = "-101005";
    }
    /**

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

@ -19,6 +19,7 @@ public class BaseRequestMapping {
        public static final String PAGE = "/page";
        public static final String LIST = "/list";
        public static final String FINDBYID = "/findById";
        public static final String STATUS = "/status";
    }
    /**
@ -26,9 +27,23 @@ public class BaseRequestMapping {
     */
    public static class Saas extends Basic {
        public static final String PREFIX  = "/saas";
        public static final String SYSTEM_CONFIGURATION  = "/system_configuration";
        public static final String THEME_STYLE  = "/theme_style";
        public static final String AUDIT  = "/audit";
    }
    /**
     * 注册saas
     */
    public static class RegisterSaas extends Basic {
        public static final String PREFIX  = "/open/saas";
        public static final String REGISTER  = "/register";
        public static final String SEND_EMAIL  = "/sendEmail";
        public static final String NAME_IS_EXIST  = "/nameIsExist";
        public static final String SAAS_TYPE_DICT  = "/saasTypeDict";
    }
    /**
     * SAAS默认模块
     */
@ -176,6 +191,7 @@ public class BaseRequestMapping {
     */
    public static class ErrorCode extends Basic {
        public static final String PREFIX  = "/error";
        public static final String INIT_WITHOUT_CONDITION  = "/initWithoutCondition";
    }
    /**
@ -197,7 +213,7 @@ public class BaseRequestMapping {
     * 文件上传
     */
    public static class FileUpload extends Basic {
        public static final String PREFIX  = "/fileUpload";
        public static final String PREFIX  = "/open/fileUpload";
        public static final String UPLOAD_STREAM_IMG  = "/upload_stream_img";
        public static final String UPLOAD_STREAM  = "/upload_stream";
        public static final String UPLOAD_STRING  = "/upload_string";
@ -222,19 +238,25 @@ public class BaseRequestMapping {
        public static final String getWechatInfos ="/getWechatInfos";
        public static final String saveWxAndSaas ="/saveWxAndSaas";
        public static final String updateWxAndSaas ="/updateWxAndSaas";
        public static final String findWxWechatSingle ="/findWxWechatSingle";
        public static final String findWxWechatExist ="/findWxWechatExist";
        public static final String findWechatCombo ="/findWechatCombo";
        public static final String findWechatImgGroup ="/findWechatImgGroup";
        public static final String createImgGroup ="/createImgGroup";
        public static final String findImgGroupExist ="/findImgGroupExist";
        public static final String updateImgGroup ="/updateImgGroup";
        public static final String deleteImgGroup ="/deleteImgGroup";
        public static final String saveImg ="/saveImg";
        public static final String findImg ="/findImg";
        public static final String findGraphicMessageSingle ="/findGraphicMessageSingle";
        public static final String saveImgGroup ="/saveImgGroup";
        public static final String deleteImgGroupRelation ="/deleteImgGroupRelation";
        public static final String saveWxReplyScene ="/saveWxReplyScene";
        public static final String findWxReplyScene ="/findWxReplyScene";
        public static final String saveWxTemp ="/saveWxTemp";
        public static final String findWxtemp ="/findWxtemp";
        public static final String saveWxTempConfig ="/saveWxTempConfig";
        public static final String findWxTempConfigList ="/findWxTempConfigList";
        public static final String findWxTemplateConfig ="/findWxTemplateConfig";
@ -380,6 +402,7 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseOrg";
        public static final String baseInfoList  = "/baseInfoList";
        public static final String check_code  = "/check_code";
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
    }
@ -397,6 +420,18 @@ public class BaseRequestMapping {
     */
    public static class BasePopulation extends Basic {
        public static final String PREFIX  = "/basePopulation";
        public static final String CHECK_POPULATION_IS_EXIST  = "/checkBasePopulationIsExist";
        public static final String POPULATION_BATCH_IMPORT  = "/basePopulationBatchImport";
        public static final String POPULATION_BATCH_ERROR_DOENLOAD  = "/basePopulationBatchErrorDownLoad";
        public static final String POPULATION_BODY_BATCH_IMPORT  = "/basePopulationBodyBatchImport";
    }
    /**
     * 年份
     */
    public static class BaseYear extends Basic {
        public static final String PREFIX  = "/baseYear";
    }

+ 10 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/dict/SystemDictEntryVO.java

@ -4,8 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by wq on 2016/2/19.
 */
@ -16,6 +14,8 @@ public class SystemDictEntryVO {
    private long dictId;
    @ApiModelProperty("系统字典元编码")
    private String code;
    @ApiModelProperty("saasId")
    private String saasId;
    @ApiModelProperty("系统字典元值")
    private String value;
    @ApiModelProperty("系统字典元排序")
@ -33,6 +33,14 @@ public class SystemDictEntryVO {
        this.dictId = dictId;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getCode() {
        return code;
    }

+ 130 - 121
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/population/BasePopulationVO.java

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.util.Date;
@ -22,121 +24,109 @@ import java.util.Date;
@ApiModel(value = "BasePopulationVO", description = "基础人口基数信息")
public class BasePopulationVO extends UuidIdentityVOWithOperator {
    /**
	 * saas化的id
	 */
	@ApiModelProperty(value = "saas化的id", example = "402803ee656498890165649ad2da1112")
    private String saasId;
    /**
	 * 所属省代码
	 */
	@ApiModelProperty(value = "所属省代码", example = "参考省代码")
    private String provinceCode;
    /**
	 * 所属市代码
	 */
	@ApiModelProperty(value = "所属市代码", example = "参考市代码")
    private String cityCode;
    /**
	 * 所属区代码
	 */
	@ApiModelProperty(value = "所属区代码", example = "参考区代码")
    private String districtCode;
    /**
	 * 所属具体名称
	 */
	@ApiModelProperty(value = "所属具体名称", example = "")
    private String name;
    /**
	 * 人口数
	 */
	@ApiModelProperty(value = "人口数", example = "自然数")
    private Integer populationNum;
    /**
	 * 类别 0是省,1是市,2是区,3是机构
	 */
	@ApiModelProperty(value = "类别 0是省,1是市,2是区,3是机构", example = "0")
    private String type;
    /**
	 * 每年的人口数
	 */
	@ApiModelProperty(value = "每年的人口数", example = "自然数")
    private Integer year;
    /**
	 * 高血压发病数,HBP为医学简称
	 */
	@ApiModelProperty(value = "高血压发病数,HBP为医学简称", example = "模块1")
    private Integer hbpNum;
    /**
	 * 糖尿病发病数,DM为医学简称
	 */
	@ApiModelProperty(value = "糖尿病发病数,DM为医学简称", example = "模块1")
    private Integer dmNum;
    /**
	 * 65岁以上老年人口数
	 */
	@ApiModelProperty(value = "65岁以上老年人口数", example = "自然数")
    private Integer olderThan65Num;
    /**
	 * 高血压任务数
	 */
	@ApiModelProperty(value = "高血压任务数", example = "自然数")
    private Integer hbpTaskNum;
    /**
	 * 糖尿病任务数
	 */
	@ApiModelProperty(value = "糖尿病任务数", example = "自然数")
    private Integer dmTaskNum;
    /**
	 * 65岁以上老年人口任务数
	 */
	@ApiModelProperty(value = "65岁以上老年人口任务数", example = "自然数")
    private Integer olderThan65TaskNum;
    /**
	 * 户籍人口任务数
	 */
	@ApiModelProperty(value = "户籍人口任务数", example = "自然数")
    private Integer taskNum;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@ApiModelProperty(value = "创建时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    //saas化的id
    @ApiModelProperty(value = "saasId", example = "自然数")
    private String  saasId;
    //租户名称
    @ApiModelProperty(value = "租户名称", example = "i健康")
    private String  saasName;
    //所属省代码
    @ApiModelProperty(value = "所属省代码", example = "350000")
    private String  provinceCode;
    //省份名称
    @ApiModelProperty(value = "省份名称", example = "福建省")
    private String  provinceName;
    //城市名称
    @ApiModelProperty(value = "城市名称", example = "厦门市")
    private String  cityName;
    //城市名称
    @ApiModelProperty(value = "城市编码", example = "350200")
    private String  cityCode;
    //所属区代码
    @ApiModelProperty(value = "所属区代码", example = "350203")
    private String  districtCode;
    //区名
    @ApiModelProperty(value = "所属区名称", example = "思明区")
    private String  districtName;
    //户籍人口数
    @ApiModelProperty(value = "户籍人口数", example = "自然数")
    private Integer  regisPopulationNum ;
    //常住人口数
    @ApiModelProperty(value = "常住人口数", example = "自然数")
    private Integer  populationNum;
    //类别 0是省,1是市,2是区,3是机构
    @ApiModelProperty(value = "类别 0是省,1是市,2是区,3是机构", example = "自然数")
    private String  type;
    //时间(年份)
    @ApiModelProperty(value = "时间", example = "2018年")
    private String  year;
    // 高血压人口数,HBP为医学简称
    @ApiModelProperty(value = "高血压人口数", example = "自然数")
    private Integer  hbpNum;
    // 糖尿病人口数,DM为医学简称
    @ApiModelProperty(value = "糖尿病人口数", example = "自然数")
    private Integer  dmNum;
    //高血压任务数
    @ApiModelProperty(value = "高血压任务数", example = "自然数")
    private Integer  hbpTaskNum;
    //糖尿病任务数
    @ApiModelProperty(value = "糖尿病任务数", example = "自然数")
    private Integer  dmTaskNum;
    //任务数
    @ApiModelProperty(value = "任务数", example = "自然数")
    private Integer  taskNum;
    @ApiModelProperty(value = "慢病人数(高血压人口数+糖尿病人口数)", example = "自然数")
    private Integer ncdNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "租户创建时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date  saasCreateTime;
    @ApiModelProperty(value = "行政区划", example = "省+市+区")
    private String address;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getSaasName() {
        return saasName;
    }
    public void setSaasName(String saasName) {
        this.saasName = saasName;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
@ -144,20 +134,31 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
    public String getName() {
        return name;
    public String getDistrictName() {
        return districtName;
    }
    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }
    public Integer getRegisPopulationNum() {
        return regisPopulationNum;
    }
    public void setName(String name) {
        this.name = name;
    public void setRegisPopulationNum(Integer regisPopulationNum) {
        this.regisPopulationNum = regisPopulationNum;
    }
    public Integer getPopulationNum() {
        return populationNum;
    }
    public void setPopulationNum(Integer populationNum) {
        this.populationNum = populationNum;
    }
@ -165,20 +166,23 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getYear() {
    public String getYear() {
        return year;
    }
    public void setYear(Integer year) {
    public void setYear(String year) {
        this.year = year;
    }
    public Integer getHbpNum() {
        return hbpNum;
    }
    public void setHbpNum(Integer hbpNum) {
        this.hbpNum = hbpNum;
    }
@ -186,20 +190,15 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public Integer getDmNum() {
        return dmNum;
    }
    public void setDmNum(Integer dmNum) {
        this.dmNum = dmNum;
    }
    public Integer getOlderThan65Num() {
        return olderThan65Num;
    }
    public void setOlderThan65Num(Integer olderThan65Num) {
        this.olderThan65Num = olderThan65Num;
    }
    public Integer getHbpTaskNum() {
        return hbpTaskNum;
    }
    public void setHbpTaskNum(Integer hbpTaskNum) {
        this.hbpTaskNum = hbpTaskNum;
    }
@ -207,30 +206,40 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public Integer getDmTaskNum() {
        return dmTaskNum;
    }
    public void setDmTaskNum(Integer dmTaskNum) {
        this.dmTaskNum = dmTaskNum;
    }
    public Integer getOlderThan65TaskNum() {
        return olderThan65TaskNum;
    }
    public void setOlderThan65TaskNum(Integer olderThan65TaskNum) {
        this.olderThan65TaskNum = olderThan65TaskNum;
    }
    public Integer getTaskNum() {
        return taskNum;
    }
    public void setTaskNum(Integer taskNum) {
        this.taskNum = taskNum;
    }
    public Date getCreateTime() {
        return createTime;
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
}

+ 136 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/BaseEmailTemplateConfigVO.java

@ -0,0 +1,136 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by zdm on 2018/10/16.
 */
@ApiModel(value = "BaseEmailTemplateConfigVO", description = "租户审核-邮件模板")
public class BaseEmailTemplateConfigVO extends UuidIdentityEntityWithOperator {
    @ApiModelProperty(value = "模板名称", example = "审核通过模板")
    private String templateName; // T '自定义模板名称
    @ApiModelProperty(value = "邮件首行", example = "您好!")
    private String first; //
    @ApiModelProperty(value = "转链接", example = "http://www.baidu.com")
    private String url ; // 转链接
    @ApiModelProperty(value = "备注", example = "备注")
    private String remark ; //
    @ApiModelProperty(value = "自定义文本", example = "自定义文本1")
    private String keyword1; // 自定义文本1
    @ApiModelProperty(value = "自定义文本", example = "自定义文本2")
    private String keyword2 ; // 自定义文本2
    @ApiModelProperty(value = "自定义文本", example = "自定义文本3")
    private String keyword3; // 自定义文本3
    @ApiModelProperty(value = "自定义文本", example = "自定义文本4")
    private String keyword4; // 自定义文本4
    @ApiModelProperty(value = "自定义文本", example = "自定义文本5")
    private String keyword5 ; // 自定义文本5
    @ApiModelProperty(value = "自定义文本", example = "自定义文本6")
    private String keyword6; // 自定义文本6
    @ApiModelProperty(value = "自定义文本", example = "自定义文本7")
    private String keyword7; // 自定义文本7
    @ApiModelProperty(value = "使用状态", example = "状态 1:正常 0:删除")
    private Integer status; // 状态 1:正常 0:删除
    public String getTemplateName() {
        return templateName;
    }
    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }
    public String getFirst() {
        return first;
    }
    public void setFirst(String first) {
        this.first = first;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getKeyword1() {
        return keyword1;
    }
    public void setKeyword1(String keyword1) {
        this.keyword1 = keyword1;
    }
    public String getKeyword2() {
        return keyword2;
    }
    public void setKeyword2(String keyword2) {
        this.keyword2 = keyword2;
    }
    public String getKeyword3() {
        return keyword3;
    }
    public void setKeyword3(String keyword3) {
        this.keyword3 = keyword3;
    }
    public String getKeyword4() {
        return keyword4;
    }
    public void setKeyword4(String keyword4) {
        this.keyword4 = keyword4;
    }
    public String getKeyword5() {
        return keyword5;
    }
    public void setKeyword5(String keyword5) {
        this.keyword5 = keyword5;
    }
    public String getKeyword6() {
        return keyword6;
    }
    public void setKeyword6(String keyword6) {
        this.keyword6 = keyword6;
    }
    public String getKeyword7() {
        return keyword7;
    }
    public void setKeyword7(String keyword7) {
        this.keyword7 = keyword7;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 44 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasThemeExtendVO.java

@ -0,0 +1,44 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 主题风格扩展表(type=2时存多图)
 * @author yeshijie on 2018/10/16.
 */
@ApiModel(value = "SaasThemeExtendVO", description = "主题风格扩展")
public class SaasThemeExtendVO extends UuidIdentityVO {
    @ApiModelProperty(value = "主题id", example = "theme_id")
    private String themeId;
    @ApiModelProperty(value = "图片地址", example = "图片地址")
    private String img;
    @ApiModelProperty(value = "url地址", example = "url地址")
    private String url;
    public String getThemeId() {
        return themeId;
    }
    public void setThemeId(String themeId) {
        this.themeId = themeId;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
}

+ 107 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasThemeVO.java

@ -0,0 +1,107 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * 租户主题风格
 * @author yeshijie on 2018/10/16.
 */
@ApiModel(value = "SaasThemeVO", description = "租户主题风格")
public class SaasThemeVO extends UuidIdentityVO{
    @ApiModelProperty(value = "saas_id", example = "saas_id")
    private String saasId;
    @ApiModelProperty(value = "组件类型", example = "(1单张图文广告,2多图图文广告,3标题,4中心指标1,5中心指标2)")
    private String type;
    @ApiModelProperty(value = "图片url", example = "图片url")
    private String img;
    @ApiModelProperty(value = "标题", example = "标题")
    private String title;
    @ApiModelProperty(value = "内容/解释说明", example = "解释说明")
    private String content;
    @ApiModelProperty(value = "跳转url", example = "跳转url")
    private String url;
    @ApiModelProperty(value = "字体大小", example = "12")
    private String font;
    @ApiModelProperty(value = "排序", example = "1")
    private Integer sort;
    @ApiModelProperty(value = "type=2,才有值", example = "1")
    List<SaasThemeExtendVO> themeExtendList;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getFont() {
        return font;
    }
    public void setFont(String font) {
        this.font = font;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public List<SaasThemeExtendVO> getThemeExtendList() {
        return themeExtendList;
    }
    public void setThemeExtendList(List<SaasThemeExtendVO> themeExtendList) {
        this.themeExtendList = themeExtendList;
    }
}

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

@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
public class SaasTypeDictVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "Saas类型编码", example = "familyDoctor")
    private String code;
    private Integer code;
    @ApiModelProperty(value = "Saas类型名称", example = "家医型")
    private String name;
@ -21,11 +21,11 @@ public class SaasTypeDictVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "状态(effective-生效中,invalid-已失效)", example = "effective")
    private SaasTypeDictDO.Status status;
    public String getCode() {
    public Integer getCode() {
        return code;
    }
    public void setCode(String code) {
    public void setCode(Integer code) {
        this.code = code;
    }

+ 32 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java

@ -0,0 +1,32 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@ApiModel(value = "SaasUserVO", description = "租户账号")
public class SaasUserVO extends UuidIdentityVO {
    private String saasId;//租户ID
    private String userId;//用户账号
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 20 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasVO.java

@ -49,11 +49,15 @@ public class SaasVO extends UuidIdentityVOWithOperator {
	private String systemName;
	@ApiModelProperty(value = "行政区划代码", example = "361000")
	private String areaNumber;
	@ApiModelProperty(value = "主题色", example = "主题色")
	private String themeColor;
	@ApiModelProperty(value = "机构", example = "机构")
	List<BaseOrgVO> orgList;
	@ApiModelProperty(value = "业务模块", example = "业务模块")
	List<SaasModuleVO> saasModuleList;
	@ApiModelProperty(value = "主题风格", example = "主题风格")
	List<SaasThemeVO> saasThemeList;
	public String getOrgCode() {
@ -199,4 +203,20 @@ public class SaasVO extends UuidIdentityVOWithOperator {
    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }
	public String getThemeColor() {
		return themeColor;
	}
	public void setThemeColor(String themeColor) {
		this.themeColor = themeColor;
	}
	public List<SaasThemeVO> getSaasThemeList() {
		return saasThemeList;
	}
	public void setSaasThemeList(List<SaasThemeVO> saasThemeList) {
		this.saasThemeList = saasThemeList;
	}
}

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxComboVO.java

@ -6,12 +6,15 @@ import io.swagger.annotations.ApiModelProperty;
 * Created by Administrator on 2018/10/9.
 */
public class WxComboVO {
    @ApiModelProperty(value = "微信id")
    private String id;
    @ApiModelProperty(value = "微信公众号")
    private String name;
    @ApiModelProperty(value = "原始id")
    private String appOriginId;
    @ApiModelProperty(value="公众号类型")
    private String publicType;
    public String getId() {
        return id;
@ -36,4 +39,12 @@ public class WxComboVO {
    public void setAppOriginId(String appOriginId) {
        this.appOriginId = appOriginId;
    }
    public String getPublicType() {
        return publicType;
    }
    public void setPublicType(String publicType) {
        this.publicType = publicType;
    }
}

+ 5 - 14
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxGraphicMessageVO.java

@ -7,7 +7,7 @@ import java.util.Date;
 */
public class WxGraphicMessageVO {
    private String id;
    private String saasId;
    private String wechatId;//微信id
    private String title;//标题
    private String description;//描述
    private String url;//图文消息url值
@ -18,7 +18,6 @@ public class WxGraphicMessageVO {
    private String updateUser;//修改人
    private String updateUserName;//修改人名称
    private Date updateTime;//修改时间
    private String remark;//备注
    private Integer status;  //状态 -1删除 0 冻结 1可用
    public String getId() {
@ -109,12 +108,12 @@ public class WxGraphicMessageVO {
        this.updateTime = updateTime;
    }
    public String getRemark() {
        return remark;
    public String getWechatId() {
        return wechatId;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    public void setWechatId(String wechatId) {
        this.wechatId = wechatId;
    }
    public Integer getStatus() {
@ -124,12 +123,4 @@ public class WxGraphicMessageVO {
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
}

+ 240 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/wx/WxWechatSingleVO.java

@ -0,0 +1,240 @@
package com.yihu.jw.restmodel.base.wx;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2018/10/16.
 */
public class WxWechatSingleVO {
    @ApiModelProperty(value = "id")
    private String id;
    @ApiModelProperty(value = "名称")
    private String name;//名称
    @ApiModelProperty(value = "token")
    private String token;//token
    @ApiModelProperty(value = "加密密钥")
    private String encodingAesKey;//加密密钥
    @ApiModelProperty(value = "加密方式  0:明文模式   1:兼容模式   2:安全模式")
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    @ApiModelProperty(value = "类型 -1 已删除 0未认证 1已认证 2 审核中 3.审核未通过'")
    private Integer status;//'类型 -1 已删除 0未认证 1已认证 2 审核中 3.审核未通过'
    @ApiModelProperty(value = "1:服务号 2 订阅号")
    private String type;//'1:服务号 2 订阅号
    @ApiModelProperty(value = "微信app_id")
    private String appId;//'微信app_id'
    @ApiModelProperty(value = "微信app_secret'")
    private String appSecret;//'微信app_secret'
    @ApiModelProperty(value = "原始ID")
    private String appOriginId;//原始ID
    @ApiModelProperty(value = "微信base_url'")
    private String baseUrl;//'微信base_url'
    @ApiModelProperty(value = "公总号登录账户")
    private String userName;//公总号登录账户
    @ApiModelProperty(value = "用户密码")
    private String password;//用户密码
    @ApiModelProperty(value = "1.自运营,2.外接")
    private String publicType;//1.自运营,2.外接
    @ApiModelProperty(value = "备注")
    private String remark;//'备注'
    //创建时间
    @ApiModelProperty(value = "创建时间")
    protected Date createTime;
    //创建者
    @ApiModelProperty(value = "创建者")
    protected String createUser;
    //创建者
    @ApiModelProperty(value = "创建者")
    protected String createUserName;
    //更新时间
    @ApiModelProperty(value = "更新时间")
    protected Date updateTime;
    //更新者
    @ApiModelProperty(value = "更新者")
    protected String updateUser;
    //更新者
    @ApiModelProperty(value = "更新者")
    protected String updateUserName;
    @ApiModelProperty(value = "租户")
    private List<WxSaasVO> saas;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public String getEncodingAesKey() {
        return encodingAesKey;
    }
    public void setEncodingAesKey(String encodingAesKey) {
        this.encodingAesKey = encodingAesKey;
    }
    public Integer getEncType() {
        return encType;
    }
    public void setEncType(Integer encType) {
        this.encType = encType;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppSecret() {
        return appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    public String getAppOriginId() {
        return appOriginId;
    }
    public void setAppOriginId(String appOriginId) {
        this.appOriginId = appOriginId;
    }
    public String getBaseUrl() {
        return baseUrl;
    }
    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getPublicType() {
        return publicType;
    }
    public void setPublicType(String publicType) {
        this.publicType = publicType;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public List<WxSaasVO> getSaas() {
        return saas;
    }
    public void setSaas(List<WxSaasVO> saas) {
        this.saas = saas;
    }
}

+ 4 - 0
gateway/ag-basic/pom.xml

@ -41,6 +41,10 @@
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>

+ 1 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -61,7 +61,7 @@ public class BasicZuulFilter extends ZuulFilter {
        String url = request.getRequestURI();
        //内部微服务有不需要认证的地址请在URL上追加/open/来进行过滤,如/api/v1.0/open/**,不要在此继续追加!!!
        if (url.contains("/auth/")//验证服务
                || url.contains("/wechat/")//微信
                || url.contains("/wechat")//微信
                || url.contains("/open/")) {//开发接口
            return true;
        }

+ 4 - 4
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -118,10 +118,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "password");
            //解密密码
//            if (parameters.get("password") != null) {
//                RSAPrivateKey rsaPrivateKey = (RSAPrivateKey)httpSession.getAttribute("privateKey");
//                parameters.put("password", RSAUtils.decryptByPrivateKey(new String(Base64.decodeBase64(parameters.get("password"))), rsaPrivateKey));
//            }
            if (parameters.get("password") != null) {
                RSAPrivateKey rsaPrivateKey = (RSAPrivateKey)httpSession.getAttribute("privateKey");
                parameters.put("password", RSAUtils.decryptByPrivateKey(new String(Base64.decodeBase64(parameters.get("password"))), rsaPrivateKey));
            }
        } else {
            parameters.put("grant_type", "captcha");
        }

+ 2 - 2
server/svr-configuration/src/main/resources/bootstrap.yml

@ -10,7 +10,7 @@ spring:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/jiwei/wlyy2.0.config.git}
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:jwdev}
@ -23,7 +23,7 @@ spring:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/jiwei/wlyy2.0.config.git}
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:jwdev}

+ 1 - 1
server/svr-discovery/pom.xml

@ -13,7 +13,7 @@
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-discovery</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->

+ 3 - 3
server/svr-discovery/src/main/resources/application.yml

@ -16,10 +16,10 @@ security:
eureka:
  server:
    enable-self-preservation: false  #是否开启自我保护模式,默认为true。
    eviction-interval-timer-in-ms: 60000 #eureka server清理无效节点的时间间隔,默认60000毫秒,即60秒
    #eviction-interval-timer-in-ms: 60000 #eureka server清理无效节点的时间间隔,默认60000毫秒,即60秒
  client:
    register-with-eureka: false
    registry-fetch-interval-seconds: 30 #定期的更新客户端的服务清单 30秒更新一次
    fetch-registry: false #如果是做高可用的发现服务那就要改成true
    fetch-registry: false #如果是做高可用的发现服务那就要改成 true
    #registry-fetch-interval-seconds: 30 #定期的更新客户端的服务清单 30秒更新一次
    service-url:
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka/

+ 44 - 0
svr/svr-base/pom.xml

@ -128,7 +128,51 @@
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>1.3.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>mailapi</artifactId>
                    <groupId>javax.mail</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 发送邮件 -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 end -->
    </dependencies>

+ 11 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseCityDao.java

@ -1,21 +1,24 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseCityDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 城市字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong 	1.0  		2018年08月31日 	Created
 *
 *          </pre>
 * @since 1.
 */
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO>  {
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO> {
    @Query("select name from BaseCityDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 10 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseProvinceDao.java

@ -1,21 +1,23 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 省字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong 	1.0  		2018年08月31日 	Created
 *
 *                   </pre>
 * @since 1.
 */
public interface BaseProvinceDao extends PagingAndSortingRepository<BaseProvinceDO, Integer>, JpaSpecificationExecutor<BaseProvinceDO>  {
public interface BaseProvinceDao extends PagingAndSortingRepository<BaseProvinceDO, Integer>, JpaSpecificationExecutor<BaseProvinceDO> {
    @Query("select name from BaseProvinceDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 11 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseTownDao.java

@ -1,21 +1,24 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseTownDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 区县字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong 	1.0  		2018年08月31日 	Created
 *
 *          </pre>
 * @since 1.
 */
public interface BaseTownDao extends PagingAndSortingRepository<BaseTownDO, Integer>, JpaSpecificationExecutor<BaseTownDO>  {
public interface BaseTownDao extends PagingAndSortingRepository<BaseTownDO, Integer>, JpaSpecificationExecutor<BaseTownDO> {
    @Query("select name from BaseTownDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictDiseaseDao.java

@ -1,7 +1,7 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -31,4 +31,6 @@ public interface DictDiseaseDao extends PagingAndSortingRepository<DictDiseaseDO
    @Query("select code as code,name as name from DictDiseaseDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictDiseaseDO> findBySaasId(String saasId);
}

+ 2 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHealthProblemDao.java

@ -31,4 +31,6 @@ public interface DictHealthProblemDao extends PagingAndSortingRepository<DictHea
    @Query("select code as code,name as name from DictHealthProblemDO")
    List<Map<String,Object>> findCodeAndName();
    List<DictHealthProblemDO> findBySaasId(String saasId);
}

+ 4 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java

@ -1,15 +1,13 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictHealthProblemDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import java.util.List;
import java.util.Map;
@ -32,4 +30,6 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    @Query("select code as code,name as name from DictHospitalDeptDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictHospitalDeptDO> findBySaasId(String saasId);
}

+ 4 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java

@ -1,14 +1,12 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import feign.Param;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import java.util.List;
import java.util.Map;
@ -31,4 +29,6 @@ public interface DictIcd10Dao extends PagingAndSortingRepository<DictIcd10DO, In
    @Query("select code as code,name as name from DictIcd10DO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictIcd10DO> findBySaasId(String saasId);
}

+ 4 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictJobTitleDao.java

@ -1,14 +1,13 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictMedicineDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import java.util.List;
import java.util.Map;
@ -31,4 +30,6 @@ public interface DictJobTitleDao extends PagingAndSortingRepository<DictJobTitle
    @Query("select code as code,name as name from DictJobTitleDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictJobTitleDO> findBySaasId(String saasId);
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictMedicineDao.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictMedicineDO;
import com.yihu.jw.entity.base.system.SystemDictDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -30,4 +31,6 @@ public interface DictMedicineDao extends PagingAndSortingRepository<DictMedicine
    @Query("select code as code,name as name from DictMedicineDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictMedicineDO> findBySaasId(String saasId);
}

+ 6 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -1,12 +1,12 @@
package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.data.domain.Pageable;
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.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import java.util.List;
import java.util.Map;
@ -46,4 +46,8 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    List<BaseOrgDO> findOrgByArea();
    boolean existsByCode(String code);
    @Modifying
    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/population/BaseYearDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.population;
import com.yihu.jw.entity.base.population.BaseYearDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zdm on 2018/10/12.
 */
public interface BaseYearDao extends PagingAndSortingRepository<BaseYearDO, String>, JpaSpecificationExecutor<BaseYearDO>  {
    @Query("select year from BaseYearDO ")
    List<String> findYears();
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/BaseEmailTemplateConfigDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.BaseEmailTemplateConfigDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Dao - BaseEmailTemplateConfig
 * Created by zdm on 2018/8/14.
 */
public interface BaseEmailTemplateConfigDao extends PagingAndSortingRepository<BaseEmailTemplateConfigDO, String> {
    BaseEmailTemplateConfigDO findById(String id);
    BaseEmailTemplateConfigDO findByTemplateName(String templateName);
    BaseEmailTemplateConfigDO findByCode(String code);
}

+ 13 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasThemeDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.SaasThemeDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 租户主题风格
 * @author yeshijie on 2018/10/16.
 */
public interface SaasThemeDao extends PagingAndSortingRepository<SaasThemeDO, String> {
}

+ 13 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasThemeExtendDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.SaasThemeExtendDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 主题风格扩展表(type=2时存多图)
 * @author yeshijie on 2018/10/16.
 */
public interface SaasThemeExtendDao extends PagingAndSortingRepository<SaasThemeExtendDO, String> {
}

+ 13 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
public interface SaasUserDao extends PagingAndSortingRepository<SaasUserDO, String> {
}

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java

@ -4,9 +4,13 @@ import com.yihu.jw.entity.base.system.SystemDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Dao - 系统字典
 * Created by LiTaohong on 2017/12/01.
 */
public interface SystemDictDao extends PagingAndSortingRepository<SystemDictDO, String>, JpaSpecificationExecutor<SystemDictDO> {
    List<SystemDictDO> findBySaasId(String saasId);
}

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java

@ -4,9 +4,13 @@ import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Dao - 系统字典项
 * Created by LiTaohong on 2017/12/01.
 */
public interface SystemDictEntryDao extends PagingAndSortingRepository<SystemDictEntryDO, String>, JpaSpecificationExecutor<SystemDictEntryDO> {
    List<SystemDictEntryDO> findBySaasId(String saasId);
}

+ 2 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java

@ -26,4 +26,6 @@ public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String
    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
    WxWechatDO findByAppOriginId(String appOriginId);
    List<WxWechatDO> findByName(String name);
}

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxGraphicSceneDao.java

@ -4,8 +4,12 @@ import com.yihu.jw.entity.base.wx.WxGraphicSceneDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2018/10/9.
 */
public interface WxGraphicSceneDao extends PagingAndSortingRepository<WxGraphicSceneDO, String>, JpaSpecificationExecutor<WxGraphicSceneDO> {
    List<WxGraphicSceneDO> findByWechatIdAndScene(String wechatId,String scene);
}

+ 2 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxGraphicSceneGroupDao.java

@ -12,4 +12,6 @@ import java.util.List;
public interface WxGraphicSceneGroupDao extends PagingAndSortingRepository<WxGraphicSceneGroupDO, String>, JpaSpecificationExecutor<WxGraphicSceneGroupDO> {
    List<WxGraphicSceneGroupDO> findByWechatIdAndScene(String wechatId, String scene);
    WxGraphicSceneGroupDO findByWechatIdAndSceneAndGraphicId(String wechatId, String scene,String graphicId);
}

+ 66 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelReader.java

@ -0,0 +1,66 @@
package com.yihu.jw.base.endpoint.common.excel;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class AExcelReader {
    protected List errorLs = new ArrayList<>();
    protected List correctLs = new ArrayList<>();
    protected Map<String, Set> repeat = new HashMap<>();
    public abstract void read(Workbook rwb) throws Exception;
    public void read(MultipartFile file) throws Exception {
        read(ExcelUtils.getWorkBook(file));
    }
    public static String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            str = str.replaceAll("\\u00A0" ," ");
            //去除字符串中的空格、回车、换行符、制表符
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
    protected String getCellCont(Sheet sheet, int row, int col){
        Cell cell = sheet.getRow(row).getCell(col);
        return ExcelUtils.getCellValue(cell);
    }
    public List getErrorLs() {
        return errorLs;
    }
    public void setErrorLs(List errorLs) {
        this.errorLs = errorLs;
    }
    public List getCorrectLs() {
        return correctLs;
    }
    public void setCorrectLs(List correctLs) {
        this.correctLs = correctLs;
    }
    public Map<String, Set> getRepeat() {
        return repeat;
    }
    public void setRepeat(Map<String, Set> repeat) {
        this.repeat = repeat;
    }
}

+ 71 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelWriter.java

@ -0,0 +1,71 @@
package com.yihu.jw.base.endpoint.common.excel;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.*;
import java.io.File;
import java.util.List;
public abstract class AExcelWriter {
    public abstract void write(Workbook wwb, List ls, File file) throws Exception;
//    public void write(OutputStream os, List ls) throws Exception{
//        write(Workbook.createWorkbook(os), ls);
//    };
    public void write( File file, List ls) throws Exception{
        write(ExcelUtils.getWorkBook(file),ls,file);
    };
    //添加单元格内容
    public void addCell(Sheet ws, int row, int column, String data )  {
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public  void addCell(Sheet ws, int row, int column, String data , String memo)  {
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public void addCell(Workbook wb,Sheet ws, int row, int column, String data, String memo)  {
        //1.得到一个POI的工具类
        CreationHelper factory = wb.getCreationHelper();
        //2 得到一个换图的对象
        Drawing drawing = ws.createDrawingPatriarch();
        //3. ClientAnchor是附属在WorkSheet上的一个对象,  其固定在一个单元格的左上角和右下角.
        ClientAnchor anchor = factory.createClientAnchor();
        //4  获取行
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellValue(data);
        //5 设置注释
        anchor.setCol1(cell.getColumnIndex());
        anchor.setCol2(cell.getColumnIndex() + 2);
        anchor.setRow1(row1.getRowNum());
        anchor.setRow2(row1.getRowNum() + 3);
        if(!StringUtils.isEmpty(memo)){
            Comment comment0 = drawing.createCellComment(anchor);
            RichTextString richTextString = factory.createRichTextString(memo);
            comment0.setString(richTextString);
            cell.setCellComment(comment0);
        }
    }
}

+ 546 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/ExcelUtils.java

@ -0,0 +1,546 @@
package com.yihu.jw.base.endpoint.common.excel;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * excel 工具类
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2017/3/2.
 */
public class ExcelUtils extends AExcelWriter {
    private static Logger logger = LoggerFactory.getLogger(ExcelUtils.class);
    private final static String xls = "xls";
    private final static String xlsx = "xlsx";
    /**
     * 总行数
     */
    private int totalRows = 0;
    /**
     * 总列数
     */
    private int totalCells = 0;
    public int getTotalRows() {
        return totalRows;
    }
    public int getTotalCells() {
        return totalCells;
    }
    /**
     * 创建Excel文档
     *
     * @return
     */
    public static HSSFWorkbook createWorkBook() {
        return new HSSFWorkbook();
    }
    /**
     * 创建sheet
     *
     * @param wb
     * @param sheetName
     * @return
     */
    public static HSSFSheet createSheet(HSSFWorkbook wb, String sheetName) {
        return wb.createSheet(sheetName);
    }
    /**
     * 创建一行多列
     *
     * @param sheet
     * @param rowNum
     * @param columnNum
     * @param cellStyle
     * @return
     */
    public static HSSFRow createRow(HSSFSheet sheet, int rowNum, int columnNum, HSSFCellStyle cellStyle) {
        HSSFRow row = sheet.createRow(rowNum);
        if (columnNum > 0) {
            for (int i = 0; i < columnNum; i++) {
                HSSFCell cell = row.createCell(i);
                if (cellStyle != null) {
                    cell.setCellStyle(cellStyle);
                }
            }
        }
        return row;
    }
    /**
     * 创建多行多列
     *
     * @param sheet`
     * @param rowNum
     * @param rowCount
     * @param columnNum
     * @param cellStyle
     * @return
     */
    public static boolean createRows(HSSFSheet sheet, int rowNum, int rowCount, int columnNum, HSSFCellStyle cellStyle) {
        for (int i = 0; i < rowCount; i++) {
            HSSFRow row = sheet.createRow(rowNum + i);
            if (columnNum > 0) {
                for (int j = 0; j < columnNum; j++) {
                    HSSFCell cell = row.createCell(j);
                    if (cellStyle != null) {
                        cell.setCellStyle(cellStyle);
                    }
                }
            }
        }
        return true;
    }
    /**
     * 合并单元格
     *
     * @param sheet
     * @param firstRow
     * @param lastRow
     * @param firstCol
     * @param lastCol
     * @return
     */
    public static int mergeRegion(HSSFSheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
        int num = sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
        return num;
    }
    /**
     * 创建单元格样式
     *
     * @param wb
     * @param align
     * @param bold
     * @param border
     * @param backColor
     * @return
     */
    public static HSSFCellStyle createCellStyle(HSSFWorkbook wb, short align, boolean bold, boolean border, short backColor) {
        HSSFCellStyle style = wb.createCellStyle();
        //字体
        HSSFFont font = wb.createFont();
        font.setBold(bold);
        font.setFontName("宋体");
        font.setFontHeight((short) 220);
        style.setFont(font);
        //设置对齐
//        style.setAlignment(align);
//        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        if (border) {
            // 设置边框
//            style.setBottomBorderColor(HSSFColor.BLACK.index);
//            style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//            style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//            style.setBorderRight(HSSFCellStyle.BORDER_THIN);
//            style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        }
        if (backColor > 0) {
            style.setFillBackgroundColor((short) backColor);
        }
        return style;
    }
    /* **************************************** Excel 读取 *************************************************************** */
    /**
     * 读取Excel内容
     *
     * @param is       Excel文件流
     * @param fileName excel文件名,包括后缀
     * @return
     * @throws IOException
     */
    public static List<Map<Object, Object>> readExcel(InputStream is, String fileName) throws IOException {
        List<Map<Object, Object>> list = null;
        boolean isExcel2007 = isExcel2007(fileName);
        if (isExcel2007) {
            list = readExcel2007(is);
        } else {
            list = readExcel2003(is);
        }
        return list;
    }
    /**
     *  读取Excel2003内容
     * @param is  Excel文件流
     * @return
     * @throws IOException
     */
    public static List<Map<Object, Object>> readExcel2003(InputStream is) throws IOException {
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
        Map<Object, Object> student = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        // 循环工作表Sheet
        for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
            if (hssfSheet == null) {
                continue;
            }
            //获取表头字段
            HSSFRow columnName = hssfSheet.getRow(0);
            // 循环行Row
            for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow != null) {
                    student = setCellVal(columnName, hssfRow);
                    list.add(student);
                }
            }
        }
        return list;
    }
    /**
     * 获取Excel单元格的值
     * @param hssfCell  单元格对象
     * @return
     */
    @SuppressWarnings("static-access")
    public static Object getExcelValue(HSSFCell hssfCell) {
        if(hssfCell==null){
            return null;
        }else  if (hssfCell.getCellType() == hssfCell.CELL_TYPE_BOOLEAN) {
            // 返回布尔类型的值
            return hssfCell.getBooleanCellValue();
        } else if (hssfCell.getCellType() == hssfCell.CELL_TYPE_NUMERIC) {
            // 返回数值类型的值
            return (int)hssfCell.getNumericCellValue();
        } else {
            // 返回字符串类型的值
            return hssfCell.getStringCellValue();
        }
    }
    /**
     * 获取Excel2007的内容
     * @param is    输入流
     * @return
     */
    public static List<Map<Object, Object>> readExcel2007(InputStream is) {
        XSSFWorkbook hssfWorkbook = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        try {
            hssfWorkbook = new XSSFWorkbook(is);
            Map<Object, Object> result = null;
            // 循环工作表Sheet
            for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
                XSSFSheet xssfSheet = hssfWorkbook.getSheetAt(numSheet);
                if (xssfSheet == null) {
                    continue;
                }
                //获取表头字段
                XSSFRow columnName = xssfSheet.getRow(0);
                // 循环行Row
                for (int rowNum = 1; rowNum <= xssfSheet.getLastRowNum(); rowNum++) {
                    XSSFRow hssfRow = xssfSheet.getRow(rowNum);
                    if (hssfRow != null) {
                        result = setCellVal(columnName, hssfRow);
                        list.add(result);
                    }
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return list;
    }
    @SuppressWarnings("static-access")
    public static Object getExcelValue(XSSFCell xssfCell) {
        if(xssfCell==null){
            return null;
        }else if (xssfCell.getCellType() == xssfCell.CELL_TYPE_BOOLEAN) {
            // 返回布尔类型的值
            return xssfCell.getBooleanCellValue();
        } else if (xssfCell.getCellType() == xssfCell.CELL_TYPE_NUMERIC) {
            // 返回数值类型的值
            return (int)xssfCell.getNumericCellValue();
        } else {
            // 返回字符串类型的值
            return xssfCell.getStringCellValue();
        }
    }
    public static Map<Object, Object> setCellVal(XSSFRow names, XSSFRow values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getExcelValue(names.getCell(i));
            value = getExcelValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    public static Map<Object, Object> setCellVal(HSSFRow names, HSSFRow values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getExcelValue(names.getCell(i));
            value = getExcelValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    public static boolean isExcel2007(String filePath) {
        return filePath.matches("^.+\\.(?i)(xlsx)$");
    }
    /* ********************************  重写poi,2018-05-16 by hzy   ******************************************* */
    /**
     * 获取excel对象
     * @param file
     * @return
     */
    public static Workbook getWorkBook(MultipartFile file) {
        //获得文件名
        String fileName = file.getOriginalFilename();
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        try {
            //获取excel文件的io流
            InputStream is = file.getInputStream();
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook(is);
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook(is);
            }
        } catch (IOException e) {
            e.printStackTrace();
            logger.info(e.getMessage());
        }
        return workbook;
    }
    /**
     * 获取Excel的内容
     * @param file    上传的文件
     * @return
     */
    public static List<Map<Object, Object>> readExcel (File file) {
        Workbook workBook = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        try {
            workBook = getWorkBook(file);
            Map<Object, Object> result = null;
            // 循环工作表Sheet
            for (int numSheet = 0; numSheet < workBook.getNumberOfSheets(); numSheet++) {
                Sheet sheet = workBook.getSheetAt(numSheet);
                if (sheet == null) {
                    continue;
                }
                //获取表头字段
                Row columnName = sheet.getRow(0);
                // 循环行Row
                for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
                    Row hssfRow = sheet.getRow(rowNum);
                    if (hssfRow != null) {
                        result = setCellVal(columnName, hssfRow);
                        list.add(result);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
    /**
     * 设置单元格值
     * @param names
     * @param values
     * @return
     */
    public static Map<Object, Object> setCellVal(Row names, Row values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getCellValue(names.getCell(i));
            value = getCellValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    /**
     * 获取excel对象
     * @param file
     * @return
     */
    public static Workbook getWorkBook(File file) throws IOException {
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        FileOutputStream fileOut = null;
        try {
            //获得文件名
            String fileName = file.getName();
            //创建excel文件的out流
             fileOut = new FileOutputStream(file);
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook();
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook();
            }
            workbook.write(fileOut);
        } catch (IOException e) {
            e.printStackTrace();
            logger.info(e.getMessage());
        }finally {
            if (fileOut!=null){
                fileOut.flush();
                fileOut.close();
            }
        }
        return workbook;
    }
    /**
     * 获取excel对象
     * @param is
     * @return
     */
    public static Workbook getWorkBook(String fileName,InputStream is) {
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        try {
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook(is);
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook(is);
            }
        } catch (IOException e) {
            logger.info(e.getMessage());
        }
        return workbook;
    }
    /**
     *   获取单元格值
     * @param cell     excel单元格对象
     * @return
     */
    public static String getCellValue(Cell cell){
        String cellValue = "";
        if(cell == null){
            return cellValue;
        }
        //把数字当成String来读,避免出现1读成1.0的情况
        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
            cell.setCellType(Cell.CELL_TYPE_STRING);
        }
        //判断数据的类型
        switch (cell.getCellType()){
            case Cell.CELL_TYPE_NUMERIC: //数字
                cellValue = String.valueOf(cell.getNumericCellValue());
                break;
            case Cell.CELL_TYPE_STRING: //字符串
                cellValue = String.valueOf(cell.getStringCellValue());
                break;
            case Cell.CELL_TYPE_BOOLEAN: //Boolean
                cellValue = String.valueOf(cell.getBooleanCellValue());
                break;
            case Cell.CELL_TYPE_FORMULA: //公式
                cellValue = String.valueOf(cell.getCellFormula());
                break;
            case Cell.CELL_TYPE_BLANK: //空值
                cellValue = "";
                break;
            case Cell.CELL_TYPE_ERROR: //故障
                cellValue = "非法字符";
                break;
            default:
                cellValue = "未知类型";
                break;
        }
        return cellValue;
    }
    public void addCell(Sheet ws, int row, int column, String data )  {
        Row row1 = ws.createRow(row);
        Cell cell = row1.createCell(column);
        cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public static void addCellData(Sheet sheet, int column, int row, String data){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
    }
    //添加单元格内容带样式
    public static void addCellData(Sheet sheet, int column, int row, String data, CellStyle cellStyle){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
        cell.setCellStyle(cellStyle);
    }
    @Override
    public void write(Workbook wwb, List ls, File file) throws Exception {
    }
}

+ 224 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsg.java

@ -0,0 +1,224 @@
package com.yihu.jw.base.endpoint.common.populationBatchImport;
import com.yihu.jw.util.excel.ExcelUtil;
import com.yihu.jw.util.excel.Validation;
import com.yihu.jw.util.excel.annotation.Location;
import com.yihu.jw.util.excel.annotation.Row;
import com.yihu.jw.util.excel.annotation.Title;
import com.yihu.jw.util.excel.annotation.ValidRepeat;
import javax.persistence.Column;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
 *  基础人口信息列表-excel实体类
 *
 * @author zdm
 * @vsrsion 1.0
 * Created at 2018/10/15.
 */
@Row(start = 1)
@Title(names= "{'租户名称', '时间','常住人口', '户籍人口', '糖尿病人数', '高血压人数', '任务数'}")
public class PopulationMsg extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String saasName;
    @Location(x=1)
    @ValidRepeat
    String year;
    @Location(x=2)
    @ValidRepeat
    Integer populationNum;
    @Location(x=3)
    @ValidRepeat
    Integer regisPopulationNum;
    @Location(x=4)
    @ValidRepeat
    Integer dmNum;
    @Location(x=5)
    @ValidRepeat
    Integer hbpNum;
    @Location(x=6)
    @ValidRepeat
    Integer taskNum;
    private String  saasId;
    //租户创建时间
    private Date saasCreateTime;
    //所属省代码
    private String  provinceCode;
    //省份名称
    private String  provinceName;
    //城市编码
    private String  cityCode;
    //城市名称
    private String  cityName;
    //所属区代码
    private String  districtCode;
    //区名
    private String  districtName;
    //慢病人数
    private Integer ncdNum;
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        if(!repeatMap.get("saasName").add(saasName+year)){
            rs = 0;
            addErrorMsg("saasName", "已添加"+year+saasName+"的基础人口信息,请直接修改即可");
        }
        if(populationNum<0){
            rs = 0;
            addErrorMsg("populationNum", "常住人口数不能小于0!");
        }
        if(regisPopulationNum<0){
            rs = 0;
            addErrorMsg("regisPopulationNum", "户籍人口数不能小于0!");
        }
        if(dmNum<0){
            rs = 0;
            addErrorMsg("dmNum", "糖尿病人口不能小于0!");
        }
        if(hbpNum<0){
            rs = 0;
            addErrorMsg("hbpNum", "高血压人口不能小于0!");
        }
        if(taskNum<0){
            rs = 0;
            addErrorMsg("taskNum", "任务数不能小于0!");
        }
        return rs;
    }
    public String getSaasName() {
        return saasName;
    }
    public void setSaasName(String saasName) {
        this.saasName = saasName;
    }
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public Integer getPopulationNum() {
        return populationNum;
    }
    public void setPopulationNum(Integer populationNum) {
        this.populationNum = populationNum;
    }
    public Integer getRegisPopulationNum() {
        return regisPopulationNum;
    }
    public void setRegisPopulationNum(Integer regisPopulationNum) {
        this.regisPopulationNum = regisPopulationNum;
    }
    public Integer getDmNum() {
        return dmNum;
    }
    public void setDmNum(Integer dmNum) {
        this.dmNum = dmNum;
    }
    public Integer getHbpNum() {
        return hbpNum;
    }
    public void setHbpNum(Integer hbpNum) {
        this.hbpNum = hbpNum;
    }
    public Integer getTaskNum() {
        return taskNum;
    }
    public void setTaskNum(Integer taskNum) {
        this.taskNum = taskNum;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
    public String getDistrictName() {
        return districtName;
    }
    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
}

+ 64 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsgReader.java

@ -0,0 +1,64 @@
package com.yihu.jw.base.endpoint.common.populationBatchImport;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import java.util.*;
/**
 * 基础人口信息列表-excel解析类
 *
 * @author zdm
 * @vsrsion 1.0
 * Created at 2018/10/15.
 */
public class PopulationMsgReader extends AExcelReader {
    @Override
    public void read(Workbook rwb) throws Exception {
        try {
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            PopulationMsg populationMsg;
            getRepeat().put("saasName", new HashSet<>());
            getRepeat().put("year", new HashSet<>());
            getRepeat().put("populationNum", new HashSet<>());
            getRepeat().put("regisPopulationNum", new HashSet<>());
            getRepeat().put("dmNum", new HashSet<>());
            getRepeat().put("hbpNum", new HashSet<>());
            getRepeat().put("taskNum", new HashSet<>());
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    populationMsg = new PopulationMsg();
                    populationMsg.setSaasName(replaceBlank(getCellCont(sheet, i, 0)));
                    populationMsg.setYear(replaceBlank(getCellCont(sheet, i, 1)));
                    populationMsg.setPopulationNum(null == getCellCont(sheet, i, 2) ? 0 : Integer.valueOf(getCellCont(sheet, i, 2).trim()));
                    populationMsg.setRegisPopulationNum(null == getCellCont(sheet, i, 3) ? 0 : Integer.valueOf(getCellCont(sheet, i, 3).trim()));
                    populationMsg.setDmNum(null == getCellCont(sheet, i, 4) ? 0 : Integer.valueOf(getCellCont(sheet, i, 4).trim()));
                    populationMsg.setHbpNum(null == getCellCont(sheet, i, 5) ? 0 : Integer.valueOf(getCellCont(sheet, i, 5).trim()));
                    populationMsg.setTaskNum(null == getCellCont(sheet, i, 6) ? 0 : Integer.valueOf(getCellCont(sheet, i, 6).trim()));
                    int rs = populationMsg.validate(repeat);
                    if (rs == 0) {
                        errorLs.add(populationMsg);
                    } else if (rs == 1) {
                        correctLs.add(populationMsg);
                    }
                }
                j++;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
}

+ 12 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/errorCode/ErrorCodeEndpoint.java

@ -5,6 +5,7 @@ import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.dict.ErrorCodeDO;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.restmodel.base.dict.ErrorCodeVO;
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;
@ -31,7 +32,7 @@ public class ErrorCodeEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ErrorCodeUtil errorCodeUtil;
    @PostMapping(value = BaseRequestMapping.Menu.CREATE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.ErrorCode.CREATE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<ErrorCodeVO> create (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
@ -44,7 +45,14 @@ public class ErrorCodeEndpoint extends EnvelopRestEndpoint {
        return success(errorCodeDO, ErrorCodeVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Menu.UPDATE)
    @PostMapping(value = BaseRequestMapping.ErrorCode.INIT_WITHOUT_CONDITION,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "初始化")
    public Envelop initWithoutCondition () throws Exception {
        errorCodeService.initWithoutCondition();
        return success("初始化成功");
    }
    @PostMapping(value = BaseRequestMapping.ErrorCode.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<ErrorCodeVO> update (
            @ApiParam(name = "id", value = "id")
@ -59,7 +67,7 @@ public class ErrorCodeEndpoint extends EnvelopRestEndpoint {
        return success(errorCodeDO, ErrorCodeVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Menu.PAGE)
    @GetMapping(value = BaseRequestMapping.ErrorCode.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<ErrorCodeVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -77,7 +85,7 @@ public class ErrorCodeEndpoint extends EnvelopRestEndpoint {
        return success(errorCodeDOS, count, page, size, ErrorCodeVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Menu.LIST)
    @GetMapping(value = BaseRequestMapping.ErrorCode.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<ErrorCodeVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")

+ 144 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java

@ -0,0 +1,144 @@
package com.yihu.jw.base.endpoint.open.register;
import com.yihu.jw.base.dao.saas.BaseEmailTemplateConfigDao;
import com.yihu.jw.base.service.saas.SaasService;
import com.yihu.jw.base.service.saas.SaasTypeDictService;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.saas.BaseEmailTemplateConfigDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.saas.SaasTypeDictDO;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.restmodel.base.saas.SaasTypeDictVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
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.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * @author yeshijie on 2018/10/16.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.RegisterSaas.PREFIX)
@Api(value = "注册Saas管理", description = "注册Saas管理服务接口", tags = {"wlyy基础服务 - 注册Saas管理服务接口"})
public class RegisterEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SaasService saasService;
    @Autowired
    private UserService userService;
    @Autowired
    private ErrorCodeUtil errorCodeUtil;
    @Autowired
    private JavaMailSender jms;
    @Value("${spring.mail.username}")
    private String username;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private SaasTypeDictService saasTypeDictService;
    @Autowired
    private BaseEmailTemplateConfigDao emailTemplateConfigDao;
    /**
     * 验证码redis前缀
     */
    private final String redisPrefix = "verificationCode:";
    @PostMapping(value = BaseRequestMapping.RegisterSaas.REGISTER, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册租户")
    public Envelop create (
            @ApiParam(name = "jsonSaas", value = "租户数据", required = true)
            @RequestParam String jsonSaas,
            @ApiParam(name = "captcha", value = "验证码", required = true)
            @RequestParam String captcha) throws Exception {
        SaasDO saasDO = toEntity(jsonSaas, SaasDO.class);
        String redisKey = redisPrefix + saasDO.getEmail();
        String verificationCode = redisTemplate.opsForValue().get(redisKey);
        if(!captcha.equals(verificationCode)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.CAPTCHA_IS_ERROR), Envelop.class);
        }
        if (saasService.search("name=" + saasDO.getName()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST), Envelop.class);
        }
        if (userService.search("mobile=" + saasDO.getMobile()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.MOBILE_IS_EXIST), Envelop.class);
        }
        if (userService.search("username=" + saasDO.getEmail()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
        }
        saasService.create(saasDO);
        //注册成功后 吧key删除
        redisTemplate.delete(redisKey);
        return success("注册申请成功");
    }
    @GetMapping(value = BaseRequestMapping.RegisterSaas.SAAS_TYPE_DICT)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<SaasTypeDictVO> list() throws Exception {
        List<SaasTypeDictDO> saasTypeDictDOS = saasTypeDictService.search(null, "status="+SaasTypeDictDO.Status.effective, null);
        return success(saasTypeDictDOS, SaasTypeDictVO.class);
    }
    @PostMapping(value = BaseRequestMapping.RegisterSaas.NAME_IS_EXIST)
    @ApiOperation(value = "租户名称是否存在")
    public Envelop create (
            @ApiParam(name = "name", value = "租户名称", required = true)
            @RequestParam String name) throws Exception {
        if (saasService.search("name=" + name).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST2), Envelop.class);
        }
        return success("查询成功");
    }
    @PostMapping(value = BaseRequestMapping.RegisterSaas.SEND_EMAIL)
    @ApiOperation(value = "邮件发送")
    public Envelop send(@ApiParam(name = "email", value = "邮箱地址", required = true)
                         @RequestParam String email) throws Exception {
        //建立邮件消息
        SimpleMailMessage mainMessage = new SimpleMailMessage();
        //发送者
        mainMessage.setFrom(username);
        //接收者
        mainMessage.setTo(email);
        //发送的标题
        //查找发送模板
        BaseEmailTemplateConfigDO emailTemplateConfigDO = emailTemplateConfigDao.findByTemplateName("租户注册-验证码");
        StringBuilder content = null;
        String captcha = String.valueOf(Math.random()).substring(2, 8);
        if(emailTemplateConfigDO == null){
            //发送的内容
            content =  new StringBuilder("您好!\n感谢您注册健康之路城市i健康。\n");
            content.append("您的验证码是:").append(captcha);
            content.append("。 (验证码10分钟内有效)");
        }else {
            //发送的内容
            content =  new StringBuilder(emailTemplateConfigDO.getFirst());
            content.append("\n").append(emailTemplateConfigDO.getKeyword1()).append("\n")
                    .append(emailTemplateConfigDO.getKeyword2()).append(captcha)
                    .append(emailTemplateConfigDO.getKeyword3()).append("\n")
                    .append(emailTemplateConfigDO.getKeyword5()).append(emailTemplateConfigDO.getUrl())
                    .append("\n").append("\n").append(emailTemplateConfigDO.getRemark());
        }
        mainMessage.setSubject("租户注册-验证码");
        mainMessage.setText(content.toString());
        jms.send(mainMessage);
        redisTemplate.opsForValue().set(redisPrefix + email, captcha, 10, TimeUnit.MINUTES);
        return success("发送成功");
    }
}

+ 13 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.base.endpoint.org;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -21,8 +22,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import com.yihu.jw.entity.base.org.BaseOrgDO;
/**
 * 机构信息控制器
 *
@ -108,6 +107,18 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
        return success(baseOrgs, BaseOrgVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BaseOrg.getOrgAreaTree)
    @ApiOperation(value = "获取机构树")
    public Envelop getOrgAreaTree (
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = false) String saasId) throws Exception {
       if(StringUtils.isEmpty(saasId)){
           return success(baseOrgService.getOrgAreaTree());
       }else {
           return success(baseOrgService.getOrgAreaTree(saasId));
       }
    }
    @PostMapping(value = BaseRequestMapping.BaseOrg.baseInfoList)
    @ApiOperation(value = "获取机构基础信息列表")

+ 322 - 58
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BasePopulationEndpoint.java

@ -1,7 +1,16 @@
package com.yihu.jw.base.endpoint.population;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.base.endpoint.common.populationBatchImport.*;
import com.yihu.jw.base.service.area.BaseCityService;
import com.yihu.jw.base.service.area.BaseProvinceService;
import com.yihu.jw.base.service.area.BaseTownService;
import com.yihu.jw.base.service.population.BasePopulationService;
import com.yihu.jw.base.service.saas.SaasService;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.population.BasePopulationDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.base.population.BasePopulationVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -12,93 +21,348 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
/**
*
* 基础人口基数信息控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年09月26日 	update
 * 基础人口基数信息控制器
 *
 * </pre>
* @since 1.
*/
 * @version <pre>
 *           Author	Version		Date		Changes
 *           litaohong 	1.0  		2018年09月26日 	update
 *
 *           </pre>
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BasePopulation.PREFIX)
@Api(value = "基础人口基数信息管理", description = "基础人口基数信息管理服务接口", tags = {"wlyy基础服务 - 基础人口基数信息管理服务接口"})
public class BasePopulationEndpoint extends EnvelopRestEndpoint {
@Autowired
private BasePopulationService basePopulationService;
@PostMapping(value = BaseRequestMapping.BasePopulation.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BasePopulationVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
    basePopulation = basePopulationService.save(basePopulation);
    return success(basePopulation, BasePopulationVO.class);
    @Autowired
    private BasePopulationService basePopulationService;
    @Autowired
    private SaasService saasService;
    @Autowired
    private BaseTownService baseTownService;
    @Autowired
    private BaseProvinceService baseProvinceService;
    @Autowired
    private BaseCityService baseCityService;
    static final String parentFile = "population";
    @PostMapping(value = BaseRequestMapping.BasePopulation.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BasePopulationVO> create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
        //根据saasid获取所属机构的行政区划
        if (StringUtils.isNotBlank(basePopulation.getSaasId())) {
            basePopulation = updateBasePopulation(basePopulation);
        } else {
            return failed("租户id不能为空!", ObjEnvelop.class);
        }
        Boolean bo = checkNameAndYear(basePopulation.getSaasId(), basePopulation.getYear());
        if (bo) {
            return failed("已添加" + basePopulation.getYear() + basePopulation.getSaasName() + "的基础人口信息,请直接修改即可!", ObjEnvelop.class);
        }
        basePopulation = basePopulationService.save(basePopulation);
        return success(basePopulation, BasePopulationVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    basePopulationService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        basePopulationService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BasePopulation.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BasePopulationVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
    public ObjEnvelop<BasePopulationVO> update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {
        BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
        if (null == basePopulation.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
            return failed("ID不能为空", ObjEnvelop.class);
        }
        //根据saasid获取所属机构的行政区划
        if (StringUtils.isNotBlank(basePopulation.getSaasId())) {
            basePopulation = updateBasePopulation(basePopulation);
        } else {
            return failed("租户id不能为空!", ObjEnvelop.class);
        }
        Boolean bo = checkNameAndYear(basePopulation.getSaasId(), basePopulation.getYear());
        if (bo) {
            return failed("已添加" + basePopulation.getYear() + basePopulation.getSaasName() + "的基础人口信息,请直接修改即可!", ObjEnvelop.class);
        }
        basePopulation = basePopulationService.save(basePopulation);
        return success(basePopulation, BasePopulationVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BasePopulation.PAGE)
    @ApiOperation(value = "基数统计-获取分页")
    public PageEnvelop<BasePopulationVO> page(
            @ApiParam(name = "saasName", value = "租户名称,支持模糊搜索")
            @RequestParam(value = "saasName", required = false) String saasName,
            @ApiParam(name = "provinceCode", value = "省份编码")
            @RequestParam(value = "provinceCode", required = false) String provinceCode,
            @ApiParam(name = "cityCode", value = "城市编码")
            @RequestParam(value = "cityCode", required = false) String cityCode,
            @ApiParam(name = "year", value = "时间")
            @RequestParam(value = "year", required = false) String year,
            @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 {
        StringBuffer s = new StringBuffer();
        if (StringUtils.isNotBlank(saasName)) {
            s.append("saasName?" + saasName + " g1;");
        }
        if (StringUtils.isNotBlank(provinceCode)) {
            s.append("provinceCode=" + provinceCode + ";");
        }
        if (StringUtils.isNotBlank(cityCode)) {
            s.append("cityCode=" + cityCode + ";");
        }
        if (StringUtils.isNotBlank(year)) {
            s.append("year=" + year + ";");
        }
        //时间(最近时间排最前)>租户创建时间(最新创建租户排最前)
        String sorts = "-createTime,-saasCreateTime";
        String filters = s.toString();
        List<BasePopulationDO> basePopulations = basePopulationService.search(null, filters, sorts, page, size);
        int count = (int) basePopulationService.getCount(filters);
        return success(basePopulations, count, page, size, BasePopulationVO.class);
    }
        @GetMapping(value = BaseRequestMapping.BasePopulation.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BasePopulationVO> page (
    @GetMapping(value = BaseRequestMapping.BasePopulation.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<BasePopulationVO> 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,
            @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<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts, page, size);
                int count = (int)basePopulationService.getCount(filters);
                return success(basePopulations, count, page, size, BasePopulationVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BasePopulation.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BasePopulationVO> 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<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts);
                  return success(basePopulations, BasePopulationVO.class);
         }
 }
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts);
        return success(basePopulations, BasePopulationVO.class);
    }
    /**
     * 根据基数中的saasid,更新基数中租户相关信息
     *
     * @param basePopulation
     * @return
     * @throws Exception
     */
    public BasePopulationDO updateBasePopulation(BasePopulationDO basePopulation) throws Exception {
        SaasDO saasDO = saasService.findById(basePopulation.getSaasId());
        if (null != saasDO) {
            basePopulation.setSaasCreateTime(saasDO.getCreateTime());
            basePopulation.setSaasName(saasDO.getName());
            String areaCode = saasDO.getAreaNumber();
            String filters = "province?" + areaCode + " g1;city?" + areaCode + " g1;code?" + areaCode + " g1;";
            List<BaseTownDO> baseTowns = baseTownService.search(filters);
            BaseTownDO baseTownDO = (null != baseTowns && baseTowns.size() > 0 ? baseTowns.get(0) : null);
            if (null != baseTownDO) {
                if (baseTownDO.getCode().equals(areaCode)) {
                    basePopulation.setProvinceCode(baseTownDO.getProvince());
                    basePopulation.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                    //市编码
                    basePopulation.setCityCode(baseTownDO.getCity());
                    basePopulation.setCityName(baseCityService.getNameByCode(baseTownDO.getCity()));
                    //区县编码
                    basePopulation.setDistrictCode(areaCode);
                    basePopulation.setDistrictName(baseTownDO.getName());
                } else if (baseTownDO.getCity().equals(areaCode)) {
                    basePopulation.setProvinceCode(baseTownDO.getProvince());
                    basePopulation.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                    //市编码
                    basePopulation.setCityCode(areaCode);
                    basePopulation.setCityName(baseCityService.getNameByCode(areaCode));
                    //区县编码
                    basePopulation.setDistrictCode("");
                    basePopulation.setDistrictName("");
                } else if (baseTownDO.getProvince().equals(areaCode)) {
                    //省编码
                    basePopulation.setProvinceCode(areaCode);
                    basePopulation.setProvinceName(baseProvinceService.getNameByCode(areaCode));
                    //市编码
                    basePopulation.setCityCode("");
                    basePopulation.setCityName("");
                    //区县编码
                    basePopulation.setDistrictCode("");
                    basePopulation.setDistrictName("");
                }
            }
        }
        basePopulation.setDmNum(null == basePopulation.getDmNum() ? 0 : basePopulation.getDmNum());
        basePopulation.setHbpNum(null == basePopulation.getHbpNum() ? 0 : basePopulation.getHbpNum());
        //更新慢病总人数
        basePopulation.setNcdNum(basePopulation.getHbpNum() + basePopulation.getDmNum());
        return basePopulation;
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.FINDBYID)
    @ApiOperation(value = "根据基数统计id获取信息")
    public ObjEnvelop<BasePopulationVO> audit(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) throws Exception {
        BasePopulationDO basePopulationDO = basePopulationService.findById(id);
        if (null == basePopulationDO) {
            return failed("无相关基数统计信息", ObjEnvelop.class);
        }
        return success(basePopulationDO, BasePopulationVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BasePopulation.CHECK_POPULATION_IS_EXIST)
    @ApiOperation(value = "根据租户id和年份,判断基数统计是否已经存在")
    public ObjEnvelop<Boolean> checkPopulationIsExist(
            @ApiParam(name = "saasId", value = "租户id", required = true)
            @RequestParam(value = "saasId") String saasId,
            @ApiParam(name = "year", value = "年份", required = true)
            @RequestParam(value = "year") String year) throws Exception {
        Boolean bo = checkNameAndYear(saasId, year);
        return success(bo);
    }
    /**
     * 验证名称+年份数据是否已存在
     *
     * @param saasId
     * @param year
     * @return
     * @throws Exception
     */
    public Boolean checkNameAndYear(String saasId, String year) throws Exception {
        StringBuffer s = new StringBuffer();
        if (StringUtils.isNotBlank(saasId)) {
            s.append("saasId=" + saasId + ";");
        }
        if (StringUtils.isNotBlank(year)) {
            s.append("year=" + year);
        }
        String filters = s.toString();
        List<BasePopulationDO> basePopulationDOList = basePopulationService.search(filters);
        return (null != basePopulationDOList && basePopulationDOList.size() > 0) ? true : false;
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.POPULATION_BATCH_IMPORT)
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础人口信息列表导入")
    public Envelop importData(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
            AExcelReader excelReader = new PopulationMsgReader();
            excelReader.read(file);
            //验证未通过
            List<PopulationMsg> errorLs = excelReader.getErrorLs();
            List<PopulationMsg> correctLs = excelReader.getCorrectLs();
            if(errorLs.size()>0){
                return failed("格式有误,导入失败!");
            }
            //获取所有租户+年份的基础人口信息
            Set<String> populationNameAndYear = new HashSet<String>(basePopulationService.getFacilityCodeByServerType());
            PopulationMsg model;
            List saveLs = new ArrayList<>();
            if (correctLs.size() > 0) {
                for (int i = 0; i < correctLs.size(); i++) {
                    model = correctLs.get(i);
                    Map<Boolean, PopulationMsg> map = validate(model, populationNameAndYear);
                    if (null == map.get(true)) {
//                        errorLs.add(model);
                        return failed("格式有误,导入失败!");
                    } else {
                        saveLs.add(model);
                    }
                }
//                if(errorLs.size()>0){
//                    return failed("格式有误,导入失败!");
//                }
                Map<String, Object> result = basePopulationService.batchInsertPopulation(saveLs);
                result.put("errorLs", errorLs);
                return success("导入成功!", result);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
        return failed("导入失败");
    }
    private Map<Boolean, PopulationMsg> validate(PopulationMsg model, Set<String> populationNameAndYear) throws Exception {
        Map<Boolean, PopulationMsg> msgMap = new HashMap<>();
        Boolean rs = true;
        //验证租户是否存在
        SaasDO saasDO = saasService.findByName(model.getSaasName());
        String nameAndYear = model.getSaasName() + model.getYear();
        //验证租户+年份的人口基数是否存在
        if (populationNameAndYear.contains(nameAndYear)) {
            model.addErrorMsg("saasName", "已添加" + model.getYear() + model.getSaasName() + "的基础人口信息,请直接修改即可!");
            rs = false;
        }
        if (null == saasDO) {
            model.addErrorMsg("saasName", "租户不存在,请核对!");
            rs = false;
        } else {
            model.setSaasId(saasDO.getId());
            model.setSaasCreateTime(saasDO.getCreateTime());
            String areaCode = saasDO.getAreaNumber();
            String filters = "province?" + areaCode + " g1;city?" + areaCode + " g1;code?" + areaCode + " g1;";
            List<BaseTownDO> baseTowns = baseTownService.search(filters);
            BaseTownDO baseTownDO = (null != baseTowns && baseTowns.size() > 0 ? baseTowns.get(0) : null);
            if (null != baseTownDO) {
                if (baseTownDO.getCode().equals(areaCode)) {
                    model.setProvinceCode(baseTownDO.getProvince());
                    model.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                    //市编码
                    model.setCityCode(baseTownDO.getCity());
                    model.setCityName(baseCityService.getNameByCode(baseTownDO.getCity()));
                    //区县编码
                    model.setDistrictCode(areaCode);
                    model.setDistrictName(baseTownDO.getName());
                } else if (baseTownDO.getCity().equals(areaCode)) {
                    model.setProvinceCode(baseTownDO.getProvince());
                    model.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                    //市编码
                    model.setCityCode(areaCode);
                    model.setCityName(baseCityService.getNameByCode(areaCode));
                    //区县编码
                    model.setDistrictCode("");
                    model.setDistrictName("");
                } else if (baseTownDO.getProvince().equals(areaCode)) {
                    //省编码
                    model.setProvinceCode(areaCode);
                    model.setProvinceName(baseProvinceService.getNameByCode(areaCode));
                    //市编码
                    model.setCityCode("");
                    model.setCityName("");
                    //区县编码
                    model.setDistrictCode("");
                    model.setDistrictName("");
                }
            }
        }
        msgMap.put(rs, model);
        return msgMap;
    }
}

+ 73 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BaseYearEndpoint.java

@ -0,0 +1,73 @@
package com.yihu.jw.base.endpoint.population;
import ch.qos.logback.core.util.TimeUtil;
import com.yihu.jw.base.service.population.BaseYearService;
import com.yihu.jw.entity.base.population.BaseYearDO;
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.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
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.ArrayList;
import java.util.List;
/**
 * 基数-年份维护
 * Created by zdm on 2018/10/12.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BaseYear.PREFIX)
@Api(value = "年份管理", description = "基础人口-年份管理接口", tags = {"wlyy基础服务 - 基础人口-年份管理接口"})
public class BaseYearEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseYearService baseYearService;
    @PostMapping(value = BaseRequestMapping.BaseYear.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取系统当前年份,创建时间列表至1990年")
    public ObjEnvelop<Boolean> create() throws Exception {
        int year = DateUtil.getNowYear();
        baseYearService.save(year);
        return success(true);
    }
    @PostMapping(value = BaseRequestMapping.BaseYear.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        baseYearService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseYear.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseYearDO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BaseYearDO BaseYear = toEntity(jsonData, BaseYearDO.class);
        if (null == BaseYear.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        BaseYear = baseYearService.save(BaseYear);
        return success(BaseYear);
    }
    @GetMapping(value = BaseRequestMapping.BaseYear.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<String> getYearList() throws Exception {
        List<String> BaseYears = baseYearService.getYearList();
        return success(BaseYears);
    }
}

+ 37 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/BaseEmailTemplateConfigEndpoint.java

@ -0,0 +1,37 @@
package com.yihu.jw.base.endpoint.saas;
import com.yihu.jw.base.service.saas.BaseEmailTemplateConfigService;
import com.yihu.jw.entity.base.saas.BaseEmailTemplateConfigDO;
import com.yihu.jw.restmodel.base.saas.BaseEmailTemplateConfigVO;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.*;
/**
 * Endpoint - BaseEmailTemplateConfig
 * Created by zdm on 2018/10/10.
 */
@RestController
@RequestMapping(value = "/BaseEmailTemplateConfig")
@Api(value = "邮件模板管理", description = "Saas邮件模板管理", tags = {"wlyy基础服务 - Saas邮件模板管理"})
public class BaseEmailTemplateConfigEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseEmailTemplateConfigService baseEmailTemplateConfigService;
    @PostMapping(value = "/create", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BaseEmailTemplateConfigVO> create(
            @ApiParam(name = "baseEmailTemplateConfigDO", value = "baseEmailTemplateConfigDO")
            @RequestBody BaseEmailTemplateConfigDO baseEmailTemplateConfigDO) throws Exception {
        baseEmailTemplateConfigService.save(baseEmailTemplateConfigDO);
        return success("创建成功", baseEmailTemplateConfigDO, BaseEmailTemplateConfigVO.class);
    }
}

+ 126 - 20
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java

@ -1,11 +1,12 @@
package com.yihu.jw.base.endpoint.saas;
import com.yihu.jw.base.service.saas.SaasTypeDictService;
import com.yihu.jw.base.service.saas.BaseEmailTemplateConfigService;
import com.yihu.jw.base.service.saas.SaasService;
import com.yihu.jw.base.service.saas.SaasTypeDictService;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.saas.BaseEmailTemplateConfigDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.base.service.saas.SaasService;
import com.yihu.jw.entity.base.saas.SaasTypeDictDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.exception.code.BaseErrorCode;
@ -20,7 +21,11 @@ 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.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -42,28 +47,54 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
    private SaasTypeDictService saasTypeDictService;
    @Autowired
    private ErrorCodeUtil errorCodeUtil;
    @Autowired
    private BaseEmailTemplateConfigService baseEmailTemplateConfigService;
    @Autowired
    JavaMailSender jms;
    @Value("${spring.mail.username}")
    private String username;
    @PostMapping(value = BaseRequestMapping.Saas.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    @ApiOperation(value = "创建-基本信息")
    public Envelop create (
            @ApiParam(name = "saasDO", value = "Json数据", required = true)
            @RequestParam(value = "saasDO") SaasDO saasDO,
            @ApiParam(name = "userDO", value = "Json数据", required = true)
            @RequestParam(value = "userDO") UserDO userDO) throws Exception {
        if (saasService.search("name=" + userDO.getName()).size() > 0) {
            @ApiParam(name = "jsonSaas", value = "租户数据", required = true)
            @RequestParam String jsonSaas) throws Exception {
        SaasDO saasDO = toEntity(jsonSaas, SaasDO.class);
        if (saasService.search("name=" + saasDO.getName()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST), Envelop.class);
        }
        if (userService.search("mobile=" + userDO.getMobile()).size() > 0) {
        if (userService.search("mobile=" + saasDO.getMobile()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.MOBILE_IS_EXIST), Envelop.class);
        }
        if (userService.search("username=" + userDO.getEmail()).size() > 0) {
        if (userService.search("username=" + saasDO.getEmail()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
        }
        userDO.setUsername(userDO.getEmail());
        saasService.save(saasDO, userDO);
        saasService.create(saasDO);
        saasDO.setStatus(SaasDO.Status.auditPassed);
        return send(saasDO);
    }
    @PostMapping(value = BaseRequestMapping.Saas.SYSTEM_CONFIGURATION, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建-系统配置")
    public Envelop createSystemConfig (
            @ApiParam(name = "saasDO", value = "Json数据", required = true)
            @RequestParam(value = "saasDO") SaasDO saasDO) throws Exception {
        saasService.saveSystemConfig(saasDO);
        return success("创建成功");
    }
    @PostMapping(value = BaseRequestMapping.Saas.THEME_STYLE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建-主题风格")
    public Envelop createThemeConfig (
            @ApiParam(name = "saasDO", value = "Json数据", required = true)
            @RequestParam(value = "saasDO") SaasDO saasDO) throws Exception {
        saasService.createThemeConfig(saasDO);
        return success("创建成功");
    }
    @PostMapping(value = BaseRequestMapping.Saas.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
@ -73,17 +104,41 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.Saas.STATUS)
    @ApiOperation(value = "修改状态")
    public Envelop status(
            @ApiParam(name = "id", value = "saas类型Json数据")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "status")
            @RequestParam(value = "status", required = true) SaasDO.Status status) throws Exception {
        saasService.updateStatus(id, status);
        return success("修改成功");
    }
    @PostMapping(value = BaseRequestMapping.Saas.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public Envelop update (
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        SaasDO saasDO = toEntity(jsonData, SaasDO.class);
        if (null == saasDO.getId()) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), Envelop.class);
        }
        saasDO = saasService.save(saasDO);
        return success(saasDO);
        SaasDO oldSaas = saasService.findById(saasDO.getId());
        UserDO userDO = userService.findById(oldSaas.getManager());
        if (!oldSaas.getName().equals(saasDO.getName())&&saasService.search("name=" + saasDO.getName()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST), Envelop.class);
        }
        if (!userDO.getMobile().equals(saasDO.getMobile())&&userService.search("mobile=" + saasDO.getMobile()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.MOBILE_IS_EXIST), Envelop.class);
        }
        if (!userDO.getEmail().equals(saasDO.getEmail())&&userService.search("username=" + saasDO.getEmail()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
        }
        saasService.updateSaas(saasDO,oldSaas,userDO);
        return success("修改成功");
    }
    @GetMapping(value = BaseRequestMapping.Saas.PAGE)
@ -135,21 +190,72 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.Saas.AUDIT)
    @ApiOperation(value = "审核")
    public Envelop audit(
    public ObjEnvelop<SaasDO> audit(
            @ApiParam(name = "id", value = "SaasId", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "状态", required = true)
            @RequestParam(value = "status") SaasDO.Status status,
            @ApiParam(name = "auditFailedReason", value = "审核不通过的原因(非必填)")
            @RequestParam(value = "auditFailedReason",required = false) String auditFailedReason) throws Exception {
            @RequestParam(value = "auditFailedReason", required = false) String auditFailedReason) throws Exception {
        SaasDO saasDO = saasService.retrieve(id);
        if (null == saasDO) {
            return failed("无相关SAAS配置", Envelop.class);
            return failed("无相关SAAS配置", ObjEnvelop.class);
        }
        saasDO.setStatus(status);
        saasDO.setAuditFailedReason(auditFailedReason);
        //用户信息初始化
        UserDO userDO = new UserDO();
        userDO.setEmail(saasDO.getEmail());
        userDO.setMobile(saasDO.getMobile());
        userDO.setName(saasDO.getManagerName());
        userDO.setUsername(userDO.getEmail());
        //初始化租户信息
        saasService.save(saasDO);
        return success("操作成功");
        saasDO = saasService.saasAudit(saasDO, userDO);
        return send(saasDO);
    }
    @GetMapping("/sendEmail")
    @ApiOperation(value = "邮件发送")
    public ObjEnvelop<SaasDO> send(SaasDO saasDO) {
        try {
            SaasDO.Status status = saasDO.getStatus();
            String password = saasDO.getMobile().substring(0, 6);
            BaseEmailTemplateConfigDO baseEmailTemplateConfigDO = baseEmailTemplateConfigService.findByCode(status.name());
            if (null == baseEmailTemplateConfigDO) {
                failed(status.name() + "邮件模板不存在!");
            }
            //建立邮件消息
            SimpleMailMessage mainMessage = new SimpleMailMessage();
            //发送者
            mainMessage.setFrom(username);
            //接收者
//            mainMessage.setTo("763558454@qq.com");
            mainMessage.setTo(saasDO.getEmail());
            //发送的标题
            mainMessage.setSubject(baseEmailTemplateConfigDO.getTemplateName());
            //发送的内容
            StringBuffer content = new StringBuffer();
            content.append(baseEmailTemplateConfigDO.getFirst() + "\n").append(baseEmailTemplateConfigDO.getKeyword1() + "\n");
            content.append(baseEmailTemplateConfigDO.getKeyword2() + "\n");
            if (status.equals(SaasDO.Status.auditPassed)) {
                //账号
                content.append(baseEmailTemplateConfigDO.getKeyword3() + saasDO.getMobile() + "\n");
                //密码
                content.append(baseEmailTemplateConfigDO.getKeyword4() + password + "\n");
            } else if (status.equals(SaasDO.Status.auditNotPassed)) {
                //审核未通过的原因
                content.append(saasDO.getAuditFailedReason() + "\n");
            }
            content.append(baseEmailTemplateConfigDO.getKeyword5() + baseEmailTemplateConfigDO.getUrl() + "\n");
            content.append(baseEmailTemplateConfigDO.getRemark());
            mainMessage.setText(content.toString());
            jms.send(mainMessage);
        } catch (MailException e) {
            e.printStackTrace();
            return failed("邮件发送失败!"+e.getMessage(),ObjEnvelop.class);
        }
        return success("审核完成", saasDO);
    }
}

+ 12 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasTypeDictEndpoint.java

@ -44,7 +44,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SaasTypeModuleService saasTypeModuleService;
    @PostMapping(value = BaseRequestMapping.SaasTypeDict.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.SaasTypeDict.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<SaasTypeDictVO> create(
            @ApiParam(name = "saasTypeDictJson", value = "saas类型Json数据")
@ -53,6 +53,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "saasTypeDefaultModuleIds", required = true) String saasTypeDefaultModuleIds) throws Exception {
        SaasTypeDictDO saasTypeDictDO = toEntity(saasTypeDictJson, SaasTypeDictDO.class);
        //名称重复判断
        List<SaasTypeDictDO> saasTypeDictDOList = saasTypeDictService.findByField("name", saasTypeDictDO.getName());
        if (null != saasTypeDictDOList && saasTypeDictDOList.size() > 0) {
            return failed("租户类型名称重复!", ObjEnvelop.class);
@ -62,7 +63,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = BaseRequestMapping.SaasTypeDict.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.SaasTypeDict.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<SaasTypeDictVO> update(
            @ApiParam(name = "saasTypeDictJson", value = "saas类型Json数据")
@ -95,7 +96,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "size") int size) throws Exception {
        StringBuffer s = new StringBuffer();
        if (StringUtils.isNotEmpty(name)) {
            s.append("name?" + name + "g1;");
            s.append("name?" + name + " g1;");
        }
        if (null != status) {
            s.append("status=" + status);
@ -157,11 +158,14 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "saasTypeDictId", value = "租户类型id")
            @RequestParam(value = "saasTypeDictId", required = false) String saasTypeDictId) throws Exception {
        //根据租户类型获取关联的模块
        String fis = "status=1;saasTypeId=" + saasTypeDictId;
        List<SaasTypeModuleDO> saasTypeModuleDOList = saasTypeModuleService.search(fis);
        List<SaasTypeModuleDO> saasTypeModuleDOList = new ArrayList<>();
        Set<String> moduleIdSet = new HashSet<>();
        for (SaasTypeModuleDO saasTypeModuleDO : saasTypeModuleDOList) {
            moduleIdSet.add(saasTypeModuleDO.getModuleId());
        if(StringUtils.isNotBlank(saasTypeDictId)){
            String fis = "status=1;saasTypeId=" + saasTypeDictId;
            saasTypeModuleDOList = saasTypeModuleService.search(fis);
            for (SaasTypeModuleDO saasTypeModuleDO : saasTypeModuleDOList) {
                moduleIdSet.add(saasTypeModuleDO.getModuleId());
            }
        }
        //获取生效中的模块
        String filters = "status=1";
@ -169,7 +173,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
        List<ModuleVO> moduleVOs = convertToModels(modules, new ArrayList<>(modules.size()), ModuleVO.class);
        moduleVOs = moduleVOs.stream()
                .filter(module -> {
                    if (CommonContant.IS_MUST.equals(module.getIsMust())) {
                    if (CommonContant.IS_MUST.equals(String.valueOf(module.getIsMust()))) {
                        //是否选中(0-表示未选,1-表示已选)
                        module.setIsCheck(1);
                    } else {

+ 5 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WeChatQrcodeController.java

@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
 * Created by Trick on 2018/9/7.
 */
@ -31,8 +33,9 @@ public class WeChatQrcodeController extends EnvelopRestEndpoint {
    public Envelop getQrcode(@ApiParam(name = "wxId", value = "微信id")
                             @RequestParam(value = "wxId", required = true)String wxId,
                             @ApiParam(name = "scene", value = "场景值")
                             @RequestParam(value = "scene", required = true)String scene) throws Exception{
        return success(weChatQrcodeService.getQrcode(wxId,scene));
                             @RequestParam(value = "scene", required = true)String scene,
                             HttpServletRequest request) throws Exception{
        return success(weChatQrcodeService.getQrcode(request,wxId,scene));
    }
}

+ 122 - 72
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatController.java

@ -3,8 +3,7 @@ package com.yihu.jw.base.endpoint.wx;
import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.base.service.wx.WechatService;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.restmodel.base.wx.WxTemplateConfigVO;
import com.yihu.jw.restmodel.base.wx.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -33,18 +32,18 @@ public class WechatController extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.WeChat.getWechatInfos)
    @ApiOperation(value = "获取微信基本信息列表", notes = "获取微信基本信息列表")
    public MixEnvelop getWxWechatList(@ApiParam(name = "name", value = "微信名称")
                                      @RequestParam(value = "name", required = false) String name,
                                      @ApiParam(name = "saasName", value = "租户名称")
                                      @RequestParam(value = "saasName", required = false) String saasName,
                                      @ApiParam(name = "status", value = "状态")
                                      @RequestParam(value = "status", required = false) Integer status,
                                      @ApiParam(name = "publicType", value = "微信类型")
                                      @RequestParam(value = "publicType", required = false) Integer publicType,
                                      @ApiParam(name = "page", value = "页码")
                                      @RequestParam(value = "page", required = true) Integer page,
                                      @ApiParam(name = "size", value = "每页大小")
                                      @RequestParam(value = "size", required = true) Integer size) {
    public MixEnvelop<WxWechatVO,WxWechatVO> getWxWechatList(@ApiParam(name = "name", value = "微信名称")
                                                             @RequestParam(value = "name", required = false) String name,
                                                             @ApiParam(name = "saasName", value = "租户名称")
                                                             @RequestParam(value = "saasName", required = false) String saasName,
                                                             @ApiParam(name = "status", value = "状态")
                                                             @RequestParam(value = "status", required = false) Integer status,
                                                             @ApiParam(name = "publicType", value = "微信类型")
                                                             @RequestParam(value = "publicType", required = false) Integer publicType,
                                                             @ApiParam(name = "page", value = "页码")
                                                             @RequestParam(value = "page", required = true) Integer page,
                                                             @ApiParam(name = "size", value = "每页大小")
                                                             @RequestParam(value = "size", required = true) Integer size) {
        return wechatService.getWxWechatList(name, saasName, status, publicType, page, size);
    }
@ -70,9 +69,26 @@ public class WechatController extends EnvelopRestEndpoint {
        return wechatService.updateWxAndSaas(wxWechat,list);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findWxWechatSingle)
    @ApiOperation(value = "查询单条微信信息", notes = "查询单条微信信息")
    public ObjEnvelop<WxWechatSingleVO> findWxWechatSingle(String wechatId) {
        WxWechatDO wxWechatDO  = wechatService.findWxWechatSingle(wechatId);
        WxWechatSingleVO wxWechatSingleVO = convertToModel(wxWechatDO,WxWechatSingleVO.class);
        List<WxSaasVO> list = wechatService.getWxSaasVOs(wechatId);
        wxWechatSingleVO.setSaas(list);
        return success("success", wxWechatSingleVO);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findWxWechatExist)
    @ApiOperation(value = "判断微信名称是否存在", notes = "判断微信名称是否存在")
    public Envelop findWxWechatExist(String name) {
       return success(BaseRequestMapping.WeChat.api_success, wechatService.findWxWechatExist(name));
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findWechatCombo)
    @ApiOperation(value = "微信信息下拉框", notes = "微信信息下拉框")
    public MixEnvelop findWechatCombo() {
    public MixEnvelop<WxComboVO,WxComboVO> findWechatCombo() {
        return wechatService.findWechatCombo();
    }
@ -81,13 +97,15 @@ public class WechatController extends EnvelopRestEndpoint {
    //====================图文素材管理============================
    @GetMapping(value = BaseRequestMapping.WeChat.findWechatImgGroup)
    @ApiOperation(value = "获取图文素材分组", notes = "获取图文素材分组")
    public MixEnvelop findWechatImgGroup(@ApiParam(name = "wechatId", value = "微信ID")
                                         @RequestParam(value = "wechatId", required = true)String wechatId,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = false)Integer page,
                                         @ApiParam(name = "size", value = "每页条数")
                                         @RequestParam(value = "size", required = false)Integer size) {
        return wechatService.findWechatImgGroup(wechatId,page,size);
    public MixEnvelop<WxGraphicSceneVO,WxGraphicSceneVO> findWechatImgGroup(@ApiParam(name = "wechatId", value = "微信ID")
                                                                            @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                            @ApiParam(name = "scene", value = "分组名称(场景值)")
                                                                            @RequestParam(value = "scene", required = false)String scene,
                                                                            @ApiParam(name = "page", value = "第几页")
                                                                            @RequestParam(value = "page", required = false)Integer page,
                                                                            @ApiParam(name = "size", value = "每页条数")
                                                                            @RequestParam(value = "size", required = false)Integer size) {
        return wechatService.findWechatImgGroup(wechatId,scene,page,size);
    }
    @PostMapping(value = BaseRequestMapping.WeChat.createImgGroup)
@ -98,6 +116,15 @@ public class WechatController extends EnvelopRestEndpoint {
        return wechatService.createImgGroup(wxWechatScene);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findImgGroupExist)
    @ApiOperation(value = "验证图文素材分组是否存在", notes = "验证图文素材分组是否存在")
    public Envelop findImgGroupExist(@ApiParam(name = "wechatId", value = "微信id")
                                     @RequestParam(value = "wechatId", required = true)String wechatId,
                                     @ApiParam(name = "scene", value = "场景值")
                                     @RequestParam(value = "scene", required = true)String scene) {
        return success(BaseRequestMapping.WeChat.api_success,wechatService.findImgGroupExist(wechatId,scene));
    }
    @PostMapping(value = BaseRequestMapping.WeChat.updateImgGroup)
    @ApiOperation(value = "修改图文素材分组", notes = "修改图文素材分组")
    public Envelop updateImgGroup(@ApiParam(name = "id", value = "id")
@ -116,36 +143,54 @@ public class WechatController extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.WeChat.saveImg)
    @ApiOperation(value = "保存图文素材", notes = "保存图文素材")
    public Envelop saveImg(@ApiParam(name = "id", value = "id")
                           @RequestParam(value = "id", required = true)String wxGraphicMessageJson)throws Exception {
    public Envelop saveImg(@ApiParam(name = "wxGraphicMessageJson", value = "保存图文素材")
                           @RequestParam(value = "wxGraphicMessageJson", required = true)String wxGraphicMessageJson)throws Exception {
        WxGraphicMessageDO WxGraphicMessage = toEntity(wxGraphicMessageJson, WxGraphicMessageDO.class);
        return wechatService.saveImg(WxGraphicMessage);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findImg)
    @ApiOperation(value = "获取图文素材", notes = "获取图文素材")
    public MixEnvelop findImg(@ApiParam(name = "wechatId", value = "微信id")
                              @RequestParam(value = "wechatId", required = true)String wechatId,
                              @ApiParam(name = "title", value = "素材标题")
                              @RequestParam(value = "title", required = false)String title,
                              @ApiParam(name = "scene", value = "场景值")
                              @RequestParam(value = "scene", required = false)String scene,
                              @ApiParam(name = "page", value = "第几页")
                              @RequestParam(value = "page", required = true)Integer page,
                              @ApiParam(name = "size", value = "每页几条")
                              @RequestParam(value = "size", required = true)Integer size) {
    public MixEnvelop<WxGraphicMessageVO,WxGraphicMessageVO> findImg(@ApiParam(name = "wechatId", value = "微信id")
                                                                     @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                     @ApiParam(name = "title", value = "素材标题")
                                                                     @RequestParam(value = "title", required = false)String title,
                                                                     @ApiParam(name = "scene", value = "场景值")
                                                                     @RequestParam(value = "scene", required = false)String scene,
                                                                     @ApiParam(name = "page", value = "第几页")
                                                                     @RequestParam(value = "page", required = true)Integer page,
                                                                     @ApiParam(name = "size", value = "每页几条")
                                                                     @RequestParam(value = "size", required = true)Integer size) {
        return wechatService.findImg(wechatId, title, scene, page, size);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findGraphicMessageSingle)
    @ApiOperation(value = "获取图文素材(单条)", notes = "获取图文素材(单条)")
    public ObjEnvelop<WxGraphicMessageVO> findGraphicMessageSingle(@ApiParam(name = "id", value = "图文id")
                                                       @RequestParam(value = "id", required = true)String id) {
        return success(wechatService.findGraphicMessageSingle(id),WxGraphicMessageVO.class);
    }
    @PostMapping(value = BaseRequestMapping.WeChat.saveImgGroup)
    @ApiOperation(value = "分组图文素材", notes = "分组图文素材")
    public Envelop saveImgGroup(@ApiParam(name = "groups", value = "微信id")
    public Envelop saveImgGroup(@ApiParam(name = "groups", value = "图文消息关系json")
                                @RequestParam(value = "groups", required = true)String groups) {
        List<WxGraphicSceneGroupDO> list = (List<WxGraphicSceneGroupDO>) JSONArray.parseArray(groups, WxGraphicSceneGroupDO.class);
        return wechatService.saveImgGroup(list);
    }
    @PostMapping(value = BaseRequestMapping.WeChat.saveWxReplyScene)
    @PostMapping(value = BaseRequestMapping.WeChat.deleteImgGroupRelation)
    @ApiOperation(value = "分组图文素材", notes = "分组图文素材")
    public Envelop deleteImgGroupRelation(@ApiParam(name = "wechatId", value = "微信id")
                                          @RequestParam(value = "wechatId", required = true)String wechatId,
                                          @ApiParam(name = "scene", value = "图文分组名称(场景值)")
                                          @RequestParam(value = "scene", required = true)String scene,
                                          @ApiParam(name = "imgId", value = "图文id")
                                          @RequestParam(value = "imgId", required = true)String imgId) {
        return wechatService.deleteImgGroupRelation(wechatId,scene,imgId);
    }
        @PostMapping(value = BaseRequestMapping.WeChat.saveWxReplyScene)
    @ApiOperation(value = "事件配置场景", notes = "事件配置场景")
    public Envelop saveWxReplyScene(@ApiParam(name = "wxReplySceneJson", value = "事件配置json")
                                    @RequestParam(value = "wxReplySceneJson", required = true)String wxReplySceneJson) throws Exception{
@ -157,17 +202,17 @@ public class WechatController extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.WeChat.findWxReplyScene)
    @ApiOperation(value = "获取消息配置场景", notes = "获取消息配置场景")
    public MixEnvelop<WxReplySceneVO,WxReplySceneVO> findWxReplyScene(@ApiParam(name = "wechatId", value = "微信id")
                                       @RequestParam(value = "wechatId", required = true)String wechatId,
                                                       @ApiParam(name = "msgType", value = "消息类型")
                                       @RequestParam(value = "msgType", required = false)String msgType,
                                                       @ApiParam(name = "event", value = "事件类型")
                                       @RequestParam(value = "event", required = false)String event,
                                                       @ApiParam(name = "content", value = "回复内容")
                                       @RequestParam(value = "content", required = false)String content,
                                                       @ApiParam(name = "page", value = "页数")
                                       @RequestParam(value = "page", required = true)Integer page,
                                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true)Integer size) {
                                                                      @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                      @ApiParam(name = "msgType", value = "消息类型")
                                                                      @RequestParam(value = "msgType", required = false)String msgType,
                                                                      @ApiParam(name = "event", value = "事件类型")
                                                                      @RequestParam(value = "event", required = false)String event,
                                                                      @ApiParam(name = "content", value = "回复内容")
                                                                      @RequestParam(value = "content", required = false)String content,
                                                                      @ApiParam(name = "page", value = "页数")
                                                                      @RequestParam(value = "page", required = true)Integer page,
                                                                      @ApiParam(name = "size", value = "每页大小")
                                                                      @RequestParam(value = "size", required = true)Integer size) {
        return wechatService.findWxReplyScene(wechatId, msgType, event, content, page, size);
    }
    //====================图文素材管理end============================
@ -182,20 +227,20 @@ public class WechatController extends EnvelopRestEndpoint {
        return wechatService.saveWxTemp(wxTemplate);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.saveWxTemp)
    @GetMapping(value = BaseRequestMapping.WeChat.findWxtemp)
    @ApiOperation(value = "获取微信模板消息基础信息(列表)", notes = "获取微信模板消息基础信息(列表)")
    public MixEnvelop findWxtemp(@ApiParam(name = "wechatId", value = "微信id")
                                 @RequestParam(value = "wechatId", required = true)String wechatId,
                                 @ApiParam(name = "status", value = "状态")
                                 @RequestParam(value = "status", required = true)Integer status,
                                 @ApiParam(name = "name", value = "微信模板名称")
                                 @RequestParam(value = "name", required = true)String name,
                                 @ApiParam(name = "key", value = "模板id或标题模糊匹配")
                                 @RequestParam(value = "key", required = true)String key,
                                 @ApiParam(name = "page", value = "页码")
                                 @RequestParam(value = "page", required = true)Integer page,
                                 @ApiParam(name = "size", value = "分页大小")
                                 @RequestParam(value = "size", required = true)Integer size) {
    public MixEnvelop<WxTemplateVO,WxTemplateVO> findWxtemp(@ApiParam(name = "wechatId", value = "微信id")
                                                            @RequestParam(value = "wechatId", required = true)String wechatId,
                                                            @ApiParam(name = "status", value = "状态")
                                                            @RequestParam(value = "status", required = true)Integer status,
                                                            @ApiParam(name = "name", value = "微信模板名称")
                                                            @RequestParam(value = "name", required = true)String name,
                                                            @ApiParam(name = "key", value = "模板id或标题模糊匹配")
                                                            @RequestParam(value = "key", required = true)String key,
                                                            @ApiParam(name = "page", value = "页码")
                                                            @RequestParam(value = "page", required = true)Integer page,
                                                            @ApiParam(name = "size", value = "分页大小")
                                                            @RequestParam(value = "size", required = true)Integer size) {
        return wechatService.findWxtemp(wechatId, status, name, key, page, size);
    }
@ -210,24 +255,24 @@ public class WechatController extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.WeChat.findWxTempConfigList)
    @ApiOperation(value = "获取微信模板列表", notes = "获取微信模板列表")
    public MixEnvelop<WxTemplateConfigVO,WxTemplateConfigVO> findWxTempConfigList(@ApiParam(name = "wechatId", value = "微信id")
                                           @RequestParam(value = "wechatId", required = true)String wechatId,
                                           @ApiParam(name = "scene", value = "微信场景值")
                                           @RequestParam(value = "scene", required = true)String scene,
                                           @ApiParam(name = "page", value = "第几页")
                                           @RequestParam(value = "page", required = true)Integer page,
                                           @ApiParam(name = "size", value = "分页大小")
                                           @RequestParam(value = "size", required = true)Integer size) {
                                                                                  @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                                  @ApiParam(name = "scene", value = "微信场景值")
                                                                                  @RequestParam(value = "scene", required = true)String scene,
                                                                                  @ApiParam(name = "page", value = "第几页")
                                                                                  @RequestParam(value = "page", required = true)Integer page,
                                                                                  @ApiParam(name = "size", value = "分页大小")
                                                                                  @RequestParam(value = "size", required = true)Integer size) {
        return wechatService.findWxTempConfigList(wechatId, scene, page, size);
    }
    @GetMapping(value = BaseRequestMapping.WeChat.findWxTemplateConfig)
    @ApiOperation(value = "获取微信模板列表(单条)", notes = "获取微信模板列表(单条)")
    public ObjEnvelop<WxTemplateConfigVO>  findWxTemplateConfig(@ApiParam(name = "wechatId", value = "微信id")
                                                   @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                          @ApiParam(name = "name", value = "模板名称")
                                                   @RequestParam(value = "name", required = true)String name,
                                                                          @ApiParam(name = "scene", value = "场景值")
                                                   @RequestParam(value = "scene", required = true)String scene) {
                                                                @RequestParam(value = "wechatId", required = true)String wechatId,
                                                                @ApiParam(name = "name", value = "模板名称")
                                                                @RequestParam(value = "name", required = true)String name,
                                                                @ApiParam(name = "scene", value = "场景值")
                                                                @RequestParam(value = "scene", required = true)String scene) {
        return success(wechatService.findWxTemplateConfig(wechatId,name,scene), WxTemplateConfigVO.class);
    }
@ -257,4 +302,9 @@ public class WechatController extends EnvelopRestEndpoint {
    }
    //===================微信粉丝统计end==========================================
//    @GetMapping(value = "header")
//    @ApiOperation(value = "测试header", notes = "测试header")
//    public String getHeader(){
//        return getUID();
//    }
}

+ 13 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatCoreController.java

@ -116,9 +116,20 @@ public class WechatCoreController extends EnvelopRestEndpoint {
     */
    private boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
        logger.info("validate:");
        logger.info("signature:"+signature);
        logger.info("timestamp:"+timestamp);
        logger.info("nonce:"+nonce);
        //查询平台所有微信token
        List<WxWechatDO> wxs =  wechatCoreService.findAll();
        try{
            logger.info("validate:wxs.size:"+wxs.size());
        }catch (Exception e){
            e.printStackTrace();
        }
        if(wxs!=null&&wxs.size()>0){
            for(WxWechatDO wx :wxs){
@ -137,6 +148,8 @@ public class WechatCoreController extends EnvelopRestEndpoint {
                String decodeStr = "";
                byte[] bytes = md.digest(content.getBytes());
                decodeStr = byteToStr(bytes);
                logger.info("decodeStr:"+decodeStr);
                //验证
                if (StringUtils.isNotEmpty(decodeStr) && decodeStr.equals(signature.toUpperCase())) {
                    return true;

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseCityService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseCityDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseCityDO;
/**
 * 
 * 城市字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong    1.0  2018年08月31日 Created
 *
 *          </pre>
 * @since 1.
 */
@Service
public class BaseCityService extends BaseJpaService<BaseCityDO, BaseCityDao> {
    @Autowired
    private BaseCityDao baseCityDao;
    public String getNameByCode(String code) {
        return baseCityDao.getNameByCode(code);
    }
}

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseProvinceService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseProvinceDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
/**
 * 
 * 省字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong    1.0  2018年08月31日 Created
 *
 *                   </pre>
 * @since 1.
 */
@Service
public class BaseProvinceService extends BaseJpaService<BaseProvinceDO, BaseProvinceDao> {
    @Autowired
    private BaseProvinceDao baseProvinceDao;
    public String getNameByCode(String code) {
        return baseProvinceDao.getNameByCode(code);
    }
}

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseTownService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseTownDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseTownDO;
/**
 * 
 * 区县字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong    1.0  2018年08月31日 Created
 *
 *                   </pre>
 * @since 1.
 */
@Service
public class BaseTownService extends BaseJpaService<BaseTownDO, BaseTownDao> {
    @Autowired
    private BaseTownDao baseTownDao;
    public String getNameByCode(String code) {
        return baseTownDao.getNameByCode(code);
    }
}

+ 10 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/errorCode/ErrorCodeService.java

@ -34,6 +34,16 @@ public class ErrorCodeService extends BaseJpaService<ErrorCodeDO, ErrorCodeDao>
        }
    }
    /**
     * 初始化错误码(无条件)
     */
    public void initWithoutCondition(){
        Iterable<ErrorCodeDO> list = errorCodeDao.findAll();
        list.forEach(code->{
            redisTemplate.opsForValue().set(BaseErrorCode.PREFIX + code.getErrorCode(),code.getErrorMsg());
        });
    }
    /**
     * 新增
     * @param errorCodeDO

+ 35 - 15
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -1,18 +1,26 @@
package com.yihu.jw.base.service.org;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.google.gson.JsonObject;
import com.yihu.jw.base.dao.org.BaseOrgDao;
//import com.yihu.jw.base.dao.org.OrgTreeDao;
import com.yihu.jw.base.dao.org.OrgTreeDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.dao.user.UserRoleDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.Tree;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.service.user.UserRoleService;
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.entity.base.user.UserRoleDO;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.org.BaseOrgDO;
@ -39,14 +47,15 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    private BaseOrgDao baseOrgDao;
    @Autowired
    private OrgTreeService orgTreeService;
    private OrgTreeDao orgTreeDao;
    @Autowired
    private UserService userService;
    @Autowired
    private UserRoleService userRoleService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
@ -57,23 +66,22 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @return
     */
    public List<Map<String,Object>> queryOrgBaseInfoList(String orgCode,String orgName,String orgStatus,int page,int size,String sorts){
        getOrgAreaTree();
        List<Map<String,Object>> result = new ArrayList<>();
        if(StringUtils.endsWithIgnoreCase("1",orgStatus)){
            if(!StringUtils.isEmpty(orgCode) ){
                result = baseOrgDao.findByCodeAndDel(orgCode,orgStatus,createPage(page,size,sorts));
                result = baseOrgDao.findByCodeAndDel(orgCode,orgStatus,creatPage(page,size,sorts));
            }else if(!StringUtils.isEmpty(orgCode)){
                result = baseOrgDao.findByNameAndDel(orgName,orgStatus,createPage(page,size,sorts));
                result = baseOrgDao.findByNameAndDel(orgName,orgStatus,creatPage(page,size,sorts));
            }else{
                result = baseOrgDao.findBaseInfoByDel(orgStatus,createPage(page,size,sorts));
                result = baseOrgDao.findBaseInfoByDel(orgStatus,creatPage(page,size,sorts));
            }
        }else{
            if(!StringUtils.isEmpty(orgCode) ){
                result = baseOrgDao.findByCode(orgCode,createPage(page,size,sorts));
                result = baseOrgDao.findByCode(orgCode,creatPage(page,size,sorts));
            }else if(!StringUtils.isEmpty(orgCode)){
                result = baseOrgDao.findByName(orgName,createPage(page,size,sorts));
                result = baseOrgDao.findByName(orgName,creatPage(page,size,sorts));
            }else{
                result = baseOrgDao.findBaseInfo(createPage(page,size,sorts));
                result = baseOrgDao.findBaseInfo(creatPage(page,size,sorts));
            }
        }
        return result;
@ -95,9 +103,6 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        if(StringUtils.isEmpty(baseOrgDO.getId())){
            baseOrgDao.save(baseOrgDO);
            //添加机构和区域的树形结构关系
//            orgTreeService.addOrgTreeNode(baseOrgDO);
            //新增用户(管理员)
            userDO = new UserDO();
            userDO.setUsername(adminName);
@ -110,7 +115,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            userRoleDO.setUserId("");
            userRoleService.save(userRoleDO);
        }else{
            String adminId = orgAdminJson.getString("adminId");
            String adminId = orgAdminJson.getString("id");
            if(StringUtils.isEmpty(adminId)){
                return "paramter id for admin is null when update";
            }
@ -160,7 +165,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    public String getOrgAreaTree(){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeService.findListByLevel(OrgTree.Level.org.getLevelValue()));
        treeNodes.addAll(orgTreeDao.findAll());
        SimpleTree tree = new SimpleTree(treeNodes);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
@ -170,5 +175,20 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        return JSONObject.toJSONString(treeNode, filter);
    }
    public String getOrgAreaTree(String saasId){
        StringBuffer sql = new StringBuffer("SELECT t.* from base_org b,org_tree t ")
                .append("WHERE b.saasid='").append(saasId).append("' AND ")
                .append("(b.`code`= t.`code` or b.city_code=t.`code` or b.province_code = t.`code` or b.town_code=t.`code`)");
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(OrgTree.class)));
        SimpleTree tree = new SimpleTree(treeNodes);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        return JSONObject.toJSONString(treeNode, filter);
    }
}

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

@ -32,7 +32,7 @@ public class SimpleTreeNode {
        this.nodeId = obj.extractNodeId();
        this.nodeName = obj.extractNodeName();
        this.parentNodeId = obj.extractNodeParentId();
//        this.level = obj.extractOrderNum();
//        this.orderNum = obj.extractOrderNum();
    }
    public void addChild(SimpleTreeNode treeNode){
        this.children.add(treeNode);

+ 0 - 12
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java

@ -1,12 +1,7 @@
package com.yihu.jw.base.service.patient;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.patient.BasePatientDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,7 +10,6 @@ import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.*;
/**
@ -36,12 +30,6 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private PatientMedicardCardService patientMedicardCardService;
    /**
     * 居民id
     * @param patientId

+ 91 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BasePopulationService.java

@ -1,22 +1,106 @@
package com.yihu.jw.base.service.population;
import com.yihu.jw.base.dao.population.BasePopulationDao;
import com.yihu.jw.base.endpoint.common.populationBatchImport.PopulationMsg;
import com.yihu.jw.entity.base.population.BasePopulationDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.mysql.query.BaseJpaService;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 
 * 基础人口基数信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年09月26日 update
 *
 * </pre>
 * @version <pre>
 *                            Author	Version		Date		Changes
 *                            litaohong    1.0  2018年09月26日 update
 *
 *                            </pre>
 * @since 1.
 */
@Service
public class BasePopulationService extends BaseJpaService<BasePopulationDO, BasePopulationDao> {
    @Autowired
    private BasePopulationDao basePopulationDao;
    public BasePopulationDO findById(String id) {
        return basePopulationDao.findOne(id);
    }
    /**
     * 批量导入基础人口信息的集合
     *
     * @param populations 基础人口信息
     */
    public Map<String, Object> batchInsertPopulation(List<PopulationMsg> populations) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
        int correctCount = 0;
        List<BasePopulationDO> corrects = new ArrayList<>();
        BasePopulationDO basePopulationDO;
        //批量存储
        for (PopulationMsg populationMsg : populations) {
            basePopulationDO = new BasePopulationDO();
            basePopulationDO.setId(getCode());
            basePopulationDO.setSaasId(populationMsg.getSaasId());
            basePopulationDO.setSaasName(populationMsg.getSaasName());
            basePopulationDO.setSaasCreateTime(populationMsg.getSaasCreateTime());
            basePopulationDO.setYear(populationMsg.getYear());
            basePopulationDO.setProvinceCode(populationMsg.getProvinceCode());
            basePopulationDO.setProvinceName(populationMsg.getProvinceName());
            basePopulationDO.setCityCode(populationMsg.getCityCode());
            basePopulationDO.setCityName(populationMsg.getCityName());
            basePopulationDO.setDistrictCode(populationMsg.getDistrictCode());
            basePopulationDO.setDistrictName(populationMsg.getDistrictName());
            basePopulationDO.setRegisPopulationNum(populationMsg.getRegisPopulationNum());
            basePopulationDO.setPopulationNum(populationMsg.getPopulationNum());
            //糖尿病人数
            basePopulationDO.setDmNum(null == populationMsg.getDmNum() ? 0 : populationMsg.getDmNum());
            //高血压人数
            basePopulationDO.setHbpNum(null == populationMsg.getHbpNum() ? 0 : populationMsg.getHbpNum());
            basePopulationDO.setTaskNum(populationMsg.getTaskNum());
            //慢病人数
            basePopulationDO.setNcdNum(basePopulationDO.getHbpNum() + basePopulationDO.getDmNum());
            corrects.add(basePopulationDO);
            if (corrects.size() > 100) {
                basePopulationDao.save(corrects);
                correctCount += corrects.size();
                corrects.clear();
            }
        }
        if (!corrects.isEmpty()) {
            basePopulationDao.save(corrects);
            correctCount += corrects.size();
        }
        result.put("correctCount", correctCount);
        return result;
    }
    public List<String> getFacilityCodeByServerType() {
        Session s = currentSession();
        String hql = "SELECT concat(p.saas_name,p.year)  FROM  base_population p ";
        Query query = s.createSQLQuery(hql);
        return query.list();
    }
    public Boolean checkPopulationName(String id,String saasId, String year) {
        String hql = "SELECT count(1)  FROM  base_population p WHERE p.saas_id=:saasId AND  p.year=:year AND  p.id != :id";
        SQLQuery sqlQuery = currentSession().createSQLQuery(hql);
        sqlQuery.setParameter("id", id);
        sqlQuery.setParameter("saasId", saasId);
        sqlQuery.setParameter("year", year);
        BigInteger count = (BigInteger) sqlQuery.uniqueResult();
        return count.compareTo(new BigInteger("0")) > 0;
    }
}

+ 42 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BaseYearService.java

@ -0,0 +1,42 @@
package com.yihu.jw.base.service.population;
import com.yihu.jw.base.dao.population.BaseYearDao;
import com.yihu.jw.entity.base.module.ModuleDO;
import com.yihu.jw.entity.base.module.SaasTypeModuleDO;
import com.yihu.jw.entity.base.population.BaseYearDO;
import com.yihu.jw.entity.base.saas.SaasTypeDictDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by zdm on 2018/10/12.
 */
@Service
public class BaseYearService extends BaseJpaService<BaseYearDO, BaseYearDao> {
    @Autowired
    private BaseYearDao baseYearDao;
    public boolean save(int year) {
        BaseYearDO baseYearDo;
        List<BaseYearDO> baseYearDOList=new ArrayList<>();
        for( int i=year;i>1989;i--){
            baseYearDo=new BaseYearDO();
            String uuid=getCode();
            baseYearDo.setId(uuid);
            baseYearDo.setYear(i+"年");
            baseYearDOList.add(baseYearDo);
        }
        baseYearDao.save(baseYearDOList);
        return true;
    }
    public List<String> getYearList(){
      return baseYearDao.findYears();
    }
}

+ 26 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/BaseEmailTemplateConfigService.java

@ -0,0 +1,26 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.BaseEmailTemplateConfigDao;
import com.yihu.jw.entity.base.saas.BaseEmailTemplateConfigDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Service - BaseEmailTemplateConfig
 * Created by zdm on 2018/8/14.
 */
@Service
public class BaseEmailTemplateConfigService extends BaseJpaService<BaseEmailTemplateConfigDO, BaseEmailTemplateConfigDao> {
    @Autowired
    private BaseEmailTemplateConfigDao baseEmailTemplateConfigDao;
    public BaseEmailTemplateConfigDO findById(String id) {
        return baseEmailTemplateConfigDao.findById(id);
    }
    public BaseEmailTemplateConfigDO findByCode(String code) {
        return baseEmailTemplateConfigDao.findByCode(code);
    }
}

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

@ -1,22 +1,36 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.dict.*;
import com.yihu.jw.base.dao.module.SaasModuleDao;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.base.dao.saas.SaasThemeDao;
import com.yihu.jw.base.dao.saas.SaasThemeExtendDao;
import com.yihu.jw.base.dao.system.SystemDictDao;
import com.yihu.jw.base.dao.system.SystemDictEntryDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.dao.user.UserRoleDao;
import com.yihu.jw.entity.base.dict.*;
import com.yihu.jw.entity.base.module.SaasModuleDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.saas.SaasThemeDO;
import com.yihu.jw.entity.base.saas.SaasThemeExtendDO;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.user.UserRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -40,26 +54,172 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
    private UserRoleDao userRoleDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private SystemDictEntryDao systemDictEntryDao;
    @Autowired
    private DictMedicineDao dictMedicineDao;
    @Autowired
    private DictJobTitleDao dictJobTitleDao;
    @Autowired
    private DictIcd10Dao dictIcd10Dao;
    @Autowired
    private DictHealthProblemDao dictHealthProblemDao;
    @Autowired
    private DictDiseaseDao dictDiseaseDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private SaasModuleDao saasModuleDao;
    @Autowired
    private SaasThemeDao saasThemeDao;
    @Autowired
    private SaasThemeExtendDao saasThemeExtendDao;
    @Value("${configDefault.saasId}")
    private String defaultSaasId;
    /**
     * 默认租户管理员角色code
     */
    private final String roleCode = "saasAdmin";
    /**
     * 注册新增
     * @param saas
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public SaasDO create(SaasDO saas){
        saas.setStatus(SaasDO.Status.auditWait);
        saas = saasDao.save(saas);
        List<BaseOrgDO> orgDOList = saas.getOrgList();
        if(orgDOList!=null&&orgDOList.size()>0){
            String saasId = saas.getId();
            orgDOList.forEach(org->{
                org.setSaasid(saasId);
            });
        }
        baseOrgDao.save(orgDOList);
        return saas;
    }
    /**
     * 修改
     * @param saas
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public SaasDO updateSaas(SaasDO saas,SaasDO oldSaas,UserDO userDO){
        String saasId = saas.getId();
        oldSaas.setEmail(saas.getEmail());
        oldSaas.setMobile(saas.getMobile());
        oldSaas.setManagerName(saas.getManagerName());
        oldSaas.setName(saas.getName());
        oldSaas.setStatus(saas.getStatus());
        oldSaas.setOrganizationCode(saas.getOrganizationCode());
        oldSaas.setBusinessLicense(saas.getBusinessLicense());
        userDO.setEmail(saas.getEmail());
        userDO.setMobile(saas.getMobile());
        userDO.setName(saas.getManagerName());
        baseOrgDao.deleteBySaasId(saasId);
        List<BaseOrgDO> orgDOList = saas.getOrgList();
        if(orgDOList!=null&&orgDOList.size()>0){
            orgDOList.forEach(org->{
                org.setSaasid(saasId);
            });
        }
        baseOrgDao.save(orgDOList);
        saasDao.save(oldSaas);
        userDao.save(userDO);
        return oldSaas;
    }
    /**
     * 系统配置
     * @param saasDO
     */
    @Transactional(rollbackFor = Exception.class)
    public void saveSystemConfig(SaasDO saasDO){
        SaasDO oldSaas = saasDao.findById(saasDO.getId());
        oldSaas.setSystemName(saasDO.getSystemName());
        oldSaas.setLogo(saasDO.getLogo());
        oldSaas.setAreaNumber(saasDO.getAreaNumber());
        List<SaasModuleDO> saasModuleDOList = saasDO.getSaasModuleList();
        saasModuleDOList.forEach(saasModuleDO -> {
            saasModuleDO.setSaasId(saasDO.getId());
        });
        saasDao.save(oldSaas);
        saasModuleDao.save(saasModuleDOList);
    }
    public void updateStatus(String id,SaasDO.Status status){
        SaasDO saasDO = findById(id);
        saasDO.setStatus(status);
        saasDao.save(saasDO);
    }
    /**
     * 主题风格
     * @param saasDO
     */
    @Transactional(rollbackFor = Exception.class)
    public void createThemeConfig(SaasDO saasDO){
        SaasDO oldSaas = saasDao.findById(saasDO.getId());
        oldSaas.setThemeColor(saasDO.getThemeColor());
        List<SaasThemeDO> themeDOList = saasDO.getSaasThemeList();
        List<SaasThemeExtendDO> themeExtendDOList = new ArrayList<>(16);
        themeDOList.forEach(saasThemeDO -> {
            String themeId = getCode();
            saasThemeDO.setSaasId(saasDO.getId());
            saasThemeDO.setId(themeId);
            if(saasThemeDO.getThemeExtendList()!=null&&saasThemeDO.getThemeExtendList().size()>0){
                saasThemeDO.getThemeExtendList().forEach(saasThemeExtendDO -> {
                    saasThemeExtendDO.setThemeId(themeId);
                    themeExtendDOList.add(saasThemeExtendDO);
                });
            }
        });
        saasDao.save(oldSaas);
        saasThemeDao.save(themeDOList);
        saasThemeExtendDao.save(themeExtendDOList);
    }
    @Transactional
    public SaasDO save(SaasDO saas, UserDO user) {
        //初始化租户信息
        String saasId = getCode();
        String userId = getCode();
        saas.setId(saasId);
        saas.setManager(userId);
    public void delete(String ids) {
        for (String id : ids.split(",")) {
            SaasDO saas = saasDao.findById(id);
            saas.setStatus(SaasDO.Status.delete);
        }
    }
    public SaasDO findById(String id){
        return saasDao.findById(id);
    }
    public SaasDO findByName(String name){
        return saasDao.findByName(name);
    }
    /**
     *审核通过后,初始化租户信息
     * @param saas
     * @param user
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public SaasDO saasAudit(SaasDO saas, UserDO user) {
        //初始化角色
        RoleDO roleDO = roleDao.findByCode(roleCode);
        //初始化租户管理员
        user.setId(userId);
        user.setEnabled(true);
        user.setLocked(false);
        user.setSalt(randomString(5));
        user.setName(user.getEmail());
        String password = user.getPassword();
        //密码默认手机号后6位
        if (StringUtils.isEmpty(password)) {
@ -68,28 +228,115 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        user.setPassword(MD5.md5Hex(password + "{" + user.getSalt() + "}"));
        //初始化管理员角色
        UserRoleDO userRoleDO = new UserRoleDO();
        userRoleDO.setUserId(user.getId());
        userRoleDO.setRoleId(roleDO.getId());
        List<BaseOrgDO> orgDOList = saas.getOrgList();
        orgDOList.forEach(org->{
            org.setSaasid(saasId);
        });
        //保存数据
        saas.setStatus(SaasDO.Status.auditWait);
        saas = saasDao.save(saas);
        baseOrgDao.save(orgDOList);
        userDao.save(user);
        userRoleDO.setUserId(user.getId());
        userRoleDao.save(userRoleDO);
//        roleModuleFunctionDao.save(roleModuleFunctionDOS);
        return saas;
    }
        saas.setManager(user.getId());
        saas = saasDao.save(saas);
        String saasId = saas.getId();
        //系统字典项
        List<SystemDictEntryDO> systemDictEntryDOList = systemDictEntryDao.findBySaasId(defaultSaasId);
        List<SystemDictEntryDO> dictEntryDOList = new ArrayList<>(systemDictEntryDOList.size());
        systemDictEntryDOList.forEach(dict->{
            SystemDictEntryDO systemDictEntryDO = new SystemDictEntryDO();
            systemDictEntryDO.setCode(dict.getCode());
            systemDictEntryDO.setSort(dict.getSort());
            systemDictEntryDO.setSaasId(saasId);
            systemDictEntryDO.setPyCode(dict.getPyCode());
            systemDictEntryDO.setDictCode(dict.getDictCode());
            systemDictEntryDO.setRemark(dict.getRemark());
            systemDictEntryDO.setValue(dict.getValue());
            dictEntryDOList.add(systemDictEntryDO);
        });
        //药品字典
        List<DictMedicineDO> dictMedicineDOList = dictMedicineDao.findBySaasId(defaultSaasId);
        List<DictMedicineDO> medicineDOList = new ArrayList<>(dictMedicineDOList.size());
        dictMedicineDOList.forEach(dict->{
            DictMedicineDO dictMedicineDO = new DictMedicineDO();
            dictMedicineDO.setCode(dict.getCode());
            dictMedicineDO.setDosageForm(dict.getDosageForm());
            dictMedicineDO.setIndication(dict.getIndication());
            dictMedicineDO.setName(dict.getName());
            dictMedicineDO.setPackingSpecification(dict.getPackingSpecification());
            dictMedicineDO.setSequence(dict.getSequence());
            dictMedicineDO.setSpecification(dict.getSpecification());
            dictMedicineDO.setSpellCode(dict.getSpellCode());
            dictMedicineDO.setSubjectCode(dict.getSubjectCode());
            dictMedicineDO.setWbzxCode(dict.getWbzxCode());
            dictMedicineDO.setSaasId(saasId);
            dictMedicineDO.setStorageConditions(dict.getStorageConditions());
            medicineDOList.add(dictMedicineDO);
        });
        //职称字典
        List<DictJobTitleDO> dictJobTitleDOList = dictJobTitleDao.findBySaasId(defaultSaasId);
        List<DictJobTitleDO> jobTitleDOList = new ArrayList<>(dictJobTitleDOList.size());
        dictJobTitleDOList.forEach(dict->{
            DictJobTitleDO jobTitleDO = new DictJobTitleDO();
            jobTitleDO.setSaasId(saasId);
            jobTitleDO.setName(dict.getName());
            jobTitleDO.setCode(dict.getCode());
            jobTitleDO.setCreateTime(new Date());
            jobTitleDOList.add(jobTitleDO);
        });
        //icd10字典
        List<DictIcd10DO> dictIcd10DOList = dictIcd10Dao.findBySaasId(defaultSaasId);
        List<DictIcd10DO> icd10DOList = new ArrayList<>(dictIcd10DOList.size());
        dictIcd10DOList.forEach(dict->{
            DictIcd10DO icd10DO = new DictIcd10DO();
            icd10DO.setSaasId(saasId);
            icd10DO.setName(dict.getName());
            icd10DO.setCode(dict.getCode());
            icd10DO.setCreateTime(new Date());
            icd10DO.setDescription(dict.getDescription());
            icd10DOList.add(icd10DO);
        });
        //健康问题字典
        List<DictHealthProblemDO> dictHealthProblemDOList = dictHealthProblemDao.findBySaasId(defaultSaasId);
        List<DictHealthProblemDO> healthProblemDOList = new ArrayList<>(dictHealthProblemDOList.size());
        dictHealthProblemDOList.forEach(dict->{
            DictHealthProblemDO healthProblemDO = new DictHealthProblemDO();
            healthProblemDO.setSaasId(saasId);
            healthProblemDO.setName(dict.getName());
            healthProblemDO.setCode(dict.getCode());
            healthProblemDO.setCreateTime(new Date());
            healthProblemDO.setDescription(dict.getDescription());
            healthProblemDO.setChronicFlag(dict.getChronicFlag());
            healthProblemDOList.add(healthProblemDO);
        });
        //病种字典
        List<DictDiseaseDO> dictDiseaseDOList = dictDiseaseDao.findBySaasId(defaultSaasId);
        List<DictDiseaseDO> diseaseDOList = new ArrayList<>(dictDiseaseDOList.size());
        dictDiseaseDOList.forEach(dict->{
            DictDiseaseDO diseaseDO = new DictDiseaseDO();
            diseaseDO.setSaasId(saasId);
            diseaseDO.setName(dict.getName());
            diseaseDO.setCode(dict.getCode());
            diseaseDO.setCreateTime(new Date());
            diseaseDOList.add(diseaseDO);
        });
        //科室字典
        List<DictHospitalDeptDO> dictHospitalDeptDOList = dictHospitalDeptDao.findBySaasId(defaultSaasId);
        List<DictHospitalDeptDO> hospitalDeptDOList = new ArrayList<>(dictHospitalDeptDOList.size());
        dictHospitalDeptDOList.forEach(dict->{
            DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
            deptDO.setSaasId(saasId);
            deptDO.setName(dict.getName());
            deptDO.setCode(dict.getCode());
            deptDO.setCreateTime(new Date());
            hospitalDeptDOList.add(deptDO);
        });
    @Transactional
    public void delete(String ids) {
        for (String id : ids.split(",")) {
            SaasDO saas = saasDao.findById(id);
            saas.setStatus(SaasDO.Status.delete);
        }
        //保存数据
//        systemDictDao.save(dictDOList);
        systemDictEntryDao.save(dictEntryDOList);
        dictMedicineDao.save(medicineDOList);
        dictJobTitleDao.save(jobTitleDOList);
        dictIcd10Dao.save(icd10DOList);
        dictHealthProblemDao.save(healthProblemDOList);
        dictDiseaseDao.save(diseaseDOList);
        dictHospitalDeptDao.save(hospitalDeptDOList);
        return saas;
    }
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasThemeExtendService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasThemeExtendDao;
import com.yihu.jw.entity.base.saas.SaasThemeExtendDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 主题风格扩展表(type=2时存多图)
 * @author yeshijie on 2018/10/16.
 */
@Service
public class SaasThemeExtendService extends BaseJpaService<SaasThemeExtendDO, SaasThemeExtendDao> {
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasThemeService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasThemeDao;
import com.yihu.jw.entity.base.saas.SaasThemeDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 租户主题风格
 * @author yeshijie on 2018/10/16.
 */
@Service
public class SaasThemeService extends BaseJpaService<SaasThemeDO, SaasThemeDao> {
}

+ 21 - 22
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasTypeDictService.java

@ -38,41 +38,39 @@ public class SaasTypeDictService extends BaseJpaService<SaasTypeDictDO, SaasType
    @Autowired
    private SaasTypeModuleDao saasTypeModuleDao;
    @Transactional
    public SaasTypeDictDO save(SaasTypeDictDO saasTypeDictDO, String saasTypeModuleIds) {
        String saasTypeId;
        if (StringUtils.isEmpty(saasTypeDictDO.getId())) {
            //新增
            saasTypeDictDO.setCode(getNextSaasTypeDictCode());
            saasTypeId = getCode();
        } else {
            //编辑
            saasTypeId = saasTypeDictDO.getId();
        }
        //保存数据
        saasTypeDictDO = saasTypeDictDao.save(saasTypeDictDO);
        String saasTypeId = saasTypeDictDO.getId();
        //根据moduleId获取模块
        String[] ids = saasTypeModuleIds.split(",");
        SaasTypeModuleDO saasTypeModuleDO;
        List<SaasTypeModuleDO> saasDefaultModuleDOS = new ArrayList<>();
        for (String id : ids) {
            ModuleDO moduleDO = moduleDao.findOne(id);
            saasTypeModuleDO = new SaasTypeModuleDO();
            saasTypeModuleDO.setModuleId(id);
            saasTypeModuleDO.setName(moduleDO.getName());
            saasTypeModuleDO.setParentModuleId(moduleDO.getParentId());
            saasTypeModuleDO.setType(moduleDO.getType());
            saasTypeModuleDO.setStatus(moduleDO.getStatus());
            saasTypeModuleDO.setIsEnd(moduleDO.getIsEnd());
            saasTypeModuleDO.setIsMust(moduleDO.getIsMust());
            saasTypeModuleDO.setUrl(moduleDO.getUrl());
            saasTypeModuleDO.setRemark(moduleDO.getRemark());
            saasTypeModuleDO.setSaasTypeId(saasTypeId);
            saasDefaultModuleDOS.add(saasTypeModuleDO);
            if(!StringUtils.isEmpty(id)){
                ModuleDO moduleDO = moduleDao.findOne(id);
                saasTypeModuleDO = new SaasTypeModuleDO();
                saasTypeModuleDO.setModuleId(id);
                saasTypeModuleDO.setName(moduleDO.getName());
                saasTypeModuleDO.setParentModuleId(moduleDO.getParentId());
                saasTypeModuleDO.setType(moduleDO.getType());
                saasTypeModuleDO.setStatus(moduleDO.getStatus());
                saasTypeModuleDO.setIsEnd(moduleDO.getIsEnd());
                saasTypeModuleDO.setIsMust(moduleDO.getIsMust());
                saasTypeModuleDO.setUrl(moduleDO.getUrl());
                saasTypeModuleDO.setRemark(moduleDO.getRemark());
                saasTypeModuleDO.setSaasTypeId(saasTypeId);
                saasDefaultModuleDOS.add(saasTypeModuleDO);
            }
        }
        //初始化租户默认模块
        saasTypeModuleDao.save(saasDefaultModuleDOS);
        //保存数据
        SaasTypeDictDO saasTypeDictDO1 = saasTypeDictDao.save(saasTypeDictDO);
        return saasTypeDictDO1;
        return saasTypeDictDO;
    }
    /**
@ -103,6 +101,7 @@ public class SaasTypeDictService extends BaseJpaService<SaasTypeDictDO, SaasType
    public SaasTypeDictDO findById(String id) {
        return saasTypeDictDao.findById(id);
    }
    public SaasTypeDictDO findByCode(Integer code) {
        return saasTypeDictDao.findByCode(code);
    }

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasUserDao;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Service
public class SaasUserService extends BaseJpaService<SaasUserDO, SaasUserDao> {
}

+ 63 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WeChatQrcodeService.java

@ -4,10 +4,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpRequest;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@ -25,7 +29,7 @@ public class WeChatQrcodeService {
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    public String getQrcode(String wechatId,String scene) throws Exception{
    public String getQrcode(HttpServletRequest request, String wechatId, String scene) throws Exception{
        String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
        String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + scene + "\"}}}";
        //服务号必须是通过腾讯认证,每年是300元,如果没有认证而导致的错误提示,那就去认证
@ -43,11 +47,67 @@ public class WeChatQrcodeService {
                HttpURLConnection connection = (HttpURLConnection) urlGet.openConnection();
                connection.connect();
                inputStream = connection.getInputStream();
                ObjectNode objectNode = fastDFSHelper.upload(inputStream,"png","微信二维码");
//                String pathFile = request.getSession().getServletContext().getRealPath("/")
//                        + File.separator + "qrcode" + File.separator + wechatId+"_"+scene+".png";
                String path = WeChatQrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                        + File.separator + "qrcode" ;
                File dir = new File(path);
                if(!dir.exists()){
                    dir.mkdir();
                }
                path+= File.separator + wechatId+"_"+scene+".png";
                File file = new File(path);
                // 保存文件
                FileOutputStream outputStream = new FileOutputStream(file);
                byte[] data = new byte[1024];
                int len = 0;
                while ((len = inputStream.read(data)) != -1) {
                    outputStream.write(data, 0, len);
                }
                InputStream input = new FileInputStream(file);
                ObjectNode objectNode = fastDFSHelper.upload(input,"png","");
                File del = new File(path);
                if(del.exists()&&del.isFile()){
                    del.delete();
                }
                if (outputStream != null) {
                    outputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                return objectNode.get("fileId").toString().replaceAll("\"", "");
            }
        }
        return "";
    }
//    public void write(InputStream inputStream)throws Exception{
//        String file = "D:\\workspace\\file\\test.png";
//        // 保存文件
//        FileOutputStream outputStream = new FileOutputStream(file);
//
//        byte[] data = new byte[1024];
//        int len = 0;
//
//        while ((len = inputStream.read(data)) != -1) {
//            outputStream.write(data, 0, len);
//        }
//
//        if (outputStream != null) {
//            outputStream.close();
//        }
//
//    }
}

+ 2 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatCoreService.java

@ -15,6 +15,7 @@ import org.dom4j.io.SAXReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -33,6 +34,7 @@ public class WechatCoreService {
    private Logger logger = LoggerFactory.getLogger(WechatCoreService.class);
    @Autowired
    private WechatDao wechatDao;

+ 62 - 17
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java

@ -5,8 +5,10 @@ import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.restmodel.base.wx.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -71,12 +73,12 @@ public class WechatService {
            sql += " AND w.public_type = " + publicType + " " ;
        }
        if (status!=null) {
            sql += " AND w.`status` = " + status + "";
            sql += " AND w.`status` = " + status + " ";
        }
        if (StringUtils.isNotBlank(saasName)) {
            sql += " AND bs.`name` like '%" + saasName + "%'";
        }
        sql += "LIMIT " + (page - 1) * size + "," + size + "";
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<WxWechatVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxWechatVO.class));
        if(list!=null&&list.size()>0){
@ -120,7 +122,7 @@ public class WechatService {
                " bs.id AS saasid" +
                " FROM " +
                " wx_wechat_saas s " +
                " JOIN base_saas bs ON s.saas_id = s.saas_id " +
                " JOIN base_saas bs ON bs.id = s.saas_id " +
                " WHERE " +
                " s.wechat_id = '"+id+"'";
        List<WxSaasVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxSaasVO.class));
@ -128,13 +130,12 @@ public class WechatService {
    }
    public Envelop saveWxAndSaas(WxWechatDO wxWechatDO, List<WxWechatSaasDO> wxWechatSaasDOs){
        String uuid = UUID.randomUUID().toString();
        wxWechatDO.setId(uuid);
        wechatDao.save(wxWechatDO);
        WxWechatDO wechat = wechatDao.save(wxWechatDO);
        if(wxWechatSaasDOs!=null&&wxWechatSaasDOs.size()>0){
            for(WxWechatSaasDO wxs:wxWechatSaasDOs){
                wxs.setWechatId(uuid);
                wxs.setWechatId(wechat.getId());
            }
            wxWechatSaasDao.save(wxWechatSaasDOs);
        }
@ -157,32 +158,60 @@ public class WechatService {
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
    public WxWechatDO findWxWechatSingle(String wechatId){
        WxWechatDO wxWechatDO = wechatDao.findOne(wechatId);
        return wxWechatDO;
    }
    public Boolean findWxWechatExist(String name){
        List<WxWechatDO> list = wechatDao.findByName(name);
        if(list!=null&&list.size()>0){
            return true;
        }
        return false;
    }
    //====================微信与租户管理end=======================
    //====================图文素材管理============================
    public MixEnvelop findWechatCombo(){
        String sql ="SELECT t.id,t.`name`,t.app_origin_id AS appOriginId from wx_wechat t";
        String sql ="SELECT t.id,t.`name`," +
                "t.app_origin_id AS appOriginId," +
                "t.public_type AS publicType " +
                "from wx_wechat t";
        List<WxComboVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxComboVO.class));
        return MixEnvelop.getSuccessList(BaseRequestMapping.WeChat.api_success,list);
    }
    public MixEnvelop findWechatImgGroup(String wechatId,Integer page,Integer size){
    public MixEnvelop findWechatImgGroup(String wechatId,String scene,Integer page,Integer size){
        String totalSql ="SELECT COUNT(1) AS total from wx_graphic_scene g WHERE g.wechat_id ='"+wechatId+"'";
        if(StringUtils.isNotBlank(scene)){
            totalSql+=" AND g.scene like'%"+scene+"%' ";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        String sql = "SELECT " +
                " g.id,g.wechat_id AS wechatId,g.scene " +
                " FROM " +
                " wx_graphic_scene g " +
                " WHERE " +
                " g.wechat_id = '"+wechatId+"' " +
                " LIMIT  " + (page - 1) * size + "," + size + "";
                " g.wechat_id = '"+wechatId+"' ";
        if(StringUtils.isNotBlank(scene)){
            sql+= " AND g.scene like'%"+scene+"%'" ;
        }
        sql+= " LIMIT  " + (page - 1) * size + "," + size + "";
        List<WxGraphicSceneVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxGraphicSceneVO.class));
        return MixEnvelop.getSuccessListWithPage(BaseRequestMapping.WeChat.api_success, list, page, size, count);
@ -193,6 +222,14 @@ public class WechatService {
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
    public Boolean findImgGroupExist(String wechatId,String scene){
        List<WxGraphicSceneDO> list = wxGraphicSceneDao.findByWechatIdAndScene(wechatId,scene);
        if(list!=null&&list.size()>0){
            return true;
        }
        return false;
    }
    public Envelop updateImgGroup(String id,String scene){
        WxGraphicSceneDO wxGraphicSceneDO = wxGraphicSceneDao.findOne(id);
        List<WxGraphicSceneGroupDO> list = wxGraphicSceneGroupDao.findByWechatIdAndScene(wxGraphicSceneDO.getWechatId(),wxGraphicSceneDO.getScene());
@ -234,12 +271,12 @@ public class WechatService {
                }
        sqlTotal+= " WHERE " +
                " m.wechat_id = '"+wechatId+"' " +
                " m.status =1" ;
                " AND m.status =1" ;
                if(StringUtils.isNotBlank(title)){
                    sqlTotal += " AND m.title LIKE '%"+title+"%' " ;
                }
                if(StringUtils.isNotBlank(scene)){
                    sqlTotal+= "AND g.scene = '"+scene+"'";
                    sqlTotal+= " AND g.scene = '"+scene+"'";
                }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sqlTotal);
        Long count = 0L;
@ -250,12 +287,10 @@ public class WechatService {
        String sql = "SELECT " +
                " m.id, " +
                " m.wechat_id AS wechatId, " +
                " m.`code` AS code, " +
                " m.title, " +
                " m.description, " +
                " m.url, " +
                " m.pic_url AS picUrl, " +
                " m.remark, " +
                " m.`status` " +
                " FROM " +
                " wx_graphic_message m ";
@ -263,18 +298,22 @@ public class WechatService {
            sql+= " JOIN wx_graphic_scene_group g ON g.graphic_id = m.id ";
        }
        sql+=" WHERE m.wechat_id = '"+wechatId+"' " +
                " m.status =1" ;
                " AND m.status =1" ;
        if(StringUtils.isNotBlank(title)){
            sql += " AND m.title LIKE '%"+title+"%' " ;
        }
        if(StringUtils.isNotBlank(scene)){
            sql+= "AND g.scene = '"+scene+"'";
            sql+= " AND g.scene = '"+scene+"' ORDER BY g.scene ASC ";
        }
        sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
        List<WxGraphicMessageVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxGraphicMessageVO.class));
        return MixEnvelop.getSuccessListWithPage(BaseRequestMapping.WeChat.api_success, list, page, size, count);
    }
    public WxGraphicMessageDO findGraphicMessageSingle(String id){
        return wxGraphicMessageDao.findOne(id);
    }
    public Envelop saveImgGroup(List<WxGraphicSceneGroupDO> groups){
        List<WxGraphicSceneGroupDO> gs = wxGraphicSceneGroupDao.findByWechatIdAndScene(groups.get(0).getWechatId(),groups.get(0).getScene());
        if(gs!=null&&gs.size()>0){
@ -284,6 +323,12 @@ public class WechatService {
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
    public Envelop deleteImgGroupRelation(String wechatId,String scene,String imgId){
        WxGraphicSceneGroupDO wxGraphicSceneGroupDO = wxGraphicSceneGroupDao.findByWechatIdAndSceneAndGraphicId(wechatId,scene,imgId);
        wxGraphicSceneGroupDao.delete(wxGraphicSceneGroupDO);
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
    public Envelop saveWxReplyScene(WxReplySceneDO wxReplySceneDO){
        wxReplySceneDao.save(wxReplySceneDO);
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);

+ 14 - 0
svr/svr-base/src/main/resources/application.yml

@ -79,6 +79,20 @@ spring:
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
  mail:
    default-encoding: UTF-8
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#端口
    port: 25
#协议
    protocol: smtp
#发送者的邮箱账号
    username: i_jiankang@163.com
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
# 短信发送地址

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-base
    name: svr-base-lith
  cloud:
    config:
      failFast: true

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-iot
    name: svr-iot-lith
  cloud:
    config:
      failFast: true