Commit 1db16306 authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!217
parents 105429f9 93f0abb8
...@@ -38,6 +38,50 @@ public class OrderConstants { ...@@ -38,6 +38,50 @@ public class OrderConstants {
* 订单编号不能为空 * 订单编号不能为空
*/ */
public static final String ORDER_NO_IS_EMPTY = "订单编号不能为空"; public static final String ORDER_NO_IS_EMPTY = "订单编号不能为空";
/**
* 下单人不能为空
*/
public static final String ORDER_NAME_IS_EMPTY = "下单人不能为空";
/**
* 下单时间不能为空
*/
public static final String ORDER_TIME_IS_EMPTY = "下单时间不能为空";
/**
* 项目编码不能为空
*/
public static final String DEPT_NO_IS_EMPTY = "项目编码不能为空";
/**
* 项目名称不能为空
*/
public static final String DEPT_NAME_IS_EMPTY = "项目名称不能为空";
/**
* 客户名称不能为空
*/
public static final String CUSTOMER_NAME_IS_EMPTY = "客户名称不能为空";
/**
* 订单状态不能为空
*/
public static final String ORDER_STATUS_IS_EMPTY = "订单状态不能为空";
/**
* 订单内容不能为空
*/
public static final String ORDER_CONTENT_IS_EMPTY = "订单内容不能为空";
/**
* 订单内容,200字以内
*/
public static final String ORDER_CONTENT_MORE_THAN_200 = "订单内容,200字以内";
/**
* 处理人不能为空
*/
public static final String HANDLE_USER_IS_EMPTY = "处理人不能为空";
/**
* 回复人不能为空
*/
public static final String REPLY_NAME_IS_EMPTY = "回复人不能为空";
/**
* 回复时间不能为空
*/
public static final String REPLY_TIME_IS_EMPTY = "回复时间不能为空";
/** /**
* 回复内容和附件,两者必填其一 * 回复内容和附件,两者必填其一
*/ */
......
...@@ -71,7 +71,6 @@ public class TOrder implements Serializable { ...@@ -71,7 +71,6 @@ public class TOrder implements Serializable {
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间(下单时间)") @Schema(description = "创建时间(下单时间)")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
...@@ -91,7 +90,7 @@ public class TOrder implements Serializable { ...@@ -91,7 +90,7 @@ public class TOrder implements Serializable {
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间") @Schema(description = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
......
package com.yifu.cloud.plus.v1.yifu.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 订单处理人表 t_order_handler
* @date 2022-08-31 09:20:16
*/
@Data
@TableName("t_order_handler")
@Schema(description = "订单处理人表")
public class TOrderHandler implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 订单处理人(用户名)
*/
@Schema(description = "订单处理人(用户名)")
private String handleUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
...@@ -47,7 +47,6 @@ public class TOrderReply implements Serializable { ...@@ -47,7 +47,6 @@ public class TOrderReply implements Serializable {
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间(回复时间)") @Schema(description = "创建时间(回复时间)")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
......
package com.yifu.cloud.plus.v1.yifu.order.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author licancan
* @description 订单新增vo
* @date 2022-08-31 08:36:32
*/
@Data
public class OrderAddVO implements Serializable {
private static final long serialVersionUID = 6620652346415180825L;
/**
* 创建人姓名(下单人)
*/
@Schema(description = "创建人姓名(下单人)")
private String createName;
/**
* 创建时间(下单时间)
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间(下单时间)")
private LocalDateTime createTime;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema(description = "订单状态 0待办理 1办理中 2已办结")
private Integer orderStatus;
/**
* 订单内容
*/
@Schema(description = "订单内容")
private String orderContent;
/**
* 指派人(处理人)
*/
@Schema(description = "指派人(处理人)")
private List<String> handleUserList;
/**
* 附件
*/
@Schema(description = "附件")
private MultipartFile[] file;
}
package com.yifu.cloud.plus.v1.yifu.order.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author licancan
* @description 订单回复新增vo
* @date 2022-08-31 08:36:32
*/
@Data
public class OrderReplyAddVO implements Serializable {
private static final long serialVersionUID = 5043110315841697190L;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 回复内容
*/
@Schema(description = "回复内容")
private String replyContent;
/**
* 创建人姓名(回复人)
*/
@Schema(description = "创建人姓名(回复人)")
private String createName;
/**
* 创建时间(回复时间)
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间(回复时间)")
private LocalDateTime createTime;
/**
* 附件
*/
@Schema(description = "附件")
private MultipartFile[] file;
}
package com.yifu.cloud.plus.v1.yifu.order.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderService;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderAddVO;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyAddVO;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
/**
* @author licancan
* @description 接收ekp订单controller
* @date 2022-08-31 08:54:06
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/ekp/order")
@Tag(name = "接收ekp订单相关")
public class EkpOrderController {
@Resource
private TOrderService tOrderService;
/**
* 接收处理ekp订单
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
@Schema(description = "接收处理ekp订单")
@PostMapping(value = "/receiveOrder")
public R receiveOrder(OrderAddVO vo) throws IOException {
return tOrderService.receiveOrder(vo);
}
/**
* 接收处理ekp订单回复
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
@Schema(description = "接收处理ekp订单回复")
@PostMapping(value = "/receiveOrderReply")
public R receiveOrderReply(OrderReplyAddVO vo) throws IOException {
return tOrderService.receiveOrderReply(vo);
}
}
package com.yifu.cloud.plus.v1.yifu.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler;
import org.apache.ibatis.annotations.Mapper;
/**
* @author licancan
* @description 针对表【t_order_handler(订单处理人表)】的数据库操作Mapper
* @date 2022-08-31 09:20:16
*/
@Mapper
public interface TOrderHandlerMapper extends BaseMapper<TOrderHandler> {
}
package com.yifu.cloud.plus.v1.yifu.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler;
/**
* @author licancan
* @description 针对表【t_order_handler(订单处理人表)】的数据库操作Service
* @date 2022-08-31 09:20:16
*/
public interface TOrderHandlerService extends IService<TOrderHandler> {
}
...@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder; import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO; import com.yifu.cloud.plus.v1.yifu.order.vo.*;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
...@@ -91,4 +88,24 @@ public interface TOrderService extends IService<TOrder> { ...@@ -91,4 +88,24 @@ public interface TOrderService extends IService<TOrder> {
* @return {@link IPage< OrderReplyListVO>} * @return {@link IPage< OrderReplyListVO>}
*/ */
IPage<OrderReplyListVO> getOrderReplyPageList(Page<OrderReplyListVO> page, String orderNo); IPage<OrderReplyListVO> getOrderReplyPageList(Page<OrderReplyListVO> page, String orderNo);
/**
* 接收处理ekp订单
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
R receiveOrder(OrderAddVO vo) throws IOException;
/**
* 接收处理ekp订单回复
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
R receiveOrderReply(OrderReplyAddVO vo) throws IOException;
} }
package com.yifu.cloud.plus.v1.yifu.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler;
import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderHandlerMapper;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderHandlerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author licancan
* @description 针对表【t_order_handler(订单处理人表)】的数据库操作Service实现
* @date 2022-08-31 09:20:16
*/
@Slf4j
@Service
public class TOrderHandlerServiceImpl extends ServiceImpl<TOrderHandlerMapper, TOrderHandler> implements TOrderHandlerService {
}
...@@ -14,7 +14,6 @@ import org.springframework.stereotype.Service; ...@@ -14,7 +14,6 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
public class TOrderReplyServiceImpl extends ServiceImpl<TOrderReplyMapper, TOrderReply> public class TOrderReplyServiceImpl extends ServiceImpl<TOrderReplyMapper, TOrderReply> implements TOrderReplyService {
implements TOrderReplyService {
} }
...@@ -13,21 +13,21 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; ...@@ -13,21 +13,21 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants; import com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder; import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure; import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderReply; import com.yifu.cloud.plus.v1.yifu.order.entity.TOrderReply;
import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper; import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService; import com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderHandlerService;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderReplyService; import com.yifu.cloud.plus.v1.yifu.order.service.TOrderReplyService;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderService; import com.yifu.cloud.plus.v1.yifu.order.service.TOrderService;
import com.yifu.cloud.plus.v1.yifu.order.util.ValidityUtil; import com.yifu.cloud.plus.v1.yifu.order.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO; import com.yifu.cloud.plus.v1.yifu.order.vo.*;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -36,8 +36,8 @@ import javax.annotation.Resource; ...@@ -36,8 +36,8 @@ import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -53,6 +53,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme ...@@ -53,6 +53,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
@Resource @Resource
private TOrderReplyService tOrderReplyService; private TOrderReplyService tOrderReplyService;
@Resource @Resource
private TOrderHandlerService tOrderHandlerService;
@Resource
private OSSUtil ossUtil; private OSSUtil ossUtil;
/** /**
...@@ -243,7 +245,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme ...@@ -243,7 +245,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
try { try {
tOrderEnclosureService.save(orderEnclosure); tOrderEnclosureService.save(orderEnclosure);
} catch (Exception e) { } catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage()); log.error("回复附件OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key); ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage()); return R.failed("failed:" + e.getMessage());
} }
...@@ -283,4 +285,165 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme ...@@ -283,4 +285,165 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
return orderReplyList; return orderReplyList;
} }
/**
* 接收处理ekp订单
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R receiveOrder(OrderAddVO vo) throws IOException{
if (Common.isEmpty(vo.getOrderNo())){
return R.failed(OrderConstants.ORDER_NO_IS_EMPTY);
}
if (Common.isEmpty(vo.getCreateName())){
return R.failed(OrderConstants.ORDER_NAME_IS_EMPTY);
}
if (Common.isEmpty(vo.getCreateTime())){
return R.failed(OrderConstants.ORDER_TIME_IS_EMPTY);
}
if (Common.isEmpty(vo.getDeptNo())){
return R.failed(OrderConstants.DEPT_NO_IS_EMPTY);
}
if (Common.isEmpty(vo.getDeptName())){
return R.failed(OrderConstants.DEPT_NAME_IS_EMPTY);
}
if (Common.isEmpty(vo.getCustomerName())){
return R.failed(OrderConstants.CUSTOMER_NAME_IS_EMPTY);
}
if (Common.isEmpty(vo.getOrderStatus())){
return R.failed(OrderConstants.ORDER_STATUS_IS_EMPTY);
}
if (Common.isEmpty(vo.getOrderContent())){
return R.failed(OrderConstants.ORDER_CONTENT_IS_EMPTY);
}
if (!Common.isEmpty(vo.getOrderContent()) && !ValidityUtil.validate200(vo.getOrderContent())){
return R.failed(OrderConstants.ORDER_CONTENT_MORE_THAN_200);
}
if (CollectionUtils.isEmpty(vo.getHandleUserList())){
return R.failed(OrderConstants.HANDLE_USER_IS_EMPTY);
}
TOrder order = new TOrder();
BeanUtils.copyProperties(vo,order);
boolean save = this.save(order);
//处理指派人
if (save && CollectionUtils.isNotEmpty(vo.getHandleUserList())){
List<TOrderHandler> list = new ArrayList<>();
vo.getHandleUserList().stream().forEach(e ->{
TOrderHandler handler = new TOrderHandler();
handler.setOrderNo(vo.getOrderNo());
handler.setHandleUser(e);
list.add(handler);
});
tOrderHandlerService.saveBatch(list);
}
if (save && ArrayUtils.isNotEmpty(vo.getFile())){
for (MultipartFile multipartFile : vo.getFile()) {
String fileName = System.currentTimeMillis() + "_" + multipartFile.getOriginalFilename();
//filePath不传默认存储空间的根目录
//支持的附件格式
String key = fileName;
boolean flag = ossUtil.uploadFileByStream(multipartFile.getInputStream(), key, null);
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
TOrderEnclosure orderEnclosure = new TOrderEnclosure();
orderEnclosure.setOrderNo(order.getOrderNo());
orderEnclosure.setEnclosureName(multipartFile.getOriginalFilename());
orderEnclosure.setEnclosureFlag(CommonConstants.ZERO_INT);
orderEnclosure.setEnclosureAddress(key);
orderEnclosure.setDeleteFlag(CommonConstants.ZERO_INT);
try {
tOrderEnclosureService.save(orderEnclosure);
} catch (Exception e) {
log.error("订单接收OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
} else {
return R.failed(OrderConstants.OPERATE_FAILED);
}
}
}
return R.ok(OrderConstants.OPERATE_SUCCESS);
}
/**
* 接收处理ekp订单回复
*
* @author licancan
* @param vo
* @return {@link R}
* @throws IOException
*/
@Override
public R receiveOrderReply(OrderReplyAddVO vo) throws IOException{
if (Common.isEmpty(vo.getOrderNo())){
return R.failed(OrderConstants.ORDER_NO_IS_EMPTY);
}
if (Common.isEmpty(vo.getCreateName())){
return R.failed(OrderConstants.REPLY_NAME_IS_EMPTY);
}
if (Common.isEmpty(vo.getCreateTime())){
return R.failed(OrderConstants.REPLY_TIME_IS_EMPTY);
}
if (Common.isEmpty(vo.getReplyContent()) && ArrayUtils.isEmpty(vo.getFile())){
return R.failed(OrderConstants.REPLY_CONTENT_AND_ENCLOSURE_IS_EMPTY);
}
// 校验回复内容200字以内
if (!Common.isEmpty(vo.getReplyContent()) && !ValidityUtil.validate200(vo.getReplyContent())){
return R.failed(OrderConstants.REPLY_CONTENT_MORE_THAN_200);
}
if (ArrayUtils.isNotEmpty(vo.getFile())){
if (vo.getFile().length > CommonConstants.TWENTY_INT){
return R.failed(OrderConstants.ENCLOSURE_SIZE_ERROR);
}
for (MultipartFile multipartFile : vo.getFile()) {
if(!Common.checkInsuranceFile(multipartFile.getOriginalFilename())){
return R.failed(OrderConstants.ENCLOSURE_TYPE_IS_ERROR);
}
if (multipartFile.getSize() > (CommonConstants.FIFTY_INT*CommonConstants.BYTE*CommonConstants.BYTE)){
return R.failed(OrderConstants.ENCLOSURE_SIZE_ERROR);
}
}
}
TOrderReply reply = new TOrderReply();
BeanUtils.copyProperties(vo,reply);
reply.setReplyContent(Common.isEmpty(vo.getReplyContent())?null:vo.getReplyContent());
reply.setDeleteFlag(CommonConstants.ZERO_INT);
boolean save = tOrderReplyService.save(reply);
if (save && ArrayUtils.isNotEmpty(vo.getFile())){
for (MultipartFile multipartFile : vo.getFile()) {
String fileName = System.currentTimeMillis() + "_" + multipartFile.getOriginalFilename();
//filePath不传默认存储空间的根目录
//支持的附件格式
String key = fileName;
boolean flag = ossUtil.uploadFileByStream(multipartFile.getInputStream(), key, null);
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
TOrderEnclosure orderEnclosure = new TOrderEnclosure();
orderEnclosure.setOrderNo(reply.getId());
orderEnclosure.setEnclosureName(multipartFile.getOriginalFilename());
orderEnclosure.setEnclosureFlag(CommonConstants.ONE_INT);
orderEnclosure.setEnclosureAddress(key);
orderEnclosure.setDeleteFlag(CommonConstants.ZERO_INT);
try {
tOrderEnclosureService.save(orderEnclosure);
} catch (Exception e) {
log.error("订单回复接收OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
} else {
return R.failed(OrderConstants.OPERATE_FAILED);
}
}
}
return R.ok(OrderConstants.OPERATE_SUCCESS);
}
} }
...@@ -39,6 +39,8 @@ security: ...@@ -39,6 +39,8 @@ security:
- /v3/api-docs - /v3/api-docs
- /actuator/** - /actuator/**
- /swagger-ui/** - /swagger-ui/**
- /ekp/order/receiveOrder
- /ekp/order/receiveOrderReply
......
<?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.yifu.cloud.plus.v1.yifu.order.mapper.TOrderHandlerMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="handleUser" column="HANDLE_USER" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,ORDER_NO,HANDLE_USER
</sql>
</mapper>
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