修改接口

This commit is contained in:
yuyang 2022-09-08 20:48:33 +08:00
parent 788bd23b09
commit 0b7ba3f729
7 changed files with 237 additions and 23 deletions

View File

@ -1,23 +1,19 @@
package com.xhpc.order.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcPileRegularInspect;
import com.xhpc.order.service.IXhpcPileRegularInspectService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/pileRegularInspect")
@Api(value = "桩定期检查接口", tags = "桩定期检查接口")
public class XhpcPileRegularInspectController extends BaseController {
@Resource
IXhpcPileRegularInspectService xhpcPileRegularInspectService;
@Autowired
private IXhpcPileRegularInspectService xhpcPileRegularInspectService;
/**
* 查询桩定期检查接口
@ -31,7 +27,7 @@ public class XhpcPileRegularInspectController extends BaseController {
@PostMapping("/addPileRegularInspect")
public AjaxResult addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect)
public AjaxResult addPileRegularInspect(@RequestBody XhpcPileRegularInspect xhpcPileRegularInspect)
{
return xhpcPileRegularInspectService.addPileRegularInspect(xhpcPileRegularInspect);
}

View File

@ -1,6 +1,5 @@
package com.xhpc.order.controller;
import cn.hutool.core.date.DateUtil;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
@ -9,7 +8,6 @@ import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

View File

@ -220,7 +220,9 @@ public interface XhpcStatisticsServiceMapper {
List<Map<String, Object>> getTerminalEmptyOrder(@Param("chargingStationId")Long chargingStationId,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
List<Map<String, Object>> getWorkHistoryOrderList(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
List<Map<String, Object>> getWorkHistoryOrderList(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay,@Param("type")Integer type);
List<Map<String, Object>> getWorkHistoryOrderListYY(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay,@Param("type")Integer type);
List<Map<String, Object>> getWorkOrderNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);

View File

@ -31,7 +31,7 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
Map<String, Object> map = xhpcPileRegularInspectMapper.getPileRegularInspectTenantId(tenantId);
return AjaxResult.success(map);
}catch (Exception e){
return AjaxResult.error(500, "请重新登录");
return AjaxResult.error(500, "请重新登录!");
}
}
@ -43,7 +43,7 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
if(tenantId==null || "".equals(tenantId)){
return AjaxResult.error(500, "请重新登录");
}
if(xhpcPileRegularInspect.getPileRegularInspectId()!=null){
if(xhpcPileRegularInspect.getPileRegularInspectId()==null){
Map<String, Object> map = xhpcPileRegularInspectMapper.getPileRegularInspectTenantId(tenantId);
if(map !=null){

View File

@ -1385,14 +1385,28 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
Long logOperatorId = sysUser.getOperatorId();
if ("01".equals(sysUser.getUserType())) {
//运营商看自己的场站
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,1,logOperatorId,tenantId,conditionBeginOfDay,conditionEndOfDay);
if(type !=null && type==4){
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderListYY(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,1,logOperatorId,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}else{
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,1,logOperatorId,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}
}else{
//查询赋值的场站
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,2,logUserId,tenantId,conditionBeginOfDay,conditionEndOfDay);
if(type !=null && type==4){
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderListYY(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,2,logUserId,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}else{
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,2,logUserId,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}
}
}else{
//全部桩
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,0,null,tenantId,conditionBeginOfDay,conditionEndOfDay);
if(type !=null && type==4){
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderListYY(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,0,null,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}else{
map= xhpcStatisticsServiceMapper.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,0,null,tenantId,conditionBeginOfDay,conditionEndOfDay,type);
}
}
}
}

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.order.mapper.XhpcPileRegularInspectMapper">
<resultMap type="com.xhpc.order.domain.XhpcPileRegularInspect" id="XhpcPileRegularInspectMap">
<result column="pile_regular_inspect_id" property="pileRegularInspectId"/>
<result column="version_number_time" property="versionNumberTime"/>
<result column="timing_price_time" property="timingPriceTime"/>
<result column="rate_time" property="rateTime"/>
<result column="copying_administrator_time" property="copyingAdministratorTime"/>
<result column="tenant_id" property="tenantId"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
<result column="del_flag" property="delFlag"/>
</resultMap>
<insert id="addPileRegularInspect" parameterType="com.xhpc.order.domain.XhpcPileRegularInspect" useGeneratedKeys="true"
keyProperty="pileRegularInspectId">
insert into xhpc_pile_regular_inspect
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != versionNumberTime and versionNumberTime !=''">
version_number_time,
</if>
<if test="null != timingPriceTime and timingPriceTime !=''">
timing_price_time,
</if>
<if test="null != rateTime and rateTime!=''">
rate_time,
</if>
<if test="null != copyingAdministratorTime and copyingAdministratorTime!='' ">
copying_administrator_time,
</if>
<if test="null != status ">
status,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy ">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy ">
update_by,
</if>
<if test="null != remark ">
remark,
</if>
<if test="null != tenantId and tenantId !=''">
tenant_id,
</if>
<if test="null != delFlag">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != versionNumberTime and versionNumberTime !=''">
#{versionNumberTime},
</if>
<if test="null != timingPriceTime and timingPriceTime !=''">
#{timingPriceTime},
</if>
<if test="null != rateTime and rateTime!=''">
#{rateTime},
</if>
<if test="null != copyingAdministratorTime and copyingAdministratorTime!='' ">
#{copyingAdministratorTime},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy ">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy ">
#{updateBy},
</if>
<if test="null != remark ">
#{remark},
</if>
<if test="null != tenantId and tenantId!='' ">
#{tenantId},
</if>
<if test="null != delFlag">
#{delFlag},
</if>
</trim>
</insert>
<update id="updatePileRegularInspect" parameterType="com.xhpc.order.domain.XhpcPileRegularInspect">
update xhpc_pile_regular_inspect
<set>
<if test="versionNumberTime != null and versionNumberTime !=''">version_number_time = #{versionNumberTime},</if>
<if test="timingPriceTime != null and timingPriceTime !=''">timing_price_time = #{timingPriceTime},</if>
<if test="rateTime != null and rateTime!=''">rate_time=#{rateTime},</if>
<if test="copyingAdministratorTime != null and copyingAdministratorTime!=''">copying_administrator_time = #{copyingAdministratorTime},</if>
</set>
where pile_regular_inspect_id = #{pileRegularInspectId}
</update>
<select id="getPileRegularInspectTenantId" resultType="map">
select
pile_regular_inspect_id as pileRegularInspectId,
version_number_time as versionNumberTime,
timing_price_time as timingPriceTime,
rate_time as rateTime,
copying_administrator_time as copyingAdministratorTime,
tenant_id as tenantId
from xhpc_pile_regular_inspect
where tenant_id=#{tenantId} and del_flag =0
</select>
</mapper>

View File

@ -1499,11 +1499,16 @@
<select id="getWorkHistoryOrderList" resultType="map">
select
count(xwho.history_order_id) totalOrder,
format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2) emptyOrderRate
FROM `xhpc_history_order` as xh
DATE_FORMAT(xwho.end_time, '%Y-%m-%d') time,
format(ifnull(utu.empty/COUNT(xwho.history_order_id)*100,0), 2) emptyOrderRate
from xhpc_work_history_order xwho
LEFT JOIN (select
xwho.history_order_id
left join (select
DATE_FORMAT(xwho.end_time, '%Y-%m-%d') time,
count(xwho.history_order_id)empty
from xhpc_work_history_order xwho
where xwho.end_time &gt;=#{beginOfDay} and xwho.end_time &lt;= #{endOfDay} and xwho.total_price=0
<if test="operatorId !=null">
@ -1523,7 +1528,8 @@
</if>
<if test="tenantId !=null and '' !=tenantId">
and xwho.tenant_id=#{tenantId}
</if>) ut on ut.history_order_id = xwho.history_order_id
</if>
GROUP BY time) utu on utu.time = DATE_FORMAT(xwho.end_time, '%Y-%m-%d')
where xwho.end_time &gt;=#{beginOfDay} and xwho.end_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
@ -1549,6 +1555,75 @@
<if test="status==2">
and xwho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
GROUP BY DATE_FORMAT(xwho.end_time, '%Y-%m-%d')
order by xwho.end_time
</select>
<select id="getWorkHistoryOrderListYY" resultType="map">
select
count(xwho.history_order_id) totalOrder,
DATE_FORMAT(xwho.end_time, '%Y-%m') time,
format(ifnull(utu.empty/COUNT(xwho.history_order_id)*100,0), 2) emptyOrderRate
from xhpc_work_history_order xwho
left join (
select
DATE_FORMAT(xwho.end_time, '%Y-%m') time,
count(xwho.history_order_id)empty
from xhpc_work_history_order xwho
where xwho.end_time &gt;=#{beginOfDay} and xwho.end_time &lt;= #{endOfDay} and xwho.total_price=0
<if test="operatorId !=null">
and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="chargingStationId!=null">
and xwho.charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and xwho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="stopReason !=null and stopReason !=''">
and xwho.stop_reason_evcs_name LIKE concat('%',#{stopReason}, '%')
</if>
<if test="terminalId !=null">
and xwho.terminal_id =#{terminalId}
</if>
<if test="tenantId !=null and '' !=tenantId">
and xwho.tenant_id=#{tenantId}
</if>
GROUP BY time) utu on utu.time = DATE_FORMAT(xwho.end_time, '%Y-%m')
where xwho.end_time &gt;=#{beginOfDay} and xwho.end_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="chargingStationId!=null">
and xwho.charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and xwho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="terminalId !=null">
and xwho.terminal_id =#{terminalId}
</if>
<if test="stopReason !=null and stopReason !=''">
and xwho.stop_reason_evcs_name LIKE concat('%',#{stopReason}, '%')
</if>
<if test="tenantId !=null and '' !=tenantId">
and xwho.tenant_id=#{tenantId}
</if>
<if test="status==1">
and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and xwho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
GROUP BY date_format(xwho.end_time, '%Y-%m')
order by xwho.end_time
</select>
<select id="getWorkOrderNumber" resultType="map">