增加pad接口:服务指令工单转单、协助执行
This commit is contained in:
parent
e1e1adc9c8
commit
6e2d793c18
|
|
@ -110,7 +110,22 @@ public class ServiceOrderApi {
|
|||
@ApiOperation(value="服务指令工单-转单", notes="服务指令工单-转单")
|
||||
@AutoLog(value = "服务指令工单-转单",clientType="app", operateType = 3)
|
||||
@PostMapping(value = "/transferOrder")
|
||||
public Result<String> transferOrder(@RequestBody DirectiveOrderEntity directiveOrderEntity) {
|
||||
public Result<String> transferOrder(@RequestBody DirectiveOrderSubEntity dto) {
|
||||
if(StringUtils.isBlank(dto.getMainId()) ){
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
directiveOrderApi.transferOrder(dto);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
@ApiOperation(value="服务指令工单-协助执行", notes="服务指令工单-协助执行")
|
||||
@AutoLog(value = "服务指令工单-协助执行",clientType="app", operateType = 3)
|
||||
@PostMapping(value = "/assistOrder")
|
||||
public Result<String> assistOrder(@RequestBody DirectiveOrderSubEntity dto) {
|
||||
if(StringUtils.isBlank(dto.getMainId()) ){
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
directiveOrderApi.assistOrder(dto);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,4 +51,7 @@ public interface IDirectiveOrderApi {
|
|||
|
||||
Map<String, Object> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity);
|
||||
|
||||
void transferOrder(DirectiveOrderSubEntity dto);
|
||||
|
||||
void assistOrder(DirectiveOrderSubEntity dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nu.modules.biz.order.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -29,7 +30,7 @@ import java.util.*;
|
|||
/**
|
||||
* @Description: 服务指令工单主表
|
||||
* @Author: caolei
|
||||
* @Date: 2025-11-18
|
||||
* @Date: 2025-11-18
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
|
@ -54,20 +55,20 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
@Override
|
||||
public DirectiveOrderEntity selectInfoById(String id) {
|
||||
DirectiveOrderEntity result = new DirectiveOrderEntity();
|
||||
BeanUtils.copyProperties(baseMapper.selectInfoById(id),result);
|
||||
BeanUtils.copyProperties(baseMapper.selectInfoById(id), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DirectiveOrderEntity> queryOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req) {
|
||||
DirectiveOrder directiveOrder = new DirectiveOrder();
|
||||
BeanUtils.copyProperties(directiveOrderEntity,directiveOrder);
|
||||
BeanUtils.copyProperties(directiveOrderEntity, directiveOrder);
|
||||
QueryWrapper<DirectiveOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("nu_id",directiveOrderEntity.getNuId());
|
||||
queryWrapper.eq("iz_finish","N");
|
||||
queryWrapper.eq(StringUtils.isNotBlank(directiveOrderEntity.getEmployeeId()),"employee_id",directiveOrderEntity.getEmployeeId());
|
||||
queryWrapper.eq("nu_id", directiveOrderEntity.getNuId());
|
||||
queryWrapper.eq("iz_finish", "N");
|
||||
queryWrapper.eq(StringUtils.isNotBlank(directiveOrderEntity.getEmployeeId()), "employee_id", directiveOrderEntity.getEmployeeId());
|
||||
Page<DirectiveOrder> page = new Page<>(pageNo, pageSize);
|
||||
List<DirectiveOrder> list = baseMapper.selectList(page,queryWrapper);
|
||||
List<DirectiveOrder> list = baseMapper.selectList(page, queryWrapper);
|
||||
IPage<DirectiveOrderEntity> entityPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||
entityPage.setRecords(BeanUtil.copyToList(list, DirectiveOrderEntity.class));
|
||||
return entityPage;
|
||||
|
|
@ -76,7 +77,7 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
@Override
|
||||
public List<DirectiveOrderSubEntity> queryOrderInfoList(DirectiveOrderSubEntity directiveOrderSubEntity, HttpServletRequest req) {
|
||||
DirectiveOrderSub directiveOrderSub = new DirectiveOrderSub();
|
||||
BeanUtils.copyProperties(directiveOrderSubEntity,directiveOrderSub);
|
||||
BeanUtils.copyProperties(directiveOrderSubEntity, directiveOrderSub);
|
||||
QueryWrapper<DirectiveOrderSub> queryWrapper = QueryGenerator.initQueryWrapper(directiveOrderSub, req.getParameterMap());
|
||||
List<DirectiveOrderSub> list = directiveOrderSubMapper.selectList(queryWrapper);
|
||||
List<DirectiveOrderSubEntity> list1 = new ArrayList<>();
|
||||
|
|
@ -92,17 +93,17 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
directiveOrderSub.setBeginTime(new Date());
|
||||
directiveOrderSubMapper.updateById(directiveOrderSub);
|
||||
|
||||
if(!StringUtils.equals("Y",directiveOrder.getIzStart())){
|
||||
if (!StringUtils.equals("Y", directiveOrder.getIzStart())) {
|
||||
directiveOrder.setIzStart("Y");
|
||||
directiveOrder.setBeginTime(new Date());
|
||||
baseMapper.updateById(directiveOrder);
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("success",true);
|
||||
map.put("message","操作成功");
|
||||
map.put("directiveOrder",directiveOrder);
|
||||
map.put("directiveOrderSub",directiveOrderSub);
|
||||
map.put("success", true);
|
||||
map.put("message", "操作成功");
|
||||
map.put("directiveOrder", directiveOrder);
|
||||
map.put("directiveOrderSub", directiveOrderSub);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -117,8 +118,8 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
directiveOrderSub.setComPrice(directivePriceSub.getComPrice());
|
||||
directiveOrderSubMapper.updateById(directiveOrderSub);
|
||||
|
||||
List<DirectiveOrderSub> list = directiveOrderSubMapper.selectList(new QueryWrapper<DirectiveOrderSub>().eq("main_id",directiveOrder.getId()).ne("iz_finish","Y"));
|
||||
if(list.size()==0){
|
||||
List<DirectiveOrderSub> list = directiveOrderSubMapper.selectList(new QueryWrapper<DirectiveOrderSub>().eq("main_id", directiveOrder.getId()).ne("iz_finish", "Y"));
|
||||
if (list.size() == 0) {
|
||||
directiveOrder.setIzFinish("Y");
|
||||
directiveOrder.setFinishTime(new Date());
|
||||
DirectiveOrder directivePrice = baseMapper.getDirectivePrice(directiveOrder.getDirectiveId());//获取服务指令价格
|
||||
|
|
@ -129,54 +130,54 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("success",true);
|
||||
map.put("message","操作成功");
|
||||
map.put("directiveOrder",directiveOrder);
|
||||
map.put("directiveOrderSub",directiveOrderSub);
|
||||
map.put("success", true);
|
||||
map.put("message", "操作成功");
|
||||
map.put("directiveOrder", directiveOrder);
|
||||
map.put("directiveOrderSub", directiveOrderSub);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DirectiveOrderEntity> queryWorkOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req) {
|
||||
DirectiveOrder directiveOrder = new DirectiveOrder();
|
||||
BeanUtils.copyProperties(directiveOrderEntity,directiveOrder);
|
||||
BeanUtils.copyProperties(directiveOrderEntity, directiveOrder);
|
||||
QueryWrapper<DirectiveOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("nu_id",directiveOrderEntity.getNuId());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(directiveOrderEntity.getEmployeeId()),"employee_id",directiveOrderEntity.getEmployeeId());
|
||||
queryWrapper.eq("nu_id", directiveOrderEntity.getNuId());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(directiveOrderEntity.getEmployeeId()), "employee_id", directiveOrderEntity.getEmployeeId());
|
||||
// 方法1: 使用between查询
|
||||
LocalDateTime todayStart = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
||||
LocalDateTime todayEnd = LocalDateTime.now().withHour(23).withMinute(59).withSecond(59);
|
||||
queryWrapper.between("start_time", todayStart, todayEnd);
|
||||
/**工单类型 1待执行 2已执行 3已完成 4已过期 5待执行或者已执行未完成 空是全部*/
|
||||
if(StringUtils.equals("1",directiveOrderEntity.getWorkType())){
|
||||
queryWrapper.eq("iz_start","N");
|
||||
queryWrapper.eq("iz_finish","N");
|
||||
if (StringUtils.equals("1", directiveOrderEntity.getWorkType())) {
|
||||
queryWrapper.eq("iz_start", "N");
|
||||
queryWrapper.eq("iz_finish", "N");
|
||||
queryWrapper.apply("start_time > now()");
|
||||
queryWrapper.orderByAsc("start_time");
|
||||
}else if(StringUtils.equals("2",directiveOrderEntity.getWorkType())){
|
||||
queryWrapper.eq("iz_start","Y");
|
||||
queryWrapper.eq("iz_finish","N");
|
||||
} else if (StringUtils.equals("2", directiveOrderEntity.getWorkType())) {
|
||||
queryWrapper.eq("iz_start", "Y");
|
||||
queryWrapper.eq("iz_finish", "N");
|
||||
queryWrapper.orderByAsc("start_time");
|
||||
}else if(StringUtils.equals("3",directiveOrderEntity.getWorkType())){
|
||||
queryWrapper.eq("iz_start","Y");
|
||||
queryWrapper.eq("iz_finish","Y");
|
||||
}else if(StringUtils.equals("4",directiveOrderEntity.getWorkType())){
|
||||
queryWrapper.eq("iz_start","N");
|
||||
queryWrapper.eq("iz_finish","N");
|
||||
} else if (StringUtils.equals("3", directiveOrderEntity.getWorkType())) {
|
||||
queryWrapper.eq("iz_start", "Y");
|
||||
queryWrapper.eq("iz_finish", "Y");
|
||||
} else if (StringUtils.equals("4", directiveOrderEntity.getWorkType())) {
|
||||
queryWrapper.eq("iz_start", "N");
|
||||
queryWrapper.eq("iz_finish", "N");
|
||||
queryWrapper.apply("start_time < now()");
|
||||
}else if(StringUtils.equals("5",directiveOrderEntity.getWorkType())){
|
||||
} else if (StringUtils.equals("5", directiveOrderEntity.getWorkType())) {
|
||||
queryWrapper.apply("((iz_start = 'N' and iz_finish='N') or (iz_start='Y' and iz_finish='N'))");
|
||||
}
|
||||
Page<DirectiveOrder> page = new Page<>(pageNo, pageSize);
|
||||
List<DirectiveOrder> list = baseMapper.selectList(page,queryWrapper);
|
||||
List<DirectiveOrder> list = baseMapper.selectList(page, queryWrapper);
|
||||
IPage<DirectiveOrderEntity> entityPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||
entityPage.setRecords(BeanUtil.copyToList(list, DirectiveOrderEntity.class));
|
||||
return entityPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryTodayFinishedTotal(String type,String nuId, String elderId) {
|
||||
return baseMapper.queryTodayFinishedTotal(type,nuId, elderId);
|
||||
public int queryTodayFinishedTotal(String type, String nuId, String elderId) {
|
||||
return baseMapper.queryTodayFinishedTotal(type, nuId, elderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,8 +197,8 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
directiveOrderSub.setManuallyMp4Path(directiveOrderSubEntity.getManuallyMp4Path());
|
||||
directiveOrderSubMapper.updateById(directiveOrderSub);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("success",true);
|
||||
map.put("message","操作成功");
|
||||
map.put("success", true);
|
||||
map.put("message", "操作成功");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -208,21 +209,77 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
directiveOrderSub.setManuallyPicPath(directiveOrderSubEntity.getManuallyPicPath());
|
||||
directiveOrderSubMapper.updateById(directiveOrderSub);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("success",true);
|
||||
map.put("message","操作成功");
|
||||
map.put("success", true);
|
||||
map.put("message", "操作成功");
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成即时服务指令工单
|
||||
*
|
||||
* @param directiveOrderEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity){
|
||||
public Map<String, Object> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity) {
|
||||
DirectiveOrder directiveOrder = new DirectiveOrder();
|
||||
BeanUtils.copyProperties(directiveOrderEntity,directiveOrder);
|
||||
BeanUtils.copyProperties(directiveOrderEntity, directiveOrder);
|
||||
return directiveOrderService.generateOrdersInstant(directiveOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferOrder(DirectiveOrderSubEntity dto) {
|
||||
DirectiveOrder main = new DirectiveOrder();
|
||||
DirectiveOrderSub sub = new DirectiveOrderSub();
|
||||
|
||||
String optType = "3";//转单
|
||||
|
||||
//执行类型
|
||||
main.setOptType(optType);
|
||||
sub.setOptType(optType);
|
||||
//主要执行人
|
||||
main.setEmployeeId(dto.getEmployeeId());
|
||||
main.setEmployeeName(dto.getEmployeeName());
|
||||
sub.setEmployeeId(dto.getEmployeeId());
|
||||
sub.setEmployeeName(dto.getEmployeeName());
|
||||
//实际执行人
|
||||
main.setOptIds(dto.getEmployeeId());
|
||||
main.setOptNames(dto.getEmployeeName());
|
||||
sub.setOptIds(dto.getEmployeeId());
|
||||
sub.setOptNames(dto.getEmployeeName());
|
||||
|
||||
//修改主表
|
||||
main.setId(dto.getMainId());
|
||||
directiveOrderService.updateById(main);
|
||||
//修改子表
|
||||
UpdateWrapper<DirectiveOrderSub> subUW = new UpdateWrapper<>();
|
||||
subUW.eq("main_id",dto.getMainId());
|
||||
directiveOrderSubMapper.update(sub,subUW);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void assistOrder(DirectiveOrderSubEntity dto) {
|
||||
DirectiveOrder main = new DirectiveOrder();
|
||||
DirectiveOrderSub sub = new DirectiveOrderSub();
|
||||
|
||||
String optType = "2";//协助
|
||||
|
||||
//执行类型
|
||||
main.setOptType(optType);
|
||||
sub.setOptType(optType);
|
||||
//实际执行人
|
||||
main.setOptIds(dto.getOptIds());
|
||||
main.setOptNames(dto.getOptNames());
|
||||
sub.setOptIds(dto.getOptIds());
|
||||
sub.setOptNames(dto.getOptNames());
|
||||
|
||||
//修改主表
|
||||
main.setId(dto.getMainId());
|
||||
directiveOrderService.updateById(main);
|
||||
//修改子表
|
||||
UpdateWrapper<DirectiveOrderSub> subUW = new UpdateWrapper<>();
|
||||
subUW.eq("main_id",dto.getMainId());
|
||||
directiveOrderSubMapper.update(sub,subUW);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue