新增提单管理和提单计费页面
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.common.enums.PaymentMesEnum;
|
||||
import com.bms.price.domain.PayPostcodeGroup;
|
||||
import com.bms.price.domain.PayPostcodeLine;
|
||||
import com.bms.price.service.IPayPostcodeService;
|
||||
@@ -74,12 +74,12 @@ public class PayPostcodeController extends BaseController
|
||||
{
|
||||
if (file == null || file.isEmpty())
|
||||
{
|
||||
throw new ServiceException("请选择 Excel 文件");
|
||||
throw PaymentMesEnum.BMS_PAY_PICK_XLS.exception();
|
||||
}
|
||||
String name = file.getOriginalFilename() == null ? "" : file.getOriginalFilename().toLowerCase(Locale.ROOT);
|
||||
if (!name.endsWith(".xlsx"))
|
||||
{
|
||||
throw new ServiceException("只支持 xlsx 文件");
|
||||
throw PaymentMesEnum.BMS_PAY_XLSX_ONLY.exception();
|
||||
}
|
||||
return success(payPostcodeService.importExcel(file.getBytes(), file.getOriginalFilename(), getUsername()));
|
||||
}
|
||||
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.bms.web.controller.price;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bms.common.annotation.Log;
|
||||
import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.utils.poi.ExcelUtil;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFeeImportRow;
|
||||
import com.bms.price.airbill.domain.SrvBillAirRoleFeeCommand;
|
||||
import com.bms.price.airbill.domain.SrvBillAirRoleFeeQuery;
|
||||
import com.bms.price.domain.vo.SrvBillAirQuery;
|
||||
import com.bms.price.service.ISrvBillAirFeeService;
|
||||
import com.bms.price.service.ISrvBillAirService;
|
||||
|
||||
/**
|
||||
* 空运、报关、清关三个角色往提单上添加费用。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/price/airFee")
|
||||
public class AirFeeRoleController extends BaseController
|
||||
{
|
||||
private static final int MAX_BILLS = 50;
|
||||
|
||||
@Autowired
|
||||
private ISrvBillAirFeeService srvBillAirFeeService;
|
||||
|
||||
@Autowired
|
||||
private ISrvBillAirService srvBillAirService;
|
||||
|
||||
/** 按提单号查出可绑定的提单,支持一次多选。 */
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:airFee:air,price:airFee:declare,price:airFee:clear')")
|
||||
@GetMapping("/bills")
|
||||
public AjaxResult bills(@RequestParam(value = "billCodes", required = false) String billCodes)
|
||||
{
|
||||
List<String> codes = splitCodes(billCodes);
|
||||
if (codes.isEmpty())
|
||||
{
|
||||
return success(List.of());
|
||||
}
|
||||
if (codes.size() > MAX_BILLS)
|
||||
{
|
||||
return error("单次最多选择" + MAX_BILLS + "个提单");
|
||||
}
|
||||
SrvBillAirQuery query = new SrvBillAirQuery();
|
||||
query.setBillCodes(codes);
|
||||
return success(srvBillAirService.selectSrvBillAirList(query));
|
||||
}
|
||||
|
||||
/** 查询已绑定到这些提单、且属于当前入口的费用。 */
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:airFee:air,price:airFee:declare,price:airFee:clear')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(@RequestParam("scene") String scene, @RequestParam(value = "billCodes", required = false) String billCodes)
|
||||
{
|
||||
SrvBillAirRoleFeeQuery query = new SrvBillAirRoleFeeQuery();
|
||||
query.setScene(scene);
|
||||
query.setBillCodes(splitCodes(billCodes));
|
||||
return success(srvBillAirFeeService.listRoleFees(query));
|
||||
}
|
||||
|
||||
/** 保存当前入口的费用。空运写入 b 段,报关和清关写入 c 段。 */
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:airFee:air,price:airFee:declare,price:airFee:clear')")
|
||||
@Log(title = "提单角色费用", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody SrvBillAirRoleFeeCommand command)
|
||||
{
|
||||
return success(srvBillAirFeeService.saveRole(command));
|
||||
}
|
||||
|
||||
/** 下载导入模板,模板中带一行示例。 */
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:airFee:air,price:airFee:declare,price:airFee:clear')")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response)
|
||||
{
|
||||
SrvBillAirFeeImportRow example = new SrvBillAirFeeImportRow();
|
||||
example.setFeeName("燃油附加费");
|
||||
example.setPrice(new BigDecimal("1000"));
|
||||
example.setCurrency("EUR");
|
||||
example.setRemark("导入时需清空这行示例数据");
|
||||
List<SrvBillAirFeeImportRow> rows = new ArrayList<>();
|
||||
rows.add(example);
|
||||
new ExcelUtil<>(SrvBillAirFeeImportRow.class).exportExcel(response, rows, "提单费用导入模板");
|
||||
}
|
||||
|
||||
/** 解析导入文件,不直接落库。示例行会被跳过。 */
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:airFee:air,price:airFee:declare,price:airFee:clear')")
|
||||
@Log(title = "提单角色费用导入", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/import")
|
||||
public AjaxResult importFee(MultipartFile file, @RequestParam("scene") String scene) throws Exception
|
||||
{
|
||||
if (file == null || file.isEmpty())
|
||||
{
|
||||
return error("请选择导入文件");
|
||||
}
|
||||
return success(srvBillAirFeeService.parseImport(scene, file.getInputStream()));
|
||||
}
|
||||
|
||||
private static List<String> splitCodes(String billCodes)
|
||||
{
|
||||
LinkedHashSet<String> codes = new LinkedHashSet<>();
|
||||
if (billCodes != null)
|
||||
{
|
||||
for (String part : billCodes.split("[,,\\s]+"))
|
||||
{
|
||||
if (part != null && !part.isBlank())
|
||||
{
|
||||
codes.add(part.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(codes);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -22,7 +22,7 @@ import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.common.enums.PaymentMesEnum;
|
||||
import com.bms.common.utils.file.FileUtils;
|
||||
import com.bms.common.utils.poi.ExcelUtil;
|
||||
import com.bms.price.domain.ChannelProductMap;
|
||||
@@ -86,7 +86,8 @@ public class PayProductController extends BaseController
|
||||
@PostMapping("/order/{billId}")
|
||||
public AjaxResult generateOrderCost(@PathVariable String billId)
|
||||
{
|
||||
return success(payOrderCostService.generate(billId));
|
||||
payOrderCostService.generate(billId);
|
||||
return success("操作成功");
|
||||
}
|
||||
|
||||
/** 下载某一版导入时上传的源文件 */
|
||||
@@ -260,16 +261,16 @@ public class PayProductController extends BaseController
|
||||
{
|
||||
if (file == null || file.isEmpty())
|
||||
{
|
||||
throw new ServiceException("请选择价卡文件");
|
||||
throw PaymentMesEnum.BMS_PAY_PICK_FILE.exception();
|
||||
}
|
||||
String filename = file.getOriginalFilename();
|
||||
if (filename == null || !filename.toLowerCase(Locale.ROOT).endsWith(".xlsx"))
|
||||
{
|
||||
throw new ServiceException("请上传xlsx价卡");
|
||||
throw PaymentMesEnum.BMS_PAY_XLSX.exception();
|
||||
}
|
||||
if (file.getSize() > 30L * 1024 * 1024)
|
||||
{
|
||||
throw new ServiceException("价卡文件不能超过30MB");
|
||||
throw PaymentMesEnum.BMS_PAY_FILE_30M.exception();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user