添加稽核查询功能

This commit is contained in:
xiaodong.hu
2023-07-21 16:53:02 +08:00
parent 1aedfb3442
commit dc8f27a365
14 changed files with 299 additions and 26 deletions

View File

@@ -30,7 +30,6 @@ public interface HyInspectionMapper {
InterviewInspectionInfo interviewInspectionGetDetail(@Param("id") Long id);
List<InterviewInspectionHistoryInfo> interviewInspectionGetHistoryDetail(@Param("id") Long id);
List<InterviewInspectionResultVO> interviewInspectionResultGetList(GetInterviewInspectionResultListReq request);

View File

@@ -1,7 +1,11 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyInterviewInspectionLog;
import com.cool.store.vo.interview.InterviewInspectionHistoryInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface HyInterviewInspectionLogMapper {
@@ -16,4 +20,6 @@ public interface HyInterviewInspectionLogMapper {
int updateByPrimaryKeySelective(HyInterviewInspectionLog record);
int updateByPrimaryKey(HyInterviewInspectionLog record);
List<InterviewInspectionHistoryInfo> interviewInspectionGetHistoryDetail(@Param("inspectionId") Long id);
}

View File

@@ -17,4 +17,7 @@ public interface MdmAreaMapper {
List<MDMAreaDO> getSonArea(@Param("code") String code);
List<MDMAreaDO> getProvinceAllCode(@Param("code") String code);
List<MDMAreaDO> getArea(@Param("code") String code);
}

View File

@@ -30,16 +30,119 @@
where id = #{id}
</select>
<select id="interviewInspectionGetList" resultType="com.cool.store.vo.interview.InterviewInspectionVO">
SELECT
eu.`name` AS interviewerName,
eu.mobile AS interviewerMobile,
hpui.username AS intervieweeName,
hpui.mobile AS intervieweeMobile,
hoai.area_name AS wantShopAreaName,
hi.create_time AS interviewPassTime,
hi.`status` AS `status`,
euj.`name` AS auditorName,
euj.mobile AS auditorMobile,
hi.inspection_time AS inspectionTime,
hi.id AS id,
hi.interview_plan_id AS interviewPlanId
FROM
hy_inspection hi
LEFT JOIN enterprise_user euj ON hi.operator_user_id = euj.user_id
LEFT JOIN hy_partner_interview_plan hpip ON hi.interview_plan_id = hpip.id
AND hi.deleted = 0
AND hpip.deleted = 0
LEFT JOIN hy_partner_interview hpi ON hpi.interview_plan_id = hpip.id
AND hpi.deleted = 0
LEFT JOIN enterprise_user eu ON hpi.interviewer = eu.user_id
LEFT JOIN hy_partner_user_info hpui ON hpip.partner_id = hpui.partner_id
LEFT JOIN hy_inspection_setting_mapping hism ON hpui.want_shop_area = hism.open_area_mapping_id
AND hism.deleted = 0
LEFT JOIN hy_inspection_setting his ON hism.inspection_setting_id = his.id
AND his.deleted = 0
AND eu.deleted = 0
LEFT JOIN hy_open_area_info hoai ON hpui.want_shop_area = hoai.id
AND hoai.deleted = 0
<where>
<if test="userId !=null and userId !=''">
and (his.inspection_user_id = #{userId} OR hi.operator_user_id = #{userId})
</if>
<if test="interviewerName !=null and interviewerName !=''">
and eu.`name`=#{interviewerName}
</if>
<if test="interviewerMobile !=null and interviewerMobile !=''">
and eu.mobile=#{interviewerMobile}
</if>
<if test="intervieweeName !=null and intervieweeName !=''">
and hpui.username=#{intervieweeName}
</if>
<if test="intervieweeMobile !=null and intervieweeMobile !=''">
and hpui.mobile=#{intervieweeMobile}
</if>
<if test="status !=null">
and hi.`status`=#{status}
</if>
<if test="codeList !=null">
and hpui.want_shop_area in <foreach collection="codeList" separator="," open="(" close=")" item="code" >#{code}</foreach>
</if>
<if test="startTime != null and startTime != ''">
and hpi.pass_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and hpi.pass_time &lt;= #{endTime}
</if>
</where>
order by hi.id desc
</select>
<select id="interviewInspectionGetDetail" resultType="com.cool.store.vo.interview.InterviewInspectionInfo">
SELECT b.`name` as auditorName, b.mobile as auditorMobile,inspection_time as inspectionTime,`status` ,description,files as filesStr
FROM hy_inspection a left join enterprise_user b on a.operator_user_id=b.user_id and a.deleted=0 and b.deleted=0
where id=#{id}
</select>
<select id="interviewInspectionGetHistoryDetail" resultType="com.cool.store.vo.interview.InterviewInspectionHistoryInfo">
</select>
<select id="interviewInspectionResultGetList" resultType="com.cool.store.vo.interview.InterviewInspectionResultVO">
SELECT
hpui.username AS intervieweeName,
hpui.mobile AS intervieweeMobile,
hoai.area_name AS wantShopAreaName,
hi.create_time AS interviewPassTime,
hi.`status` AS `status`,
euj.`name` AS auditorName,
euj.mobile AS auditorMobile,
hi.inspection_time AS inspectionTime,
hi.id AS id,
hi.interview_plan_id AS interviewPlanId
FROM
hy_inspection hi
LEFT JOIN enterprise_user euj ON hi.operator_user_id = euj.user_id
LEFT JOIN hy_partner_interview_plan hpip ON hi.interview_plan_id = hpip.id
AND hi.deleted = 0
AND hpip.deleted = 0
LEFT JOIN hy_partner_interview hpi ON hpi.interview_plan_id = hpip.id
AND hpi.deleted = 0
LEFT JOIN hy_partner_user_info hpui ON hpip.partner_id = hpui.partner_id
LEFT JOIN hy_open_area_info hoai ON hpui.want_shop_area = hoai.id
AND hoai.deleted = 0
<where>
<if test="userId !=null and userId !=''">
and hpi.interviewer = #{userId}
</if>
<if test="intervieweeName !=null and intervieweeName !=''">
and hpui.username=#{intervieweeName}
</if>
<if test="intervieweeMobile !=null and intervieweeMobile !=''">
and hpui.mobile=#{intervieweeMobile}
</if>
<if test="status !=null">
and hi.`status`=#{status}
</if>
<if test="codeList !=null">
and hpui.want_shop_area in <foreach collection="codeList" separator="," open="(" close=")" item="code" >#{code}</foreach>
</if>
<if test="startTime != null and startTime != ''">
and hpi.pass_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and hpi.pass_time &lt;= #{endTime}
</if>
</where>
order by hi.id desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_inspection

View File

@@ -25,7 +25,11 @@
from hy_interview_inspection_log
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<select id="interviewInspectionGetHistoryDetail" resultType="com.cool.store.vo.interview.InterviewInspectionHistoryInfo">
SELECT a.id, b.`name` as auditorName, b.mobile as auditorMobile,operation_time as inspectionTime, operation_type as operationType ,description,files as filesStr
FROM hy_interview_inspection_log a left join enterprise_user b on a.operator_user_id=b.user_id and b.deleted=0 WHERE inspection_id=#{inspectionId} ORDER BY a.id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_interview_inspection_log
where id = #{id,jdbcType=BIGINT}
</delete>

View File

@@ -15,4 +15,13 @@
FROM mdm_area
WHERE parent_code = #{code}
</select>
<select id="getProvinceAllCode" resultType="com.cool.store.entity.MDMAreaDO">
SELECT b.* FROM `mdm_area` a inner join mdm_area b on a.`code`=b.`parent_code`
WHERE a.`parent_code`=#{code} ORDER BY b.id desc
</select>
<select id="getArea" resultType="com.cool.store.entity.MDMAreaDO">
SELECT id, instance_id, code, area_name, parent_code
FROM mdm_area
WHERE `code` = #{code}
</select>
</mapper>

View File

@@ -4,6 +4,9 @@ import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @Author: hxd
@@ -12,14 +15,23 @@ import lombok.Data;
*/
@Data
@ApiModel
@Accessors(chain = true)
public class GetInterviewInspectionListReq extends PageBasicInfo {
@ApiModelProperty("搜索类型")
private String searchType;
@ApiModelProperty("面试官姓名")
private String interviewerName;
@ApiModelProperty("搜索内容")
private String searchContent;
@ApiModelProperty("面试官手机号")
private String interviewerMobile;
@ApiModelProperty("被面试人姓名")
private String intervieweeName;
@ApiModelProperty("被面试人手机号")
private String intervieweeMobile;
@ApiModelProperty("稽核状态0为未稽核1为合格2为不合格")
@@ -37,6 +49,10 @@ public class GetInterviewInspectionListReq extends PageBasicInfo {
@ApiModelProperty("面试结束时间")
private String endTime;
/**
* 地区编码
*/
private List<String> codeList;
private String userId;

View File

@@ -5,6 +5,9 @@ import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @Author: hxd
@@ -13,6 +16,7 @@ import lombok.Data;
*/
@Data
@ApiModel
@Accessors(chain = true)
public class GetInterviewInspectionResultListReq extends PageBasicInfo {
@ApiModelProperty("搜索类型")
@@ -38,4 +42,11 @@ public class GetInterviewInspectionResultListReq extends PageBasicInfo {
@ApiModelProperty("面试结束时间")
private String endTime;
/**
* 地区编码
*/
private List<String> codeList;
private String userId;
}

View File

@@ -18,8 +18,11 @@ import java.util.List;
@Data
public class InterviewInspectionHistoryInfo {
@ApiModelProperty(value = "操作人")
private String operatorUser;
@ApiModelProperty(value = "操作人姓名")
private String operatorUserName;
@ApiModelProperty(value = "操作人电话")
private String operatorUserMobile;
@ApiModelProperty(value = "稽核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -29,6 +32,16 @@ public class InterviewInspectionHistoryInfo {
@ApiModelProperty(value = "原因")
private String description;
@ApiModelProperty(value = "操作类型")
private String operationType;
@ApiModelProperty(value = "凭证或者证据")
private List<String> files;
private String filesStr;
@ApiModelProperty(value = "id")
private Long id;
}

View File

@@ -19,8 +19,11 @@ import java.util.List;
@ApiModel(description = "面试稽核详情信息")
public class InterviewInspectionInfo {
@ApiModelProperty(value = "稽核人")
private String auditor;
@ApiModelProperty(value = "稽核人姓名")
private String auditorName;
@ApiModelProperty(value = "稽核人电话")
private String auditorMobile;
@ApiModelProperty(value = "稽核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -34,4 +37,6 @@ public class InterviewInspectionInfo {
@ApiModelProperty(value = "凭证或者证据")
private List<String> files;
private String filesStr;
}

View File

@@ -17,4 +17,7 @@ public interface MDMAreaService {
*/
List<MDMAreaDO> getSonArea(String code);
List<MDMAreaDO> getAllAreaCode(String code);
boolean getAreaProvinceType(String code);
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -14,7 +14,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;