Commit 1d5fcc17 by lijingjing

添加检测项目执行状态接口;

parent ecc8c696
......@@ -2,6 +2,7 @@ package com.patzn.cloud.service.lims.hmhj.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.google.common.collect.Lists;
import com.patzn.cloud.commons.api.RestAssert;
import com.patzn.cloud.commons.api.RestConstants;
import com.patzn.cloud.commons.api.RestResult;
import com.patzn.cloud.commons.controller.ServiceController;
......@@ -653,4 +654,17 @@ public class EntrustSampleItemController extends ServiceController {
public RestResult<Boolean> revokeDeletedItem(@RequestParam("sampleIds") Long[] sampleIds) {
return success(entrustSampleItemService.revokeDeletedItems(sampleIds));
}
@ApiOperation("恢复删除的检测项目")
@PostMapping("/revoke_removed_item")
public RestResult<Boolean> revokeRemovedItem(@RequestParam("ids") Long[] ids) {
return success(entrustSampleItemService.revokeRemovedItem(ids));
}
@ApiOperation("委托检测项目填写进度查询")
@PostMapping("/item_fill_progress_query")
public RestResult<Page<EntrustSampleItemVO>> getItemFillProgressQuery(EntrustSampleItemVO itemVO) {
RestAssert.fail(null == itemVO.getEntrustId(), "委托ID为空");
return success(entrustSampleItemService.getItemFillProgressQuery(getPage(), itemVO));
}
}
......@@ -73,4 +73,9 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
@SqlParser(filter = true)
boolean updateForRevokeDeletedItems(@Param("sampleIds") Long[] sampleIds);
@SqlParser(filter = true)
boolean updateForRevokeRemovedItems(@Param("ids") Long[] ids);
List<EntrustSampleItemVO> selectItemFillProgress(@Param("vo") EntrustSampleItemVO itemVO);
}
......@@ -107,4 +107,8 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
boolean revokeDeletedItems(Long[] sampleIds);
List<EntrustSampleItem> getListByEntrustId(Long entrustId);
boolean revokeRemovedItem(Long[] ids);
Page<EntrustSampleItemVO> getItemFillProgressQuery(Page<EntrustSampleItemVO> page, EntrustSampleItemVO itemVO);
}
......@@ -1326,6 +1326,19 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return list(Condition.create().exists("select 1 from entrust_sample s where s.deleted = 0 and s.id = entrust_sample_item.entrust_sample_id and s.entrust_id = " + entrustId));
}
@Override
public boolean revokeRemovedItem(Long[] ids) {
if (null == ids) {
throw new PatznException("检测项目编号为空");
}
return baseMapper.updateForRevokeRemovedItems(ids);
}
@Override
public Page<EntrustSampleItemVO> getItemFillProgressQuery(Page<EntrustSampleItemVO> page, EntrustSampleItemVO itemVO) {
return page.setRecords(baseMapper.selectItemFillProgress(itemVO));
}
/**
* 处理 原铝等标准为
*/
......
......@@ -271,6 +271,32 @@
ORDER BY s.code , i.name
</select>
<select id="selectItemFillProgress" resultType="com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO">
with ix as (
select x.entrust_sample_item_id,
(case when count(1) != sum(case when x.test_value is null then 0 else 1 end) then 0 else 1 end) "is_finish"
from entrust_sample_item_index x where x.deleted = 0
group by x.entrust_sample_item_id
)
SELECT i.id,i.name,s.code AS "sampleCode",s.name AS "sampleName",
( case when i.status = 50 THEN '已提交' WHEN i.status = 40 and ix.is_finish = 1 then '已检测' else '检测中' end ) "handle_status",
i.entrust_sample_id,s.entrust_id,i.agreed_value,i.test_value,i.tester_id,i.tester,i.test_time,
s.sample_shape ,s.sample_quantity, s.standard, s.sample_from,s.product_code,s.name_code
FROM
entrust_sample_item i
JOIN entrust_sample s ON i.entrust_sample_id = s.ID
LEFT JOIN ix on ix.entrust_sample_item_id = i.id
WHERE i.deleted = 0 AND s.deleted = 0
AND s.entrust_id = #{vo.entrustId}
<if test="null != vo.name">
and i.name = #{vo.name}
</if>
<if test="null != vo.sampleCode">
and s.code = #{vo.sampleCode}
</if>
ORDER BY s.code ,i.name
</select>
<select id="selectByOriginalRecordId" resultType="com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO">
SELECT i.id,
i.name,
......@@ -718,4 +744,14 @@
#{sampleId}
</foreach>
</update>
<update id="updateForRevokeRemovedItems">
update entrust_sample_item
set
deleted = 0
where id in
<foreach collection="ids" index="index" item="itemId" open="(" separator="," close=")">
#{itemId}
</foreach>
</update>
</mapper>
/** add by meazty on 2021/08/07 13:54 **/
/** add by meazty on 2021/08/07 13:54 **/
/** add by meazty on 2021/08/07 13:54 **/
ALTER TABLE "public"."material"
DROP COLUMN"urgent_report_time",
ALTER COLUMN "urgent_report_time" int4;
COMMENT ON COLUMN "public"."material"."urgent_report_time" IS '加急拿报告时间(分钟)';
\ No newline at end of file
/** created by meazty on 2021/8/10 16:59 **/
/** created by meazty on 2021/8/10 16:59 **/
ALTER TABLE "public"."entrust_sample"
ADD COLUMN "material_id" int8;
COMMENT ON COLUMN "public"."entrust_sample"."material_id" IS '物资ID';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment