package com.boco.nbd.wios.manage.controller; import cn.hutool.core.lang.Assert; import com.boco.nbd.cams.core.constant.CamsConstant; import com.boco.nbd.cams.core.constant.MessageConstant; import com.boco.nbd.framework.common.ResponseMessage2; import com.boco.nbd.wios.flow.entity.SecretPhone; import com.boco.nbd.wios.flow.entity.bo.SapStatisticsBO; import com.boco.nbd.wios.flow.util.ProcessUtil; import com.boco.nbd.wios.manage.contants.WiosConstant; import com.boco.nbd.wios.manage.entity.bo.*; import com.boco.nbd.wios.manage.entity.common.bo.UploadFile; import com.boco.nbd.wios.manage.service.impl.OrderService; import com.boco.nbd.wios.manage.service.impl.SecretPhoneService; import com.boco.nbd.wios.manage.util.CommonUtils; import com.ihidea.component.api.v2.BaseResponse; import com.ihidea.core.support.exception.ServiceException; import com.ihidea.core.support.session.SessionInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; /** * 订单管理接口 * * @author xgl * @version [版本号, 2020年9月22日] */ @RestController @RequestMapping("api") @Api(tags = "订单管理接口") @ApiIgnore public class OrderController { @Autowired private OrderService orderService; @Autowired private SecretPhoneService spService; private static final String OEM_TYPE = "oemType"; private static final String OEM_ID = "oemId"; /** * 添加订单 * * @param order * @return */ @PostMapping(value = "order/add") @ApiOperation(value = "添加订单信息") @ApiImplicitParams({ @ApiImplicitParam(name = "invoiceTimeStr", value = "发票日期", dataType = "String", paramType = "query", required = false),}) public BaseResponse<Object> add(Order order, String invoiceTimeStr) { Assert.notNull(order.getRegionId(), "区域不能为空"); Assert.notNull(order.getId(), "订单id不能为空"); Assert.notNull(order.getOemId(), "主机厂id不能为空"); if (!StringUtils.isEmpty(invoiceTimeStr)) { OrderBo orderBo = new OrderBo(); orderBo.setInvoiceTimeStr(invoiceTimeStr); order.setInvoiceTime(orderBo.getInvoiceTime()); } //如果是经销商用户新增订单初始化经销商信息 SessionInfo sessionInfo = ProcessUtil.getUserInfo(); if (sessionInfo != null && WiosConstant.OEM_AGENT_TYPE.equals(sessionInfo.getAttribute().get(OEM_TYPE))) { order.setOemAgentId(Integer.valueOf(sessionInfo.getAttribute().get(OEM_ID))); orderService.add(order); } return new BaseResponse<>(); } /** * 修改订单 * * @param order * @return */ @PostMapping(value = "order/update") @ApiOperation(value = "修改订单信息") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "oemId", value = "经销商id", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "outOrderId", value = "安装单号", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "userName", value = "车主姓名", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "userPhone", value = "车主电话", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "regionId", value = "区域id", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "wallboxModel", value = "墙盒型号", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "itemModel", value = "墙盒设备型号", dataType = "String", paramType = "query", required = false),}) public BaseResponse<Object> update(Order order, String invoiceTimeStr) { Assert.notNull(order.getId(), "订单id不能为空"); if (!StringUtils.isEmpty(invoiceTimeStr)) { OrderBo orderBo = new OrderBo(); orderBo.setInvoiceTimeStr(invoiceTimeStr); order.setInvoiceTime(orderBo.getInvoiceTime()); } orderService.update(order.getId(), order); return new BaseResponse<>(); } /** * 批量添加订单 * * @param orderJson * @return */ @PostMapping(value = "order/batchAdd") @ApiOperation(value = "批量添加订单信息") @ApiImplicitParams({ @ApiImplicitParam(name = "orderJson", value = "订单列表json", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> batchAdd(String orderJson) { Assert.notEmpty(orderJson, "参数不能为空"); orderService.batchAdd(orderJson); return new BaseResponse<>(); } /** * 派单 * * @param orderId * @param supplierId * @return */ @PostMapping(value = "order/dispatch") @ApiOperation(value = "派单") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "supplierId", value = "服务商id", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> dispatch(String orderId, Integer supplierId) { if (StringUtils.isEmpty(orderId) || supplierId == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.dispatchOrder(orderId, supplierId); return new BaseResponse<>(); } /** * 查询订单列表 * * @param condition * @return */ @GetMapping(value = "order/all") @ApiOperation(value = "查询订单列表") @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "一页显示数量", dataType = "int", paramType = "query", required = false), @ApiImplicitParam(name = "pagecount", value = "页码", dataType = "int", paramType = "query", required = false), @ApiImplicitParam(name = "oemId", value = "经销商id", dataType = "int", paramType = "query", required = false), @ApiImplicitParam(name = "id", value = "订单号", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "outOrderId", value = "第三方订单号", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "regionId", value = "区域id", dataType = "int", paramType = "query", required = false), @ApiImplicitParam(name = "userName", value = "车主姓名", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "userPhone", value = "车主手机号", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "oemName", value = "经销商名称", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "supplierName", value = "服务商名称", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "oemAgentInfo", value = "经销商信息", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "wallboxNo", value = "墙盒设备编号", dataType = "String", paramType = "query", required = false),}) public BaseResponse<List<OrderVo>> getAll(OrderBo condition) { return new BaseResponse<>(orderService.getList(condition)); } /** * 查询订单安装完成之前列表 * * @param condition * @return */ @GetMapping(value = "order/installComplete") @ApiOperation(value = "查询订单安装完成之前列表") public BaseResponse<List<InstallComplete>> installCompleteList(OrderBo condition) { return new BaseResponse<>(orderService.installCompleteList(condition)); } /** * 转派勘察 * * @param orderId * @param staffId */ @PostMapping(value = "order/survey") @ApiOperation(value = "转派勘察") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "staffId", value = "电工id", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> selectStaff(String orderId, Integer staffId) { if (StringUtils.isEmpty(orderId) || staffId == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.selectStaff(orderId, staffId); return new BaseResponse<>(); } /** * 更换电工 * * @param orderId * @param staffId */ @PostMapping(value = "order/changeStaff") @ApiOperation(value = "更换电工") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "staffId", value = "电工id", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> updateStaff(String orderId, Integer staffId) { if (StringUtils.isEmpty(orderId) || staffId == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.updateStaff(orderId, staffId); return new BaseResponse<>(); } /** * 更换安装服务商 * * @param orderId * @param supplierId */ @PostMapping(value = "order/changeSupplier") @ApiOperation(value = "更换安装服务商") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "supplierId", value = "安装服务商id", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> updateInstallSupplier(String orderId, Integer supplierId) { if (StringUtils.isEmpty(orderId) || supplierId == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.updateInstallSupplier(orderId, supplierId); return new BaseResponse<>(); } /** * 更新订单状态 * * @param orderId * @param status */ @PostMapping(value = "order/updateStatus") @ApiOperation(value = "更新订单状态") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "status", value = "订单状态", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> updateStatus(String orderId, Integer status) { if (StringUtils.isEmpty(orderId) || status == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.updateStatus(orderId, status); return new BaseResponse<>(); } @PostMapping(value = "order/addRemark") @ApiOperation(value = "添加订单备注") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "remark", value = "备注", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "nextTime", value = "下次更新时间", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "tag", value = "标签", dataType = "String", paramType = "query", required = false),}) public BaseResponse<Object> updateSurveyRemark(String orderId, String remark, String nextTime, String tag) { if (StringUtils.isEmpty(orderId) || StringUtils.isEmpty(remark)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.addRemark(orderId, remark, nextTime, tag); return new BaseResponse<>(); } @GetMapping(value = "order/getRemark") @ApiOperation(value = "查询订单备注") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true),}) public BaseResponse<List<OperateLog>> getRemark(String orderId) { if (StringUtils.isEmpty(orderId)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } List<OperateLog> list = orderService.getRemark(orderId); return new BaseResponse<>(list); } /** * 关闭订单 * * @param orderId * @param closeReason */ @PostMapping(value = "order/close") @ApiOperation(value = "关闭订单") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "closeReason", value = "关闭原因", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> closeOrder(String orderId, String closeReason) { if (StringUtils.isEmpty(orderId) || StringUtils.isEmpty(closeReason)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.closeOrder(orderId, closeReason); return new BaseResponse<>(); } /** * 报装 * * @param orderId * @param expandStatus * @param expandFailReason * @param expandFailOperate */ @PostMapping(value = "order/expand") @ApiOperation(value = "报装") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "expandStatus", value = "报装状态 1:通过 2:不通过", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "expandFailReason", value = "报装不通过原因", dataType = "String", paramType = "query", required = false), @ApiImplicitParam(name = "expandFailOperate", value = "报装不通过后订单后续操作", dataType = "int", paramType = "query", required = false),}) public BaseResponse<Object> expand(String orderId, Integer expandStatus, String expandFailReason, Integer expandFailOperate) { if (StringUtils.isEmpty(orderId) || expandStatus == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.expand(orderId, expandStatus, expandFailReason, expandFailOperate); return new BaseResponse<>(); } /** * 预约勘察 * * @param orderId * @param surveyReserveTime * @param surveyClientName * @param surveyClientPhone * @param surveyCamsPhone */ @PostMapping(value = "order/reserveSurvey") @ApiOperation(value = "预约勘察") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyReserveTime", value = "预约时间yyyy-MM-dd HH:mm:ss", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyClientName", value = "勘察客户姓名", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyClientPhone", value = "勘察客户手机号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyCamsPhone", value = "注册CAMS PLUS 手机号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyReserveRemark", value = "备注", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyReserveStatus", value = "0-预约失败,1:预约成功", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "surveyFollowTime", value = "下次跟进时间yyyy-MM-dd HH:mm:ss", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> reserveSurvey(String orderId, String surveyReserveTime, String surveyClientName, String surveyClientPhone, String surveyCamsPhone, String surveyReserveRemark, int surveyReserveStatus, String surveyFollowTime) { Assert.notNull(surveyReserveStatus, "预约状态不能为空"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; Date followDate = null; if (surveyReserveStatus == 1) { try { date = sdf.parse(surveyReserveTime); } catch (ParseException e) { throw new ServiceException("日期格式错误"); } } else { try { followDate = sdf.parse(surveyFollowTime); } catch (ParseException e) { throw new ServiceException("日期格式错误"); } } orderService.reserveSurvey(orderId, date, surveyClientName, surveyClientPhone, surveyCamsPhone, surveyReserveRemark, surveyReserveStatus, followDate); return new BaseResponse<>(); } /** * 预约安装 * * @param orderId * @param installReserveTime * @param installClientName * @param installClientPhone * @param installCamsPhone */ @PostMapping(value = "order/reserveInstall") @ApiOperation(value = "预约安装") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installReserveTime", value = "安装预约时间yyyy-MM-dd HH:mm:ss", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installClientName", value = "安装客户姓名", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installClientPhone", value = "安装客户手机号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installCamsPhone", value = "注册CAMS PLUS 手机号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installReserveRemark", value = "备注", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installReserveStatus", value = "0-预约失败,1:预约成功", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "installFollowTime", value = "下次跟进时间yyyy-MM-dd HH:mm:ss", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> reserveInstall(String orderId, String installReserveTime, String installClientName, String installClientPhone, String installCamsPhone, String installReserveRemark, int installReserveStatus, String installFollowTime) { Assert.notNull(installReserveStatus, "预约状态不能为空"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; Date followDate = null; if (installReserveStatus == 1) { try { date = sdf.parse(installReserveTime); } catch (ParseException e) { throw new ServiceException("日期格式错误"); } } else { try { followDate = sdf.parse(installFollowTime); } catch (ParseException e) { throw new ServiceException("日期格式错误"); } } orderService.reserveInstall(orderId, date, installClientName, installClientPhone, installCamsPhone, installReserveRemark, installReserveStatus, followDate); return new BaseResponse<>(); } /** * 勘察完成审批 * * @param orderId * @param status * @param surveyFinishFailReason */ @PostMapping(value = "order/surveyFinishExamine") @ApiOperation(value = "勘察完成审批") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "status", value = "状态0:不通过 1:通过", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "surveyFinishFailReason", value = "不通过原因", dataType = "String", paramType = "query", required = false),}) public BaseResponse<Object> surveyFinishExamine(String orderId, Integer status, String surveyFinishFailReason) { if (StringUtils.isEmpty(orderId) || status == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.surveyFinishExamine(orderId, status, surveyFinishFailReason); return new BaseResponse<>(); } /** * 安装变更审批 * * @param orderId * @param status * @param installChangeFailReason */ @PostMapping(value = "order/installChangeExamine") @ApiOperation(value = "安装变更审批") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "status", value = "状态0:不通过 1:通过", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installChangeFailReason", value = "不通过原因", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> installChangeExamine(String orderId, Integer status, String installChangeFailReason) { if (StringUtils.isEmpty(orderId) || status == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.installChangeExamine(orderId, status, installChangeFailReason); return new BaseResponse<>(); } /** * 安装完成审批 * * @param orderId * @param status * @param installFinishFailReason */ @PostMapping(value = "order/installFinishExamine") @ApiOperation(value = "安装完成审批") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "status", value = "状态0:不通过 1:通过", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "installFinishFailReason", value = "不通过原因", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> installFinishExamine(String orderId, Integer status, String installFinishFailReason) { if (StringUtils.isEmpty(orderId) || status == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.installFinishExamine(orderId, status, installFinishFailReason); return new BaseResponse<>(); } /** * 填写预约异常信息 * * @param orderId * @param content * @return */ @PostMapping(value = "order/reserveException") @ApiOperation(value = "填写预约异常信息") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "content", value = "内容", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> reserveException(String orderId, String content) { Assert.notNull(orderId, "缺少订单号"); Assert.notNull(content, "缺少内容"); orderService.reserveException(orderId, content); return new BaseResponse<>(); } /** * 查询维保订单列表 * * @param condition * @return */ @GetMapping(value = "order/warrantyList") @ApiOperation(value = "查询维保订单列表") @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "一页显示数量", dataType = "int", paramType = "query", required = false), @ApiImplicitParam(name = "pagecount", value = "页码", dataType = "int", paramType = "query", required = false),}) public BaseResponse<List<WarrantyOrder>> getWarrantyAll(WarrantyOrderBo condition) { return new BaseResponse<>(orderService.getWarrantyOrders(condition)); } /** * 更新车架号 * * @param orderId * @param vehicleVin * @return */ @PostMapping(value = "order/updateVehicleVin") @ApiOperation(value = "更新车架号") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "vehicleVin", value = "车架号", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> updateVehicleVin(String orderId, String vehicleVin) { if (StringUtils.isEmpty(orderId) || StringUtils.isEmpty(vehicleVin)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } orderService.updateVehicleVin(orderId, vehicleVin); return new BaseResponse<>(); } /** * 安装变更提交审批 * * @param orderId * @param name * @param url * @return */ @PostMapping(value = "order/installChange") @ApiOperation(value = "安装变更提交审批") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "name", value = "文件名,多个逗号分割", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "url", value = "文件地址,多个逗号分割", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> installChange(String orderId, String name, String url) { if (StringUtils.isEmpty(orderId) || StringUtils.isEmpty(name) || StringUtils.isEmpty(url)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } String[] nameArr = name.split(CamsConstant.COMMA); List<String> fileNames = Arrays.asList(nameArr); String[] urlArr = url.split(CamsConstant.COMMA); List<String> fileUrls = new ArrayList<>(); for (String s : urlArr) { fileUrls.add(CommonUtils.urlHandle(s)); } orderService.installChange(orderId, fileNames, fileUrls); return new BaseResponse<>(); } /** * 查询订单详情 * * @return */ @GetMapping(value = "order/detail") @ApiOperation(value = "查询订单详情") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "订单id", dataType = "String", paramType = "query", required = true)}) public BaseResponse<OrderVo> detail(String id) { Assert.notNull(id, WiosConstant.EMPTY_ID); return new BaseResponse<>(orderService.getDetail(id)); } /** * 查询订单详情 * * @return */ @GetMapping(value = "order/detailInfo") @ApiOperation(value = "查询订单详情") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "订单id", dataType = "String", paramType = "query", required = true)}) public ResponseMessage2 detailInfo(String id) { Assert.notNull(id, WiosConstant.EMPTY_ID); return ResponseMessage2.Success2(orderService.getMapDetail(id)); } /** * 订单附件上传 * * @param orderId * @param name * @param url * @return */ @PostMapping(value = "order/attachFilesUpload") @ApiOperation(value = "订单附件上传") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "name", value = "文件名,多个逗号分割", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "url", value = "文件地址,多个逗号分割", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> attachFilesUpload(String orderId, String name, String url) { if (StringUtils.isEmpty(orderId) || StringUtils.isEmpty(name) || StringUtils.isEmpty(url)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } String[] nameArr = name.split(CamsConstant.COMMA); List<String> fileNames = Arrays.asList(nameArr); String[] urlArr = url.split(CamsConstant.COMMA); List<String> fileUrls = new ArrayList<>(); for (String s : urlArr) { fileUrls.add(CommonUtils.urlHandle(s)); } orderService.uploadFile(orderId, fileNames, fileUrls); return new BaseResponse<>(); } /** * 查询订单附件列表 * * @param id * @return */ @GetMapping(value = "order/getFiles") @ApiOperation(value = "查询订单附件列表") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "订单id", dataType = "String", paramType = "query", required = true)}) public BaseResponse<List<UploadFile>> getFiles(String id) { Assert.notEmpty(id, WiosConstant.EMPTY_ID); return new BaseResponse<>(orderService.getFiles(id)); } @PostMapping(value = "order/bindVirtualPhone") @ApiOperation(value = "绑定车主手机虚拟号码") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> bindVirtualPhone(String orderId) throws Exception { if (StringUtils.isEmpty(orderId)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } Order order = orderService.get(orderId); if (order != null) { spService.bind(order.getUserPhone()); } return new BaseResponse<>(); } @PostMapping(value = "order/unbindVirtualPhone") @ApiOperation(value = "解绑车主手机虚拟号码") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true),}) public BaseResponse<Object> unbindVirtualPhone(String orderId) throws Exception { if (StringUtils.isEmpty(orderId)) { throw new ServiceException(MessageConstant.MISSING_PARAM); } Order order = orderService.get(orderId); if (order != null) { spService.unbind(order.getUserPhone()); } return new BaseResponse<>(); } @GetMapping(value = "order/getVirtualPhone") @ApiOperation(value = "查询虚拟手机号") @ApiImplicitParams({@ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true)}) public BaseResponse<SecretPhone> getVirtualPhone(String phone) { Assert.notEmpty(phone, "phone不能为空"); return new BaseResponse<>(spService.get(phone)); } /** * @return com.ihidea.component.api.v2.BaseResponse<java.lang.Object> * @Description 提供管理员删除订单功能 * @Param [orderId] * @author liwenxiang * @date 2021/7/28 10:30 */ @PostMapping(value = "order/deleteOrder") @ApiOperation(value = "删除订单") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单号", dataType = "String", paramType = "query", required = true)}) public BaseResponse<Object> deleteOrder(String orderId){ orderService.deleteOrder(orderId); return new BaseResponse<>(); } /** * @Description 手动第一次同步订单到sap * @Param [orderId] * @author xufengyu * @date 2022/2/17 10:30 */ @PostMapping(value = "order/pushOrder") @ApiOperation(value = "同步订单到sap") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单号", dataType = "String", paramType = "query", required = true)}) public ResponseMessage2<SapStatisticsBO> pushOrder(String orderId) { return orderService.pushOrder(orderId); } /** * @Description 手动同步订单到sap * @Param [orderId] * @author xufengyu * @date 2022/2/17 10:30 */ @PostMapping(value = "order/pushNewOrder") @ApiOperation(value = "同步订单到sap") @ApiImplicitParams({ @ApiImplicitParam(name = "orderId", value = "订单号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "newzbrandid", value = "墙盒品牌ID", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "contractId", value = "合同编号", dataType = "Integer", paramType = "query", required = false), @ApiImplicitParam(name = "sapCode", value = "产品编码", dataType = "String", paramType = "query", required = false) }) public BaseResponse<Object> pushOrder(String orderId, String newzbrandid,Integer contractId,String sapCode){ orderService.pushNewOrder(orderId, newzbrandid,contractId,sapCode); return new BaseResponse<>(); } /** * @Description 获取合同编号枚举 * @Param [orderId] * @author xufengyu * @date 2022/2/17 10:30 */ @PostMapping(value = "order/contractids") @ApiOperation(value = "查询合同编号枚举") public BaseResponse<Object> getAllContractId(){ return new BaseResponse<>(orderService.showContracts()); } }