1
This commit is contained in:
parent
21e8ccab35
commit
e1015c4b04
@ -80,7 +80,7 @@ public enum RecordTypeEnum {
|
||||
/** 删除工单 */
|
||||
SCGG("scgg", "删除工单"),
|
||||
|
||||
/** 删除工单 */
|
||||
/** 交车 */
|
||||
JC("jc", "交车"),
|
||||
|
||||
/** 内返派工 */
|
||||
|
@ -19,18 +19,14 @@ public enum TicketsStatusEnum {
|
||||
* 施工中
|
||||
*/
|
||||
WORKING("05","施工中"),
|
||||
/**
|
||||
* 未结账
|
||||
*/
|
||||
NO_PAY("01","未结账"),
|
||||
/**
|
||||
* 待通知客户取车
|
||||
*/
|
||||
WAITING_NOTICE("07","待通知客户取车"),
|
||||
/**
|
||||
* 已交车
|
||||
* 未结账
|
||||
*/
|
||||
OVER("08","已交车"),
|
||||
NO_PAY("01","未结账"),
|
||||
/**
|
||||
* 挂单/记账
|
||||
*/
|
||||
@ -39,6 +35,10 @@ public enum TicketsStatusEnum {
|
||||
* 已结账
|
||||
*/
|
||||
CHECK_OUT("02","已结账"),
|
||||
/**
|
||||
* 已交车
|
||||
*/
|
||||
OVER("08","已交车"),
|
||||
/**
|
||||
* 已作废
|
||||
*/
|
||||
|
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_tickets(维修工单表)】的数据库操作Mapper
|
||||
*
|
||||
@ -52,6 +54,8 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
|
||||
* @return java.lang.Long
|
||||
**/
|
||||
Long selectCountByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
|
||||
List<String> selectTicketIdByParams( @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1024,7 +1024,57 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
//查待处理
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
} else {
|
||||
//查所有
|
||||
//查所有,
|
||||
if(("jinchang".equals(repairTicketsReqVO.getTicketsStatus()) ||
|
||||
"yijungong".equals(repairTicketsReqVO.getTicketsStatus()) ||
|
||||
"yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())) && StringUtils.isNotEmpty(repairTicketsReqVO.getStartDate())){
|
||||
//如果是查询进场、已竣工、已交车三个状态,同时选了时间范围的,需要单独处理
|
||||
String startDate = repairTicketsReqVO.getStartDate()+" 00:00:00";
|
||||
String endDate = repairTicketsReqVO.getEndDate()+" 23:59:59";
|
||||
List<String> idList = new ArrayList<>();
|
||||
if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//已竣工
|
||||
idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.ZJ.getCode(),startDate,endDate);
|
||||
}else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//已交车
|
||||
idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.JC.getCode(),startDate,endDate);
|
||||
}else {
|
||||
//进厂
|
||||
repairTicketsReqVO.setStartDate(startDate);
|
||||
repairTicketsReqVO.setEndDate(endDate);
|
||||
}
|
||||
if(null!=idList && !idList.isEmpty()){
|
||||
repairTicketsReqVO.setIdList(idList);
|
||||
//时间查询条件置空
|
||||
repairTicketsReqVO.setStartDate(null);
|
||||
repairTicketsReqVO.setEndDate(null);
|
||||
}
|
||||
}else {
|
||||
//否则查询时间不生效,按维修状态查
|
||||
List<String> statusList = new ArrayList<>();
|
||||
if("weixiuzhong".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//维修中
|
||||
statusList.add(TicketsStatusEnum.WORKING.getCode());
|
||||
}else if("weijiesuan".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//未结算
|
||||
statusList = Arrays.asList("04","05","07","01");
|
||||
}else if("zaichang".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//在厂
|
||||
statusList = Arrays.asList("04","05","07","01","06","02");
|
||||
}else if("jinchang".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//进厂
|
||||
statusList.add(TicketsStatusEnum.NO_WORK.getCode());
|
||||
}else if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//已竣工
|
||||
statusList.add(TicketsStatusEnum.WAITING_NOTICE.getCode());
|
||||
}else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
|
||||
//已交车
|
||||
statusList.add(TicketsStatusEnum.OVER.getCode());
|
||||
}
|
||||
if(!statusList.isEmpty()){
|
||||
repairTicketsReqVO.setStatusList(statusList);
|
||||
}
|
||||
}
|
||||
return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
|
||||
}
|
||||
}
|
||||
@ -1562,10 +1612,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
long overNum=0;
|
||||
//已交车
|
||||
long giveCusNum=0;
|
||||
//未结算
|
||||
long noPayNum=0;
|
||||
List<DlRepairTickets> repairTickets = this.list();
|
||||
if (!repairTickets.isEmpty()) {
|
||||
workingNum = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).count();
|
||||
inCompanyNum = repairTickets.stream().filter(item -> TicketsStatusEnum.NO_PAY.getCode().equals(item.getTicketsStatus())).count();
|
||||
//只要没交车都算在厂
|
||||
List<String> inCompanyCodeList = Arrays.asList("04","05","07","01","06","02");
|
||||
inCompanyNum = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).count();
|
||||
//只要没结算,都是未结算
|
||||
List<String> noPayCodeList = Arrays.asList("04","05","07","01");
|
||||
noPayNum = repairTickets.stream().filter(item -> noPayCodeList.contains(item.getTicketsStatus())).count();
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
if("today".equals(selectType)){
|
||||
String nowDayStr = DateUtil.formatDate(new Date());
|
||||
@ -1573,15 +1630,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).count();
|
||||
//查当日已完成的(总检完成的)
|
||||
overNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null);
|
||||
//查当日已交车的(已结算的)
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JS.getCode(),null,null);
|
||||
//查当日已交车的
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JC.getCode(),null,null);
|
||||
}else if("all".equals(selectType)){
|
||||
//查累计进厂数、已完成、已交车
|
||||
newOrderNum = repairTickets.size();
|
||||
//查累计已完成的(总检完成的)
|
||||
overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(),null,null);
|
||||
//查累计已交车的(已结算的)
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(),null,null);
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(),null,null);
|
||||
}else {
|
||||
//查某个时间范围内进厂数、已完成、已交车
|
||||
LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
@ -1589,8 +1646,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).count();
|
||||
//查某区间范围内已完成的(总检完成的)
|
||||
overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59");
|
||||
//查某区间范围内已交车的(已结算的)
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(), startDate+" 00:00:00", endDate+" 23:59:59");
|
||||
//查某区间范围内已交车的
|
||||
giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(), startDate+" 00:00:00", endDate+" 23:59:59");
|
||||
}
|
||||
}
|
||||
rtnMap.put("workingNum", workingNum);
|
||||
@ -1598,6 +1655,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
rtnMap.put("newOrderNum", newOrderNum);
|
||||
rtnMap.put("overNum", overNum);
|
||||
rtnMap.put("giveCusNum", giveCusNum);
|
||||
rtnMap.put("noPayNum", noPayNum);
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
|
@ -42,4 +42,14 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
|
||||
|
||||
/** 客户来源 */
|
||||
private String cusFrom;
|
||||
|
||||
/** 查询开始日期 */
|
||||
private String startDate;
|
||||
/** 查询结束日期 */
|
||||
private String endDate;
|
||||
|
||||
/** 工单状态集和 */
|
||||
private List<String> statusList;
|
||||
/** 工单id集和 */
|
||||
private List<String> idList;
|
||||
}
|
||||
|
@ -369,11 +369,28 @@
|
||||
)
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
|
||||
and (drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
|
||||
</if>
|
||||
<if test="map.startDate != null and map.startDate != ''">
|
||||
and (drt.create_time >= #{map.startDate} and drt.create_time <= #{map.endDate})
|
||||
</if>
|
||||
<if test="map.repairType !=null and map.repairType !=''">
|
||||
AND (drt.repair_type=#{map.repairType})
|
||||
</if>
|
||||
<if test="map.statusList !=null and map.statusList.size > 0">
|
||||
AND (drt.tickets_status IN
|
||||
<foreach collection="map.statusList" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="map.idList !=null and map.idList.size > 0">
|
||||
AND (drt.id IN
|
||||
<foreach collection="map.idList" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="map.cusFrom != null and map.cusFrom!=''">
|
||||
<choose>
|
||||
<when test="map.cusFrom == '06'">
|
||||
@ -424,4 +441,20 @@
|
||||
AND drr.create_time <= #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectTicketIdByParams" resultType="java.lang.String">
|
||||
SELECT
|
||||
DISTINCT drt.id
|
||||
FROM
|
||||
dl_repair_tickets drt
|
||||
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id
|
||||
AND drr.deleted = '0'
|
||||
WHERE
|
||||
drt.deleted = '0'
|
||||
AND drt.tickets_status !='03'
|
||||
AND drr.type = #{recordCode}
|
||||
<if test="startTime!=null">
|
||||
AND drr.create_time >= #{startTime}
|
||||
AND drr.create_time <= #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user