Antiloveg 8 years ago
parent
commit
dd6d278fbf

+ 6 - 10
src/main/java/com/goafanti/common/dao/OrganizationPropertiesMapper.java

@@ -3,21 +3,17 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.OrganizationProperties;
 
 public interface OrganizationPropertiesMapper {
-    int deleteByPrimaryKey(String id);
+	int deleteByPrimaryKey(String id);
 
-    int insert(OrganizationProperties record);
+	int insert(OrganizationProperties record);
 
-    int insertSelective(OrganizationProperties record);
+	int insertSelective(OrganizationProperties record);
 
-    OrganizationProperties selectByPrimaryKey(String id);
+	OrganizationProperties selectByPrimaryKey(String id);
 
-    int updateByPrimaryKeySelective(OrganizationProperties record);
+	int updateByPrimaryKeySelective(OrganizationProperties record);
 
-    int updateByPrimaryKey(OrganizationProperties record);
-    
-    
-    //根据组织id查询
-   // OrganizationProperties selectByOid(String oid);
+	int updateByPrimaryKey(OrganizationProperties record);
 
 	OrganizationProperties selectOrgProByUserId(String uid);
 

+ 6 - 0
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -425,6 +425,12 @@ public class UserApiController extends BaseApiController {
 					OrgProFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
+		
+		
+		if (StringUtils.isBlank(pro.getCompanyName())){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到单位名称", "单位名称"));
+			return res;
+		}
 
 		OrganizationInfo oi = new OrganizationInfo();
 		OrganizationProperties op = new OrganizationProperties();

+ 10 - 0
src/main/java/com/goafanti/user/service/impl/OrganizationInfoServiceImpl.java

@@ -8,8 +8,10 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.common.dao.OrganizationInfoMapper;
 import com.goafanti.common.dao.OrganizationPropertiesMapper;
+import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.model.OrganizationInfo;
 import com.goafanti.common.model.OrganizationProperties;
+import com.goafanti.common.model.User;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.user.service.OrganizationInfoService;
 
@@ -19,6 +21,8 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
 	OrganizationInfoMapper			organizationInfoMapper;
 	@Autowired
 	OrganizationPropertiesMapper	organizationPropertiesMapper;
+	@Autowired
+	UserMapper						userMapper;
 
 	@Override
 	public OrganizationInfo selectOrgInfoByUserId(String uid) {
@@ -55,6 +59,12 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
 		} else if (null != oo && StringUtils.isNotBlank(op.getId())) {
 			organizationPropertiesMapper.updateByPrimaryKeySelective(op);
 		}
+		
+		if (StringUtils.isNotBlank(oi.getCompanyName())){
+			User u = userMapper.selectByPrimaryKey(oi.getUid());
+			u.setNickname(oi.getCompanyName());
+			userMapper.updateByPrimaryKeySelective(u);
+		}
 		return 1;
 	}