Browse Source

规范格式化

gaodm 6 years ago
parent
commit
7f20459854
28 changed files with 571 additions and 570 deletions
  1. 49 45
      user-service/src/main/java/com/diagbot/facade/VerFacade.java
  2. 1 0
      user-service/src/main/java/com/diagbot/service/EnumsDataService.java
  3. 2 0
      user-service/src/main/java/com/diagbot/service/ImgVerService.java
  4. 1 3
      user-service/src/main/java/com/diagbot/service/OrganizationService.java
  5. 1 0
      user-service/src/main/java/com/diagbot/service/SmsVerService.java
  6. 1 1
      user-service/src/main/java/com/diagbot/service/UserAuthenticationService.java
  7. 1 1
      user-service/src/main/java/com/diagbot/service/UserOrganizationService.java
  8. 9 8
      user-service/src/main/java/com/diagbot/service/UserService.java
  9. 127 128
      user-service/src/main/java/com/diagbot/util/ExportBeanExcelUtil.java
  10. 6 7
      user-service/src/main/java/com/diagbot/util/SmsCodeUtil.java
  11. 48 39
      user-service/src/main/java/com/diagbot/util/VerifyCodeUtils.java
  12. 8 10
      user-service/src/main/java/com/diagbot/vo/OrganizationVO.java
  13. 3 3
      user-service/src/main/java/com/diagbot/vo/SmsVerCreatVO.java
  14. 1 1
      user-service/src/main/java/com/diagbot/vo/SmsVerVerVO.java
  15. 12 13
      user-service/src/main/java/com/diagbot/vo/UserAndOrganizationVO.java
  16. 0 1
      user-service/src/main/java/com/diagbot/vo/UserAuthenticationVO.java
  17. 5 8
      user-service/src/main/java/com/diagbot/vo/UserExportVO.java
  18. 10 14
      user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java
  19. 11 15
      user-service/src/main/java/com/diagbot/vo/UserInfoOrganizationsVO.java
  20. 4 8
      user-service/src/main/java/com/diagbot/vo/UserInfoVO.java
  21. 1 1
      user-service/src/main/java/com/diagbot/vo/UserSaveVO.java
  22. 2 2
      user-service/src/main/java/com/diagbot/web/EnumsController.java
  23. 14 15
      user-service/src/main/java/com/diagbot/web/ReportFormController.java
  24. 3 3
      user-service/src/main/java/com/diagbot/web/TestController.java
  25. 1 1
      user-service/src/main/java/com/diagbot/web/UserAuthenticationController.java
  26. 56 54
      user-service/src/main/java/com/diagbot/web/UserController.java
  27. 179 179
      user-service/src/main/java/com/diagbot/web/UserInfoController.java
  28. 15 10
      user-service/src/main/java/com/diagbot/web/VerController.java

+ 49 - 45
user-service/src/main/java/com/diagbot/facade/VerFacade.java

