添加稽核查询功能
This commit is contained in:
@@ -17,4 +17,7 @@ public interface MDMAreaService {
|
||||
*/
|
||||
List<MDMAreaDO> getSonArea(String code);
|
||||
|
||||
List<MDMAreaDO> getAllAreaCode(String code);
|
||||
|
||||
boolean getAreaProvinceType(String code);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.inspection.interview.InspectionRevocationDTO;
|
||||
import com.cool.store.dto.inspection.interview.InspectionSubmissionDTO;
|
||||
import com.cool.store.entity.HyInspection;
|
||||
import com.cool.store.entity.HyInterviewInspectionLog;
|
||||
import com.cool.store.entity.MDMAreaDO;
|
||||
import com.cool.store.entity.SysMenuDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.InspectionOperationTypeEnum;
|
||||
import com.cool.store.enums.InspectionStatusEnum;
|
||||
@@ -13,20 +16,21 @@ import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.mapper.HyInspectionMapper;
|
||||
import com.cool.store.request.GetInterviewInspectionListReq;
|
||||
import com.cool.store.request.GetInterviewInspectionResultListReq;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.mapper.HyInterviewInspectionLogMapper;
|
||||
import com.cool.store.service.InterviewInspectionService;
|
||||
import com.cool.store.service.MDMAreaService;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.vo.interview.InterviewInspectionHistoryInfo;
|
||||
import com.cool.store.vo.interview.InterviewInspectionInfo;
|
||||
import com.cool.store.vo.interview.InterviewInspectionResultVO;
|
||||
import com.cool.store.vo.interview.InterviewInspectionVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -43,6 +47,10 @@ public class InterviewInspectionServiceImpl implements InterviewInspectionServic
|
||||
@Autowired
|
||||
private HyInterviewInspectionLogMapper interviewInspectionLogMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MDMAreaService mdmAreaService;
|
||||
|
||||
@Override
|
||||
public void submit(InspectionSubmissionDTO dto) throws ApiException {
|
||||
HyInspection rawInspection = inspectionMapper.selectByPrimaryKey(dto.getInspectionId());
|
||||
@@ -110,17 +118,44 @@ public class InterviewInspectionServiceImpl implements InterviewInspectionServic
|
||||
|
||||
@Override
|
||||
public InterviewInspectionInfo interviewInspectionGetDetail(Long id) {
|
||||
return inspectionMapper.interviewInspectionGetDetail(id);
|
||||
InterviewInspectionInfo interviewInspectionInfo = inspectionMapper.interviewInspectionGetDetail(id);
|
||||
if (ObjectUtil.isNotNull(interviewInspectionInfo) && ObjectUtil.isNotNull(interviewInspectionInfo.getFilesStr())) {
|
||||
List<String> list = Arrays.asList(interviewInspectionInfo.getFilesStr().split(","));
|
||||
interviewInspectionInfo.setFiles(list);
|
||||
}
|
||||
return interviewInspectionInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InterviewInspectionHistoryInfo> interviewInspectionGetHistoryDetail(Long id) {
|
||||
return inspectionMapper.interviewInspectionGetHistoryDetail(id);
|
||||
List<InterviewInspectionHistoryInfo> interviewInspectionHistoryInfos = interviewInspectionLogMapper.interviewInspectionGetHistoryDetail(id);
|
||||
for (InterviewInspectionHistoryInfo interviewInspectionHistoryInfo : interviewInspectionHistoryInfos) {
|
||||
if (ObjectUtil.isNotNull(interviewInspectionHistoryInfo) && ObjectUtil.isNotNull(interviewInspectionHistoryInfo.getFilesStr())) {
|
||||
List<String> list = Arrays.asList(interviewInspectionHistoryInfo.getFilesStr().split(","));
|
||||
interviewInspectionHistoryInfo.setFiles(list);
|
||||
}
|
||||
}
|
||||
return interviewInspectionHistoryInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InterviewInspectionResultVO> interviewInspectionResultGetList(GetInterviewInspectionResultListReq request) {
|
||||
return inspectionMapper.interviewInspectionResultGetList(request);
|
||||
//给个默认时间
|
||||
if (StringUtil.isEmpty(request.getStartTime()) && StringUtil.isEmpty(request.getEndTime())) {
|
||||
request.setStartTime(getHourDayDate(0, -6, true)).setEndTime(getHourDayDate(0, 0, false));
|
||||
}
|
||||
//意向开店区域 不为空
|
||||
if (StringUtil.isNotEmpty(request.getWantShopArea())) {
|
||||
if (mdmAreaService.getAreaProvinceType(request.getWantShopArea())) {
|
||||
//是省
|
||||
|
||||
} else {
|
||||
//并非省
|
||||
List<String> codeList = mdmAreaService.getAllAreaCode(request.getWantShopArea()).stream().map(MDMAreaDO::getCode).collect(Collectors.toList());
|
||||
request.setCodeList(codeList);
|
||||
}
|
||||
}
|
||||
return inspectionMapper.interviewInspectionResultGetList(request.setUserId(CurrentUserHolder.getUserId()));
|
||||
}
|
||||
|
||||
private String spliceFiles(List<String> files) {
|
||||
@@ -132,7 +167,35 @@ public class InterviewInspectionServiceImpl implements InterviewInspectionServic
|
||||
|
||||
@Override
|
||||
public List<InterviewInspectionVO> interviewInspectionGetList(GetInterviewInspectionListReq request) {
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
return inspectionMapper.interviewInspectionGetList(request);
|
||||
//给个默认时间
|
||||
if (StringUtil.isEmpty(request.getStartTime()) && StringUtil.isEmpty(request.getEndTime())) {
|
||||
request.setStartTime(getHourDayDate(0, -6, true)).setEndTime(getHourDayDate(0, 0, false));
|
||||
}
|
||||
//意向开店区域 不为空
|
||||
if (StringUtil.isNotEmpty(request.getWantShopArea())) {
|
||||
if (mdmAreaService.getAreaProvinceType(request.getWantShopArea())) {
|
||||
//是省
|
||||
|
||||
} else {
|
||||
//并非省
|
||||
List<String> codeList = mdmAreaService.getAllAreaCode(request.getWantShopArea()).stream().map(MDMAreaDO::getCode).collect(Collectors.toList());
|
||||
request.setCodeList(codeList);
|
||||
}
|
||||
}
|
||||
return inspectionMapper.interviewInspectionGetList(request.setUserId(CurrentUserHolder.getUserId()));
|
||||
}
|
||||
|
||||
|
||||
private String getHourDayDate(int hour, int day, boolean pan) {
|
||||
Date today = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(today);
|
||||
calendar.add(Calendar.HOUR, hour);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, day);
|
||||
Date twoDay = calendar.getTime();
|
||||
String partner = pan ? "yyyy-MM-dd 00:00:00" : "yyyy-MM-dd 24:00:00";
|
||||
return new SimpleDateFormat(partner).format(twoDay);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import com.cool.store.entity.MDMAreaDO;
|
||||
import com.cool.store.mapper.MdmAreaMapper;
|
||||
import com.cool.store.service.MDMAreaService;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
@@ -57,4 +59,41 @@ public class MDMAreaServiceImpl implements MDMAreaService {
|
||||
return areaDOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MDMAreaDO> getAllAreaCode(String code) {
|
||||
if (StringUtil.isEmpty(code)) {
|
||||
return null;
|
||||
}
|
||||
//获取省下所有数据
|
||||
List<MDMAreaDO> provinceCodeList= mdmAreaMapper.getProvinceAllCode(code);
|
||||
if(CollectionUtils.isEmpty(provinceCodeList)){
|
||||
//获取市区下所有数据
|
||||
List<MDMAreaDO> cityCodeList= mdmAreaMapper.getSonArea(code);
|
||||
if(CollectionUtils.isEmpty(cityCodeList)){
|
||||
//获取区数据
|
||||
return mdmAreaMapper.getArea(code);
|
||||
}else {
|
||||
return cityCodeList;
|
||||
}
|
||||
}else {
|
||||
return provinceCodeList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 省为true
|
||||
* 非省为false
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean getAreaProvinceType(String code) {
|
||||
if (StringUtil.isEmpty(code)) {
|
||||
return false;
|
||||
}
|
||||
//获取省下所有数据
|
||||
List<MDMAreaDO> provinceCodeList= mdmAreaMapper.getProvinceAllCode(code);
|
||||
return CollectionUtils.isEmpty(provinceCodeList)?false:true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user