Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev/one' into dev/one

# Conflicts:
#	diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java
#	diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java
#	diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml
zhoutg 6 rokov pred
rodič
commit
220a0487cd
37 zmenil súbory, kde vykonal 569 pridanie a 670 odobranie
  1. 12 3
      diagbotman-service/src/main/java/com/diagbot/dto/AuthDetailDTO.java
  2. 10 0
      diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOnTrialDTO.java
  3. 41 0
      diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOpenedDTO.java
  4. 8 2
      diagbotman-service/src/main/java/com/diagbot/dto/ProductAuthProgressDTO.java
  5. 3 5
      diagbotman-service/src/main/java/com/diagbot/dto/ProductServiceDTO.java
  6. 0 23
      diagbotman-service/src/main/java/com/diagbot/dto/ProductServiceRespDTO.java
  7. 0 194
      diagbotman-service/src/main/java/com/diagbot/entity/DiagOrderDetails.java
  8. 0 166
      diagbotman-service/src/main/java/com/diagbot/entity/DiagProductOrder.java
  9. 0 14
      diagbotman-service/src/main/java/com/diagbot/entity/LantoneProduct.java
  10. 22 0
      diagbotman-service/src/main/java/com/diagbot/entity/OpenedProducts.java
  11. 19 0
      diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java
  12. 40 49
      diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java
  13. 26 0
      diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java
  14. 21 4
      diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java
  15. 22 4
      diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java
  16. 6 10
      diagbotman-service/src/main/java/com/diagbot/web/ProductServiceController.java
  17. 4 4
      diagbotman-service/src/main/java/com/diagbot/web/ServiceTokenController.java
  18. 0 21
      diagbotman-service/src/main/resources/mapper/DiagOrderDetailsMapper.xml
  19. 0 1
      diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml
  20. 16 0
      diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml
  21. 2 2
      diagbotman-service/src/main/resources/mapper/ProductOrderMapper.xml
  22. 1 1
      diagbotman-service/src/test/java/com/diagbot/CodeGeneration.java
  23. 1 1
      user-service/src/main/java/com/diagbot/dto/UserAuthenticationDTO.java
  24. 0 17
      user-service/src/main/java/com/diagbot/dto/UserAuthenticationRespDTO.java
  25. 42 40
      user-service/src/main/java/com/diagbot/facade/UserAuthenticationFacade.java
  26. 5 1
      user-service/src/main/java/com/diagbot/mapper/UserMapper.java
  27. 11 0
      user-service/src/main/java/com/diagbot/mapper/UserOrganizationMapper.java
  28. 2 0
      user-service/src/main/java/com/diagbot/service/UserOrganizationService.java
  29. 3 1
      user-service/src/main/java/com/diagbot/service/UserService.java
  30. 5 0
      user-service/src/main/java/com/diagbot/service/impl/UserOrganizationServiceImpl.java
  31. 6 2
      user-service/src/main/java/com/diagbot/service/impl/UserServiceImpl.java
  32. 24 0
      user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java
  33. 0 15
      user-service/src/main/java/com/diagbot/vo/UserInfoOrganizationsVO.java
  34. 11 15
      user-service/src/main/java/com/diagbot/web/UserAuthenticationController.java
  35. 105 18
      user-service/src/main/java/com/diagbot/web/UserInfoController.java
  36. 92 57
      user-service/src/main/resources/mapper/UserMapper.xml
  37. 9 0
      user-service/src/main/resources/mapper/UserOrganizationMapper.xml

+ 12 - 3
diagbotman-service/src/main/java/com/diagbot/dto/AuthDetailDTO.java

@@ -7,11 +7,20 @@ import lombok.Setter;
 @Setter
 public class AuthDetailDTO {
 	
-	private String productName;
+	/**
+     * 产品名称
+     */
+    private String name;
 	
-	private Integer auditStatus;
+    /**
+     * 是否通过审核,N:未通过,Y:已通过
+     */
+    private String auditStatus;
 	
-	private String auditStatusMessage;
+    /**
+     * 不通过原因
+     */
+    private String rejectReason;
 	
 
 }

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOnTrialDTO.java

@@ -0,0 +1,10 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class GetConsoleOnTrialDTO {
+
+}

+ 41 - 0
diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOpenedDTO.java

@@ -0,0 +1,41 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class GetConsoleOpenedDTO {
+	
+	/**
+     * 已开通产品id
+     */
+    private Integer openId;
+	
+	 /**
+     * 产品id
+     */
+    private Integer productId;
+    
+    /**
+     * 产品名称
+     */
+    private String name;
+
+    /**
+     * 开通日期
+     */
+    private String startTime;
+
+    /**
+     * 结束日期
+     */
+    private String endTime;
+    
+    /**
+     * 当前用户的产品停用状态
+     */
+    private Integer serviceStatus;
+    
+
+}

+ 8 - 2
diagbotman-service/src/main/java/com/diagbot/dto/ProductAuthProgressDTO.java

@@ -14,8 +14,14 @@ import lombok.Setter;
 @Setter
 public class ProductAuthProgressDTO {
 
+    /**
+     * 订单编号
+     */
 	private String num;
-	
-	List<AuthDetailDTO> products;
+
+	/**
+	 * 订单详情
+	 */
+	private List<AuthDetailDTO> products;
 	
 }

+ 3 - 5
diagbotman-service/src/main/java/com/diagbot/dto/ProductServiceDTO.java

@@ -1,7 +1,6 @@
 package com.diagbot.dto;
 
 import com.diagbot.entity.LantoneProduct;
-import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.ProductService;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.ServiceToken;
@@ -9,16 +8,15 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
- * @Description:
+ * @Description:产品服务关联信息返回类
  * @author: zhaops
- * @time: 2018/9/19 15:11
+ * @time: 2018/9/18 19:58
  */
 @Getter
 @Setter
 public class ProductServiceDTO {
     private ProductService productService;
+    private ServiceToken serviceToken;
     private LantoneProduct lantoneProduct;
-    private OpenedProducts openedProducts;
     private ServiceInfo serviceInfo;
-    private ServiceToken serviceToken;
 }

+ 0 - 23
diagbotman-service/src/main/java/com/diagbot/dto/ProductServiceRespDTO.java

@@ -1,23 +0,0 @@
-package com.diagbot.dto;
-
-import com.diagbot.entity.LantoneProduct;
-import com.diagbot.entity.ProductService;
-import com.diagbot.entity.ServiceInfo;
-import com.diagbot.entity.ServiceToken;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @Description:
- * @author: zhaops
- * @time: 2018/9/18 19:58
- */
-@Getter
-@Setter
-public class ProductServiceRespDTO {
-    private ProductService productService;
-    private ServiceToken serviceToken;
-    private LantoneProduct lantoneProduct;
-    private ServiceInfo serviceInfo;
-    private String msg;
-}

+ 0 - 194
diagbotman-service/src/main/java/com/diagbot/entity/DiagOrderDetails.java

