package com.steerinfo.dil.controller; import com.github.pagehelper.PageHelper; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.service.impl.BmstruckDetailsOrderServiceImpl; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiModelProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Required; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Description: * @Author:HuJianGuo * @GreateTime:2021/9/24 17:29 * @Version:V2.0 */ @RestController @RequestMapping("/${api.version}/bmstruckdetailsorder") public class BmstruckDetailsOrderController extends BaseRESTfulController { @Autowired BmstruckDetailsOrderServiceImpl bmstruckDetailsOrderService; @Autowired ColumnDataUtil columnDataUtil; @Autowired ESFeign esFeign; /** * 展示汽运详单信息 * * @param mapValue * @param pageNum * @param pageSize * @param apiId * @return */ @ApiModelProperty(value = "展示汽运详单信息") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "销售:176/采购:140", required = false, dataType = "BigDecimal"), @ApiImplicitParam(name = "orderType", value = "1:销售,3:采购", required = false, dataType = "Integer") }) @PostMapping("/getTruckDetailsOrderList") public RESTfulResult getTruckDetailsOrderList(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, Integer orderType, String carrierSsoId) { if (mapValue == null) { mapValue = new HashMap<>(); } if (carrierSsoId != null && carrierSsoId.equals("undefined")) { carrierSsoId = null; } if (carrierSsoId != null) { BigDecimal carrierId = bmstruckDetailsOrderService.getCarrierIdBySSO(carrierSsoId); mapValue.put("carrierId",carrierId); } mapValue.put("orderType",orderType); //初始化过滤 List> truckDetailList = bmstruckDetailsOrderService.getTruckDetailsOrderList(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = bmstruckDetailsOrderService.getTruckDetailsOrderList(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, truckDetailList, columnList); return success(data); } /** * 展示汽运未生成账单的详单信息 * * @param mapValue * @param pageNum * @param pageSize * @param apiId * @return */ @ApiModelProperty(value = "展示汽运未生成账单的详单信息") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "销售:176", required = false, dataType = "BigDecimal"), @ApiImplicitParam(name = "orderType", value = "1:销售", required = false, dataType = "Integer") }) @PostMapping("/getUnFinishedTruckDetailsOrderList") public RESTfulResult getUnFinishedTruckDetailsOrderList(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, Integer orderType, String carrierSsoId) { if (carrierSsoId != null && carrierSsoId.equals("undefined")) { carrierSsoId = null; } if (carrierSsoId != null) { BigDecimal carrierId = bmstruckDetailsOrderService.getCarrierIdBySSO(carrierSsoId); mapValue.put("carrierId",carrierId); } List> truckDetailList = bmstruckDetailsOrderService.getUnFinishedTruckDetailsOrderList(mapValue, orderType); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = bmstruckDetailsOrderService.getUnFinishedTruckDetailsOrderList(mapValue, orderType); PageListAdd data = columnDataUtil.tableColumnData(apiId, truckDetailList, columnList); return success(data); } /* 内转计重计费详单 */ @PostMapping("/getInwardWeightDetailsOrder") public RESTfulResult getInwardWeightDetailsOrder(@RequestBody(required = false) MapmapValue, Integer pageNum, Integer pageSize, Integer apiId, String carrierSsoId, Integer detailStatus, Integer orderType, String userId){ if (carrierSsoId != null && carrierSsoId.equals("undefined")) { carrierSsoId = null; } if (carrierSsoId != null) { BigDecimal carrierId = bmstruckDetailsOrderService.getCarrierIdBySSO(carrierSsoId); mapValue.put("carrierId",carrierId); } if(userId != null){ mapValue.put("userId","%"+ userId +"%"); } mapValue.put("detailStatus",detailStatus); List> truckDetailList = bmstruckDetailsOrderService.getInwardWeightDetailsOrder(mapValue,orderType); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = bmstruckDetailsOrderService.getInwardWeightDetailsOrder(mapValue,orderType); PageListAdd data = columnDataUtil.tableColumnData(apiId, truckDetailList, columnList); return success(data); } /** * 展示汽运实绩信息 * * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiModelProperty(value = "展示汽运实绩信息") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "销售:177/采购:142", required = false, dataType = "BigDecimal") }) @PostMapping("/getTruckResultList") public RESTfulResult getTruckResultList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, BigDecimal orderId) { if (mapVal == null) { mapVal = new HashMap<>(); } mapVal.put("orderId", orderId); List> list = bmstruckDetailsOrderService.getTruckResultList(mapVal); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = bmstruckDetailsOrderService.getTruckResultList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList); return success(data); } /** * 新增详单 * * @param orderId * @return */ @ApiModelProperty(value = "新增详单") @ApiImplicitParams({ @ApiImplicitParam(name = "orderId", value = "汽运计量实绩id", required = false, dataType = "BigDecimal"), }) @PostMapping("/addDetailsOrder/{orderId}") public RESTfulResult addDetailsOrder(@PathVariable("orderId") BigDecimal orderId) throws Exception { int code = bmstruckDetailsOrderService.insertSelective(orderId); return success(code); } @ApiModelProperty(value = "新增内转计费详单") @ApiImplicitParams({ @ApiImplicitParam(name = "orderId", value = "汽运计量实绩id", required = false, dataType = "BigDecimal"), }) @PostMapping("/addInwardDetailsOrder") public RESTfulResult addInwardDetailsOrder(@RequestBody(required = false) Map mapVal) { int code = bmstruckDetailsOrderService.inserInwardOrder(mapVal); return success(code); } /** * 修改详单 * * @param mapValue * @return */ @ApiModelProperty(value = "修改详单") @ApiImplicitParams({ @ApiImplicitParam(name = "detailsId,priceId", value = "详单id,价格id", required = false, dataType = "BigDecimal"), }) @PostMapping("/updateDetailsOrder") public RESTfulResult updateDetailsOrder(@RequestBody Map mapValue) throws Exception { int code = bmstruckDetailsOrderService.updateDetailsOrder(mapValue); return success(code); } /**addLossFeeOfCoke * 增加焦炭途损费 * * @param map * @return */ @ApiModelProperty(value = "增加焦炭途损费") @ApiImplicitParams({ @ApiImplicitParam(name = "detailsId", value = "详单id", required = false, dataType = "BigDecimal"), }) @PostMapping("/addLossFeeOfCoke") public RESTfulResult addLossFeeOfCoke(@RequestBody Map map) { int code = bmstruckDetailsOrderService.addLossFeeOfCoke(map); return success(code); } /** * 查询价格和地址 * * @param priceId * @return */ @ApiModelProperty(value = "查询价格和地址") @ApiImplicitParams({ @ApiImplicitParam(name = "priceId", value = "价格id", required = false, dataType = "BigDecimal"), }) @PostMapping("/findAddressAndPrice") public RESTfulResult findAddressAndPrice(@RequestParam Integer priceId) { Map map = bmstruckDetailsOrderService.findAddressAndPrice(priceId); return success(map); } @PostMapping("updateDetails") public int updateDetailsOrder(){ int i = bmstruckDetailsOrderService.updateDetails(); return i; } }