Commit 2ba9fc54 authored by jianqian's avatar jianqian

BASE

parent 6d9f4043
package com.zehong.web.controller.workOrder; package com.zehong.web.controller.workOrder;
import java.util.List; import java.util.List;
import java.util.Map;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.form.TWorkOrderForm; import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import org.apache.commons.math3.analysis.function.Add;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
...@@ -43,7 +42,7 @@ public class TWorkOrderController extends BaseController ...@@ -43,7 +42,7 @@ public class TWorkOrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('workOrder:basicsInfo:list')") @PreAuthorize("@ss.hasPermi('workOrder:basicsInfo:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TWorkOrderForm tWorkOrderForm) throws Exception public TableDataInfo list(TWorkOrderForm tWorkOrderForm,Integer pageNum, Integer pageSize) throws Exception
{ {
startPage(); startPage();
List<WorkOrderVo> list = null; List<WorkOrderVo> list = null;
...@@ -56,6 +55,37 @@ public class TWorkOrderController extends BaseController ...@@ -56,6 +55,37 @@ public class TWorkOrderController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 小程序待办
* @return
* @throws Exception
*/
@GetMapping("/waitinglist")
public TableDataInfo waitinglist(String userId,@RequestParam(value = "type", defaultValue = "1")Integer type) throws Exception
{
startPage();
PageInfo<TWorkOrder> pageInfo;
try {
pageInfo = tWorkOrderService.selectWaitingWorkOrder(userId,type);
} 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);
}
/** /**
* 导出工单基础信息列表 * 导出工单基础信息列表
*/ */
...@@ -132,7 +162,6 @@ public class TWorkOrderController extends BaseController ...@@ -132,7 +162,6 @@ public class TWorkOrderController extends BaseController
} }
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 修改工单状态 * 修改工单状态
*/ */
......
...@@ -61,6 +61,12 @@ public class TWorkOrder extends BaseEntity ...@@ -61,6 +61,12 @@ public class TWorkOrder extends BaseEntity
@Excel(name = "备注") @Excel(name = "备注")
private String remarks; private String remarks;
/** 地址 */
private String address;
private String longitude;
private String latitude;
public void setOrderId(String orderId) public void setOrderId(String orderId)
{ {
this.orderId = orderId; this.orderId = orderId;
...@@ -157,16 +163,38 @@ public class TWorkOrder extends BaseEntity ...@@ -157,16 +163,38 @@ public class TWorkOrder extends BaseEntity
return actualTime; return actualTime;
} }
public void setRemarks(String remarks) public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public void setAddress(String address)
{ {
this.remarks = remarks; this.address = address;
}
public String getAddress()
{
return address;
} }
public String getRemarks() public String getRemarks()
{ {
return remarks; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -3,6 +3,7 @@ package com.zehong.system.mapper; ...@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDeviceAlarm; import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm; import com.zehong.system.domain.form.DeviceAlarmForm;
import org.apache.commons.math3.analysis.function.Add;
/** /**
* 报警信息Mapper接口 * 报警信息Mapper接口
...@@ -81,4 +82,10 @@ public interface TDeviceAlarmMapper ...@@ -81,4 +82,10 @@ public interface TDeviceAlarmMapper
* @return TDeviceAlarm * @return TDeviceAlarm
*/ */
List<TDeviceAlarm> selectAlarmDevice (); List<TDeviceAlarm> selectAlarmDevice ();
/**
* 根据工单id查报警设备地址
* @return
*/
String selectAddressByOrderId(String orderId);
} }
...@@ -3,6 +3,8 @@ package com.zehong.system.mapper; ...@@ -3,6 +3,8 @@ package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TWorkOrder; import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.domain.form.TWorkOrderForm; import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo;
import org.apache.ibatis.annotations.Param;
/** /**
* 工单基础信息Mapper接口 * 工单基础信息Mapper接口
...@@ -35,6 +37,13 @@ public interface TWorkOrderMapper ...@@ -35,6 +37,13 @@ public interface TWorkOrderMapper
*/ */
public List<TWorkOrder> selectTWorkOrderList(TWorkOrderForm tWorkOrderForm); public List<TWorkOrder> selectTWorkOrderList(TWorkOrderForm tWorkOrderForm);
/**
* 代办
* @param userId
* @return
*/
public List<TWorkOrder> selectWaitingWorkOrder(@Param("userId") String userId,@Param("type") Integer type);
/** /**
* 新增工单基础信息 * 新增工单基础信息
* *
...@@ -66,4 +75,11 @@ public interface TWorkOrderMapper ...@@ -66,4 +75,11 @@ public interface TWorkOrderMapper
* @return 结果 * @return 结果
*/ */
public int deleteTWorkOrderByIds(String[] orderIds); public int deleteTWorkOrderByIds(String[] orderIds);
/**
* 小程序工单详情
* @param orderId
* @return
*/
public TWorkOrder orderdtail(@Param("orderId")String orderId,@Param("type")String type);
} }
package com.zehong.system.service; package com.zehong.system.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageInfo;
import com.zehong.system.domain.TWorkOrder; import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.domain.form.TWorkOrderForm; import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import org.apache.commons.math3.analysis.function.Add;
import org.apache.poi.ss.formula.functions.T;
/** /**
* 工单基础信息Service接口 * 工单基础信息Service接口
...@@ -30,6 +35,13 @@ public interface ITWorkOrderService ...@@ -30,6 +35,13 @@ public interface ITWorkOrderService
*/ */
public List<WorkOrderVo> selectTWorkOrderList(TWorkOrderForm tWorkOrderForm) throws Exception; public List<WorkOrderVo> selectTWorkOrderList(TWorkOrderForm tWorkOrderForm) throws Exception;
/**
* 查询代办订单
* @return
* @throws Exception
*/
public PageInfo<TWorkOrder> selectWaitingWorkOrder(String userId,Integer type)throws Exception;
/** /**
* 新增工单基础信息 * 新增工单基础信息
* *
...@@ -61,4 +73,11 @@ public interface ITWorkOrderService ...@@ -61,4 +73,11 @@ public interface ITWorkOrderService
* @return 结果 * @return 结果
*/ */
public int deleteTWorkOrderById(String orderId); public int deleteTWorkOrderById(String orderId);
/**
* 小程序订单详情
* @param orderId
* @return
*/
public TWorkOrder orderDtail(String orderId);
} }
...@@ -2,7 +2,9 @@ package com.zehong.system.service.impl; ...@@ -2,7 +2,9 @@ package com.zehong.system.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageInfo;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
...@@ -195,7 +197,6 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -195,7 +197,6 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
{ {
List<WorkOrderVo> workOrderVoList = new ArrayList<WorkOrderVo>(); List<WorkOrderVo> workOrderVoList = new ArrayList<WorkOrderVo>();
List<TWorkOrder> workOrderList = tWorkOrderMapper.selectTWorkOrderList(tWorkOrderForm); List<TWorkOrder> workOrderList = tWorkOrderMapper.selectTWorkOrderList(tWorkOrderForm);
if(workOrderList.size() != 0){ if(workOrderList.size() != 0){
for(TWorkOrder workOrder : workOrderList){ for(TWorkOrder workOrder : workOrderList){
...@@ -219,6 +220,23 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -219,6 +220,23 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
return workOrderVoList; return workOrderVoList;
} }
/**
* 代办工单
* @param userId
* @return
*/
@Override
public PageInfo<TWorkOrder> selectWaitingWorkOrder(String userId,Integer type){
List<TWorkOrder> workOrderList = tWorkOrderMapper.selectWaitingWorkOrder(userId,type);
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;
}
/** /**
* 新增工单基础信息 * 新增工单基础信息
* *
...@@ -321,4 +339,9 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -321,4 +339,9 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
{ {
return tWorkOrderMapper.deleteTWorkOrderById(orderId); 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" ...@@ -141,4 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end_time IS NULL end_time IS NULL
</select> </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> </mapper>
\ No newline at end of file
...@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="actualInspector" column="actual_inspector" /> <result property="actualInspector" column="actual_inspector" />
<result property="actualTime" column="actual_time" /> <result property="actualTime" column="actual_time" />
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
<result property="address" column="address" />
</resultMap> </resultMap>
<select id="getWorkOrderId" resultType="String"> <select id="getWorkOrderId" resultType="String">
...@@ -43,7 +44,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -43,7 +44,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by t.allot_time desc order by t.allot_time desc
</select> </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>
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"> <select id="selectTWorkOrderById" parameterType="String" resultMap="TWorkOrderResult">
<include refid="selectTWorkOrderVo"/> <include refid="selectTWorkOrderVo"/>
where t.order_id = #{orderId} where t.order_id = #{orderId}
...@@ -108,4 +124,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -108,4 +124,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{orderId} #{orderId}
</foreach> </foreach>
</delete> </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>
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
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.resource_id
</when>
<when test='type=="2"'>
LEFT JOIN t_hidden_trouble p ON p.trouble_id = t.resource_id
</when>
<otherwise>
LEFT JOIN t_device_alarm a ON a.alarm_id = t.resource_id
LEFT JOIN t_device_info p ON p.device_id = a.`device_id`
</otherwise>
</choose>
</select>
</mapper> </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