liujie
2025-11-12 fb97f83e39a0995fb70326c492a0bcd37af5e300
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TMerchantController.java
@@ -172,11 +172,11 @@
            }
        }
    }
    @Log(title = "商户信息导入", businessType = BusinessType.INSERT)
    @Log(title = "商户信息-商户信息导入", businessType = BusinessType.INSERT)
    @ApiOperation(value = "商户信息导入")
    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
    @PostMapping("/import")
    public R<String> importLocation(@RequestPart("file") MultipartFile file) {
    public R<String> importInfo(@RequestPart("file") MultipartFile file) {
        List<TMerchant> merchants = new ArrayList<>();
        ImportParams params = new ImportParams();
        params.setHeadRows(1); //表头行数
@@ -205,21 +205,26 @@
        for (MerchantImport merchantImport : merchantImports) {
            if (!StringUtils.hasLength(merchantImport.getMerchantName())){
                result.append("第"+i+"行:[", "商户名称"+"]不能为空");
                continue;
            }
            if (!StringUtils.hasLength(merchantImport.getMerchantPhone())){
                result.append("第"+i+"行:[", "商户电话"+"]不能为空");
                continue;
            }
            if (!StringUtils.hasLength(merchantImport.getTypeName())){
                result.append("第"+i+"行:[", "商户分类"+"]不能为空");
                continue;
            }
            if (!StringUtils.hasLength(merchantImport.getAddress())){
                result.append("第"+i+"行:[", "商户地址"+"]不能为空");
                continue;
            }
            TMerchantType merchantType = merchantTypeService.getOne(Wrappers.lambdaQuery(TMerchantType.class)
                    .eq(TMerchantType::getTypeName, merchantImport.getTypeName())
                    .last("LIMIT 1"));
            if(Objects.isNull(merchantType)){
                result.append("第"+i+"行:[", "商户分类"+"]不存在");
                continue;
            }
            TMerchant merchant = new TMerchant();
            BeanUtils.copyProperties(merchantImport, merchant);