| | |
| | | return Result.success(insOrderPlanService.doInsOrder(id, laboratory)); |
| | | } |
| | | |
| | | @ApiOperation(value = "切换光纤/光纤带记录模版查询检验内容") |
| | | @ApiOperation(value = "切换套管/光纤/光纤带记录模版查询检验内容") |
| | | @PostMapping("/getReportModel") |
| | | @ValueAuth |
| | | public Result<?> getReportModel(Integer sampleId) { |
| | |
| | | |
| | | private SheathDto sheath; |
| | | |
| | | //检验人 |
| | | private String checkName; |
| | | |
| | | } |
| | |
| | | public class SampleProductDto2 extends OrderBy implements Serializable { |
| | | |
| | | private Integer id; |
| | | private Integer insProductId; |
| | | |
| | | @ValueTableShow(name = "样品编号") |
| | | private String sampleCode; |
| | |
| | | @ValueTableShow(value = 14, name = "结果判定") |
| | | private Integer insResult; |
| | | |
| | | @ValueTableShow(value = 15, name = "检验人") |
| | | private String checkName; |
| | | |
| | | @ValueTableShow(value = 16, name = "检验日期") |
| | | private String checkTime; |
| | | |
| | | private String equipValue; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | */ |
| | | public interface InsReportMapper extends BaseMapper<InsReport> { |
| | | |
| | | IPage<ReportPageDto> pageInsReport(IPage<ReportPageDto> page, QueryWrapper<ReportPageDto> ew); |
| | | IPage<ReportPageDto> pageInsReport(IPage<ReportPageDto> page, @Param("ew") QueryWrapper<ReportPageDto> ew, @Param("laboratory") String laboratory); |
| | | |
| | | String getLaboratoryByName(String name); |
| | | |
| | |
| | | |
| | | List<InsProduct> getInsProduct3(Integer id); |
| | | |
| | | List<InsProduct> getInsProduct4(Integer id); |
| | | |
| | | List<Map<String, Object>> getReportModel(@Param("orderId") Integer orderId, @Param("id") Integer id, @Param("laboratory") String laboratory); |
| | | |
| | | SampleVo getDetailById(Integer sampleId); |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false,select = false) |
| | | private Integer state; |
| | | } |
| | |
| | | |
| | | private Integer insFibersId; |
| | | |
| | | private Integer insBushId; |
| | | |
| | | private Integer standardMethodListId; |
| | | |
| | | //返回的20度常温的计算值(温度循环) |
| | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (type) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insSampleMapper.getInsProduct1(id, laboratory); |
| | | break; |
| | | case 1: |
| | | //光纤带 |
| | | insProducts = insSampleMapper.getInsProduct2(id); |
| | | break; |
| | | case 2: |
| | | //光纤 |
| | | insProducts = insSampleMapper.getInsProduct3(id); |
| | | break; |
| | | case 3: |
| | | //套管 |
| | | insProducts = insSampleMapper.getInsProduct4(id); |
| | | break; |
| | | } |
| | | |
| | |
| | | List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId)); |
| | | List<InsFibers> fibers = new ArrayList<>(); |
| | | List<InsFiber> fiber = new ArrayList<>(); |
| | | List<InsBushing> bush = new ArrayList<>(); |
| | | for (InsBushing insBushing : insBushings) { |
| | | //再查询出所有的光纤带 |
| | | List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId())); |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | if (CollectionUtils.isNotEmpty(insFibers)) { |
| | | for (InsFibers insFiber : insFibers) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().in(InsFiber::getInsFibersId, insFibers.stream().map(InsFibers::getId).collect(Collectors.toList()))); |
| | | for (InsFiber insFiber : fiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | } |
| | | } |
| | | fiber.addAll(fiberList); |
| | | } else { |
| | | } |
| | | //如果套管下没有光纤带就只有光纤了 |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | else if (CollectionUtils.isNotEmpty(insFiberList)) { |
| | | for (InsFiber insFiber : insFiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | } |
| | | fiber.addAll(insFiberList); |
| | | } |
| | | //如果光纤带和光纤都没有就只有套管(松套管) |
| | | else { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsBushId, insBushing.getId())); |
| | | List<Integer> collect = insProducts.stream() |
| | | .map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insBushing.setState(1);//已检验 |
| | | } else { |
| | | insBushing.setState(0);//未检验 |
| | | } |
| | | bush.add(insBushing); |
| | | } |
| | | } |
| | | map.put("光纤带", fibers); |
| | | map.put("光纤", fiber); |
| | | map.put("套管", bush); |
| | | return map; |
| | | } |
| | | |
| | |
| | | .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn()) |
| | | .eq(InsProduct::getTemplateId, product.getTemplateId()) |
| | | .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId()) |
| | | .eq(InsProduct::getInsBushId,product.getInsBushId()) |
| | | .eq(InsProduct::getInsFibersId,product.getInsFibersId()) |
| | | .eq(InsProduct::getInsFiberId,product.getInsFiberId()) |
| | | ); |
| | | if (ObjectUtils.isNotEmpty(product1)){ |
| | | //如果存在项目,查询是否有表 |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, product1.getId())); |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, product1.getId())); |
| | | if (ObjectUtils.isEmpty(productResult)){ |
| | | //没有表新建表 |
| | | productResult = new InsProductResult(); |
| | |
| | | import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | private InsProductMapper insProductMapper; |
| | | private InsProductService insProductService; |
| | | |
| | | private InsProductUserMapper insProductUserMapper; |
| | | |
| | | private GiveCode giveCode; |
| | | |
| | |
| | | } |
| | | } |
| | | //都为空 只配置了套管 这种情况只限于项目是含有松套管的 |
| | | // else { |
| | | // String collect = a.getInsProduct().stream().map(InsProduct::getInspectionItem).distinct().collect(Collectors.joining(",")); |
| | | // if (collect.contains("松套管")){ |
| | | // //获取检验项目中包含松套管的检验项目 |
| | | // List<InsProduct> products = a.getInsProduct().stream().filter(insProduct -> insProduct.getInspectionItem().contains("松套管")).collect(Collectors.toList()); |
| | | // |
| | | // }else { |
| | | // throw new ErrorException("样品的光纤配置信息里面没有配置光纤带信息也没有光纤信息,请重新配置保存再提交下单!!!"); |
| | | // } |
| | | // } |
| | | else { |
| | | String collect = a.getInsProduct().stream().map(InsProduct::getInspectionItem).distinct().collect(Collectors.joining(",")); |
| | | if (collect.contains("松套管")){ |
| | | //获取检验项目中包含松套管的检验项目 |
| | | List<InsProduct> products = a.getInsProduct().stream().filter(insProduct -> insProduct.getInspectionItem().contains("松套管")).collect(Collectors.toList()); |
| | | for (InsProduct product : products) { |
| | | product.setInsBushId(bushingDto.getId()); |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(a.getId()); |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | }else { |
| | | throw new ErrorException("样品的光纤配置信息里面没有配置光纤带信息也没有光纤信息,请重新配置保存再提交下单!!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | InsOrder insOrder = insOrderMapper.selectById(insSampleMapper.selectById(sampleId).getInsOrderId()); |
| | | String name = insSampleMapper.selMethodById(sampleId); |
| | | for (InsProduct product : productList) { |
| | | if (product.getInspectionItem().contains("松套管")){ |
| | | continue; |
| | | } |
| | | if (product.getState() == 1 && !product.getInspectionItem().equals("光纤接头损耗")) { |
| | | //判断光缆的温度循环项目添加 |
| | | if (insOrder.getSampleType().equals("光缆") && product.getInspectionItem().equals("温度循环") && type != 0) { |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById(id); |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | for (SampleProductDto sampleProductDto : list) { |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |
| | | .in(InsProductUser::getInsProductId, ids)); |
| | | if (CollectionUtils.isNotEmpty(insProductUsers)) { |
| | | List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); |
| | | String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); |
| | | sampleProductDto.setCheckName(collect); |
| | | } |
| | | } |
| | | map.put("insOrder", insOrder); |
| | | map.put("sampleProduct", list); |
| | | //查询所有记录模版去重 |
| | |
| | | public Map<String, Object> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(SampleProductDto2.class)); |
| | | map.put("body", insOrderMapper.selectSampleAndProductByOrderId(page, QueryWrappers.queryWrappers(sampleProductDto))); |
| | | IPage<SampleProductDto2> productDto2IPage = insOrderMapper.selectSampleAndProductByOrderId(page, QueryWrappers.queryWrappers(sampleProductDto)); |
| | | for (SampleProductDto2 record : productDto2IPage.getRecords()) { |
| | | InsProductUser insProductUser = insProductUserMapper.selectOne(Wrappers.<InsProductUser>lambdaQuery() |
| | | .eq(InsProductUser::getInsProductId, record.getInsProductId()) |
| | | .orderByDesc(InsProductUser::getCreateTime) |
| | | .last("limit 1")); |
| | | if (ObjectUtils.isNotEmpty(insProductUser)){ |
| | | record.setCheckName(userMapper.selectById(insProductUser.getCreateUser()).getName()); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | record.setCheckTime(insProductUser.getCreateTime().format(formatter)); |
| | | } |
| | | } |
| | | map.put("body",productDto2IPage); |
| | | return map; |
| | | } |
| | | |
| | |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.InsOrder; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.InsReportService; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import com.yuanchu.mom.vo.Result; |
| | |
| | | map.put("head", PrintChina.printChina(ReportPageDto.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsReport"); |
| | | if (map1.get("look") == 1) reportPageDto.setCreateUser(map1.get("userId")); |
| | | map.put("body", insReportMapper.pageInsReport(page, QueryWrappers.queryWrappers(reportPageDto))); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = insOrderMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | map.put("body", insReportMapper.pageInsReport(page, QueryWrappers.queryWrappers(reportPageDto),laboratory)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | select * |
| | | from ( |
| | | select |
| | | i.id,isa.sample_code,isa.sample,isa.model,isa.ins_state,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, |
| | | i.id,isa.sample_code,isa.sample,isa.model,isa.ins_state,ip.id insProductId,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, |
| | | ip.son_laboratory,ip.inspection_item_type,ip.inspection_value_type,ip.tell,ip.`last_value`,ip.ins_result,ipr.equip_value |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | |
| | | select * |
| | | from ( |
| | | select |
| | | ir.*,io.entrust_code,u.name write_user_name,u1.name ratify_user,u2.name examine_user |
| | | ir.*,io.entrust_code,u.name write_user_name,u1.name ratify_user,u2.name examine_user,io.laboratory |
| | | from ins_report ir |
| | | left join ins_order io on io.id = ir.ins_order_id |
| | | left join user u on u.id = ir.write_user_id |
| | | left join user u1 on u1.id = ir.ratify_user_id |
| | | left join user u2 on u2.id = ir.examine_user_id |
| | | where 1=1 |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | |
| | | ) a |
| | | |
| | | |
| | | |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | |
| | | ORDER BY |
| | |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | </select> |
| | | |
| | | <select id="getInsProduct4" resultMap="product"> |
| | | select ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | ip.ins_bush_id, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ipr.equip_name, |
| | | ip.method_s, |
| | | ip.tell, |
| | | ip.dic |
| | | from ins_product ip |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_bush_id = #{id} |
| | | and state = 1 |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | </select> |
| | | <select id="getReportModel" resultType="java.util.Map"> |
| | | </select> |
| | | |
| | |
| | | <result property="lastValue" column="last_value" jdbcType="VARCHAR"/> |
| | | <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/> |
| | | <result property="state" column="state" jdbcType="INTEGER"/> |
| | | <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/> |
| | | <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/> |
| | | <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/> |
| | |
| | | import com.yuanchu.mom.annotation.ValueTableShow; |
| | | import com.yuanchu.mom.pojo.AuxiliaryCorrectionHours; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | //原始工时 |
| | | public class AuxiliaryOriginalHoursDto { |
| | | |
| | | @ApiModelProperty("姓名") |
| | | @ValueTableShow(2) |
| | | @ExcelProperty(value = "姓名") |