@@ -1,194 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @Description: 订单明细实体类
- * @Author: wangyu
- * @Date: 15:40 2018/9/17
- */
-public class DiagOrderDetails implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 订单明细id
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 是否删除,N:未删除,Y:删除
-     */
-    private String isDeleted;
-
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-
-    /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
-     */
-    private Date gmtModified;
-
-    /**
-     * 创建人,0表示无创建人值
-     */
-    private String creator;
-
-    /**
-     * 修改人,如果为0则表示纪录未修改
-     */
-    private String modifier;
-
-    /**
-     * 订单编号
-     */
-    private String orderNum;
-
-    /**
-     * 产品id
-     */
-    private Integer productId;
-
-    /**
-     * 用户id
-     */
-    private Integer userId;
-
-    /**
-     * 是否通过审核,N:未通过,Y:已通过
-     */
-    private String auditStatus;
-
-    /**
-     * 单个服务的价钱
-     */
-    private BigDecimal unitPrice;
-
-    /**
-     * 订单状态 Y:已付款,N未付款
-     */
-    private String status;
-
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-
-    public String getOrderNum() {
-        return orderNum;
-    }
-
-    public void setOrderNum(String orderNum) {
-        this.orderNum = orderNum;
-    }
-
-    public Integer getProductId() {
-        return productId;
-    }
-
-    public void setProductId(Integer productId) {
-        this.productId = productId;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public String getAuditStatus() {
-        return auditStatus;
-    }
-
-    public void setAuditStatus(String auditStatus) {
-        this.auditStatus = auditStatus;
-    }
-
-    public BigDecimal getUnitPrice() {
-        return unitPrice;
-    }
-
-    public void setUnitPrice(BigDecimal unitPrice) {
-        this.unitPrice = unitPrice;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    @Override
-    public String toString() {
-        return "DiagOrderDetails{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreate=" + gmtCreate +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", orderNum=" + orderNum +
-        ", productId=" + productId +
-        ", userId=" + userId +
-        ", auditStatus=" + auditStatus +
-        ", unitPrice=" + unitPrice +
-                ", status=" + status +
-        "}";
-    }
-}

+ 0 - 166
diagbotman-service/src/main/java/com/diagbot/entity/DiagProductOrder.java

@@ -1,166 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @Description: 订单实体类
- * @Author: wangyu
- * @Date: 15:41 2018/9/17
- */
-public class DiagProductOrder implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 订单id
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 是否删除,N:未删除,Y:删除
-     */
-    private String isDeleted;
-
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-
-    /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
-     */
-    private Date gmtModified;
-
-    /**
-     * 创建人,0表示无创建人值
-     */
-    private String creator;
-
-    /**
-     * 修改人,如果为0则表示纪录未修改
-     */
-    private String modifier;
-
-    /**
-     * 订单编号
-     */
-    private String num;
-
-    /**
-     * 用户id
-     */
-    private Integer userId;
-
-    /**
-     * 下单时间(申请时间)
-     */
-    private Date time;
-
-    /**
-     * 订单总价
-     */
-    private BigDecimal totalPrices;
-
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-
-    public String getNum() {
-        return num;
-    }
-
-    public void setNum(String num) {
-        this.num = num;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public Date getTime() {
-        return time;
-    }
-
-    public void setTime(Date time) {
-        this.time = time;
-    }
-
-    public BigDecimal getTotalPrices() {
-        return totalPrices;
-    }
-
-    public void setTotalPrices(BigDecimal totalPrices) {
-        this.totalPrices = totalPrices;
-    }
-
-    @Override
-    public String toString() {
-        return "DiagProductOrder{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreate=" + gmtCreate +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", num=" + num +
-        ", userId=" + userId +
-        ", time=" + time +
-        ", totalPrices=" + totalPrices +
-        "}";
-    }
-}

+ 0 - 14
diagbotman-service/src/main/java/com/diagbot/entity/LantoneProduct.java

@@ -71,11 +71,6 @@ public class LantoneProduct implements Serializable {
      */
     private String url;
 
-    /**
-     * 机构开通数量
-     */
-    private Integer openNum;
-
     /**
      * 停用状态
      */
@@ -177,14 +172,6 @@ public class LantoneProduct implements Serializable {
         this.url = url;
     }
 
-    public Integer getOpenNum() {
-        return openNum;
-    }
-
-    public void setOpenNum(Integer openNum) {
-        this.openNum = openNum;
-    }
-
     public Integer getServiceStatus() {
         return serviceStatus;
     }
@@ -230,7 +217,6 @@ public class LantoneProduct implements Serializable {
                 ", decription=" + decription +
                 ", chargeType=" + chargeType +
                 ", url=" + url +
-                ", openNum=" + openNum +
                 ", serviceStatus=" + serviceStatus +
                 ", trialStatus=" + trialStatus +
                 ", trialUrl=" + trialUrl +

+ 22 - 0
diagbotman-service/src/main/java/com/diagbot/entity/OpenedProducts.java

@@ -81,6 +81,10 @@ public class OpenedProducts implements Serializable {
      */
     private Integer orderId;
 
+    private Integer accessType;
+
+    private Integer chargeType;
+
 
     public Long getId() {
         return id;
@@ -178,6 +182,22 @@ public class OpenedProducts implements Serializable {
         this.orderId = orderId;
     }
 
+    public Integer getAccessType() {
+        return accessType;
+    }
+
+    public void setAccessType(Integer accessType) {
+        this.accessType = accessType;
+    }
+
+    public Integer getChargeType() {
+        return chargeType;
+    }
+
+    public void setChargeType(Integer chargeType) {
+        this.chargeType = chargeType;
+    }
+
     @Override
     public String toString() {
         return "OpenedProducts{" +
@@ -193,6 +213,8 @@ public class OpenedProducts implements Serializable {
                 ", endTime=" + endTime +
                 ", serviceStatus=" + serviceStatus +
                 ", orderId=" + orderId +
+                ", accessType=" + accessType +
+                ", chargeType=" + chargeType +
                 "}";
     }
 }

+ 19 - 0
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -2,11 +2,18 @@ package com.diagbot.facade;
 
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.service.impl.OpenedProductsServiceImpl;
+import java.util.List;
+
 import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.Map;
 
+import com.diagbot.dto.GetConsoleOnTrialDTO;
+import com.diagbot.dto.GetConsoleOpenedDTO;
+import com.diagbot.service.impl.OpenedProductsServiceImpl;
+import com.diagbot.util.UserUtils;
+
 /**
  * @Description:已开通产品业务层
  * @author: zhaops
@@ -18,4 +25,16 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
     public List<OpenedProducts> getByAppkeyAndSecretFac(Map map) {
         return this.getByAppkeyAndSecret(map);
     }
+
+
+    public List<GetConsoleOpenedDTO> getConsoleOpened(){
+    	Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        return baseMapper.getConsoleOpened(userId);
+    }
+
+    public List<GetConsoleOnTrialDTO> getConsoleOnTrial(){
+    	Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        return baseMapper.getConsoleOnTrial(userId);
+    }
+
 }

+ 40 - 49
diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java

@@ -2,7 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.diagbot.dto.ProductServiceRespDTO;
+import com.diagbot.dto.ProductServiceDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.ProductService;
@@ -10,6 +10,8 @@ import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.ServiceToken;
 import com.diagbot.entity.wrapper.ProductServiceWrapper;
 import com.diagbot.enums.TokenTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ProductServiceServiceImpl;
 import com.diagbot.util.GuidUtil;
 import com.diagbot.util.UserUtils;
@@ -44,22 +46,22 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
      * @author: zhaops
      * @time: 2018/9/18 16:33
      */
-    public ProductServiceRespDTO genProductService(ProductServiceSaveVO productServiceSaveVO) {
-        ProductServiceRespDTO productServiceRespDTO = new ProductServiceRespDTO();
+    public ProductServiceDTO genProductService(ProductServiceSaveVO productServiceSaveVO) {
+        ProductServiceDTO productServiceDTO = new ProductServiceDTO();
         Calendar calendar = Calendar.getInstance();
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
         if (lantoneProduct == null) {
-            productServiceRespDTO.setMsg("找不到产品【" + lantoneProduct.getName() + "】");
-            return productServiceRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "找不到产品【" + lantoneProduct.getName() + "】");
         }
         ServiceInfo serviceInfo = serviceInfoFacade.getById(productServiceSaveVO.getServiceId());
         if (serviceInfo == null) {
-            productServiceRespDTO.setMsg("找不到服务端【" + serviceInfo.getName() + "】");
-            return productServiceRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "找不到服务端【" + serviceInfo.getName() + "】");
         } else if (serviceInfo.getUserId() != userId) {
-            productServiceRespDTO.setMsg("当前登录用户没有关联服务端【" + serviceInfo.getName() + "】");
-            return productServiceRespDTO;
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "当前登录用户没有关联服务端【" + serviceInfo.getName() + "】");
         }
 
         Map<String, Object> map = new HashMap<>();
@@ -82,47 +84,40 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         // 生成令牌
         // 如果已有令牌,先删除原令牌,再重新生成
         // 试用产品 type=3 需生成7天有效期,重新生成令牌,有效期继承,超出有效期不允许再生成令牌
-        // 接入方式 accessType=3 online模式不需要生成令牌
         ServiceToken old_serviceToken = serviceTokenFacade.getByProductServiceId(productService.getId());
         //删除原有token
         if (old_serviceToken != null) {
             serviceTokenFacade.deleteByProductServiceId(old_serviceToken.getProductSeviceId());
         }
 
-        String[] accessType = lantoneProduct.getAccessType().split(",");
-        if (accessType.length == 1 && accessType[0].equals("3")) {
-            productServiceRespDTO.setMsg("online模式不需要生成令牌!");
-        } else {
-            ServiceToken serviceToken = new ServiceToken();
-            serviceToken.setCreator(userId.toString());
-            serviceToken.setGmtCreate(new Date());
-            serviceToken.setProductSeviceId(productService.getId());
-            serviceToken.setType(productServiceSaveVO.getType());
-            serviceToken.setAppKeyId(GuidUtil.App_key());
-            serviceToken.setAppKeySecret(GuidUtil.App_screct());
-            serviceToken.setStatus(1);
-            if (old_serviceToken != null && old_serviceToken.getType().equals(TokenTypeEnum.Trial)) {
-                //如果试用已过期,不允许再生成
-                if (calendar.after(old_serviceToken.getExpiringDate())) {
-                    productServiceRespDTO.setMsg("当前试用账号已过期,不允许再生成令牌");
-                    return productServiceRespDTO;
-                }
-                serviceToken.setStartingDate(old_serviceToken.getStartingDate());
-                serviceToken.setExpiringDate(old_serviceToken.getExpiringDate());
-            } else if (productServiceSaveVO.getType().equals(TokenTypeEnum.Trial)) {
-                serviceToken.setStartingDate(new Date());
-                calendar.clear();
-                calendar.setTime(new Date());
-                calendar.add(Calendar.DAY_OF_MONTH, 7);
-                serviceToken.setExpiringDate(calendar.getTime());
+        ServiceToken serviceToken = new ServiceToken();
+        serviceToken.setCreator(userId.toString());
+        serviceToken.setGmtCreate(new Date());
+        serviceToken.setProductSeviceId(productService.getId());
+        serviceToken.setType(productServiceSaveVO.getType());
+        serviceToken.setAppKeyId(GuidUtil.App_key());
+        serviceToken.setAppKeySecret(GuidUtil.App_screct());
+        serviceToken.setStatus(1);
+        if (old_serviceToken != null && old_serviceToken.getType().equals(TokenTypeEnum.Trial.getKey())) {
+            //如果试用已过期,不允许再生成
+            if (calendar.after(old_serviceToken.getExpiringDate())) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "当前试用账号已过期,不允许再生成令牌");
             }
-            serviceTokenFacade.save(serviceToken);
-            productServiceRespDTO.setServiceToken(serviceToken);
-            productServiceRespDTO.setMsg("令牌生成成功!");
+            serviceToken.setStartingDate(old_serviceToken.getStartingDate());
+            serviceToken.setExpiringDate(old_serviceToken.getExpiringDate());
+        } else if (productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
+            serviceToken.setStartingDate(new Date());
+            calendar.clear();
+            calendar.setTime(new Date());
+            calendar.add(Calendar.DAY_OF_MONTH, 7);
+            serviceToken.setExpiringDate(calendar.getTime());
         }
+        serviceTokenFacade.save(serviceToken);
+        productServiceDTO.setServiceToken(serviceToken);
 
-        productServiceRespDTO.setProductService(productService);
-        return productServiceRespDTO;
+        productServiceDTO.setProductService(productService);
+        return productServiceDTO;
     }
 
     /**
@@ -130,24 +125,20 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
      * @author: zhaops
      * @time: 2018/9/18 16:33
      */
-    public ProductServiceRespDTO deleteProductService(ProductServiceSaveVO productServiceSaveVO) {
-        ProductServiceRespDTO productServiceRespDTO = new ProductServiceRespDTO();
-        Calendar calendar = Calendar.getInstance();
-        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+    public Boolean deleteProductService(ProductServiceSaveVO productServiceSaveVO) {
         Map<String, Object> map = new HashMap<>();
         map.put("productId", productServiceSaveVO.getProductId());
         map.put("serviceId", productServiceSaveVO.getServiceId());
         ProductService productService = this.findByProductIdAndServiceId(map);
         if (productService == null) {
-            productServiceRespDTO.setMsg("产品服务端不存在!");
-            return productServiceRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "找不到产品服务端");
         }
         //删除关联令牌
         serviceTokenFacade.deleteByProductServiceId(productService.getId());
         //删除产品服务端
         this.delById(productService.getId());
-        productServiceRespDTO.setMsg("删除成功!");
-        return productServiceRespDTO;
+        return true;
     }
 
     /**

+ 26 - 0
diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java

@@ -6,6 +6,8 @@ import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.ServiceToken;
 import com.diagbot.entity.wrapper.ProductServiceWrapper;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ServiceInfoServiceImpl;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.ServiceSaveVO;
@@ -20,6 +22,11 @@ import java.util.List;
  */
 @Component
 public class ServiceInfoFacade extends ServiceInfoServiceImpl {
+    /**
+     * @Description: 新建服务端
+     * @author: zhaops
+     * @time: 2018/9/18 16:31
+     */
     public ServiceInfo createService(ServiceSaveVO serviceSaveVO) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         ServiceInfo serviceInfo = new ServiceInfo();
@@ -33,20 +40,39 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
         return serviceInfo;
     }
 
+    /**
+     * @Description: 修改服务端
+     * @author: zhaops
+     * @time: 2018/9/18 16:31
+     */
     public Boolean updateService(ServiceInfo serviceInfo) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        if (userId != serviceInfo.getUserId()) {
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
+                    "服务端【" + serviceInfo.getName() + "】关联用户与当前登录用户不匹配");
+        }
         serviceInfo.setUserId(userId);
         serviceInfo.setModifier(userId.toString());
         serviceInfo.setGmtModified(new Date());
         return this.updateById(serviceInfo);
     }
 
+    /**
+     * @Description: 获取当前登录用户服务列表
+     * @author: zhaops
+     * @time: 2018/9/18 16:31
+     */
     public List<ServiceInfo> getServiceListByCurrentUser() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         List<ServiceInfo> list = this.getListByUserId(userId);
         return list;
     }
 
