Commit 0f0b91df authored by chenyuxi's avatar chenyuxi

feat: 瓜子接口提交

parent 1f512df4
......@@ -47,4 +47,7 @@ public class TGzOfferInfoExportSearchVo extends TGzOfferInfo {
@Schema(description = "查询止")
private int limitEnd;
@Schema(description = "瓜子Offer状态查询数组")
private String[] offerStatusArray;
}
......@@ -32,12 +32,6 @@ import java.util.List;
@Data
public class TGzOfferInfoVo extends TGzOfferInfo {
// @Schema(description = "人员类别展示值")
// private String empTypeLabel;
//
// @Schema(description = "外签类型展示值")
// private String outSginTypeLabel;
/**
* 查询使用:接收时间开始
*/
......@@ -53,4 +47,19 @@ public class TGzOfferInfoVo extends TGzOfferInfo {
@Schema(description = "瓜子状态数组")
private List<String> statusList;
/**
* 批量更新失败的offer信息列表
*/
@Schema(description = "更新失败的offer信息列表")
private List<TGzOfferInfo> updateFailOfferList;
/**
* 批量更新的状态的offerId列表
*/
@Schema(description = "批量更新的状态的offerId列表")
private List<Integer> offerIdList;
@Schema(description = "瓜子Offer状态查询数组")
private String[] offerStatusArray;
}
......@@ -230,4 +230,16 @@ public class TGzOfferInfoController {
tGzOfferInfoService.exportDetail(response, searchVo);
}
/**
* 瓜子批量更新offer状态
* @param tGzOfferInfo 瓜子offer信息接收表
* @return R
*/
@Operation(summary = "瓜子批量更新offer状态")
@SysLog("瓜子批量更新offer状态" )
@PutMapping("/batchUpdateStatus")
public R batchUpdateStatus(@RequestBody TGzOfferInfoVo tGzOfferInfo) {
return tGzOfferInfoService.batchUpdateStatus(tGzOfferInfo);
}
}
......@@ -118,5 +118,12 @@ public interface TGzOfferInfoService extends IService<TGzOfferInfo> {
**/
void exportDetail(HttpServletResponse response, TGzOfferInfoExportSearchVo searchVo);
/**
* 瓜子批量更新offer状态
* @param tGzOfferInfo 瓜子offer信息接收表
* @return R
*/
R batchUpdateStatus(TGzOfferInfoVo tGzOfferInfo);
}
......@@ -25,11 +25,13 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpContactInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRegisteWarningEmployee;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.EmployeeRegistrationPreMapper;
......@@ -80,6 +82,12 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
private final EmployeeRegistrationPreMapper registrationPreMapper;
// 禁止手动变更的状态:3:待发送Offer,9:候选人填写信息,12:候选人信息审核,13:待签署,8:合同审核通过,99:已归档,97:候选人审核通过
private final String[] forbidStatusArr = {"3", "9", "12", "13", "8","99","97"};
// 当前Offer更新状态,无法再发起更新:5:拒绝Offer、10:取消offer、8:合同审核通过、99:已归档
private final String[] failStatusArr = {"5", "10", "8", "99"};
/**
* 瓜子offer信息接收表简单分页查询
* @param tGzOfferInfo 瓜子offer信息接收表
......@@ -161,6 +169,11 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
if (Common.isEmpty(tGzOfferInfo.getOfferStatus())) {
return R.failed("更新状态不能为空");
}
// 禁止手动变更的状态
if (ArrayUtils.contains(forbidStatusArr, tGzOfferInfo.getOfferStatus())) {
return R.failed("参数错误,禁止手动变更为该状态");
}
TGzOfferInfo findInfo = this.getInfoCommon(tGzOfferInfo.getId());
if (Common.isEmpty(findInfo)) {
return R.failed(CommonConstants.ERROR_NO_DOMAIN);
......@@ -169,10 +182,9 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
if (findInfo.getOfferStatus().equals(tGzOfferInfo.getOfferStatus())) {
return R.failed("当前Offer更新状态失败,请刷新页面后重试");
}
// 当前Offer更新状态,无法再发起更新:5:拒绝Offer、10:取消offer、8:合同审核通过、99:已归档
String[] forbidStatusArr = {"5", "10", "8", "99"};
if (ArrayUtils.contains(forbidStatusArr, findInfo.getOfferStatus())) {
return R.failed("当前Offer更新状态,无法再发起更新");
// 当前Offer更新状态,无法再发起更新
if (ArrayUtils.contains(failStatusArr, findInfo.getOfferStatus())) {
return R.failed("当前Offer状态,无法再发起手动更新");
}
// 获取当前状态下,允许更新的状态列表
List<String> allowUpdateStatusList = this.allowUpdateStatus(findInfo.getOfferStatus());
......@@ -685,4 +697,78 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
}
}
/**
* 瓜子批量更新offer状态
*
* @param tGzOfferInfo 瓜子offer信息接收表
* @return R
*/
@Override
public R batchUpdateStatus(TGzOfferInfoVo tGzOfferInfo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if(Common.isEmpty(tGzOfferInfo.getOfferIdList())){
return R.failed("需要更新的档案集合不能为空");
}
if(Common.isEmpty(tGzOfferInfo.getOfferStatus())){
return R.failed("需要更新的状态选项不能为空");
}
// 禁止手动变更的状态
if (ArrayUtils.contains(forbidStatusArr, tGzOfferInfo.getOfferStatus())) {
return R.failed("参数错误,禁止手动变更为该状态");
}
LambdaQueryWrapper<TGzOfferInfo> queryOffer = Wrappers.<TGzOfferInfo>lambdaQuery()
.in(TGzOfferInfo::getId, tGzOfferInfo.getOfferIdList())
.eq(TGzOfferInfo::getDelFlag, CommonConstants.ZERO_STRING);
List<TGzOfferInfo> findOfferList = this.list(queryOffer);
if(Common.isEmpty(findOfferList)){
return R.failed("没有任何符合更新条件的数据");
}
// 存更新失败的offer信息
List<TGzOfferInfo> updateFailOfferList = new ArrayList<>();
for(TGzOfferInfo findInfo : findOfferList){
// 当前Offer更新状态,无法再发起更新
if (ArrayUtils.contains(failStatusArr, findInfo.getOfferStatus())) {
updateFailOfferList.add(findInfo);
continue;
}
// 更新为同一状态的提示操作失败
if (findInfo.getOfferStatus().equals(tGzOfferInfo.getOfferStatus())) {
updateFailOfferList.add(findInfo);
continue;
}
// 获取当前状态下,允许更新的状态列表
List<String> allowUpdateStatusList = this.allowUpdateStatus(findInfo.getOfferStatus());
if (!allowUpdateStatusList.contains(tGzOfferInfo.getOfferStatus())) {
updateFailOfferList.add(findInfo);
continue;
}
// 更新状态
LambdaUpdateWrapper<TGzOfferInfo> updateOfferWrapper = new LambdaUpdateWrapper<>();
updateOfferWrapper.eq(TGzOfferInfo::getId, findInfo.getId())
.set(TGzOfferInfo::getOfferStatus, tGzOfferInfo.getOfferStatus())
.set(TGzOfferInfo::getUpdateTime, LocalDateTime.now())
.set(TGzOfferInfo::getUpdateBy, user.getId());
boolean res = this.update(null, updateOfferWrapper);
if(!res){
updateFailOfferList.add(findInfo);
continue;
}
// todo 记录offer操作日志
}
if(Common.isEmpty(updateFailOfferList)){
return R.ok("批量更新成功");
}
return R.failed(updateFailOfferList,"存在更新失败的数据,未找到该状态下需要更新的人员信息");
}
}
......@@ -209,10 +209,10 @@
</if>
<!--查询提交档案时间-->
<if test="tGzEmpInfo.createTimeStart != null ">
AND a.create_time &gt;= concat(#{tGzEmpInfo.createTimeStart},' 00:00:00')
AND a.create_time &gt;= #{tGzEmpInfo.createTimeStart}
</if>
<if test="tGzEmpInfo.createTimeEnd != null ">
AND a.create_time &lt;= concat(#{tGzEmpInfo.createTimeEnd},' 23:59:59')
AND a.create_time &lt;= #{tGzEmpInfo.createTimeEnd}
</if>
<if test="tGzEmpInfo.createBy != null and tGzEmpInfo.createBy.trim() != ''">
AND a.create_by = #{tGzEmpInfo.createBy}
......
......@@ -126,10 +126,10 @@
</if>
<!--查询接收时间-->
<if test="tGzOfferInfo.createTimeStart != null ">
AND a.create_time &gt;= concat(#{tGzOfferInfo.createTimeStart},' 00:00:00')
AND a.create_time &gt;= #{tGzOfferInfo.createTimeStart}
</if>
<if test="tGzOfferInfo.createTimeEnd != null ">
AND a.create_time &lt;= concat(#{tGzOfferInfo.createTimeEnd},' 23:59:59')
AND a.create_time &lt;= #{tGzOfferInfo.createTimeEnd}
</if>
<if test="tGzOfferInfo.offerStatus != null and tGzOfferInfo.offerStatus.trim() != ''">
AND a.offer_status = #{tGzOfferInfo.offerStatus}
......@@ -137,9 +137,9 @@
<if test="tGzOfferInfo.offerSendStatus != null and tGzOfferInfo.offerSendStatus.trim() != ''">
AND a.offer_send_status = #{tGzOfferInfo.offerSendStatus}
</if>
<if test="tGzOfferInfo.statusList != null and tGzOfferInfo.statusList.size() > 0">
<if test="tGzOfferInfo.offerStatusArray != null and tGzOfferInfo.offerStatusArray.size() > 0">
AND a.offer_status in
<foreach item="item" index="index" collection="tGzOfferInfo.statusList" open="(" separator="," close=")">
<foreach item="item" index="index" collection="tGzOfferInfo.offerStatusArray" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment