Commit 4b3031b8 authored by lining's avatar lining

feat: vo添加ApiModelProperty注解+接口合并

parent aec88f6d
package com.onsiteservice.common.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("订单流程值对象")
public class ServiceOrderLogVO {
/**
* 主键
*/
private Long id;
/**
* 订单id
*/
@ApiModelProperty(value = "订单id")
private Long orderId;
/**
* 流程id <link>ServiceOrderStatusEnum</link>
*/
@ApiModelProperty(value = "流程id")
private Integer processId;
/**
* 维修工id或估价员id
*/
private Long hostId;
/**
* 步骤说明
*/
@ApiModelProperty(value = "流程说明")
private String description;
/**
* 备注
*/
@ApiModelProperty(value = "流程备注")
private String remark;
/**
* 创建时间
*/
@ApiModelProperty(value = "流程发生时间")
private Date createTime;
}
\ No newline at end of file
package com.onsiteservice.common.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@ApiModel("订单值对象")
public class ServiceOrderVO {
@ApiModelProperty(value = "订单id")
private Long id;
@ApiModelProperty(value = "订单号")
private String orderNo;
private Long accountNo;
/**
* 地址相关信息
*/
@ApiModelProperty(value = "客户名")
private String name;
@ApiModelProperty(value = "客户手机号")
private String phone;
@ApiModelProperty(value = "客户下单服务地址")
private String address;
private Long addressId;
@ApiModelProperty(value = "期望上门时间")
private Date expectArrivalTime;
@ApiModelProperty(value = "服务数量")
private Integer num;
private String demandImg;
@ApiModelProperty(value = "子类服务图片,待受理标题图片url地址")
private String subclassImg;
@ApiModelProperty(value = "服务说明")
private String demandDesc;
private Integer readAgreement;
@ApiModelProperty(value = "下单备注信息")
private String remark;
private Integer orderStatus;
@ApiModelProperty(value = "订单创建时间")
private Date createTime;
@ApiModelProperty(value = "订单修改时间")
private Date modifyTime;
private List<String> urls;
@ApiModelProperty(value = "客户上传需求图片,最多8张")
private List<String> demandImgUrls;
@ApiModelProperty(value = "订单流程信息")
private List<ServiceOrderLogVO> process;
}
\ No newline at end of file
package com.onsiteservice.miniapp.controller.address.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("地址值对象")
public class ServiceAddressVO {
/**
* 主键
*/
@ApiModelProperty(value = "地址id")
private Long id;
/**
* 姓名
*/
@ApiModelProperty(value = "客户姓名")
private String name;
/**
* 手机或电话
*/
@ApiModelProperty(value = "客户手机号")
private String phone;
/**
* 区域id
*/
@ApiModelProperty(value = "地址所在区域id")
private Long areaId;
/**
* 区域名称路径
*/
@ApiModelProperty(value = "对应区域表name_path字段,例:山东省, 日照市, 东港区")
private String namePath;
/**
* 地址
*/
@ApiModelProperty(value = "详细地址")
private String address;
/**
* 是否默认:1默认地址,0非默认地址
*/
@ApiModelProperty(value = "是否默认地址")
private Boolean def;
}
\ No newline at end of file
package com.onsiteservice.miniapp.controller.category.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("服务大类值对象")
public class ServiceCategoryVO {
@ApiModelProperty(value = "服务大类id")
private Integer id;
@ApiModelProperty(value = "大类服务名")
private String serviceName;
@ApiModelProperty(value = "服务顺序")
private Integer sequence;
@ApiModelProperty(value = "图片url")
private String img;
@ApiModelProperty(value = "子类信息")
private List<ServiceSubclassVO> children;
}
\ No newline at end of file
package com.onsiteservice.miniapp.controller.category.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("子类值对象")
public class ServiceSubclassVO {
@ApiModelProperty(value = "子类id")
private Integer id;
@ApiModelProperty(value = "大类id")
private Integer categoryId;
@ApiModelProperty(value = "子类名称")
private String serviceName;
@ApiModelProperty(value = "顺序")
private Integer sequence;
@ApiModelProperty(value = "图片url")
private String img;
}
\ No newline at end of file
......@@ -132,11 +132,5 @@ public class ServiceOrderController {
return serviceOrderBizService.cancelOrder(dto, userId, ServiceOrderOpSourceEnum.MINI_APP) == 1 ? success() : fail("取消失败");
}
@ApiOperation(value = "订单流程图")
@GetMapping("process/{id}")
public Result<List<ServiceOrderLogVO>> process(@ApiParam(name = "id", value = "订单id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return success(serviceOrderBizService.process(id, userId));
}
}
package com.onsiteservice.miniapp.controller.worker.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
......@@ -13,14 +15,19 @@ import java.util.List;
* @since 2022/7/12 10:06
*/
@Data
@ApiModel("估价员值对象")
public class ServiceValuatorVO {
private List<Date> assignTime;
@ApiModelProperty(value = "估价员id")
private Long id;
@ApiModelProperty(value = "估价员id")
private String name;
@ApiModelProperty(value = "估价员手机号")
private String phone;
@ApiModelProperty(value = "估价员已被指派的时间")
private List<Date> assignTime;
}
package com.onsiteservice.miniapp.controller.worker.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
......@@ -13,16 +15,22 @@ import java.util.List;
* @since 2022/7/12 10:06
*/
@Data
@ApiModel("维修工值对象")
public class ServiceWorkerVO {
private List<Date> assignTime;
@ApiModelProperty(value = "维修工id")
private Long id;
@ApiModelProperty(value = "维修工姓名")
private String name;
@ApiModelProperty(value = "维修工手机号")
private String phone;
@ApiModelProperty(value = "工种")
private String kindName;
@ApiModelProperty(value = "维修工已被指派的时间")
private List<Date> assignTime;
}
package com.onsiteservice.miniapp.service.order;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.onsiteservice.common.order.vo.ServiceOrderLogVO;
import com.onsiteservice.common.order.vo.ServiceOrderVO;
import com.onsiteservice.constant.constant.BizConstants;
......@@ -38,7 +37,10 @@ import org.springframework.util.CollectionUtils;
import tk.mybatis.mapper.entity.Condition;
import javax.annotation.Resource;
import java.util.*;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -89,7 +91,26 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(BizCodeEnum.SERVICE_ORDER_NOT_EXIST);
}
return buildServiceOrderVO(serviceOrderList).get(0);
// 基础订单信息
ServiceOrderVO serviceOrderVO = buildServiceOrderVO(serviceOrderList).get(0);
// 需求图片
Condition c1 = new Condition(ServiceOrderImg.class);
c1.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, serviceOrderVO.getId());
List<ServiceOrderImg> serviceOrderImgList = serviceOrderImgMapper.selectByCondition(c1);
List<String> serviceOrderImgUrlList = serviceOrderImgList.parallelStream().map(ServiceOrderImg::getUrl).collect(Collectors.toList());
serviceOrderVO.setDemandImgUrls(serviceOrderImgUrlList);
// 流程信息
Condition c2 = new Condition(ServiceOrderLog.class);
c2.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, id);
List<ServiceOrderLog> serviceOrderLogList = serviceOrderLogMapper.selectByCondition(c2);
List<ServiceOrderLogVO> serviceOrderLogVOList = serviceOrderLogList.parallelStream()
.map(e -> AttrCopyUtils.copy(e, new ServiceOrderLogVO()))
.sorted(Comparator.comparing(ServiceOrderLogVO::getCreateTime).reversed()).collect(Collectors.toList());
serviceOrderVO.setProcess(serviceOrderLogVOList);
return serviceOrderVO;
}
......@@ -199,16 +220,6 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
}
public List<ServiceOrderLogVO> process(Long id, Long userId) {
log.info("order process id: {}, userId: {}", id, userId);
Condition c = new Condition(ServiceOrderLog.class);
c.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, id);
List<ServiceOrderLog> serviceOrderLogList = serviceOrderLogMapper.selectByCondition(c);
return serviceOrderLogList.parallelStream().map(e -> AttrCopyUtils.copy(e, new ServiceOrderLogVO())).sorted(Comparator.comparing(ServiceOrderLogVO::getCreateTime).reversed()).collect(Collectors.toList());
}
/**
* 未派单订单 用户可实时退款
* 已派单订单 需要管理员审批
......@@ -238,15 +249,13 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
private List<ServiceOrderVO> buildServiceOrderVO(List<ServiceOrder> serviceOrderList) {
// 图片信息
List<Long> orderIdList = serviceOrderList.parallelStream().map(ServiceOrder::getId).collect(Collectors.toList());
List<ServiceOrderImg> serviceOrderImgList = CollectionUtils.isEmpty(orderIdList) ? Lists.newArrayList() : serviceOrderImgMapper.selectByOrderIdList(orderIdList);
Map<Long, List<ServiceOrderImg>> serviceOrderImgMap = serviceOrderImgList.parallelStream().collect(Collectors.groupingBy(ServiceOrderImg::getOrderId));
List<Integer> subclassIdList = serviceOrderList.parallelStream().map(ServiceOrder::getSubclassId).collect(Collectors.toList());
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByIdList(subclassIdList);
Map<Integer, ServiceSubclass> serviceSubclassMap = serviceSubclassList.parallelStream().collect(Collectors.toMap(ServiceSubclass::getId, Function.identity()));
return serviceOrderList.parallelStream().map(e -> {
ServiceOrderVO serviceOrderVO = AttrCopyUtils.copy(e, new ServiceOrderVO());
serviceOrderVO.setUrls(serviceOrderImgMap.getOrDefault(serviceOrderVO.getId(), new ArrayList<>()).parallelStream()
.map(ServiceOrderImg::getUrl).collect(Collectors.toList()));
serviceOrderVO.setSubclassImg(serviceSubclassMap.getOrDefault(e.getSubclassId(), new ServiceSubclass()).getImg());
return serviceOrderVO;
}).collect(Collectors.toList());
......
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