+    /**
+     * @Description: 获取当前登录用户服务分页列表
+     * @author: zhaops
+     * @time: 2018/9/19 14:05
+     */
     public IPage<ServiceInfo> getServiceListPageByCurrentUser(Page<ServiceInfo> page) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         ServiceInfo serviceInfoVO = new ServiceInfo();

+ 21 - 4
diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java

@@ -1,13 +1,16 @@
 package com.diagbot.mapper;
 
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.GetConsoleOnTrialDTO;
+import com.diagbot.dto.GetConsoleOpenedDTO;
 import com.diagbot.entity.OpenedProducts;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -40,4 +43,18 @@ public interface OpenedProductsMapper extends BaseMapper<OpenedProducts> {
      */
     List<OpenedProducts> getByAppkeyAndSecret(Map<String,Object> map);
 
+
+    /**
+     * 控制台已开通产品查询
+     * @param userId
+     * @return
+     */
+    List<GetConsoleOpenedDTO> getConsoleOpened(Long userId);
+
+    /**
+     * 控制台已开通产品查询
+     * @param userId
+     * @return
+     */
+    List<GetConsoleOnTrialDTO> getConsoleOnTrial(Long userId);
 }

+ 22 - 4
diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

@@ -3,37 +3,55 @@ package com.diagbot.web;
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.GetConsoleOnTrialDTO;
+import com.diagbot.dto.GetConsoleOpenedDTO;
 import com.diagbot.dto.ProductAuthProgressDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.OpenedProductsFacade;
 import com.diagbot.facade.ProductOrderFacade;
 
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 /**
- * 订单操作
  * 
  * @author rgb
  *
  */
