Commit f1001688 authored by lining's avatar lining

feat: 预约下单接口img信息处理

parent e09a6220
...@@ -13,5 +13,8 @@ public class BizConstants { ...@@ -13,5 +13,8 @@ public class BizConstants {
public static final String ORDER_ID = "orderId"; public static final String ORDER_ID = "orderId";
} }
public static class FormatConstants {
public static final String CATEGORY_SUBCLASS_SERVICE_NAME = "%s-%s";
}
} }
package com.onsiteservice.dao.component;
import com.onsiteservice.dao.mapper.service.ServiceOrderImgMapper;
import com.onsiteservice.dao.mapper.service.ServiceOrderLogMapper;
import com.onsiteservice.entity.order.ServiceOrder;
import com.onsiteservice.entity.service.ServiceOrderImg;
import com.onsiteservice.entity.service.ServiceOrderLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/14 10:08
*/
@Component
@Slf4j
public class RecordComponent {
@Resource
private ServiceOrderImgMapper serviceOrderImgMapper;
@Resource
private ServiceOrderLogMapper serviceOrderLogMapper;
@Async
public void recordServiceOrderImg(ServiceOrder serviceOrder, List<String> urls) {
log.info("recordServiceOrderImg serviceOrder: {}, urls: {}", serviceOrder, urls);
if (CollectionUtils.isEmpty(urls)) {
return;
}
List<ServiceOrderImg> serviceOrderImgList = urls
.parallelStream().map(url -> {
ServiceOrderImg serviceOrderImg = new ServiceOrderImg();
serviceOrderImg.setOrderId(serviceOrder.getId());
serviceOrderImg.setUrl(url);
serviceOrderImg.setCreateTime(new Date());
return serviceOrderImg;
}).collect(Collectors.toList());
serviceOrderImgMapper.insertList(serviceOrderImgList);
}
@Async
public void recordProcess(Long orderId, Integer processId, String description, Long hostId, String remark) {
log.info("recordProcess orderId: {}, processId: {}, description: {}, hostId: {}, remark: {}",
orderId, processId, description, hostId, remark);
ServiceOrderLog serviceOrderLog = new ServiceOrderLog();
serviceOrderLog.setOrderId(orderId);
serviceOrderLog.setProcessId(processId);
serviceOrderLog.setDescription(description);
serviceOrderLog.setHostId(hostId);
serviceOrderLog.setRemark(remark);
serviceOrderLogMapper.insertSelective(serviceOrderLog);
}
}
package com.onsiteservice.dao.mapper.service;
import com.onsiteservice.dao.common.Mapper;
import com.onsiteservice.entity.service.ServiceOrderImg;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ServiceOrderImgMapper extends Mapper<ServiceOrderImg> {
List<ServiceOrderImg> selectByOrderIdList(@Param("list") List<Long> orderIdList);
}
\ No newline at end of file
...@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service; ...@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service;
import com.onsiteservice.dao.common.Mapper; import com.onsiteservice.dao.common.Mapper;
import com.onsiteservice.entity.order.ServiceOrder; import com.onsiteservice.entity.order.ServiceOrder;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ServiceOrderMapper extends Mapper<ServiceOrder> { public interface ServiceOrderMapper extends Mapper<ServiceOrder> {
List<ServiceOrder> selectServiceOrderPage(@Param("orderStatus") Integer orderStatus);
} }
\ No newline at end of file
<?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.onsiteservice.dao.mapper.service.ServiceOrderImgMapper">
<resultMap id="BaseResultMap" type="com.onsiteservice.entity.service.ServiceOrderImg">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="order_id" jdbcType="BIGINT" property="orderId"/>
<result column="url" jdbcType="VARCHAR" property="url"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<select id="selectByOrderIdList" resultType="com.onsiteservice.entity.service.ServiceOrderImg">
select * from service_order_img where order_id in
<foreach collection="list" open="(" separator="," close=")" item="orderId">
#{orderId}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.onsiteservice.dao.mapper.service.ServiceOrderMapper"> <mapper namespace="com.onsiteservice.dao.mapper.service.ServiceOrderMapper">
<resultMap id="BaseResultMap" type="com.onsiteservice.entity.order.ServiceOrder">
<!-- <select id="selectServiceOrderPage" resultType="com.onsiteservice.entity.order.ServiceOrder">
WARNING - @mbg.generated select *
--> from service_order
<id column="id" jdbcType="BIGINT" property="id" /> where
<result column="account_no" jdbcType="BIGINT" property="accountNo" /> 1=1
<result column="address_id" jdbcType="BIGINT" property="addressId" /> <if test="orderStatus != 0">
<result column="expect_arrival_time" jdbcType="TIMESTAMP" property="expectArrivalTime" /> and order_status = #{orderStatus,jdbcType=INTEGER}
<result column="num" jdbcType="INTEGER" property="num" /> </if>
<result column="demand_img" jdbcType="VARCHAR" property="demandImg" /> order by create_time asc
<result column="demand_desc" jdbcType="VARCHAR" property="demandDesc" /> </select>
<result column="read_agreement" jdbcType="INTEGER" property="readAgreement" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="order_status" jdbcType="INTEGER" property="orderStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
</resultMap>
</mapper> </mapper>
\ No newline at end of file
...@@ -31,6 +31,13 @@ public class ServiceOrder implements Serializable { ...@@ -31,6 +31,13 @@ public class ServiceOrder implements Serializable {
@ApiModelProperty("订单号") @ApiModelProperty("订单号")
private String orderNo; private String orderNo;
/**
* 服务名
*/
@Column(name = "service_name")
@ApiModelProperty("服务名")
private String serviceName;
/** /**
* 账号 * 账号
*/ */
......
package com.onsiteservice.entity.service;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
@ApiModel("订单图片表")
@Table(name = "service_order_img")
public class ServiceOrderImg implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("")
private Long id;
/**
* 订单id
*/
@Column(name = "order_id")
@ApiModelProperty("订单id")
private Long orderId;
/**
* 图片oss地址
*/
@ApiModelProperty("图片oss地址")
private String url;
/**
* 创建时间
*/
@Column(name = "create_time")
@ApiModelProperty("创建时间")
private Date createTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
...@@ -49,7 +49,7 @@ public class ServiceOrderController { ...@@ -49,7 +49,7 @@ public class ServiceOrderController {
@ApiOperation(value = "分页查询订单") @ApiOperation(value = "分页查询订单")
@PostMapping("page") @PostMapping("page")
public Result<PageInfoVO<ServiceOrderVO>> getPage(@RequestBody @NonNull @Validated PageServiceOrderDTO dto, @CurrentUserId Long userId) { public Result<PageInfoVO<ServiceOrderVO>> getPage(@RequestBody @NonNull @Validated PageServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.selectByUserId(dto, userId); return serviceOrderService.getPage(dto, userId);
} }
@ApiOperation(value = "订单预约") @ApiOperation(value = "订单预约")
......
...@@ -7,7 +7,9 @@ import lombok.Data; ...@@ -7,7 +7,9 @@ import lombok.Data;
import javax.validation.constraints.Future; import javax.validation.constraints.Future;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@ApiModel("订单预约请求模型") @ApiModel("订单预约请求模型")
...@@ -60,4 +62,8 @@ public class ReserveServiceOrderDTO { ...@@ -60,4 +62,8 @@ public class ReserveServiceOrderDTO {
@NotNull(message = "请确认是否阅读协议") @NotNull(message = "请确认是否阅读协议")
private Boolean readAgreement; private Boolean readAgreement;
@ApiModelProperty("服务图片数组")
@Size(max = 8, message = "最多上传8张图片")
private List<String> urls;
} }
\ No newline at end of file
package com.onsiteservice.miniapp.controller.order.vo; package com.onsiteservice.miniapp.controller.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
public class ServiceOrderVO { public class ServiceOrderVO {
...@@ -47,4 +41,6 @@ public class ServiceOrderVO { ...@@ -47,4 +41,6 @@ public class ServiceOrderVO {
private Date modifyTime; private Date modifyTime;
private List<String> urls;
} }
\ No newline at end of file
...@@ -14,6 +14,6 @@ import java.util.List; ...@@ -14,6 +14,6 @@ import java.util.List;
*/ */
public interface ServiceOrderBizMapper { public interface ServiceOrderBizMapper {
List<ServiceOrder> selectServiceOrderPage(@Param("dto") PageServiceOrderDTO dto, @Param("uid") Long uid); List<ServiceOrder> selectServiceOrderPage(@Param("dto") PageServiceOrderDTO dto, @Param("userId") Long userId);
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
select * select *
from service_order from service_order
where where
account_no = #{uid,jdbcType=BIGINT} account_no = #{userId,jdbcType=BIGINT}
<if test="dto.orderStatus != 0"> <if test="dto.orderStatus != 0">
and order_status = #{dto.orderStatus,jdbcType=INTEGER} and order_status = #{dto.orderStatus,jdbcType=INTEGER}
</if> </if>
......
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