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,7 +462,8 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
sampleStatusEnum = EntrustSampleStatusEnum.REPORT_SEND;
}
if (null != sampleStatusEnum) {
entrust.setFlowStatus(sampleStatusEnum.getName());
entrustService.updateById(entrust);
entrustSample.setStatus(sampleStatusEnum);
entrustSample.setProgress(sampleStatusEnum);
entrustSampleService.update(entrustSample, Condition.create().eq("entrust_id", entrust.getId()));
......@@ -470,7 +472,6 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
entrustRecordService.record(new Long[]{entrust.getId()}, entrustReport.getStatus().getDisplay(), sampleStatusEnum.getDisplay(), 2, account, reason);
}
}
}
@Override
public boolean backReportIssue(Long[] ids, String reason, Account account) {
......
......@@ -117,6 +117,9 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
@Autowired
private Executor executor1;
@Autowired
private UserInfoServiceImpl userInfoService;
@Value("${libreOffice.url}")
private String libreOfficeUrl;
@Autowired
......@@ -216,6 +219,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
if (entrustService.isCanIntoNextNode(entrust)) {
entrustService.submitToNextNode(entrust, account);
} else {
entrust.setFlowStatus(EntrustFlowEnum.TEST.getName());
entrustService.updateById(entrust);
entrustRecordService.record(new Long[]{entrust.getId()}, "任务分配", "数据录入", 0, account, "提交至数据录入");
}
}
......@@ -299,7 +304,15 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
// RestAssert.fail(itemList.stream().filter(t -> (null == t.getEndIndex() || 0 == t.getEndIndex().intValue())).count() > 0, "存在没有完成检测的检测项目");
// 若存在检测项目没有完成的,不可提交
for (EntrustSampleItemVO item : itemList) {
RestAssert.fail(null == item.getEndIndex() || 0 == item.getEndIndex(), "检测项目名称:" + item.getName() + "未填写检测值,请确认!");
long testerId = null == item.getTesterId() ? 0l : item.getTesterId().longValue();
boolean noSubmit = null == item.getEndIndex() || 0 == item.getEndIndex();
if (noSubmit) {
String message = String.format("检测项目【%s】未填写检测值!", item.getName());
if (testerId != account.getUserId().longValue()) {
message = "其他用户的" + message;
}
RestAssert.fail(message);
}
}
EntrustSampleItem item = new EntrustSampleItem();
......@@ -319,8 +332,6 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
entrustService.submitToNextNode(entrust, account);
return true;
}
// 样品操作日志
// 暂时不提供
// 修改委托信息
entrust.setLid(account.getUserId()).setLtime(new Date()).setFlowStatus(EntrustFlowEnum.REPORT_MAKE.getName()).setProgress(EntrustStatusEnum.TEST).setStatus(EntrustStatusEnum.TEST);
entrustService.updateById(entrust);
......@@ -770,6 +781,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
@Override
public Page<EntrustSampleItemVO> pageItemDeviateCheck(Page<EntrustSampleItemVO> page, EntrustSampleItemVO entrustSampleItem) {
entrustSampleItem.setGroupNameList(userInfoService.getCurGroupNameList());
return page.setRecords(baseMapper.selectByItemDeviate(page, entrustSampleItem));
}
......@@ -843,11 +855,9 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return page;
}
List<Long> ids = list.stream().map(s -> {
return s.getItemId();
}).collect(Collectors.toList());
List<Long> ids = list.stream().map(ItemDeviate::getItemId).collect(Collectors.toList());
entrustSampleItem.setIds(ids);
entrustSampleItem.setGroupNameList(userInfoService.getCurGroupNameList());
return page.setRecords(baseMapper.selectByItemDeviate(page, entrustSampleItem));
}
......@@ -911,7 +921,14 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
RestAssert.fail(CollectionUtils.isEmpty(sampleItemList), "样品检测项目及内容不能为空");
// 计算合计值
// 获得产品标准信息 -- 实时最新不是根据样品中的是否组合判定进行判定
// 可能需要根据样品中的字段进行判断是否需要组合判定composeJudge
GradingStandard standard = gradingStandardService.getById(sampleVO.getProductStandardId());
RestAssert.fail(null == standard, "产品标准不能为空");
// 是否组合判定
boolean isComposeJudgment = null != standard.getComposeJudge() && 1 == standard.getComposeJudge().intValue();
// 计算合计-组合判定合计值
double totalValue = sampleItemList.stream().filter(t -> StringUtils.isNotBlank(t.getTestValue())).map(t -> {
// 符合此条件,需要判断是否此标准且为稀有元素且值小于0.01即可忽略为0
String testValue = t.getTestValue().trim();
......@@ -924,12 +941,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
// 获取检测项目值对象
Map<String, Double> itemDataMap = sampleItemList.stream().collect(Collectors.toMap(EntrustSampleItemVO::getName, t -> Double.parseDouble(t.getTestValue())));
// 获得产品标准信息 -- 实时最新不是根据样品中的是否组合判定进行判定
// 可能需要根据样品中的字段进行判断是否需要组合判定composeJudge
GradingStandard standard = gradingStandardService.getById(sampleVO.getProductStandardId());
RestAssert.fail(null == standard, "产品标准不能为空");
// 是否组合判定
boolean isComposeJudgment = null != standard.getComposeJudge() && 1 == standard.getComposeJudge().intValue();
// 获得产品等级信息
List<GradingProduct> gradingProductList = gradingProductService.list(Condition.create()
.eq("grading_standard_id", standard.getId()).eq("deleted", 0)
......@@ -940,29 +952,14 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
// 循环产品标准依次判定级别
for (int i = 0; i < gradingProductList.size(); i++) {
// 最后一个判定级别
boolean isLastGrading = i == gradingProductList.size() - 1;
// ==
GradingProduct product = gradingProductList.get(i);
RestAssert.fail(null == product.getSumValue(), "产品标准合计值不能为空");
RestAssert.fail(StringUtils.isBlank(product.getSumCompare()), "产品标准比较符不能为空");
// 根据比较符类型比较大小
if (!CompareUtils.Comparator.get(product.getSumCompare()).calc(totalValue, product.getSumValue().doubleValue())) {
if (i < gradingProductList.size() - 1) {
continue;
}
updateJudgeNoPass(sample, account, updateSampleList);
break;
}
// 符合合计,若不为组合判定,则直接判定合格
if (!isComposeJudgment) {
// continue;
// 样品判定合格
updateSampleList.add(sample.setOkJudge("合格").setJudger(account.getUserName()).setJudgerId(account.getUserId())
.setJudgeCheckTime(new Date()).setJudgeStatus(0).setJudgeProgress(0)
.setSampleGrading(product.getProductGrade()));
break;
}
// 若为组合判定,比较单个大小是否都符合
// 比较单个大小是否都符合
List<GradingItem> gradingItemList = gradingItemService.list(Condition.create()
.eq("grading_product_id", product.getId()).eq("compose_judge", 1)
.eq("deleted", 0));
......@@ -984,8 +981,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}).collect(Collectors.toList());
RestAssert.fail(CollectionUtils.isEmpty(gradingItems), "样品下设定组合判定的检测项目不存在");
// 获取失败数量
long failCount = gradingItems.stream().filter(t -> {
// 若失败,则进入下一判级
if (gradingItems.stream().anyMatch(t -> {
// 获取填写检测值
double testValue = itemDataMap.get(t.getName());
// 若不包含正常的比较符,那么则为区间比较符
......@@ -1005,18 +1002,28 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return !CompareUtils.Comparator.get(t.getDecisionSymbol()).calc(testValue, Double.parseDouble(t.getLimitValue()));
}
}
).count();
// 若存在不符合判定要求,则进入下一标准判定
if (failCount > 0) {
// 存在下一个标准等级判定,继续判定
if (i >= gradingProductList.size() - 1) {
)) {
// 若为最后一个级别,那么判定结果
if (isLastGrading) {
updateJudgeNoPass(sample, account, updateSampleList);
break;
}
// 否则,继续下一判定级别
continue;
}
// 继续判定是否为组合判定,若为组合判定,那么需要判定组合结果是否符合限定值
if (isComposeJudgment) {
// 根据比较符类型比较大小
if (!CompareUtils.Comparator.get(product.getSumCompare()).calc(totalValue, product.getSumValue().doubleValue())) {
if (!isLastGrading) {
continue;
}
updateJudgeNoPass(sample, account, updateSampleList);
break;
}
}
// 样品判定合格
updateSampleList.add(sample.setOkJudge("合格").setJudger(account.getUserName()).setJudgerId(account.getUserId())
.setJudgeCheckTime(new Date()).setJudgeStatus(0).setJudgeProgress(0)
......
......@@ -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));
}
}
......@@ -2,37 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.patzn.cloud.service.lims.hmhj.mapper.EntrustMapper">
<select id="listByContractId" resultType="com.patzn.cloud.service.hmhj.dto.EntrustSampleDTO">
SELECT * FROM entrust_sample WHERE deleted = 0 AND entrust_id =#{entrustId} ORDER BY code DESC
</select>
<sql id="basicCondition">
<select id="selectEntrustSampleReceive" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
SELECT * FROM entrust WHERE deleted = 0
<if test="null!=vo.idsList">
AND id IN
<foreach collection="vo.idsList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="null!=vo.groupNameList">
AND test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
</foreach>
</if>
order by entrust_time desc
</select>
<select id="selectVOList" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
SELECT e.* FROM entrust e WHERE e.deleted = 0
<if test="null!=vo.idsList">
AND e.id IN
<foreach collection="vo.idsList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="null!=vo.client">
AND e.client LIKE CONCAT('%',#{vo.client},'%')
</if>
......@@ -42,24 +13,106 @@
<if test="null!=vo.testSide">
AND e.test_side LIKE CONCAT('%',#{vo.testSide},'%')
</if>
<if test="null!=vo.status">
AND e.status = #{vo.status}
</if>
<if test="null!=vo.flowStatus">
AND e.flow_status = #{vo.flowStatus}
</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>
<if test="null!=vo.statusList">
AND e.status IN
<foreach collection="vo.statusList" index="index" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="null != vo.idsList">
AND e.id IN
<foreach collection="vo.idsList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</sql>
<select id="listByContractId" resultType="com.patzn.cloud.service.hmhj.dto.EntrustSampleDTO">
SELECT *
FROM entrust_sample
WHERE deleted = 0
AND entrust_id = #{entrustId}
ORDER BY code DESC
</select>
<select id="selectEntrustSampleReceive" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
SELECT e.* FROM entrust e WHERE e.deleted = 0
<include refid="basicCondition"/>
<if test="null != vo.prepareStatus">
and exists (
select 1 from entrust_sample s
join entrust_sample_prepare p on p.entrust_sample_id = s.id
where s.deleted = 0 and p.deleted = 0 and p.entrust_sample_id is not null
and s.entrust_id = e.id and p.status = #{vo.prepareStatus}
)
</if>
<if test="null != vo.prepareNotStatus">
and exists (
select 1 from entrust_sample s
join entrust_sample_prepare p on p.entrust_sample_id = s.id
where s.deleted = 0 and p.deleted = 0 and p.entrust_sample_id is not null
and s.entrust_id = e.id and p.status != #{vo.prepareNotStatus}
)
</if>
order by e.entrust_time desc
</select>
<select id="selectVOList" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
SELECT e.* FROM entrust e WHERE e.deleted = 0
<include refid="basicCondition"/>
<if test="null != vo.sampleStatus">
AND exists (
select 1 from entrust_sample s where s.deleted = 0
and s.entrust_id = e.id and s.status = #{vo.sampleStatus}
)
</if>
<if test="null != vo.notSampleStatus">
AND exists (
select 1 from entrust_sample s where s.deleted = 0
and s.entrust_id = e.id and s.status != #{vo.notSampleStatus}
)
</if>
<if test="null != vo.itemStatus">
AND exists (
select 1 from entrust_sample_item i join entrust_sample s on i.entrust_sample_id = s.id
where s.deleted = 0 and i.deleted = 0 and s.entrust_id = e.id and i.status = #{vo.itemStatus}
)
</if>
<if test="null!=vo.groupNameList">
AND e.test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
<if test="null != vo.reportStatus">
AND exists (
select 1 from entrust_report r where r.deleted = 0 and r.entrust_id = e.id
and r.status = #{vo.reportStatus}
)
</if>
<if test="null != vo.reportStatusList">
AND exists (
select 1 from entrust_report r where r.deleted = 0 and r.entrust_id = e.id
and r.status IN
<foreach collection="vo.reportStatusList" index="index" item="reportStatus" open="(" separator=","
close=")">
#{reportStatus}
</foreach>
)
</if>
<if test="null != vo.uid">
AND e.uid = #{vo.uid}
</if>
......@@ -69,6 +122,7 @@
<!--查询委托历史数据-->
<select id="selectEntrustVOHisList" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
SELECT * FROM entrust e WHERE e.deleted = 0
<include refid="basicCondition"/>
<if test="null != vo.itemStatusEnumList">
AND exists (
select 1 from entrust_sample s,entrust_sample_item i where s.deleted = 0 and i.deleted = 0
......@@ -79,29 +133,7 @@
</foreach>
)
</if>
<if test="null!=vo.client">
AND e.client LIKE CONCAT('%',#{vo.client},'%')
</if>
<if test="null!=vo.code">
AND e.code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if test="null!=vo.testSide">
AND e.test_side LIKE CONCAT('%',#{vo.testSide},'%')
</if>
<if test="null!=vo.statusList">
AND e.status IN
<foreach collection="vo.statusList" index="index" item="status" open="(" separator="," close=")">
#{status}
</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 entrust_time desc
order by e.entrust_time desc
</select>
<select id="selectVOListByItem" resultType="com.patzn.cloud.service.hmhj.vo.EntrustVO">
......@@ -109,6 +141,8 @@
entrust e,entrust_sample s,entrust_sample_item i
WHERE e.deleted = 0 and s.deleted = 0 and i.deleted = 0
and s.entrust_id = e.id and i.entrust_sample_id = s.id
<include refid="basicCondition"/>
<if test="null!=vo.itemStatus">
and i.status = #{vo.itemStatus}
</if>
......@@ -118,21 +152,6 @@
#{status}
</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>
<if test="null!=vo.client">
AND e.client LIKE CONCAT('%',#{vo.client},'%')
</if>
<if test="null!=vo.code">
AND e.code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if test="null!=vo.testSide">
AND e.test_side LIKE CONCAT('%',#{vo.testSide},'%')
</if>
<if test="null!=vo.testerId">
AND i.tester_id = #{vo.testerId}
</if>
......@@ -148,42 +167,15 @@
where s.deleted = 0 group by s.entrust_id, s.name
) s on s.entrust_id = e.id
WHERE deleted = 0
<if test="null!=vo.idsList">
AND id IN
<foreach collection="vo.idsList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="null!=vo.client">
AND client LIKE CONCAT('%',#{vo.client},'%')
</if>
<if test="null!=vo.code">
AND code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if test="null!=vo.testSide">
AND test_side LIKE CONCAT('%',#{vo.testSide},'%')
</if>
<include refid="basicCondition"/>
<if test="null != vo.entrustTimeS and null != vo.entrustTimeE">
AND to_char(entrust_time, 'YYYY-MM-dd HH24:MI:SS') BETWEEN #{vo.entrustTimeS} AND #{vo.entrustTimeE}
</if>
<if test="null!=vo.statusList">
AND status IN
<foreach collection="vo.statusList" index="index" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="null!=vo.groupNameList">
AND test_side IN
<foreach collection="vo.groupNameList" index="index" item="groupName" open="(" separator="," close=")">
#{groupName}
</foreach>
</if>
order by entrust_time desc
order by e.entrust_time desc
</select>
</mapper>
......@@ -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,8 +142,7 @@
group by cr.sample_id
) cr on cr.sample_id = s.id
WHERE
s.deleted = 0
AND e.deleted = 0
s.deleted = 0 AND s.type = 0 AND e.deleted = 0
<if test="vo.name!=null">
AND s.name LIKE CONCAT('%',#{vo.name},'%')
</if>
......@@ -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
......@@ -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,7 +176,7 @@
FROM
entrust_sample s
join entrust e on e.id = s.entrust_id
WHERE s.deleted = 0 and e.deleted = 0
WHERE s.deleted = 0 and e.deleted = 0 AND s.type = 0
AND s.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT
......@@ -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