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 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 + "%"); } List> list = universalMapper.querySupplierByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.querySupplierByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.queryAllSupplierByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryAllSupplierByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.getSupplierMesByMaterialId(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getSupplierMesByMaterialId(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 ){ if(mapValue == null){ mapValue = new HashMap<>(); } if(index != null){ mapValue.put("index", index); } if (carrierSsoId != null && carrierSsoId.equals("undefined")) { carrierSsoId = null; } if (carrierSsoId != null) { BigDecimal carrierId = universalMapper.getCarrierIdBySSO(carrierSsoId); mapValue.put("carrierId",carrierId); } //不分页筛选数据 List> allCapacity = universalMapper.getAllCapacityByCarrierLike(mapValue); PageHelper.startPage(pageNum,pageSize); //分页数据 List> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,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); } //不分页筛选数据 List> allCapacity = universalMapper.getMaterialMesByOrderId(mapValue); PageHelper.startPage(pageNum,pageSize); //分页数据 List> capacity = universalMapper.getMaterialMesByOrderId(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,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("/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 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 + "%"); } List> list = universalMapper.queryAPOMaterialByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryAPOMaterialByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.getUnloadingMesByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getUnloadingMesByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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, String startNum) { if(mapValue == null) { mapValue = new HashMap<>(); } if(startNum != null){ mapValue.put("startNum", startNum + "%"); } if(index != null){ mapValue.put("index", "%" + index + "%"); } List> list = universalMapper.queryMaterialByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryMaterialByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.getBatchAndOrderMes(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getBatchAndOrderMes(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.queryConsigneeByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.queryConsigneeByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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 + "%"); } List> list = universalMapper.selectAllMaterialName(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.selectAllMaterialName(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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); List> list = universalMapper.getCarrierListByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getCarrierListByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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); List> list = universalMapper.getConsigneeListByLike(mapValue); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = universalMapper.getConsigneeListByLike(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, 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(); } }