+@Api(value="控制台-产品操作", tags={"控制台-产品操作"})
 @RestController
 @RequestMapping("/productOrder")
 public class ProductOrderController {
 
 	@Autowired
 	private ProductOrderFacade productOrderFacade;
+	@Autowired
+	private OpenedProductsFacade openedProductsFacade;
 
-	@ApiOperation(value = "产品认证进度")
+	@ApiOperation(value = "控制台-产品认证进度",notes="控制台-产品认证进度")
 	@PostMapping("/productAuthProgress")
 	@SysLogger("productAuthProgress")
-	@Transactional
 	public RespDTO<List<ProductAuthProgressDTO>> productAuthProgress() {
 		return RespDTO.onSuc(productOrderFacade.productAuthProgress());
 	}
+	
+	@ApiOperation(value = "控制台-已开通产品",notes="控制台-已开通产品")
+	@PostMapping("/getConsoleOpened")
+	@SysLogger("getConsoleOpened")
+	public RespDTO<List<GetConsoleOpenedDTO>> getConsoleOpened() {
+		return RespDTO.onSuc(openedProductsFacade.getConsoleOpened());
+	}
+	
+	@ApiOperation(value = "控制台-可试用产品",notes="控制台-可试用产品")
+	@PostMapping("/getConsoleOnTrial")
+	@SysLogger("getConsoleOnTrial")
+	public RespDTO<List<GetConsoleOnTrialDTO>> getConsoleOnTrial() {
+		return RespDTO.onSuc(openedProductsFacade.getConsoleOnTrial());
+	}
 
 }

+ 6 - 10
diagbotman-service/src/main/java/com/diagbot/web/ProductServiceController.java

@@ -5,9 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.ProductServiceDTO;
-import com.diagbot.dto.ProductServiceRespDTO;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.User;
 import com.diagbot.entity.wrapper.ProductServiceWrapper;
 import com.diagbot.facade.ProductServiceFacade;
 import com.diagbot.vo.ProductServiceSaveVO;
@@ -17,9 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * <p>
@@ -43,9 +39,9 @@ public class ProductServiceController {
     @PostMapping("/genProductService")
     @SysLogger("genProductService")
     @Transactional
-    public RespDTO<ProductServiceRespDTO> genProductService(ProductServiceSaveVO productServiceSaveVO) {
-        ProductServiceRespDTO productServiceRespDTO = productServiceFacade.genProductService(productServiceSaveVO);
-        return RespDTO.onSuc(productServiceRespDTO);
+    public RespDTO<ProductServiceDTO> genProductService(ProductServiceSaveVO productServiceSaveVO) {
+        ProductServiceDTO productServiceDTO = productServiceFacade.genProductService(productServiceSaveVO);
+        return RespDTO.onSuc(productServiceDTO);
     }
 
     @ApiOperation(value = "删除产品服务端",
@@ -55,9 +51,9 @@ public class ProductServiceController {
     @PostMapping("/deleteProductService")
     @SysLogger("deleteProductService")
     @Transactional
-    public RespDTO<ProductServiceRespDTO> deleteProductService(ProductServiceSaveVO productServiceSaveVO) {
-        ProductServiceRespDTO productServiceRespDTO = productServiceFacade.deleteProductService(productServiceSaveVO);
-        return RespDTO.onSuc(productServiceRespDTO);
+    public RespDTO<Boolean> deleteProductService(ProductServiceSaveVO productServiceSaveVO) {
+        Boolean isSuccess = productServiceFacade.deleteProductService(productServiceSaveVO);
+        return RespDTO.onSuc(isSuccess);
     }
 
     @ApiOperation(value = "根据用户id获取产品服务关联信息", notes = "根据用户id获取产品服务关联信息")

+ 4 - 4
diagbotman-service/src/main/java/com/diagbot/web/ServiceTokenController.java

@@ -2,7 +2,7 @@ package com.diagbot.web;
 
 
 import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.ProductServiceRespDTO;
+import com.diagbot.dto.ProductServiceDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ProductServiceFacade;
 import com.diagbot.facade.ServiceTokenFacade;
@@ -50,9 +50,9 @@ public class ServiceTokenController {
     @PostMapping("/createServiceToken")
     @SysLogger("createServiceToken")
     @Transactional
-    public RespDTO<ProductServiceRespDTO> createServiceToken(@RequestBody @Valid ProductServiceSaveVO productServiceSaveVO) {
-        ProductServiceRespDTO productServiceRespDTO = productServiceFacade.genProductService(productServiceSaveVO);
-        return RespDTO.onSuc(productServiceRespDTO);
+    public RespDTO<ProductServiceDTO> createServiceToken(@RequestBody @Valid ProductServiceSaveVO productServiceSaveVO) {
+        ProductServiceDTO productServiceDTO = productServiceFacade.genProductService(productServiceSaveVO);
+        return RespDTO.onSuc(productServiceDTO);
     }
 
     @ApiOperation(value = "令牌禁用",

+ 0 - 21
diagbotman-service/src/main/resources/mapper/DiagOrderDetailsMapper.xml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.diagbot.mapper.DiagOrderDetailsMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.diagbot.entity.DiagOrderDetails">
-        <id column="id" property="id" />
-        <result column="is_deleted" property="isDeleted" />
-        <result column="gmt_create" property="gmtCreate" />
-        <result column="gmt_modified" property="gmtModified" />
-        <result column="creator" property="creator" />
-        <result column="modifier" property="modifier" />
-        <result column="order_num" property="orderNum" />
-        <result column="product_id" property="productId" />
-        <result column="user_id" property="userId" />
-        <result column="audit_status" property="auditStatus" />
-        <result column="unit_price" property="unitPrice" />
-        <result column="status" property="status" />
-    </resultMap>
-
-</mapper>

+ 0 - 1
diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml

@@ -14,7 +14,6 @@
         <result column="decription" property="decription" />
         <result column="charge_type" property="chargeType" />
         <result column="url" property="url" />
-        <result column="open_num" property="openNum" />
         <result column="service_status" property="serviceStatus" />
         <result column="trial_status" property="trialStatus" />
         <result column="trial_url" property="trialUrl" />

+ 16 - 0
diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml

@@ -16,6 +16,8 @@
         <result column="end_time" property="endTime" />
         <result column="service_status" property="serviceStatus" />
         <result column="order_id" property="orderId" />
+        <result column="access_type" property="accessType" />
+        <result column="charge_type" property="chargeType" />
     </resultMap>
     <select id="selectOpendInfoByUserId" resultMap="BaseResultMap" parameterType="java.util.List">
         SELECT opend.* FROM diag_opened_products opend WHERE user_id = #{userId}
@@ -38,4 +40,18 @@
         and st.is_deleted = 'N' and ps.is_deleted = 'N' and si.is_deleted = 'N' AND os.is_deleted = 'N'
         and st.app_key_id = #{appkey} and st.app_key_secret = #{secret}
     </select>
+
+ 	<select id="getConsoleOpened" parameterType="long" resultType="com.diagbot.dto.GetConsoleOpenedDTO">
+    	SELECT
+			a.id as openId,
+			b.id as productId,
+			b.name as name,
+			DATE_FORMAT(a.start_time,'%Y-%m-%d') as startTime,
+			DATE_FORMAT(a.end_time,'%Y-%m-%d') as endTime,
+			a.service_status as serviceStatus
+		from diag_opened_products a join diag_lantone_product b on a.product_id=b.id
+		where a.is_deleted='N' and b.is_deleted='N' and a.user_id=#{userId};
+    </select>
+
+
 </mapper>

+ 2 - 2
diagbotman-service/src/main/resources/mapper/ProductOrderMapper.xml

@@ -25,8 +25,8 @@
 	<select id="getOrderDetails" parameterType="string" resultType="com.diagbot.dto.AuthDetailDTO">
 		select
 			b.audit_status as auditStatus,
-			c.name as productName,
-			case when b.audit_status is null then '未开通' when b.audit_status=='0' then '不通过' when when b.audit_status=='1' then "通过" end as auditStatusMessage
+			c.name as name,
+			b.reject_reason as rejectReason
 		from diag_product_order a join diag_order_details b on a.num=b.order_num
 		join diag_lantone_product c on b.product_id=c.id
 		where a.is_deleted = 'N' and  b.is_deleted = 'N' and  c.is_deleted = 'N'

+ 1 - 1
diagbotman-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -55,7 +55,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
         strategy.setTablePrefix(new String[] { "diag_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "diag_product_order","diag_order_details","diag_opened_products" ,"diag_lantone_product"}); // 需要生成的表
+        strategy.setInclude(new String[] { "diag_product_order"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);

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

@@ -8,7 +8,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
- * @Description:获取用户认证信息
+ * @Description:用户认证信息
  * @author: zhaops
  * @time: 2018/9/17 15:01
  */

+ 0 - 17
user-service/src/main/java/com/diagbot/dto/UserAuthenticationRespDTO.java

@@ -1,17 +0,0 @@
-package com.diagbot.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @Description:用户认证返回结果
- * @author: zhaops
- * @time: 2018/9/17 19:52
- */
-@Getter
-@Setter
-public class UserAuthenticationRespDTO {
-    private UserAuthenticationDTO userAuthenticationDTO;
-    private String msg;
-    private Boolean isSuccess;
-}

+ 42 - 40
user-service/src/main/java/com/diagbot/facade/UserAuthenticationFacade.java

@@ -1,24 +1,23 @@
 package com.diagbot.facade;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
 import com.diagbot.dto.QueryAuthProgressDTO;
 import com.diagbot.dto.UserAuthenticationDTO;
-import com.diagbot.dto.UserAuthenticationRespDTO;
 import com.diagbot.entity.Organization;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserAuthentication;
 import com.diagbot.enums.AuthStatusEnum;
 import com.diagbot.enums.OrganizationTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.UserAuthenticationServiceImpl;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.UserAuthenticationVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @Description:用户认证业务层
@@ -32,38 +31,38 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
     @Autowired
     private OrganizationFacade organizationFacade;
 
-    public UserAuthenticationRespDTO userAuthentication(UserAuthenticationVO userAuthenticationVO) {
-        UserAuthenticationRespDTO userAuthenticationRespDTO = new UserAuthenticationRespDTO();
+    /**
+     * @Description:用户认证
+     * @author: zhaops
+     * @time: 2018/9/13 19:30
+     */
+    public UserAuthenticationDTO userAuthentication(UserAuthenticationVO userAuthenticationVO) {
+        UserAuthenticationDTO userAuthenticationDTO = new UserAuthenticationDTO();
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         User user_old = userFacade.getById(userId);
         User user = userFacade.findByName(userAuthenticationVO.getUserName());
         if (user == null) {
-            userAuthenticationRespDTO.setMsg("用户【" + userAuthenticationVO.getUserName() + "】不存在,不允许验证!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "用户【" + userAuthenticationVO.getUserName() + "】不存在,不允许验证");
         } else if (user.getId() != userId) {
-            userAuthenticationRespDTO.setMsg("登录用户【" + user_old.getUsername() + "】与验证用户【" + user.getUsername() + "】不符,不允许验证!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "登录用户【" + user_old.getUsername() + "】与验证用户【" + user.getUsername() + "】不符,不允许验证");
         }
 
         //判断该用户是否有关联机构
         Organization organization_old = organizationFacade.getByUserId(userId);
         if (organization_old == null) {
-            userAuthenticationRespDTO.setMsg("当前用户没有关联机构,不允许验证!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "当前用户没有关联机构,不允许验证");
         }
         //更新机构信息
         Organization organization = organizationFacade.getByName(userAuthenticationVO.getOrganization());
         if (organization == null) {
-            userAuthenticationRespDTO.setMsg("找不到机构【" + userAuthenticationVO.getOrganization() + "】!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "找不到机构【" + userAuthenticationVO.getOrganization() + "】");
         } else if (organization.getId() != organization_old.getId()) {
-            userAuthenticationRespDTO.setMsg("当前用户已关联到机构【" + organization_old.getName() + "】,不允许修改机构!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "当前用户已关联到机构【" + organization_old.getName() + "】,不允许修改机构");
         }
         organization.setAddress(userAuthenticationVO.getOrganizationAddress());
         organization.setPrincipal(userAuthenticationVO.getOrganizationPrincipal());
@@ -81,13 +80,11 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
             userAuthentication.setGmtCreate(new Date());
             userAuthentication.setUserId(userId);
         } else if (userAuthentication.getStatus() == 1) {
-            userAuthenticationRespDTO.setMsg("用户【" + user.getUsername() + "】已认证,不允许重复认证!");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "用户【" + user.getUsername() + "】已认证,不允许重复认证");
         } else if (userAuthentication.getStatus() == 2) {
-            userAuthenticationRespDTO.setMsg("认证申请已提交,请耐心等待……");
-            userAuthenticationRespDTO.setIsSuccess(false);
-            return userAuthenticationRespDTO;
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "认证申请已提交,无需重复提交");
         }
         userAuthentication.setModifier(userId.toString());
         userAuthentication.setGmtModified(new Date());
@@ -95,16 +92,17 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         userAuthentication.setStatus(2);  //状态设为认证中
         this.saveOrUpdate(userAuthentication);
 
-        userAuthenticationRespDTO.setMsg("认证申请已提交成功,请耐心等待1~2个工作日");
-        userAuthenticationRespDTO.setIsSuccess(true);
-        UserAuthenticationDTO userAuthenticationDTO = new UserAuthenticationDTO();
         userAuthenticationDTO.setUser(user);
         userAuthenticationDTO.setOrganization(organization);
         userAuthenticationDTO.setUserAuthentication(userAuthentication);
-        userAuthenticationRespDTO.setUserAuthenticationDTO(userAuthenticationDTO);
-        return userAuthenticationRespDTO;
+        return userAuthenticationDTO;
     }
 
+    /**
+     * @Description:获取用户认证信息
+     * @author: zhaops
+     * @time: 2018/9/13 19:30
+     */
     public UserAuthenticationDTO getuserAuthenticationInfo() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         User user = userFacade.getById(userId);
@@ -122,6 +120,11 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         return userAuthenticationDTO;
     }
 
+    /**
+     * @Description:获取用户认证状态
+     * @author: zhaops
+     * @time: 2018/9/13 19:30
+     */
     public Map<Integer, Object> getUserAuthenticationStatus() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         UserAuthentication userAuthentication = this.getByUserId(userId);
@@ -152,13 +155,12 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
     public QueryAuthProgressDTO queryAuthProgress() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         UserAuthentication userAuthentication = this.getByUserId(userId);
-        
+
         QueryAuthProgressDTO queryAuthProgressDTO = new QueryAuthProgressDTO();
         queryAuthProgressDTO.setStatus(userAuthentication.getStatus());
         queryAuthProgressDTO.setIsReject(userAuthentication.getIsReject());
         queryAuthProgressDTO.setRejectComment(userAuthentication.getRejectComment());
-        
+
         return queryAuthProgressDTO;
     }
-    
 }

+ 5 - 1
user-service/src/main/java/com/diagbot/mapper/UserMapper.java

@@ -32,10 +32,14 @@ public interface UserMapper extends BaseMapper<User> {
     
     public Integer updateUserInfoAll(UserInfoOrganizationsVO userInfo);
     
-    public Integer updateDeleted(@Param("map") Map<String ,String> map);
+    public Integer updateDeleted(@Param("map") Map<String,Object> map);
 
     public List<User> getByIds(List<Long> ids);
 
     public List<UserOrgDTO> getUserOrgDTOByIds(List<Long> ids);
+    
+    public boolean auditUserInfoAll(@Param("auditMap") Map<String,Object> auditMap);
+    
+    public Integer updateById(Map<String,String> map);
 
 }

+ 11 - 0
user-service/src/main/java/com/diagbot/mapper/UserOrganizationMapper.java

@@ -1,5 +1,9 @@
 package com.diagbot.mapper;
 
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.entity.UserOrganization;
 
@@ -9,5 +13,12 @@ import com.diagbot.entity.UserOrganization;
  * @Date: 2018/9/13 17:19
  */
 public interface UserOrganizationMapper extends BaseMapper<UserOrganization> {
+	
+	/**
+	 * 
+	 * @param organizationId 根据机构id查绑定的用户
+	 * @return
+	 */
+	 public List<UserOrganization> getAgencyPersonnel(@Param("userORG") UserOrganization userORG);
 
 }

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

@@ -19,4 +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);
 }

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

@@ -29,11 +29,13 @@ public interface UserService extends IService<User> {
     
     public Integer updateUserInfoAll(UserInfoOrganizationsVO userInfo);
 
-	Integer updateDeleted(Map<String, String> map);
+	Integer updateDeleted(Map<String,Object> map);
 
     IPage<User> indexPage(Page<User> page, User user);
 
     public List<User> getByIds(List<Long> ids);
 
     public List<UserOrgDTO> getUserOrgByIds(List<Long> userIds);
+
+    public boolean auditUserInfoAll(Map<String,Object> auditMap);
 }

+ 5 - 0
user-service/src/main/java/com/diagbot/service/impl/UserOrganizationServiceImpl.java

@@ -25,4 +25,9 @@ public class UserOrganizationServiceImpl extends ServiceImpl<UserOrganizationMap
     public List<UserOrganization> selectByMap(Map map) {
         return userOrganizationMapper.selectByMap(map);
     }
+    @Override
+    public List<UserOrganization> getAgencyPersonnel(UserOrganization userORG){
+    	return userOrganizationMapper.getAgencyPersonnel(userORG);
+    	
+    }
 }

+ 6 - 2
user-service/src/main/java/com/diagbot/service/impl/UserServiceImpl.java

@@ -49,7 +49,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		
 	}
 	@Override
-	public Integer updateDeleted(Map<String,String> map){
+	public Integer updateDeleted(Map<String,Object> map){
 		return baseMapper.updateDeleted(map);
 		
 	}
@@ -68,6 +68,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     public List<UserOrgDTO> getUserOrgByIds(List<Long> userIds) {
         return userMapper.getUserOrgDTOByIds(userIds);
     }
-
+    @Override
+    public boolean auditUserInfoAll(Map<String,Object> auditMap) {
+	    // TODO Auto-generated method stub
+	    return baseMapper.auditUserInfoAll(auditMap);
+    }
 
 }

+ 24 - 0
user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java

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

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

@@ -23,20 +23,5 @@ public class UserInfoOrganizationsVO implements Serializable {
 	  private String address;//单位地址
 	  private Integer type;//机构属性
 	  private String position;//岗位部门
-	  private String isReject;//是否通过认证 N:未通过,Y:已通过
-	  private Integer rejectType;//未通过类型
-	  private String rejectComment;//认证被拒理由
-	  private String status;//认证状态(0:未认证,1:已认证,2:认证中)
 	  private Long userId;//用户id
-	
-	@Override
-	public String toString() {
-		return "UserInfoOrganizations [gmtModified=" + gmtModified + ", modifier="
-				+ modifier + ", email=" + email + ", principal=" + principal + ", address=" + address + ", type=" + type
-				+ ", position=" + position + ", isReject=" + isReject + ", rejectType=" + rejectType
-				+ ", rejectComment=" + rejectComment + ", status=" + status + ", userId=" + userId + "]";
-	}
-	  
-	  
-
 }

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

@@ -1,26 +1,22 @@
 package com.diagbot.web;
 
 
-import java.util.Map;
-
-import javax.validation.Valid;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.QueryAuthProgressDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserAuthenticationDTO;
-import com.diagbot.dto.UserAuthenticationRespDTO;
 import com.diagbot.facade.UserAuthenticationFacade;
 import com.diagbot.vo.UserAuthenticationVO;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.Map;
 
 /**
  * <p>
@@ -43,9 +39,9 @@ public class UserAuthenticationController {
                     "organization:组织机构,必填<br>")
     @PostMapping("/userAuthentication")
     @SysLogger("userAuthentication")
-    public RespDTO<UserAuthenticationRespDTO> userAuthentication(@RequestBody @Valid UserAuthenticationVO userAuthenticationVO) {
-        UserAuthenticationRespDTO userAuthenticationRespDTO = userAuthenticationFacade.userAuthentication(userAuthenticationVO);
-        return RespDTO.onSuc(userAuthenticationRespDTO);
+    public RespDTO<UserAuthenticationDTO> userAuthentication(@RequestBody @Valid UserAuthenticationVO userAuthenticationVO) {
+        UserAuthenticationDTO userAuthenticationDTO = userAuthenticationFacade.userAuthentication(userAuthenticationVO);
+        return RespDTO.onSuc(userAuthenticationDTO);
     }
 
     @ApiOperation(value = "获取当前用户信息")

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

@@ -7,6 +7,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.factory.PasswordEncoderFactories;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -20,11 +22,17 @@ import com.diagbot.dto.ResultModelDTO;
 import com.diagbot.dto.UserInfoDTO;
 import com.diagbot.entity.Organization;
 import com.diagbot.entity.User;
+import com.diagbot.entity.UserAuthentication;
+import com.diagbot.entity.UserOrganization;
 import com.diagbot.facade.OrganizationFacade;
+import com.diagbot.facade.UserAuthenticationFacade;
 import com.diagbot.facade.UserFacade;
+import com.diagbot.facade.UserOrganizationFacade;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.GsonUtil;
 import com.diagbot.vo.OrganizationVO;
 import com.diagbot.vo.UserAndOrganizationVO;
+import com.diagbot.vo.UserInfoAuditVO;
 import com.diagbot.vo.UserInfoOrganizationsVO;
 
 import io.swagger.annotations.Api;
@@ -44,6 +52,10 @@ public class UserInfoController {
     private UserFacade userFacade;
 	@Autowired
 	OrganizationFacade organizationFacade;
+	@Autowired
+	UserOrganizationFacade userOrganizationFacade;
+	@Autowired
+	UserAuthenticationFacade userAuthenticationFacade;
 	
 	private final String MSG_SUCCESS = "操作成功!";
     private final String MSG_ERROR = "操作失败!";
@@ -69,15 +81,36 @@ public class UserInfoController {
 	        return RespDTO.onSuc("修改成功"+res);
 	    }
 	    
+	    @ApiOperation(value = "审核用户信息和机构信息", notes = "审核用户信息和机构信息")
+	    @PostMapping("/auditUserInfoAll")
+	    @SysLogger("auditUserInfoAll")
+	    public RespDTO<UserInfoAuditVO> auditUserInfoAll( UserInfoAuditVO userInfoAuditVO){
+	    	Map<String,Object> auditMap = new HashMap<String, Object>();
+	    	auditMap.put("userId", userInfoAuditVO.getUserId());
+	    	//TODO auditMap.put("modifier",UserUtils.getCurrentPrincipleID());
+	    	auditMap.put("modifier","5");
+	    	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 ==true){
+		    		return RespDTO.onSuc("审核通过!");
+		    	}
+		    	return RespDTO.onSuc("审核失败!");
+	    }
+	    
 	    @ApiOperation(value = "删除用户信息和机构信息", notes = "用户信息和机构信息")
 	    @PostMapping("/updateDeleted")
 	    @SysLogger("updateDeleted")
 	    public RespDTO updateDeleted(@RequestParam String  userId){
-	    	Map<String,String> map = new HashMap<String, String>();
+	    	Map<String,Object> map = new HashMap<String, Object>();
 	    	map.put("userId", userId);
 	    	//TODO map.put("modifier",UserUtils.getCurrentPrincipleID());
 	    	map.put("modifier","5");
-	    	map.put("gmtModified",DateUtil.DATE_TIME_FORMAT);
+	    	map.put("gmtModified",DateUtil.now());
 	    	 int res= userFacade.updateDeleted(map);
 	    	 return RespDTO.onSuc("刪除成功"+res);
 	    }
@@ -97,12 +130,10 @@ public class UserInfoController {
 	    @SysLogger("addOrganization")
 	    public RespDTO<OrganizationVO> addOrganization(OrganizationVO  organizationVO){
 	    	//TODO
-	    	ResultModelDTO resultMode = new ResultModelDTO();
 	    	String organizationName = organizationVO.getOrganizationName();
 	    	List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
 	    	if(organizationList.size()>0){
-	    		resultMode.setMessage("该机构存在");
-	    		return RespDTO.onSuc(resultMode);
+	    		return RespDTO.onSuc("该机构存在");
 	    	}
 	    	Organization organization = new Organization();
 	    	organization.setName(organizationVO.getOrganizationName());
@@ -114,10 +145,13 @@ public class UserInfoController {
 	    	//TODO organization.setModifier(UserUtils.getCurrentPrincipleID());
 	    	organization.setCreator("5");
 	    	
-	    	boolean op = organizationFacade.save(organization);
+	    	boolean res = organizationFacade.save(organization);
 	    	
-	    	resultMode.setMessage(op+"");
-	    	 return RespDTO.onSuc(resultMode);
+	    	//System.out.println(GsonUtil.toJson(organization));
+	    	if(res ==true){
+	    		return RespDTO.onSuc("增加机构信息成功!");
+	    	}
+	    	return RespDTO.onSuc("增加机构信息失败!");
 	    }
 	    
 	    @ApiOperation(value = "添加用户信息和机构信息管理员", notes = "用户信息和机构信息的绑定")
@@ -126,20 +160,73 @@ public class UserInfoController {
 	    public RespDTO<UserAndOrganizationVO> addUserInfo(UserAndOrganizationVO  userAndOrganizationVO){
 	    	//TODO 先查找机构,获取机构id,再注册用户,返回用户id, 取到用户id和 机构id ,查询用户机构关联表,在进行绑定
 	    	//User user = new User();
-	    	ResultModelDTO resultMode = new ResultModelDTO();
-	    	String username = userAndOrganizationVO.getUserName();
-	    	 User user=  userFacade.getUserInfo(username);
-	    	 System.out.println(user);
-	    	 if(user!=null){
-	    		 resultMode.setMessage("该用户存在");
-		         return RespDTO.onSuc(resultMode); 
+	    	//验证用户是否存在
+	    	 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("该机构绑定了用户!");
+	    	 }
 	    	 
-	    	 
-	    	 resultMode.setMessage("用户不存在"); 
-	    	 return RespDTO.onSuc(resultMode);
+	    	 User user =new User();
+	    	 user.setCreator("5");
+	    	 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("5");//创建人Id
+	    		 userAuthentication.setGmtCreate(DateUtil.now());//记录创建时间
+	    		 userAuthentication.setPosition(userAndOrganizationVO.getPosition());//岗位信息
+	    		 userAuthentication.setUserId(userId);//用户id
+	    		 userAuthentication.setIsReject("Y");//是否通过认证 N:未通过,Y:已通过
+	    		 userAuthentication.setStatus(1);//认证状态(0:未认证,1:已认证,2:认证中)
+	    		 userAuthenticationFacade.save(userAuthentication);
+	    		 
+	    		 //用户信息和机构信息的绑定
+	    		 UserOrganization userOrganization = new UserOrganization();
+	    		 userOrganization.setCreator("5");//创建人Id
+	    		 userOrganization.setGmtCreate(DateUtil.now());
+	    		 userOrganization.setOrganizationId(userAndOrganizationVO.getOrganizationid());//机构id
+	    		 userOrganization.setUserId(userId);//用户id
+	    		 
+	    		 userOrganizationFacade.save(userOrganization);
+	    	 }
+	         
+	    	 return RespDTO.onSuc("绑定成功");
 	    } 
+	    //TODO
+/*	    @ApiOperation(value = "根据用户id查询已开通的功能", notes = "已开通信息")
+	    @PostMapping("/addOrganization")
+	    @SysLogger("addOrganization")*/
+	    
+	  //TODO
+	   /* 
+	    @ApiOperation(value = "根据用户id和产品id,启用和停用功能", notes = "开通信息")
+	    @PostMapping("/addOrganization")
+	    @SysLogger("addOrganization")*/
+	    
+	  //TODO
+	   /* @ApiOperation(value = "根据用户id和产品id,启用和停用功能", notes = "开通信息")
+	    @PostMapping("/addOrganization")
+	    @SysLogger("addOrganization")*/
 	    
 	    
+
 }
+

+ 92 - 57
user-service/src/main/resources/mapper/UserMapper.xml

@@ -135,65 +135,66 @@
 	     ORDER BY  u.gmt_create DESC
 	</select>
 	
-	<update id="updateUserInfoAll" parameterType="com.diagbot.vo.UserInfoOrganizationsVO" >
-		UPDATE sys_user u ,sys_user_organization a ,
-		sys_organization b ,sys_user_authentication c
-		SET  u.remark = "0"
-		<if test="email != null">
-			<if test="gmtModified !=null">
-			  ,u.gmt_modified=#{gmtModified}
-		   </if>
-		   <if test="modifier != modifier">
-			  ,u.modifier=#{modifier}
-		   </if>
-		  ,u.email=#{email}
+<update id="updateUserInfoAll" parameterType="com.diagbot.vo.UserInfoOrganizationsVO" >
+	UPDATE sys_user u ,sys_user_organization a ,
+	sys_organization b ,sys_user_authentication c
+	SET  u.remark = "0" 
+	<if test="email != null">
+	    <if test="gmtModified !=null"> 
+	      ,u.gmt_modified=#{gmtModified}
+	   </if>
+	   <if test="modifier != modifier">
+	      ,u.modifier=#{modifier}
+	   </if>
+	  ,u.email=#{email}
+	</if>
+	<if test="principal != null || address != null || type != null">
+	     <if test="gmtModified !=null"> 
+	       ,b.gmt_modified=#{gmtModified}
+	     </if>
+	     <if test="modifier != null">
+	      ,b.modifier=#{modifier}
+	     </if>
+		<if test="principal != null">
+		  ,b.principal=#{principal}
 		</if>
-		<if test="principal != null || address != null || type != null">
-			 <if test="gmtModified !=null">
-			   ,b.gmt_modified=#{gmtModified}
-			 </if>
-			 <if test="modifier != null">
-			  ,b.modifier=#{modifier}
-			 </if>
-			<if test="principal != null">
-			  ,b.principal=#{principal}
-			</if>
-			<if test="address != null">
-			  ,b.address=#{address}
-			</if>
-			<if test="type != null">
-			  ,b.type=#{type}
-			</if>
+		<if test="address != null">
+		  ,b.address=#{address}
 		</if>
-
-		<if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null">
-			<if test="gmtModified !=null">
-			  ,c.gmt_modified=#{gmtModified}
-			</if>
-			<if test="modifier != null">
-			  ,c.modifier=#{modifier}
-			</if>
-			<if test="position != null">
-			  ,c.position=#{position}
-			</if>
-			<if test="isReject != null">
-			 ,c.is_reject=#{isReject}
-			</if>
-			<if test="rejectType !=null">
-			  ,c.reject_type=#{rejectType}
-			</if>
-			<if test="rejectComment !=null">
-			  ,c.reject_comment=#{rejectComment}
-			</if>
-			<if test="status != null">
-			  ,c.status = #{status}
-			</if>
+		<if test="type != null">
+		  ,b.type=#{type}
 		</if>
-		WHERE u.id = #{userId}
-		AND c.user_id= #{userId}
-		AND a.user_id = #{userId}
-		AND a.organization_id =b.id
-	</update>
+	</if>
+	
+	<!-- <if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null"> -->
+	   <if test="position != null">
+	    <if test="gmtModified !=null">
+		  ,c.gmt_modified=#{gmtModified}
+		</if>
+		<if test="modifier != null">
+		  ,c.modifier=#{modifier}
+		</if>
+		  ,c.position=#{position}
+		</if>
+		<!-- <if test="isReject != null">
+		 ,c.is_reject=#{isReject}
+		</if>
+		<if test="rejectType !=null">
+		  ,c.reject_type=#{rejectType}
+		</if>
+		<if test="rejectComment !=null">
+		  ,c.reject_comment=#{rejectComment}
+		</if>
+		<if test="status != null">
+		  ,c.status = #{status}
+		</if> -->
+	<!-- </if> -->
+	WHERE u.id = #{userId} 
+	AND c.user_id= #{userId} 
+	AND a.user_id = #{userId} 
+	AND a.organization_id =b.id
+</update>
+	
 
 	 <update id="updateDeleted" parameterType="java.util.Map">
 		UPDATE sys_user u ,sys_user_organization a ,
@@ -214,6 +215,40 @@
 		AND a.user_id = #{map.userId}
 		AND a.organization_id =b.id
 	</update>
-
+<update id="auditUserInfoAll" parameterType="java.util.Map">
+	UPDATE sys_user_authentication
+	<trim prefix="set" suffixOverrides=",">
+		<if test="auditMap.gmtModified !=null">gmt_modified=#{auditMap.gmtModified},</if>
+		<if test="auditMap.modifier != null">modifier=#{auditMap.modifier},</if>
+		<if test="auditMap.isReject != null">is_reject = #{auditMap.isReject} ,</if>
+		<if test="auditMap.rejectType != null">reject_type =#{auditMap.rejectType},</if>
+		<if test="auditMap.rejectComment != null">reject_comment= #{auditMap.rejectComment},</if>
+		<if test="auditMap.status != null">STATUS= #{auditMap.status}</if>
+	</trim>
+	WHERE
+	user_id = #{auditMap.userId}
+	AND is_deleted = "N"
+
+</update>
+
+ <update id="updateDeleted" parameterType="java.util.Map">
+	UPDATE sys_user u ,sys_user_organization a ,
+	 sys_organization b,sys_user_authentication c
+	SET u.is_deleted = "Y",a.is_deleted= "Y",b.is_deleted= "Y",c.is_deleted="Y"
+	<if test="map.gmtModified !=null">
+	,u.gmt_modified=#{map.gmtModified}
+	,b.gmt_modified=#{map.gmtModified}
+	,c.gmt_modified=#{map.gmtModified}
+	</if>
+	<if test="map.modifier != null">
+	,u.modifier=#{map.modifier}
+	,b.modifier=#{map.modifier}
+	,c.modifier=#{map.modifier}
+	</if>
+	WHERE u.id = #{map.userId} 
+	AND c.user_id= #{map.userId} 
+	AND a.user_id = #{map.userId} 
+	AND a.organization_id =b.id
+</update>
 
 </mapper>

+ 9 - 0
user-service/src/main/resources/mapper/UserOrganizationMapper.xml

@@ -14,4 +14,13 @@
         <result column="organization_id" property="organizationId" />
     </resultMap>
 
+	<select id="getAgencyPersonnel"  resultType="com.diagbot.entity.UserOrganization">
+		SELECT * FROM 
+		sys_user_organization 
+		WHERE 
+		is_deleted = "N" AND
+		organization_id = #{userORG.organizationId} 
+		AND user_id !=0
+	</select>
+
 </mapper>