package com.boco.nbd.wios.manage.controller; import cn.hutool.core.lang.Assert; import com.boco.nbd.cams.core.constant.MessageConstant; import com.boco.nbd.wios.manage.contants.WiosConstant; import com.boco.nbd.wios.manage.entity.bo.OrderInstallBo; import com.boco.nbd.wios.manage.entity.bo.OrderInstallVo; import com.boco.nbd.wios.manage.service.impl.OrderInstallService; import com.ihidea.component.api.v2.BaseResponse; import com.ihidea.core.support.exception.ServiceException; import com.ihidea.core.util.StringUtilsEx; 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.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; /** * 安装订单管理接口 * * @author xgl * @version [版本号, 2020年9月25日] */ @RestController @RequestMapping("api") @Api(tags = "安装订单管理接口") @ApiIgnore public class OrderInstallController { @Autowired private OrderInstallService orderInstallService; /** * 添加安装订单 * * @param orderInstall * @return */ @PostMapping(value = "orderInstall/add") @ApiOperation(value = "添加安装订单信息") @ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true)}) public BaseResponse<Object> add(OrderInstallBo orderInstall) { Assert.notNull(orderInstall.getOrderId(), "orderId不能为空"); if (!StringUtils.isEmpty(orderInstall.getPredictOverItem())) { orderInstall.setPredictOverItem(StringUtilsEx.unescapeXss(orderInstall.getPredictOverItem())); } if (!StringUtils.isEmpty(orderInstall.getDebugCheck())) { orderInstall.setDebugCheck(StringUtilsEx.unescapeXss(orderInstall.getDebugCheck())); } orderInstallService.add(orderInstall); return new BaseResponse<>(); } /** * 修改安装订单 * * @param orderInstall * @return */ @PostMapping(value = "orderInstall/update") @ApiOperation(value = "修改安装订单信息") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "安装订单id", dataType = "int", paramType = "query", required = true)}) public BaseResponse<Object> update(OrderInstallBo orderInstall) { if (orderInstall.getId() == null) { throw new ServiceException(MessageConstant.MISSING_PARAM); } if (!StringUtils.isEmpty(orderInstall.getPredictOverItem())) { orderInstall.setPredictOverItem(StringUtilsEx.unescapeXss(orderInstall.getPredictOverItem())); } if (!StringUtils.isEmpty(orderInstall.getDebugCheck())) { orderInstall.setDebugCheck(StringUtilsEx.unescapeXss(orderInstall.getDebugCheck())); } // 已支付订单不能修改增项信息 if (orderInstall.getParkingType() != null && orderInstall.getParkingType().intValue() == 1) { orderInstall.setPredictOverItem(null); } orderInstallService.update(orderInstall.getId(), orderInstall); return new BaseResponse<>(); } /** * 查询安装订单详情 * * @param orderId * @return */ @GetMapping(value = "orderInstall/detail") @ApiOperation(value = "查询安装订单详情") @ApiImplicitParam(paramType = "query", name = "orderId", value = "订单id", required = true, dataType = "String") public BaseResponse<OrderInstallVo> get(String orderId) { Assert.notNull(orderId, "orderId不能为空"); OrderInstallVo orderInstall = orderInstallService.getByOrderId(orderId); return new BaseResponse<>(orderInstall); } }