Commit 2eeb8c08 authored by 耿迪迪's avatar 耿迪迪

Merge branch 'master' of ssh://111.61.77.35:15/gengdidi/gassafety

parents 00cf7c27 4dfad275
package com.zehong.web.controller.workOrder;
import com.github.pagehelper.PageInfo;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo;
import com.zehong.system.service.ITWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -36,7 +37,7 @@ public class TWorkOrderController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('workOrder:basicsInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TWorkOrderForm tWorkOrderForm) throws Exception
public TableDataInfo list(TWorkOrderForm tWorkOrderForm,Integer pageNum, Integer pageSize) throws Exception
{
startPage();
PageInfo<WorkOrderVo> page = null;
......@@ -49,6 +50,37 @@ public class TWorkOrderController extends BaseController
return getDataTable(page);
}
/**
* 小程序待办
* @return
* @throws Exception
*/
@GetMapping("/waitinglist")
public TableDataInfo waitinglist(String userId,@RequestParam(value = "type", defaultValue = "1")Integer type,String searchStr) throws Exception
{
startPage();
PageInfo<TWorkOrder> pageInfo;
try {
pageInfo = tWorkOrderService.selectWaitingWorkOrder(userId,type,searchStr);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("查询待办工单失败");
}
return getDataTable(pageInfo);
}
/**
* 小程序工单详情
* @param orderId
* @return
* @throws Exception
*/
@GetMapping("/orderDtail")
public AjaxResult orderDtail(String orderId) throws Exception
{
TWorkOrder order = tWorkOrderService.orderDtail(orderId);
return AjaxResult.success(order);
}
/**
* 导出工单基础信息列表
*/
......@@ -125,7 +157,6 @@ public class TWorkOrderController extends BaseController
}
return AjaxResult.success();
}
/**
* 修改工单状态
*/
......
......@@ -61,6 +61,17 @@ public class TWorkOrder extends BaseEntity
@Excel(name = "备注")
private String remarks;
/** 地址 */
private String address;
private String longitude;
private String latitude;
private String pictureUrl;
public String getPictureUrl() {
return pictureUrl;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
......@@ -158,15 +169,37 @@ public class TWorkOrder extends BaseEntity
}
public void setRemarks(String remarks)
{
{
this.remarks = remarks;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public String getRemarks()
{
return remarks;
}
public void setLatitude(String latitude)
{
this.latitude = latitude;
}
public String getLatitude()
{
return this.latitude;
}
public void setLongitude(String longitude)
{
this.longitude = longitude;
}
public String getLongitude()
{
return this.longitude;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm;
import org.apache.commons.math3.analysis.function.Add;
/**
* 报警信息Mapper接口
......@@ -81,4 +82,10 @@ public interface TDeviceAlarmMapper
* @return TDeviceAlarm
*/
List<TDeviceAlarm> selectAlarmDevice ();
/**
* 根据工单id查报警设备地址
* @return
*/
String selectAddressByOrderId(String orderId);
}
......@@ -3,6 +3,8 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo;
import org.apache.ibatis.annotations.Param;
/**
* 工单基础信息Mapper接口
......@@ -35,6 +37,13 @@ public interface TWorkOrderMapper
*/
public List<TWorkOrder> selectTWorkOrderList(TWorkOrderForm tWorkOrderForm);
/**
* 代办
* @param userId
* @return
*/
public List<TWorkOrder> selectWaitingWorkOrder(@Param("userId") String userId,@Param("type") Integer type,@Param("searchStr") String searchStr);
/**
* 新增工单基础信息
*
......@@ -66,4 +75,11 @@ public interface TWorkOrderMapper
* @return 结果
*/
public int deleteTWorkOrderByIds(String[] orderIds);
/**
* 小程序工单详情
* @param orderId
* @return
*/
public TWorkOrder orderdtail(@Param("orderId")String orderId,@Param("type")String type);
}
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.PageInfo;
import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo;
import org.apache.commons.math3.analysis.function.Add;
import org.apache.poi.ss.formula.functions.T;
/**
* 工单基础信息Service接口
......@@ -40,6 +45,13 @@ public interface ITWorkOrderService
*/
public PageInfo<WorkOrderVo> selectTWorkOrderPage(TWorkOrderForm tWorkOrderForm) throws Exception;
/**
* 查询代办订单
* @return
* @throws Exception
*/
public PageInfo<TWorkOrder> selectWaitingWorkOrder(String userId,Integer type,String searchStr)throws Exception;
/**
* 新增工单基础信息
*
......@@ -71,4 +83,11 @@ public interface ITWorkOrderService
* @return 结果
*/
public int deleteTWorkOrderById(String orderId);
/**
* 小程序订单详情
* @param orderId
* @return
*/
public TWorkOrder orderDtail(String orderId);
}
package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils;
......@@ -14,9 +17,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 工单基础信息Service业务层处理
*
......@@ -196,7 +196,6 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
{
List<WorkOrderVo> workOrderVoList = new ArrayList<WorkOrderVo>();
List<TWorkOrder> workOrderList = tWorkOrderMapper.selectTWorkOrderList(tWorkOrderForm);
if(workOrderList.size() != 0){
for(TWorkOrder workOrder : workOrderList){
......@@ -251,6 +250,23 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
return pageVo;
}
/**
* 代办工单
* @param userId
* @return
*/
@Override
public PageInfo<TWorkOrder> selectWaitingWorkOrder(String userId,Integer type,String searchStr){
List<TWorkOrder> workOrderList = tWorkOrderMapper.selectWaitingWorkOrder(userId,type,searchStr);
for(TWorkOrder t :workOrderList){
if(t.getOrderType().equals('3')){
String address = tDeviceAlarmMapper.selectAddressByOrderId(t.getOrderId());
t.setAddress(address);
}
}
PageInfo<TWorkOrder> pageInfo = new PageInfo<>(workOrderList);
return pageInfo;
}
/**
* 新增工单基础信息
*
......@@ -353,4 +369,9 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
{
return tWorkOrderMapper.deleteTWorkOrderById(orderId);
}
@Override
public TWorkOrder orderDtail(String orderId){
TWorkOrder order = tWorkOrderMapper.selectTWorkOrderById(orderId);
return tWorkOrderMapper.orderdtail(orderId,order.getOrderType());
}
}
......@@ -141,4 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end_time IS NULL
</select>
<select id="selectAddressByOrderId" resultType="java.lang.String">
SELECT IFNULL(d.device_addr,"") AS address FROM t_device_alarm t
LEFT JOIN t_device_info d ON t.device_id = d.device_id
WHERE order_id = #{orderId}
</select>
</mapper>
\ No newline at end of file
......@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="actualInspector" column="actual_inspector" />
<result property="actualTime" column="actual_time" />
<result property="remarks" column="remarks" />
<result property="address" column="address" />
</resultMap>
<select id="getWorkOrderId" resultType="String">
......@@ -43,7 +44,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by t.allot_time desc
</select>
<select id="selectWaitingWorkOrder" resultMap="TWorkOrderResult">
SELECT o.*,IF(o.`order_type`=1,IFNULL(p.`address`,""),IFNULL(t.`address`,"")) AS address FROM t_work_order o
LEFT JOIN t_hidden_trouble t ON t.trouble_id = o.resource_id
LEFT JOIN t_inspection_plan p ON p.plan_id = o.resource_id
WHERE
<choose>
<when test="type==1">
o.order_status &lt; 2
</when>
<otherwise>
o.order_status > 0
</otherwise>
</choose>
<if test="searchStr!=null and searchStr!=''">
AND o.order_name LIKE concat('%',#{searchStr},'%')
</if>
and (o.appoint_inspector is null OR o.appoint_inspector = #{userId})
order by o.allot_time desc
</select>
<select id="selectTWorkOrderById" parameterType="String" resultMap="TWorkOrderResult">
<include refid="selectTWorkOrderVo"/>
where t.order_id = #{orderId}
......@@ -108,4 +127,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{orderId}
</foreach>
</delete>
<select id="orderdtail" resultType="com.zehong.system.domain.TWorkOrder">
SELECT t.*,
<choose>
<when test='type=="3"'>
p.device_addr as address,
</when>
<otherwise>
p.address AS address,
</otherwise>
</choose>
<choose>
<when test='type=="1"'>
"" as longitude,
</when>
<otherwise>
p.longitude as longitude,
</otherwise>
</choose>
<choose>
<when test='type=="1"'>
"" as latitude,
</when>
<otherwise>
p.latitude as latitude,
</otherwise>
</choose>
<choose>
<when test='type!="2"'>
"" as pictureUrl
</when>
<otherwise>
p.picture_url as pictureUrl
</otherwise>
</choose>
FROM (SELECT order_id as orderId,order_name as orderName,order_type as orderType,
order_status as orderStatus,allot_time as allotTime,remarks,resource_id as resourceId
FROM t_work_order WHERE order_id=#{orderId})t
<choose>
<when test='type=="1"'>
LEFT JOIN t_inspection_plan p ON p.plan_id = t.resourceId
</when>
<when test='type=="2"'>
LEFT JOIN t_hidden_trouble p ON p.trouble_id = t.resourceId
</when>
<otherwise>
LEFT JOIN t_device_alarm a ON a.alarm_id = t.resourceId
LEFT JOIN t_device_info p ON p.device_id = a.`device_id`
</otherwise>
</choose>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment