zhuwei 1 rok pred
rodič
commit
0da1842958

+ 212 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/EntrustInfoController.java

@@ -0,0 +1,212 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.vo.EntrustDataInfoVO;
+import org.springblade.business.vo.LoadDataInfoVO;
+import org.springblade.business.vo.TrialSampleDataInfoVO;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.vo.EntrustInfoVO;
+import org.springblade.business.wrapper.EntrustInfoWrapper;
+import org.springblade.business.service.IEntrustInfoService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.Date;
+
+/**
+ * 委托单信息表 控制器
+ *
+ * @author BladeX
+ * @since 2024-05-08
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/entrustinfo")
+@Api(value = "委托单信息表", tags = "委托单信息表接口")
+public class  EntrustInfoController extends BladeController {
+
+	private final IEntrustInfoService entrustInfoService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入entrustInfo")
+	public R<EntrustInfoVO> detail(EntrustInfo entrustInfo) {
+		EntrustInfo detail = entrustInfoService.getOne(Condition.getQueryWrapper(entrustInfo));
+		return R.data(EntrustInfoWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 委托单信息表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入entrustInfo")
+	public R<IPage<EntrustInfoVO>> list(EntrustInfo entrustInfo, Query query) {
+		IPage<EntrustInfo> pages = entrustInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(entrustInfo));
+		return R.data(EntrustInfoWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页 委托单信息表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "自定义分页", notes = "传入entrustInfo")
+	public R<IPage<EntrustInfoVO>> page(EntrustInfoVO entrustInfo, Query query) {
+		IPage<EntrustInfoVO> pages = entrustInfoService.selectEntrustInfoPage(Condition.getPage(query), entrustInfo);
+		return R.data(pages);
+	}
+
+/*	*//**
+	 * 新增 委托单信息表
+	 */
+/*
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入entrustInfo")
+	public R save(@Valid @RequestBody EntrustInfo entrustInfo) {
+		return R.status(entrustInfoService.save(entrustInfo));
+	}*/
+
+	@PostMapping("/save_entrust_data")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增委托单信息", notes = "新增委托单信息")
+	public R saventrustData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
+		//操作数据
+		return entrustInfoService.saventrustData(dataInfo);
+	}
+
+
+	/**
+	 * 修改 委托单信息表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入entrustInfo")
+	@Transactional
+	public R update(@Valid @RequestBody EntrustInfo entrustInfo) {
+		if(Func.isNotEmpty(entrustInfo.getRepealType()) && entrustInfo.getRepealType()==1){
+			entrustInfo.setSampleStatus("6");
+			entrustInfo.setRepealTime(new Date());
+		}
+		if(Func.isNotEmpty(entrustInfo.getRepealType()) && entrustInfo.getRepealType()==2){
+			entrustInfo.setSampleStatus("5");
+		}
+		return R.status(entrustInfoService.updateById(entrustInfo));
+	}
+
+	/**
+	 * 新增或修改 委托单信息表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入entrustInfo")
+	public R submit(@Valid @RequestBody EntrustInfo entrustInfo) {
+		return R.status(entrustInfoService.saveOrUpdate(entrustInfo));
+	}
+
+	
+	/**
+	 * 删除 委托单信息表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return  entrustInfoService.delEntrustInfo(ids);
+	}
+
+	@PostMapping("/get-report-detail")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "获取报告详情", notes = "获取报告详情")
+	public R<EntrustDataInfoVO> getReportDetail(@ApiParam(value = "取样主键id", required = true) @RequestParam String id){
+		//操作数据
+		if(id==null && Func.isNull(id)){
+			return R.fail("id不能为空");
+		}
+		EntrustDataInfoVO reportDetail = entrustInfoService.getReportDetail(id);
+		return R.data(reportDetail);
+	}
+
+
+	/**
+	 * 样品分业
+	 */
+	@GetMapping("/sample_page")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "样品分页", notes = "样品分页")
+	public R<IPage<TrialSampleDataInfoVO>> samplePage(TrialSampleDataInfoVO trialSampleInfo, Query query) {
+		IPage<TrialSampleDataInfoVO> pages = entrustInfoService.samplePage(Condition.getPage(query), trialSampleInfo);
+		return R.data(pages);
+	}
+
+
+	/**
+	 * 删除在测样品
+	 */
+	@PostMapping("/sample_remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "删除在测样品", notes = "删除在测样品")
+	public R sampleRemove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+
+		return entrustInfoService.sampleRemove(ids);
+	}
+
+
+	/**
+	 *  数据采集分页
+	 */
+	@GetMapping("/pageDataInfo")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "数据采集分页", notes = "传入entrustInfo")
+	public R<IPage<LoadDataInfoVO>> pageDataInfo(LoadDataInfoVO entrustInfo, Query query) {
+		IPage<LoadDataInfoVO> pages = entrustInfoService.selectDataInfoPage(Condition.getPage(query), entrustInfo);
+		return R.data(pages);
+	}
+
+	/**
+	 *  数据采集分页
+	 */
+	@GetMapping("/selectDataInfoById")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "数据采集详情", notes = "传入entrustInfo")
+	public R<LoadDataInfoVO> pageDataInfo(String id) {
+		LoadDataInfoVO pages = entrustInfoService.selectDataInfoById(id);
+		return R.data(pages);
+	}
+}

+ 56 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/EntrustInfoMapper.java

@@ -0,0 +1,56 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.vo.EntrustDataInfoVO;
+import org.springblade.business.vo.EntrustInfoVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.vo.LoadDataInfoVO;
+import org.springblade.business.vo.TrialSampleDataInfoVO;
+
+import java.util.List;
+
+/**
+ * 委托单信息表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-05-08
+ */
+public interface EntrustInfoMapper extends BaseMapper<EntrustInfo> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param entrustInfo
+	 * @return
+	 */
+	List<EntrustInfoVO> selectEntrustInfoPage(IPage page, EntrustInfoVO entrustInfo);
+
+	EntrustDataInfoVO getReportDetail(@Param("id") String id);
+
+	List<TrialSampleDataInfoVO> samplePage(IPage page, TrialSampleDataInfoVO trialSampleInfo);
+
+	List<LoadDataInfoVO> selectDataInfoPage(IPage page, LoadDataInfoVO loadDataInfoVO);
+
+	LoadDataInfoVO selectDataInfoById(@Param("id") String id);
+
+	int delEntrustInfo(@Param("ids") List<Long> ids);
+}

+ 154 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/EntrustInfoMapper.xml

@@ -0,0 +1,154 @@
+<?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="org.springblade.business.mapper.EntrustInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entrustInfoResultMap" type="org.springblade.business.entity.EntrustInfo">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="sample_id" property="sampleId"/>
+        <result column="entrust_info" property="entrustInfo"/>
+        <result column="entrust_no" property="entrustNo"/>
+        <result column="entrust_name" property="entrustName"/>
+        <result column="entrust_pdf" property="entrustPdf"/>
+        <result column="entrust_e_pdf" property="entrustEPdf"/>
+        <result column="exp_count" property="expCount"/>
+        <result column="entrust_time" property="entrustTime"/>
+        <result column="sample_time" property="sampleTime"/>
+        <result column="ctest_time" property="ctestTime"/>
+        <result column="repeal_reason" property="repealReason"/>
+        <result column="repeal_type" property="repealType"/>
+        <result column="resam_start_time" property="resamStartTime"/>
+        <result column="resam_end_time" property="resamEndTime"/>
+        <result column="repeal_time" property="repealTime"/>
+        <result column="sample_status" property="sampleStatus"/>
+    </resultMap>
+
+    <resultMap id="entrustInfoResultVoMap" type="org.springblade.business.vo.EntrustInfoVO">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="sample_id" property="sampleId"/>
+        <result column="entrust_info" property="entrustInfo"/>
+        <result column="entrust_no" property="entrustNo"/>
+        <result column="entrust_name" property="entrustName"/>
+        <result column="entrust_pdf" property="entrustPdf"/>
+        <result column="entrust_e_pdf" property="entrustEPdf"/>
+        <result column="exp_count" property="expCount"/>
+        <result column="nodeId" property="nodeId"/>
+        <result column="materialName" property="materialName"/>
+    </resultMap>
+
+
+    <select id="selectEntrustInfoPage" resultMap="entrustInfoResultVoMap">
+        SELECT a.*,b.node_id as nodeId,b.material_name as materialName ,
+          (SELECT max(c.id) from u_trial_self_inspection_record c where c.entrust_id = a.id) as testId
+               from u_entrust_info a LEFT JOIN u_trial_sample_info b on a.sample_id=b.id
+        where a.is_deleted = 0 and b.is_deleted=0
+        <if test="param2.nodeId != null">
+            and b.node_id = #{param2.nodeId}
+        </if>
+        <if test="param2.contractId != null">
+            and a.contract_id = #{param2.contractId}
+        </if>
+        <if test="param2.status != null">
+            and a.status = #{param2.status}
+        </if>
+        <if test="param2.entrustName != null and param2.entrustName != ''">
+            AND a.entrust_name like CONCAT(CONCAT('%', #{param2.entrustName}), '%')
+        </if>
+    </select>
+
+    <select id="getReportDetail" resultType="org.springblade.business.vo.EntrustDataInfoVO">
+        SELECT a.id as id,a.entrust_info as entrustInfo,a.entrust_name as entrustName,b.material_name as materialName,
+               b.material_count as materialCount,b.specification_number as specificationNumber,a.exp_count as expCount,
+               b.specification_model as specificationModel, b.calculation_unit as calculationUnit
+        from u_entrust_info a , u_trial_sample_info b
+        where  a.sample_id=b.id and a.is_deleted = 0 and b.is_deleted=0
+        and a.id=#{id}
+    </select>
+
+    <select id="samplePage" resultType="org.springblade.business.vo.TrialSampleDataInfoVO">
+        SELECT a.id,b.*,(SELECT name from blade_user c where c.id=b.user_id) as userName,
+               a.ctest_time as ctestTime,a.exp_count as expCount, b.material_count-a.exp_count as sxCount,
+               CONCAT_WS('-', resam_start_time, resam_end_time) as resamTime,IF(resam_start_time is NULL,'否','是') as isSample,
+               a.repeal_reason as repealReason,a.repeal_time as repealTime,
+        (SELECT max(task_status) from u_trial_self_inspection_record c where c.entrust_id = a.id) as entrustStatusName,
+        (SELECT IF((max(task_status)) ='已审批',4,1) from u_trial_self_inspection_record c where c.entrust_id = a.id) as entrustStatus,
+        (SELECT max(c.id) from u_trial_self_inspection_record c where c.entrust_id = a.id) as testId
+        from u_entrust_info a , u_trial_sample_info b
+        where  a.sample_id=b.id and a.is_deleted = 0 and b.is_deleted=0
+          and a.sample_status=#{param2.status}
+        <if test="param2.materialName != null and param2.materialName != ''">
+            AND b.material_name like CONCAT(CONCAT('%', #{param2.materialName}), '%')
+        </if>
+        <if test="param2.nodeId != null and param2.nodeId != ''">
+            AND b.node_id = #{param2.nodeId}
+        </if>
+        <if test="param2.contractId != null and param2.contractId != ''">
+            AND a.contract_id = #{param2.contractId}
+        </if>
+
+    </select>
+
+
+    <select id="selectDataInfoPage" resultType="org.springblade.business.vo.LoadDataInfoVO">
+        select * from u_view_gather_data_info a where 1=1
+
+        <if test="param2.testTypeName != null and param2.testTypeName != ''">
+            AND a.testTypeName like CONCAT(CONCAT('%', #{param2.testTypeName}), '%')
+        </if>
+
+       <if test="param2.startTime != null and param2.startTime != '' ">
+            and a.playTime &gt;= #{param2.startTime}
+        </if>
+
+        <if test="param2.endTime != null and param2.endTime != '' ">
+            and a.playTime &lt;= #{param2.endTime}
+        </if>
+        <!-- 引用 &ndash;&gt;
+        <if test="param2.dataStatus != null and param2.dataStatus != '' ">
+            and a.playTime &lt;= #{param2.endTime}
+        </if>
+
+        &lt;!&ndash; 合格 &ndash;&gt;
+        <if test="param2.dataQualified != null and param2.dataQualified != '' ">
+            and a.dataStatus &lt;= #{param2.endTime}
+        </if>
+
+        &lt;!&ndash; 合同段 &ndash;&gt;
+        <if test="param2.contractId != null and param2.contractId != '' ">
+            and a.dataStatus &lt;= #{param2.endTime}
+        </if>-->
+
+    </select>
+
+    <select id="selectDataInfoById" resultType="org.springblade.business.vo.LoadDataInfoVO">
+        select a.*,(SELECT dict_key from blade_dict_biz where id=(SELECT parent_id from blade_dict_biz where code='test_data_type' and dict_value=a.testTypeName)) as testTypePId
+        from u_view_gather_data_info a  where a.id=#{id}
+    </select>
+
+
+    <delete id="delEntrustInfo" >
+        delete from u_entrust_info where id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        and status !=2
+        and id not in(SELECT entrust_id from u_trial_self_inspection_record where is_deleted=0)
+    </delete>
+
+</mapper>

+ 73 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IEntrustInfoService.java

@@ -0,0 +1,73 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.service;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.vo.EntrustDataInfoVO;
+import org.springblade.business.vo.EntrustInfoVO;
+import org.springblade.business.vo.LoadDataInfoVO;
+import org.springblade.business.vo.TrialSampleDataInfoVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.tool.api.R;
+
+import java.util.List;
+
+/**
+ * 委托单信息表 服务类
+ *
+ * @author BladeX
+ * @since 2024-05-08
+ */
+public interface IEntrustInfoService extends BaseService<EntrustInfo> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param entrustInfo
+	 * @return
+	 */
+	IPage<EntrustInfoVO> selectEntrustInfoPage(IPage<EntrustInfoVO> page, EntrustInfoVO entrustInfo);
+
+	EntrustDataInfoVO getReportDetail(String id);
+
+	/**
+	 * 样品分
+	 * @param page
+	 * @param trialSampleInfo
+	 * @return
+	 */
+	IPage<TrialSampleDataInfoVO> samplePage(IPage<TrialSampleDataInfoVO> page, TrialSampleDataInfoVO trialSampleInfo);
+	R sampleRemove(String ids);
+
+	//委托单数据保存
+	R saventrustData(JSONObject dataInfo);
+
+	/**
+	 * 数据采集分页
+	 * @param page
+	 * @param loadDataInfoVO
+	 * @return
+	 */
+	IPage<LoadDataInfoVO> selectDataInfoPage(IPage<LoadDataInfoVO> page, LoadDataInfoVO loadDataInfoVO);
+	LoadDataInfoVO selectDataInfoById(String id);
+
+	//委托单删除
+	R delEntrustInfo(String ids);
+}

+ 180 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/EntrustInfoServiceImpl.java

@@ -0,0 +1,180 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.AllArgsConstructor;
+import org.jsoup.select.Elements;
+import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.service.ITrialSampleInfoService;
+import org.springblade.business.vo.EntrustDataInfoVO;
+import org.springblade.business.vo.EntrustInfoVO;
+import org.springblade.business.mapper.EntrustInfoMapper;
+import org.springblade.business.service.IEntrustInfoService;
+import org.springblade.business.vo.LoadDataInfoVO;
+import org.springblade.business.vo.TrialSampleDataInfoVO;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.WbsTreePrivate;
+import org.springblade.manager.feign.ExcelTabClient;
+import org.springblade.manager.feign.WbsTreePrivateClient;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 委托单信息表 服务实现类
+ *
+ * @author BladeX
+ * @since 2024-05-08
+ */
+@Service
+@AllArgsConstructor
+public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, EntrustInfo> implements IEntrustInfoService {
+
+	private final ExcelTabClient excelTabClient;
+	private final JdbcTemplate jdbcTemplate;
+	private final WbsTreePrivateClient wbsTreePrivateClient;
+
+	@Override
+	public IPage<EntrustInfoVO> selectEntrustInfoPage(IPage<EntrustInfoVO> page, EntrustInfoVO entrustInfo) {
+		return page.setRecords(baseMapper.selectEntrustInfoPage(page, entrustInfo));
+	}
+
+	@Override
+	public EntrustDataInfoVO getReportDetail(String id) {
+		return baseMapper.getReportDetail(id);
+	}
+
+	@Override
+	public IPage<TrialSampleDataInfoVO> samplePage(IPage<TrialSampleDataInfoVO> page, TrialSampleDataInfoVO trialSampleInfo) {
+		return page.setRecords(baseMapper.samplePage(page, trialSampleInfo));
+	}
+
+	@Override
+	public R sampleRemove(String ids) {
+		if(Func.isNull(ids)){
+			return R.fail("ids不能为null");
+		}
+		return null;
+	}
+
+	@Override
+	public R saventrustData(JSONObject dataInfo) {
+		if(dataInfo == null && Func.isEmpty(dataInfo)){
+			return R.fail("文件不能为空");
+		}
+		String sampleId = "";
+		String contractId = "";
+		// 创建 委托单信息
+		if(!dataInfo.containsKey("sampleId")){
+			return R.fail("取样信息为sampleId不存在");
+		}else{
+			sampleId = dataInfo.getString("sampleId");
+		}
+		if(!dataInfo.containsKey("contractId")){
+			return R.fail("取样信息为contractId不存在");
+		}else{
+			contractId = dataInfo.getString("contractId");
+		}
+
+		String nodeErTreeId = dataInfo.getString("nodeErTreeId");
+
+		// 保存数据文件
+		EntrustInfo entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getSampleId, sampleId).eq(EntrustInfo::getContractId,contractId));
+		if(entrustInfo==null && Func.isEmpty(entrustInfo)){
+			entrustInfo = new EntrustInfo();
+		}
+		WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.getNodeByPrimaryKeyId(nodeErTreeId);
+
+		String sql ="select * from m_wbs_form_element where is_deleted = 0 and dynamic_dict in(500,501,502)  and f_id="+wbsTreePrivate.getInitTableId();
+		List<Map<String, Object>> wbsFormElements = jdbcTemplate.queryForList(sql);
+
+
+		entrustInfo.setSampleId(Func.toLong(sampleId));
+		entrustInfo.setContractId(contractId);
+		for(Map<String, Object> wb:wbsFormElements) {
+			String ekey = wb.get("e_key")+"";
+			if ((wb.get("dynamic_dict") + "").equals("500")) { //委托单--委托单位
+				for(String dataEkey : dataInfo.keySet()){
+					if(dataEkey.indexOf(ekey)>=0){
+						entrustInfo.setEntrustName(dataInfo.getString(dataEkey));
+					}
+				}
+
+			}
+
+			if ((wb.get("dynamic_dict") + "").equals("501")) { //委托单--委托单编号
+				for(String dataEkey : dataInfo.keySet()){
+					if(dataEkey.indexOf(ekey)>=0){
+						entrustInfo.setEntrustNo(dataInfo.getString(dataEkey));
+					}
+				}
+			}
+
+			if ((wb.get("dynamic_dict") + "").equals("502")) { //委托单-委托单名称
+				for(String dataEkey : dataInfo.keySet()){
+					if(dataEkey.indexOf(ekey)>=0){
+						entrustInfo.setEntrustInfo(dataInfo.getString(dataEkey));
+					}
+				}
+			}
+		}
+		this.saveOrUpdate(entrustInfo);
+		dataInfo.put("groupId",entrustInfo.getId());
+		dataInfo.put("pkeyId", dataInfo.getString("nodeErTreeId"));
+		excelTabClient.saveEntrustTabData(dataInfo);
+
+		return R.success("操作成功");
+	}
+
+	/**
+	 * 数据采集分页
+	 * @param page
+	 * @param loadDataInfoVO
+	 * @return
+	 */
+	@Override
+	public IPage<LoadDataInfoVO> selectDataInfoPage(IPage<LoadDataInfoVO> page, LoadDataInfoVO loadDataInfoVO) {
+		return page.setRecords(baseMapper.selectDataInfoPage(page, loadDataInfoVO));
+	}
+
+	@Override
+	public LoadDataInfoVO selectDataInfoById(String id) {
+		return baseMapper.selectDataInfoById(id);
+	}
+
+	@Override
+	public R delEntrustInfo(String ids){
+		if(Func.isNull(ids) || Func.isEmpty(ids)){
+			return R.fail("ids不能为null");
+		}
+		List<Long> longList = Func.toLongList(ids);
+		int delete = baseMapper.delEntrustInfo(longList);
+
+		return R.success("");
+	}
+
+}