1.派单记录

This commit is contained in:
ant 2024-07-24 14:41:29 +08:00
parent bef28bb083
commit 99192f2b5c
5 changed files with 103 additions and 68 deletions

View File

@ -161,7 +161,7 @@ public class WrkInfoController {
* 批量派单/领取
*/
@PostMapping("/dispatch/app")
@RequiresPermissions("wrk:dispatch")
@RequiresPermissions("wrk:info:dispatch")
@SysLog(value = "批量派单/领取", businessType = BusinessType.IMPORT)
public AjaxResult dispatchApp(@RequestBody @Validated DispatchQuery query) {
wrkInfoService.dispatch(query, 0);
@ -172,9 +172,9 @@ public class WrkInfoController {
* 批量派单/领取
*/
@PostMapping("/dispatch")
@RequiresPermissions("wrk:dispatch")
@RequiresPermissions("wrk:info:dispatch")
@SysLog(value = "批量派单/领取", businessType = BusinessType.IMPORT)
public AjaxResult dispatch(@RequestPart("file") MultipartFile file, @Validated DispatchQuery query) {
public AjaxResult dispatch(@RequestPart(value = "file", required = false) MultipartFile file, @Validated DispatchQuery query) {
if (file.isEmpty()) {
wrkInfoService.dispatch(query, 0);
return AjaxResult.success();

View File

@ -544,7 +544,8 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
@Override
@Transactional
public Long dispatch(WrkInfo wrkInfo, Store store, Terminal terminal, TerminalIns terminalIns) {
public Long dispatch(WrkInfo wrkInfo, Store store, Terminal terminal, TerminalIns terminalIns)
{
// 工单信息
save(wrkInfo);
//终端信息
@ -567,7 +568,8 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
/**
* 计算经纬度 偏差
*/
private Long distance(String origins, String destination) {
private Long distance(String origins, String destination)
{
HashMap<String, Object> map = new HashMap<>() {{
put("origins", origins);
put("destination", destination);
@ -598,7 +600,8 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
Integer storeStatus,
Integer workType,
Integer serviceResult,
Terminal record, Store store) {
Terminal record, Store store)
{
// 2023年4月19号修改 市场部
//撤机 两种情况下归属撤机

View File

@ -177,65 +177,59 @@
</select>
<select id="getStoreByTasKIdOrIds" resultType="com.chushang.inspection.work.dto.DispatchDTO">
select
t1.terminal_id AS terminalId,
t1.terminal_sn AS terminalSn,
t1.terminal_no AS terminalNo,
t1.terminal_type AS terminalType,
t1.terminal_model AS terminalModel,
t1.terminal_version AS terminalVersion,
t1.terminal_address AS terminalAddress,
t1.terminal_source AS terminalSource,
t1.terminal_property AS terminalProperty,
t2.store_no AS storeNo,
t2.store_id AS storeId,
t2.store_name AS storeName,
t2.store_contact AS storeContact,
t2.store_phone AS storePhone,
t2.store_address AS storeAddress,
t2.special_num AS specialNum,
t2.shop_name AS shopName,
t2.store_type AS storeType,
t2.products AS products,
t2.tip_tool AS tipTool,
t2.ins_fre AS insFre,
t2.task_id AS taskId,
t2.lower_task_id AS lowerTaskId,
t2.register_address AS registerAddress,
t2.legal_name AS legalName,
t2.account_manager AS accountManager,
t3.management_code AS managementCode,
t3.geographic_location AS geographicLocation,
t3.geographic_address AS geographicAddress
select t1.terminal_id AS terminalId,
t1.terminal_sn AS terminalSn,
t1.terminal_no AS terminalNo,
t1.terminal_type AS terminalType,
t1.terminal_model AS terminalModel,
t1.terminal_version AS terminalVersion,
t1.terminal_address AS terminalAddress,
t1.terminal_source AS terminalSource,
t1.terminal_property AS terminalProperty,
t2.store_no AS storeNo,
t2.store_id AS storeId,
t2.store_name AS storeName,
t2.store_contact AS storeContact,
t2.store_phone AS storePhone,
t2.store_address AS storeAddress,
t2.special_num AS specialNum,
t2.shop_name AS shopName,
t2.store_type AS storeType,
t2.products AS products,
t2.tip_tool AS tipTool,
t2.ins_fre AS insFre,
t2.task_id AS taskId,
t2.lower_task_id AS lowerTaskId,
t2.register_address AS registerAddress,
t2.legal_name AS legalName,
t2.account_manager AS accountManager,
t3.management_code AS managementCode,
t3.geographic_location AS geographicLocation,
t3.geographic_address AS geographicAddress
from st_terminal t1
left join st_store t2 on t1.store_id = t2.store_id
left join st_terminal_ins t3 on t3.terminal_id = t1.terminal_id
<where>
t1.del_state = 0
<if test="query.taskId != null">
AND t1.task_id = #{query.taskId}
</if>
<if test="query.nos != null and query.nos.size > 0">
AND t1.store_no in
<foreach collection="query.nos" item="no" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="query.terminalNos != null and query.terminalNos.size > 0">
AND t1.terminal_no in
<foreach collection="query.terminalNos" item="no" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="query.terminalIds != null and query.terminalIds.size > 0">
AND t1.terminal_id in
<foreach collection="query.terminalIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
left join st_store t2 on t1.store_id = t2.store_id
left join st_terminal_ins t3 on t3.terminal_id = t1.terminal_id
WHERE t1.del_state = 0
<if test="query.taskId != null">
AND t1.task_id = #{query.taskId}
</if>
<if test="query.nos != null and query.nos.size > 0">
AND t2.store_no in
<foreach collection="query.nos" item="no" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="query.terminalNos != null and query.terminalNos.size > 0">
AND t1.terminal_no in
<foreach collection="query.terminalNos" item="no" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="query.terminalIds != null and query.terminalIds.size > 0">
AND t1.terminal_id in
<foreach collection="query.terminalIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
</mapper>

View File

@ -1,7 +1,7 @@
<?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.chushang.inspection.work.mapper.WrkInfoMapper">
<select id="queryDispatchPage" resultType="com.chushang.inspection.work.vo.WrkInfoDetailsVO">
<select id="queryDispatchPage" resultMap="wrkInfoDetailsVOResult">
<include refid="wrkInfoDetailSql" />
<if test="1 == 1">
${query.sqlParam.get('sqlWhere')}
@ -17,7 +17,7 @@
ORDER BY i.create_time desc
</select>
<select id="queryArchivePage" resultType="com.chushang.inspection.work.vo.WrkInfoDetailsVO">
<select id="queryArchivePage" resultMap="wrkInfoDetailsVOResult">
<include refid="wrkInfoDetailSql" />
<if test="1 == 1">
${query.sqlParam.get('sqlWhere')}
@ -138,7 +138,7 @@
<result column="inspection_time" property="inspectionTime" />
</association>
</resultMap>
<select id="listInsTemplate" resultType="com.chushang.inspection.work.vo.WrkInfoDetailsVO">
<select id="listInsTemplate" resultMap="wrkInfoDetailsVOResult">
<include refid="wrkInfoDetailSql" />
<if test="1 == 1">
${query.sqlParam.get('sqlWhere')}

View File

@ -0,0 +1,38 @@
import com.chushang.InspectionApplication;
import com.chushang.inspection.work.query.DispatchQuery;
import com.chushang.inspection.work.service.WrkInfoService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = InspectionApplication.class)
public class InsTest {
@Resource
WrkInfoService wrkInfoService;
@Test
public void test(){
DispatchQuery query = new DispatchQuery();
query.setTerminalIds(List.of(1815687260161114113L));
query.setTaskId(1808384396409679874L);
query.setUserId(1805497601669918722L);
query.setWorkType(20);
query.setEndTime(LocalDateTime.of(2024, 7, 31, 0, 0, 0));
query.setWorkSort(1);
query.setRemark("111");
query.setWorkSource(3);
query.setNos(List.of("1242"));
query.setTerminalNos(List.of("235"));
query.setOccupy(0);
wrkInfoService.dispatch(query, 0);
}
}