inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanQueryDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,26 @@ package com.ruoyi.inspect.dto; import lombok.Data; @Data public class InsOrderPlanQueryDto { private Integer userId; private String userName; /** * æ¯å¦æ¯æ£éªäººå */ private Boolean checkUserFlag; /** * æ¯å¦æ¯æ£æµç®¡ç人å */ private Boolean testAdminFlag; /** * æ¯å¦ä¸ºåªæ¥çèªå·± */ private Boolean viewMySelfFlag; } inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.inspect.dto.InsOrderPlanDTO; import com.ruoyi.inspect.dto.InsOrderPlanQueryDto; import com.ruoyi.inspect.dto.SampleProductDto; import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsSample; @@ -26,11 +27,7 @@ IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page, @Param("ew") QueryWrapper<InsOrderPlanDTO> ew, @Param("userName") String userName , @Param("userId") Integer userId, @Param("sonLaboratory") String sonLaboratory, @Param("laboratory") String laboratory, @Param("isCheck") Integer isCheck); @Param("otherParam")InsOrderPlanQueryDto otherParam); IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, @Param("ew") QueryWrapper<InsOrderPlanDTO> ew, @Param("userId") Integer userId, @Param("sonLaboratory") String sonLaboratory, @Param("laboratory") String laboratory); inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -55,6 +55,7 @@ import com.ruoyi.system.service.InformationNotificationService; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; import org.springframework.mock.web.MockMultipartFile; @@ -154,28 +155,18 @@ @Override public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { // todo: ä» çèªå·±æè å®éªå®¤ //è·åå½å人æå±å®éªå®¤id String laboratory = null; String userName = null; Integer userId = null; if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { userId = SecurityUtils.getUserId().intValue(); userName = userMapper.selectById(userId).getName(); // æ£æµç®¡ç人åå ¨æ¥ï¼éæ£æµç®¡ç人ååªæ¥çèªå·±ç InsOrderPlanQueryDto insOrderPlanQueryDto = new InsOrderPlanQueryDto(); insOrderPlanQueryDto.setCheckUserFlag(SecurityUtils.hasRole("inspector")); insOrderPlanQueryDto.setTestAdminFlag(SecurityUtils.hasRole("testadmin")); // 夿æ¯å¦è§¦ååªæ¥çèªå·± if(null != insOrderPlanDTO.getUserId()){ insOrderPlanQueryDto.setViewMySelfFlag(true); insOrderPlanDTO.setUserId(null); } Integer isCheck = insOrderPlanDTO.getIsCheck(); insOrderPlanDTO.setIsCheck(null); String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//è¯éªå®¤ insOrderPlanQueryDto.setUserId(SecurityUtils.getUserId().intValue()); IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, userId, sonLaboratory, laboratory, isCheck); QueryWrappers.queryWrappers(insOrderPlanDTO),insOrderPlanQueryDto); return insOrderPage; } inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -91,8 +91,6 @@ //è·åæ£éªä¸åæ°æ® @Override public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { // TODO é对人ååæéå¤ç ç®åå 对æ£éªäººååæ°æ®å¤ç å¦ææ¯æ£éªäººååªè½æ¥è¯¢å°æ£éªé¡¹ç®æ¯èªå·±æè 订ååæ´¾äººæ¯èªå·±ç订åï¼ä¸æ¯æ£éªäººåçææ¶å ¨æ¥ boolean checkUserFlag = isCheckUser(SecurityUtils.getUserId().intValue()); String laboratory = null; // 夿æ¯å¦æ¯å ¨é¨ String isOrderAll = null; @@ -103,7 +101,6 @@ SampleOrderDto otherParam = new SampleOrderDto(); otherParam.setLaboratory(laboratory); otherParam.setIsOrderAll(isOrderAll); otherParam.setCheckUserFlag(checkUserFlag); otherParam.setCheckUserId(SecurityUtils.getUserId()); IPage<SampleOrderDto> sampleOrderDtoIPage = insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), otherParam); return sampleOrderDtoIPage; @@ -1037,22 +1034,6 @@ } catch (IOException e) { throw new RuntimeException("导åºå¤±è´¥"); } } /** * 夿æ¯å¦ä¸ºæ£éªäººå * @param userId * @return */ public boolean isCheckUser(Integer userId) { List<User> userList = userMapper.selectQualityUserList(); for (User user : userList) { if(userId.equals(user.getId())){ return true; } } return false; } } inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -96,23 +96,6 @@ <if test="otherParam.laboratory!=null and otherParam.laboratory!=''"> AND io.laboratory=#{otherParam.laboratory} </if> <if test="otherParam.checkUserFlag != null and otherParam.checkUserFlag and otherParam.checkUserId != null "> AND io.id IN ( SELECT DISTINCT ins_sample_id AS orderId FROM ins_sample_user WHERE user_id = #{otherParam.checkUserId} UNION SELECT T2.ins_order_id AS orderId FROM ins_product T1 JOIN ins_sample T2 ON T1.ins_sample_id = T2.id WHERE T1.check_user_id = #{otherParam.checkUserId} ) </if> GROUP BY io.id,type order by type desc,io.id desc ) a inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -164,9 +164,9 @@ <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO"> select * from(select * from( SELECT a.*,ios.ins_state,ios.verify_tell,verify_user select * from( select * from( SELECT a.*,ios.ins_state,ios.verify_tell,verify_user FROM ( SELECT @@ -181,8 +181,7 @@ then io.sample_view else io.sample end sample, GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, userName, checkName, T4.userName, ip.son_laboratory, io.ins_time, io.laboratory, @@ -198,54 +197,35 @@ LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id LEFT JOIN ins_report ira ON ira.ins_order_id = io.id LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id LEFT JOIN ( SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id WHERE u.state=0 <if test="sonLaboratory!= null and sonLaboratory != ''"> and son_laboratory=#{sonLaboratory} </if> GROUP BY ins_sample_id ORDER BY ins_sample_id ) isu ON isu.ins_sample_id = io.id LEFT JOIN ( SELECT ins_sample_id,uu.name checkName FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id WHERE u.state=1 <if test="sonLaboratory!= null and sonLaboratory != ''"> and son_laboratory=#{sonLaboratory} </if> GROUP BY ins_sample_id ORDER BY ins_sample_id )isu2 ON isu2.ins_sample_id = io.id LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id LEFT JOIN ins_sample_user isu ON isa.id = isu.user_id LEFT JOIN user uu ON ip.check_user_id = uu.id LEFT JOIN ( SELECT T1.ins_order_id,GROUP_CONCAT( DISTINCT T3.name SEPARATOR ', ' ) AS userName FROM ins_sample T1 LEFT JOIN ins_product T2 ON T1.id = T2.ins_sample_id LEFT JOIN user T3 ON T2.check_user_id = T3.id GROUP BY T1.ins_order_id ) T4 ON T4.ins_order_id = io.id WHERE io.state = 1 and send_time is not null <if test="isCheck != null"> <if test="userName !=null and userName!=''"> and checkName like CONCAT ('%', #{userName},'%') -- 鿣æµç®¡çå <if test="otherParam.testAdminFlag != null and !otherParam.testAdminFlag"> <if test="otherParam.checkUserFlag != null and otherParam.checkUserFlag"> AND ( isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} ) </if> </if> <if test="isCheck == null"> <if test="userName !=null and userName!=''"> and userName like CONCAT ('%', #{userName},'%') -- æ¯æ£æµç®¡çå <if test="otherParam.testAdminFlag != null and otherParam.testAdminFlag"> <if test="otherParam.viewMySelfFlag != null and otherParam.viewMySelfFlag"> AND ( isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} ) </if> </if> <if test="sonLaboratory!= null and sonLaboratory != ''"> and ip.son_laboratory = #{sonLaboratory} </if> GROUP BY ip.son_laboratory, io.id GROUP BY io.id ) a LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory ORDER BY a.type DESC, a.id ORDER BY a.type DESC,a.id ) b where ins_state is not null <if test="laboratory!=null and laboratory!=''"> and laboratory=#{laboratory} </if> )A <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment}