1、基础数据修复bug

2、客商模块修复bug
This commit is contained in:
2026-08-06 02:57:38 +08:00
parent 58726a675e
commit 28eb484a68
23 changed files with 294 additions and 90 deletions

View File

@@ -37,7 +37,9 @@ import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.common.excel.ImportFailureExcelUtil;
import org.springblade.transport.excel.CommonRouteExcel;
import org.springblade.transport.excel.CommonRouteImportExcel;
import org.springblade.transport.pojo.entity.CommonRoute;
import org.springblade.transport.pojo.vo.BusinessRemoveResultVO;
import org.springblade.transport.pojo.vo.CommonRouteVO;
@@ -48,6 +50,7 @@ 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 java.util.ArrayList;
import java.util.List;
@@ -102,4 +105,31 @@ public class CommonRouteController extends BladeController {
ExcelUtil.export(response, "常用线路" + DateUtil.time(), "常用线路", list, CommonRouteExcel.class);
}
@PostMapping("/import-common-route")
@ApiOperationSupport(order = 6)
@Operation(summary = "导入常用线路", description = "传入excel")
public R importCommonRoute(MultipartFile file, HttpServletResponse response) {
List<CommonRouteImportExcel> failureList = commonRouteService.importCommonRoute(
ExcelUtil.read(file, CommonRouteImportExcel.class)
);
if (Func.isNotEmpty(failureList)) {
ImportFailureExcelUtil.export(
response,
"常用线路导入失败明细" + DateUtil.time(),
"导入失败明细",
failureList,
CommonRouteImportExcel.class
);
return null;
}
return R.success("导入数据成功");
}
@GetMapping("/export-template")
@ApiOperationSupport(order = 7)
@Operation(summary = "导出导入模板")
public void exportTemplate(HttpServletResponse response) {
ExcelUtil.export(response, "常用线路模板", "常用线路导入模板", new ArrayList<CommonRouteImportExcel>(), CommonRouteImportExcel.class);
}
}

View File

@@ -109,11 +109,21 @@ public class CustomerArchiveController extends BladeController {
return R.status(customerArchiveService.submitApproval(id));
}
/**
* 撤回审批
*/
@PostMapping("/withdraw-approval")
@ApiOperationSupport(order = 5)
@Operation(summary = "撤回审批", description = "传入id")
public R withdrawApproval(@Parameter(description = "主键", required = true) @RequestParam Long id) {
return R.status(customerArchiveService.withdrawApproval(id));
}
/**
* 审核通过
*/
@PostMapping("/approve")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 6)
@Operation(summary = "审核通过", description = "传入id")
public R approve(@Parameter(description = "主键", required = true) @RequestParam Long id) {
return R.status(customerArchiveService.approve(id));
@@ -123,7 +133,7 @@ public class CustomerArchiveController extends BladeController {
* 审核不通过
*/
@PostMapping("/reject")
@ApiOperationSupport(order = 6)
@ApiOperationSupport(order = 7)
@Operation(summary = "审核不通过", description = "传入id")
public R reject(@Parameter(description = "主键", required = true) @RequestParam Long id) {
return R.status(customerArchiveService.reject(id));
@@ -133,7 +143,7 @@ public class CustomerArchiveController extends BladeController {
* 启用或停用
*/
@PostMapping("/status")
@ApiOperationSupport(order = 7)
@ApiOperationSupport(order = 8)
@Operation(summary = "启用或停用", description = "传入id和status")
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
@@ -144,7 +154,7 @@ public class CustomerArchiveController extends BladeController {
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 8)
@ApiOperationSupport(order = 9)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(customerArchiveService.removeDraft(ids));
@@ -154,7 +164,7 @@ public class CustomerArchiveController extends BladeController {
* 评分明细模板
*/
@GetMapping("/score-template")
@ApiOperationSupport(order = 9)
@ApiOperationSupport(order = 10)
@Operation(summary = "评分明细模板", description = "传入评分量化表ID")
public R<CustomerCreditScoreVO> scoreTemplate(@RequestParam(required = false) Long quantificationId) {
return R.data(customerArchiveService.buildScoreTemplate(quantificationId));
@@ -164,7 +174,7 @@ public class CustomerArchiveController extends BladeController {
* 导出客商档案
*/
@GetMapping("/export-customer-archive")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 11)
@Operation(summary = "导出客商档案")
public void exportCustomerArchive(CustomerArchiveVO customerArchive,
@RequestParam(required = false) String ids,

View File

@@ -49,65 +49,56 @@ public class CommonCargoExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("一级货物类型")
private String firstCargoTypeName;
@ExcelProperty("二级货物类型编码")
private String secondCargoTypeCode;
@ExcelProperty("货物名称")
private String cargoName;
@ExcelProperty("货物编号")
private String cargoCode;
@ExcelProperty("货物编号后缀")
private String cargoCodeSuffix;
@ExcelProperty("一级货物类型")
private String firstCargoTypeName;
@ExcelProperty("品牌")
private String brand;
@ExcelProperty("二级货物类型")
private String secondCargoTypeName;
@ExcelProperty("包装")
private String packageType;
@ExcelProperty("二级货物类型编码")
private String secondCargoTypeCode;
@ExcelProperty("包装品牌")
private String packageBrand;
@ExcelProperty("规格")
private String specification;
@ExcelProperty("型号")
private String model;
@ExcelProperty("单价")
@NumberFormat("0.00")
private BigDecimal cargoValue;
@ExcelProperty("规格")
private String specification;
@ExcelProperty("计价单位")
private String priceUnit;
@ExcelProperty("型号")
private String model;
@ExcelProperty("说明1")
private String descriptionOne;
@ExcelProperty("尺寸")
private String sizeText;
@ExcelProperty("说明2")
private String descriptionTwo;
@ExcelProperty("其他说明1")
private String descriptionOne;
@ExcelProperty("所属组织")
private String deptName;
@ExcelProperty("其他说明2")
private String descriptionTwo;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建人")
private String createUserName;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("组织")
private String deptName;
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -30,7 +30,6 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -55,10 +54,6 @@ public class CommonRouteExcel implements Serializable {
private String departureName;
@ExcelProperty("发货地址")
private String departureAddress;
@ExcelProperty("发货经度")
private BigDecimal departureLongitude;
@ExcelProperty("发货纬度")
private BigDecimal departureLatitude;
@ExcelProperty("发货联系人")
private String departureContact;
@ExcelProperty("发货联系方式")
@@ -67,10 +62,6 @@ public class CommonRouteExcel implements Serializable {
private String arrivalName;
@ExcelProperty("收货地址")
private String arrivalAddress;
@ExcelProperty("收货经度")
private BigDecimal arrivalLongitude;
@ExcelProperty("收货纬度")
private BigDecimal arrivalLatitude;
@ExcelProperty("收货联系人")
private String arrivalContact;
@ExcelProperty("收货联系方式")

View File

@@ -0,0 +1,67 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 常用线路导入 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(24)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class CommonRouteImportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("*线路名称")
private String routeName;
@ExcelProperty("*发货地")
private String departureName;
@ExcelProperty("*发货地址")
private String departureAddress;
@ExcelProperty("发货联系人")
private String departureContact;
@ExcelProperty("发货联系方式")
private String departurePhone;
@ExcelProperty("*收货地")
private String arrivalName;
@ExcelProperty("*收货地址")
private String arrivalAddress;
@ExcelProperty("收货联系人")
private String arrivalContact;
@ExcelProperty("收货联系方式")
private String arrivalPhone;
@ExcelProperty("备注")
private String remark;
@ExcelIgnore
private String errorMessage;
}

View File

@@ -54,19 +54,19 @@ public class CustomerArchiveExcel implements Serializable {
@ExcelProperty("客商简称")
private String shortName;
@ExcelProperty("客商名称")
@ExcelProperty("*客商名称")
private String fullName;
@ExcelProperty("客商类型")
@ExcelProperty("*客商类型")
private String customerType;
@ExcelProperty("客商性质")
@ExcelProperty("*客商性质")
private String customerNature;
@ExcelProperty("统一信用代码")
@ExcelProperty("*统一信用代码")
private String unifiedCreditCode;
@ExcelProperty("所属组织")
@ExcelProperty("*所属组织")
private String deptName;
@ExcelProperty("准入类型")
@@ -96,10 +96,10 @@ public class CustomerArchiveExcel implements Serializable {
@ExcelProperty("申请总资金使用额度(万元)")
private BigDecimal applyCreditLimit;
@ExcelProperty("联系电话")
@ExcelProperty("*联系电话")
private String contactPhone;
@ExcelProperty("法人/负责人")
@ExcelProperty("*法人/负责人")
private String legalPerson;
@ExcelProperty("创建时间")

View File

@@ -8,6 +8,7 @@
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="create_user_name" property="createUserName"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
@@ -19,36 +20,38 @@
<select id="selectCreditScoreQuantificationPage" resultMap="creditScoreQuantificationResultMap">
SELECT
id,
tenant_id,
create_user,
create_dept,
create_time,
update_user,
update_time,
status,
is_deleted,
name,
remark,
standard_description
csq.id,
csq.tenant_id,
csq.create_user,
csq.create_dept,
csq.create_time,
cu.real_name AS create_user_name,
csq.update_user,
csq.update_time,
csq.status,
csq.is_deleted,
csq.name,
csq.remark,
csq.standard_description
FROM
blade_credit_score_quantification
blade_credit_score_quantification csq
LEFT JOIN blade_user cu ON cu.id = csq.create_user
WHERE
is_deleted = 0
csq.is_deleted = 0
<if test="quantification.name != null and quantification.name != ''">
<bind name="nameLike" value="'%' + quantification.name + '%'"/>
AND name LIKE #{nameLike}
AND csq.name LIKE #{nameLike}
</if>
<if test="quantification.status != null">
AND status = #{quantification.status}
AND csq.status = #{quantification.status}
</if>
<if test="quantification.createTimeStart != null and quantification.createTimeStart != ''">
AND create_time &gt;= #{quantification.createTimeStart}
AND csq.create_time &gt;= #{quantification.createTimeStart}
</if>
<if test="quantification.createTimeEnd != null and quantification.createTimeEnd != ''">
AND create_time &lt;= #{quantification.createTimeEnd}
AND csq.create_time &lt;= #{quantification.createTimeEnd}
</if>
ORDER BY create_time DESC
ORDER BY csq.create_time DESC
</select>
</mapper>

View File

@@ -25,6 +25,7 @@ package org.springblade.transport.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.CommonRouteExcel;
import org.springblade.transport.excel.CommonRouteImportExcel;
import org.springblade.transport.pojo.entity.CommonRoute;
import org.springblade.transport.pojo.vo.BusinessRemoveResultVO;
import org.springblade.transport.pojo.vo.CommonRouteVO;
@@ -43,5 +44,6 @@ public interface ICommonRouteService extends BaseService<CommonRoute> {
boolean submit(CommonRoute commonRoute);
BusinessRemoveResultVO removeCommonRoute(String ids);
List<CommonRouteExcel> exportCommonRoute(CommonRouteVO commonRoute, String ids);
List<CommonRouteImportExcel> importCommonRoute(List<CommonRouteImportExcel> data);
}

View File

@@ -72,6 +72,14 @@ public interface ICustomerArchiveService extends BaseService<CustomerArchive> {
*/
boolean submitApproval(Long id);
/**
* 撤回审批并恢复草稿状态
*
* @param id 主键
* @return 是否成功
*/
boolean withdrawApproval(Long id);
/**
* 审核通过
*

View File

@@ -29,7 +29,6 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.system.pojo.entity.Dept;
import org.springblade.transport.excel.CommonCargoExcel;
import org.springblade.transport.excel.CommonCargoExportExcel;
@@ -116,8 +115,10 @@ public class CommonCargoServiceImpl extends BaseServiceImpl<CommonCargoMapper, C
return list(queryWrapper).stream().map(record -> {
CommonCargoExportExcel excel = new CommonCargoExportExcel();
BeanUtil.copyProperties(record, excel);
excel.setCreateUserName(UserCache.getUserRealName(record.getCreateUser()));
excel.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser()));
excel.setPackageBrand(String.join(" / ", List.of(
Func.isEmpty(record.getPackageType()) ? "" : record.getPackageType(),
Func.isEmpty(record.getBrand()) ? "" : record.getBrand()
).stream().filter(value -> !value.isEmpty()).toList()));
return excel;
}).toList();
}

View File

@@ -32,6 +32,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.system.pojo.entity.Dept;
import org.springblade.transport.excel.CommonRouteExcel;
import org.springblade.transport.excel.CommonRouteImportExcel;
import org.springblade.transport.mapper.CommonRouteMapper;
import org.springblade.transport.pojo.entity.CommonRoute;
import org.springblade.transport.pojo.vo.BusinessRemoveResultVO;
@@ -123,6 +124,27 @@ public class CommonRouteServiceImpl extends BaseServiceImpl<CommonRouteMapper, C
}).toList();
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<CommonRouteImportExcel> importCommonRoute(List<CommonRouteImportExcel> data) {
if (Func.isEmpty(data)) {
throw new ServiceException("导入数据不能为空");
}
List<CommonRouteImportExcel> failureList = new ArrayList<>();
for (int index = 0; index < data.size(); index++) {
CommonRouteImportExcel excel = data.get(index);
try {
CommonRoute commonRoute = new CommonRoute();
BeanUtil.copyProperties(excel, commonRoute);
submit(commonRoute);
} catch (Exception exception) {
excel.setErrorMessage("" + (index + 2) + "行:" + exception.getMessage());
failureList.add(excel);
}
}
return failureList;
}
private LambdaQueryWrapper<CommonRoute> buildQuery(CommonRouteVO commonRoute) {
TransportBusinessSupport.validateAllDept(commonRoute.getAllDept(), "常用线路");
LambdaQueryWrapper<CommonRoute> queryWrapper = Wrappers.<CommonRoute>lambdaQuery().eq(CommonRoute::getIsDeleted, 0);
@@ -195,6 +217,8 @@ public class CommonRouteServiceImpl extends BaseServiceImpl<CommonRouteMapper, C
TransportBusinessSupport.validateRequired(commonRoute.getDepartureAddress(), "发货地址不能为空");
TransportBusinessSupport.validateRequired(commonRoute.getArrivalName(), "收货地不能为空");
TransportBusinessSupport.validateRequired(commonRoute.getArrivalAddress(), "收货地址不能为空");
validateRouteNameUnique(commonRoute);
validateAddressCombinationUnique(commonRoute);
TransportBusinessSupport.validateLength(commonRoute.getRouteCode(), 255, "线路编号不能超过255字");
TransportBusinessSupport.validateLength(commonRoute.getRouteName(), 255, "线路名称不能超过255字");
TransportBusinessSupport.validateLength(commonRoute.getDepartureName(), 255, "发货地不能超过255字");
@@ -215,6 +239,33 @@ public class CommonRouteServiceImpl extends BaseServiceImpl<CommonRouteMapper, C
TransportBusinessSupport.validateCoordinate(commonRoute.getArrivalLatitude(), false);
}
private void validateRouteNameUnique(CommonRoute commonRoute) {
LambdaQueryWrapper<CommonRoute> queryWrapper = Wrappers.<CommonRoute>lambdaQuery()
.eq(CommonRoute::getIsDeleted, 0)
.eq(CommonRoute::getDeptId, commonRoute.getDeptId())
.eq(CommonRoute::getRouteName, commonRoute.getRouteName());
if (Func.isNotEmpty(commonRoute.getId())) {
queryWrapper.ne(CommonRoute::getId, commonRoute.getId());
}
if (count(queryWrapper) > 0) {
throw new ServiceException("线路名称已存在");
}
}
private void validateAddressCombinationUnique(CommonRoute commonRoute) {
LambdaQueryWrapper<CommonRoute> queryWrapper = Wrappers.<CommonRoute>lambdaQuery()
.eq(CommonRoute::getIsDeleted, 0)
.eq(CommonRoute::getDeptId, commonRoute.getDeptId())
.eq(CommonRoute::getDepartureAddress, commonRoute.getDepartureAddress())
.eq(CommonRoute::getArrivalAddress, commonRoute.getArrivalAddress());
if (Func.isNotEmpty(commonRoute.getId())) {
queryWrapper.ne(CommonRoute::getId, commonRoute.getId());
}
if (count(queryWrapper) > 0) {
throw new ServiceException("相同的发货地址和收货地址组合已存在");
}
}
private CommonRoute loadEditable(Long id, boolean checkDept) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");

View File

@@ -178,10 +178,8 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
throw new ServiceException("请选择需要删除的数据");
}
List<CreditScoreQuantification> list = listByIds(idList);
for (CreditScoreQuantification quantification : list) {
if (!Objects.equals(quantification.getStatus(), STATUS_DRAFT)) {
throw new ServiceException("仅草稿状态量表可删除");
}
if (list.size() != idList.size()) {
throw new ServiceException("评分量化表不存在");
}
deleteDetail(idList);
return deleteLogic(idList);
@@ -299,6 +297,7 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
CreditScoreCategoryVO category = findCategory(quantification.getCategories(), row.getCategoryName());
CreditScoreItemVO item = new CreditScoreItemVO();
item.setItemName(trimToEmpty(row.getItemName()));
item.setScore(row.getScore());
item.setScoreDescription(trimToNull(row.getScoreDescription()));
item.setOptionDescription(trimToNull(row.getOptionDescription()));
item.setOptions(new ArrayList<>());
@@ -348,6 +347,7 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
}
item = new CreditScoreItemVO();
item.setItemName(itemName);
item.setScore(row.getScore());
item.setScoreDescription(trimToNull(row.getScoreDescription()));
item.setOptionDescription(trimToNull(row.getOptionDescription()));
item.setOptions(new ArrayList<>());
@@ -390,6 +390,7 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
excel.setRowType(ROW_TYPE_ITEM);
excel.setCategoryName(category.getCategoryName());
excel.setItemName(item.getItemName());
excel.setScore(item.getScore());
excel.setScoreDescription(item.getScoreDescription());
excel.setOptionDescription(item.getOptionDescription());
return excel;
@@ -482,6 +483,10 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
validateLength(item.getItemName(), ITEM_NAME_MAX_LENGTH, "评分项目最多20汉字");
validateLength(item.getScoreDescription(), SCORE_DESCRIPTION_MAX_LENGTH, "得分说明最多300字符");
validateLength(item.getOptionDescription(), OPTION_NAME_MAX_LENGTH, "选项描述最多100字符");
if (Func.isEmpty(item.getScore())) {
throw new ServiceException(item.getItemName() + "分值不能为空");
}
validateNonNegative(item.getScore(), item.getItemName() + "分值不能小于0");
if (!itemNames.add(item.getItemName())) {
throw new ServiceException(category.getCategoryName() + "下评分项目名称不能重复");
}

View File

@@ -169,6 +169,25 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
return updateById(update);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean withdrawApproval(Long id) {
CustomerArchive customer = getById(id);
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
throw new ServiceException("客商档案不存在");
}
if (!List.of(APPROVAL_DRAFT, APPROVAL_REVIEWING).contains(customer.getApprovalStatus())) {
throw new ServiceException("仅未审核或审核中状态客商可撤回");
}
CustomerArchive update = new CustomerArchive();
update.setId(id);
update.setApprovalStatus(APPROVAL_DRAFT);
update.setCurrentNode("草稿");
update.setCurrentProcessor(AuthUtil.getUserName());
addChangeRecord(id, "撤回客商准入审批");
return updateById(update);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean approve(Long id) {
@@ -178,6 +197,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
validateApproval(detail);
CustomerArchive update = new CustomerArchive();
update.setId(id);
update.setAccessType(ACCESS_FORMAL);
update.setApprovalStatus(APPROVAL_APPROVED);
update.setCurrentNode("审核通过");
update.setCurrentProcessor(AuthUtil.getUserName());