调试mk
This commit is contained in:
@@ -63,6 +63,8 @@ public class AuthProvider {
|
|||||||
DEFAULT_SKIP_URL.add("/manager/check-upload");
|
DEFAULT_SKIP_URL.add("/manager/check-upload");
|
||||||
DEFAULT_SKIP_URL.add("/assets/**");
|
DEFAULT_SKIP_URL.add("/assets/**");
|
||||||
DEFAULT_SKIP_URL.add("/iam/sso/token/**");
|
DEFAULT_SKIP_URL.add("/iam/sso/token/**");
|
||||||
|
DEFAULT_SKIP_URL.add("/blade-transport/customer-archive/public/**");
|
||||||
|
DEFAULT_SKIP_URL.add("/customer-archive/public/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+6
@@ -43,6 +43,12 @@ public class MeasurementUnit extends BaseEntity {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "计量单位编码")
|
||||||
|
private String unitCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量单位
|
* 计量单位
|
||||||
*/
|
*/
|
||||||
|
|||||||
+12
-4
@@ -17,6 +17,7 @@ import org.springblade.process.pojo.dto.ApprovalDTO;
|
|||||||
import org.springblade.process.pojo.vo.ApprovalVO;
|
import org.springblade.process.pojo.vo.ApprovalVO;
|
||||||
import org.springblade.process.pojo.vo.ProcessApprovedRecordVO;
|
import org.springblade.process.pojo.vo.ProcessApprovedRecordVO;
|
||||||
import org.springblade.process.service.IBusinessProcessService;
|
import org.springblade.process.service.IBusinessProcessService;
|
||||||
|
import org.springblade.thirdparty.mk.pojo.dto.MKProcessCreateDTO;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -52,29 +53,36 @@ public class BusinessProcessController extends BladeController {
|
|||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/isEditView")
|
@PostMapping("/processSubmit")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "提交MK审核流", description = "调用mk processSubmit,传入templateCode/submitIdentity/formInstanceId")
|
||||||
|
public R<String> processSubmit(@Validated @RequestBody MKProcessCreateDTO param) {
|
||||||
|
return R.data(businessProcessService.processSubmit(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/isEditView")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
@Operation(summary = "是否编辑页", description = "传入业务id")
|
@Operation(summary = "是否编辑页", description = "传入业务id")
|
||||||
public R<Boolean> isEditView(@Valid @NotBlank(message = "业务id不能为空") String bizId) {
|
public R<Boolean> isEditView(@Valid @NotBlank(message = "业务id不能为空") String bizId) {
|
||||||
return R.data(businessProcessService.isEditView(bizId));
|
return R.data(businessProcessService.isEditView(bizId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getMKApprovalUrl")
|
@GetMapping("/getMKApprovalUrl")
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 4)
|
||||||
@Operation(summary = "获取mk审批页链接", description = "传入业务id或流程实例id")
|
@Operation(summary = "获取mk审批页链接", description = "传入业务id或流程实例id")
|
||||||
public R<String> getMKApprovalUrl(String bizId, String processInstanceId) {
|
public R<String> getMKApprovalUrl(String bizId, String processInstanceId) {
|
||||||
return R.data(businessProcessService.getMKApprovalUrl(bizId, processInstanceId));
|
return R.data(businessProcessService.getMKApprovalUrl(bizId, processInstanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getApprovedRecords")
|
@GetMapping("/getApprovedRecords")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 5)
|
||||||
@Operation(summary = "查询审批记录", description = "传入业务id或流程实例id")
|
@Operation(summary = "查询审批记录", description = "传入业务id或流程实例id")
|
||||||
public R<List<ProcessApprovedRecordVO>> getApprovedRecords(String bizId, String processInstanceId) {
|
public R<List<ProcessApprovedRecordVO>> getApprovedRecords(String bizId, String processInstanceId) {
|
||||||
return R.data(businessProcessService.queryApprovedRecords(bizId, processInstanceId));
|
return R.data(businessProcessService.queryApprovedRecords(bizId, processInstanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/downloadFile")
|
@GetMapping("/downloadFile")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "下载附件", description = "传入附件id")
|
@Operation(summary = "下载附件", description = "传入附件id")
|
||||||
public void downloadFile(HttpServletResponse response, @Valid @NotBlank(message = "附件id不能为空") String fileId) {
|
public void downloadFile(HttpServletResponse response, @Valid @NotBlank(message = "附件id不能为空") String fileId) {
|
||||||
businessProcessService.downloadFile(response, fileId);
|
businessProcessService.downloadFile(response, fileId);
|
||||||
|
|||||||
+9
@@ -6,6 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import org.springblade.process.pojo.dto.*;
|
import org.springblade.process.pojo.dto.*;
|
||||||
import org.springblade.process.pojo.entity.BusinessProcess;
|
import org.springblade.process.pojo.entity.BusinessProcess;
|
||||||
import org.springblade.process.pojo.vo.*;
|
import org.springblade.process.pojo.vo.*;
|
||||||
|
import org.springblade.thirdparty.mk.pojo.dto.MKProcessCreateDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -25,6 +26,14 @@ public interface IBusinessProcessService extends IService<BusinessProcess> {
|
|||||||
*/
|
*/
|
||||||
BusinessProcessVO submitBusinessProcess(BusinessProcessSubmitDTO<?> param);
|
BusinessProcessVO submitBusinessProcess(BusinessProcessSubmitDTO<?> param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接调用 MK processSubmit 提交流程
|
||||||
|
*
|
||||||
|
* @param param MK 流程创建参数
|
||||||
|
* @return 流程实例 id
|
||||||
|
*/
|
||||||
|
String processSubmit(MKProcessCreateDTO param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改业务流程状态
|
* 修改业务流程状态
|
||||||
* @param param
|
* @param param
|
||||||
|
|||||||
+73
@@ -24,6 +24,8 @@ import org.springblade.process.pojo.entity.BusinessProcess;
|
|||||||
import org.springblade.process.pojo.enums.TodoStatus;
|
import org.springblade.process.pojo.enums.TodoStatus;
|
||||||
import org.springblade.process.pojo.vo.*;
|
import org.springblade.process.pojo.vo.*;
|
||||||
import org.springblade.process.service.IBusinessProcessService;
|
import org.springblade.process.service.IBusinessProcessService;
|
||||||
|
import org.springblade.system.pojo.entity.User;
|
||||||
|
import org.springblade.system.service.IUserService;
|
||||||
import org.springblade.thirdparty.mk.config.MKProperties;
|
import org.springblade.thirdparty.mk.config.MKProperties;
|
||||||
import org.springblade.thirdparty.mk.constant.MKConstant;
|
import org.springblade.thirdparty.mk.constant.MKConstant;
|
||||||
import org.springblade.thirdparty.mk.constant.MKDoc;
|
import org.springblade.thirdparty.mk.constant.MKDoc;
|
||||||
@@ -61,6 +63,7 @@ public class BusinessProcessServiceImpl extends ServiceImpl<BusinessProcessMappe
|
|||||||
private final IMKService mkService;
|
private final IMKService mkService;
|
||||||
private final MKProperties mkProperties;
|
private final MKProperties mkProperties;
|
||||||
private final ApprovalConvert approvalConvert;
|
private final ApprovalConvert approvalConvert;
|
||||||
|
private final IUserService userService;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
@@ -114,6 +117,76 @@ public class BusinessProcessServiceImpl extends ServiceImpl<BusinessProcessMappe
|
|||||||
return businessProcessVO;
|
return businessProcessVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public String processSubmit(MKProcessCreateDTO param) {
|
||||||
|
AssertUtils.notNull(param, "提交流程参数不能为空");
|
||||||
|
AssertUtils.notBlank(param.getFormInstanceId(), "表单实例id不能为空");
|
||||||
|
AssertUtils.notBlank(param.getTemplateCode(), "模板编码不能为空");
|
||||||
|
// 前端拿到的手机号可能经 @Sensitive 脱敏(如 137****8880),这里从库取真实手机号覆盖
|
||||||
|
String loginName = resolveCurrentUserPhone();
|
||||||
|
AssertUtils.notBlank(loginName, "当前用户手机号为空,无法提交审核流");
|
||||||
|
param.setSubmitIdentity(loginName);
|
||||||
|
param.setLoginName(loginName);
|
||||||
|
log.info("调用mk processSubmit 参数:{}", JSON.toJSONString(param));
|
||||||
|
String processInstanceId = mkService.processSubmit(param);
|
||||||
|
AssertUtils.notBlank(processInstanceId, "提交流程失败,未返回流程实例id");
|
||||||
|
|
||||||
|
Long bizId;
|
||||||
|
try {
|
||||||
|
bizId = Long.valueOf(param.getFormInstanceId());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new ServiceException("表单实例id格式不正确");
|
||||||
|
}
|
||||||
|
BusinessProcess businessProcess = this.getOne(Wrappers.<BusinessProcess>lambdaQuery()
|
||||||
|
.eq(BusinessProcess::getBizId, bizId)
|
||||||
|
);
|
||||||
|
if (businessProcess == null) {
|
||||||
|
businessProcess = new BusinessProcess();
|
||||||
|
businessProcess.setBizId(bizId);
|
||||||
|
businessProcess.setProcessType(param.getTemplateCode());
|
||||||
|
businessProcess.setSubject(param.getSubject());
|
||||||
|
businessProcess.setPromoterId(AuthUtil.getUserId());
|
||||||
|
businessProcess.setPromoterName(AuthUtil.getNickName());
|
||||||
|
businessProcess.setPromoterLoginName(loginName);
|
||||||
|
businessProcess.setSubmitTime(new Date());
|
||||||
|
} else {
|
||||||
|
businessProcess.setProcessType(param.getTemplateCode());
|
||||||
|
if (StringUtil.isNotBlank(param.getSubject())) {
|
||||||
|
businessProcess.setSubject(param.getSubject());
|
||||||
|
}
|
||||||
|
businessProcess.setPromoterLoginName(loginName);
|
||||||
|
if (businessProcess.getSubmitTime() == null) {
|
||||||
|
businessProcess.setSubmitTime(new Date());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
businessProcess.setProcessInstanceId(processInstanceId);
|
||||||
|
businessProcess.setApproveStatus(ApproveStatusEnum.APPROVING.getValue());
|
||||||
|
this.saveOrUpdate(businessProcess);
|
||||||
|
return processInstanceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从当前登录用户实体读取真实手机号(绕过接口返回脱敏)
|
||||||
|
*/
|
||||||
|
private String resolveCurrentUserPhone() {
|
||||||
|
Long userId = AuthUtil.getUserId();
|
||||||
|
if (userId != null) {
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
if (user != null && StringUtil.isNotBlank(user.getPhone()) && !user.getPhone().contains("*")) {
|
||||||
|
return user.getPhone().trim();
|
||||||
|
}
|
||||||
|
if (user != null && StringUtil.isNotBlank(user.getAccount()) && user.getAccount().matches("^1\\d{10}$")) {
|
||||||
|
return user.getAccount().trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String account = AuthUtil.getUserAccount();
|
||||||
|
if (StringUtil.isNotBlank(account) && account.matches("^1\\d{10}$")) {
|
||||||
|
return account.trim();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public String updateBusinessProcessStatus(BusinessProcessUpdateDTO param) {
|
public String updateBusinessProcessStatus(BusinessProcessUpdateDTO param) {
|
||||||
|
|||||||
+6
@@ -13,6 +13,7 @@
|
|||||||
<result column="update_time" property="updateTime"/>
|
<result column="update_time" property="updateTime"/>
|
||||||
<result column="status" property="status"/>
|
<result column="status" property="status"/>
|
||||||
<result column="is_deleted" property="isDeleted"/>
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
<result column="unit_code" property="unitCode"/>
|
||||||
<result column="unit_name" property="unitName"/>
|
<result column="unit_name" property="unitName"/>
|
||||||
<result column="dimension" property="dimension"/>
|
<result column="dimension" property="dimension"/>
|
||||||
<result column="remark" property="remark"/>
|
<result column="remark" property="remark"/>
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
mmu.update_time,
|
mmu.update_time,
|
||||||
mmu.status,
|
mmu.status,
|
||||||
mmu.is_deleted,
|
mmu.is_deleted,
|
||||||
|
mmu.unit_code,
|
||||||
mmu.unit_name,
|
mmu.unit_name,
|
||||||
mmu.dimension,
|
mmu.dimension,
|
||||||
mmu.remark
|
mmu.remark
|
||||||
@@ -39,6 +41,10 @@
|
|||||||
LEFT JOIN blade_user uu ON uu.id = mmu.update_user
|
LEFT JOIN blade_user uu ON uu.id = mmu.update_user
|
||||||
WHERE
|
WHERE
|
||||||
mmu.is_deleted = 0
|
mmu.is_deleted = 0
|
||||||
|
<if test="measurementUnit.unitCode != null and measurementUnit.unitCode != ''">
|
||||||
|
<bind name="unitCodeLike" value="'%' + measurementUnit.unitCode + '%'"/>
|
||||||
|
AND mmu.unit_code LIKE #{unitCodeLike}
|
||||||
|
</if>
|
||||||
<if test="measurementUnit.unitName != null and measurementUnit.unitName != ''">
|
<if test="measurementUnit.unitName != null and measurementUnit.unitName != ''">
|
||||||
<bind name="unitNameLike" value="'%' + measurementUnit.unitName + '%'"/>
|
<bind name="unitNameLike" value="'%' + measurementUnit.unitName + '%'"/>
|
||||||
AND mmu.unit_name LIKE #{unitNameLike}
|
AND mmu.unit_name LIKE #{unitNameLike}
|
||||||
|
|||||||
+21
@@ -46,6 +46,7 @@ public class MeasurementUnitServiceImpl extends BaseServiceImpl<MeasurementUnitM
|
|||||||
|
|
||||||
private static final int STATUS_ENABLED = 1;
|
private static final int STATUS_ENABLED = 1;
|
||||||
private static final int STATUS_DISABLED = 2;
|
private static final int STATUS_DISABLED = 2;
|
||||||
|
private static final int UNIT_CODE_MAX_LENGTH = 50;
|
||||||
private static final int UNIT_NAME_MAX_LENGTH = 50;
|
private static final int UNIT_NAME_MAX_LENGTH = 50;
|
||||||
private static final int DIMENSION_MAX_LENGTH = 20;
|
private static final int DIMENSION_MAX_LENGTH = 20;
|
||||||
private static final int REMARK_MAX_LENGTH = 200;
|
private static final int REMARK_MAX_LENGTH = 200;
|
||||||
@@ -85,6 +86,7 @@ public class MeasurementUnitServiceImpl extends BaseServiceImpl<MeasurementUnitM
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void prepare(MeasurementUnit measurementUnit) {
|
private void prepare(MeasurementUnit measurementUnit) {
|
||||||
|
measurementUnit.setUnitCode(trimToEmpty(measurementUnit.getUnitCode()));
|
||||||
measurementUnit.setUnitName(trimToEmpty(measurementUnit.getUnitName()));
|
measurementUnit.setUnitName(trimToEmpty(measurementUnit.getUnitName()));
|
||||||
measurementUnit.setDimension(trimToEmpty(measurementUnit.getDimension()));
|
measurementUnit.setDimension(trimToEmpty(measurementUnit.getDimension()));
|
||||||
measurementUnit.setRemark(trimToNull(measurementUnit.getRemark()));
|
measurementUnit.setRemark(trimToNull(measurementUnit.getRemark()));
|
||||||
@@ -94,6 +96,12 @@ public class MeasurementUnitServiceImpl extends BaseServiceImpl<MeasurementUnitM
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validate(MeasurementUnit measurementUnit) {
|
private void validate(MeasurementUnit measurementUnit) {
|
||||||
|
if (Func.isEmpty(measurementUnit.getUnitCode())) {
|
||||||
|
throw new ServiceException("计量单位编码不能为空");
|
||||||
|
}
|
||||||
|
if (measurementUnit.getUnitCode().length() > UNIT_CODE_MAX_LENGTH) {
|
||||||
|
throw new ServiceException("计量单位编码不能超过50字");
|
||||||
|
}
|
||||||
if (Func.isEmpty(measurementUnit.getUnitName())) {
|
if (Func.isEmpty(measurementUnit.getUnitName())) {
|
||||||
throw new ServiceException("计量单位不能为空");
|
throw new ServiceException("计量单位不能为空");
|
||||||
}
|
}
|
||||||
@@ -115,9 +123,22 @@ public class MeasurementUnitServiceImpl extends BaseServiceImpl<MeasurementUnitM
|
|||||||
&& !Objects.equals(measurementUnit.getStatus(), STATUS_DISABLED)) {
|
&& !Objects.equals(measurementUnit.getStatus(), STATUS_DISABLED)) {
|
||||||
throw new ServiceException("启停状态不正确");
|
throw new ServiceException("启停状态不正确");
|
||||||
}
|
}
|
||||||
|
validateUniqueUnitCode(measurementUnit);
|
||||||
validateUniqueUnitName(measurementUnit);
|
validateUniqueUnitName(measurementUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateUniqueUnitCode(MeasurementUnit measurementUnit) {
|
||||||
|
LambdaQueryWrapper<MeasurementUnit> queryWrapper = Wrappers.<MeasurementUnit>lambdaQuery()
|
||||||
|
.eq(MeasurementUnit::getUnitCode, measurementUnit.getUnitCode())
|
||||||
|
.eq(MeasurementUnit::getIsDeleted, 0);
|
||||||
|
if (Func.isNotEmpty(measurementUnit.getId())) {
|
||||||
|
queryWrapper.ne(MeasurementUnit::getId, measurementUnit.getId());
|
||||||
|
}
|
||||||
|
if (count(queryWrapper) > 0L) {
|
||||||
|
throw new ServiceException("该计量单位编码已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void validateUniqueUnitName(MeasurementUnit measurementUnit) {
|
private void validateUniqueUnitName(MeasurementUnit measurementUnit) {
|
||||||
LambdaQueryWrapper<MeasurementUnit> queryWrapper = Wrappers.<MeasurementUnit>lambdaQuery()
|
LambdaQueryWrapper<MeasurementUnit> queryWrapper = Wrappers.<MeasurementUnit>lambdaQuery()
|
||||||
.eq(MeasurementUnit::getUnitName, measurementUnit.getUnitName())
|
.eq(MeasurementUnit::getUnitName, measurementUnit.getUnitName())
|
||||||
|
|||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.transport.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springblade.core.mp.support.Condition;
|
||||||
|
import org.springblade.core.mp.support.Query;
|
||||||
|
import org.springblade.core.secure.annotation.PreAuth;
|
||||||
|
import org.springblade.core.secure.constant.AuthConstant;
|
||||||
|
import org.springblade.core.tenant.annotation.TenantIgnore;
|
||||||
|
import org.springblade.core.tool.api.R;
|
||||||
|
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||||
|
import org.springblade.transport.pojo.vo.CustomerChangeRecordVO;
|
||||||
|
import org.springblade.transport.service.ICustomerArchiveService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客商档案公开查看 控制器
|
||||||
|
*
|
||||||
|
* @author Chill
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
@PreAuth(AuthConstant.PERMIT_ALL)
|
||||||
|
@RequestMapping("/customer-archive/public")
|
||||||
|
@Tag(name = "客商档案公开查看", description = "客商档案公开查看")
|
||||||
|
public class CustomerArchivePublicController {
|
||||||
|
|
||||||
|
private final ICustomerArchiveService customerArchiveService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公开详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@Operation(summary = "公开详情", description = "传入id,无需登录")
|
||||||
|
public R<CustomerArchiveVO> detail(@Parameter(description = "主键", required = true) @RequestParam Long id) {
|
||||||
|
return R.data(customerArchiveService.publicDetail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公开变更记录分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/change-record/list")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "公开变更记录分页", description = "传入客商ID,无需登录")
|
||||||
|
public R<IPage<CustomerChangeRecordVO>> changeRecordList(
|
||||||
|
@Parameter(description = "客商ID", required = true) @RequestParam Long customerId, Query query) {
|
||||||
|
return R.data(customerArchiveService.publicChangeRecordPage(Condition.getPage(query), customerId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+17
@@ -66,6 +66,23 @@ public interface ICustomerArchiveService extends BaseService<CustomerArchive> {
|
|||||||
*/
|
*/
|
||||||
CustomerArchiveVO detail(Long id);
|
CustomerArchiveVO detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公开查看详情(不校验登录态与数据权限)
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 客商档案详情
|
||||||
|
*/
|
||||||
|
CustomerArchiveVO publicDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公开查看变更记录分页(不校验登录态与数据权限)
|
||||||
|
*
|
||||||
|
* @param page 分页参数
|
||||||
|
* @param customerId 客商ID
|
||||||
|
* @return 变更记录分页
|
||||||
|
*/
|
||||||
|
IPage<CustomerChangeRecordVO> publicChangeRecordPage(IPage<CustomerChangeRecordVO> page, Long customerId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改客商档案
|
* 新增或修改客商档案
|
||||||
* <p>仅当 {@code customer.recordChange = true}(前端点「提交」)时写入变更记录;「保存」不落变更记录。</p>
|
* <p>仅当 {@code customer.recordChange = true}(前端点「提交」)时写入变更记录;「保存」不落变更记录。</p>
|
||||||
|
|||||||
+52
-22
@@ -32,6 +32,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
|
import org.springblade.core.tenant.annotation.TenantIgnore;
|
||||||
import org.springblade.core.tool.jackson.JsonUtil;
|
import org.springblade.core.tool.jackson.JsonUtil;
|
||||||
import org.springblade.core.tool.utils.BeanUtil;
|
import org.springblade.core.tool.utils.BeanUtil;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
@@ -151,31 +152,28 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
throw new ServiceException("客商ID不能为空");
|
throw new ServiceException("客商ID不能为空");
|
||||||
}
|
}
|
||||||
ensureCustomerAccessible(customerId);
|
ensureCustomerAccessible(customerId);
|
||||||
IPage<CustomerChangeRecord> recordPage = changeRecordMapper.selectPage(
|
return queryChangeRecordPage(page, customerId);
|
||||||
new Page<>(page.getCurrent(), page.getSize()),
|
}
|
||||||
Wrappers.<CustomerChangeRecord>lambdaQuery()
|
|
||||||
.eq(CustomerChangeRecord::getCustomerId, customerId)
|
@Override
|
||||||
.eq(CustomerChangeRecord::getIsDeleted, 0)
|
@TenantIgnore
|
||||||
.orderByDesc(CustomerChangeRecord::getChangeTime));
|
public IPage<CustomerChangeRecordVO> publicChangeRecordPage(IPage<CustomerChangeRecordVO> page, Long customerId) {
|
||||||
page.setTotal(recordPage.getTotal());
|
if (Func.isEmpty(customerId)) {
|
||||||
return page.setRecords(recordPage.getRecords().stream()
|
throw new ServiceException("客商ID不能为空");
|
||||||
.map(record -> Objects.requireNonNull(BeanUtil.copyProperties(record, CustomerChangeRecordVO.class)))
|
}
|
||||||
.toList());
|
getExistingCustomer(customerId);
|
||||||
|
return queryChangeRecordPage(page, customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomerArchiveVO detail(Long id) {
|
public CustomerArchiveVO detail(Long id) {
|
||||||
if (Func.isEmpty(id)) {
|
return buildDetail(ensureCustomerAccessible(id));
|
||||||
throw new ServiceException("主键不能为空");
|
}
|
||||||
}
|
|
||||||
CustomerArchive customer = ensureCustomerAccessible(id);
|
@Override
|
||||||
CustomerArchiveVO detail = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchiveVO.class));
|
@TenantIgnore
|
||||||
detail.setContacts(loadContacts(id));
|
public CustomerArchiveVO publicDetail(Long id) {
|
||||||
detail.setReceiptAccounts(loadReceiptAccounts(id));
|
return buildDetail(getExistingCustomer(id));
|
||||||
detail.setInvoices(loadInvoices(id));
|
|
||||||
detail.setScores(loadScores(id));
|
|
||||||
fillFundUseRisk(List.of(detail));
|
|
||||||
return detail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -987,11 +985,43 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
return CUSTOMER_CODE_PREFIX + String.format("%06d", nextNumber);
|
return CUSTOMER_CODE_PREFIX + String.format("%06d", nextNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomerArchive ensureCustomerAccessible(Long id) {
|
private IPage<CustomerChangeRecordVO> queryChangeRecordPage(IPage<CustomerChangeRecordVO> page, Long customerId) {
|
||||||
|
IPage<CustomerChangeRecord> recordPage = changeRecordMapper.selectPage(
|
||||||
|
new Page<>(page.getCurrent(), page.getSize()),
|
||||||
|
Wrappers.<CustomerChangeRecord>lambdaQuery()
|
||||||
|
.eq(CustomerChangeRecord::getCustomerId, customerId)
|
||||||
|
.eq(CustomerChangeRecord::getIsDeleted, 0)
|
||||||
|
.orderByDesc(CustomerChangeRecord::getChangeTime));
|
||||||
|
page.setTotal(recordPage.getTotal());
|
||||||
|
return page.setRecords(recordPage.getRecords().stream()
|
||||||
|
.map(record -> Objects.requireNonNull(BeanUtil.copyProperties(record, CustomerChangeRecordVO.class)))
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomerArchiveVO buildDetail(CustomerArchive customer) {
|
||||||
|
CustomerArchiveVO detail = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchiveVO.class));
|
||||||
|
Long id = customer.getId();
|
||||||
|
detail.setContacts(loadContacts(id));
|
||||||
|
detail.setReceiptAccounts(loadReceiptAccounts(id));
|
||||||
|
detail.setInvoices(loadInvoices(id));
|
||||||
|
detail.setScores(loadScores(id));
|
||||||
|
fillFundUseRisk(List.of(detail));
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomerArchive getExistingCustomer(Long id) {
|
||||||
|
if (Func.isEmpty(id)) {
|
||||||
|
throw new ServiceException("主键不能为空");
|
||||||
|
}
|
||||||
CustomerArchive customer = getById(id);
|
CustomerArchive customer = getById(id);
|
||||||
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
|
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
|
||||||
throw new ServiceException("客商档案不存在");
|
throw new ServiceException("客商档案不存在");
|
||||||
}
|
}
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomerArchive ensureCustomerAccessible(Long id) {
|
||||||
|
CustomerArchive customer = getExistingCustomer(id);
|
||||||
if (baseMapper.selectCustomerPermissionCount(id, AuthUtil.getUserId()) == 0) {
|
if (baseMapper.selectCustomerPermissionCount(id, AuthUtil.getUserId()) == 0) {
|
||||||
throw new ServiceException("无权访问该客商档案");
|
throw new ServiceException("无权访问该客商档案");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,8 @@ blade:
|
|||||||
# 退出登录:允许无令牌/令牌失效时也能调用(服务端对无用户直接返回成功)
|
# 退出登录:允许无令牌/令牌失效时也能调用(服务端对无用户直接返回成功)
|
||||||
- /oauth/logout/**
|
- /oauth/logout/**
|
||||||
- /blade-auth/oauth/logout/**
|
- /blade-auth/oauth/logout/**
|
||||||
|
- /blade-transport/customer-archive/public/**
|
||||||
|
- /customer-archive/public/**
|
||||||
#授权认证配置
|
#授权认证配置
|
||||||
auth:
|
auth:
|
||||||
- method: ALL
|
- method: ALL
|
||||||
|
|||||||
@@ -1757,6 +1757,7 @@ INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `s
|
|||||||
DROP TABLE IF EXISTS `blade_measurement_unit`;
|
DROP TABLE IF EXISTS `blade_measurement_unit`;
|
||||||
CREATE TABLE `blade_measurement_unit` (
|
CREATE TABLE `blade_measurement_unit` (
|
||||||
`id` bigint NOT NULL COMMENT '主键',
|
`id` bigint NOT NULL COMMENT '主键',
|
||||||
|
`unit_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位编码',
|
||||||
`unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位',
|
`unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位',
|
||||||
`dimension` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量维度',
|
`dimension` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量维度',
|
||||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
@@ -1768,6 +1769,7 @@ CREATE TABLE `blade_measurement_unit` (
|
|||||||
`status` int NULL DEFAULT 1 COMMENT '状态',
|
`status` int NULL DEFAULT 1 COMMENT '状态',
|
||||||
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `uk_measurement_unit_code`(`unit_code`) USING BTREE,
|
||||||
UNIQUE INDEX `uk_measurement_unit_name`(`unit_name`) USING BTREE,
|
UNIQUE INDEX `uk_measurement_unit_name`(`unit_name`) USING BTREE,
|
||||||
INDEX `idx_measurement_unit_dimension`(`dimension`) USING BTREE,
|
INDEX `idx_measurement_unit_dimension`(`dimension`) USING BTREE,
|
||||||
INDEX `idx_measurement_unit_status`(`status`) USING BTREE
|
INDEX `idx_measurement_unit_status`(`status`) USING BTREE
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
DROP TABLE IF EXISTS `blade_measurement_unit`;
|
DROP TABLE IF EXISTS `blade_measurement_unit`;
|
||||||
CREATE TABLE `blade_measurement_unit` (
|
CREATE TABLE `blade_measurement_unit` (
|
||||||
`id` bigint NOT NULL COMMENT '主键',
|
`id` bigint NOT NULL COMMENT '主键',
|
||||||
|
`unit_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位编码',
|
||||||
`unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位',
|
`unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位',
|
||||||
`dimension` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量维度',
|
`dimension` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量维度',
|
||||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
@@ -15,6 +16,7 @@ CREATE TABLE `blade_measurement_unit` (
|
|||||||
`status` int NULL DEFAULT 1 COMMENT '状态',
|
`status` int NULL DEFAULT 1 COMMENT '状态',
|
||||||
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `uk_measurement_unit_code`(`unit_code`) USING BTREE,
|
||||||
UNIQUE INDEX `uk_measurement_unit_name`(`unit_name`) USING BTREE,
|
UNIQUE INDEX `uk_measurement_unit_name`(`unit_name`) USING BTREE,
|
||||||
INDEX `idx_measurement_unit_dimension`(`dimension`) USING BTREE,
|
INDEX `idx_measurement_unit_dimension`(`dimension`) USING BTREE,
|
||||||
INDEX `idx_measurement_unit_status`(`status`) USING BTREE
|
INDEX `idx_measurement_unit_status`(`status`) USING BTREE
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-- 计量单位新增计量单位编码
|
||||||
|
ALTER TABLE `blade_measurement_unit`
|
||||||
|
ADD COLUMN `unit_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '计量单位编码' AFTER `id`;
|
||||||
|
|
||||||
|
UPDATE `blade_measurement_unit`
|
||||||
|
SET `unit_code` = CONCAT('MU', `id`)
|
||||||
|
WHERE `unit_code` IS NULL OR `unit_code` = '';
|
||||||
|
|
||||||
|
ALTER TABLE `blade_measurement_unit`
|
||||||
|
MODIFY COLUMN `unit_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计量单位编码',
|
||||||
|
ADD UNIQUE INDEX `uk_measurement_unit_code`(`unit_code`) USING BTREE;
|
||||||
Reference in New Issue
Block a user