package com.steerinfo.dil.controller; import com.steerinfo.dil.mapper.UniversalMapper; import com.steerinfo.dil.service.impl.UniversalServiceImpl; 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 com.steerinfo.framework.service.pagehelper.PageHelper; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @ author :TXF * @ time :2021/10/19 18:06 * 通用接口 */ @RequestMapping("${api.version}/uc") @RestController public class UniversalController extends BaseRESTfulController { @Autowired UniversalServiceImpl universalService; @Autowired UniversalMapper universalMapper; @Autowired ColumnDataUtil columnDataUtil; @ApiOperation(value="查询数据打印提货单接口") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "运输订单号", required = false, dataType = "Map"), }) @PostMapping("/printTHD") public RESTfulResult printTiHuoDan(@RequestBody(required=false) Map mapValue){ Map tiHuoDan = universalService.printTiHuoDan((String) mapValue.get("orderNumber")); return success(tiHuoDan); } @ApiModelProperty(value = "模糊查询发货单位") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal") }) @PostMapping("/querySupplierByLike") public RESTfulResult querySupplierByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index","%" + index + "%"); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.querySupplierByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId,columnList); return success(data); } @ApiModelProperty(value = "查询所有发货单位") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal") }) @PostMapping("/queryAllSupplierByLike") public RESTfulResult queryAllSupplierByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index","%" + index + "%"); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryAllSupplierByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "通过物资ID查询该物资的发货单位信息") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal") }) @PostMapping("/getSupplierMesByMaterialId") public RESTfulResult getSupplierMesByMaterialId(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index, String materialId) { if(mapValue == null) mapValue = new HashMap<>(); if(!"null".equals(materialId)) mapValue.put("materialId",materialId); if(index != null){ mapValue.put("index","%" + index + "%"); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getSupplierMesByMaterialId(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiOperation(value="查询所有运力信息") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(248)", value = "动态表头", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"), }) @PostMapping("/getAllCapacityByCarrierLike") public RESTfulResult getAllCapacityByCarrierLike(@RequestBody(required=false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String carrierSsoId, String index, String con ){ if(mapValue == null){ mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } if (con != null&& !con.equals("undefined")){ mapValue.put("con",con); } if (carrierSsoId != null && carrierSsoId.equals("undefined")) { carrierSsoId = null; } if (carrierSsoId != null) { BigDecimal carrierId = universalMapper.getCarrierIdBySSO(carrierSsoId); mapValue.put("carrierId",carrierId); } //不分页筛选数据 PageHelper.startPage(pageNum,pageSize); //分页数据 List> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, capacity); return success(pageList); } @ApiOperation(value="通过订单ID查询订单下所有物资") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(395)", value = "动态表头", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"), }) @PostMapping("/getMaterialMesByOrderId") public RESTfulResult getMaterialMesByOrderId(@RequestBody(required=false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String orderId ){ if(mapValue == null){ mapValue = new HashMap<>(); } if(orderId != null){ mapValue.put("orderId", orderId); } //不分页筛选数据 PageHelper.startPage(pageNum,pageSize); //分页数据 List> capacity = universalMapper.getMaterialMesByOrderId(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, capacity); return success(pageList); } @ApiModelProperty(value = "边输边查发货单位") @PostMapping("/getSupplierMesByLike") public RESTfulResult getSupplierMesByLike(@RequestParam("index") String index) { List> list = universalMapper.getSupplierMesByLike(index == null ? "" : index); return success(list); } @ApiModelProperty(value = "边输边查用车单位") @PostMapping("/getRequireUnitName") public RESTfulResult getRequireUnitName(@RequestParam("index") String index) { List>list = universalMapper.getRequireUnitName(index == null ? "" : "%" + index + "%"); return success(list); } @ApiModelProperty(value = "边输边查收货单位") @PostMapping("/getConsigneeByLike") public RESTfulResult getConsigneeByLike(@RequestParam("index") String index) { List> list = universalMapper.getConsigneeByLike(index == null ? "" : index); return success(list); } @ApiModelProperty(value = "通过订单ID查询订单下物资信息") @PostMapping("/getOrderMaterialMesByOrderId/{orderId}") public RESTfulResult getMaterialMesByOrderId(@PathVariable("orderId") Integer orderId){ List> mes = universalMapper.getOrderMaterialMesByOrderId(new BigDecimal(orderId)); return success(mes); } @ApiModelProperty(value = "模糊查询物资") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal") }) @PostMapping("/queryAPOMaterialByLike") public RESTfulResult queryAPOMaterialByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index, Integer supplierId) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null && !"".equals(index) &&!"null".equals(index)){ mapValue.put("index", index); } if(supplierId != null){ mapValue.put("supplierId", supplierId); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryAPOMaterialByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "模糊查询卸货点") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "374", required = false, dataType = "BigDecimal") }) @PostMapping("/getUnloadingMesByLike") public RESTfulResult getUnloadingMesByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, Integer type, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(type != null){ mapValue.put("type", type); } if(index != null){ mapValue.put("index", index); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getUnloadingMesByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "模糊查询物资") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal") }) @PostMapping("/queryMaterialByLike") public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryMaterialByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "模糊查询批次") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal") }) @PostMapping("/queryBatchByLike") public RESTfulResult queryBatchByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getBatchAndOrderMes(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "边输边查承运商") @PostMapping("/getCarrierMesByLike") public RESTfulResult getCarrierMesByLike(@RequestParam("index") String index) { List> list = universalMapper.getCarrierMesByLike(index == null ? "" : index); return success(list); } @ApiModelProperty(value = "模糊查询收货单位") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "396", required = false, dataType = "BigDecimal") }) @PostMapping("/queryConsigneeByLike") public RESTfulResult queryConsigneeByLike(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryConsigneeByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "模糊查询物资信息") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "395", required = false, dataType = "BigDecimal") }) @PostMapping("/selectAllMaterialName") public RESTfulResult selectAllMaterialName(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String index) { if(mapValue == null) { mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.selectAllMaterialName(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "返回sha1加密字符串") @RequestMapping(value = "/sha1DigestUtils", method = {RequestMethod.GET,RequestMethod.POST}) public String sha1DigestUtils(String text){ return universalService.sha1DigestUtils(text); } @ApiModelProperty(value = "查装货卸货点") @PostMapping("/selectUnloadingPoint") public List> selectUnloadingPoint() { return universalMapper.selectUnloadingPoint(); } @ApiModelProperty(value = "模糊查询承运商") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "412", required = false, dataType = "BigDecimal") }) @PostMapping("/getCarrierListByLike") public RESTfulResult getCarrierListByLike(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String index) { if(index != null){ if(index.length() == 0){ index = null; }else { index = "%" + index + "%"; } } if (mapValue == null) { mapValue = new HashMap<>(); } mapValue.put("index",index); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getCarrierListByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "所有门岗下拉框") @GetMapping("/getAllGatepost") public List> getAllGatepost(){ return universalMapper.getAllGatepost(); } //通过承运商id获取userId @PostMapping("/getUserIdByCarrierId") public String getUserIdByCarrierId(@RequestBody Map map){ //获取承运商id Integer carrierId =(Integer) map.get("carrierId"); return universalMapper.getUserIdbyCarrierId(carrierId); } @ApiModelProperty(value = "已经在sso权限模块承运商下拉框") @GetMapping("/getAllCarrierIdForSso") public List> getAllCarrierIdForSso(){ return universalMapper.getAllCarrierIdForSso(); } @ApiModelProperty(value = "模糊查询收货单位") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "418", required = false, dataType = "BigDecimal") }) @PostMapping("/getConsigneeListByLike") public RESTfulResult getConsigneeListByLike(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String index) { if(index != null){ if(index.length() == 0){ index = null; }else { index = "%" + index + "%"; } } if (mapValue == null) { mapValue = new HashMap<>(); } mapValue.put("index",index); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getConsigneeListByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiOperation("通过运输订单id查询销售订单审核状态") @PostMapping("/getSaleOrderStatus") public Integer getSaleOrderStatus(@RequestParam Integer orderId) { Integer saleStatus = universalMapper.getSaleOrderStatus(new BigDecimal(orderId)); return saleStatus; } @ApiOperation("查询所有的汽车衡") @GetMapping("/getAllCalculateMes") public List> getAllCalculateMes() { return universalMapper.getAllCalculateMes(); } @ApiOperation("查询所有的焦炭子类") @GetMapping("/getAllMaterialCoke") public List> getAllMaterialCoke() { return universalMapper.getAllMaterialCoke(); } @ApiModelProperty(value = "边输边查车牌号") @PostMapping("/getCapacityByLike") public RESTfulResult getCapacityByLike(@RequestParam("index") String index) { List> list = universalMapper.getCapacityByLike(index == null ? "" : index); return success(list); } @ApiModelProperty(value = "边输边查批次") @GetMapping("/getBatchByLike") public RESTfulResult getBatchByLike(@RequestParam("index") String index) { List> list = universalMapper.getBatchByLike(index == null ? "" : index); return success(list); } @ApiModelProperty(value = "根据运力id查询所有承运商(下拉框)") @GetMapping("/getCarrierByCapacityId") public RESTfulResult getCarrierByCapacityId(@RequestParam("capacityId") Integer capacityId) { List> list = universalMapper.getCarrierByCapacityId(new BigDecimal(capacityId)); return success(list); } @ApiModelProperty(value = "根据收货客户查询承运商") @PostMapping("/getCarrierByConsignee") public RESTfulResult getCarrierByConsignee(@RequestBody Map mapValue) { Map map = universalService.getCarrierByConsignee(mapValue); return success(map); } @ApiModelProperty(value = "确认车牌号与承运商关系是否存在") @PostMapping("/isInCapacityCarrier") public RESTfulResult isInCapacityCarrier(@RequestBody Map mapValue) { Map map = universalService.isInCapacityCarrier(mapValue); BigDecimal capacityId = (BigDecimal) map.get("capacityId"); BigDecimal capacityCarrierId = (BigDecimal) map.get("capacityCarrierId"); if (capacityId == null) { return failed(); } if (capacityCarrierId == null) { return failed(capacityId); } return success(map); } @ApiModelProperty(value = "得到所有油价联动计费公式(apiId:444)") @PostMapping("/getOilFormula") public RESTfulResult getOilFormula(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize) { if (mapValue == null) { mapValue = new HashMap<>(); } mapValue.put("con", "%执行运价公式"); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getOilFormula(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList); return success(data); } @ApiModelProperty(value = "获得港口下拉框") @GetMapping("/getPortId") public RESTfulResult getPortId() { return success(universalService.getPortId()); } @ApiModelProperty(value = "获取车牌号边输边查") @GetMapping("/getCapacityNumber") public RESTfulResult getCapacityNumber(String index) { if(index.length() < 3){ return failed(); } return success(universalService.getCapacityNumber(index)); } @ApiModelProperty(value = "获得订单号及订单号下面物资") @GetMapping("/getOrderNumber") public RESTfulResult getOrderNumber(String capacityId) { return success(universalService.getOrderNumber(capacityId)); } @ApiModelProperty(value = "根据订单查询物资") @GetMapping("/getMaterialIdByOrderId") public RESTfulResult getMaterialIdByOrderId(Integer orderId) { return success(universalService.getMaterialIdByOrderId(orderId)); } @ApiOperation(value = "修改路段顺序号") @PostMapping("/updateLineSqe") public RESTfulResult updateLineSqe(@RequestBody Map map) { int i = universalMapper.updateLineSqe(map); return success(i); } @ApiModelProperty(value = "边输边查物资") @GetMapping("/getMaterialByLike") public RESTfulResult getMaterialByLike(@RequestParam("index") String index) { List> list = universalMapper.getMaterialByLike(index == null ? "" : index); return success(list); } }