|
|
@@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.platform.b2b.dao.EnterpriseDao;
|
|
|
+import com.uas.platform.b2b.dao.UserDao;
|
|
|
import com.uas.platform.b2b.model.Enterprise;
|
|
|
import com.uas.platform.b2b.model.QueriableMember;
|
|
|
import com.uas.platform.b2b.model.QueriableUser;
|
|
|
@@ -31,7 +33,9 @@ import com.uas.platform.b2b.service.AttachService;
|
|
|
import com.uas.platform.b2b.service.EnterpriseService;
|
|
|
import com.uas.platform.b2b.service.MonthProdioService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
+import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.util.StringUtil;
|
|
|
+import com.uas.platform.core.util.encry.Md5Utils;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
/**
|
|
|
@@ -58,6 +62,12 @@ public class PublicQueryController {
|
|
|
|
|
|
@Autowired
|
|
|
private AttachService attachService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserDao userDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private EnterpriseDao enterpriseDao;
|
|
|
|
|
|
/**
|
|
|
* 按企业名称、简称、UU号等查找企业信息
|
|
|
@@ -162,7 +172,7 @@ public class PublicQueryController {
|
|
|
@ResponseBody
|
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
|
public Map<String, Object> getUserEnterprise(String enName,
|
|
|
- String enBusinesscode, String emMobile, String emPassword)
|
|
|
+ String enBusinesscode, String emMobile, String emPassword, String emName)
|
|
|
throws UnsupportedEncodingException {
|
|
|
// ModelMap returnMap = new ModelMap();
|
|
|
Map<String, Object> infos = new HashMap<String, Object>();
|
|
|
@@ -178,7 +188,7 @@ public class PublicQueryController {
|
|
|
List<User> users = userService.findUsersByEnUU(os
|
|
|
.getUu());
|
|
|
for (User user : users) {
|
|
|
- if (user.getUserTel().equals(emMobile)) {
|
|
|
+ if (user.getUserTel()!=null&&user.getUserTel().equals(emMobile)) {
|
|
|
ok = true;
|
|
|
infos.put("enuu", os.getUu());
|
|
|
infos.put("emuu", user.getUserUU());
|
|
|
@@ -186,6 +196,29 @@ public class PublicQueryController {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ User user = null;
|
|
|
+ if(ok==false){
|
|
|
+ user = new User();
|
|
|
+ user.setUserName(emName);// 管理员姓名
|
|
|
+ user.setUserTel(emMobile);
|
|
|
+ user.setEnable(Constant.YES);
|
|
|
+ user.addEnterprise(os);// 添加userenterpris对应关系
|
|
|
+ User newUser = userDao.save(user);
|
|
|
+ newUser.setUserPwd(Md5Utils.encode(emPassword, newUser.getUserUU()));
|
|
|
+ userDao.save(newUser);
|
|
|
+ if(os.getEnAdminuu()!=null){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ os.setEnAdminuu(newUser.getUserUU());
|
|
|
+ os.setEnAdminPassword(emPassword);
|
|
|
+ os = enterpriseDao.save(os);// 再次保存enterprise
|
|
|
+ enterpriseDao.callInitProcedure(os.getUu());//设置对照关系
|
|
|
+ }
|
|
|
+ ok=true;
|
|
|
+ infos.put("enuu", os.getUu());
|
|
|
+ infos.put("emuu", newUser.getUserUU());
|
|
|
+ infos.put("enSecret", os.getAccessSecret());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (ok == false) {
|