@@ -41,9 +41,10 @@ public class VerFacade {
 
     /**
      * 获取用户图片验证信息
+     *
      * @return 图片验证码信息
      */
-    public ImgVerCreatDTO getImgVerification(){
+    public ImgVerCreatDTO getImgVerification() {
         ImgVerCreatDTO imgVerCreatDTO = new ImgVerCreatDTO();
         String imgId = visibleIdCreater.getNextId(VisibleIdTypeEnum.IS_IMG_VER.getKey()).toString();
         ImgVerInfo imgVerInfo = new ImgVerInfo();
@@ -56,10 +57,11 @@ public class VerFacade {
 
     /**
      * 验证用户图片验证码是否有效
+     *
      * @param imgVerVerVO 图片验证码验证输入信息
      * @return 验证是否成功
      */
-    public Boolean verifyImgVerification(ImgVerVerVO imgVerVerVO){
+    public Boolean verifyImgVerification(ImgVerVerVO imgVerVerVO) {
         ImgVerInfo imgVerInfo = new ImgVerInfo();
         BeanUtil.copyProperties(imgVerVerVO, imgVerInfo);
         return imgVerService.verifyImgVerification(imgVerInfo);
@@ -67,24 +69,25 @@ public class VerFacade {
 
     /**
      * 获取短信验证码
+     *
      * @param smsVerCreatVO 获取短信验证码输入参数
      * @return 获取短信验证码是否成功
      */
-    public Boolean getSmsVerification(SmsVerCreatVO smsVerCreatVO){
+    public Boolean getSmsVerification(SmsVerCreatVO smsVerCreatVO) {
         //参数验证
-        if (StringUtil.isBlank(smsVerCreatVO.getImgId())){
+        if (StringUtil.isBlank(smsVerCreatVO.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "图片验证码唯一标志不能为空!");
         }
-        if (StringUtil.isBlank(smsVerCreatVO.getCode())){
+        if (StringUtil.isBlank(smsVerCreatVO.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "图片验证码不能为空!");
         }
-        if (StringUtil.isBlank(smsVerCreatVO.getMobile())){
+        if (StringUtil.isBlank(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "用户电话不能为空!");
         }
-        if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())){
+        if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
                     "请输入正确的手机号!");
         }
@@ -92,17 +95,17 @@ public class VerFacade {
         ImgVerInfo imgVerInfo = new ImgVerInfo();
         BeanUtil.copyProperties(smsVerCreatVO, imgVerInfo);
         Boolean imgVerRes = imgVerService.verifyImgVerification(imgVerInfo);
-        if (imgVerRes){
+        if (imgVerRes) {
             User bean = userFacade.getUserInfo(smsVerCreatVO.getMobile());
-            if (bean != null){
+            if (bean != null) {
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
             }
 
             //验证是否超过三分钟
             SwsVerInfo swsVerInfoCheck = smsVerService.getSmsVerification(smsVerCreatVO.getMobile());
-            if (null != swsVerInfoCheck){
+            if (null != swsVerInfoCheck) {
                 if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), VerFacade.SMS_MINS),
-                        DateUtil.now())){
+                        DateUtil.now())) {
                     throw new CommonException(ServiceErrorCode.SMS_SEND_ERROR,
                             "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送!");
                 }
@@ -123,40 +126,40 @@ public class VerFacade {
     }
 
 
-
     /**
      * 忘记密码获取短信验证码
+     *
      * @param smsVerCreatVO 获取短信验证码输入参数
      * @return 获取短信验证码是否成功
      */
-    public Boolean getSmsWithResetPassword(SmsVerCreatVO smsVerCreatVO){
+    public Boolean getSmsWithResetPassword(SmsVerCreatVO smsVerCreatVO) {
         //参数验证
-        if (StringUtil.isBlank(smsVerCreatVO.getImgId())){
+        if (StringUtil.isBlank(smsVerCreatVO.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "图片验证码唯一标志不能为空!");
         }
-        if (StringUtil.isBlank(smsVerCreatVO.getCode())){
+        if (StringUtil.isBlank(smsVerCreatVO.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "图片验证码不能为空!");
         }
-        if (StringUtil.isBlank(smsVerCreatVO.getMobile())){
+        if (StringUtil.isBlank(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "用户电话不能为空!");
         }
-        if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())){
+        if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
                     "请输入正确的手机号!");
         }
         User bean = userFacade.getUserInfo(smsVerCreatVO.getMobile());
-        if (bean == null){
+        if (bean == null) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "手机号未注册!");
         }
 
         //验证是否超过三分钟
         SwsVerInfo swsVerInfoCheck = smsVerService.getSmsVerification(smsVerCreatVO.getMobile());
-        if (null != swsVerInfoCheck){
+        if (null != swsVerInfoCheck) {
             if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), 3000), //TODO 方便测试先加大时间间隔
-                    DateUtil.now())){
+                    DateUtil.now())) {
                 throw new CommonException(ServiceErrorCode.SMS_SEND_ERROR,
                         "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送!");
             }
@@ -176,53 +179,54 @@ public class VerFacade {
 
     /**
      * 验证短信码
+     *
      * @param smsVerVerVO 短信验证码验证输入信息
      * @return 校验短信验证码是否通过
      */
-    public Boolean verifySmsVerification(SmsVerVerVO smsVerVerVO){
+    public Boolean verifySmsVerification(SmsVerVerVO smsVerVerVO) {
         //参数验证
-        if (null == smsVerVerVO){
+        if (null == smsVerVerVO) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "短信验证码验证输入信息不能为空!");
         }
-//        if (StringUtil.isBlank(smsVerVerVO.getImgId())){
-//            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-//                    "图片验证码唯一标志不能为空!");
-//        }
-//        if (StringUtil.isBlank(smsVerVerVO.getCode())){
-//            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-//                    "图片验证码不能为空!");
-//        }
-        if (StringUtil.isBlank(smsVerVerVO.getMobile())){
+        //        if (StringUtil.isBlank(smsVerVerVO.getImgId())){
+        //            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+        //                    "图片验证码唯一标志不能为空!");
+        //        }
+        //        if (StringUtil.isBlank(smsVerVerVO.getCode())){
+        //            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+        //                    "图片验证码不能为空!");
+        //        }
+        if (StringUtil.isBlank(smsVerVerVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "用户电话不能为空!");
         }
-        if (StringUtil.isBlank(smsVerVerVO.getSmsCode())){
+        if (StringUtil.isBlank(smsVerVerVO.getSmsCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "短信验证码不能为空!");
         }
-        if (!RegexValidateUtil.checkMobileNumber(smsVerVerVO.getMobile())){
+        if (!RegexValidateUtil.checkMobileNumber(smsVerVerVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
                     "请输入正确的手机号!");
         }
         //验证图片验证码
-//        ImgVerInfo imgVerInfo = new ImgVerInfo();
-//        BeanUtil.copyProperties(smsVerVerVO, imgVerInfo);
-//        Boolean imgVerRes = imgVerService.verifyImgVerification(imgVerInfo);
-//        if (imgVerRes){
-//            User bean = userFacade.getUserInfo(smsVerVerVO.getMobile());
-//            if (bean != null){
-//                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
-//            }
-//        } else {
-//            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
-//        }
+        //        ImgVerInfo imgVerInfo = new ImgVerInfo();
+        //        BeanUtil.copyProperties(smsVerVerVO, imgVerInfo);
+        //        Boolean imgVerRes = imgVerService.verifyImgVerification(imgVerInfo);
+        //        if (imgVerRes){
+        //            User bean = userFacade.getUserInfo(smsVerVerVO.getMobile());
+        //            if (bean != null){
+        //                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
+        //            }
+        //        } else {
+        //            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
+        //        }
         //验证用户短信信息
         SwsVerInfo swsVerInfo = new SwsVerInfo();
         swsVerInfo.setMobile(smsVerVerVO.getMobile());
         swsVerInfo.setCode(smsVerVerVO.getSmsCode());
         Boolean smsVer = smsVerService.verifySmsVerification(swsVerInfo);
-        if (!smsVer){
+        if (!smsVer) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "短信验证码输入有误,请重新输入!");
         }
         return true;

+ 1 - 0
user-service/src/main/java/com/diagbot/service/EnumsDataService.java

@@ -13,6 +13,7 @@ import java.util.Map;
 public interface EnumsDataService {
     /**
      * 用户枚举数据获取
+     *
      * @return 用户枚举类map
      */
     Map<String, List<EnumEntriesBuilder.Entry>> getEnumsData();

+ 2 - 0
user-service/src/main/java/com/diagbot/service/ImgVerService.java

@@ -11,6 +11,7 @@ public interface ImgVerService {
 
     /**
      * 创建用户图片验证信息
+     *
      * @param imgVerInfo 图片验证码验证信息
      * @return 图片验证码数据流
      */
@@ -23,6 +24,7 @@ public interface ImgVerService {
 
     /**
      * 获取用户图片验证码信息
+     *
      * @param imgId
      * @return
      */

+ 1 - 3
user-service/src/main/java/com/diagbot/service/OrganizationService.java

@@ -6,8 +6,6 @@ import com.diagbot.entity.Organization;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ibatis.annotations.Param;
-
 /**
  * @Description: 机构service
  * @Author: ztg
@@ -30,7 +28,7 @@ public interface OrganizationService extends IService<Organization> {
      */
     public Organization getByUserId(Long userId);
 
-    
+
     /**
      * @Description: 模糊查询机构名称
      * @Author: wangfeng

+ 1 - 0
user-service/src/main/java/com/diagbot/service/SmsVerService.java

@@ -25,6 +25,7 @@ public interface SmsVerService {
 
     /**
      * 获取用户短信验证码信息
+     *
      * @param mobile 用户电话
      * @return 用户短信验证信息
      */

+ 1 - 1
user-service/src/main/java/com/diagbot/service/UserAuthenticationService.java

@@ -1,7 +1,7 @@
 package com.diagbot.service;
 
-import com.diagbot.entity.UserAuthentication;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.UserAuthentication;
 
 /**
  * <p>

+ 1 - 1
user-service/src/main/java/com/diagbot/service/UserOrganizationService.java

@@ -19,6 +19,6 @@ public interface UserOrganizationService extends IService<UserOrganization> {
      * @Date: 2018/9/17 15:16
      */
     public List<UserOrganization> selectByMap(Map map);
-    
+
     public List<UserOrganization> getAgencyPersonnel(UserOrganization userORG);
 }

+ 9 - 8
user-service/src/main/java/com/diagbot/service/UserService.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.UserInfoDTO;
-import com.diagbot.dto.UserInfoExportDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.User;
 
@@ -13,7 +12,7 @@ import java.util.Map;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author gaodm
@@ -23,6 +22,7 @@ public interface UserService extends IService<User> {
 
     /**
      * 根据用户查找信息
+     *
      * @param username 用户名
      * @return 用户信息
      */
@@ -30,17 +30,18 @@ public interface UserService extends IService<User> {
 
     /**
      * 根据用户id获取用户信息(示例)
+     *
      * @param page 翻页信息
      * @param user 用户输入信息
      * @return 翻页用户信息
      */
     IPage<User> selectUserListPage(Page<User> page, User user);
-    
-    public IPage<UserInfoDTO>  selectUserInfoListPage(Page<UserInfoDTO> page,UserInfoDTO userInfo);
-    
+
+    public IPage<UserInfoDTO> selectUserInfoListPage(Page<UserInfoDTO> page, UserInfoDTO userInfo);
+
     public boolean updateUserInfoAll(Map<String, Object> userMap);
 
-    boolean updateDeleted(Map<String,Object> map);
+    boolean updateDeleted(Map<String, Object> map);
 
     IPage<User> indexPage(Page<User> page, User user);
 
@@ -48,9 +49,9 @@ public interface UserService extends IService<User> {
 
     public List<UserOrgDTO> getUserOrgByIds(List<Long> userIds);
 
-    public boolean auditUserInfoAll(Map<String,Object> auditMap);
+    public boolean auditUserInfoAll(Map<String, Object> auditMap);
 
-    public List<UserInfoDTO> dependentuserInfoByTime(Map<String,Object> map);
+    public List<UserInfoDTO> dependentuserInfoByTime(Map<String, Object> map);
 
     public List<User> getUserByOrgName(String orgName);
 }

+ 127 - 128
user-service/src/main/java/com/diagbot/util/ExportBeanExcelUtil.java

@@ -1,5 +1,13 @@
 package com.diagbot.util;
 
+import com.diagbot.dto.RespDTO;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -12,140 +20,131 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
+@SuppressWarnings({ "deprecation" })
+public class ExportBeanExcelUtil<T> {
+    private final String MSG_SUCCESS = "操作成功!";
+    private final String MSG_ERROR = "操作失败!";
 
-import com.diagbot.dto.RespDTO;
+    /**
+     * 这是一个通用的方法,利用了JAVA的反射机制,可以将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出
+     * <p>
+     * title         表格标题名
+     * headersName  表格属性列名数组
+     * headersId    表格属性列名对应的字段---你需要导出的字段名(为了更灵活控制你想要导出的字段)
+     * dtoList     需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象
+     * out         与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
+     */
+    public RespDTO exportExcel(String title, List<String> headersName, List<String> headersId,
+                               List<T> dtoList, String lujing, String fileName) {
+        /*(一)表头--标题栏*/
+        Map<Integer, String> headersNameMap = new HashMap<>();
+        int key = 0;
+        for (int i = 0; i < headersName.size(); i++) {
+            if (!headersName.get(i).equals(null)) {
+                headersNameMap.put(key, headersName.get(i));
+                key++;
+            }
+        }
+        /*(二)字段*/
+        Map<Integer, String> titleFieldMap = new HashMap<>();
+        int value = 0;
+        for (int i = 0; i < headersId.size(); i++) {
+            if (!headersId.get(i).equals(null)) {
+                titleFieldMap.put(value, headersId.get(i));
+                value++;
+            }
+        }
+        /* (三)声明一个工作薄:包括构建工作簿、表格、样式*/
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFSheet sheet = wb.createSheet(title);
+        sheet.setDefaultColumnWidth((short) 15);
+        // 生成一个样式
+        HSSFCellStyle style = wb.createCellStyle();
+        HSSFRow row = sheet.createRow(0);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        HSSFCell cell;
+        Collection c = headersNameMap.values();//拿到表格所有标题的value的集合
+        Iterator<String> it = c.iterator();//表格标题的迭代器
+        /*(四)导出数据:包括导出标题栏以及内容栏*/
+        //根据选择的字段生成表头
+        short size = 0;
+        while (it.hasNext()) {
+            cell = row.createCell(size);
+            cell.setCellValue(it.next().toString());
+            cell.setCellStyle(style);
+            size++;
+        }
+        //表格标题一行的字段的集合
+        Collection zdC = titleFieldMap.values();
+        Iterator<T> labIt = dtoList.iterator();//总记录的迭代器
+        int zdRow = 0;//列序号
+        while (labIt.hasNext()) {//记录的迭代器,遍历总记录
+            int zdCell = 0;
+            zdRow++;
+            row = sheet.createRow(zdRow);
+            T l = (T) labIt.next();
+            // 利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
+            Field[] fields = l.getClass().getDeclaredFields();//获得JavaBean全部属性
+            for (short i = 0; i < fields.length; i++) {//遍历属性,比对
+                Field field = fields[i];
+                String fieldName = field.getName();//属性名
+                Iterator<String> zdIt = zdC.iterator();//一条字段的集合的迭代器
+                while (zdIt.hasNext()) {//遍历要导出的字段集合
+                    if (zdIt.next().equals(fieldName)) {//比对JavaBean的属性名,一致就写入,不一致就丢弃
+                        String getMethodName = "get"
+                                + fieldName.substring(0, 1).toUpperCase()
+                                + fieldName.substring(1);//拿到属性的get方法
+                        Class tCls = l.getClass();//拿到JavaBean对象
+                        try {
+                            Method getMethod = tCls.getMethod(getMethodName,
+                                    new Class[] {});//通过JavaBean对象拿到该属性的get方法,从而进行操控
+                            Object val = getMethod.invoke(l, new Object[] {});//操控该对象属性的get方法,从而拿到属性值
+                            String textVal = null;
+                            if (val != null) {
+                                textVal = String.valueOf(val);//转化成String
+                            } else {
+                                textVal = null;
+                            }
+                            row.createCell((short) zdCell).setCellValue(textVal);//写进excel对象
+                            zdCell++;
+                        } catch (SecurityException e) {
+                            e.printStackTrace();
+                        } catch (IllegalArgumentException e) {
+                            e.printStackTrace();
+                        } catch (NoSuchMethodException e) {
+                            e.printStackTrace();
+                        } catch (IllegalAccessException e) {
+                            e.printStackTrace();
+                        } catch (InvocationTargetException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+            }
+        }
+        RespDTO resultMode = new RespDTO();
+        try {
 
-@SuppressWarnings( { "deprecation" })
-	public class ExportBeanExcelUtil<T> {
-	    private final String MSG_SUCCESS = "操作成功!";
-	    private final String MSG_ERROR = "操作失败!";
 
-		    /**
-		     * 这是一个通用的方法,利用了JAVA的反射机制,可以将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出
-		     *
-		     * title         表格标题名
-		     * headersName  表格属性列名数组
-		     * headersId    表格属性列名对应的字段---你需要导出的字段名(为了更灵活控制你想要导出的字段)
-		     *  dtoList     需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象
-		     *  out         与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
-		     */
-		    public   RespDTO exportExcel(String title, List<String> headersName,List<String> headersId,
-		                            List<T> dtoList,String lujing,String fileName) {
-		        /*(一)表头--标题栏*/
-		        Map<Integer, String> headersNameMap = new HashMap<>();
-		        int key=0;
-		        for (int i = 0; i < headersName.size(); i++) {
-		            if (!headersName.get(i).equals(null)) {
-		                headersNameMap.put(key, headersName.get(i));
-		                key++;
-		            }
-		        }
-		        /*(二)字段*/
-		        Map<Integer, String> titleFieldMap = new HashMap<>();
-		        int value = 0;
-		        for (int i = 0; i < headersId.size(); i++) {
-		            if (!headersId.get(i).equals(null)) {
-		                titleFieldMap.put(value, headersId.get(i));
-		                value++;
-		            }
-		        }
-		        /* (三)声明一个工作薄:包括构建工作簿、表格、样式*/
-		        HSSFWorkbook wb = new HSSFWorkbook();
-		        HSSFSheet sheet = wb.createSheet(title);
-		        sheet.setDefaultColumnWidth((short)15);
-		        // 生成一个样式
-		        HSSFCellStyle style = wb.createCellStyle();
-		        HSSFRow row = sheet.createRow(0);
-		        style.setAlignment(HorizontalAlignment.CENTER);
-		        HSSFCell cell;
-		        Collection c = headersNameMap.values();//拿到表格所有标题的value的集合
-		        Iterator<String> it = c.iterator();//表格标题的迭代器
-		        /*(四)导出数据:包括导出标题栏以及内容栏*/
-		        //根据选择的字段生成表头
-		        short size = 0;
-		        while (it.hasNext()) {
-		            cell = row.createCell(size);
-		            cell.setCellValue(it.next().toString());
-		            cell.setCellStyle(style);
-		            size++;
-		        }
-		        //表格标题一行的字段的集合
-		        Collection zdC = titleFieldMap.values();
-		        Iterator<T> labIt = dtoList.iterator();//总记录的迭代器
-		        int zdRow =0;//列序号
-		        while (labIt.hasNext()) {//记录的迭代器,遍历总记录
-		            int zdCell = 0;
-		            zdRow++;
-		            row = sheet.createRow(zdRow);
-		            T l = (T) labIt.next();
-		            // 利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
-		            Field[] fields = l.getClass().getDeclaredFields();//获得JavaBean全部属性
-		            for (short i = 0; i < fields.length; i++) {//遍历属性,比对
-		                Field field = fields[i];
-		                String fieldName = field.getName();//属性名
-		                Iterator<String> zdIt = zdC.iterator();//一条字段的集合的迭代器
-		                while (zdIt.hasNext()) {//遍历要导出的字段集合
-		                    if (zdIt.next().equals(fieldName)) {//比对JavaBean的属性名,一致就写入,不一致就丢弃
-		                        String getMethodName = "get"
-		                                + fieldName.substring(0, 1).toUpperCase()
-		                                + fieldName.substring(1);//拿到属性的get方法
-		                        Class tCls = l.getClass();//拿到JavaBean对象
-		                        try {
-		                            Method getMethod = tCls.getMethod(getMethodName,
-		                                    new Class[] {});//通过JavaBean对象拿到该属性的get方法,从而进行操控
-		                            Object val = getMethod.invoke(l, new Object[] {});//操控该对象属性的get方法,从而拿到属性值
-		                            String textVal = null;
-		                            if (val!= null) {
-		                                textVal = String.valueOf(val);//转化成String
-		                            }else{
-		                                textVal = null;
-		                            }
-		                            row.createCell((short) zdCell).setCellValue(textVal);//写进excel对象
-		                            zdCell++;
-		                        } catch (SecurityException e) {
-		                            e.printStackTrace();
-		                        } catch (IllegalArgumentException e) {
-		                            e.printStackTrace();
-		                        } catch (NoSuchMethodException e) {
-		                            e.printStackTrace();
-		                        } catch (IllegalAccessException e) {
-		                            e.printStackTrace();
-		                        } catch (InvocationTargetException e) {
-		                            e.printStackTrace();
-		                        }
-		                    }
-		                }
-		            }
-		        }
-		        RespDTO resultMode = new RespDTO();
-		        try {
-		        	
-		        	 
-		            FileOutputStream exportXls = new FileOutputStream(lujing+fileName+".xls");
-		            wb.write(exportXls);
-		            exportXls.close();
+            FileOutputStream exportXls = new FileOutputStream(lujing + fileName + ".xls");
+            wb.write(exportXls);
+            exportXls.close();
 /*		            resultMode.setResult(true);
 		            resultMode.setMessage(MSG_SUCCESS);*/
-		            return resultMode.onSuc(MSG_SUCCESS);
-		        } catch (FileNotFoundException e) {
+            return resultMode.onSuc(MSG_SUCCESS);
+        } catch (FileNotFoundException e) {
 /*		            System.out.println("导出失败!");
 		            resultMode.setResult(false);
 			        resultMode.setMessage(MSG_ERROR);*/
-		        	 e.printStackTrace();
-		        	return resultMode.onSuc(MSG_ERROR);
-		           
-		        } catch (IOException e) {
-		        	 e.printStackTrace();
-		        	return resultMode.onSuc(MSG_ERROR);
-		           
-		        }
-		        
-		       // return resultMode;
-		    }
+            e.printStackTrace();
+            return resultMode.onSuc(MSG_ERROR);
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            return resultMode.onSuc(MSG_ERROR);
+
+        }
+
+        // return resultMode;
+    }
 }

+ 6 - 7
user-service/src/main/java/com/diagbot/util/SmsCodeUtil.java

@@ -13,14 +13,13 @@ public final class SmsCodeUtil {
 
     private static final String AUTH_CODE = "0123456789";
 
-    public static String getVerCode(){
+    public static String getVerCode() {
         return getVerCode(6);
     }
-    public static String getVerCode(Integer size)
-    {
+
+    public static String getVerCode(Integer size) {
         StringBuilder sb = new StringBuilder();
-        for(int i = 0; i < size; i++)
-        {
+        for (int i = 0; i < size; i++) {
             int index = new Random().nextInt(AUTH_CODE.length());
             sb.append(AUTH_CODE.charAt(index));
         }
@@ -30,9 +29,9 @@ public final class SmsCodeUtil {
     public static void main(String[] args) {
         List<String> test = new ArrayList<>();
         //int i = 0;
-        while(true){
+        while (true) {
             String result = getVerCode();
-            if(test.contains(result)){
+            if (test.contains(result)) {
                 System.out.println("出现了重复编码:" + result);
                 break;
             }

+ 48 - 39
user-service/src/main/java/com/diagbot/util/VerifyCodeUtils.java

@@ -28,33 +28,37 @@ public class VerifyCodeUtils {
 
     /**
      * 使用系统默认字符源生成验证码
-     * @param verifySize    验证码长度
+     *
+     * @param verifySize 验证码长度
      * @return
      */
-    public static String generateVerifyCode(int verifySize){
+    public static String generateVerifyCode(int verifySize) {
         return generateVerifyCode(verifySize, VERIFY_CODES);
     }
+
     /**
      * 使用指定源生成验证码
-     * @param verifySize    验证码长度
-     * @param sources   验证码字符源
+     *
+     * @param verifySize 验证码长度
+     * @param sources    验证码字符源
      * @return
      */
-    public static String generateVerifyCode(int verifySize, String sources){
-        if(sources == null || sources.length() == 0){
+    public static String generateVerifyCode(int verifySize, String sources) {
+        if (sources == null || sources.length() == 0) {
             sources = VERIFY_CODES;
         }
         int codesLen = sources.length();
         Random rand = new Random(System.currentTimeMillis());
         StringBuilder verifyCode = new StringBuilder(verifySize);
-        for(int i = 0; i < verifySize; i++){
-            verifyCode.append(sources.charAt(rand.nextInt(codesLen-1)));
+        for (int i = 0; i < verifySize; i++) {
+            verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1)));
         }
         return verifyCode.toString();
     }
 
     /**
      * 生成随机验证码文件,并返回验证码值
+     *
      * @param w
      * @param h
      * @param outputFile
@@ -62,7 +66,7 @@ public class VerifyCodeUtils {
      * @return
      * @throws IOException
      */
-    public static String outputVerifyImage(int w, int h, File outputFile, int verifySize) throws IOException{
+    public static String outputVerifyImage(int w, int h, File outputFile, int verifySize) throws IOException {
         String verifyCode = generateVerifyCode(verifySize);
         outputImage(w, h, outputFile, verifyCode);
         return verifyCode;
@@ -70,6 +74,7 @@ public class VerifyCodeUtils {
 
     /**
      * 输出随机验证码图片流,并返回验证码值
+     *
      * @param w
      * @param h
      * @param os
@@ -77,7 +82,7 @@ public class VerifyCodeUtils {
      * @return
      * @throws IOException
      */
-    public static String outputVerifyImage(int w, int h, OutputStream os, int verifySize) throws IOException{
+    public static String outputVerifyImage(int w, int h, OutputStream os, int verifySize) throws IOException {
         String verifyCode = generateVerifyCode(verifySize);
         outputImage(w, h, os, verifyCode);
         return verifyCode;
@@ -85,50 +90,52 @@ public class VerifyCodeUtils {
 
     /**
      * 生成指定验证码图像文件
+     *
      * @param w
      * @param h
      * @param outputFile
      * @param code
      * @throws IOException
      */
-    public static void outputImage(int w, int h, File outputFile, String code) throws IOException{
-        if(outputFile == null){
+    public static void outputImage(int w, int h, File outputFile, String code) throws IOException {
+        if (outputFile == null) {
             return;
         }
         File dir = outputFile.getParentFile();
-        if(!dir.exists()){
+        if (!dir.exists()) {
             dir.mkdirs();
         }
-        try{
+        try {
             outputFile.createNewFile();
             FileOutputStream fos = new FileOutputStream(outputFile);
             outputImage(w, h, fos, code);
             fos.close();
-        } catch(IOException e){
+        } catch (IOException e) {
             throw e;
         }
     }
 
     /**
      * 输出指定验证码图片流
+     *
      * @param w
      * @param h
      * @param os
      * @param code
      * @throws IOException
      */
-    public static void outputImage(int w, int h, OutputStream os, String code) throws IOException{
+    public static void outputImage(int w, int h, OutputStream os, String code) throws IOException {
         int verifySize = code.length();
         BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
         Random rand = new Random();
         Graphics2D g2 = image.createGraphics();
-        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         Color[] colors = new Color[5];
         Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN,
                 Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, Color.ORANGE,
                 Color.PINK, Color.YELLOW };
         float[] fractions = new float[colors.length];
-        for(int i = 0; i < colors.length; i++){
+        for (int i = 0; i < colors.length; i++) {
             colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)];
             fractions[i] = rand.nextFloat();
         }
@@ -139,7 +146,7 @@ public class VerifyCodeUtils {
 
         Color c = getRandColor(200, 250);
         g2.setColor(c);// 设置背景色
-        g2.fillRect(0, 2, w, h-4);
+        g2.fillRect(0, 2, w, h - 4);
 
         //1.绘制干扰线
         Random random = new Random();
@@ -165,16 +172,16 @@ public class VerifyCodeUtils {
         shear(g2, w, h, c);// 使图片扭曲
 
         g2.setColor(getRandColor(100, 160));
-        int fontSize = h-4;
+        int fontSize = h - 4;
         Font font = new Font(null, Font.BOLD + Font.ITALIC, fontSize);
         g2.setFont(font);
         char[] chars = code.toCharArray();
-        for(int i = 0; i < verifySize; i++){
+        for (int i = 0; i < verifySize; i++) {
             AffineTransform affine = new AffineTransform();
-            affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), (w / verifySize) * i + (h - 4) /2, h/2);
+            affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), (w / verifySize) * i + (h - 4) / 2, h / 2);
             g2.setTransform(affine);
             g2.drawOval(random.nextInt(w), random.nextInt(h), 5 + random.nextInt(10), 5 + random.nextInt(10));
-            g2.drawChars(chars, i, 1, ((w-10) / verifySize) * i + 5, h/2 + fontSize/2 - 10);
+            g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10);
         }
 
         g2.dispose();
@@ -182,10 +189,12 @@ public class VerifyCodeUtils {
     }
 
     private static Color getRandColor(int fc, int bc) {
-        if (fc > 255)
+        if (fc > 255) {
             fc = 255;
-        if (bc > 255)
+        }
+        if (bc > 255) {
             bc = 255;
+        }
         int r = fc + random.nextInt(bc - fc);
         int g = fc + random.nextInt(bc - fc);
         int b = fc + random.nextInt(bc - fc);
@@ -265,36 +274,36 @@ public class VerifyCodeUtils {
      * Object[0]:验证码字符串;
      * Object[1]:验证码图片。
      */
-    public static Object[] createImage(){
-        try{
+    public static Object[] createImage() {
+        try {
             int w = 125, h = 34;
             String verifyCode = generateVerifyCode(4);//生成四位随机码
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             outputImage(w, h, bos, verifyCode);
-            return new Object[]{verifyCode, bos.toByteArray()};
-        } catch (IOException e){
+            return new Object[] { verifyCode, bos.toByteArray() };
+        } catch (IOException e) {
             throw new CommonException(ServiceErrorCode.VERIFYCODE_ERROR);
         }
     }
 
 
-    public static void main(String[] args) throws IOException{
-//        File dir = new File("E:/verifies");
-//        int w = 200, h = 80;
-//        for(int i = 0; i < 50; i++){
-//            String verifyCode = generateVerifyCode(4);//生成四位随机码
-//            File file = new File(dir, verifyCode + ".jpg");
-//            outputImage(w, h, file, verifyCode);//将验证码存在指定的路径下
-//        }
+    public static void main(String[] args) throws IOException {
+        //File dir = new File("E:/verifies");
+        //int w = 200, h = 80;
+        //for(int i = 0; i < 50; i++){
+        //    String verifyCode = generateVerifyCode(4);//生成四位随机码
+        //    File file = new File(dir, verifyCode + ".jpg");
+        //    outputImage(w, h, file, verifyCode);//将验证码存在指定的路径下
+        //}
 
         File dir = new File("E:/verifies");
-        for(int i = 0; i < 50; i++){
+        for (int i = 0; i < 50; i++) {
             Object[] res = createImage();
             String code = res[0].toString().toUpperCase();
             System.out.println(code);
             File file = new File(dir, code + ".jpg");
             OutputStream out = new FileOutputStream(file);
-            byte[] b = (byte[])res[1];
+            byte[] b = (byte[]) res[1];
             out.write(b);
             out.flush();
             out.close();

+ 8 - 10
user-service/src/main/java/com/diagbot/vo/OrganizationVO.java

@@ -1,14 +1,12 @@
 package com.diagbot.vo;
 
-import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
-import lombok.Getter;
-import lombok.Setter;
 /**
- * 
  * @author wangfeng
  * @Description: 添加机构信息
  * @date 2018年9月19日 下午4:34:30
@@ -17,30 +15,30 @@ import lombok.Setter;
 @Getter
 @Setter
 public class OrganizationVO {
-	/**
+    /**
      * 机构名称
      */
-	@NotBlank(message = "请输入机构名称!")
+    @NotBlank(message = "请输入机构名称!")
     private String organizationName;
     /**
      * 机构类型
      */
-	@NotNull(message = "请输入机构类型!")
+    @NotNull(message = "请输入机构类型!")
     private Integer type;
     /**
      * 负责人
      */
-	@NotBlank(message = "请输入机构负责人!")
+    @NotBlank(message = "请输入机构负责人!")
     private String principal;
     /**
      * 机构地址
      */
-	@NotBlank(message = "请输入机构地址!")
+    @NotBlank(message = "请输入机构地址!")
     private String address;
     /**
      * 下属机构数量
      */
     private Integer subNum;
-	
+
 
 }

+ 3 - 3
user-service/src/main/java/com/diagbot/vo/SmsVerCreatVO.java

@@ -14,10 +14,10 @@ import javax.validation.constraints.Size;
  */
 @Getter
 @Setter
-public class SmsVerCreatVO extends ImgVerVerVO{
+public class SmsVerCreatVO extends ImgVerVerVO {
     //用户电话
     @NotBlank(message = "{mobile.not.null}")
-    @Pattern(regexp="^[0-9]\\d*$", message="手机号码必须是数字")
-    @Size(max=11, message = "手机号码最多11位")
+    @Pattern(regexp = "^[0-9]\\d*$", message = "手机号码必须是数字")
+    @Size(max = 11, message = "手机号码最多11位")
     private String mobile;
 }

+ 1 - 1
user-service/src/main/java/com/diagbot/vo/SmsVerVerVO.java

@@ -10,7 +10,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class SmsVerVerVO  extends ImgVerVerVO {
+public class SmsVerVerVO extends ImgVerVerVO {
     //用户电话
     private String mobile;
     //短信验证码

+ 12 - 13
user-service/src/main/java/com/diagbot/vo/UserAndOrganizationVO.java

@@ -1,14 +1,13 @@
 package com.diagbot.vo;
 
+import lombok.Getter;
+import lombok.Setter;
+
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 
-import lombok.Getter;
-import lombok.Setter;
-
 /**
- * 
  * @author wangfeng
  * @Description: 超级管理员与机构的绑定
  * @date 2018年9月19日 下午4:56:08
@@ -16,29 +15,29 @@ import lombok.Setter;
 @Getter
 @Setter
 public class UserAndOrganizationVO {
-	
-	/**
+
+    /**
      * 机构id
      */
-	@NotNull(message = "请输入机构id!")
+    @NotNull(message = "请输入机构id!")
     private Long organizationid;
-    
+
     /**
      * 用户密码
      */
-	@Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
+    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$", message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
     private String passWord;
 
     /**
      * 用户名
      */
-	@Pattern(regexp = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$",message = "请输入手机号!")
+    @Pattern(regexp = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$", message = "请输入手机号!")
     private String userName;
-    
+
     /**
      * 联系人
      */
-	@NotBlank(message = "请输入联系人!")
+    @NotBlank(message = "请输入联系人!")
     private String linkman;
 
     /**
@@ -46,7 +45,7 @@ public class UserAndOrganizationVO {
      */
     @NotBlank(message = "请输入邮箱!")
     private String email;
-    
+
     /**
      * 岗位信息
      */

+ 0 - 1
user-service/src/main/java/com/diagbot/vo/UserAuthenticationVO.java

@@ -4,7 +4,6 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.util.Date;
 
 /**
  * @Description:用户验证输入信息

+ 5 - 8
user-service/src/main/java/com/diagbot/vo/UserExportVO.java

@@ -1,23 +1,20 @@
 package com.diagbot.vo;
 
-import java.text.SimpleDateFormat;
-
 import lombok.Getter;
 import lombok.Setter;
 
 /**
- * 
- * @Description: 导出功能传参
  * @author wangfeng
+ * @Description: 导出功能传参
  * @date 2018年9月25日 上午10:41:08
  */
 @Getter
 @Setter
 public class UserExportVO {
-	
-	private String startTime;
-	private String endTime;
-	private String filePath;//文件路径
+
+    private String startTime;
+    private String endTime;
+    private String filePath;//文件路径
     private String fileName;//文件名
 
 }

+ 10 - 14
user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java

@@ -1,29 +1,25 @@
 package com.diagbot.vo;
 
-import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
 
-import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
 
-import lombok.Getter;
-import lombok.Setter;
 /**
- * 
- * @Description: 用户认证
  * @author wangfeng
+ * @Description: 用户认证
  * @date 2018年9月20日 下午1:41:56
  */
 
 @Getter
 @Setter
 public class UserInfoAuditVO {
-	  
-	  private Integer isReject;//是否通过认证 0:未通过,1:已通过
-	  private Integer rejectType;//未通过类型
-	  private String rejectComment;//认证被拒理由
-	  private Integer status;//认证状态(0:未认证,1:已认证,2:认证中)
-	  @NotNull(message = "请输入用户id!")
-	  private Long userId;//用户id
+
+    private Integer isReject;//是否通过认证 0:未通过,1:已通过
+    private Integer rejectType;//未通过类型
+    private String rejectComment;//认证被拒理由
+    private Integer status;//认证状态(0:未认证,1:已认证,2:认证中)
+    @NotNull(message = "请输入用户id!")
+    private Long userId;//用户id
 
 }

+ 11 - 15
user-service/src/main/java/com/diagbot/vo/UserInfoOrganizationsVO.java

@@ -1,16 +1,12 @@
 package com.diagbot.vo;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
 /**
- * 
  * @author wangfeng
  * @Description: 用于修改用户信息及机构信息
  * @date 2018年9月18日 下午3:06:58
@@ -18,12 +14,12 @@ import lombok.Setter;
 @Getter
 @Setter
 public class UserInfoOrganizationsVO implements Serializable {
-	
-	  private String email;//邮箱
-	  private String principal;//负责人
-	  private String address;//单位地址
-	  private Integer type;//机构属性
-	  private String position;//岗位部门
-	  @NotNull(message = "请输入用户id!")
-	  private Long userId;//用户id
+
+    private String email;//邮箱
+    private String principal;//负责人
+    private String address;//单位地址
+    private Integer type;//机构属性
+    private String position;//岗位部门
+    @NotNull(message = "请输入用户id!")
+    private Long userId;//用户id
 }

+ 4 - 8
user-service/src/main/java/com/diagbot/vo/UserInfoVO.java

@@ -1,16 +1,12 @@
 package com.diagbot.vo;
 
-import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Pattern;
 
-import lombok.Getter;
-import lombok.Setter;
-
 /**
- * 
- * 
  * @author wangfeng
  * @Description: 用于超级管理员增加用户
  * @date 2018年9月19日 下午5:25:23
@@ -19,8 +15,8 @@ import lombok.Setter;
 @Setter
 public class UserInfoVO {
 
-	@NotBlank(message = "请输入密码!")
-    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
+    @NotBlank(message = "请输入密码!")
+    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$", message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
     private String password;
     @NotBlank(message = "请输入手机号!")
     private String username;

+ 1 - 1
user-service/src/main/java/com/diagbot/vo/UserSaveVO.java

@@ -22,7 +22,7 @@ public class UserSaveVO {
     private String creator;
     private String modifier;
     @NotBlank(message = "请输入密码!")
-    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
+    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$", message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
     private String password;
     @NotBlank(message = "请输入手机号!")
     private String username;

+ 2 - 2
user-service/src/main/java/com/diagbot/web/EnumsController.java

@@ -19,7 +19,7 @@ import java.util.Map;
  * @time: 2018/9/19 14:32
  */
 @RestController
-@Api(value="用户枚举数据获取API", tags={"用户枚举数据获取API"})
+@Api(value = "用户枚举数据获取API", tags = { "用户枚举数据获取API" })
 @SuppressWarnings("unchecked")
 public class EnumsController {
     @Autowired
@@ -29,7 +29,7 @@ public class EnumsController {
             notes = "用户枚举数据获取")
     @PostMapping("/getUserEnumsData")
     @SysLogger("getUserEnumsData")
-    public RespDTO<Map<String, List<EnumEntriesBuilder.Entry>>> getEnumsData(){
+    public RespDTO<Map<String, List<EnumEntriesBuilder.Entry>>> getEnumsData() {
         return RespDTO.onSuc(enumsDataFacade.getEnumsData());
     }
 }

+ 14 - 15
user-service/src/main/java/com/diagbot/web/ReportFormController.java

@@ -34,9 +34,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 /**
- * 
- * @Description: 客户中心导出功能
  * @author wangfeng
+ * @Description: 客户中心导出功能
  * @date 2018年9月25日 上午9:45:56
  */
 @RestController
@@ -44,17 +43,17 @@ import io.swagger.annotations.ApiOperation;
 @RequestMapping("/report")
 @SuppressWarnings("unchecked")
 public class ReportFormController {
-	
-	@Autowired
-	private UserFacade userFacade;
-	
-	@ApiOperation(value = "导出用户信息和机构信息:[by:wangfeng]", notes = "根据时间 导出用户信息和机构信息")
-	@PostMapping("/exportUserInfo")
-	@SysLogger("exportUserInfo")
-	@Transactional
-	public RespDTO export(UserExportVO userExportVO)
-			throws Exception {
-		RespDTO resul = userFacade.export(userExportVO);
-		 return resul;
-	}
+
+    @Autowired
+    private UserFacade userFacade;
+
+    @ApiOperation(value = "导出用户信息和机构信息:[by:wangfeng]", notes = "根据时间 导出用户信息和机构信息")
+    @PostMapping("/exportUserInfo")
+    @SysLogger("exportUserInfo")
+    @Transactional
+    public RespDTO export(UserExportVO userExportVO)
+            throws Exception {
+        RespDTO resul = userFacade.export(userExportVO);
+        return resul;
+    }
 }

+ 3 - 3
user-service/src/main/java/com/diagbot/web/TestController.java

@@ -30,10 +30,10 @@ public class TestController {
     RespDTO testSmsSend() {
         System.out.println("The time is now " + DateUtil.nowString());
         log.info("短信验证发送开始!");
-//        String code="1234";
+        //String code="1234";
         //SMS_143861902
-        String code = smsVerService.smsSend("188575800**","SMS_143861***");
-        log.info("短信验证发送结束!验证码:{}",code);
+        String code = smsVerService.smsSend("188575800**", "SMS_143861***");
+        log.info("短信验证发送结束!验证码:{}", code);
         return RespDTO.onSuc(code);
     }
 }

+ 1 - 1
user-service/src/main/java/com/diagbot/web/UserAuthenticationController.java

@@ -29,7 +29,7 @@ import java.util.Map;
  * @since 2018-09-13
  */
 @RestController
-@Api(value="用户认证API", tags={"用户认证API"})
+@Api(value = "用户认证API", tags = { "用户认证API" })
 @RequestMapping("/userAuthentication")
 @SuppressWarnings("unchecked")
 public class UserAuthenticationController {

+ 56 - 54
user-service/src/main/java/com/diagbot/web/UserController.java

@@ -34,7 +34,7 @@ import java.util.Map;
  * @time: 2018/8/2 13:56
  */
 @RestController
-@Api(value="用户操作API", tags={"用户操作API"})
+@Api(value = "用户操作API", tags = { "用户操作API" })
 @RequestMapping("/user")
 @SuppressWarnings("unchecked")
 public class UserController {
@@ -45,17 +45,17 @@ public class UserController {
     private PermissionFacade permissionFacade;
 
     @ApiOperation(value = "注册[by:zhoutg]",
-        notes = "username:用户名,必填<br>" +
-                "password:密码,必填<br> " +
-                "organization:组织机构,必填<br>" +
-                "email:邮箱,必填<br>" +
-                "linkman:联系人,必填<br>" +
-                "imgId:图片id,必填<br>" +
-                "code:图片验证码,必填<br>")
+            notes = "username:用户名,必填<br>" +
+                    "password:密码,必填<br> " +
+                    "organization:组织机构,必填<br>" +
+                    "email:邮箱,必填<br>" +
+                    "linkman:联系人,必填<br>" +
+                    "imgId:图片id,必填<br>" +
+                    "code:图片验证码,必填<br>")
     @PostMapping("/registry")
     @SysLogger("registry")
     @Transactional
-    public RespDTO<User> createUser(@RequestBody @Valid UserSaveVO userSaveVO){
+    public RespDTO<User> createUser(@RequestBody @Valid UserSaveVO userSaveVO) {
         User user = userFacade.createUser(userSaveVO);
         return RespDTO.onSuc(user);
     }
@@ -66,8 +66,8 @@ public class UserController {
                     "password:密码, 必填<br> ")
     @PostMapping("/login")
     @SysLogger("login")
-    public RespDTO<LoginDTO> login(@RequestParam String username, @RequestParam String password){
-        return  userFacade.login(username, password);
+    public RespDTO<LoginDTO> login(@RequestParam String username, @RequestParam String password) {
+        return userFacade.login(username, password);
     }
 
 
@@ -78,17 +78,16 @@ public class UserController {
     @PostMapping("/resetPassword")
     @SysLogger("resetPassword")
     @Transactional
-    public RespDTO<Boolean> resetPassword(String username, String password, String diffPassword){
-        return  userFacade.resetPassword(username, password, diffPassword);
+    public RespDTO<Boolean> resetPassword(String username, String password, String diffPassword) {
+        return userFacade.resetPassword(username, password, diffPassword);
     }
 
 
-
     @PostMapping(value = "/getUserAndOrg")
     @SysLogger("getUserAndOrg")
     @ApiOperation(value = "获取用户和机构信息[by:zhoutg]")
     @ApiIgnore
-    RespDTO<Map<Long,UserOrgDTO>> getUserAndOrg(@RequestBody List<Long> userIds) {
+    RespDTO<Map<Long, UserOrgDTO>> getUserAndOrg(@RequestBody List<Long> userIds) {
         Map<Long, UserOrgDTO> result = userFacade.getUserAndOrg(userIds);
         return RespDTO.onSuc(result);
     }
@@ -97,14 +96,13 @@ public class UserController {
     @PostMapping(value = "/getUserByOrgName")
     @SysLogger("getUserByOrgName")
     @ApiOperation(value = "远程调用,根据机构名称获取用户信息[by:zhoutg]")
-//    @ApiIgnore
+        //    @ApiIgnore
     RespDTO<List<Long>> getUserByOrgName(@RequestBody String name) {
-        List<Long> data =  userFacade.getUserByOrgNameFac(name);
+        List<Long> data = userFacade.getUserByOrgNameFac(name);
         return RespDTO.onSuc(data);
     }
 
 
-
     /**
      * @Description: 用来测试分页,未用
      * @Author: ztg
@@ -114,7 +112,7 @@ public class UserController {
     @SysLogger("index")
     @ApiOperation(value = "用来测试分页,未用[by:zhoutg]")
     @ApiIgnore
-    public RespDTO<IPage<User>> indexUser(Page page, UserSaveVO userSaveVO){
+    public RespDTO<IPage<User>> indexUser(Page page, UserSaveVO userSaveVO) {
         return userFacade.index(page, userSaveVO);
     }
 
@@ -122,8 +120,8 @@ public class UserController {
             notes = "appkey:用户名,必填<br>" +
                     "secret:密码, 必填<br> ")
     @PostMapping("/getPermission")
-    public RespDTO<Permission> getPermission(@RequestParam String appkey, @RequestParam String secret){
-        return  permissionFacade.getPermission(appkey, secret);
+    public RespDTO<Permission> getPermission(@RequestParam String appkey, @RequestParam String secret) {
+        return permissionFacade.getPermission(appkey, secret);
     }
 
 
@@ -131,10 +129,10 @@ public class UserController {
     @PostMapping("/getByUsername")
     @SysLogger("getByUsername")
     @ApiIgnore
-//    @PreAuthorize("hasAnyAuthority('ROLE_USER')")
-    public RespDTO getUserInfo(@RequestParam String username){
+    //    @PreAuthorize("hasAnyAuthority('ROLE_USER')")
+    public RespDTO getUserInfo(@RequestParam String username) {
         //参数判读省略
-        User user=  userFacade.getUserInfo(username);
+        User user = userFacade.getUserInfo(username);
         return RespDTO.onSuc(user);
     }
 
@@ -142,33 +140,34 @@ public class UserController {
     @PostMapping("/getUserInfoByID")
     @SysLogger("getUserInfoByID")
     @ApiIgnore
-    public RespDTO getUserInfoByID(Long id, Page page){
+    public RespDTO getUserInfoByID(Long id, Page page) {
         User userVo = new User();
         userVo.setId(id);
-        IPage<User> user=  userFacade.selectUserListPage(page, userVo);
+        IPage<User> user = userFacade.selectUserListPage(page, userVo);
         return RespDTO.onSuc(user);
     }
 
-//    @ApiOperation(value = "注册事务", notes = "username和password为必选项")
-//    @PostMapping("/registryTran")
-//    @SysLogger("registryTran")
-//    @Transactional
-//    public RespDTO createUserTran(@RequestBody User user){
-//        //参数判读省略,判读该用户在数据库是否已经存在省略
-//        userFacade.createUser(user);
-//        throw new CommonException(CommonErrorCode.FAIL);
-////        return RespDTO.onSuc(user);
-//    }
-
-//    @Autowired
-//    private AmqpTemplate rabbitTemplate;
-//    @GetMapping("/test")
-//    public void test(){
-//        rabbitTemplate.convertAndSend(RabbitConfig.queueName, "Hello from RabbitMQ!");
-//    }
+    //    @ApiOperation(value = "注册事务", notes = "username和password为必选项")
+    //    @PostMapping("/registryTran")
+    //    @SysLogger("registryTran")
+    //    @Transactional
+    //    public RespDTO createUserTran(@RequestBody User user){
+    //        //参数判读省略,判读该用户在数据库是否已经存在省略
+    //        userFacade.createUser(user);
+    //        throw new CommonException(CommonErrorCode.FAIL);
+    ////        return RespDTO.onSuc(user);
+    //    }
+
+    //    @Autowired
+    //    private AmqpTemplate rabbitTemplate;
+    //    @GetMapping("/test")
+    //    public void test(){
+    //        rabbitTemplate.convertAndSend(RabbitConfig.queueName, "Hello from RabbitMQ!");
+    //    }
 
     /**
      * 增加用户
+     *
      * @param user 用户信息
      * @return 增加是否成功
      */
@@ -177,7 +176,7 @@ public class UserController {
     @SysLogger("addUser")
     @Transactional
     @ApiIgnore
-    public RespDTO addUser(@RequestBody User user){
+    public RespDTO addUser(@RequestBody User user) {
         //参数判读省略,判读该用户在数据库是否已经存在省略
         userFacade.saveUser(user);
         //        throw new CommonException(ErrorCode.FAIL);
@@ -186,6 +185,7 @@ public class UserController {
 
     /**
      * 修改用户
+     *
      * @param user 用户信息
      * @return 修改是否成功
      */
@@ -194,7 +194,7 @@ public class UserController {
     @SysLogger("updateUser")
     @Transactional
     @ApiIgnore
-    public RespDTO updateUser(@RequestBody User user){
+    public RespDTO updateUser(@RequestBody User user) {
         //参数判读省略,判读该用户在数据库是否已经存在省略
         userFacade.updateUser(user);
         return RespDTO.onSuc(user);
@@ -202,6 +202,7 @@ public class UserController {
 
     /**
      * 查询用户信息
+     *
      * @param id 用户ID
      * @return 用户信息
      */
@@ -210,12 +211,13 @@ public class UserController {
     @SysLogger("getUser")
     @Transactional
     @ApiIgnore
-    public RespDTO getUser(Long id){
+    public RespDTO getUser(Long id) {
         return RespDTO.onSuc(userFacade.getById(id));
     }
 
     /**
      * 删除用户
+     *
      * @param id 用户ID
      * @return 删除是否成功
      */
@@ -224,14 +226,14 @@ public class UserController {
     @SysLogger("delUser")
     @Transactional
     @ApiIgnore
-    public RespDTO delUser(Long id){
+    public RespDTO delUser(Long id) {
         return RespDTO.onSuc(userFacade.removeById(id));
     }
-    
-    @ApiOperation(value = "控制台账户信息(示例)[by:rengb]", notes="控制台账户信息")
-	@PostMapping("/getConsoleUserInfo")
-	@SysLogger("getConsoleUserInfo")
-	public RespDTO<GetConsoleUserInfoDTO> getConsoleUserInfo() {
-		return RespDTO.onSuc(userFacade.getConsoleUserInfo());
-	}
+
+    @ApiOperation(value = "控制台账户信息(示例)[by:rengb]", notes = "控制台账户信息")
+    @PostMapping("/getConsoleUserInfo")
+    @SysLogger("getConsoleUserInfo")
+    public RespDTO<GetConsoleUserInfoDTO> getConsoleUserInfo() {
+        return RespDTO.onSuc(userFacade.getConsoleUserInfo());
+    }
 }

+ 179 - 179
user-service/src/main/java/com/diagbot/web/UserInfoController.java

@@ -49,184 +49,184 @@ import java.util.Map;
 @SuppressWarnings("unchecked")
 public class UserInfoController {
 
-	@Autowired
-	private UserFacade userFacade;
-	@Autowired
-	OrganizationFacade organizationFacade;
-	@Autowired
-	UserOrganizationFacade userOrganizationFacade;
-	@Autowired
-	UserAuthenticationFacade userAuthenticationFacade;
-
-	@ApiOperation(value = "分页查询获取用户信息[by:wangfeng]", notes = "根据每页显示条数,默认 10,和当前页")
-	@PostMapping("/getUserInfoPag")
-	@SysLogger("getUserInfoPag")
-	// @ApiIgnore
-	public RespDTO<UserInfoDTO> getUserInfoPag(Page page, String orgName, Integer autStatus) {
-		UserInfoDTO userInfo = new UserInfoDTO();
-		userInfo.setOrgName(orgName);
-		userInfo.setAutStatus(autStatus);
-		IPage<UserInfoDTO> user = userFacade.selectUserInfoListPage(page, userInfo);
-		return RespDTO.onSuc(user);
-	}
-
-	@ApiOperation(value = "修改用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
-	@PostMapping("/updateUserInfoAll")
-	@SysLogger("updateUserInfoAll")
-	@Transactional
-	public RespDTO<UserInfoOrganizationsVO> updateUserInfoAll(
-			@Valid @RequestBody UserInfoOrganizationsVO userInfoOrganizationsVO) {
-		Map<String, Object> userMap = new HashMap<String, Object>();
-		userMap.put("modifier",UserUtils.getCurrentPrincipleID());
-		userMap.put("gmtModified", DateUtil.now());
-		userMap.put("email", userInfoOrganizationsVO.getEmail());
-		userMap.put("principal", userInfoOrganizationsVO.getPrincipal());
-		userMap.put("address", userInfoOrganizationsVO.getAddress());
-		userMap.put("type", userInfoOrganizationsVO.getType());
-		userMap.put("position", userInfoOrganizationsVO.getPosition());
-		userMap.put("userId", userInfoOrganizationsVO.getUserId());
-		boolean res = userFacade.updateUserInfoAll(userMap);
-		if (!res){
-			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
-		}
-		return RespDTO.onSuc(res);
-	}
-
-	@ApiOperation(value = "审核用户信息和机构信息[by:wangfeng]", notes = "审核用户信息和机构信息")
-	@PostMapping("/auditUserInfoAll")
-	@SysLogger("auditUserInfoAll")
-	@Transactional
-	public RespDTO<Boolean> auditUserInfoAll(@Valid @RequestBody UserInfoAuditVO userInfoAuditVO) {
-		Map<String, Object> auditMap = new HashMap<String, Object>();
-		auditMap.put("userId", userInfoAuditVO.getUserId());
-		auditMap.put("modifier",UserUtils.getCurrentPrincipleID());
-		auditMap.put("gmtModified", DateUtil.now());
-		auditMap.put("isReject", userInfoAuditVO.getIsReject());
-		auditMap.put("rejectComment", userInfoAuditVO.getRejectComment());
-		auditMap.put("rejectType", userInfoAuditVO.getRejectType());
-		// TODO 审核前先验证该用户的的认证状态
-		boolean res = userFacade.auditUserInfoAll(auditMap);
-
-		if (!res){
-			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
-		}
-		return RespDTO.onSuc(res);
-	}
-
-	@ApiOperation(value = "删除用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
-	@PostMapping("/updateDeleted")
-	@SysLogger("updateDeleted")
-	@Transactional
-	public RespDTO updateDeleted(@RequestParam String userId) {
-		Map<String, Object> map = new HashMap<String, Object>();
-		map.put("userId", userId);
-		map.put("modifier",UserUtils.getCurrentPrincipleID());
-		map.put("gmtModified", DateUtil.now());
-		boolean res = userFacade.updateDeleted(map);
-		if (!res){
-			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
-		}
-		return RespDTO.onSuc(res);
-	}
-
-	@ApiOperation(value = "模糊查询机构信息[by:wangfeng]", notes = "机构信息")
-	@PostMapping("/findOrganization")
-	@SysLogger("findOrganization")
-	public RespDTO findOrganization(@RequestParam String organizationName) {
-		// TODO 返回机构Id和机构
-		List<Organization> organization = organizationFacade.findOrganization(organizationName);
-
-		return RespDTO.onSuc(organization);
-	}
-
-	@ApiOperation(value = "添加构信息[by:wangfeng]", notes = "机构信息")
-	@PostMapping("/addOrganization")
-	@SysLogger("addOrganization")
-	@Transactional
-	public RespDTO<Boolean> addOrganization(@Valid @RequestBody OrganizationVO organizationVO) {
-
-		String organizationName = organizationVO.getOrganizationName();
-		List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
-		if (organizationList.size() > 0) {
-			return RespDTO.onSuc("该机构存在");
-		}
-		Organization organization = new Organization();
-		organization.setName(organizationVO.getOrganizationName());
-		organization.setType(organizationVO.getType());
-		organization.setPrincipal(organizationVO.getPrincipal());
-		organization.setSubNum(organizationVO.getSubNum());
-		organization.setAddress(organizationVO.getAddress());
-		organization.setGmtCreate(DateUtil.now());
-		organization.setModifier(UserUtils.getCurrentPrincipleID());
-		// organization.setCreator("5");
-
-		boolean res = organizationFacade.save(organization);
-
-		// System.out.println(GsonUtil.toJson(organization));
-		if (!res){
-			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
-		}
-		return RespDTO.onSuc(res);
-	}
-
-	@ApiOperation(value = "添加用户信息和机构信息管理员[by:wangfeng]", notes = "用户信息和机构信息的绑定")
-	@PostMapping("/addUserInfo")
-	@SysLogger("addUserInfo")
-	@Transactional
-	public RespDTO<UserAndOrganizationVO> addUserInfo(@Valid @RequestBody UserAndOrganizationVO userAndOrganizationVO) {
-		// TODO 先查找机构,获取机构id,再注册用户,返回用户id, 取到用户id和 机构id ,查询用户机构关联表,在进行绑定
-		// User user = new User();
-		// 验证用户是否存在
-		String username = userAndOrganizationVO.getUserName();
-		User userData = userFacade.getUserInfo(username);
-		// System.out.println(user);
-		if (userData != null) {
-			return RespDTO.onSuc("该用户存在");
-		}
-		// 验证机构是否被绑定
-		UserOrganization userORG = new UserOrganization();
-		userORG.setOrganizationId(userAndOrganizationVO.getOrganizationid());
-
-		List<UserOrganization> userOrganizationData = userOrganizationFacade.getAgencyPersonnel(userORG);
-		if (userOrganizationData.size() > 0) {
-			return RespDTO.onSuc("该机构绑定了用户!");
-		}
-
-		User user = new User();
-		user.setCreator(UserUtils.getCurrentPrincipleID());
-		user.setUsername(userAndOrganizationVO.getUserName());
-		PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
-		String entryPassword = passwordEncoder.encode(userAndOrganizationVO.getPassWord());
-		user.setPassword(entryPassword);
-		user.setLinkman(userAndOrganizationVO.getLinkman());
-		user.setGmtCreate(DateUtil.now());
-		user.setEmail(userAndOrganizationVO.getEmail());
-		boolean res = userFacade.save(user);
-		if (res == true) {
-			Long userId = user.getId();
-			// 用户信息的认证
-			UserAuthentication userAuthentication = new UserAuthentication();
-			userAuthentication.setCreator(UserUtils.getCurrentPrincipleID());//
-			// 创建人Id
-			userAuthentication.setGmtCreate(DateUtil.now());// 记录创建时间
-			userAuthentication.setPosition(userAndOrganizationVO.getPosition());// 岗位信息
-			userAuthentication.setUserId(userId);// 用户id
-			userAuthentication.setIsReject(1);// 是否通过认证 0:未通过,1:已通过
-			userAuthentication.setStatus(1);// 认证状态(0:未认证,1:已认证,2:认证中)
-			userAuthenticationFacade.save(userAuthentication);
-
-			// 用户信息和机构信息的绑定
-			UserOrganization userOrganization = new UserOrganization();
-			userOrganization.setCreator(UserUtils.getCurrentPrincipleID());//
-			// 创建人Id
-			userOrganization.setGmtCreate(DateUtil.now());
-			userOrganization.setOrganizationId(userAndOrganizationVO.getOrganizationid());// 机构id
-			userOrganization.setUserId(userId);// 用户id
-
-			userOrganizationFacade.save(userOrganization);
-		}
-
-		return RespDTO.onSuc("绑定成功");
-	}
+    @Autowired
+    private UserFacade userFacade;
+    @Autowired
+    OrganizationFacade organizationFacade;
+    @Autowired
+    UserOrganizationFacade userOrganizationFacade;
+    @Autowired
+    UserAuthenticationFacade userAuthenticationFacade;
+
+    @ApiOperation(value = "分页查询获取用户信息[by:wangfeng]", notes = "根据每页显示条数,默认 10,和当前页")
+    @PostMapping("/getUserInfoPag")
+    @SysLogger("getUserInfoPag")
+    // @ApiIgnore
+    public RespDTO<UserInfoDTO> getUserInfoPag(Page page, String orgName, Integer autStatus) {
+        UserInfoDTO userInfo = new UserInfoDTO();
+        userInfo.setOrgName(orgName);
+        userInfo.setAutStatus(autStatus);
+        IPage<UserInfoDTO> user = userFacade.selectUserInfoListPage(page, userInfo);
+        return RespDTO.onSuc(user);
+    }
+
+    @ApiOperation(value = "修改用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
+    @PostMapping("/updateUserInfoAll")
+    @SysLogger("updateUserInfoAll")
+    @Transactional
+    public RespDTO<UserInfoOrganizationsVO> updateUserInfoAll(
+            @Valid @RequestBody UserInfoOrganizationsVO userInfoOrganizationsVO) {
+        Map<String, Object> userMap = new HashMap<String, Object>();
+        userMap.put("modifier", UserUtils.getCurrentPrincipleID());
+        userMap.put("gmtModified", DateUtil.now());
+        userMap.put("email", userInfoOrganizationsVO.getEmail());
+        userMap.put("principal", userInfoOrganizationsVO.getPrincipal());
+        userMap.put("address", userInfoOrganizationsVO.getAddress());
+        userMap.put("type", userInfoOrganizationsVO.getType());
+        userMap.put("position", userInfoOrganizationsVO.getPosition());
+        userMap.put("userId", userInfoOrganizationsVO.getUserId());
+        boolean res = userFacade.updateUserInfoAll(userMap);
+        if (!res) {
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
+        }
+        return RespDTO.onSuc(res);
+    }
+
+    @ApiOperation(value = "审核用户信息和机构信息[by:wangfeng]", notes = "审核用户信息和机构信息")
+    @PostMapping("/auditUserInfoAll")
+    @SysLogger("auditUserInfoAll")
+    @Transactional
+    public RespDTO<Boolean> auditUserInfoAll(@Valid @RequestBody UserInfoAuditVO userInfoAuditVO) {
+        Map<String, Object> auditMap = new HashMap<String, Object>();
+        auditMap.put("userId", userInfoAuditVO.getUserId());
+        auditMap.put("modifier", UserUtils.getCurrentPrincipleID());
+        auditMap.put("gmtModified", DateUtil.now());
+        auditMap.put("isReject", userInfoAuditVO.getIsReject());
+        auditMap.put("rejectComment", userInfoAuditVO.getRejectComment());
+        auditMap.put("rejectType", userInfoAuditVO.getRejectType());
+        // TODO 审核前先验证该用户的的认证状态
+        boolean res = userFacade.auditUserInfoAll(auditMap);
+
+        if (!res) {
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
+        }
+        return RespDTO.onSuc(res);
+    }
+
+    @ApiOperation(value = "删除用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
+    @PostMapping("/updateDeleted")
+    @SysLogger("updateDeleted")
+    @Transactional
+    public RespDTO updateDeleted(@RequestParam String userId) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userId", userId);
+        map.put("modifier", UserUtils.getCurrentPrincipleID());
+        map.put("gmtModified", DateUtil.now());
+        boolean res = userFacade.updateDeleted(map);
+        if (!res) {
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
+        }
+        return RespDTO.onSuc(res);
+    }
+
+    @ApiOperation(value = "模糊查询机构信息[by:wangfeng]", notes = "机构信息")
+    @PostMapping("/findOrganization")
+    @SysLogger("findOrganization")
+    public RespDTO findOrganization(@RequestParam String organizationName) {
+        // TODO 返回机构Id和机构
+        List<Organization> organization = organizationFacade.findOrganization(organizationName);
+
+        return RespDTO.onSuc(organization);
+    }
+
+    @ApiOperation(value = "添加构信息[by:wangfeng]", notes = "机构信息")
+    @PostMapping("/addOrganization")
+    @SysLogger("addOrganization")
+    @Transactional
+    public RespDTO<Boolean> addOrganization(@Valid @RequestBody OrganizationVO organizationVO) {
+
+        String organizationName = organizationVO.getOrganizationName();
+        List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
+        if (organizationList.size() > 0) {
+            return RespDTO.onSuc("该机构存在");
+        }
+        Organization organization = new Organization();
+        organization.setName(organizationVO.getOrganizationName());
+        organization.setType(organizationVO.getType());
+        organization.setPrincipal(organizationVO.getPrincipal());
+        organization.setSubNum(organizationVO.getSubNum());
+        organization.setAddress(organizationVO.getAddress());
+        organization.setGmtCreate(DateUtil.now());
+        organization.setModifier(UserUtils.getCurrentPrincipleID());
+        // organization.setCreator("5");
+
+        boolean res = organizationFacade.save(organization);
+
+        // System.out.println(GsonUtil.toJson(organization));
+        if (!res) {
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
+        }
+        return RespDTO.onSuc(res);
+    }
+
+    @ApiOperation(value = "添加用户信息和机构信息管理员[by:wangfeng]", notes = "用户信息和机构信息的绑定")
+    @PostMapping("/addUserInfo")
+    @SysLogger("addUserInfo")
+    @Transactional
+    public RespDTO<UserAndOrganizationVO> addUserInfo(@Valid @RequestBody UserAndOrganizationVO userAndOrganizationVO) {
+        // TODO 先查找机构,获取机构id,再注册用户,返回用户id, 取到用户id和 机构id ,查询用户机构关联表,在进行绑定
+        // User user = new User();
+        // 验证用户是否存在
+        String username = userAndOrganizationVO.getUserName();
+        User userData = userFacade.getUserInfo(username);
+        // System.out.println(user);
+        if (userData != null) {
+            return RespDTO.onSuc("该用户存在");
+        }
+        // 验证机构是否被绑定
+        UserOrganization userORG = new UserOrganization();
+        userORG.setOrganizationId(userAndOrganizationVO.getOrganizationid());
+
+        List<UserOrganization> userOrganizationData = userOrganizationFacade.getAgencyPersonnel(userORG);
+        if (userOrganizationData.size() > 0) {
+            return RespDTO.onSuc("该机构绑定了用户!");
+        }
+
+        User user = new User();
+        user.setCreator(UserUtils.getCurrentPrincipleID());
+        user.setUsername(userAndOrganizationVO.getUserName());
+        PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
+        String entryPassword = passwordEncoder.encode(userAndOrganizationVO.getPassWord());
+        user.setPassword(entryPassword);
+        user.setLinkman(userAndOrganizationVO.getLinkman());
+        user.setGmtCreate(DateUtil.now());
+        user.setEmail(userAndOrganizationVO.getEmail());
+        boolean res = userFacade.save(user);
+        if (res == true) {
+            Long userId = user.getId();
+            // 用户信息的认证
+            UserAuthentication userAuthentication = new UserAuthentication();
+            userAuthentication.setCreator(UserUtils.getCurrentPrincipleID());//
+            // 创建人Id
+            userAuthentication.setGmtCreate(DateUtil.now());// 记录创建时间
+            userAuthentication.setPosition(userAndOrganizationVO.getPosition());// 岗位信息
+            userAuthentication.setUserId(userId);// 用户id
+            userAuthentication.setIsReject(1);// 是否通过认证 0:未通过,1:已通过
+            userAuthentication.setStatus(1);// 认证状态(0:未认证,1:已认证,2:认证中)
+            userAuthenticationFacade.save(userAuthentication);
+
+            // 用户信息和机构信息的绑定
+            UserOrganization userOrganization = new UserOrganization();
+            userOrganization.setCreator(UserUtils.getCurrentPrincipleID());//
+            // 创建人Id
+            userOrganization.setGmtCreate(DateUtil.now());
+            userOrganization.setOrganizationId(userAndOrganizationVO.getOrganizationid());// 机构id
+            userOrganization.setUserId(userId);// 用户id
+
+            userOrganizationFacade.save(userOrganization);
+        }
+
+        return RespDTO.onSuc("绑定成功");
+    }
 
 }

+ 15 - 10
user-service/src/main/java/com/diagbot/web/VerController.java

@@ -23,7 +23,7 @@ import javax.validation.Valid;
  * @time: 2018/9/4 19:30
  */
 @RestController
-@Api(value="用户验证API", tags={"用户手机图片验证API"})
+@Api(value = "用户验证API", tags = { "用户手机图片验证API" })
 @RequestMapping("/userver")
 @SuppressWarnings("unchecked")
 public class VerController {
@@ -32,17 +32,19 @@ public class VerController {
 
     /**
      * 获取图片验证码
+     *
      * @return 图片验证码包括图片验证码唯一标志和图片信息
      */
     @ApiOperation(value = "获取图片验证码[by:zhoutg]", notes = "获取图片验证码包括图片验证码唯一标志和图片信息")
     @PostMapping("/getImgVerification")
     @SysLogger("getImgVerification")
-    public RespDTO<ImgVerCreatDTO> getImgVerification(){
-        return   RespDTO.onSuc(verFacade.getImgVerification());
+    public RespDTO<ImgVerCreatDTO> getImgVerification() {
+        return RespDTO.onSuc(verFacade.getImgVerification());
     }
 
     /**
      * 验证图片验证码信息
+     *
      * @param imgVerVerVO 验证图片验证码所需参数
      * @return 是否验证成功
      */
@@ -51,12 +53,13 @@ public class VerController {
                     "code:图片验证码<br>")
     @PostMapping("/verifyImgVerification")
     @SysLogger("verifyImgVerification")
-    public RespDTO<Boolean> verImgVerification(@RequestBody @Valid ImgVerVerVO imgVerVerVO){
-        return  RespDTO.onSuc(verFacade.verifyImgVerification(imgVerVerVO));
+    public RespDTO<Boolean> verImgVerification(@RequestBody @Valid ImgVerVerVO imgVerVerVO) {
+        return RespDTO.onSuc(verFacade.verifyImgVerification(imgVerVerVO));
     }
 
     /**
      * 注册获取短信验证码
+     *
      * @param smsVerCreatVO 获取短信验证码输入参数
      * @return 获取短信验证码是否成功
      */
@@ -66,13 +69,14 @@ public class VerController {
                     "code:图片验证码<br>")
     @PostMapping("/getSmsWithRegister")
     @SysLogger("getSmsWithRegister")
-    public RespDTO<Boolean> getSmsWithRegister(@RequestBody @Valid SmsVerCreatVO smsVerCreatVO){
-        return   RespDTO.onSuc(verFacade.getSmsVerification(smsVerCreatVO));
+    public RespDTO<Boolean> getSmsWithRegister(@RequestBody @Valid SmsVerCreatVO smsVerCreatVO) {
+        return RespDTO.onSuc(verFacade.getSmsVerification(smsVerCreatVO));
     }
 
 
     /**
      * 验证注册短信码并且注册为新的用户
+     *
      * @param smsVerVerVO 短信验证码验证输入信息
      * @return 用户信息是否注册到数据库
      */
@@ -81,13 +85,14 @@ public class VerController {
                     "smsCode:短信验证码,必填<br>")
     @PostMapping("/verifySmsVerification")
     @SysLogger("verifySmsVerification")
-    public RespDTO<Boolean> verifySmsVerification(@RequestBody SmsVerVerVO smsVerVerVO){
+    public RespDTO<Boolean> verifySmsVerification(@RequestBody SmsVerVerVO smsVerVerVO) {
         return RespDTO.onSuc(verFacade.verifySmsVerification(smsVerVerVO));
     }
 
 
     /**
      * 忘记密码获取短信验证码
+     *
      * @param smsVerCreatVO 获取短信验证码输入参数
      * @return 获取短信验证码是否成功
      */
@@ -97,8 +102,8 @@ public class VerController {
                     "code:图片验证码<br>")
     @PostMapping("/getSmsWithResetPassword")
     @SysLogger("getSmsWithResetPassword")
-    public RespDTO<Boolean> getSmsWithResetPassword(@RequestBody @Valid SmsVerCreatVO smsVerCreatVO){
-        return   RespDTO.onSuc(verFacade.getSmsWithResetPassword(smsVerCreatVO));
+    public RespDTO<Boolean> getSmsWithResetPassword(@RequestBody @Valid SmsVerCreatVO smsVerCreatVO) {
+        return RespDTO.onSuc(verFacade.getSmsWithResetPassword(smsVerCreatVO));
     }
 
 }