|
|
@@ -11,11 +11,9 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.xunmei.common.core.constant.CacheConstants;
|
|
|
import com.xunmei.common.core.constant.DictConstants;
|
|
|
import com.xunmei.common.core.constant.ErrorMsgConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
-import com.xunmei.common.core.domain.edu.vo.CoreEduTrainingTaskReportVo;
|
|
|
import com.xunmei.common.core.domain.letter.domain.*;
|
|
|
import com.xunmei.common.core.domain.letter.dto.*;
|
|
|
import com.xunmei.common.core.domain.letter.vo.*;
|
|
|
@@ -23,13 +21,9 @@ import com.xunmei.common.core.domain.panel.dto.PanelListDto;
|
|
|
import com.xunmei.common.core.domain.panel.enums.PanelTypeEnums;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
import com.xunmei.common.core.domain.panel.vo.WebPanelResult;
|
|
|
-import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.core.exception.SystemException;
|
|
|
import com.xunmei.common.core.util.BeanHelper;
|
|
|
-import com.xunmei.common.core.utils.DateUtils;
|
|
|
-import com.xunmei.common.core.utils.StringUtils;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
-import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
import com.xunmei.common.security.utils.DictUtils;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.edu.service.impl.ValueCellWriteHandler;
|
|
|
@@ -48,12 +42,10 @@ import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.RemoteRoleService;
|
|
|
import com.xunmei.system.api.RemoteUserService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
-import com.xunmei.system.api.domain.SysRole;
|
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
import io.netty.util.internal.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -312,15 +304,32 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
if (ObjectUtil.isEmpty(list)) {
|
|
|
throw new SystemException("未获取到数据");
|
|
|
}
|
|
|
- String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
|
|
|
- String staticsPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
|
|
|
-
|
|
|
+ // 设置序号
|
|
|
+ Map<Long, Integer> mergedMap = new HashMap<>();
|
|
|
+ int index = 1;
|
|
|
+ for (CoreIntroduceLetterOutInRequestExcelVo raw : list) {
|
|
|
+ Long id = raw.getOutInRequestId();
|
|
|
+
|
|
|
+ Integer rowNo = mergedMap.get(id);
|
|
|
+ if (rowNo == null) {
|
|
|
+ // 第一次出现,创建新组,分配序号
|
|
|
+ raw.setNo(index++);
|
|
|
+ mergedMap.put(id, raw.getNo());
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ raw.setNo(rowNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- CoreIntroduceLetterOutInRequestExcelVo outInRequestVo = list.get(i);
|
|
|
+// String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
|
|
|
+// String staticsPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
|
|
|
|
|
|
- outInRequestVo.setNo(i + 1);
|
|
|
- // 处理签名图片
|
|
|
+// // 处理图片数据
|
|
|
+// for (int i = 0; i < list.size(); i++) {
|
|
|
+// CoreIntroduceLetterOutInRequestExcelVo outInRequestVo = list.get(i);
|
|
|
+//
|
|
|
+// outInRequestVo.setNo(i + 1);
|
|
|
+// // 处理签名图片
|
|
|
// if (ObjectUtil.isNotEmpty(outInRequestVo.getCheckSign())) {
|
|
|
// outInRequestVo.setCheckSign(getFileRealPath(outInRequestVo.getCheckSign(), prefixPath, staticsPath));
|
|
|
// }
|
|
|
@@ -328,36 +337,38 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
// if (ObjectUtil.isNotEmpty(outInRequestVo.getApproveSignImg())) {
|
|
|
// outInRequestVo.setApproveSignImg(getFileRealPath(outInRequestVo.getApproveSignImg(), prefixPath, staticsPath));
|
|
|
// }
|
|
|
- // 处理证件照片(逗号分隔)
|
|
|
- if (ObjectUtil.isNotEmpty(outInRequestVo.getImgFileStr())) {
|
|
|
- outInRequestVo.setImgFileList(getFileRealPath(Arrays.asList(outInRequestVo.getImgFileStr().split(",")), prefixPath, staticsPath));
|
|
|
- }
|
|
|
- // 处理介绍信文件(JSON 数组)
|
|
|
- if (ObjectUtil.isNotEmpty(outInRequestVo.getLetterFileStr())) {
|
|
|
-
|
|
|
- final List<String> letterFileList = JSON.parseArray(outInRequestVo.getLetterFileStr(), String.class);
|
|
|
- List<String> strings = new ArrayList<>();
|
|
|
- for (String json : letterFileList) {
|
|
|
- final Map map = JSON.parseObject(json, Map.class);
|
|
|
- final String url = (String) map.get("imgPath");
|
|
|
- if (ObjectUtil.isNotEmpty(url)) {
|
|
|
- strings.add(url);
|
|
|
- } else {
|
|
|
- strings.add((String) map.get("url"));
|
|
|
- }
|
|
|
- }
|
|
|
- outInRequestVo.setLetterFile(getFileRealPath(strings, prefixPath, staticsPath));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+// // 处理证件照片(逗号分隔)
|
|
|
+// if (ObjectUtil.isNotEmpty(outInRequestVo.getImgFileStr())) {
|
|
|
+// outInRequestVo.setImgFileList(getFileRealPath(Arrays.asList(outInRequestVo.getImgFileStr().split(",")), prefixPath, staticsPath));
|
|
|
+// }
|
|
|
+// // 处理介绍信文件(JSON 数组)
|
|
|
+// if (ObjectUtil.isNotEmpty(outInRequestVo.getLetterFileStr())) {
|
|
|
+//
|
|
|
+// final List<String> letterFileList = JSON.parseArray(outInRequestVo.getLetterFileStr(), String.class);
|
|
|
+// List<String> strings = new ArrayList<>();
|
|
|
+// for (String json : letterFileList) {
|
|
|
+// final Map map = JSON.parseObject(json, Map.class);
|
|
|
+// final String url = (String) map.get("imgPath");
|
|
|
+// if (ObjectUtil.isNotEmpty(url)) {
|
|
|
+// strings.add(url);
|
|
|
+// } else {
|
|
|
+// strings.add((String) map.get("url"));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// outInRequestVo.setLetterFile(getFileRealPath(strings, prefixPath, staticsPath));
|
|
|
+// }
|
|
|
+// }
|
|
|
try {
|
|
|
String baseHeaderName = "出入情况表";
|
|
|
// 设置响应头
|
|
|
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(baseHeaderName, "utf-8"));
|
|
|
response.setContentType("application/octet-stream;charset=UTF-8");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
-
|
|
|
- String header = baseHeaderName + "(" + DateUtil.format(requestDto.getStartTime(), "yyyy-MM-dd") + "至" + DateUtil.format(requestDto.getEndTime(), "yyyy-MM-dd") + ")";
|
|
|
+ String header = baseHeaderName;
|
|
|
+ if(requestDto.getStartTime()!=null)
|
|
|
+ {
|
|
|
+ header = baseHeaderName + "(" + DateUtil.format(requestDto.getStartTime(), "yyyy-MM-dd") + "至" + DateUtil.format(requestDto.getEndTime(), "yyyy-MM-dd") + ")";
|
|
|
+ }
|
|
|
// 数据导出
|
|
|
EasyExcel.write(response.getOutputStream(), CoreIntroduceLetterOutInRequestExcelVo.class)
|
|
|
.registerWriteHandler(new IntroduceLetterOutInRequestMergeHandler(list)) // 注册合并处理器
|
|
|
@@ -428,7 +439,19 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
outInRequest.setApproveUserId(SecurityUtils.getUserId());
|
|
|
if(outInRequest.getApproveStatus() ==1)
|
|
|
{
|
|
|
- outInRequest.setStatus(1);
|
|
|
+ CoreIntroduceLetterOutInRequest outInRequestDo = outInRequestMapper.selectById(outInRequest.getId());
|
|
|
+ Date currentDate = DateUtil.beginOfDay(new Date());
|
|
|
+ // 判断是否已逾期
|
|
|
+ final int result = currentDate.compareTo(outInRequestDo.getCreateTime());
|
|
|
+
|
|
|
+ if (result > 0) {
|
|
|
+ //4 已过期
|
|
|
+ outInRequest.setStatus(4);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ //1 待登记
|
|
|
+ outInRequest.setStatus(1);
|
|
|
+ }
|
|
|
}
|
|
|
else if(outInRequest.getApproveStatus() ==2)
|
|
|
{
|
|
|
@@ -795,8 +818,9 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
// 将介绍信过期的设置为 已过期状态
|
|
|
saveOrUpdateBatch(overdueLettersList);
|
|
|
|
|
|
+ // 出入状态 :0待审批 1 待登记 2 已完成 3 已拒绝 4 已过期 5已补登
|
|
|
final LambdaQueryWrapper<CoreIntroduceLetterOutInRequest> oqw = new LambdaQueryWrapper<CoreIntroduceLetterOutInRequest>();
|
|
|
- oqw.eq(CoreIntroduceLetterOutInRequest::getApproveStatus, 0).eq(CoreIntroduceLetterOutInRequest::getDeleted, 0);
|
|
|
+ oqw.eq(CoreIntroduceLetterOutInRequest::getStatus, 1).eq(CoreIntroduceLetterOutInRequest::getDeleted, 0);
|
|
|
List<CoreIntroduceLetterOutInRequest> outInRequestList = outInRequestMapper.selectList(oqw);
|
|
|
List<CoreIntroduceLetterOutInRequest> overdueOutInRequestList = new ArrayList<>();
|
|
|
Date currentDate = DateUtil.beginOfDay(new Date());
|
|
|
@@ -805,7 +829,7 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
// 出入申请当天有效
|
|
|
final int result = currentDate.compareTo(x.getCreateTime());
|
|
|
if (result > 0) {
|
|
|
- x.setApproveStatus(3);
|
|
|
+ x.setStatus(4);
|
|
|
overdueOutInRequestList.add(x);
|
|
|
}
|
|
|
});
|
|
|
@@ -817,17 +841,17 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
}
|
|
|
|
|
|
//815版本需求允许介绍信失效后登记了进入时间的,未登记离开时间,可以随时登记离开时间
|
|
|
- final LambdaQueryWrapper<CoreOutInRecord> oqw1 = new LambdaQueryWrapper<CoreOutInRecord>();
|
|
|
- oqw1.notIn(CoreOutInRecord::getStatus, 2,3)
|
|
|
- .isNull(CoreOutInRecord::getArrivalTime)
|
|
|
- .le(CoreOutInRecord::getOutInRequestEffectiveEndTime,currentDate);
|
|
|
- List<CoreOutInRecord> outInRecords = coreOutInRecordMapper.selectList(oqw1);
|
|
|
- if(ObjectUtil.isNotEmpty(outInRecords)){
|
|
|
- outInRecords.stream().forEach(x->x.setStatus(3));
|
|
|
-
|
|
|
- // 将出入记录设置为已失效状态
|
|
|
- coreOutInRecordMapper.batchUpdateCoreOutInRecordStatus(outInRecords);
|
|
|
- }
|
|
|
+// final LambdaQueryWrapper<CoreOutInRecord> oqw1 = new LambdaQueryWrapper<CoreOutInRecord>();
|
|
|
+// oqw1.notIn(CoreOutInRecord::getStatus, 2,3)
|
|
|
+// .isNull(CoreOutInRecord::getArrivalTime)
|
|
|
+// .le(CoreOutInRecord::getOutInRequestEffectiveEndTime,currentDate);
|
|
|
+// List<CoreOutInRecord> outInRecords = coreOutInRecordMapper.selectList(oqw1);
|
|
|
+// if(ObjectUtil.isNotEmpty(outInRecords)){
|
|
|
+// outInRecords.stream().forEach(x->x.setStatus(3));
|
|
|
+//
|
|
|
+// // 将出入记录设置为已失效状态
|
|
|
+// coreOutInRecordMapper.batchUpdateCoreOutInRecordStatus(outInRecords);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -920,7 +944,9 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
public void updateOutInRequest(CoreIntroduceLetterUpdateOutInRequestDto outInRequestDto) {
|
|
|
// 更新出入申请信息
|
|
|
CoreIntroduceLetterOutInRequest outInRequest = outInRequestMapper.selectById(outInRequestDto.getId());
|
|
|
- if(outInRequest.getStatus()==2)
|
|
|
+
|
|
|
+ //出入状态 :0待审批 1 待登记 2 已完成 3 已拒绝 4 已过期 5已补登
|
|
|
+ if(outInRequest.getStatus()==2 || outInRequest.getStatus()==5)
|
|
|
{
|
|
|
throw new RuntimeException("更新失败,当前出入记录已登记,请勿重复操作");
|
|
|
}
|
|
|
@@ -934,7 +960,15 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
|
|
|
if(outInRequestDto.getType()==2)
|
|
|
{
|
|
|
- outInRequest.setStatus(2);
|
|
|
+ if(outInRequest.getStatus()==1)
|
|
|
+ {
|
|
|
+ //正常完成
|
|
|
+ outInRequest.setStatus(2);
|
|
|
+ }
|
|
|
+ else if(outInRequest.getStatus()==4){
|
|
|
+ //逾期完成
|
|
|
+ outInRequest.setStatus(5);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
outInRequestMapper.updateById(outInRequest);
|
|
|
@@ -964,7 +998,7 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
|
|
|
public void syncUserInfoToHistoryUserAndLetterUser (CoreIntroduceLetterUpdateOutInRequestDto outInRequestDto,CoreIntroduceLetterOutInRequest outInRequest) {
|
|
|
try {
|
|
|
- // TODO 回写介绍信人员,回写历史人员库
|
|
|
+ //提交时: 回写介绍信人员,回写历史人员库
|
|
|
if(outInRequestDto.getType()==2) {
|
|
|
//回写介绍信人员
|
|
|
List<CoreIntroduceLetterUserAddDto> fromLetterUserList = outInRequestDto.getUserInfos().stream().filter(x -> x.getLetterUserId() != null).collect(Collectors.toList());
|