Browse Source

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

zhaops 6 years ago
parent
commit
dfde9bb3aa
20 changed files with 382 additions and 116 deletions
  1. 41 0
      diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOpenedDTO.java
  2. 0 14
      diagbotman-service/src/main/java/com/diagbot/entity/LantoneProduct.java
  3. 22 0
      diagbotman-service/src/main/java/com/diagbot/entity/OpenedProducts.java
  4. 14 1
      diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java
  5. 2 2
      diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java
  6. 13 4
      diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java
  7. 12 0
      diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java
  8. 0 1
      diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml
  9. 16 0
      diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml
  10. 5 1
      user-service/src/main/java/com/diagbot/mapper/UserMapper.java
  11. 11 0
      user-service/src/main/java/com/diagbot/mapper/UserOrganizationMapper.java
  12. 2 0
      user-service/src/main/java/com/diagbot/service/UserOrganizationService.java
  13. 3 1
      user-service/src/main/java/com/diagbot/service/UserService.java
  14. 5 0
      user-service/src/main/java/com/diagbot/service/impl/UserOrganizationServiceImpl.java
  15. 6 2
      user-service/src/main/java/com/diagbot/service/impl/UserServiceImpl.java
  16. 24 0
      user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java
  17. 0 15
      user-service/src/main/java/com/diagbot/vo/UserInfoOrganizationsVO.java
  18. 105 18
      user-service/src/main/java/com/diagbot/web/UserInfoController.java
  19. 92 57
      user-service/src/main/resources/mapper/UserMapper.xml
  20. 9 0
      user-service/src/main/resources/mapper/UserOrganizationMapper.xml

+ 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;
+    
+
+}

+ 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 +
                 "}";
     }
 }

+ 14 - 1
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -1,8 +1,13 @@
 package com.diagbot.facade;
 
-import com.diagbot.service.impl.OpenedProductsServiceImpl;
+import java.util.List;
+
 import org.springframework.stereotype.Component;
 
+import com.diagbot.dto.GetConsoleOpenedDTO;
+import com.diagbot.service.impl.OpenedProductsServiceImpl;
+import com.diagbot.util.UserUtils;
+
 /**
  * @Description:已开通产品业务层
  * @author: zhaops
@@ -10,4 +15,12 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class OpenedProductsFacade extends OpenedProductsServiceImpl {
+	
+	
+    public List<GetConsoleOpenedDTO> getConsoleOpened(){
+    	Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        return baseMapper.getConsoleOpened(userId);
+    }
+	
+	
 }

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

@@ -98,7 +98,7 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         serviceToken.setAppKeyId(GuidUtil.App_key());
         serviceToken.setAppKeySecret(GuidUtil.App_screct());
         serviceToken.setStatus(1);
-        if (old_serviceToken != null && old_serviceToken.getType().equals(TokenTypeEnum.Trial)) {
+        if (old_serviceToken != null && old_serviceToken.getType().equals(TokenTypeEnum.Trial.getKey())) {
             //如果试用已过期,不允许再生成
             if (calendar.after(old_serviceToken.getExpiringDate())) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -106,7 +106,7 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
             }
             serviceToken.setStartingDate(old_serviceToken.getStartingDate());
             serviceToken.setExpiringDate(old_serviceToken.getExpiringDate());
-        } else if (productServiceSaveVO.getType().equals(TokenTypeEnum.Trial)) {
+        } else if (productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
             serviceToken.setStartingDate(new Date());
             calendar.clear();
             calendar.setTime(new Date());

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

@@ -1,13 +1,15 @@
 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.GetConsoleOpenedDTO;
 import com.diagbot.entity.OpenedProducts;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -31,4 +33,11 @@ public interface OpenedProductsMapper extends BaseMapper<OpenedProducts> {
      * @return
      */
     List<OpenedProducts> selectOpenedProducts(Map<String,Object>map);
+    
+    /**
+     * 控制台已开通产品查询
+     * @param userId
+     * @return
+     */
+    List<GetConsoleOpenedDTO> getConsoleOpened(Long userId);
 }

+ 12 - 0
diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

@@ -8,8 +8,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.diagbot.annotation.SysLogger;
+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;
@@ -27,6 +29,8 @@ public class ProductOrderController {
 
 	@Autowired
 	private ProductOrderFacade productOrderFacade;
+	@Autowired
+	private OpenedProductsFacade openedProductsFacade;
 
 	@ApiOperation(value = "控制台-产品认证进度",notes="控制台-产品认证进度")
 	@PostMapping("/productAuthProgress")
@@ -34,5 +38,13 @@ public class ProductOrderController {
 	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());
+	}
+	
 
 }

+ 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}
@@ -30,4 +32,18 @@
         and t.product_id=#{productId}
         </if>
     </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>

+ 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 + "]";
-	}
-	  
-	  
-
 }

+ 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>