Browse Source

人才招聘功能编写

hejq 8 years ago
parent
commit
4b755c58f9

+ 124 - 0
src/main/java/com/uas/platform/home/controller/UuzcController.java

@@ -0,0 +1,124 @@
+package com.uas.platform.home.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.uas.account.entity.User;
+import com.uas.account.entity.UserSpaceDetail;
+import com.uas.account.entity.UserView;
+import com.uas.account.util.AccountUtils;
+import com.uas.platform.home.core.support.SystemSession;
+import com.uas.platform.home.model.ResultInfo;
+import com.uas.platform.home.model.UuzcUserInfo;
+import com.uas.platform.home.web.BaseController;
+import com.uas.sso.common.util.HttpUtil;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 关于优软众创的一些接口
+ *
+ * Created by hejq on 2017-11-02.
+ */
+@RestController
+@RequestMapping(value = "/uuzc")
+public class UuzcController extends BaseController {
+
+    /**
+     * 对当前登录账号进行检验
+     *
+     * @return
+     */
+    @RequestMapping(value = "/account/check", method = RequestMethod.GET)
+    public ModelMap checkAccount() throws Exception {
+        UserView user = SystemSession.getUser();
+        ModelMap map = new ModelMap();
+        //先判断个人账户类型
+        String personalUrl = "http://job.uutest.com/index.php?m=&c=ubtob&a=check_user&uc_uid=" + user.getDialectUID();
+        HttpUtil.ResponseWrap responseWrap =  HttpUtil.doGet(personalUrl);
+        ResultInfo userInfo = JSONObject.parseObject(responseWrap.getContent(), ResultInfo.class);
+        if(null != userInfo.getData()) {
+            if(userInfo.getData().getCode().equals("2")) {//个人用户
+                UuzcUserInfo info = getUserInfo(user, false);
+                JSONObject formData = JSON.parseObject(JSON.toJSONString(info));
+                map.put("user", formData);
+                map.put("usertype", "personal");
+                return  map;
+            } else if(userInfo.getData().getCode().equals("1")) {// 企业用户
+                UuzcUserInfo info = getUserInfo(user, true);
+                JSONObject formData = JSON.parseObject(JSON.toJSONString(info));
+                //判断是否设置了hr
+                String result = AccountUtils.getHrAccount(info.getLicense());
+                ResultInfo resInfo = JSONObject.parseObject(result, ResultInfo.class);
+                map.put("hr", resInfo.getExistHr() ? true : false);
+                if(user.getName().equals(user.getUserSpaceDetail().getAdminName())) {
+                    map.put("manager", true);
+                }
+                map.put("user", info);
+                map.put("usertype", "company");
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 将账户中心信息转成众创需要的信息
+     *
+     * @param user
+     * @param company
+     * @return
+     */
+    private UuzcUserInfo getUserInfo(UserView user, boolean company) {
+        UuzcUserInfo info = new UuzcUserInfo();
+        info.setEmail(user.getSecondUID());
+        info.setMobile(user.getUid());
+        info.setUc_uid(user.getDialectUID());
+        info.setPassword(user.getPassword());
+        info.setSalt(user.getSalt());
+        info.setUsername(user.getName());
+        if(null != user.getUserSpaceDetail() && company) {
+            info.setCompanyname(user.getSpaceName());
+            info.setLicense(user.getSpaceUID());
+            info.setContact(user.getUserSpaceDetail().getContactMan());
+            info.setWebsite(user.getUserSpaceDetail().getUrl());
+            info.setTelephone(user.getUserSpaceDetail().getTel());
+            info.setLandine_tel(user.getUserSpaceDetail().getContactTel());
+        }
+        return  info;
+    }
+
+    /**
+     * 设置hr账号
+     *
+     * @param user
+     * @return
+     */
+    @RequestMapping(value = "/setHrAccount", method = RequestMethod.POST)
+    public ModelMap setHrAccount(UuzcUserInfo user) throws Exception {
+        UserSpaceDetail detail = SystemSession.getUser().getUserSpaceDetail();
+        User userInfo = new User();
+        userInfo.setHr((short) 1);
+        userInfo.setName(user.getUsername());
+        userInfo.setUid(user.getMobile());
+        userInfo.setSecondUID(user.getEmail());
+        String result = AccountUtils.setHrAccount(userInfo, detail);
+        ResultInfo resInfo = JSONObject.parseObject(result, ResultInfo.class);
+        return new ModelMap("result", resInfo.getMsg());
+    }
+
+    /**
+     * 获取当前企业的用户信息
+     *
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "/existusers", method = RequestMethod.GET)
+    public ModelMap getExistUsers() throws Exception {
+        List<User> users = AccountUtils.getEmployees(SystemSession.getUser().getUserSpaceDetail().getBusinessCode());
+        return success(users);
+    }
+
+}

+ 74 - 0
src/main/java/com/uas/platform/home/model/ResultData.java

@@ -0,0 +1,74 @@
+package com.uas.platform.home.model;
+
+/**
+ * 众创接口请求返回结果
+ *
+ * Created by hejq on 2017-11-02.
+ */
+public class ResultData {
+
+    /**
+     * 众创uid
+     */
+    private String uid;
+
+    /**
+     * 企业名称
+     */
+    private String companyname;
+
+    /**
+     * 电话
+     */
+    private String mobile;
+
+    /**
+     * 优软云维一编号
+     */
+    private String uc_uid;
+
+    /**
+     * 编号
+     */
+    private String code;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getCompanyname() {
+        return companyname;
+    }
+
+    public void setCompanyname(String companyname) {
+        this.companyname = companyname;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getUc_uid() {
+        return uc_uid;
+    }
+
+    public void setUc_uid(String uc_uid) {
+        this.uc_uid = uc_uid;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+}

+ 86 - 0
src/main/java/com/uas/platform/home/model/ResultInfo.java

@@ -0,0 +1,86 @@
+package com.uas.platform.home.model;
+
+/**
+ * 众创接口请求返回结果
+ *
+ * Created by hejq on 2017-11-02.
+ */
+public class ResultInfo {
+    /**
+     * 状态码
+     */
+    private Short status;
+
+    /**
+     * 消息
+     */
+    private String msg;
+
+    /**
+     * 提示
+     */
+    private String dialog;
+
+    /**
+     * 返回data数据
+     */
+    private ResultData data;
+
+    /**
+     * 是否存在hr账户
+     */
+    private boolean existHr;
+
+    /**
+     * hr数量
+     */
+    private Integer count;
+
+    public Short getStatus() {
+        return status;
+    }
+
+    public void setStatus(Short status) {
+        this.status = status;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public String getDialog() {
+        return dialog;
+    }
+
+    public void setDialog(String dialog) {
+        this.dialog = dialog;
+    }
+
+    public ResultData getData() {
+        return data;
+    }
+
+    public void setData(ResultData data) {
+        this.data = data;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+    public boolean getExistHr() {
+        return this.count > 0 ? true : false;
+    }
+
+    public void setExistHr(boolean existHr) {
+        this.existHr = existHr;
+    }
+}

+ 83 - 0
src/main/java/com/uas/platform/home/model/UserSpaceDetailInfo.java

@@ -0,0 +1,83 @@
+package com.uas.platform.home.model;
+
+public class UserSpaceDetailInfo {
+
+	/**
+	 * 企业名称
+	 */
+	private String company;
+
+	/**
+	 * 地址
+	 */
+	private String address;
+
+	/**
+	 * 管理员姓名
+	 */
+	private String username;
+
+	/**
+	 * 管理员电话
+	 */
+	private String usertel;
+
+	/**
+	 * 管理员imid
+	 */
+	private String imid;
+
+	/**
+	 * 管理员邮箱
+	 */
+	private String email;
+
+	public String getCompany() {
+		return company;
+	}
+
+	public void setCompany(String company) {
+		this.company = company;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getUsertel() {
+		return usertel;
+	}
+
+	public void setUsertel(String usertel) {
+		this.usertel = usertel;
+	}
+
+	public String getImid() {
+		return imid;
+	}
+
+	public void setImid(String imid) {
+		this.imid = imid;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+}

+ 191 - 0
src/main/java/com/uas/platform/home/model/UuzcUserInfo.java

@@ -0,0 +1,191 @@
+package com.uas.platform.home.model;
+
+/**
+ * 众创传输数据需要的参数
+ *
+ * Created by hejq on 2017-11-02.
+ */
+public class UuzcUserInfo {
+
+    /**
+     * 用户名
+     */
+    private String username;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 邮箱
+     */
+    private String email;
+
+    /**
+     * 电话
+     */
+    private String mobile;
+
+    /**
+     * 优软云uid
+     */
+    private String uc_uid;
+
+    /**
+     * 盐值
+     */
+    private String salt;
+
+    /**
+     * 公司名称(企业需要)
+     */
+    private String companyname;
+
+    /**
+     * 公司联系人(企业需要)
+     */
+    private String contact;
+
+    /**
+     * 手机(企业需要)
+     */
+    private String telephone;
+
+    /**
+     * 公司400电话(企业需要)
+     */
+    private String landine_tel;
+
+    /**
+     * 营业执照号(企业需要)
+     */
+    private String license;
+
+    /**
+     * 注册资金(企业需要)
+     */
+    private Double registered;
+
+    /**
+     * 资金单位(企业需要)
+     */
+    private String currency;
+
+    /**
+     * 公司网址(企业需要)
+     */
+    private String website;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getUc_uid() {
+        return uc_uid;
+    }
+
+    public void setUc_uid(String uc_uid) {
+        this.uc_uid = uc_uid;
+    }
+
+    public String getSalt() {
+        return salt;
+    }
+
+    public void setSalt(String salt) {
+        this.salt = salt;
+    }
+
+    public String getCompanyname() {
+        return companyname;
+    }
+
+    public void setCompanyname(String companyname) {
+        this.companyname = companyname;
+    }
+
+    public String getContact() {
+        return contact;
+    }
+
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public String getLandine_tel() {
+        return landine_tel;
+    }
+
+    public void setLandine_tel(String landine_tel) {
+        this.landine_tel = landine_tel;
+    }
+
+    public String getLicense() {
+        return license;
+    }
+
+    public void setLicense(String license) {
+        this.license = license;
+    }
+
+    public Double getRegistered() {
+        return registered;
+    }
+
+    public void setRegistered(Double registered) {
+        this.registered = registered;
+    }
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public String getWebsite() {
+        return website;
+    }
+
+    public void setWebsite(String website) {
+        this.website = website;
+    }
+}