Commit 4b3031b8 authored by lining's avatar lining

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

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