From 9ab644692599cc41b5cbd90173388f83f35934f1 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 23 七月 2024 15:26:32 +0800
Subject: [PATCH] 班次权限2.0
---
inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 2
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml | 32 +++++++++++-----
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 9 ++++
performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java | 14 +++++++
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java | 7 +++
inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderPlanService.java | 2 +
6 files changed, 54 insertions(+), 12 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
index 79c81a2..dfdb382 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
@@ -91,6 +91,13 @@
return Result.success(insOrderPlanService.upPlanUser(userId, orderId, sonLaboratory));
}
+ @ValueAuth
+ @ApiOperation(value = "鍒ゆ柇浜ゆ帴鐨勮瘯楠屽")
+ @PostMapping("/upPlanUser2")
+ public Result<?> upPlanUser2(Integer orderId) {
+ return Result.success(insOrderPlanService.upPlanUser2(orderId));
+ }
+
@ValueClassify("妫�楠屼换鍔�")
@ApiOperation(value = "澶嶆牳妫�楠屼换鍔�")
@PostMapping("/verifyPlan")
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderPlanService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderPlanService.java
index 510fa39..7b49e94 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderPlanService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderPlanService.java
@@ -40,4 +40,6 @@
Map<String,Object> getReportModel(Integer sampleId);
Map<String,Object> temCycle(Integer sampleId, String inspectionItem, String inspectionItemSubclass);
+
+ List<String> upPlanUser2(Integer orderId);
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index 9bab7c6..b32ff49 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -439,6 +439,13 @@
return map;
}
+ @Override
+ public List<String> upPlanUser2(Integer orderId) {
+ List<Integer> sampleId = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
+ List<String> sonLaboratory = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, sampleId)).stream().map(InsProduct::getSonLaboratory).distinct().collect(Collectors.toList());
+ return sonLaboratory;
+ }
+
@Override
public void saveInsContext(Map<String, Object> insContext) {
@@ -3466,7 +3473,7 @@
insSampleUser.setInsSampleId(orderId);
insSampleUser.setState(0);
insSampleUser.setSonLaboratory(laboratory);
- insSampleUserMapper.insert(insSampleUser);
+ insSampleUserMapper.insert(insSampleUser);
/*鏍¢獙涓�涓媟esult琛�*/
CompletableFuture.supplyAsync(() -> {
List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 7d48c25..81acae6 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -350,7 +350,7 @@
left join ins_product ip on isa.id = ip.ins_sample_id
left join ins_product_result ipr on ip.id = ipr.ins_product_id
where ins_order_id = #{id}
- and template_id is not null
+ and ip.standard_method_list_id is not null
and state = 1
</select>
diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
index 91d2ce3..f281f2d 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
@@ -217,6 +217,20 @@
@Override
public IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, String laboratory) {
+ //鏌ヨ褰撳墠鐧诲綍浜哄憳鐨勬灦鏋�
+ Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ //鍒ゆ柇鍏ㄩ儴,涓汉,缁勭粐鐨勬潈闄�
+ User user = userMapper.selectById(userId);//褰撳墠鐧诲綍鐨勪汉
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String departLimsId = user.getDepartLimsId();
+ if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
+ String[] split = departLimsId.split(",");
+ //鏌ヨ瀵瑰簲鏋舵瀯鍚嶇О(閫氫俊瀹為獙瀹�,鐢靛姏瀹為獙瀹�,妫�娴嬪姙)
+ String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
+ if (departLims.contains("瀹為獙瀹�")) {
+ laboratory = departLims;
+ }
+ }
IPage<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYear(page, time, userName, laboratory);
List<Enums> shiftType = enumService.selectEnumByCategory("鐝绫诲瀷");
mapYearIPage.setRecords(annualAttendanceProcessing(mapYearIPage.getRecords(), shiftType));
diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index 1ada6d1..4324a38 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -39,38 +39,50 @@
SELECT
s.user_id, s.shift
FROM performance_shift s
- LEFT JOIN user u on u.id = s.user_id
+ LEFT JOIN (SELECT u.* from
+ user u
+ left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
+ where state=1
+ <if test="laboratory != null and laboratory != ''">
+ and dl.name=#{laboratory}
+ </if>
+ ) u2 on u2.id = s.user_id
where s.shift is not NULL
and s.shift != ''
+ and name is not null
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
</if>
<if test="userName != null and userName != ''">
- and u.name like concat('%', #{userName}, '%')
- </if>
- <if test="laboratory != null and laboratory != ''">
+ and u2.name like concat('%', #{userName}, '%')
</if>
order by s.create_time
</select>
<select id="performanceShiftYear" resultType="java.util.Map">
- SELECT if(u.department is not null and u.department != '', CONCAT(u.name, '锛�', u.department, '锛�'), u.name) name,
- s.user_id, u.account,
+ SELECT if(u2.department is not null and u2.department != '', CONCAT(u2.name, '锛�', u2.department, '锛�'), u2.name) name,
+ s.user_id, u2.account,
DATE_FORMAT(s.work_time, '%c') work_time,
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', s.shift order by s.work_time SEPARATOR ';') month_str
FROM performance_shift s
- LEFT JOIN user u on u.id = s.user_id
+ LEFT JOIN (SELECT u.* from
+ user u
+ left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
+ where state=1
+ <if test="laboratory != null and laboratory != ''">
+ and dl.name=#{laboratory}
+ </if>
+ ) u2 on u2.id = s.user_id
where s.shift is not NULL
and s.shift != ''
+ and name is not null
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
</if>
<if test="userName != null and userName != ''">
and u.name like concat('%', #{userName}, '%')
</if>
- <if test="laboratory != null and laboratory != ''">
- </if>
- GROUP BY u.id
+ GROUP BY u2.id
order by s.create_time
</select>
--
Gitblit v1.9.3