Commit 93706d81 by lijingjing

添加部分流程检测单位限制;

parent bbf88bca
......@@ -108,4 +108,12 @@ public class EntrustFlowUtils {
}
return statusEnum;
}
public static boolean isContains(String statusPath, String flowStatus) {
if (StringUtils.isBlank(statusPath) || StringUtils.isBlank(flowStatus)) {
return false;
}
List<String> flowList = Arrays.asList(statusPath.split("->"));
return flowList.stream().anyMatch(t -> t.equals(flowStatus));
}
}
......@@ -208,9 +208,10 @@ public class EntrustController extends ServiceController {
@ApiImplicitParam(name = RestConstants.PAGE_SORD, value = "排序方式", paramType = "query", dataTypeClass = String.class),
})
@PostMapping("/page_make")
public RestResult<Page<Entrust>> getPageMake(Entrust entrust) {
public RestResult<Page<EntrustVO>> getPageMake(EntrustVO entrust) {
entrust.setStatus(EntrustStatusEnum.MAKE);
return success(entrustService.page(getPage(), entrust));
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustService.pageEntrustSampleMake(getPage(), entrust));
}
......@@ -224,6 +225,7 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_make_his")
public RestResult<Page<EntrustVO>> getPageMakeHis(EntrustVO entrust) {
entrust.setNotSampleStatus(EntrustSampleStatusEnum.DRAFT);
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustService.pageEntrustByNotSample(getPage(), entrust));
}
......@@ -400,7 +402,6 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_sample_receive")
public RestResult<Page<EntrustVO>> getPageEntrustSampleReceive(EntrustVO entrust) {
entrust.setPrepareStatus(EntrustSamplePrepareStatusEnum.RECEIVE);
// 设置用户编组
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustService.pageEntrustSampleReceive(getPage(), entrust));
}
......@@ -416,7 +417,6 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_sample_receive_his")
public RestResult<Page<EntrustVO>> getPageEntrustSampleReceiveHis(EntrustVO entrust) {
entrust.setPrepareNotStatus(EntrustSamplePrepareStatusEnum.RECEIVE);
// 设置用户编组
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustService.pageEntrustSampleReceiveHis(getPage(), entrust));
}
......@@ -605,6 +605,8 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_report_make")
public RestResult<Page<EntrustVO>> getPageReportMake(EntrustVO entrust) {
entrust.setSampleStatus(EntrustSampleStatusEnum.REPORT_MAKE);
entrust.setFlowStatus(EntrustFlowEnum.REPORT_MAKE.getName());
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustService.pageEntrustBySample(getPage(), entrust));
}
......@@ -633,6 +635,7 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_report_check")
public RestResult<Page<EntrustVO>> getPageReportCheck(EntrustVO entrust) {
entrust.setReportStatus(EntrustReportStatusEnum.CHECK);
entrust.setFlowStatus(EntrustFlowEnum.REPORT_CHECK.getName());
return success(entrustService.pageEntrustByReport(getPage(), entrust));
}
......@@ -667,6 +670,7 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_report_approve")
public RestResult<Page<EntrustVO>> getPageReportApprove(EntrustVO entrust) {
entrust.setReportStatus(EntrustReportStatusEnum.ALLOW);
entrust.setFlowStatus(EntrustFlowEnum.REPORT_ALLOW.getName());
return success(entrustService.pageEntrustByReport(getPage(), entrust));
}
......@@ -732,6 +736,7 @@ public class EntrustController extends ServiceController {
@PostMapping("/page_entrust_report_issue")
public RestResult<Page<EntrustVO>> getPageReportIssue(EntrustVO entrust) {
entrust.setReportStatus(EntrustReportStatusEnum.ISSUE);
entrust.setFlowStatus(EntrustFlowEnum.REPORT_ISSUE.getName());
return success(entrustService.pageEntrustByReport(getPage(), entrust));
}
......
......@@ -3,6 +3,7 @@ package com.patzn.cloud.service.lims.hmhj.controller;
import com.patzn.cloud.service.hmhj.entity.EntrustSampleBackup;
import com.patzn.cloud.service.hmhj.enums.EntrustSampleBackupStatusEnum;
import com.patzn.cloud.service.hmhj.vo.EntrustSampleBackupVO;
import com.patzn.cloud.service.lims.hmhj.service.impl.UserInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -40,6 +41,9 @@ public class EntrustSampleBackupController extends ServiceController {
@Autowired
private IEntrustSampleBackupService entrustSampleBackupService;
@Autowired
private UserInfoServiceImpl userInfoService;
@ApiOperation("样品备样分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = RestConstants.PAGE_PAGE, value = "请求数据的页码", required = true, paramType = "query", dataTypeClass = Integer.class),
......@@ -51,6 +55,7 @@ public class EntrustSampleBackupController extends ServiceController {
public RestResult<Page<EntrustSampleBackupVO>> getPage(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setStatus(EntrustSampleBackupStatusEnum.BACKUP_ING);
entrustSampleBackup.setType("BY");
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageVO(getPage(), entrustSampleBackup));
}
......@@ -66,6 +71,7 @@ public class EntrustSampleBackupController extends ServiceController {
public RestResult<Page<EntrustSampleBackupVO>> getPageBackupHis(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setNotStatus(EntrustSampleBackupStatusEnum.BACKUP_ING);
entrustSampleBackup.setType("BY");
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageVO(getPage(), entrustSampleBackup));
}
......@@ -81,6 +87,7 @@ public class EntrustSampleBackupController extends ServiceController {
public RestResult<Page<EntrustSampleBackupVO>> getPageManage(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setStatus(EntrustSampleBackupStatusEnum.MANAGE_ING);
entrustSampleBackup.setType("YP");
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageManage(getPage(), entrustSampleBackup));
}
......@@ -95,6 +102,7 @@ public class EntrustSampleBackupController extends ServiceController {
public RestResult<Page<EntrustSampleBackupVO>> getPageManageHis(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setNotStatus(EntrustSampleBackupStatusEnum.MANAGE_ING);
entrustSampleBackup.setType("YP");
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageVO(getPage(), entrustSampleBackup));
}
// =========================================
......@@ -111,6 +119,7 @@ public class EntrustSampleBackupController extends ServiceController {
@PostMapping("/page_handle")
public RestResult<Page<EntrustSampleBackupVO>> getPageHandle(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setStatus(EntrustSampleBackupStatusEnum.HANDLE);
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageVO(getPage(), entrustSampleBackup));
}
......@@ -125,6 +134,7 @@ public class EntrustSampleBackupController extends ServiceController {
@PostMapping("/page_handle_his")
public RestResult<Page<EntrustSampleBackupVO>> getPageHandleHis(EntrustSampleBackupVO entrustSampleBackup) {
entrustSampleBackup.setStatus(EntrustSampleBackupStatusEnum.HANDLE_OK);
entrustSampleBackup.setGroupNameList(userInfoService.getCurGroupNameList());
return success(entrustSampleBackupService.pageVO(getPage(), entrustSampleBackup));
}
......
......@@ -94,6 +94,8 @@ public class EntrustSampleController extends ServiceController {
@PostMapping("/page_report_make")
public RestResult<Page<EntrustSampleVO>> getPageReportMake(EntrustSampleVO entrustSample) {
entrustSample.setStatus(EntrustSampleStatusEnum.REPORT_MAKE);
// 只显示试样
entrustSample.setType(0);
return success(entrustSampleService.pageVOForMake(getPage(), entrustSample));
}
......@@ -113,6 +115,7 @@ public class EntrustSampleController extends ServiceController {
EntrustSampleStatusEnum.REPORT_SEND,
EntrustSampleStatusEnum.END
));
entrustSample.setType(0);
return success(entrustSampleService.pageVOForMakeHis(getPage(), entrustSample));
}
......
......@@ -16,6 +16,7 @@ import com.patzn.cloud.service.hmhj.vo.TesterWorkloadStatsVO;
import com.patzn.cloud.service.lims.base.entity.LmsUserRelGroup;
import com.patzn.cloud.service.lims.base.vo.LmsUserRelGroupVO;
import com.patzn.cloud.service.lims.hmhj.service.IEntrustSampleItemService;
import com.patzn.cloud.service.lims.hmhj.service.impl.UserInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -41,6 +42,7 @@ public class EntrustSampleItemController extends ServiceController {
@Autowired
private IEntrustSampleItemService entrustSampleItemService;
@ApiOperation("分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = RestConstants.PAGE_PAGE, value = "请求数据的页码", required = true, paramType = "query", dataTypeClass = Integer.class),
......
......@@ -102,4 +102,6 @@ public interface IEntrustService extends IBaseService<Entrust> {
boolean isCanIntoNextNode(Entrust entrust);
boolean isCanIntoPrevNode(Entrust entrust);
Page<EntrustVO> pageEntrustSampleMake(Page<EntrustVO> page, EntrustVO entrust);
}
......@@ -234,11 +234,12 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
if (!entrustSampleService.isRequireJudgeGrading(entrust.getId())) {
entrustSampleService.updateJudgeStatus(entrust.getId(), 2);
}
entrustService.updateById(entrust);
// 更改样品编码显示形式,由三级变为一级
entrustSampleService.updateSampleCodeByEntrustId(entrust.getId(), 1);
}
// 流程状态
entrust.setFlowStatus(toFlowStatus.getName());
entrustService.updateById(entrust);
entrustRecordService.record(new Long[]{entrust.getId()}, fromFlowStatus.getDisplay(), toFlowStatus.getDisplay(), 0, account, remark);
}
}
......@@ -275,14 +276,14 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
private void judgeStatusPath(Entrust entrust, EntrustFlowEnum nextStatus) {
RestAssert.fail(null == entrust, "委托信息为空");
String statusPath = entrust.getStatusPath();
String statusPath = entrust.getStatusPath(), flowStatus = entrust.getFlowStatus();
// 为空,或者路径中不包含当前流程状态
if (StringUtils.isBlank(statusPath) || !entrust.getStatusPath().contains(entrust.getFlowStatus())) {
if (!EntrustFlowUtils.isContains(statusPath, flowStatus)) {
return;
}
EntrustFlowEnum nextFlowStatus = EntrustFlowUtils.getNextFlowStatus(entrust.getFlowStatus(), statusPath);
EntrustFlowEnum nextFlowStatus = EntrustFlowUtils.getNextFlowStatus(flowStatus, statusPath);
// RestAssert.fail(null == nextFlowStatus,"状态路径配置的下一流程节点为空,无法进行下一步");
RestAssert.fail(null != nextFlowStatus && nextFlowStatus != nextStatus, String.format("状态路径配置的下一节点为【%s】,无法进行下一步",nextFlowStatus.getDisplay()));
RestAssert.fail(null != nextFlowStatus && nextFlowStatus != nextStatus, String.format("状态路径配置的下一节点为【%s】,无法进行下一步", nextFlowStatus.getDisplay()));
}
@Transactional(rollbackFor = Exception.class)
......@@ -461,14 +462,14 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
sampleStatusEnum = EntrustSampleStatusEnum.REPORT_SEND;
}
if (null != sampleStatusEnum) {
entrustSample.setStatus(sampleStatusEnum);
entrustSample.setProgress(sampleStatusEnum);
entrustSampleService.update(entrustSample, Condition.create().eq("entrust_id", entrust.getId()));
if (null != entrustReport) {
reason = String.format("因【%s】,退回至%s", reason, sampleStatusEnum.getDisplay());
entrustRecordService.record(new Long[]{entrust.getId()}, entrustReport.getStatus().getDisplay(), sampleStatusEnum.getDisplay(), 2, account, reason);
}
entrust.setFlowStatus(sampleStatusEnum.getName());
entrustService.updateById(entrust);
entrustSample.setStatus(sampleStatusEnum);
entrustSample.setProgress(sampleStatusEnum);
entrustSampleService.update(entrustSample, Condition.create().eq("entrust_id", entrust.getId()));
if (null != entrustReport) {
reason = String.format("因【%s】,退回至%s", reason, sampleStatusEnum.getDisplay());
entrustRecordService.record(new Long[]{entrust.getId()}, entrustReport.getStatus().getDisplay(), sampleStatusEnum.getDisplay(), 2, account, reason);
}
}
......
......@@ -86,6 +86,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Autowired
private SysOrgClient sysOrgClient;
@Autowired
private UserInfoServiceImpl userInfoService;
@Autowired
private Executor executor1;
......@@ -335,7 +338,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
List<Entrust> entrustList = getBatchIds(Arrays.asList(ids));
boolean hasSendMessage = false;
for (Entrust e : entrustList) {
if (StringUtils.isNotBlank(e.getStatusPath())) {
if (isCanIntoNextNode(e)) {
rejectToPrevNode(e, reason, account);
hasSendMessage = true;
} else {
......@@ -362,7 +365,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
boolean hasSendMessage = false;
for (Entrust e : entrustList) {
// 若存在路径,根据状态路径处理数据
if (StringUtils.isNotBlank(e.getStatusPath()) && e.getStatusPath().contains(e.getFlowStatus())) {
if (isCanIntoNextNode(e)) {
submitToNextNode(e, account);
hasSendMessage = true;
} else {
......@@ -389,7 +392,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
boolean hasSendMessage = false;
for (Entrust e : entrustList) {
// 若存在路径,根据状态路径处理数据
if (StringUtils.isNotBlank(e.getStatusPath())) {
if (isCanIntoNextNode(e)) {
submitToNextNode(e, account);
hasSendMessage = true;
} else {
......@@ -567,63 +570,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
public Page<EntrustVO> pageEntrustSampleReceive(Page<EntrustVO> page, EntrustVO entrust) {
List<EntrustSamplePrepare> prepareList = entrustSamplePrepareService.list(Condition.create().setSqlSelect("entrust_sample_id")
.eq("status", EntrustSamplePrepareStatusEnum.RECEIVE).isNotNull("entrust_sample_id"));
if (CollectionUtils.isEmpty(prepareList)) {
return page;
}
List<Long> sampleIds = prepareList.stream().map(p -> {
return p.getEntrustSampleId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(sampleIds)) {
return page;
}
List<EntrustSample> entrustSamples = entrustSampleService.getBatchIds(sampleIds);
if (CollectionUtils.isEmpty(entrustSamples)) {
return page;
}
List<Long> ids = entrustSamples.stream().map(e -> {
return e.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
return page;
}
entrust.setIdsList(ids);
return page.setRecords(baseMapper.selectEntrustSampleReceive(page, entrust));
}
@Override
public Page<EntrustVO> pageEntrustSampleReceiveHis(Page<EntrustVO> page, EntrustVO entrust) {
List<EntrustSamplePrepare> prepareList = entrustSamplePrepareService.list(Condition.create().setSqlSelect("entrust_sample_id").ne("status", EntrustSamplePrepareStatusEnum.RECEIVE));
if (CollectionUtils.isEmpty(prepareList)) {
return page;
}
List<Long> sampleIds = prepareList.stream().map(p -> {
return p.getEntrustSampleId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(sampleIds)) {
return page;
}
List<EntrustSample> entrustSamples = entrustSampleService.getBatchIds(sampleIds);
if (CollectionUtils.isEmpty(entrustSamples)) {
return page;
}
List<Long> ids = entrustSamples.stream().map(e -> {
return e.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
return page;
}
entrust.setIdsList(ids);
return page.setRecords(baseMapper.selectEntrustSampleReceive(page, entrust));
}
......@@ -664,64 +616,32 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
public Page<EntrustVO> pageEntrustBySample(Page<EntrustVO> page, EntrustVO entrust) {
RestAssert.fail(null == entrust.getSampleStatus(), "样品状态不能为空");
List<EntrustSample> sampleList = entrustSampleService.list(Condition.create().eq("status", entrust.getSampleStatus()));
if (CollectionUtils.isEmpty(sampleList)) {
return page;
}
List<Long> ids = sampleList.stream().map(s -> {
return s.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
if (null == entrust.getSampleStatus()) {
return page;
}
entrust.setIdsList(ids);
return page.setRecords(baseMapper.selectVOList(page, entrust));
}
@Override
public Page<EntrustVO> pageEntrustByNotSample(Page<EntrustVO> page, EntrustVO entrust) {
RestAssert.fail(null == entrust.getNotSampleStatus(), "样品状态不能为空");
List<EntrustSample> sampleList = entrustSampleService.list(Condition.create().ne("status", entrust.getNotSampleStatus()));
if (CollectionUtils.isEmpty(sampleList)) {
if (null == entrust.getNotSampleStatus()) {
return page;
}
List<Long> ids = sampleList.stream().map(s -> {
return s.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
return page;
}
entrust.setIdsList(ids);
return page.setRecords(baseMapper.selectVOList(page, entrust));
}
@Override
public Page<EntrustVO> pageEntrustByReport(Page<EntrustVO> page, EntrustVO entrust) {
RestAssert.fail(null == entrust.getReportStatus(), "报告状态不能为空");
List<EntrustReport> reportList = entrustReportService.list(Condition.create().eq("status", entrust.getReportStatus()));
if (CollectionUtils.isEmpty(reportList)) {
return page;
}
List<Long> ids = reportList.stream().map(s -> {
return s.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
if (null == entrust.getReportStatus()) {
return page;
}
entrust.setIdsList(ids);
// 此方法过滤检测单位
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return page.setRecords(baseMapper.selectVOList(page, entrust));
}
@Override
public Page<EntrustVO> pageEntrustByReportNotHis(Page<EntrustVO> page, EntrustVO entrust) {
RestAssert.fail(null == entrust.getReportNotStatus(), "报告状态不能为空");
......@@ -744,20 +664,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
public Page<EntrustVO> pageEntrustByReportHis(Page<EntrustVO> page, EntrustVO entrust) {
RestAssert.fail(CollectionUtils.isEmpty(entrust.getReportStatusList()), "报告状态不能为空");
List<EntrustReport> reportList = entrustReportService.list(Condition.create().in("status", entrust.getReportStatusList()));
if (CollectionUtils.isEmpty(reportList)) {
return page;
}
List<Long> ids = reportList.stream().map(s -> {
return s.getEntrustId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
//
if (CollectionUtils.isEmpty(entrust.getReportStatusList())) {
return page;
}
entrust.setIdsList(ids);
// 历史同样过滤检测单位
entrust.setGroupNameList(userInfoService.getCurGroupNameList());
return page.setRecords(baseMapper.selectVOList(page, entrust));
}
......@@ -1372,14 +1284,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
public boolean isCanIntoNextNode(Entrust entrust) {
// 路径不为空且当前流程状态不为空且存在下一步流程节点
String statusPath = entrust.getStatusPath(), flowStatus = entrust.getFlowStatus();
return org.apache.commons.lang3.StringUtils.isNotBlank(statusPath) && statusPath.contains(flowStatus) && null != EntrustFlowUtils.getNextFlowStatus(flowStatus, statusPath);
if (StringUtils.isNotBlank(statusPath)) {
List<String> flowList = Arrays.asList(statusPath.split("->"));
return flowList.stream().anyMatch(t -> t.equals(flowStatus)) && null != EntrustFlowUtils.getNextFlowStatus(flowStatus, statusPath);
}
return false;
}
@Override
public boolean isCanIntoPrevNode(Entrust entrust) {
// 路径不为空且当前流程状态不为空且存在上一步流程节点
String statusPath = entrust.getStatusPath(), flowStatus = entrust.getFlowStatus();
return org.apache.commons.lang3.StringUtils.isNotBlank(statusPath) && statusPath.contains(flowStatus) && null != EntrustFlowUtils.getPrevFlowStatus(flowStatus, statusPath);
if (StringUtils.isNotBlank(statusPath)) {
List<String> flowList = Arrays.asList(statusPath.split("->"));
return flowList.stream().anyMatch(t -> t.equals(flowStatus)) && null != EntrustFlowUtils.getPrevFlowStatus(flowStatus, statusPath);
}
return false;
}
@Override
public Page<EntrustVO> pageEntrustSampleMake(Page<EntrustVO> page, EntrustVO entrust) {
return page.setRecords(baseMapper.selectVOList(page, entrust));
}
}
......@@ -45,6 +45,12 @@
<if test="null!=vo.entrustCode">
AND e.code LIKE CONCAT('%',#{vo.entrustCode},'%')
</if>
<if test="null != vo.groupNameList">
AND e.test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
</foreach>
</if>
</where>
order by date_part('day', CAST(b.storage_period AS TIMESTAMP) - CAST( now() AS TIMESTAMP)) asc,b.ctime desc
</select>
......@@ -63,7 +69,7 @@
s.code AS "sampleCode" ,
e.client ,
e.code AS "entrustCode",
(case when e.sample_handle_advise = '检测完毕退还' and s.status &gt;20 then 1 else 0 end) "weights"
(case when e.sample_handle_advise = '检测完毕退还' and s.status &gt; 20 then 1 else 0 end) "weights"
FROM
entrust_sample_backup b
JOIN entrust_sample s ON b.sample_id = s.ID
......@@ -92,6 +98,12 @@
<if test="null!=vo.entrustCode">
AND e.code LIKE CONCAT('%',#{vo.entrustCode},'%')
</if>
<if test="null != vo.groupNameList">
AND e.test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
</foreach>
</if>
</where>
order by (case when e.sample_handle_advise = '检测完毕退还' and s.status &gt;20 then 1 else 0 end) desc, b.ctime desc
</select>
......
......@@ -241,6 +241,12 @@
#{id}
</foreach>
</if>
<if test="null != vo.groupNameList">
AND e.test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
</foreach>
</if>
ORDER BY s.code , i.name
</select>
......@@ -340,6 +346,7 @@
<select id="selectByEntrustId" resultType="com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO">
SELECT i.id,i.name,i.entrust_sample_id,s.entrust_id,i.agreed_value,i.test_value,i.standard,s.code AS "sampleCode"
,s.name AS "sampleName", s.sample_shape ,s.sample_quantity, s.standard, s.sample_from,s.product_code,s.name_code,
i.tester_id,i.tester,
(case when COALESCE(ii."END_INDEX",0) = 0 then 0 else 1 end) "endIndex"
FROM
entrust_sample_item i
......@@ -453,7 +460,7 @@
join entrust_sample_item_index ii on ii.entrust_sample_item_id = i.id
join entrust_sample s on s.id = i.entrust_sample_id
join gspi g on g.grading_standard_id = s.product_standard_id and strpos(i.name,g.name) >= 0
where i.deleted = 0 and ii.deleted = 0
where i.deleted = 0 and ii.deleted = 0 AND s.type = 0
<if test="null != vo.entrustId">
and s.entrust_id = #{vo.entrustId}
</if>
......@@ -535,7 +542,7 @@
JOIN entrust_sample_item i ON i.ID = ii.entrust_sample_item_id
JOIN entrust_sample s ON s.ID = i.entrust_sample_id
JOIN entrust e on e.id = s.entrust_id
where ii.deleted = 0 and i.deleted = 0 and s.deleted = 0 and e.deleted = 0
where ii.deleted = 0 and i.deleted = 0 and s.deleted = 0 and e.deleted = 0 AND s.type = 0
<if test="null != vo.client">
and e.client LIKE CONCAT('%',#{vo.client},'%')
</if>
......
......@@ -45,6 +45,10 @@
AND s.code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if test="null != vo.type">
AND s.type = #{vo.type}
</if>
<if test="null != vo.notStatus">
AND s.status != #{vo.notStatus}
</if>
......@@ -138,18 +142,17 @@
group by cr.sample_id
) cr on cr.sample_id = s.id
WHERE
s.deleted = 0
AND e.deleted = 0
<if test="vo.name!=null">
AND s.name LIKE CONCAT('%',#{vo.name},'%')
</if>
<if test="vo.entrustTimeStart!=null">
AND e.entrust_time >= #{vo.entrustTimeStart}
</if>
s.deleted = 0 AND s.type = 0 AND e.deleted = 0
<if test="vo.name!=null">
AND s.name LIKE CONCAT('%',#{vo.name},'%')
</if>
<if test="vo.entrustTimeStart!=null">
AND e.entrust_time >= #{vo.entrustTimeStart}
</if>
<if test="vo.entrustTimeEnd!=null">
AND e.entrust_time <![CDATA[<=]]> #{vo.entrustTimeEnd}
</if>
<if test="vo.entrustTimeEnd!=null">
AND e.entrust_time <![CDATA[<=]]> #{vo.entrustTimeEnd}
</if>
<if test="null!=vo.code">
AND s.code LIKE CONCAT('%',#{vo.code},'%')
......@@ -203,7 +206,7 @@
JOIN electrolyzer e ON s.electrolyzer_id = e.ID
LEFT JOIN ix ix ON ix.entrust_sample_id = s.id
WHERE
s.deleted = 0 and e.deleted = 0 and s.name = '原铝'
s.deleted = 0 and e.deleted = 0 and s.name = '原铝' AND s.type = 0
<if test="null != vo.timeS and null != vo.timeE">
AND EXISTS (
select 1 from entrust_sample_item si where si.deleted = 0 and si.entrust_sample_id = s.id
......@@ -255,7 +258,7 @@
entrust_sample_item_index ii
WHERE
i.ID = ii.entrust_sample_item_id
and ii.name like '%电解质-%'
and ii.name like '%电解质-%'
AND i.deleted = 0
AND ii.deleted = 0
and ii.test_value is not null and is_numeric(ii.test_value)
......@@ -290,7 +293,7 @@
LEFT JOIN ix ix ON ix.entrust_sample_id = s.id
WHERE
s.deleted = 0 and e.deleted = 0
and s.name = '电解质'
and s.name = '电解质' AND s.type = 0
<if test="null != vo.timeS and null != vo.timeE">
AND EXISTS (
select 1 from entrust_sample_item si where si.deleted = 0 and si.entrust_sample_id = s.id
......@@ -339,7 +342,7 @@
WHERE
i.ID = ii.entrust_sample_item_id
AND I.TESTER_ID = u.USER_ID
-- and ii.name like '%磷生铁-%'
and ii.name like '%磷生铁-%'
AND i.deleted = 0
AND ii.deleted = 0
AND ii.test_value is not null and is_numeric(ii.test_value)
......@@ -382,7 +385,7 @@
from entrust_sample s
join pi pi on pi.entrust_sample_id = s.id
where s.deleted = 0
where s.deleted = 0 AND s.type = 0
group by pi.period
</select>
......
......@@ -11,11 +11,12 @@
FROM
entrust_sample s,
(
SELECT COUNT (1) "total" FROM entrust_sample s WHERE s.deleted = 0 AND s.sample_grading IS NOT NULL
SELECT COUNT (1) "total" FROM entrust_sample s WHERE s.deleted = 0
AND s.type = 0 AND s.sample_grading IS NOT NULL
AND to_char(s.judge_time, 'yyyy-MM-dd') = to_char( now(), 'yyyy-MM-dd')
) A
WHERE
s.deleted = 0
s.deleted = 0 AND s.type = 0
AND s.sample_grading IS NOT NULL AND to_char( s.judge_time, 'yyyy-MM-dd' ) = to_char(now(), 'yyyy-MM-dd')
GROUP BY
A.total,
......@@ -27,13 +28,13 @@
<!--外委完成量统计-->
<select id="selectOutTestFinishQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
SELECT
count(1) "total",
count(distinct c.id) "total",
sum(case when s.status = 70 and s.judge_status = 2 then 1 else 0 end) "done_num"
FROM
contract_sample c, entrust_sample s
WHERE
c.deleted = 0 and s.deleted = 0 and c.id = s.contract_sample_id
and c.type = 1
and c.type = 1 AND s.type = 0
</select>
<!--本周自产炭块质量统计-->
......@@ -50,14 +51,14 @@
FROM
entrust_sample s
WHERE
s.deleted = 0
s.deleted = 0 AND s.type = 0
AND s.sample_grading IS NOT NULL
AND s.NAME = '自产阳极炭块'
AND EXTRACT ( YEAR FROM s.judge_time ) = EXTRACT ( YEAR FROM NOW() )
AND EXTRACT ( WEEK FROM s.judge_time ) = EXTRACT ( WEEK FROM NOW() )
) A
WHERE
s.deleted = 0
s.deleted = 0 AND s.type = 0
AND s.sample_grading IS NOT NULL
AND s.NAME = '自产阳极炭块'
AND EXTRACT ( YEAR FROM s.judge_time ) = EXTRACT ( YEAR FROM NOW() )
......@@ -78,7 +79,7 @@
FROM
entrust_sample s
WHERE
s.deleted = 0
s.deleted = 0 AND s.type = 0
AND s.sample_grading IS NOT NULL
AND s.status = 70 AND s.judge_status = 2
AND EXTRACT ( YEAR FROM s.judge_time ) = EXTRACT ( YEAR FROM NOW() )
......@@ -107,7 +108,7 @@
join entrust_report r on r.entrust_id = e.id
WHERE
s.deleted = 0 and e.deleted = 0 and r.deleted = 0
AND s.status = 70 AND s.judge_status = 2
AND s.status = 70 AND s.judge_status = 2 AND s.type = 0
AND s.judge_time between #{vo.timeS} and #{vo.timeE}
) a , (SELECT
count(r.id) "total"
......@@ -117,7 +118,7 @@
join entrust_report r on r.entrust_id = e.id
WHERE
s.deleted = 0 and e.deleted = 0 and r.deleted = 0
AND s.status = 70 AND s.judge_status = 2
AND s.status = 70 AND s.judge_status = 2 AND s.type = 0
AND s.judge_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT
......@@ -128,7 +129,7 @@
join entrust_report r on r.entrust_id = e.id
WHERE
s.deleted = 0 and e.deleted = 0 and r.deleted = 0
AND s.status = 70 AND s.judge_status = 2
AND s.status = 70 AND s.judge_status = 2 AND s.type = 0
AND s.judge_time between #{vo.prevTimeS} and #{vo.prevTimeE}
) c
......@@ -144,7 +145,8 @@
join entrust_sample s on s.id = i.entrust_sample_id
join contract_sample c on c.id = s.contract_sample_id
WHERE
i.deleted = 0 and s.deleted = 0 and c.deleted = 0 and c.type = 1
i.deleted = 0 and s.deleted = 0 and c.deleted = 0
and c.type = 1 AND s.type = 0
<if test="null != vo.timeS and null != vo.timeE">
AND i.ctime between #{vo.timeS} and #{vo.timeE}
</if>
......@@ -166,7 +168,7 @@
entrust_sample s
join entrust e on e.id = s.entrust_id
WHERE
s.deleted = 0 and e.deleted = 0
s.deleted = 0 and e.deleted = 0 AND s.type = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE}
) a ,
(SELECT
......@@ -174,8 +176,8 @@
FROM
entrust_sample s
join entrust e on e.id = s.entrust_id
WHERE s.deleted = 0 and e.deleted = 0
AND s.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
WHERE s.deleted = 0 and e.deleted = 0 AND s.type = 0
AND s.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT
count(s.id) "total"
......@@ -183,7 +185,7 @@
entrust_sample s
join entrust e on e.id = s.entrust_id
WHERE
s.deleted = 0 and e.deleted = 0
s.deleted = 0 and e.deleted = 0 AND s.type = 0
AND s.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE}
) c
</select>
......@@ -197,7 +199,7 @@
entrust_sample_item i
join entrust_sample s on s.id = i.entrust_sample_id
WHERE
i.deleted = 0 and s.deleted = 0
i.deleted = 0 and s.deleted = 0 AND s.type = 0
<if test="null != vo.timeS and null != vo.timeE">
AND i.ctime between #{vo.timeS} and #{vo.timeE}
</if>
......@@ -216,7 +218,7 @@
entrust e
join entrust_report r on r.entrust_id = e.id
WHERE
e.deleted = 0 and r.deleted = 0 and r.status = 50
e.deleted = 0 and r.deleted = 0 AND s.type = 0 and r.status = 50
<if test="null != vo.timeS and null != vo.timeE">
AND r.report_check_time between #{vo.timeS} and #{vo.timeE}
</if>
......@@ -270,8 +272,7 @@
ENTRUST E
JOIN ENTRUST_SAMPLE S ON S.entrust_id = E.ID
WHERE
E.deleted = 0
AND S.deleted = 0
E.deleted = 0 AND S.deleted = 0 AND s.type = 0
AND S.NAME IN ( '电解质', '硅铁', '磷铁', '锰铁', '水', '纯铝', '铝合金', '石灰石' )
GROUP BY
s.NAME ORDER BY S.NAME
......
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