feat(crm/crmMailingApply): 新增并实现邮寄申请模块业务逻辑
- 添加邮件申请实体类 CrmMailingApply,定义完整字段及逻辑删除标志 - 新增业务对象 CrmMailingApplyBo,支持校验注解和自动映射 - 实现 CrmMailingApplyController,提供增删改查及审批流程接口 - 编写 Mapper 接口及 XML 映射,支持复杂查询和批量操作 - 完成业务层 CrmMailingApplyServiceImpl,含分页查询、条件构造、数据校验 - 集成工作流启动与监听,确保审批流程正常触发与流程变量处理 - 对发货单明细表格渲染策略文档注释进行详细补充说明 - 增加请求参数校验及防重提交注解保障接口安全与幂等性dev
parent
5e9c90e3bf
commit
bb41043301
@ -0,0 +1,144 @@
|
||||
package org.dromara.oa.crm.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.oa.crm.domain.bo.CrmMailingApplyBo;
|
||||
import org.dromara.oa.crm.domain.vo.CrmMailingApplyVo;
|
||||
import org.dromara.oa.crm.service.ICrmMailingApplyService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 邮寄申请
|
||||
* 前端访问路由地址为:/oa/crm/crmMailingApply
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-12
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/crm/crmMailingApply")
|
||||
public class CrmMailingApplyController extends BaseController {
|
||||
|
||||
private final ICrmMailingApplyService crmMailingApplyService;
|
||||
|
||||
/**
|
||||
* 查询邮寄申请列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CrmMailingApplyVo> list(CrmMailingApplyBo bo, PageQuery pageQuery) {
|
||||
return crmMailingApplyService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出邮寄申请列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:export")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CrmMailingApplyBo bo, HttpServletResponse response) {
|
||||
List<CrmMailingApplyVo> list = crmMailingApplyService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "邮寄申请", CrmMailingApplyVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取邮寄申请详细信息
|
||||
*
|
||||
* @param mailingApplyId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:query")
|
||||
@GetMapping("/{mailingApplyId}")
|
||||
public R<CrmMailingApplyVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("mailingApplyId") Long mailingApplyId) {
|
||||
return R.ok(crmMailingApplyService.queryById(mailingApplyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增邮寄申请
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:add")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<CrmMailingApplyVo> add(@Validated(AddGroup.class) @RequestBody CrmMailingApplyBo bo) {
|
||||
crmMailingApplyService.insertByBo(bo);
|
||||
return R.ok(crmMailingApplyService.queryById(bo.getMailingApplyId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改邮寄申请
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:edit")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CrmMailingApplyBo bo) {
|
||||
return toAjax(crmMailingApplyService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除邮寄申请
|
||||
*
|
||||
* @param mailingApplyIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:remove")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{mailingApplyIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("mailingApplyIds") Long[] mailingApplyIds) {
|
||||
return toAjax(crmMailingApplyService.deleteWithValidByIds(List.of(mailingApplyIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询邮寄申请列表
|
||||
*/
|
||||
@GetMapping("/getCrmMailingApplyList")
|
||||
public R<List<CrmMailingApplyVo>> getCrmMailingApplyList(CrmMailingApplyBo bo) {
|
||||
List<CrmMailingApplyVo> list = crmMailingApplyService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交邮寄申请并发起审批流程
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:add")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/submitAndFlowStart")
|
||||
public R<CrmMailingApplyVo> mailingApplySubmitAndFlowStart(@RequestBody CrmMailingApplyBo bo) {
|
||||
return R.ok(crmMailingApplyService.mailingApplySubmitAndFlowStart(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新签收时间
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmMailingApply:edit")
|
||||
@Log(title = "邮寄申请", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/signTime")
|
||||
public R<CrmMailingApplyVo> updateSignTime(@RequestBody CrmMailingApplyBo bo) {
|
||||
if (bo == null || bo.getMailingApplyId() == null) {
|
||||
throw new ServiceException("邮寄申请ID不能为空");
|
||||
}
|
||||
return R.ok(crmMailingApplyService.updateSignTime(bo.getMailingApplyId(), bo.getSignTime()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package org.dromara.oa.crm.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.oa.crm.domain.bo.CrmMailingApplyBo;
|
||||
import org.dromara.oa.crm.domain.vo.CrmMailingApplyVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 邮寄申请Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-12
|
||||
*/
|
||||
public interface ICrmMailingApplyService {
|
||||
|
||||
/**
|
||||
* 查询邮寄申请
|
||||
*
|
||||
* @param mailingApplyId 主键
|
||||
* @return 邮寄申请
|
||||
*/
|
||||
CrmMailingApplyVo queryById(Long mailingApplyId);
|
||||
|
||||
/**
|
||||
* 分页查询邮寄申请列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 邮寄申请分页列表
|
||||
*/
|
||||
TableDataInfo<CrmMailingApplyVo> queryPageList(CrmMailingApplyBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的邮寄申请列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 邮寄申请列表
|
||||
*/
|
||||
List<CrmMailingApplyVo> queryList(CrmMailingApplyBo bo);
|
||||
|
||||
/**
|
||||
* 新增邮寄申请
|
||||
*
|
||||
* @param bo 邮寄申请
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(CrmMailingApplyBo bo);
|
||||
|
||||
/**
|
||||
* 修改邮寄申请
|
||||
*
|
||||
* @param bo 邮寄申请
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(CrmMailingApplyBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除邮寄申请信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 提交邮寄申请并发起审批流程
|
||||
*
|
||||
* @param bo 邮寄申请
|
||||
* @return 邮寄申请VO
|
||||
*/
|
||||
CrmMailingApplyVo mailingApplySubmitAndFlowStart(CrmMailingApplyBo bo);
|
||||
|
||||
/**
|
||||
* 更新签收时间
|
||||
*
|
||||
* @param mailingApplyId 邮寄申请ID
|
||||
* @param signTime 签收时间
|
||||
* @return 邮寄申请VO
|
||||
*/
|
||||
CrmMailingApplyVo updateSignTime(Long mailingApplyId, Date signTime);
|
||||
}
|
||||
@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.oa.crm.mapper.CrmMailingApplyMapper">
|
||||
<resultMap type="org.dromara.oa.crm.domain.vo.CrmMailingApplyVo" id="CrmMailingApplyResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomCrmMailingApplyVoList" resultMap="CrmMailingApplyResult">
|
||||
select t.mailing_apply_id, t.mailing_apply_code, t.tenant_id, t.application_date, t.handler_id, t.handler_name,
|
||||
t.dept_id, d.dept_name, t.province, t.weight, t.mailing_type, t.mailing_fee, t.express_no, t.item_info,
|
||||
t.project_id, t.project_code, t.project_name, t.oss_id, t.mailing_apply_status, t.flow_status,
|
||||
t.logistics_status, t.mailing_time, t.sign_time, t.remark, t.del_flag, t.create_dept, t.create_by,
|
||||
t.create_time, t.update_by, t.update_time
|
||||
from crm_mailing_apply t
|
||||
left join sys_dept d on t.dept_id = d.dept_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询详情 -->
|
||||
<select id="selectCustomCrmMailingApplyVoById" resultMap="CrmMailingApplyResult">
|
||||
select t.mailing_apply_id, t.mailing_apply_code, t.tenant_id, t.application_date, t.handler_id, t.handler_name,
|
||||
t.dept_id, d.dept_name, t.province, t.weight, t.mailing_type, t.mailing_fee, t.express_no, t.item_info,
|
||||
t.project_id, t.project_code, t.project_name, t.oss_id, t.mailing_apply_status, t.flow_status,
|
||||
t.logistics_status, t.mailing_time, t.sign_time, t.remark, t.del_flag, t.create_dept, t.create_by,
|
||||
t.create_time, t.update_by, t.update_time
|
||||
from crm_mailing_apply t
|
||||
left join sys_dept d on t.dept_id = d.dept_id
|
||||
where t.mailing_apply_id = #{mailingApplyId} and t.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<!-- 批量查询 - 根据ID列表 -->
|
||||
<select id="selectCustomCrmMailingApplyVoByIds" resultMap="CrmMailingApplyResult">
|
||||
select t.mailing_apply_id, t.mailing_apply_code, t.tenant_id, t.application_date, t.handler_id, t.handler_name, t.dept_id, t.province, t.weight, t.mailing_type, t.mailing_fee, t.express_no, t.item_info, t.project_id, t.project_code, t.project_name, t.oss_id, t.mailing_apply_status, t.flow_status, t.logistics_status, t.mailing_time, t.sign_time, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_mailing_apply t
|
||||
where t.del_flag = '0' and t.mailing_apply_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 统计查询 -->
|
||||
<select id="countCustomCrmMailingApply" resultType="java.lang.Long">
|
||||
select count(1) from crm_mailing_apply t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 分页查询(带自定义条件) -->
|
||||
<select id="selectCustomCrmMailingApplyVoPage" resultMap="CrmMailingApplyResult">
|
||||
select t.mailing_apply_id, t.mailing_apply_code, t.tenant_id, t.application_date, t.handler_id, t.handler_name, t.dept_id, t.province, t.weight, t.mailing_type, t.mailing_fee, t.express_no, t.item_info, t.project_id, t.project_code, t.project_name, t.oss_id, t.mailing_apply_status, t.flow_status, t.logistics_status, t.mailing_time, t.sign_time, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_mailing_apply t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsertCrmMailingApply">
|
||||
insert into crm_mailing_apply(
|
||||
mailing_apply_code,
|
||||
|
||||
tenant_id,
|
||||
|
||||
application_date,
|
||||
|
||||
handler_id,
|
||||
|
||||
handler_name,
|
||||
|
||||
dept_id,
|
||||
|
||||
province,
|
||||
|
||||
weight,
|
||||
|
||||
mailing_type,
|
||||
|
||||
mailing_fee,
|
||||
|
||||
express_no,
|
||||
|
||||
item_info,
|
||||
|
||||
project_id,
|
||||
|
||||
project_code,
|
||||
|
||||
project_name,
|
||||
|
||||
oss_id,
|
||||
|
||||
mailing_apply_status,
|
||||
|
||||
flow_status,
|
||||
|
||||
logistics_status,
|
||||
|
||||
mailing_time,
|
||||
|
||||
sign_time,
|
||||
|
||||
remark,
|
||||
|
||||
del_flag,
|
||||
|
||||
create_dept,
|
||||
|
||||
create_by,
|
||||
|
||||
create_time,
|
||||
|
||||
update_by,
|
||||
|
||||
update_time
|
||||
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.mailingApplyCode},
|
||||
|
||||
#{item.tenantId},
|
||||
|
||||
#{item.applicationDate},
|
||||
|
||||
#{item.handlerId},
|
||||
|
||||
#{item.handlerName},
|
||||
|
||||
#{item.deptId},
|
||||
|
||||
#{item.province},
|
||||
|
||||
#{item.weight},
|
||||
|
||||
#{item.mailingType},
|
||||
|
||||
#{item.mailingFee},
|
||||
|
||||
#{item.expressNo},
|
||||
|
||||
#{item.itemInfo},
|
||||
|
||||
#{item.projectId},
|
||||
|
||||
#{item.projectCode},
|
||||
|
||||
#{item.projectName},
|
||||
|
||||
#{item.ossId},
|
||||
|
||||
#{item.mailingApplyStatus},
|
||||
|
||||
#{item.flowStatus},
|
||||
|
||||
#{item.logisticsStatus},
|
||||
|
||||
#{item.mailingTime},
|
||||
|
||||
#{item.signTime},
|
||||
|
||||
#{item.remark},
|
||||
|
||||
#{item.delFlag},
|
||||
|
||||
#{item.createDept},
|
||||
|
||||
#{item.createBy},
|
||||
|
||||
#{item.createTime},
|
||||
|
||||
#{item.updateBy},
|
||||
|
||||
#{item.updateTime}
|
||||
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量更新 -->
|
||||
<update id="batchUpdateCrmMailingApply">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
update crm_mailing_apply t
|
||||
<set>
|
||||
<if test="item.mailingApplyCode != null and item.mailingApplyCode != ''">
|
||||
t.mailing_apply_code = #{item.mailingApplyCode},
|
||||
</if>
|
||||
<if test="item.tenantId != null and item.tenantId != ''">
|
||||
t.tenant_id = #{item.tenantId},
|
||||
</if>
|
||||
<if test="item.applicationDate != null">
|
||||
t.application_date = #{item.applicationDate},
|
||||
</if>
|
||||
<if test="item.handlerId != null">
|
||||
t.handler_id = #{item.handlerId},
|
||||
</if>
|
||||
<if test="item.handlerName != null and item.handlerName != ''">
|
||||
t.handler_name = #{item.handlerName},
|
||||
</if>
|
||||
<if test="item.deptId != null">
|
||||
t.dept_id = #{item.deptId},
|
||||
</if>
|
||||
<if test="item.province != null and item.province != ''">
|
||||
t.province = #{item.province},
|
||||
</if>
|
||||
<if test="item.weight != null">
|
||||
t.weight = #{item.weight},
|
||||
</if>
|
||||
<if test="item.mailingType != null and item.mailingType != ''">
|
||||
t.mailing_type = #{item.mailingType},
|
||||
</if>
|
||||
<if test="item.mailingFee != null">
|
||||
t.mailing_fee = #{item.mailingFee},
|
||||
</if>
|
||||
<if test="item.expressNo != null and item.expressNo != ''">
|
||||
t.express_no = #{item.expressNo},
|
||||
</if>
|
||||
<if test="item.itemInfo != null and item.itemInfo != ''">
|
||||
t.item_info = #{item.itemInfo},
|
||||
</if>
|
||||
<if test="item.projectId != null">
|
||||
t.project_id = #{item.projectId},
|
||||
</if>
|
||||
<if test="item.projectCode != null and item.projectCode != ''">
|
||||
t.project_code = #{item.projectCode},
|
||||
</if>
|
||||
<if test="item.projectName != null and item.projectName != ''">
|
||||
t.project_name = #{item.projectName},
|
||||
</if>
|
||||
<if test="item.ossId != null and item.ossId != ''">
|
||||
t.oss_id = #{item.ossId},
|
||||
</if>
|
||||
<if test="item.mailingApplyStatus != null and item.mailingApplyStatus != ''">
|
||||
t.mailing_apply_status = #{item.mailingApplyStatus},
|
||||
</if>
|
||||
<if test="item.flowStatus != null and item.flowStatus != ''">
|
||||
t.flow_status = #{item.flowStatus},
|
||||
</if>
|
||||
<if test="item.logisticsStatus != null and item.logisticsStatus != ''">
|
||||
t.logistics_status = #{item.logisticsStatus},
|
||||
</if>
|
||||
<if test="item.mailingTime != null">
|
||||
t.mailing_time = #{item.mailingTime},
|
||||
</if>
|
||||
<if test="item.signTime != null">
|
||||
t.sign_time = #{item.signTime},
|
||||
</if>
|
||||
<if test="item.remark != null and item.remark != ''">
|
||||
t.remark = #{item.remark},
|
||||
</if>
|
||||
<if test="item.delFlag != null and item.delFlag != ''">
|
||||
t.del_flag = #{item.delFlag},
|
||||
</if>
|
||||
<if test="item.createDept != null">
|
||||
t.create_dept = #{item.createDept},
|
||||
</if>
|
||||
<if test="item.createBy != null">
|
||||
t.create_by = #{item.createBy},
|
||||
</if>
|
||||
<if test="item.createTime != null">
|
||||
t.create_time = #{item.createTime},
|
||||
</if>
|
||||
<if test="item.updateBy != null">
|
||||
t.update_by = #{item.updateBy},
|
||||
</if>
|
||||
<if test="item.updateTime != null">
|
||||
t.update_time = #{item.updateTime}
|
||||
</if>
|
||||
</set>
|
||||
where t.mailing_apply_id = #{item.mailingApplyId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据自定义条件删除 -->
|
||||
<delete id="deleteCustomCrmMailingApply">
|
||||
delete from crm_mailing_apply t
|
||||
${ew.getCustomSqlSegment}
|
||||
</delete>
|
||||
|
||||
<!-- 根据ID列表批量删除 -->
|
||||
<delete id="deleteCustomCrmMailingApplyByIds">
|
||||
delete from crm_mailing_apply t
|
||||
where t.mailing_apply_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 检查是否存在 -->
|
||||
<select id="existsCrmMailingApply" resultType="java.lang.Boolean">
|
||||
select count(1) > 0 from crm_mailing_apply t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue