¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.exception; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/9/4 |
| | | * ä¸å¡å¼å¸¸ |
| | | */ |
| | | public class ApplicationException extends RuntimeException{ |
| | | |
| | | |
| | | /** |
| | | * ä¸å¡ç¼ç å®ä¹ |
| | | * @return ä¸å¡ç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * ä¸å¡ä¿¡æ¯å®ä¹ |
| | | * @return ä¸å¡ä¿¡æ¯å®ä¹ |
| | | */ |
| | | private String msg; |
| | | |
| | | |
| | | public ApplicationException(String code, String msg) { |
| | | super(msg); |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ApplicationException() { |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.TypeMismatchException; |
| | | import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.dao.DataAccessException; |
| | | import org.springframework.dao.DataIntegrityViolationException; |
| | | import org.springframework.dao.DuplicateKeyException; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.http.converter.HttpMessageNotReadableException; |
| | | import org.springframework.http.converter.HttpMessageNotWritableException; |
| | | import org.springframework.jdbc.BadSqlGrammarException; |
| | |
| | | import java.io.IOException; |
| | | import java.net.BindException; |
| | | import java.sql.SQLException; |
| | | import java.sql.SQLIntegrityConstraintViolationException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public Result<?> noAuth(AuthException e){ |
| | | return Result.fail(Integer.valueOf(e.getCode()),e.getMsg()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | }) |
| | | @PostMapping("/check") |
| | | @AuthHandler |
| | | public Result check(@RequestHeader("X-Token") String token, Integer id, String result) throws Exception { |
| | | public Result check(@RequestHeader("X-Token") String token, Integer id, Integer result) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | MyUtil.PrintLog(unmarshal + "-------id" + id + "=========" + result); |
| | |
| | | private String supplier; |
| | | |
| | | /** |
| | | * åå·id |
| | | */ |
| | | private String specificationId; |
| | | |
| | | /** |
| | | * è§æ ¼åç§°-åå·åç§° |
| | | **/ |
| | | private String specifications; |
| | |
| | | @ApiModelProperty(value = "ææåç§°", required = true, example = "å
纤") |
| | | private String materialName; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åå·", required = true) |
| | | private Integer specificationsId; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åå·", required = true, example = "GGXH2023") |
| | | private String specificationsModels; |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String check(String name, Integer id, String result); |
| | | String check(String name, Integer id, Integer result); |
| | | |
| | | /** |
| | | * å é¤ |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.exception.ApplicationException; |
| | | import com.yuanchu.limslaboratory.mapper.*; |
| | | import com.yuanchu.limslaboratory.pojo.*; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InsProductVo; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | //æ°å¢æ£éªå-->éæ©æ£éªé¡¹ç®çæ¬ |
| | | @Override |
| | | public List<Integer> chooseVer(String name, String mcode, String specifications) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | return productMapper.chooseVersion(specificationId); |
| | | return productMapper.chooseVersion(Integer.parseInt(specifications)); |
| | | } |
| | | |
| | | //æ°å¢æ£éªå-->éæ©æ£éªé¡¹ç®çæ¬-->æ¥çè¯¥çæ¬ä¸æä»¬è¦åç项ç®è¦æ± |
| | | @Override |
| | | public List<Map<String, Object>> lookProByVer(String name, String mcode, String specifications, Integer version, String experiment) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | Integer specificationId = Integer.parseInt(specifications); |
| | | /*妿è¯éªé¡¹ç®ä¸ºç©ºåæ¯æåæ£éªæè
åæææ£éªåæ¯å±ç¤ºè¯¥çæ¬çææé¡¹ç®æ£éªè¦æ±åæ°*/ |
| | | if (ObjectUtils.isEmpty(experiment)) { |
| | | return productMapper.pageProductInformation(specificationId, version); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addInspect(Integer id, InspectionVo inspectionVo) { |
| | | public Integer addInspect(Integer id, InspectionVo inspectionVo) throws ApplicationException { |
| | | /*æ°å¢æ£éªç³è¯·è¡¨*/ |
| | | Inspection inspection = Inspection.builder() |
| | | .startTime(inspectionVo.getStartTime()) |
| | |
| | | .num(inspectionVo.getNum()) |
| | | .unit(inspectionVo.getUnit()) |
| | | .supplier(inspectionVo.getSupplier()) |
| | | .specificationId(inspectionVo.getSpecificationId()) |
| | | .specifications(inspectionVo.getSpecifications()) |
| | | .formTime(inspectionVo.getFormTime()) |
| | | .inspectionId(inspection.getId()) |
| | |
| | | inspectionMaterialMapper.insert(inspectionMaterial); |
| | | /*æ°å¢æ£éªé¡¹ç®è¡¨*/ |
| | | //æ ¹æ®æ ·ååç§°ç¼å·ä»¥ååå·è§æ ¼è·ååå·id |
| | | Integer specificationId = null; |
| | | if(ObjectUtils.isNotEmpty(inspectionVo.getSpecificationId())){ |
| | | specificationId =Integer.parseInt(inspectionVo.getSpecificationId()); |
| | | }else{ |
| | | specificationId=getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications()); |
| | | } |
| | | Integer specificationId = Integer.parseInt(inspectionVo.getSpecificationId()); |
| | | //if(ObjectUtils.isNotEmpty(inspectionVo.getSpecificationId())){ |
| | | // specificationId =Integer.parseInt(inspectionVo.getSpecificationId()); |
| | | //}else{ |
| | | // specificationId=getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications()); |
| | | //} |
| | | //妿è¯éªé¡¹ç®å段ä¸ä¸ºç©ºåæè¯¥å段ç项ç®è¿è¡å¹é
|
| | | if (ObjectUtils.isNotEmpty(inspectionVo.getExperiment())) { |
| | | //è·åè¯éªé¡¹ç®ä¿¡æ¯(ç»æ,导线å¤å¾) |
| | |
| | | productMapper.selectList(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .eq("version",inspectionVo.getVersion())); |
| | | productList.stream().forEach(p->{ |
| | | String internal = Optional.ofNullable(p) |
| | | .map(Product::getInternal) |
| | | .orElse("空"); |
| | | String required = Optional.ofNullable(p) |
| | | .map(Product::getRequired).orElse("空"); |
| | | if(Objects.equals("空",internal)||Objects.equals(required,"空")) { |
| | | throw new ApplicationException("500","项ç®çæ¬ä¸å¯ç¨"); |
| | | } |
| | | }); |
| | | //å°æ¥è¯¢ç项ç®ä¿¡æ¯æå»ºææ£éªé¡¹ç® |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : productList) { |
| | |
| | | |
| | | //å®¡æ ¸ |
| | | @Override |
| | | public String check(String name, Integer id, String result) { |
| | | public String check(String name, Integer id, Integer result) { |
| | | Report report = new Report(); |
| | | report.setId(id); |
| | | report.setApprover(name); |
| | | report.setCheckTime(new Date()); |
| | | if (result.equals("éè¿")){ |
| | | report.setStatus(2); |
| | | }else if (result.equals("ä¸éè¿")){ |
| | | report.setStatus(3); |
| | | } |
| | | report.setStatus(result); |
| | | reportMapper.updateById(report); |
| | | return "å®¡æ ¸æå!"; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> getReportContext(String code) { |
| | | return reportMapper.getReportContext(code); |
| | | Map<String, Object> reportContext = reportMapper.getReportContext(code); |
| | | System.out.println("========================"); |
| | | System.out.println(reportContext); |
| | | return reportContext; |
| | | } |
| | | |
| | | @Override |
| | |
| | | INNER JOIN inspection_material im ON i.id = im.inspection_id |
| | | 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 DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | | AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} |
| | | </if> |
| | |
| | | AND ipr.test_state is not null |
| | | AND ipr.test_state = 0 |
| | | <if test="dto.beginDate!=null and dto.endDate!=null"> |
| | | DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | | AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} |
| | | </if> |
| | |
| | | AND im.state = 1 |
| | | AND ipr.state = 1 |
| | | <if test="dto.beginDate!=null and dto.endDate!=null"> |
| | | DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | | AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} |
| | | </if> |
| | |
| | | INNER JOIN inspection_material im ON i.id = im.inspection_id |
| | | 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 DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} |
| | | AND #{dto.endDate} |
| | | AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} |
| | | </if> |
| | |
| | | AND r.`type` = #{type} |
| | | </if> |
| | | <if test="createTime != null and createTime != ''"> |
| | | AND DATE_FORMAT(r.`create_time`,'%Y-%m-%d') = #{createTime} |
| | | AND DATE_FORMAT(r.`date_survey`,'%Y-%m-%d') = #{createTime} |
| | | </if> |
| | | </select> |
| | | <select id="selectRawmaAll" resultType="java.util.Map"> |
| | |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="checkTime" column="check_time"/> |
| | | <result property="inspectionStatus" column="inspection_status"/> |
| | | <result property="notes" column="notes"/> |
| | | <collection property="products" resultMap="products" javaType="java.util.List"/> |
| | | </resultMap> |
| | | |
| | |
| | | <result property="required" column="required"/> |
| | | <result property="testValue" column="test_value"/> |
| | | <result property="testState" column="test_state"/> |
| | | <result property="ipName" column="ipName"/> |
| | | </resultMap> |
| | | |
| | | <select id="getReportContext" resultMap="report"> |
| | |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and i.`equipment_name` like concat('%',#{dto.name},'%') |
| | | </if> |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and i.measurement_unit like concat('%',#{dto.unit},'%') |
| | | <if test="dto.unit!=null and dto.unit!=''"> |
| | | and m.measurement_unit like concat('%',#{dto.unit},'%') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | @ApiModelProperty(value = "å
³è åå·id", example = "1", hidden = true) |
| | | private Integer specifications_id; |
| | | |
| | | public Product() { |
| | | } |
| | | |
| | | public Product(Integer id, String name, String father, String unit, String required, String internal, Integer state, Date createTime, Date updateTime, Integer version, Integer specifications_id) { |
| | | this.id = id; |
| | | this.name = name; |
| | | this.father = father; |
| | | this.unit = unit; |
| | | this.required = required; |
| | | this.internal = internal; |
| | | this.state = state; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.version = version; |
| | | this.specifications_id = specifications_id; |
| | | } |
| | | } |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # url: jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # username: user |
| | | # password: 123456 |
| | | url: jdbc:mysql://192.168.73.113:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: user |
| | | password: 123456 |
| | | # url: jdbc:mysql://localhost:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: 123456 |
| | | druid: |
| | | # Druidæ°æ®æºé
ç½® |
| | | initialSize: 5 # åå§è¿æ¥æ° |
| | |
| | | # redisæ°æ®åºç´¢å¼(é»è®¤ä¸º0)ï¼æä»¬ä½¿ç¨ç´¢å¼ä¸º3çæ°æ®åºï¼é¿å
åå
¶ä»æ°æ®åºå²çª |
| | | database: 0 |
| | | # redisæå¡å¨å°åï¼é»è®¤ä¸ºlocalhostï¼ |
| | | host: 192.168.110.209 |
| | | # host: localhost |
| | | # host: 192.168.110.209 |
| | | host: 192.168.73.113 |
| | | # redis端å£ï¼é»è®¤ä¸º6379ï¼ |
| | | port: 6380 |
| | | port: 6379 |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |
| | | password: null |
| | | # redisè¿æ¥è¶
æ¶æ¶é´ï¼å使¯«ç§ï¼ |
| | |
| | | |
| | | int deleteRoleMenuByRoleId(Long id); |
| | | |
| | | List<RoleMenu>getRoleMenuByRoleId(@Param("roleId")Long roleId); |
| | | |
| | | RoleAndMenuDto selectAllRoleAndMenuByRoleId(Long roleId); |
| | | |
| | | List<Map<String, Object>> getUserListRole(); |
| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.exception.AuthException; |
| | |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleInfoDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateRoleMenuDto; |
| | | import com.yuanchu.limslaboratory.service.RoleManagerService; |
| | | import com.yuanchu.limslaboratory.utils.ArrayListUtil; |
| | | import com.yuanchu.limslaboratory.utils.JsonUtil; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | ,createTime |
| | | )); |
| | | }); |
| | | if(roleMenuList.size()<1){ |
| | | roleMenuList.add(new RoleMenu(null,nextId,39L,true,false,false,false,createTime)); |
| | | } |
| | | roleMenuList.add(new RoleMenu(null,nextId,39L,true,false,false,false,createTime)); |
| | | //roleMenuAddList.forEach(System.out::println); |
| | | int i = roleManageMapper.insertBatchRoleMenu(roleMenuList); |
| | | return insert>0&&i>0; |
| | |
| | | .set(RoleInfo::getUpdateTime,DateUtil.toLocalDateTime(DateUtil.date())) |
| | | .eq(RoleInfo::getId,dto.getRoleId()); |
| | | int update = roleManageMapper.update(null, updateWrapper); |
| | | //å é¤role_menuä¿¡æ¯ |
| | | int deleteRoleMenuByRoleId = roleManageMapper.deleteRoleMenuByRoleId(dto.getRoleId()); |
| | | List<RoleMenu> roleMenuByRoleId = roleManageMapper.getRoleMenuByRoleId(dto.getRoleId()); |
| | | if (roleMenuByRoleId.size()>1){ |
| | | //å é¤role_menuä¿¡æ¯ |
| | | update = roleManageMapper.deleteRoleMenuByRoleId(dto.getRoleId()); |
| | | } |
| | | //æ·»å ææ°éæ©ã |
| | | dto.getMenuData().forEach(l->{ |
| | | l.setRoleId(dto.getRoleId()); |
| | | l.setCreateTime(DateUtil.toLocalDateTime(DateUtil.date())); |
| | | l.setUpdateTime(DateUtil.toLocalDateTime(DateUtil.date())); |
| | | }); |
| | | int insertBatchRoleMenu = roleManageMapper.insertBatchRoleMenu(dto.getMenuData()); |
| | | return update>0&&deleteRoleMenuByRoleId>0&&insertBatchRoleMenu>0; |
| | | List<RoleMenu> collect = dto.getMenuData().stream().filter(l -> l.getAdded() == false && l.getDeleted() == false && l.getSelected() == false && l.getUpdated() == false).collect(Collectors.toList()); |
| | | List<RoleMenu> roleMenuList = ArrayListUtil.compareNotEqualListBySingleValue(dto.getMenuData(), collect); |
| | | if(roleMenuList.size()>0){ |
| | | return update>0&&roleManageMapper.insertBatchRoleMenu(roleMenuList)>0; |
| | | }else { |
| | | return update>0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.JsonUtil; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.pojo.vo.NewPersonnelVo; |
| | |
| | | |
| | | @Override |
| | | public Integer addNewPersonnel(NewPersonnelVo newPersonnelVo, String enterpriseId) { |
| | | try { |
| | | User unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(newPersonnelVo), User.class); |
| | | unmarshal.setEnterpriseId(Integer.valueOf(enterpriseId)); |
| | | return userMapper.insert(unmarshal); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | User unmarshal = JsonUtil.jsonToPojo(JsonUtil.jsonToString(newPersonnelVo), User.class); |
| | | unmarshal.setEnterpriseId(Integer.valueOf(enterpriseId)); |
| | | return userMapper.insert(unmarshal); |
| | | } |
| | | |
| | | @Override |
| | |
| | | delete |
| | | from role_menu |
| | | where role_id = #{id} |
| | | and menu_id !=39 |
| | | </delete> |
| | | <select id="getAssertName" resultType="com.yuanchu.limslaboratory.pojo.RoleInfo"> |
| | | select id |
| | |
| | | select name, url |
| | | from interface_info |
| | | </select> |
| | | <select id="getRoleMenuByRoleId" resultType="com.yuanchu.limslaboratory.pojo.RoleMenu"> |
| | | select id from role_menu where role_id =#{roleId} |
| | | </select> |
| | | <resultMap id="roleAndMenuById" type="com.yuanchu.limslaboratory.pojo.dto.RoleAndMenuDto"> |
| | | <result property="roleName" column="roleName"/> |
| | | <result property="createTime" column="createTime"/> |