¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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; |
| | |
| | | |
| | | @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; |
| | | } |
| | | |
| | |
| | | //è·åæ£éªä¸åæ°æ® |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | // TODO é对人ååæéå¤ç ç®åå
对æ£éªäººååæ°æ®å¤ç å¦ææ¯æ£éªäººååªè½æ¥è¯¢å°æ£éªé¡¹ç®æ¯èªå·±æè
订ååæ´¾äººæ¯èªå·±ç订åï¼ä¸æ¯æ£éªäººåçææ¶å
¨æ¥ |
| | | boolean checkUserFlag = isCheckUser(SecurityUtils.getUserId().intValue()); |
| | | String laboratory = null; |
| | | // 夿æ¯å¦æ¯å
¨é¨ |
| | | String isOrderAll = null; |
| | |
| | | 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; |
| | |
| | | } 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; |
| | | } |
| | | |
| | | } |
| | |
| | | <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 |
| | |
| | | |
| | | |
| | | <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO"> |
| | | select * from(select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | io.order_type, |
| | | case when |
| | | io.type_source = 0 |
| | | then io.sample_view |
| | | else io.sample end sample, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | userName, |
| | | checkName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | io.type_source, |
| | | io.ifs_inventory_id, |
| | | ira.id ins_report_id, |
| | | ira.url, |
| | | ira.url_s, |
| | | ira.temp_url_pdf, |
| | | iiq.is_copper |
| | | FROM |
| | | ins_order io |
| | | 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 |
| | | 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> |
| | | </if> |
| | | <if test="isCheck == null"> |
| | | <if test="userName !=null and userName!=''"> |
| | | and userName like CONCAT ('%', #{userName},'%') |
| | | </if> |
| | | </if> |
| | | <if test="sonLaboratory!= null and sonLaboratory != ''"> |
| | | and ip.son_laboratory = #{sonLaboratory} |
| | | </if> |
| | | GROUP BY |
| | | ip.son_laboratory, |
| | | 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 |
| | | ) b |
| | | where ins_state is not null |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | select * from( |
| | | select * from( |
| | | SELECT a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | io.order_type, |
| | | case when |
| | | io.type_source = 0 |
| | | then io.sample_view |
| | | else io.sample end sample, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | T4.userName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | io.type_source, |
| | | io.ifs_inventory_id, |
| | | ira.id ins_report_id, |
| | | ira.url, |
| | | ira.url_s, |
| | | ira.temp_url_pdf, |
| | | iiq.is_copper |
| | | FROM |
| | | ins_order io |
| | | 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 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="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="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> |
| | | 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 |
| | | ) b |
| | | where ins_state is not null |
| | | )A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |