Browse Source

代码同步

shuzhan 2 năm trước cách đây
mục cha
commit
a77cde816f
15 tập tin đã thay đổi với 682 bổ sung10 xóa
  1. 1 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/RecruitPersonRelationDAO.java
  2. 2 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/RecruitPersonRelationService.java
  3. 5 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/RecruitPersonRelationServiceImpl.java
  4. 23 0
      common/src/main/java/com/jpsoft/employment/modules/common/utils/WeixinUtil.java
  5. 1 0
      common/src/main/java/com/jpsoft/employment/modules/sys/dao/DataDictionaryDAO.java
  6. 2 0
      common/src/main/java/com/jpsoft/employment/modules/sys/service/DataDictionaryService.java
  7. 5 0
      common/src/main/java/com/jpsoft/employment/modules/sys/service/impl/DataDictionaryServiceImpl.java
  8. 13 3
      common/src/main/resources/mapper/base/RecruitPersonRelation.xml
  9. 12 0
      common/src/main/resources/mapper/sys/DataDictionary.xml
  10. 6 1
      web/src/main/java/com/jpsoft/employment/config/WebMvcConfig.java
  11. 26 2
      web/src/main/java/com/jpsoft/employment/modules/mobile/controller/DataDictionaryApiController.java
  12. 211 0
      web/src/main/java/com/jpsoft/employment/modules/mobile/controller/JobApiController.java
  13. 219 0
      web/src/main/java/com/jpsoft/employment/modules/mobile/controller/RecruitApiController.java
  14. 135 4
      web/src/main/java/com/jpsoft/employment/modules/mobile/controller/UserApiController.java
  15. 21 0
      web/src/main/java/com/jpsoft/employment/modules/wechat/controller/WxController.java

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/RecruitPersonRelationDAO.java

@@ -15,4 +15,5 @@ public interface RecruitPersonRelationDAO {
 	int delete(String id);
 	List<RecruitPersonRelation> list();
 	List<RecruitPersonRelation> search(Map<String, Object> searchParams, List<Sort> sortList);
+	RecruitPersonRelation findByRecruitIdAndPersonId(String recruitId,String personId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/RecruitPersonRelationService.java

@@ -14,4 +14,6 @@ public interface RecruitPersonRelationService {
 	int delete(String id);
 	List<RecruitPersonRelation> list();
 	Page<RecruitPersonRelation> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+
+	RecruitPersonRelation findByRecruitIdAndPersonId(String recruitId,String personId);
 }

+ 5 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/RecruitPersonRelationServiceImpl.java

@@ -67,4 +67,9 @@ public class RecruitPersonRelationServiceImpl implements RecruitPersonRelationSe
         
         return page;
 	}
+
+	@Override
+	public RecruitPersonRelation findByRecruitIdAndPersonId(String recruitId,String personId){
+		return recruitPersonRelationDAO.findByRecruitIdAndPersonId(recruitId,personId);
+	}
 }

+ 23 - 0
common/src/main/java/com/jpsoft/employment/modules/common/utils/WeixinUtil.java

@@ -449,6 +449,29 @@ public class WeixinUtil {
 		return result;
 	}
 
+	//通过code获取手机号
+	public static String getuserphonenumberUrl = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN";
+	public static String getUserPhoneNumber(String accessToken, String code) throws Exception {
+		String url = getuserphonenumberUrl.replace("ACCESS_TOKEN", accessToken);
+		String phone = "";
+
+		JSONObject requestBody = new JSONObject();
+		requestBody.put("code", code);
+
+		JSONObject jsonObject = HttpConnectionUtil.httpRequest(url, "POST", requestBody.toString());
+		if (!jsonObject.isNullObject() && !jsonObject.isEmpty()) {
+			try {
+				JSONObject personObject = jsonObject.getJSONObject("phone_info");
+				phone = personObject.getString("purePhoneNumber");
+			} catch (Exception e) {
+				// 获取token失败
+				log.error("获取失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
+				e.printStackTrace();
+			}
+		}
+		return phone;
+	}
+
 	public static void main(String[] args) {
 		JSONObject sendData = JSONObject.fromObject("{\"first\":{\"value\":\"尊敬的用户,本次充电已结束!\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"地下停车场充电桩\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"2022-03-08 17:37:50至2022-03-08 17:44:41\",\"color\":\"#173177\"},\"keyword3\":{\"value\":\"6分钟\"},\"keyword4\":{\"value\":\"0.25元(账户余额:98.5元)\"}}");
 

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/sys/dao/DataDictionaryDAO.java

@@ -26,4 +26,5 @@ public interface DataDictionaryDAO {
 
 	String findNameByCatalogNameAndValue(String catalogName, String value);
 	String findValueByCatalogNameAndName(String catalogName, String name);
+	String findValueByName(String name);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/sys/service/DataDictionaryService.java

@@ -24,4 +24,6 @@ public interface DataDictionaryService {
 	String findNameByCatalogNameAndValue(String catalogName, String value);
 	String findValueByCatalogNameAndName(String catalogName, String name);
     Map<String, DataDictionary> findMapByCatalogName(String catalogName);
+
+	String findValueByName(String name);
 }

+ 5 - 0
common/src/main/java/com/jpsoft/employment/modules/sys/service/impl/DataDictionaryServiceImpl.java

@@ -119,4 +119,9 @@ public class DataDictionaryServiceImpl implements DataDictionaryService {
 
 		return ddMap;
 	}
+
+	@Override
+	public String findValueByName(String name){
+		return dataDictionaryDAO.findValueByName(name);
+	}
 }

+ 13 - 3
common/src/main/resources/mapper/base/RecruitPersonRelation.xml

@@ -66,14 +66,13 @@
 	where id_=#{id}
 	</update>
 	<select id="get" parameterType="string" resultMap="RecruitPersonRelationMap">
-		select
-id_,work_person_id,recruit_information_id,create_by,create_time,update_by,update_time,del_flag		from base_recruit_person_relation where id_=#{0}
+		select* from base_recruit_person_relation where id_=#{0}
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_recruit_person_relation where id_=#{0}
 	</select>
 	<select id="list" resultMap="RecruitPersonRelationMap">
-		select * from base_recruit_person_relation
+		select * from base_recruit_person_relation where del_flag = 0
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="RecruitPersonRelationMap">
 		<![CDATA[
@@ -96,4 +95,15 @@ id_,work_person_id,recruit_information_id,create_by,create_time,update_by,update
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="findByRecruitIdAndPersonId" resultMap="RecruitPersonRelationMap">
+		SELECT
+		*
+		FROM
+		base_recruit_person_relation
+		WHERE
+		del_flag = 0
+		AND work_person_id = #{personId}
+		AND recruit_information_id = #{recruitId}
+		LIMIT 1
+	</select>
 </mapper>

+ 12 - 0
common/src/main/resources/mapper/sys/DataDictionary.xml

@@ -183,4 +183,16 @@
         order by a.sort_no asc
         limit 1
     </select>
+    <select id="findValueByName" parameterType="map" resultType="string">
+        SELECT
+        value_
+        FROM
+        sys_data_dictionary
+        WHERE
+        name_ = #{name}
+        AND del_flag = 0
+        ORDER BY
+        sort_no ASC
+        LIMIT 1
+    </select>
 </mapper>

+ 6 - 1
web/src/main/java/com/jpsoft/employment/config/WebMvcConfig.java

@@ -58,9 +58,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/user/wechatLogin")
 				.excludePathPatterns("/mobile/user/validateCode")
 				.excludePathPatterns("/mobile/user/getVerifyCode")
-				.excludePathPatterns("/mobile/recruit/**")
+				.excludePathPatterns("/mobile/user/createUser")
+				.excludePathPatterns("/mobile/recruit/findRecruitHomePage")
+				.excludePathPatterns("/mobile/recruit/findRecruitSearch")
+				.excludePathPatterns("/mobile/recruit/findJobList")
+				.excludePathPatterns("/mobile/recruit/recruitDetail")
 				.excludePathPatterns("/mobile/news/**")
 				.excludePathPatterns("/mobile/dictionary/**")
+				.excludePathPatterns("/mobile/job/jobDetail")
 		;
 
 

+ 26 - 2
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/DataDictionaryApiController.java

@@ -43,9 +43,9 @@ public class DataDictionaryApiController {
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
-    @PostMapping("findByName")
+    @PostMapping("findListByCatalogName")
     @ApiOperation(value = " 根据字典名称查询字典(公开接口)")
-    public MessageResult<Map> findByName(String name) {
+    public MessageResult<Map> findListByCatalogName(String name) {
         MessageResult<Map> msgResult = new MessageResult<>();
 
         try {
@@ -69,4 +69,28 @@ public class DataDictionaryApiController {
 
         return msgResult;
     }
+
+    @PostMapping("findValueByName")
+    @ApiOperation(value = " 根据名称查内容")
+    public MessageResult<String> findValueByName(String name) {
+        MessageResult<String> msgResult = new MessageResult<>();
+
+        try {
+            String value = dataDictionaryService.findValueByName(name);
+
+            msgResult.setData(value);
+            msgResult.setResult(true);
+        } catch (Exception ex) {
+            if (ex instanceof CustomException) {
+                log.error(ex.getMessage());
+            } else {
+                log.error(ex.getMessage(), ex);
+            }
+
+            msgResult.setMessage(ex.getMessage());
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
 }

+ 211 - 0
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/JobApiController.java

@@ -0,0 +1,211 @@
+package com.jpsoft.employment.modules.mobile.controller;
+
+import com.alipay.api.domain.Person;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.*;
+import com.jpsoft.employment.modules.base.service.*;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+@Slf4j
+@RestController
+@RequestMapping("/mobile/job")
+@Api(description = "求职功能")
+public class JobApiController {
+    @Value("${jwt.secret}")
+    private String jwtSecret;
+
+    @Autowired
+    RabbitTemplate rabbitTemplate;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+    @Autowired
+    private ValueOperations<String, Object> valueOperations;
+    @Autowired
+    private PersonInfoService personInfoService;
+    @Autowired
+    private RecruitInformationInfoService recruitInformationInfoService;
+    @Autowired
+    private JobInformationInfoService jobInformationInfoService;
+    @Autowired
+    private EnterpriseInfoService enterpriseInfoService;
+    @Autowired
+    private ShareWorksInfoService shareWorksInfoService;
+    @Autowired
+    private RecruitPersonRelationService recruitPersonRelationService;
+
+    @ApiOperation(value="发布求职信息")
+    @RequestMapping(value = "createJobHunt",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "简历ID(传为修改", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "intendedIndustries", value = "意向行业", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "intendedPosition", value = "意向岗位", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "hopeSalary", value = "期望薪资(元/天", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "method", value = "结算方式", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "workExperience", value = "工作经验", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "education", value = "学历", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "serviceDesc", value = "服务描述", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "photo", value = "头像", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> createJobHunt(
+            @RequestParam(value="id",defaultValue="") String id,
+            @RequestParam(value="intendedIndustries",defaultValue="") String intendedIndustries,
+            @RequestParam(value="intendedPosition",defaultValue="") String intendedPosition,
+            @RequestParam(value="hopeSalary",defaultValue="") Integer hopeSalary,
+            @RequestParam(value="method",defaultValue="") String method,
+            @RequestParam(value="workExperience",defaultValue="") String workExperience,
+            @RequestParam(value="education",defaultValue="") String education,
+            @RequestParam(value="serviceDesc",defaultValue="") String serviceDesc,
+            @RequestParam(value="photo",defaultValue="") String photo,
+            @RequestAttribute String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("未登录");
+            }
+
+            if (StringUtils.isNotEmpty(id)) {
+                JobInformationInfo jobInformationInfo = jobInformationInfoService.get(id);
+                jobInformationInfo.setUpdateBy(subject);
+                jobInformationInfo.setUpdateTime(new Date());
+                jobInformationInfo.setStatus("0");
+
+                jobInformationInfo.setPersonId(subject);
+                jobInformationInfo.setIntendedIndustries(intendedIndustries);
+                jobInformationInfo.setIntendedPosition(intendedPosition);
+                jobInformationInfo.setHopeSalary(hopeSalary);
+                jobInformationInfo.setMethod(method);
+                jobInformationInfo.setWorkExperience(workExperience);
+                jobInformationInfo.setEducation(education);
+                jobInformationInfo.setServiceDesc(serviceDesc);
+                jobInformationInfo.setPhoto(photo);
+
+                jobInformationInfoService.update(jobInformationInfo);
+            } else {
+                JobInformationInfo jobInformationInfo = new JobInformationInfo();
+                jobInformationInfo.setId(UUID.randomUUID().toString());
+                jobInformationInfo.setDelFlag(false);
+                jobInformationInfo.setCreateBy(subject);
+                jobInformationInfo.setCreateTime(new Date());
+                jobInformationInfo.setStatus("0");
+
+                jobInformationInfo.setPersonId(subject);
+                jobInformationInfo.setIntendedIndustries(intendedIndustries);
+                jobInformationInfo.setIntendedPosition(intendedPosition);
+                jobInformationInfo.setHopeSalary(hopeSalary);
+                jobInformationInfo.setMethod(method);
+                jobInformationInfo.setWorkExperience(workExperience);
+                jobInformationInfo.setEducation(education);
+                jobInformationInfo.setServiceDesc(serviceDesc);
+                jobInformationInfo.setPhoto(photo);
+
+                jobInformationInfoService.insert(jobInformationInfo);
+            }
+
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="jobHuntDetail")
+    @RequestMapping(value = "求职信息详细(免登陆",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "简历ID", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> jobDetail(
+            @RequestParam(value="id",defaultValue="") String id){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+            Map<String,Object> returnMap = new HashMap<>();
+            JobInformationInfo jobInformationInfo = jobInformationInfoService.get(id);
+            PersonInfo personInfo = null;
+            if(jobInformationInfo != null) {
+                personInfo = personInfoService.get(jobInformationInfo.getPersonId());
+            }
+
+            returnMap.put("jobInformationInfo",jobInformationInfo);
+            returnMap.put("personInfo",personInfo);
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="joinRecruit")
+    @RequestMapping(value = "我要报名(求职者报岗位",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "recruitId", value = "岗位ID", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> joinRecruit(
+            @RequestParam(value="recruitId",defaultValue="") String recruitId,
+            @RequestAttribute String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("未登录");
+            }
+
+            RecruitInformationInfo recruitInformationInfo = recruitInformationInfoService.get(recruitId);
+            if(recruitInformationInfo == null){
+                throw new Exception("未找到信息");
+            }
+
+            RecruitPersonRelation recruitPersonRelation = recruitPersonRelationService.findByRecruitIdAndPersonId(recruitId,personInfo.getId());
+            if(recruitPersonRelation == null){
+                recruitPersonRelation = new RecruitPersonRelation();
+                recruitPersonRelation.setId(UUID.randomUUID().toString());
+                recruitPersonRelation.setDelFlag(false);
+                recruitPersonRelation.setCreateBy(subject);
+                recruitPersonRelation.setCreateTime(new Date());
+                recruitPersonRelation.setRecruitInformationId(recruitId);
+                recruitPersonRelation.setWorkPersonId(subject);
+
+                recruitPersonRelationService.insert(recruitPersonRelation);
+            }
+
+
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
+
+}

+ 219 - 0
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/RecruitApiController.java

@@ -12,6 +12,7 @@ import com.jpsoft.employment.modules.common.utils.JwtUtil;
 import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import com.jpsoft.employment.modules.common.utils.SMSUtil;
 import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -26,6 +27,7 @@ import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -50,6 +52,12 @@ public class RecruitApiController {
     private RecruitInformationInfoService recruitInformationInfoService;
     @Autowired
     private JobInformationInfoService jobInformationInfoService;
+    @Autowired
+    private EnterpriseInfoService enterpriseInfoService;
+    @Autowired
+    private ShareWorksInfoService shareWorksInfoService;
+    @Autowired
+    private RecruitPersonRelationService recruitPersonRelationService;
 
     @PostMapping("findRecruitHomePage")
     @ApiOperation(value = " 首页查询全部(公开接口)")
@@ -244,4 +252,215 @@ public class RecruitApiController {
 
         return messageResult;
     }
+
+    @ApiOperation(value="createRecruit")
+    @RequestMapping(value = "发布招聘信息",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "ID(传为修改", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "positionName", value = "职位名称", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "salary", value = "薪资待遇", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "settlementMethod", value = "结算方式", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "industry", value = "行业", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "recruitingNumbers", value = "招聘人数", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "desc", value = "工作描述", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "contacts", value = "联系人", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "contactsPhone", value = "联系电话", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "workArea", value = "工作地区", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "address", value = "详细地址", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> createRecruit(
+            @RequestParam(value="id",defaultValue="") String id,
+            @RequestParam(value="positionName",defaultValue="") String positionName,
+            @RequestParam(value="salary",defaultValue="") String salary,
+            @RequestParam(value="settlementMethod",defaultValue="") String settlementMethod,
+            @RequestParam(value="industry",defaultValue="") String industry,
+            @RequestParam(value="recruitingNumbers",defaultValue="") String recruitingNumbers,
+            @RequestParam(value="desc",defaultValue="") String desc,
+            @RequestParam(value="contacts",defaultValue="") String contacts,
+            @RequestParam(value="contactsPhone",defaultValue="") String contactsPhone,
+            @RequestParam(value="workArea",defaultValue="") String workArea,
+            @RequestParam(value="address",defaultValue="") String address,
+            @RequestAttribute String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("未登录");
+            }
+
+            if(StringUtils.isEmpty(personInfo.getEnterpriseId())){
+                throw new Exception("未绑定企业");
+            }
+
+            if (StringUtils.isNotEmpty(id)) {
+                RecruitInformationInfo recruitInformationInfo = recruitInformationInfoService.get(id);
+                recruitInformationInfo.setUpdateBy(subject);
+                recruitInformationInfo.setUpdateTime(new Date());
+                recruitInformationInfo.setStatus("0");
+                recruitInformationInfo.setEnterpriseId(personInfo.getEnterpriseId());
+
+                recruitInformationInfo.setPositionName(positionName);
+                recruitInformationInfo.setSalary(salary);
+                recruitInformationInfo.setSettlementMethod(settlementMethod);
+                recruitInformationInfo.setIndustry(industry);
+                recruitInformationInfo.setRecruitingNumbers(recruitingNumbers);
+                recruitInformationInfo.setDesc(desc);
+                recruitInformationInfo.setContacts(contacts);
+                recruitInformationInfo.setContactsPhone(contactsPhone);
+                recruitInformationInfo.setWorkArea(workArea);
+                recruitInformationInfo.setAddress(address);
+
+                recruitInformationInfoService.update(recruitInformationInfo);
+            } else {
+                RecruitInformationInfo recruitInformationInfo = new RecruitInformationInfo();
+                recruitInformationInfo.setId(UUID.randomUUID().toString());
+                recruitInformationInfo.setDelFlag(false);
+                recruitInformationInfo.setCreateBy(subject);
+                recruitInformationInfo.setCreateTime(new Date());
+                recruitInformationInfo.setStatus("0");
+                recruitInformationInfo.setEnterpriseId(personInfo.getEnterpriseId());
+
+                recruitInformationInfo.setPositionName(positionName);
+                recruitInformationInfo.setSalary(salary);
+                recruitInformationInfo.setSettlementMethod(settlementMethod);
+                recruitInformationInfo.setIndustry(industry);
+                recruitInformationInfo.setRecruitingNumbers(recruitingNumbers);
+                recruitInformationInfo.setDesc(desc);
+                recruitInformationInfo.setContacts(contacts);
+                recruitInformationInfo.setContactsPhone(contactsPhone);
+                recruitInformationInfo.setWorkArea(workArea);
+                recruitInformationInfo.setAddress(address);
+
+                recruitInformationInfoService.insert(recruitInformationInfo);
+            }
+
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="recruitDetail")
+    @RequestMapping(value = "招聘信息详细(免登陆",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "recruitId", value = "招聘信息ID", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> recruitDetail(
+            @RequestParam(value="recruitId",defaultValue="") String recruitId,
+            HttpServletRequest request){
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+            String subject = (String)request.getAttribute("subject");
+
+            Boolean isJoin = false;
+
+            Map<String,Object> returnMap = new HashMap<>();
+            RecruitInformationInfo recruitInformationInfo = recruitInformationInfoService.get(recruitId);
+
+            int BrowseNumber = 0;
+            if(recruitInformationInfo.getBrowseNumber() != null){
+                BrowseNumber = recruitInformationInfo.getBrowseNumber();
+
+            }
+            recruitInformationInfo.setBrowseNumber(BrowseNumber++);
+            recruitInformationInfoService.update(recruitInformationInfo);
+
+
+            EnterpriseInfo enterpriseInfo = null;
+            if(recruitInformationInfo.getEnterpriseId() != null) {
+                enterpriseInfo = enterpriseInfoService.get(recruitInformationInfo.getEnterpriseId());
+            }
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if(personInfo != null){
+                RecruitPersonRelation recruitPersonRelation = recruitPersonRelationService.findByRecruitIdAndPersonId(recruitId,personInfo.getId());
+                if(recruitPersonRelation != null){
+                    isJoin = true;
+                }
+            }
+
+
+            returnMap.put("recruitInformationInfo",recruitInformationInfo);
+            returnMap.put("enterpriseInfo",enterpriseInfo);
+            returnMap.put("isJoin",isJoin);
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="发布共享用工信息")
+    @RequestMapping(value = "createShareWork",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "ID(传为修改", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "type", value = "信息类型", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "title", value = "标题", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "content", value = "内容", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> createShareWork(
+            @RequestParam(value="id",defaultValue="") String id,
+            @RequestParam(value="type",defaultValue="") String type,
+            @RequestParam(value="title",defaultValue="") String title,
+            @RequestParam(value="content",defaultValue="") String content,
+            @RequestAttribute String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("未登录");
+            }
+
+            if(StringUtils.isEmpty(personInfo.getEnterpriseId())){
+                throw new Exception("未绑定企业");
+            }
+
+            if (StringUtils.isNotEmpty(id)) {
+                ShareWorksInfo shareWorksInfo = shareWorksInfoService.get(id);
+                shareWorksInfo.setUpdateBy(subject);
+                shareWorksInfo.setUpdateTime(new Date());
+                shareWorksInfo.setStatus("0");
+
+                shareWorksInfo.setType(type);
+                shareWorksInfo.setTitle(title);
+                shareWorksInfo.setContent(content);
+                shareWorksInfo.setAuthor(personInfo.getRealName());
+
+                shareWorksInfoService.update(shareWorksInfo);
+            } else {
+                ShareWorksInfo shareWorksInfo = new ShareWorksInfo();
+                shareWorksInfo.setId(UUID.randomUUID().toString());
+                shareWorksInfo.setDelFlag(false);
+                shareWorksInfo.setCreateBy(subject);
+                shareWorksInfo.setCreateTime(new Date());
+                shareWorksInfo.setStatus("0");
+
+                shareWorksInfo.setType(type);
+                shareWorksInfo.setTitle(title);
+                shareWorksInfo.setContent(content);
+                shareWorksInfo.setAuthor(personInfo.getRealName());
+
+                shareWorksInfoService.update(shareWorksInfo);
+            }
+
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
 }

+ 135 - 4
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/UserApiController.java

@@ -4,8 +4,10 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.jpsoft.employment.exception.CustomException;
 import com.jpsoft.employment.modules.base.entity.*;
+import com.jpsoft.employment.modules.base.service.EnterpriseInfoService;
 import com.jpsoft.employment.modules.base.service.PersonInfoService;
 import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.utils.DES3;
 import com.jpsoft.employment.modules.common.utils.JwtUtil;
 import com.jpsoft.employment.modules.common.utils.SMSUtil;
 import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
@@ -23,10 +25,7 @@ import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 @Slf4j
@@ -45,6 +44,10 @@ public class UserApiController {
     private ValueOperations<String, Object> valueOperations;
     @Autowired
     private PersonInfoService personInfoService;
+    @Autowired
+    private EnterpriseInfoService enterpriseInfoService;
+
+
 
     @GetMapping("findByOpenId")
     public MessageResult<Map> findByOpenId(String openId) {
@@ -281,8 +284,136 @@ public class UserApiController {
     }
 
 
+    @PostMapping("createUser")
+    @ApiOperation(value = "一键注册(公开接口)")
+    public MessageResult<Map> createUser(String openId,
+                                           String phone) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            if (StrUtil.isBlank(openId)) {
+                    throw new Exception("微信标识不存在");
+            }
 
+            PersonInfo personInfo = null;
+            String token = null;
+            if (StringUtils.isNotEmpty(openId)) {
+                personInfo = personInfoService.findByPhone(phone);
 
+                if (personInfo != null) {
+                    personInfo.setOpenId(openId);
+                    personInfo.setUpdateTime(new Date());
+                    personInfoService.update(personInfo);
+                    token = JwtUtil.createToken(jwtSecret, personInfo.getId(), DateTime.now().plusHours(6).toDate());
+                } else {
+                    personInfo = new PersonInfo();
+                    personInfo.setId(UUID.randomUUID().toString());
+                    personInfo.setDelFlag(false);
+                    personInfo.setCreateTime(new Date());
+                    personInfo.setPhone(phone);
+                    personInfo.setUserName(phone);
+                    personInfo.setOpenId(openId);
+                    DES3 des3 = new DES3();
+                    personInfo.setPassword(des3.encrypt(jwtSecret,"123456"));
+                    personInfo.setStatus("0");
+
+                    personInfoService.insert(personInfo);
+
+                    token = JwtUtil.createToken(jwtSecret, personInfo.getId(), DateTime.now().plusHours(6).toDate());
+                }
+            }
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("token", token);
+            map.put("regUser", personInfo);
+
+            messageResult.setData(map);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            log.error(ex.getMessage());
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @ApiOperation(value="createAuthentication")
+    @RequestMapping(value = "绑定认证信息",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "realName", value = "真实姓名", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "idCard", value = "身份证", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "enterpriseName", value = "企业全称", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "licenseUrl", value = "营业执照地址", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "type", value = "认证类型(0个人,1企业 不传默认0", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> createAuthentication(
+            @RequestParam(value="realName",defaultValue="") String realName,
+            @RequestParam(value="idCard",defaultValue="") String idCard,
+            @RequestParam(value="enterpriseName",defaultValue="") String enterpriseName,
+            @RequestParam(value="licenseUrl",defaultValue="") String licenseUrl,
+            @RequestParam(value="type",defaultValue="0") String type,
+            @RequestAttribute String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("未登录");
+            }
+
+            if("0".equals(type)) {
+                //个人
+                personInfo.setStatus("0");
+                personInfo.setRealName(realName);
+                personInfo.setIdCard(idCard);
+                personInfo.setUpdateBy(subject);
+                personInfo.setUpdateTime(new Date());
+
+                personInfoService.update(personInfo);
+            }else if("1".equals(type)){
+                if(StringUtils.isNotEmpty(personInfo.getEnterpriseId())) {
+                    EnterpriseInfo enterpriseInfo = enterpriseInfoService.get(personInfo.getEnterpriseId());
+                    enterpriseInfo.setUpdateBy(subject);
+                    enterpriseInfo.setUpdateTime(new Date());
+                    enterpriseInfo.setLicenseImage(licenseUrl);
+                    enterpriseInfo.setName(enterpriseName);
+                    enterpriseInfo.setStatus("0");
+                    enterpriseInfoService.update(enterpriseInfo);
+                }else{
+                    EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
+                    enterpriseInfo.setId(UUID.randomUUID().toString());
+                    enterpriseInfo.setDelFlag(false);
+                    enterpriseInfo.setCreateBy(subject);
+                    enterpriseInfo.setCreateTime(new Date());
+                    enterpriseInfo.setLicenseImage(licenseUrl);
+                    enterpriseInfo.setName(enterpriseName);
+                    enterpriseInfo.setStatus("0");
+
+                    int count = enterpriseInfoService.insert(enterpriseInfo);
+
+                    if(count> 0) {
+                        personInfo.setEnterpriseId(enterpriseInfo.getId());
+                        personInfoService.update(personInfo);
+                    }
+                }
+            }
+
+
+            msgResult.setResult(true);
+        }catch (Exception e){
+            msgResult.setResult(false);
+            msgResult.setMessage(e.getMessage());
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
 
 
 

+ 21 - 0
web/src/main/java/com/jpsoft/employment/modules/wechat/controller/WxController.java

@@ -223,4 +223,25 @@ public class WxController {
             return "index";
         }
     }
+
+    @ApiOperation(value = "获取小程序用户手机号信息")
+    @GetMapping(value = "findUserPhoneNumber/{code}")
+    public MessageResult findUserPhoneNumber(@PathVariable String code) {
+        try {
+
+            String accessToken = (String)valueOperations.get("accessToken1");
+            if(StringUtils.isEmpty(accessToken)){
+                AccessToken token = WeixinUtil.getAccessToken(wxPropertiesApplet.getAppId(), wxPropertiesApplet.getAppSecret());
+                accessToken = token.getToken();
+                valueOperations.set("accessToken1",token.getToken(),2, TimeUnit.HOURS);
+            }
+            String phone = WeixinUtil.getUserPhoneNumber(accessToken,code);
+
+            return new MessageResult(true, "成功", phone, 200);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return new MessageResult(false, "系统错误", "", 500);
+        }
+    }
+
 }