更新
This commit is contained in:
parent
4d8dee555f
commit
e65d3e4972
@ -85,4 +85,9 @@ public class InspectionConstants {
|
||||
*/
|
||||
public static final String INSPECTION_NOTICE_TEMPLATE_ASSIGN_STAFF_MEET_CAR_NO_CAR_NO = "您有的新的接车订单需要处理 接车时间:%s 详细信息请前往接车列表";
|
||||
|
||||
/**
|
||||
* 检测站内信模板-提示业务经理 接车订单已被创建
|
||||
*/
|
||||
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE = "%s的工单已创建,详细信息请前往列表查看";
|
||||
|
||||
}
|
||||
|
@ -125,6 +125,19 @@ public class InspectionInfoController extends BaseController {
|
||||
return success(inspectionInfoService.geStelectInspection(page, inspectionInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前登陆人获取可以选择的工单(业务经理查询)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("geStelectInspectionByBusiness")
|
||||
public CommonResult geStelectInspectionByBusiness(InspectionInfo inspectionInfo,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
|
||||
return success(inspectionInfoService.geStelectInspectionByBusiness(page, inspectionInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
*
|
||||
@ -376,6 +389,17 @@ public class InspectionInfoController extends BaseController {
|
||||
return success(inspectionInfoService.getCountByType(partnerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得不同状态的数据的数量
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:22 2024/12/18
|
||||
**/
|
||||
@GetMapping("/getBusinessCountByType")
|
||||
public CommonResult<?> getBusinessCountByType(@RequestParam("partnerId") Integer partnerId) {
|
||||
return success(inspectionInfoService.getBusinessCountByType(partnerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 接车拍照
|
||||
*
|
||||
|
@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/channel")
|
||||
@ -40,7 +42,18 @@ public class InspectionBusinessChannelController {
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult<InspectionBusinessChannel> getChannelById(@PathVariable("id") Long id) {
|
||||
return CommonResult.success(inspectionBusinessChannelService.getById(id));
|
||||
InspectionBusinessChannel info = inspectionBusinessChannelService.getById(id);
|
||||
|
||||
//将字符串转为集合
|
||||
if (ObjectUtil.isNotEmpty(info.getUserIds())) {
|
||||
List<Long> userIdList = Arrays.stream(info.getUserIds().split(","))
|
||||
.filter(s -> s != null && !s.isEmpty()) // 可选:避免空字符串
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
info.setUserIdList(userIdList);
|
||||
|
||||
}
|
||||
return CommonResult.success(info);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,6 +61,13 @@ public class InspectionBusinessChannelController {
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public CommonResult<?> updateChannel(@RequestBody InspectionBusinessChannel channel) {
|
||||
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
|
||||
String userIds = channel.getUserIdList().stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
channel.setUserIds(userIds);
|
||||
|
||||
}
|
||||
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,12 @@ public class InspectionBusinessChannel extends TenantBaseDO {
|
||||
|
||||
private Integer type; // 0-业务渠道 1-客户来源
|
||||
|
||||
private String userIds; // 绑定的用户ID
|
||||
|
||||
// 子节点
|
||||
@TableField(exist = false)
|
||||
private List<InspectionBusinessChannel> children;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Long> userIdList;
|
||||
}
|
||||
|
@ -94,4 +94,7 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
|
||||
*/
|
||||
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
|
||||
Long countByUser(@Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
|
||||
|
||||
|
||||
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
|
||||
}
|
||||
|
@ -165,4 +165,14 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
|
||||
* @param inspectionInfo
|
||||
*/
|
||||
void leadCar(InspectionInfo inspectionInfo);
|
||||
|
||||
/**
|
||||
* 获取业务方工单
|
||||
* @param page
|
||||
* @param inspectionInfo
|
||||
* @return
|
||||
*/
|
||||
IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo);
|
||||
|
||||
Map<String, Long> getBusinessCountByType(Integer partnerId);
|
||||
}
|
||||
|
@ -419,6 +419,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
update(Wrappers.<InspectionInfo>lambdaUpdate()
|
||||
.eq(InspectionInfo::getId, inspectionInfo.getId())
|
||||
.set(InspectionInfo::getIsMeetCar, 1));
|
||||
|
||||
// 查询接车标
|
||||
InspectionMeetCarOrder inspectionMeetCarOrder = inspectionMeetCarOrderService.getById(inspectionInfo.getMeetCarId());
|
||||
// 判断接车类型是否是业务接车
|
||||
if (inspectionMeetCarOrder.getMeetType() == 2) {
|
||||
// 给对应的业务经理发送消息
|
||||
String message = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE, inspectionInfo.getBuyName() == null ? inspectionInfo.getBuyPhone() : inspectionInfo.getBuyName());
|
||||
noticeService.sentMessage(inspectionMeetCarOrder.getMeetManId(), message);
|
||||
}
|
||||
}
|
||||
|
||||
workNodeService.saveBatch(inspectionWorkNodes);
|
||||
@ -974,6 +983,83 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
saveLeadRecord(inspectionInfo.getId(), loginUser.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务方工单
|
||||
*
|
||||
* @param page
|
||||
* @param inspectionInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo) {
|
||||
return baseMapper.geStelectInspectionByBusiness(page, inspectionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param partnerId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Long> getBusinessCountByType(Integer partnerId) {
|
||||
// 创建线程池
|
||||
ExecutorService executor = Executors.newFixedThreadPool(10);
|
||||
|
||||
try {
|
||||
InspectionInfo inspectionInfo = new InspectionInfo();
|
||||
inspectionInfo.setPartnerId(partnerId.longValue());
|
||||
|
||||
// 获取当前登录人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 获取当前登陆人的角色
|
||||
// List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
|
||||
// inspectionInfo.setLeadManId(loginUser.getId());
|
||||
// List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
||||
inspectionInfo.setUserId(loginUser.getId());
|
||||
|
||||
if (!"1".equals(inspectionInfo.getStatus())) {
|
||||
inspectionInfo.setDealUserId(loginUser.getId());
|
||||
}
|
||||
|
||||
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
|
||||
|
||||
// 这里 `5` 而不是 `6`,因为 i 从 `0` 开始
|
||||
CompletableFuture<Void>[] futures = new CompletableFuture[3];
|
||||
|
||||
for (int i = 0; i < 3; i++) { // 改为 `0~4`
|
||||
final String status = String.valueOf(i + 1);
|
||||
|
||||
// 深拷贝对象,防止多线程修改冲突
|
||||
InspectionInfo infoCopy = JSON.parseObject(JSON.toJSONString(inspectionInfo), InspectionInfo.class);
|
||||
infoCopy.setStatus(status);
|
||||
|
||||
Page<InspectionInfo> page = new Page<>(1, 1);
|
||||
|
||||
futures[i] = CompletableFuture.runAsync(() -> {
|
||||
IPage<InspectionInfo> inspectionInfoIPage = baseMapper.geStelectInspectionByBusiness(page, infoCopy);
|
||||
Long count = inspectionInfoIPage.getTotal();
|
||||
result.put(status, count);
|
||||
}, executor);
|
||||
}
|
||||
|
||||
// 等待所有任务完成
|
||||
CompletableFuture.allOf(futures).join();
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to execute tasks in parallel", e);
|
||||
} finally {
|
||||
executor.shutdown();
|
||||
try {
|
||||
if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存引车员记录
|
||||
*
|
||||
|
@ -617,4 +617,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="geStelectInspectionByBusiness"
|
||||
resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT imco.meet_man_id,imco.buy_name,imco.buy_phone, imco.car_num,imco.other_phone
|
||||
<if test="info.status != 1">
|
||||
,ii.id AS id,imco.id AS meetCarId,oi.sku_name AS skuName,oi.goods_title,ii.*
|
||||
</if>
|
||||
<if test="info.status == 1">
|
||||
,imco.id AS id
|
||||
</if>
|
||||
FROM inspection_meet_car_order imco
|
||||
JOIN inspection_business_channel ibc
|
||||
ON imco.customer_source_id = ibc.id
|
||||
<if test="info.status != 1">
|
||||
INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0
|
||||
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0
|
||||
</if>
|
||||
<where>
|
||||
ibc.deleted = 0
|
||||
AND imco.deleted = 0
|
||||
<if test="info.userId != null and info.userId != ''">
|
||||
AND FIND_IN_SET(#{info.userId}, ibc.user_ids)
|
||||
AND imco.creator = #{info.userId}
|
||||
</if>
|
||||
<if test="info.status == 2">
|
||||
AND ii.status = '0'
|
||||
</if>
|
||||
<if test="info.status == 3">
|
||||
AND ii.status = '1'
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -589,6 +589,9 @@ public class SysLoginController {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("partnerId", user.getTenantId());
|
||||
map.put("user", user);
|
||||
// 查询用户表信息
|
||||
AdminUserDO selectUser = userService.getUser(user.getId());
|
||||
map.put("userInfo", selectUser);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user