소스 검색

岗位编辑功能调整两个岗位发布接口

LiFei 6 년 전
부모
커밋
2a583ab64b

+ 2 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/mapper/PositionMapper.java

@@ -32,4 +32,6 @@ public interface PositionMapper extends BaseMapper<Position> {
     List<Position> findPosition(@Param("userId")Integer userId);
 
     void changePositionName(@Param("Position")Position position);
+
+    void deleteBypositionId(@Param("positionId")String positionId);
 }

+ 6 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/mapper/xml/PositionAddressMapper.xml

@@ -29,4 +29,10 @@
             a.position_id = #{positionId}
         </where>
     </select>
+
+    <!--物理删除-->
+    <update id="deleteBypositionId">
+		DELETE FROM dp_position_address
+		WHERE position_id = #{positionId}
+	</update>
 </mapper>

+ 35 - 10
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/service/impl/PositionServiceImpl.java

@@ -263,7 +263,17 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
         String userToken = requestMap.get("user_token");
         //验证用户合法性
         if (TokenUtil.validateToken(userId, userToken)) {
+            String positionId = requestMap.get("positionId");//所属公司id
             Position position = new Position();
+            //positionId不为空则是编辑,为空新插入
+            if(StringUtils.isNotBlank(positionId)){
+                position=getById(positionId);
+            }else{
+                position.setAuthenticationStatus(1);  //审核状态待审核
+                position.setIsOn(1);   //结束状态为上架
+                position.setDelFlag("0");  //设置逻辑删除状态为未删除
+                position.setIsPause(0);   //设置暂停状态为未暂停
+            }
             String enterpriseName = requestMap.get("enterpriseName");//所属公司
             String positionName = requestMap.get("positionName");//岗位标题
             String positionDetail = requestMap.get("positionDetail");//职位描述
@@ -302,10 +312,6 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
             if (StringUtils.isNotBlank(isPublishNationwide)) {
                 position.setSettlementMethod(Integer.parseInt(isPublishNationwide));
             }
-            position.setAuthenticationStatus(1);  //审核状态待审核
-            position.setIsOn(1);   //结束状态为上架
-            position.setDelFlag("0");  //设置逻辑删除状态为未删除
-            position.setIsPause(0);   //设置暂停状态为未暂停
             position.setUserId(Integer.parseInt(userId));
             position.setWelfare(welfare);
             position.setEnterpriseName(enterpriseName);
@@ -344,7 +350,13 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
             }
             position.setCreateTime(new Date());
             position.setUpdateTime(new Date());
-            positionMapper.save(position);
+            //positionId不为空则是编辑,为空新插入
+            if(StringUtils.isNotBlank(positionId)){
+                updateById(position);
+                positionMapper.deleteBypositionId(positionId);//删除原有岗位地址
+            }else {
+                positionMapper.save(position);
+            }
             String json = requestMap.get("json");//工作地址
             if (StringUtils.isNotBlank(json)) {
                 JSONArray jsonArray = JSONArray.fromObject(json);
@@ -362,6 +374,7 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
                 }
             }
             String  companyName = companyAuthenticationMapper.findCompanyName(Integer.parseInt(userId));
+            //公司通过审核的发布岗位时同时保存公司名称
             if (StringUtils.isNotBlank(companyName)) {
                 List<Position> list=positionMapper.findPosition(Integer.parseInt(userId));
                 if(list.size()>0){
@@ -390,7 +403,17 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
         String userToken = requestMap.get("user_token");
         //验证用户合法性
         if (TokenUtil.validateToken(userId, userToken)) {
+            String positionId = requestMap.get("positionId");//所属公司id
             Position position = new Position();
+            //positionId不为空则是编辑,为空新插入
+            if(StringUtils.isNotBlank(positionId)){
+                position=getById(positionId);
+            }else{
+                position.setAuthenticationStatus(1);  //审核状态待审核
+                position.setIsOn(1);   //结束状态为上架
+                position.setDelFlag("0");  //设置逻辑删除状态为未删除
+                position.setIsPause(0);   //设置暂停状态为未暂停
+            }
             String enterpriseName = requestMap.get("enterpriseName");//所属公司
             String positionName = requestMap.get("positionName");//岗位标题
             String positionDetail = requestMap.get("positionDetail");//职位描述
@@ -420,10 +443,6 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
             if (StringUtils.isNotBlank(isPublishNationwide)) {
                 position.setSettlementMethod(Integer.parseInt(isPublishNationwide));
             }
-            position.setAuthenticationStatus(1);  //审核状态待审核
-            position.setIsOn(1);   //结束状态为上架
-            position.setDelFlag("0");  //设置逻辑删除状态为未删除
-            position.setIsPause(0);   //设置暂停状态为未暂停
             position.setUserId(Integer.parseInt(userId));
             position.setEnterpriseName(enterpriseName);
             position.setPositionName(positionName);
@@ -459,7 +478,13 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
             }
             position.setCreateTime(new Date());
             position.setUpdateTime(new Date());
-            positionMapper.save(position);
+            //positionId不为空则是编辑,为空新插入
+            if(StringUtils.isNotBlank(positionId)){
+                updateById(position);
+                positionMapper.deleteBypositionId(positionId);//删除原有岗位地址
+            }else {
+                positionMapper.save(position);
+            }
             String json = requestMap.get("json");
             if (StringUtils.isNotBlank(json)) {
                 JSONArray jsonArray = JSONArray.fromObject(json);