feat(order): 新增订单审批日志查询功能

- 修改订单列表接口请求参数传递方式,将 data 改为 params
- 增加订单审批日志查询 SQL 语句,支持多表关联和复杂条件过滤
- 在 ProjectOrderInfoMapper 中新增 listLog 方法定义
- 更新前端页面排序字段,使用新的审批时间别名
- 根据是否含有 approveLog 参数决定调用原始列表或带日志的列表方法
dev_1.0.0
chenhao 2025-12-01 16:17:20 +08:00
parent 6747c224c8
commit 9dc06d049c
5 changed files with 184 additions and 5 deletions

View File

@ -59,7 +59,7 @@ export function delContractFile(ids) {
return request({ return request({
url: '/project/order/file/remove', url: '/project/order/file/remove',
method: 'post', method: 'post',
data: { ids: ids } params: { ids: ids }
}) })
} }

View File

@ -148,7 +148,7 @@ export default {
customerName: null, customerName: null,
dutyName: null, dutyName: null,
approveNode: null, approveNode: null,
orderByColumn:'approveTime', orderByColumn:'t7.todo_approve_time',
isAsc: 'desc' isAsc: 'desc'
}, },
}; };

View File

@ -81,4 +81,7 @@ public interface ProjectOrderInfoMapper
List<ProjectOrderInfo> listByCodeList(List<String> businessKeyList); List<ProjectOrderInfo> listByCodeList(List<String> businessKeyList);
void updatePartnerCodeByCode(@Param("oldValue") String partnerCode, @Param("newValue")String newPartnerCode); void updatePartnerCodeByCode(@Param("oldValue") String partnerCode, @Param("newValue")String newPartnerCode);
List<ProjectOrderInfo> listLog(ProjectOrderInfo projectOrderInfo);
} }

View File

@ -260,9 +260,12 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
put("authSql", authSql.toString()); put("authSql", authSql.toString());
}}); }});
} }
List<ProjectOrderInfo> projectOrderInfos=new ArrayList<>();
if (StringUtils.isNotEmpty(projectOrderInfo.getApproveLog())){
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo); projectOrderInfos = projectOrderInfoMapper.listLog(projectOrderInfo);
}else{
projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo);
}
for (ProjectOrderInfo orderInfo : projectOrderInfos) { for (ProjectOrderInfo orderInfo : projectOrderInfos) {
//省代看总代合同 //省代看总代合同
orderInfo.setShowLog(showLog && ProjectOrderInfo.OrderChannelEnum.TOTAL_GENERATION.getCode().equals(orderInfo.getOrderChannel())); orderInfo.setShowLog(showLog && ProjectOrderInfo.OrderChannelEnum.TOTAL_GENERATION.getCode().equals(orderInfo.getOrderChannel()));

View File

@ -294,6 +294,179 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
) )
</select> </select>
<select id="listLog" resultType="com.ruoyi.sip.domain.ProjectOrderInfo">
select t1.id, t1.project_id,t1.province, t1.city, t1.business_person, t1.business_email, t1.business_phone, t1.order_code, t1.currencyType,
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
,t4.agent_name
,t5.user_name as duty_name
from project_order_info t1
left join project_info t2 on t1.project_id = t2.id
left join partner_info t3 on t1.partner_code=t3.partner_code
left join agent_info t4 on t2.agent_code=t4.agent_code
left join sys_user t5 on t1.duty=t5.user_id
inner join
(
SELECT
business_key,
max(btc.approve_time) todo_approve_time
FROM
bu_todo_completed btc
WHERE
btc.process_key IN ( 'order_approve_online', 'order_approve_offline' )
AND btc.approve_user = #{approveLog}
AND btc.task_name != '售前'
GROUP BY business_key
) t7 ON t7.business_key = t1.order_code
where 1=1
<if test="projectId != null ">and t1.project_id = #{projectId}</if>
<if test="projectCode != null and projectCode!='' ">and t2.project_code like
concat('%',#{projectCode},'%')
</if>
<if test="projectName != null and projectName!=''">and t2.project_name like concat('%',
#{projectName},'%')
</if>
<if test="customerName != null and customerName!=''">and t2.customer_name like
concat('%',#{customerName},'%')
</if>
<if test="agentName != null and agentName!=''">and t4.agent_name like concat('%',#{agentName},'%')</if>
<if test="financeStatus != null and financeStatus!=''">and t1.finance_status =#{financeStatus}</if>
<if test="province != null and province != ''">and t1.province = #{province}</if>
<if test="city != null and city != ''">and t1.city = #{city}</if>
<if test="businessPerson != null and businessPerson != ''">and t1.business_person = #{businessPerson}</if>
<if test="businessEmail != null and businessEmail != ''">and t1.business_email = #{businessEmail}</if>
<if test="businessPhone != null and businessPhone != ''">and t1.business_phone = #{businessPhone}</if>
<if test="orderCode != null and orderCode != ''">and t1.order_code = #{orderCode}</if>
<if test="currencyType != null and currencyType != ''">and t1.currencyType = #{currencyType}</if>
<if test="shipmentAmount != null ">and t1.shipment_amount = #{shipmentAmount}</if>
<if test="actualPurchaseAmount != null ">and t1.actual_purchase_amount = #{actualPurchaseAmount}</if>
<if test="orderEndTime != null ">and t1.order_end_time = #{orderEndTime}</if>
<if test="deliveryTime != null ">and t1.delivery_time = #{deliveryTime}</if>
<if test="companyDelivery != null and companyDelivery != ''">and t1.company_delivery = #{companyDelivery}
</if>
<if test="notifier != null and notifier != ''">and t1.notifier = #{notifier}</if>
<if test="notifierEmail != null and notifierEmail != ''">and t1.notifier_email = #{notifierEmail}</if>
<if test="notifierPhone != null and notifierPhone != ''">and t1.notifier_phone = #{notifierPhone}</if>
<if test="notifierAddress != null and notifierAddress != ''">and t1.notifier_address = #{notifierAddress}
</if>
<if test="duty != null and duty != ''">and t1.duty = #{duty}</if>
<if test="dutyName != null and dutyName != ''">and t5.user_name like concat('%', #{dutyName}, '%')</if>
<if test="dutyEmail != null and dutyEmail != ''">and t1.duty_email = #{dutyEmail}</if>
<if test="dutyPhone != null and dutyPhone != ''">and t1.duty_phone = #{dutyPhone}</if>
<if test="orderChannel != null and orderChannel != ''">and t1.order_channel = #{orderChannel}</if>
<if test="partnerCode != null and partnerCode != ''">and t1.partner_code = #{partnerCode}</if>
<if test="partnerName != null and partnerName != ''">and t3.partner_name like concat('%', #{partnerName},
'%')
</if>
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="orderStatus != null and orderStatus != ''">and t1.order_status = #{orderStatus}</if>
<if test="deliveryStatus != null and deliveryStatus != ''">and t1.delivery_status = #{deliveryStatus}</if>
<if test="outerStatus != null and outerStatus != ''">and t1.outer_status = #{outerStatus}</if>
<if test="signStatus != null and signStatus != ''">and t1.sign_status = #{signStatus}</if>
<if test="keyword != null and keyword != ''">and (t1.order_code like concat('%',#{keyword},'%') or
t2.project_name like concat('%',#{keyword},'%') or t2.customer_name like concat('%',#{keyword},'%'))
</if>
<if test="deliveryTimeStart != null or deliveryTimeEnd != null">
<choose>
<when test="deliveryTimeStart != null and deliveryTimeEnd != null">
and t1.delivery_time between date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00') and
date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="deliveryTimeStart != null">
and t1.delivery_time <![CDATA[ >= ]]> date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="deliveryTimeEnd != null">
and t1.delivery_time <![CDATA[ <= ]]> date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test="updateTimeStart != null or updateTimeEnd != null">
<choose>
<when test="updateTimeStart != null and updateTimeEnd != null">
and t1.update_time between date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00') and
date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="updateTimeStart != null">
and t1.update_time <![CDATA[ >= ]]> date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="updateTimeEnd != null">
and t1.update_time <![CDATA[ <= ]]> date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test="approveTimeStart != null or approveTimeEnd != null">
<choose>
<when test="approveTimeStart != null and approveTimeEnd != null">
and t1.approve_time between date_format(#{approveTimeStart}, '%Y-%m-%d 00:00:00') and
date_format(#{approveTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="approveTimeStart != null">
and t1.approve_time <![CDATA[ >= ]]> date_format(#{approveTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="approveTimeEnd != null">
and t1.approve_time <![CDATA[ <= ]]> date_format(#{approveTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test="estimatedOrderTimeStart != null or estimatedOrderTimeEnd != null">
<choose>
<when test="estimatedOrderTimeStart != null and estimatedOrderTimeEnd != null">
and t2.estimated_order_time between date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00')
and date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="estimatedOrderTimeStart != null">
and t2.estimated_order_time <![CDATA[ >= ]]> date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d
00:00:00')
</when>
<when test="estimatedOrderTimeEnd != null">
and t2.estimated_order_time <![CDATA[ <= ]]> date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d
23:59:59')
</when>
</choose>
</if>
<if test="orderEndTimeStart != null or orderEndTimeEnd != null">
<choose>
<when test="orderEndTimeStart != null and orderEndTimeEnd != null">
and t1.order_end_time between date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00') and
date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="orderEndTimeStart != null">
and t1.order_end_time <![CDATA[ >= ]]> date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="orderEndTimeEnd != null">
and t1.order_end_time <![CDATA[ <= ]]> date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test="approve!=null and approve!=''">and t1.order_code in (select business_key from bu_todo where
process_key in ('order_approve_online','order_approve_offline') and approve_user = #{approve} and
task_name != '售前')
</if>
<if test="productCodeList!=null and productCodeList.size>0">
and t1.project_id in (select distinct t2.project_id from project_product_info t2 where t2.product_bom_code
in
<foreach item="item" collection="productCodeList" separator="," open="(" close=")">
#{item}
</foreach>
)
</if>
${params.authSql}
${params.dataScope}
</select>
<insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id">