| | |
| | | Map map= JsonUtil.jsonToPojo(JsonUtil.jsonToString(o),Map.class); |
| | | return String.valueOf(map.get("supplier")); |
| | | } |
| | | |
| | | public static String comparingByCode(Object o){ |
| | | Map map= JsonUtil.jsonToPojo(JsonUtil.jsonToString(o),Map.class); |
| | | return String.valueOf(map.get("code")); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | private String imName; |
| | | |
| | | private String iCode; |
| | | private String imCode; |
| | | |
| | | private Integer inspectionStatus; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "审æ¹äºº") |
| | | @JsonSerialize |
| | | private Integer approver; |
| | | private String approver; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8") |
| | |
| | | public NonConformanceReviewVo getNonConformanceReviewVo(NonConformingFeedbackDto nonConformingFeedbackDto) { |
| | | QueryWrapper<NonConformanceReview>queryWrapper= new QueryWrapper<>(); |
| | | if (StringUtils.hasText(nonConformingFeedbackDto.getMaterialCode())){ |
| | | queryWrapper.lambda().and(a->a.eq(NonConformanceReview::getMaterialCode,nonConformingFeedbackDto.getMaterialCode())); |
| | | queryWrapper.lambda().and(a->a.like(NonConformanceReview::getMaterialCode,nonConformingFeedbackDto.getMaterialCode())); |
| | | } |
| | | if (StringUtils.hasText(nonConformingFeedbackDto.getMaterialName())){ |
| | | queryWrapper.lambda().and(a->a.eq(NonConformanceReview::getMaterialName,nonConformingFeedbackDto.getMaterialName())); |
| | | queryWrapper.lambda().and(a->a.like(NonConformanceReview::getMaterialName,nonConformingFeedbackDto.getMaterialName())); |
| | | } |
| | | if (StringUtils.hasText(nonConformingFeedbackDto.getInspectionCode())){ |
| | | queryWrapper.lambda().and(a->a.eq(NonConformanceReview::getInspectionCode,nonConformingFeedbackDto.getInspectionCode())); |
| | | queryWrapper.lambda().and(a->a.like(NonConformanceReview::getInspectionCode,nonConformingFeedbackDto.getInspectionCode())); |
| | | } |
| | | Page<NonConformanceReview> page = new Page<>(nonConformingFeedbackDto.getCurrentPage(), nonConformingFeedbackDto.getPageNum(), true); |
| | | IPage<NonConformanceReview> iPage = mapper.selectPage(page, queryWrapper); |
| | |
| | | return allMap; |
| | | } |
| | | imInfos.forEach(l->{ |
| | | NameList.add(l.getICode()+"-"+l.getImName()); |
| | | projectByCodeAndNameDtos.add(new SelectProjectByCodeAndNameDto(l.getICode(),l.getImName())); |
| | | NameList.add(l.getImCode()+"-"+l.getImName()); |
| | | projectByCodeAndNameDtos.add(new SelectProjectByCodeAndNameDto(l.getImCode(),l.getImName())); |
| | | }); |
| | | List<ImInfo> imInfosAll = qualificationRateStatisticsMapper.selectProjection(projectByCodeAndNameDtos,dto); |
| | | int total = imInfosAll.size(); |
| | |
| | | AtomicInteger i=new AtomicInteger(0); |
| | | NameList.forEach(n->{ |
| | | imInfos.stream() |
| | | .filter(im-> Objects.equals(n,im.getICode()+"-"+im.getImName())) |
| | | .filter(im-> Objects.equals(n,im.getImCode()+"-"+im.getImName())) |
| | | .forEach(im->{ |
| | | i.set(im.getIprInfos().size()); |
| | | }); |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSampleOptions() { |
| | | return qualificationRateStatisticsMapper.getSampleOptions(); |
| | | List<Map<String, Object>> sampleOptions = qualificationRateStatisticsMapper.getSampleOptions(); |
| | | //å»éæ ·å |
| | | List<Map<String, Object>> sampleOptionsDistinct = ArrayListUtil.oneObjectsDistinctByProperty(MapHandlerDto::comparingByCode, sampleOptions); |
| | | sampleOptionsDistinct.forEach(System.out::println); |
| | | return sampleOptionsDistinct; |
| | | } |
| | | |
| | | public static String getPercent(long x, long y) { |
| | |
| | | i.end_time endTime |
| | | FROM inspection i |
| | | INNER JOIN inspection_material im ON i.id = im.inspection_id |
| | | where (i.state = 1 AND i.inspection_status is NOT NULL and im.state=1) |
| | | where (i.state = 1 and im.state=1) |
| | | <if test="dto.beginDate!=null and dto.endDate!=null"> |
| | | DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | |
| | | and im.name=#{dto.sample} |
| | | </if> |
| | | <if test="dto.code!=null and dto.code!=''"> |
| | | and i.code=#{dto.code} |
| | | and im.code=#{dto.code} |
| | | </if> |
| | | </select> |
| | | <select id="selectProjectionsByCondition" resultMap="ImInfoMap"> |
| | |
| | | ipr.id iprId, |
| | | ipr.`name` iprName, |
| | | ipr.test_state testState, |
| | | i.code iCode, |
| | | im.code imCode, |
| | | i.type type |
| | | FROM |
| | | inspection i, |
| | |
| | | and im.name=#{dto.sample} |
| | | </if> |
| | | <if test="dto.code!=null and dto.code!=''"> |
| | | and i.code=#{dto.code} |
| | | and im.code=#{dto.code} |
| | | </if> |
| | | </select> |
| | | <select id="selectProjection" resultMap="ImInfoMap"> |
| | |
| | | AND i.state = 1 |
| | | AND im.state = 1 |
| | | AND ipr.state = 1 |
| | | AND i.inspection_status is NOT NULL |
| | | AND ipr.test_state is not null |
| | | <if test="dto.beginDate!=null and dto.endDate!=null"> |
| | | DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | |
| | | and im.name=#{dto.sample} |
| | | </if> |
| | | <if test="dto.code!=null and dto.code!=''"> |
| | | and i.code=#{dto.code} |
| | | and im.code=#{dto.code} |
| | | </if> |
| | | and i.code in |
| | | and im.code in |
| | | <foreach collection="list" item="l" open="(" close=")" separator="," > |
| | | #{l.code} |
| | | </foreach> |
| | |
| | | i.end_time endTime |
| | | FROM inspection i |
| | | INNER JOIN inspection_material im ON i.id = im.inspection_id |
| | | where (i.state = 1 AND i.inspection_status is NOT NULL and im.state=1) |
| | | where (i.state = 1 and im.state=1) |
| | | <if test="dto.beginDate!=null and dto.endDate!=null"> |
| | | DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | |
| | | and im.name=#{dto.sample} |
| | | </if> |
| | | <if test="dto.code!=null and dto.code!=''"> |
| | | and i.code=#{dto.code} |
| | | and im.code=#{dto.code} |
| | | </if> |
| | | </select> |
| | | <select id="getSampleOptions" resultType="java.util.Map"> |
| | |
| | | i.inspection_status inspectionStatus, |
| | | i.start_time startTime, |
| | | i.end_time endTime, |
| | | i.`code` |
| | | im.`code` code |
| | | FROM |
| | | inspection i |
| | | INNER JOIN inspection_material im ON i.id = im.inspection_id |
| | | WHERE |
| | | ( i.state = 1 AND i.inspection_status IS NOT NULL AND im.state = 1 ) |
| | | ( i.state = 1 AND im.state = 1 ) |
| | | </select> |
| | | |
| | | <resultMap id="ImInfoMap" type="com.yuanchu.limslaboratory.pojo.ImInfo"> |
| | | <result property="imId" column="imId"/> |
| | | <result property="iCode" column="iCode"/> |
| | | <result property="imCode" column="imCode"/> |
| | | <result property="imName" column="imName"/> |
| | | <result property="startTime" column="startTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | |
| | | im.name materialName, |
| | | r.conclusion , |
| | | r.status , |
| | | r.approver approver, |
| | | check_time, |
| | | u.name |
| | | from lims_laboratory.report r |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.service.RoleManagerService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Api(tags = "å®éªå®¤-->3ãè§è²ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/role-manager") |
| | | public class RoleMangerController { |
| | | |
| | | @Resource |
| | | private RoleManagerService roleManagerService; |
| | | |
| | | @ApiOperation("è·åèååè½æ ") |
| | | @GetMapping("/getMenusTree") |
| | | public Result<?>getMenusTree() { |
| | | return Result.success(roleManagerService.getMenusTree()); |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Menu; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Repository |
| | | public interface MenuMapper extends BaseMapper<Menu> { |
| | | |
| | | List<Menu> getMenuList(); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Data |
| | | public class Menu implements Serializable { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | private Integer value; |
| | | |
| | | /** |
| | | * èåå |
| | | */ |
| | | private String label; |
| | | |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | private Integer parentId; |
| | | |
| | | /** |
| | | * å级èåä¿¡æ¯ |
| | | */ |
| | | private List<Menu> children; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Data |
| | | public class Role implements Serializable { |
| | | |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer name; |
| | | |
| | | private LocalDateTime createTime; |
| | | |
| | | private LocalDateTime updateTime; |
| | | |
| | | private Integer state; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | public interface RoleManagerService { |
| | | Object getMenusTree(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.yuanchu.limslaboratory.mapper.MenuMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Menu; |
| | | import com.yuanchu.limslaboratory.service.RoleManagerService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Service |
| | | public class RoleManagerServiceImpl implements RoleManagerService { |
| | | |
| | | @Resource |
| | | private MenuMapper menuMapper; |
| | | |
| | | @Override |
| | | public Object getMenusTree() { |
| | | List<Menu> menus = menuMapper.getMenuList(); |
| | | return menus.stream() |
| | | .filter(t -> t.getParentId() == 0) |
| | | .peek((menu) -> menu.setChildren(this.getEnumChildren(menu, menus))) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | private List<Menu> getEnumChildren(Menu root, List<Menu> all) { |
| | | return all.stream() |
| | | .filter(t -> Objects.equals(t.getParentId(), root.getValue())) |
| | | .peek(g -> { |
| | | //æ¾åèå |
| | | g.setChildren(getEnumChildren(g, all)); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.MenuMapper"> |
| | | |
| | | <select id="getMenuList" resultType="com.yuanchu.limslaboratory.pojo.Menu"> |
| | | select id value,name label,parent_id parentId |
| | | from menu |
| | | where state =1 |
| | | </select> |
| | | </mapper> |