feat(sip): 新增根据业务编码列表查询订单信息功能

- 在IProjectOrderInfoService接口中新增listByCodeList方法
- 在ProjectOrderInfoController中添加uploadFinalFile属性
- 在ProjectOrderInfoMapper中新增listByCodeList方法
- 在ProjectOrderInfoMapper.xml中添加listByCodeList查询SQL
- 在ProjectOrderInfoServiceImpl中实现listByCodeList方法
- 在Todo实体类中新增businessId和businessName字段
- 在TodoMapper.xml中优化查询条件并支持按业务名称搜索
- 在TodoServiceImpl中注入IProjectOrderInfoService并关联业务信息
dev_1.0.0
chenhao 2025-09-26 15:29:01 +08:00
parent 4729ed87ce
commit 98cb07b710
8 changed files with 97 additions and 17 deletions

View File

@ -276,6 +276,7 @@ public class ProjectOrderInfoController extends BaseController
("产品经理".equals(todoCompletedList.get(todoCompletedList.size() - 1).getTaskName()) || "商务".equals(todoCompletedList.get(todoCompletedList.size() - 1).getTaskName()))
: true;
mmap.put("updateFile", ShiroUtils.getSubject().hasRole("sale_assistant") && updateFlag);
mmap.put("uploadFinalFile",false);
return prefix + "/edit";
}

View File

@ -96,4 +96,8 @@ public class Todo extends BaseEntity
private Map<String, Object> variables;
private List<ProjectTaxRateTemp> taxRateData;
private Long businessId;
private String businessName;
}

View File

@ -12,10 +12,13 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.flowable.controller.TodoController;
import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.flowable.mapper.TodoMapper;
import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.service.IProjectOrderInfoService;
import com.ruoyi.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@ -29,6 +32,7 @@ import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -58,6 +62,9 @@ public class TodoServiceImpl implements TodoService {
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private IProjectOrderInfoService projectOrderInfoService;
/**
*
*
@ -133,8 +140,6 @@ public class TodoServiceImpl implements TodoService {
public List<Todo> selectTodoCompletedList(Todo todo) {
List<Todo> todoCompletedList = todoMapper.selectTodoCompletedList(todo);
List<Todo> todoList = todoMapper.selectTodoList(todo);
List<Long> collect = todoCompletedList.stream().map(item->Long.parseLong(item.getApproveUser())).collect(Collectors.toList());
SysUser queryUserParam = new SysUser();
queryUserParam.setUserIdList(collect);
@ -153,6 +158,23 @@ public class TodoServiceImpl implements TodoService {
todoDto.setNextAllApproveUserName(nextApproveUserName);
todoDto.setRoleName(userRoleMap.get(Long.parseLong(todoDto.getApproveUser())));
}
//关联业务信息
List<String> businessKeyList = todoCompletedList.stream().map(Todo::getBusinessKey).collect(Collectors.toList());
if (CollUtil.isNotEmpty(businessKeyList)){
List<ProjectOrderInfo> orderInfoList = projectOrderInfoService.listByCodeList(businessKeyList);
Map<String, ProjectOrderInfo> orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(ProjectOrderInfo::getOrderCode, Function.identity(), (v1, v2) -> v1));
todoCompletedList.forEach(item -> {
ProjectOrderInfo projectOrderInfo = orderInfoMap.get(item.getBusinessKey());
if (ObjectUtils.isEmpty(projectOrderInfo)) {
return;
}
item.setBusinessId(projectOrderInfo.getId());
item.setBusinessName(projectOrderInfo.getProjectName());
});
}
return todoCompletedList;
}

View File

@ -77,4 +77,6 @@ public interface ProjectOrderInfoMapper
void bakData(ProjectOrderInfo projectOrderInfo);
List<OrderInfoVo> listOrderInfoVo(ProjectOrderInfo queryParams);
List<ProjectOrderInfo> listByCodeList(List<String> businessKeyList);
}

View File

@ -96,4 +96,6 @@ public interface IProjectOrderInfoService
* @return
*/
byte[] exportContractTemplate(ProjectOrderInfo orderInfo);
List<ProjectOrderInfo> listByCodeList(List<String> businessKeyList);
}

View File

@ -1313,6 +1313,11 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
}
}
@Override
public List<ProjectOrderInfo> listByCodeList(List<String> businessKeyList) {
return projectOrderInfoMapper.listByCodeList(businessKeyList);
}
private void replaceTextInDocument(XWPFDocument document, ProjectOrderInfo orderInfo) {
// 替换段落中的文本
for (XWPFParagraph paragraph : document.getParagraphs()) {

View File

@ -55,25 +55,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectTodoCompletedList" resultType="Todo">
select todo_id, business_key, process_key, process_name, task_name, approve_user_name,approve_time,approve_opinion,
approve_status,apply_user_name, apply_time, extend_field1, extend_field2,task_id,process_instance_id,form_key,all_approve_user_name,approve_user from bu_todo_completed
select todo_id, business_key, process_key, process_name, task_name,
approve_user_name,approve_time,approve_opinion,
approve_status,apply_user_name, apply_time, extend_field1,
extend_field2,task_id,process_instance_id,form_key,all_approve_user_name,approve_user from bu_todo_completed
<where>
<if test="todoId != null and todoId != ''"> and todo_id = #{todoId}</if>
<if test="businessKey != null and businessKey != ''"> and business_key = #{businessKey}</if>
<if test="processKey != null and processKey != ''"> and process_key = #{processKey}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
<if test="approveUserName != null and approveUserName != ''"> and approve_user_name = #{approveUserName}</if>
<if test="applyUserName != null and applyUserName != ''"> and apply_user_name like concat('%', #{applyUserName}, '%')</if>
<if test="applyTime != null "> and date_format(apply_time,'%y%m%d') = date_format(#{applyTime},'%y%m%d')</if>
<if test="approveTime != null "> and date_format(approve_time,'%y%m%d') = date_format(#{approveTime},'%y%m%d')</if>
<if test="extendField1 != null and extendField1 != ''"> and extend_field1 like concat('%',#{extendField1},'%')</if>
<if test="extendField2 != null and extendField2 != ''"> and extend_field2 like concat('%',#{extendField2},'%')</if>
<if test="processInstanceId != null and processInstanceId != ''"> and process_instance_id = #{processInstanceId}</if>
<if test="approveStatus != null and approveStatus != ''"> and approve_status = #{approveStatus}</if>
<if test="todoId != null and todoId != ''">and todo_id = #{todoId}</if>
<if test="businessKey != null and businessKey != ''">and business_key = #{businessKey}</if>
<if test="processKey != null and processKey != ''">and process_key = #{processKey}</if>
<if test="processName != null and processName != ''">and process_name like concat('%', #{processName},
'%')
</if>
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
<if test="approveUserName != null and approveUserName != ''">and approve_user_name = #{approveUserName}
</if>
<if test="applyUserName != null and applyUserName != ''">and apply_user_name like concat('%',
#{applyUserName}, '%')
</if>
<if test="applyTime != null ">and date_format(apply_time,'%y%m%d') = date_format(#{applyTime},'%y%m%d')</if>
<if test="approveTime != null ">and date_format(approve_time,'%y%m%d') =
date_format(#{approveTime},'%y%m%d')
</if>
<if test="extendField1 != null and extendField1 != ''">and extend_field1 like
concat('%',#{extendField1},'%')
</if>
<if test="extendField2 != null and extendField2 != ''">and extend_field2 like
concat('%',#{extendField2},'%')
</if>
<if test="processInstanceId != null and processInstanceId != ''">and process_instance_id =
#{processInstanceId}
</if>
<if test="approveStatus != null and approveStatus != ''">and approve_status = #{approveStatus}</if>
<if test="searchValue != null and searchValue != ''">
AND (todo_id like concat('%',#{searchValue},'%') or extend_field1 like concat('%',#{searchValue},'%'))
</if>
<if test="businessName != null and businessName != ''">
AND business_key in (
select order_code from project_order_info t1 inner join project_info t2 on t1.project_id = t2.id where t2.project_name like concat('%',#{businessName},'%')
)
</if>
<if test="(params.beginCreateTime != null and params.beginCreateTime != '') or (params.endCreateTime != null and params.endCreateTime!='')">
<choose>
<when test="(params.beginCreateTime != null and params.beginCreateTime != '') and (params.endCreateTime != null and params.endCreateTime!='')">
and approve_time between date_format(#{params.beginCreateTime}, '%Y-%m-%d 00:00:00') and
date_format(#{params.endCreateTime}, '%Y-%m-%d 23:59:59')
</when>
<when test="(params.beginCreateTime != null and params.beginCreateTime != '')">
and approve_time <![CDATA[ >= ]]> date_format(#{params.beginCreateTime}, '%Y-%m-%d 00:00:00')
</when>
<when test="(params.endCreateTime != null and params.endCreateTime!='')">
and approve_time <![CDATA[ <= ]]> date_format(#{params.endCreateTime}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
</where>
order by approve_time desc
</select>

View File

@ -269,6 +269,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and t1.order_code in (select select DISTINCT order_code from oms_inventory_outer where outer_code in (select outer_code from oms_inventory_info where product_sn=#{productSn} ) )
</if>
</select>
<select id="listByCodeList" resultType="com.ruoyi.sip.domain.ProjectOrderInfo">
<include refid="selectProjectOrderInfoRelationVo"/>
where t1.order_code in (
<foreach item="item" collection="list" separator=",">
#{item}
</foreach>
)
</select>
<insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id">