8 changed files with 1107 additions and 0 deletions
-
1src/main/java/com/spring/common/utils/Constant.java
-
237src/main/java/com/spring/modules/lab/controller/LabController.java
-
248src/main/java/com/spring/modules/lab/entity/LabEntity.java
-
24src/main/java/com/spring/modules/lab/mapper/LabMapper.java
-
47src/main/java/com/spring/modules/lab/service/LabService.java
-
411src/main/java/com/spring/modules/lab/service/impl/LabServiceImpl.java
-
29src/main/java/com/spring/modules/lab/vo/LabSubmitVo.java
-
110src/main/resources/mapper/lab/LabMapper.xml
@ -0,0 +1,237 @@ |
|||||
|
package com.spring.modules.lab.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.common.utils.R; |
||||
|
import com.spring.modules.base.service.TransNoControlService; |
||||
|
import com.spring.modules.change.vo.ProcessFormVo; |
||||
|
import com.spring.modules.lab.entity.LabEntity; |
||||
|
import com.spring.modules.lab.service.LabService; |
||||
|
import com.spring.modules.lab.vo.LabSubmitVo; |
||||
|
import com.spring.modules.oss.entity.SysOssEntity; |
||||
|
import com.spring.modules.oss.service.SysOssService; |
||||
|
import com.spring.modules.sys.entity.SysUserEntity; |
||||
|
import org.apache.commons.lang.StringUtils; |
||||
|
import org.apache.shiro.SecurityUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Lab Controller |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/lab") |
||||
|
public class LabController { |
||||
|
|
||||
|
private static final String REFERENCE_NO_TRANS_TYPE = "reference_no"; |
||||
|
|
||||
|
@Autowired |
||||
|
private LabService labService; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysOssService sysOssService; |
||||
|
|
||||
|
@Autowired |
||||
|
private TransNoControlService transNoControlService; |
||||
|
|
||||
|
/** |
||||
|
* 列表查询 |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R list(@RequestParam Map<String, Object> params) { |
||||
|
PageUtils page = labService.queryPage(params); |
||||
|
return R.ok().put("page", page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 详情查询 |
||||
|
*/ |
||||
|
@GetMapping("/info") |
||||
|
public R info(@RequestParam("site") String site, @RequestParam("referenceNo") String referenceNo) { |
||||
|
if (StringUtils.isBlank(site) || StringUtils.isBlank(referenceNo)) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
LabEntity lab = labService.getDetail(site, referenceNo); |
||||
|
return R.ok().put("data", lab); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 保存 |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@Transactional |
||||
|
public R save(@RequestBody LabEntity lab) { |
||||
|
if (StringUtils.isBlank(lab.getSite()) || StringUtils.isBlank(lab.getReferenceNo())) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
String currentUserName = getCurrentUserName(); |
||||
|
|
||||
|
String originalReferenceNo = lab.getReferenceNo(); |
||||
|
String newReferenceNo = originalReferenceNo; |
||||
|
|
||||
|
if (originalReferenceNo.startsWith("TEMP-")) { |
||||
|
newReferenceNo = transNoControlService.transNo(lab.getSite(), REFERENCE_NO_TRANS_TYPE); |
||||
|
if (StringUtils.isBlank(newReferenceNo)) { |
||||
|
return R.error("请维护编码生成规则(TransNoControl)!"); |
||||
|
} |
||||
|
lab.setReferenceNo(newReferenceNo); |
||||
|
|
||||
|
SysOssEntity updateOss = new SysOssEntity(); |
||||
|
updateOss.setOrderRef1(lab.getSite()); |
||||
|
updateOss.setOrderRef2(newReferenceNo); |
||||
|
|
||||
|
QueryWrapper<SysOssEntity> ossWrapper = new QueryWrapper<>(); |
||||
|
ossWrapper.eq("order_ref1", lab.getSite()); |
||||
|
ossWrapper.eq("order_ref2", originalReferenceNo); |
||||
|
sysOssService.update(updateOss, ossWrapper); |
||||
|
} else { |
||||
|
LabEntity exist = labService.getDetail(lab.getSite(), lab.getReferenceNo()); |
||||
|
if (exist != null) { |
||||
|
return R.error("该序列号(referenceNo)的申请记录已存在"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (lab.getApplicationDate() == null) { |
||||
|
lab.setApplicationDate(new Date()); |
||||
|
} |
||||
|
if (StringUtils.isBlank(lab.getStatus())) { |
||||
|
lab.setStatus("草稿"); |
||||
|
} |
||||
|
if (lab.getCreateDate() == null) { |
||||
|
lab.setCreateDate(new Date()); |
||||
|
} |
||||
|
if (StringUtils.isBlank(lab.getCreateBy())) { |
||||
|
lab.setCreateBy(currentUserName); |
||||
|
} |
||||
|
if (lab.getStepId() == null) { |
||||
|
lab.setStepId(10); |
||||
|
} |
||||
|
if (StringUtils.isBlank(lab.getRejectFlag())) { |
||||
|
lab.setRejectFlag("N"); |
||||
|
} |
||||
|
labService.save(lab); |
||||
|
return R.ok().put("referenceNo", newReferenceNo); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
*/ |
||||
|
@PostMapping("/update") |
||||
|
public R update(@RequestBody LabEntity lab) { |
||||
|
if (StringUtils.isBlank(lab.getSite()) || StringUtils.isBlank(lab.getReferenceNo())) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
String currentUserName = getCurrentUserName(); |
||||
|
LabEntity exists = labService.getDetail(lab.getSite(), lab.getReferenceNo()); |
||||
|
if (exists == null) { |
||||
|
return R.error("未找到对应Lab单据"); |
||||
|
} |
||||
|
if ("已完成".equals(exists.getStatus())) { |
||||
|
return R.error("已完成状态的单据不允许修改"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(lab.getStatus())) { |
||||
|
lab.setStatus(exists.getStatus()); |
||||
|
} |
||||
|
lab.setUpdateDate(new Date()); |
||||
|
if (StringUtils.isBlank(lab.getUpdateBy())) { |
||||
|
lab.setUpdateBy(currentUserName); |
||||
|
} |
||||
|
|
||||
|
QueryWrapper<LabEntity> updateWrapper = new QueryWrapper<>(); |
||||
|
updateWrapper.eq("site", lab.getSite()).eq("reference_no", lab.getReferenceNo()); |
||||
|
labService.update(lab, updateWrapper); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 下达 |
||||
|
*/ |
||||
|
@PostMapping("/issue") |
||||
|
public R issue(@RequestBody LabSubmitVo data) { |
||||
|
if (StringUtils.isBlank(data.getSite()) || StringUtils.isBlank(data.getReferenceNo()) || StringUtils.isBlank(data.getMenuId())) { |
||||
|
return R.error("工厂(site)、序列号(referenceNo)和菜单ID(menuId)不能为空"); |
||||
|
} |
||||
|
try { |
||||
|
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
||||
|
String userName = user == null ? null : user.getUsername(); |
||||
|
labService.issue(data.getSite(), data.getReferenceNo(), userName, data.getMenuId()); |
||||
|
} catch (RuntimeException e) { |
||||
|
return R.error(e.getMessage()); |
||||
|
} |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 审批提交(同意/驳回) |
||||
|
*/ |
||||
|
@PostMapping("/submit") |
||||
|
public R submit(@RequestBody LabSubmitVo data) { |
||||
|
if (StringUtils.isBlank(data.getSite()) || StringUtils.isBlank(data.getReferenceNo())) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
try { |
||||
|
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
||||
|
String userName = user == null ? null : user.getUsername(); |
||||
|
labService.submit(data, userName); |
||||
|
} catch (RuntimeException e) { |
||||
|
return R.error(e.getMessage()); |
||||
|
} |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询审批信息 |
||||
|
*/ |
||||
|
@PostMapping("/approvalList") |
||||
|
public R approvalList(@RequestBody LabSubmitVo data) { |
||||
|
if (StringUtils.isBlank(data.getSite()) || StringUtils.isBlank(data.getMenuId()) || StringUtils.isBlank(data.getDocumentNo())) { |
||||
|
return R.ok().put("rows", Collections.emptyList()); |
||||
|
} |
||||
|
List<ProcessFormVo> list = labService.getApprovalList(data.getSite(), data.getMenuId(), data.getDocumentNo()); |
||||
|
return R.ok().put("rows", list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询按钮控制信息 |
||||
|
*/ |
||||
|
@PostMapping("/buttonCondition") |
||||
|
public R buttonCondition(@RequestBody LabSubmitVo data) { |
||||
|
if (StringUtils.isBlank(data.getSite()) || StringUtils.isBlank(data.getReferenceNo())) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
return R.ok().put("data", labService.getButtonCondition(data.getSite(), data.getReferenceNo())); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
*/ |
||||
|
@PostMapping("/delete") |
||||
|
@Transactional |
||||
|
public R delete(@RequestBody LabEntity lab) { |
||||
|
if (StringUtils.isBlank(lab.getSite()) || StringUtils.isBlank(lab.getReferenceNo())) { |
||||
|
return R.error("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
|
||||
|
QueryWrapper<LabEntity> deleteWrapper = new QueryWrapper<>(); |
||||
|
deleteWrapper.eq("site", lab.getSite()).eq("reference_no", lab.getReferenceNo()); |
||||
|
labService.remove(deleteWrapper); |
||||
|
|
||||
|
QueryWrapper<SysOssEntity> ossWrapper = new QueryWrapper<>(); |
||||
|
ossWrapper.eq("order_ref1", lab.getSite()); |
||||
|
ossWrapper.eq("order_ref2", lab.getReferenceNo()); |
||||
|
sysOssService.remove(ossWrapper); |
||||
|
|
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
private String getCurrentUserName() { |
||||
|
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
||||
|
return user == null ? "" : user.getUsername(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,248 @@ |
|||||
|
package com.spring.modules.lab.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Lab 实验室申请实体类 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("plm_lab") |
||||
|
public class LabEntity implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 工厂 |
||||
|
*/ |
||||
|
private String site; |
||||
|
|
||||
|
/** |
||||
|
* 序列号 |
||||
|
*/ |
||||
|
private String referenceNo; |
||||
|
|
||||
|
/** |
||||
|
* 申请人 |
||||
|
*/ |
||||
|
private String applicant; |
||||
|
|
||||
|
/** |
||||
|
* 申请日期 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date applicationDate; |
||||
|
|
||||
|
/** |
||||
|
* 申请部门 |
||||
|
*/ |
||||
|
private String applyDepartment; |
||||
|
|
||||
|
/** |
||||
|
* 需求日期 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date requestedDate; |
||||
|
|
||||
|
/** |
||||
|
* 项目编码 |
||||
|
*/ |
||||
|
private String projectId; |
||||
|
|
||||
|
/** |
||||
|
* 客户编码 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 样品名称 |
||||
|
*/ |
||||
|
private String sampleName; |
||||
|
|
||||
|
/** |
||||
|
* 样品型号 |
||||
|
*/ |
||||
|
private String sampleModel; |
||||
|
|
||||
|
/** |
||||
|
* 样品数量 |
||||
|
*/ |
||||
|
private String sampleQty; |
||||
|
|
||||
|
/** |
||||
|
* 测试目的 |
||||
|
*/ |
||||
|
private String testPurpose; |
||||
|
|
||||
|
/** |
||||
|
* 产品阶段 |
||||
|
*/ |
||||
|
private String productStage; |
||||
|
|
||||
|
/** |
||||
|
* 测试类型 |
||||
|
*/ |
||||
|
private String testType; |
||||
|
|
||||
|
/** |
||||
|
* 报告出具 |
||||
|
*/ |
||||
|
private String reportDocument; |
||||
|
|
||||
|
/** |
||||
|
* 样品退回 |
||||
|
*/ |
||||
|
private String returnSample; |
||||
|
|
||||
|
/** |
||||
|
* 应用表面 |
||||
|
*/ |
||||
|
private String applicationSurface; |
||||
|
|
||||
|
/** |
||||
|
* 测试实验室 |
||||
|
*/ |
||||
|
private String testLab; |
||||
|
|
||||
|
/** |
||||
|
* 注意事项 |
||||
|
*/ |
||||
|
private String attention; |
||||
|
|
||||
|
/** |
||||
|
* 测试开始时间 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date testStartDate; |
||||
|
|
||||
|
/** |
||||
|
* 测试完成日期 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date completedDate; |
||||
|
|
||||
|
/** |
||||
|
* 异常情况及说明 |
||||
|
*/ |
||||
|
private String unnormalSymptomAndDescription; |
||||
|
|
||||
|
/** |
||||
|
* 测试编码 |
||||
|
*/ |
||||
|
private String testNumber; |
||||
|
|
||||
|
/** |
||||
|
* 备注(测试员) |
||||
|
*/ |
||||
|
private String testerComments; |
||||
|
|
||||
|
/** |
||||
|
* 备注(部门经理) |
||||
|
*/ |
||||
|
private String departmentManagerComments; |
||||
|
|
||||
|
/** |
||||
|
* 备注(实验室) |
||||
|
*/ |
||||
|
private String labComments; |
||||
|
|
||||
|
/** |
||||
|
* 测试人(;分隔) |
||||
|
*/ |
||||
|
private String tester; |
||||
|
|
||||
|
/** |
||||
|
* 单据状态(草稿/审批中/已完成) |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createDate; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createBy; |
||||
|
|
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date updateDate; |
||||
|
|
||||
|
/** |
||||
|
* 修改人 |
||||
|
*/ |
||||
|
private String updateBy; |
||||
|
|
||||
|
/** |
||||
|
* 流程步骤 |
||||
|
*/ |
||||
|
private Integer stepId; |
||||
|
|
||||
|
/** |
||||
|
* 驳回标识 |
||||
|
*/ |
||||
|
private String rejectFlag; |
||||
|
|
||||
|
/** |
||||
|
* 驳回步骤 |
||||
|
*/ |
||||
|
private Integer rejectStepId; |
||||
|
|
||||
|
/** |
||||
|
* 当前节点 ID |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String nodeId; |
||||
|
|
||||
|
/** |
||||
|
* 当前节点名称 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String nodeName; |
||||
|
|
||||
|
/** |
||||
|
* 当前节点审批人 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String currentApprover; |
||||
|
|
||||
|
/** |
||||
|
* 申请人名称 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String applicantName; |
||||
|
|
||||
|
/** |
||||
|
* 客户名称 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String customerName; |
||||
|
|
||||
|
/** |
||||
|
* 项目名称 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String projectName; |
||||
|
|
||||
|
/** |
||||
|
* 测试人名称 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private String testerName; |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.spring.modules.lab.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.spring.modules.change.vo.ProcessFormVo; |
||||
|
import com.spring.modules.lab.entity.LabEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Lab Mapper |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface LabMapper extends BaseMapper<LabEntity> { |
||||
|
|
||||
|
List<ProcessFormVo> getApprovalList(@Param("site") String site, @Param("menuId") String menuId, @Param("documentNo") String documentNo); |
||||
|
|
||||
|
IPage<LabEntity> queryPageWithNames(IPage<?> page, @Param("params") Map<String, Object> params); |
||||
|
|
||||
|
LabEntity getDetailWithNames(@Param("site") String site, @Param("referenceNo") String referenceNo); |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package com.spring.modules.lab.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.modules.change.vo.ProcessFormVo; |
||||
|
import com.spring.modules.lab.entity.LabEntity; |
||||
|
import com.spring.modules.lab.vo.LabSubmitVo; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Lab Service |
||||
|
*/ |
||||
|
public interface LabService extends IService<LabEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
*/ |
||||
|
PageUtils queryPage(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 详情查询 |
||||
|
*/ |
||||
|
LabEntity getDetail(String site, String referenceNo); |
||||
|
|
||||
|
/** |
||||
|
* 下达 |
||||
|
*/ |
||||
|
void issue(String site, String referenceNo, String userName, String menuId); |
||||
|
|
||||
|
/** |
||||
|
* 提交审批结论 |
||||
|
*/ |
||||
|
void submit(LabSubmitVo data, String userName); |
||||
|
|
||||
|
/** |
||||
|
* 查询审批记录 |
||||
|
*/ |
||||
|
List<ProcessFormVo> getApprovalList(String site, String menuId, String documentNo); |
||||
|
|
||||
|
/** |
||||
|
* 查询当前按钮控制信息 |
||||
|
*/ |
||||
|
HashMap<String, String> getButtonCondition(String site, String referenceNo); |
||||
|
} |
||||
@ -0,0 +1,411 @@ |
|||||
|
package com.spring.modules.lab.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.spring.common.utils.Constant; |
||||
|
import com.spring.common.utils.DateUtils; |
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.common.utils.Query; |
||||
|
import com.spring.modules.base.data.OaUserData; |
||||
|
import com.spring.modules.base.utils.HttpClientUtil; |
||||
|
import com.spring.modules.base.utils.ResponseData; |
||||
|
import com.spring.modules.change.entity.APIEntity.DoForceDrawBackParam; |
||||
|
import com.spring.modules.change.entity.APIEntity.MainData; |
||||
|
import com.spring.modules.change.entity.APIEntity.SubmitRequestParam; |
||||
|
import com.spring.modules.change.entity.ParamData; |
||||
|
import com.spring.modules.change.entity.ProcessFormEntity; |
||||
|
import com.spring.modules.change.mapper.ChangeManagementMapper; |
||||
|
import com.spring.modules.change.service.impl.ChangeManagementServiceImpl; |
||||
|
import com.spring.modules.change.vo.ProcessFormVo; |
||||
|
import com.spring.modules.lab.entity.LabEntity; |
||||
|
import com.spring.modules.lab.mapper.LabMapper; |
||||
|
import com.spring.modules.lab.service.LabService; |
||||
|
import com.spring.modules.lab.vo.LabSubmitVo; |
||||
|
import com.spring.modules.request.vo.PlmRequestDetailVo; |
||||
|
import com.spring.modules.sys.dao.SysUserDao; |
||||
|
import com.spring.modules.sys.entity.SysUserEntity; |
||||
|
import org.apache.commons.lang.StringUtils; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.Date; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.LinkedHashSet; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
import static com.spring.modules.base.utils.CommonUtils.getPropertyValue; |
||||
|
|
||||
|
@Service("labService") |
||||
|
public class LabServiceImpl extends ServiceImpl<LabMapper, LabEntity> implements LabService { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserDao sysUserDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private ChangeManagementMapper changeManagementMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private ChangeManagementServiceImpl changeManagementService; |
||||
|
|
||||
|
@Value("${oa-control.control-flag}") |
||||
|
private Boolean dataUrlOa; |
||||
|
|
||||
|
@Value("${oa-api.api-url}") |
||||
|
private String apiUrlOa; |
||||
|
|
||||
|
@Override |
||||
|
public PageUtils queryPage(Map<String, Object> params) { |
||||
|
params.put("referenceNo", toLikeParam((String) params.get("referenceNo"))); |
||||
|
params.put("applicant", toLikeParam((String) params.get("applicant"))); |
||||
|
params.put("currentApprover", toLikeParam((String) params.get("currentApprover"))); |
||||
|
|
||||
|
IPage<LabEntity> page = this.baseMapper.queryPageWithNames( |
||||
|
new Query<LabEntity>().getPage(params), |
||||
|
params |
||||
|
); |
||||
|
return new PageUtils(page); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public LabEntity getDetail(String site, String referenceNo) { |
||||
|
return this.baseMapper.getDetailWithNames(site, referenceNo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public void issue(String site, String referenceNo, String userName, String menuId) { |
||||
|
LabEntity lab = this.getDetail(site, referenceNo); |
||||
|
if (lab == null) { |
||||
|
throw new RuntimeException("未找到对应Lab单据"); |
||||
|
} |
||||
|
if (!"草稿".equals(lab.getStatus())) { |
||||
|
throw new RuntimeException("仅草稿状态的单据允许下达"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(userName)) { |
||||
|
throw new RuntimeException("下达人不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(menuId)) { |
||||
|
throw new RuntimeException("菜单ID不能为空"); |
||||
|
} |
||||
|
|
||||
|
if (!dataUrlOa) { |
||||
|
LabEntity updateEntity = new LabEntity(); |
||||
|
updateEntity.setStatus("已完成"); |
||||
|
QueryWrapper<LabEntity> updateWrapper = new QueryWrapper<>(); |
||||
|
updateWrapper.eq("site", site).eq("reference_no", referenceNo); |
||||
|
this.update(updateEntity, updateWrapper); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
Map<String, String> baseData = changeManagementService.getReleaseBaseData(site, userName, menuId, referenceNo); |
||||
|
List<PlmRequestDetailVo> nodeDetails = changeManagementMapper.queryNodeDetailFirst(site, baseData.get("workflowId"), menuId); |
||||
|
if (nodeDetails == null || nodeDetails.isEmpty()) { |
||||
|
throw new RuntimeException("流程节点信息获取异常!"); |
||||
|
} |
||||
|
|
||||
|
List<MainData> mainData = new ArrayList<>(); |
||||
|
for (PlmRequestDetailVo nodeDetail : nodeDetails) { |
||||
|
if (nodeDetail.getId() == null) { |
||||
|
continue; |
||||
|
} |
||||
|
MainData md = new MainData(); |
||||
|
md.setFieldName(nodeDetail.getOaField()); |
||||
|
String fieldValue = ""; |
||||
|
if (StringUtils.isNotBlank(nodeDetail.getFieldValue())) { |
||||
|
md.setFieldValue(nodeDetail.getFieldValue()); |
||||
|
mainData.add(md); |
||||
|
continue; |
||||
|
} |
||||
|
if ("plm_lab".equals(nodeDetail.getPlmTable())) { |
||||
|
Object valueObj = getPropertyValue(lab, nodeDetail.getPlmField()); |
||||
|
fieldValue = convertFieldValue(valueObj); |
||||
|
if (StringUtils.isNotBlank(fieldValue) && "A".equals(nodeDetail.getFieldType())) { |
||||
|
fieldValue = convertUserFieldToOaIds(fieldValue); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(fieldValue)) { |
||||
|
md.setFieldValue(fieldValue); |
||||
|
} else { |
||||
|
if ("Y".equals(nodeDetail.getReview())) { |
||||
|
String fieldName = changeManagementService.getFieldName(nodeDetail.getPlmTable(), nodeDetail.getPlmField()); |
||||
|
throw new RuntimeException("[" + fieldName + "] 参数在当前节点是必填项,无法下达/提交该流程!"); |
||||
|
} else if ("N".equals(nodeDetail.getReview()) && "A".equals(nodeDetail.getFieldType())) { |
||||
|
continue; |
||||
|
} else { |
||||
|
md.setFieldValue(""); |
||||
|
} |
||||
|
} |
||||
|
mainData.add(md); |
||||
|
} |
||||
|
|
||||
|
ParamData paramData = new ParamData(site, baseData.get("domainControlAccount"), nodeDetails.get(0).getNodeId(), nodeDetails.get(0).getNodeName(), |
||||
|
referenceNo, userName, baseData.get("classificationNo"), nodeDetails.get(0).getStepId(), baseData.get("menuId"), baseData.get("menuName"), |
||||
|
baseData.get("userId"), baseData.get("workflowId"), baseData.get("workflowname"), baseData.get("requestName"), mainData, baseData.get("path"), |
||||
|
"", "plm_lab", "reference_no", "status"); |
||||
|
|
||||
|
try { |
||||
|
changeManagementService.issueFunction(paramData, Constant.LAB); |
||||
|
if ("已完成".equals(paramData.getStatus())) { |
||||
|
return; |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
changeManagementService.rollBackFunction(paramData, e); |
||||
|
throw new RuntimeException(e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
LabEntity updateEntity = new LabEntity(); |
||||
|
updateEntity.setStatus("审批中"); |
||||
|
QueryWrapper<LabEntity> updateWrapper = new QueryWrapper<>(); |
||||
|
updateWrapper.eq("site", site).eq("reference_no", referenceNo); |
||||
|
this.update(updateEntity, updateWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public void submit(LabSubmitVo data, String userName) { |
||||
|
if (data == null || StringUtils.isBlank(data.getSite()) || StringUtils.isBlank(data.getReferenceNo())) { |
||||
|
throw new RuntimeException("工厂(site)和序列号(referenceNo)不能为空"); |
||||
|
} |
||||
|
String site = data.getSite(); |
||||
|
String referenceNo = data.getReferenceNo(); |
||||
|
String nodeConclusion = data.getNodeConclusion(); |
||||
|
String rejectOpinion = data.getRejectOpinion(); |
||||
|
|
||||
|
LabEntity current = this.getDetail(site, referenceNo); |
||||
|
if (current == null) { |
||||
|
throw new RuntimeException("未找到对应Lab单据"); |
||||
|
} |
||||
|
if (!"审批中".equals(current.getStatus())) { |
||||
|
throw new RuntimeException("仅审批中状态的单据允许提交审批结论"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(userName)) { |
||||
|
throw new RuntimeException("提交人不能为空"); |
||||
|
} |
||||
|
if (!"Y".equals(nodeConclusion) && !"N".equals(nodeConclusion)) { |
||||
|
throw new RuntimeException("审批结论仅支持Y(同意)或N(驳回)"); |
||||
|
} |
||||
|
|
||||
|
LabEntity updateEntity = new LabEntity(); |
||||
|
BeanUtils.copyProperties(data, updateEntity); |
||||
|
updateEntity.setStatus(null); |
||||
|
updateEntity.setStepId(null); |
||||
|
updateEntity.setRejectFlag(null); |
||||
|
updateEntity.setRejectStepId(null); |
||||
|
updateEntity.setCreateDate(null); |
||||
|
updateEntity.setCreateBy(null); |
||||
|
updateEntity.setUpdateDate(new Date()); |
||||
|
updateEntity.setUpdateBy(userName); |
||||
|
QueryWrapper<LabEntity> updateWrapper = new QueryWrapper<>(); |
||||
|
updateWrapper.eq("site", site).eq("reference_no", referenceNo); |
||||
|
this.update(updateEntity, updateWrapper); |
||||
|
|
||||
|
if (!dataUrlOa) { |
||||
|
LabEntity statusEntity = new LabEntity(); |
||||
|
statusEntity.setStatus("已完成"); |
||||
|
statusEntity.setUpdateDate(new Date()); |
||||
|
statusEntity.setUpdateBy(userName); |
||||
|
QueryWrapper<LabEntity> statusWrapper = new QueryWrapper<>(); |
||||
|
statusWrapper.eq("site", site).eq("reference_no", referenceNo); |
||||
|
this.update(statusEntity, statusWrapper); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
LabEntity lab = this.getDetail(site, referenceNo); |
||||
|
if (lab == null) { |
||||
|
throw new RuntimeException("更新后未找到对应Lab单据"); |
||||
|
} |
||||
|
|
||||
|
Map<String, String> baseData = changeManagementService.getSubmitBaseData(site, userName, referenceNo); |
||||
|
ParamData paramData = new ParamData(site, baseData.get("nodeId"), baseData.get("nodeName"), referenceNo, userName, baseData.get("classificationNo"), |
||||
|
baseData.get("userId"), baseData.get("workflowId"), baseData.get("workflowname"), baseData.get("requestName"), baseData.get("path"), baseData.get("requestId"), |
||||
|
"plm_lab", "reference_no", "status", lab.getStepId(), "", |
||||
|
baseData.get("domainControlAccount"), baseData.get("menuId"), baseData.get("menuName"), nodeConclusion, StringUtils.defaultString(rejectOpinion), baseData.get("nodeId")); |
||||
|
|
||||
|
if ("Y".equals(nodeConclusion)) { |
||||
|
List<MainData> mainData = getSubmitMainData(site, baseData, lab); |
||||
|
paramData.setMainData(mainData); |
||||
|
|
||||
|
SubmitRequestParam submitRequestParam = new SubmitRequestParam(); |
||||
|
submitRequestParam.setUserId(paramData.getUserId()); |
||||
|
submitRequestParam.setRequestId(paramData.getRequestId()); |
||||
|
submitRequestParam.setMainData(paramData.getMainData()); |
||||
|
String submitRequestURL = apiUrlOa + "/oa/interface/submitRequest"; |
||||
|
ResponseData submitRequestResponses = HttpClientUtil.doPostByRawWithOA(submitRequestURL, submitRequestParam); |
||||
|
if (!"0".equals(submitRequestResponses.getCode())) { |
||||
|
throw new RuntimeException("OA提交流程异常信息:" + submitRequestResponses.getMsg()); |
||||
|
} |
||||
|
try { |
||||
|
changeManagementService.agreeFunction(paramData, Constant.LAB); |
||||
|
} catch (Exception e) { |
||||
|
handleSubmitRollback(paramData, e); |
||||
|
} |
||||
|
} else { |
||||
|
SubmitRequestParam submitRequestParam = new SubmitRequestParam(); |
||||
|
submitRequestParam.setUserId(paramData.getUserId()); |
||||
|
submitRequestParam.setRequestId(paramData.getRequestId()); |
||||
|
String submitRequestURL = apiUrlOa + "/oa/interface/rejectRequest"; |
||||
|
ResponseData submitRequestResponses = HttpClientUtil.doPostByRawWithOA(submitRequestURL, submitRequestParam); |
||||
|
if (!"0".equals(submitRequestResponses.getCode())) { |
||||
|
throw new RuntimeException("OA流程退回异常信息:" + submitRequestResponses.getMsg()); |
||||
|
} |
||||
|
try { |
||||
|
changeManagementService.rejectFunction(paramData, Constant.LAB); |
||||
|
} catch (Exception e) { |
||||
|
handleSubmitRollback(paramData, e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ProcessFormVo> getApprovalList(String site, String menuId, String documentNo) { |
||||
|
if (StringUtils.isBlank(site) || StringUtils.isBlank(menuId) || StringUtils.isBlank(documentNo)) { |
||||
|
return Collections.emptyList(); |
||||
|
} |
||||
|
return this.baseMapper.getApprovalList(site, menuId, documentNo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public HashMap<String, String> getButtonCondition(String site, String referenceNo) { |
||||
|
HashMap<String, String> result = new HashMap<>(); |
||||
|
result.put("createBy2", ""); |
||||
|
result.put("isReject", "Y"); |
||||
|
result.put("tpProcessControl", "N"); |
||||
|
result.put("csProcessControl", "N"); |
||||
|
|
||||
|
if (StringUtils.isBlank(site) || StringUtils.isBlank(referenceNo)) { |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
List<ProcessFormEntity> currentProcessList = changeManagementMapper.queryRequestId(site, "", referenceNo); |
||||
|
if (currentProcessList == null || currentProcessList.isEmpty()) { |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
Set<String> approvers = new LinkedHashSet<>(); |
||||
|
for (ProcessFormEntity processForm : currentProcessList) { |
||||
|
String approver = processForm.getUpdateBy(); |
||||
|
if (StringUtils.isBlank(approver) && StringUtils.isNotBlank(processForm.getDomainControlAccount())) { |
||||
|
SysUserEntity sysUser = sysUserDao.selectOne( |
||||
|
new QueryWrapper<SysUserEntity>().eq("domain_control_account", processForm.getDomainControlAccount()) |
||||
|
); |
||||
|
if (sysUser != null) { |
||||
|
approver = sysUser.getUsername(); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(approver)) { |
||||
|
approvers.add(approver); |
||||
|
} |
||||
|
} |
||||
|
result.put("createBy2", String.join(";", approvers)); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
private List<MainData> getSubmitMainData(String site, Map<String, String> baseData, LabEntity lab) { |
||||
|
List<MainData> mainData = new ArrayList<>(); |
||||
|
List<PlmRequestDetailVo> nodeDetails = changeManagementMapper.queryNodeDetails(site, baseData.get("workflowId"), baseData.get("nodeId"), baseData.get("classificationNo")); |
||||
|
if (nodeDetails == null || nodeDetails.isEmpty()) { |
||||
|
return mainData; |
||||
|
} |
||||
|
for (PlmRequestDetailVo nodeDetail : nodeDetails) { |
||||
|
if (nodeDetail.getId() == null) { |
||||
|
continue; |
||||
|
} |
||||
|
MainData md = new MainData(); |
||||
|
md.setFieldName(nodeDetail.getOaField()); |
||||
|
String fieldValue = ""; |
||||
|
if (StringUtils.isNotBlank(nodeDetail.getFieldValue())) { |
||||
|
md.setFieldValue(nodeDetail.getFieldValue()); |
||||
|
mainData.add(md); |
||||
|
continue; |
||||
|
} |
||||
|
if ("plm_lab".equals(nodeDetail.getPlmTable())) { |
||||
|
Object valueObj = getPropertyValue(lab, nodeDetail.getPlmField()); |
||||
|
fieldValue = convertFieldValue(valueObj); |
||||
|
if (StringUtils.isNotBlank(fieldValue) && "A".equals(nodeDetail.getFieldType())) { |
||||
|
fieldValue = convertUserFieldToOaIds(fieldValue); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(fieldValue)) { |
||||
|
md.setFieldValue(fieldValue); |
||||
|
} else { |
||||
|
if ("Y".equals(nodeDetail.getReview())) { |
||||
|
String fieldName = changeManagementService.getFieldName(nodeDetail.getPlmTable(), nodeDetail.getPlmField()); |
||||
|
throw new RuntimeException("[" + fieldName + "] 参数在当前节点是必填项,无法下达/提交该流程!"); |
||||
|
} else if ("N".equals(nodeDetail.getReview()) && "A".equals(nodeDetail.getFieldType())) { |
||||
|
continue; |
||||
|
} else { |
||||
|
md.setFieldValue(""); |
||||
|
} |
||||
|
} |
||||
|
mainData.add(md); |
||||
|
} |
||||
|
return mainData; |
||||
|
} |
||||
|
|
||||
|
private String convertUserFieldToOaIds(String fieldValue) { |
||||
|
String[] users = fieldValue.replace(";", ",").split(","); |
||||
|
StringBuilder oaIdList = new StringBuilder(); |
||||
|
for (String userCode : users) { |
||||
|
String username = StringUtils.trim(userCode); |
||||
|
if (StringUtils.isBlank(username)) { |
||||
|
continue; |
||||
|
} |
||||
|
SysUserEntity sysUser = sysUserDao.selectOne(new QueryWrapper<SysUserEntity>().eq("username", username)); |
||||
|
if (sysUser == null) { |
||||
|
throw new RuntimeException("未找到PLM用户信息,用户编码: " + username); |
||||
|
} |
||||
|
String account = sysUser.getDomainControlAccount(); |
||||
|
if (StringUtils.isBlank(account)) { |
||||
|
throw new RuntimeException("未获取到PLM人员域控账号,用户编码: " + username); |
||||
|
} |
||||
|
List<OaUserData> oaIds = sysUserDao.selectOaIdByAccount(account); |
||||
|
if (oaIds == null || oaIds.isEmpty()) { |
||||
|
throw new RuntimeException("未获取到域控账号对应的OA人员,域控账号: " + account); |
||||
|
} |
||||
|
oaIdList.append(oaIds.get(0).getId()).append(","); |
||||
|
} |
||||
|
return oaIdList.length() > 0 ? oaIdList.substring(0, oaIdList.length() - 1) : ""; |
||||
|
} |
||||
|
|
||||
|
private void handleSubmitRollback(ParamData paramData, Exception e) { |
||||
|
DoForceDrawBackParam doForceDrawBackParam = new DoForceDrawBackParam(); |
||||
|
doForceDrawBackParam.setUserId(paramData.getUserId()); |
||||
|
doForceDrawBackParam.setRequestId(paramData.getRequestId()); |
||||
|
String doForceDrawBackURL = apiUrlOa + "/oa/interface/doForceDrawBack"; |
||||
|
ResponseData doForceDrawBackResponses = HttpClientUtil.doPostByRawWithOA(doForceDrawBackURL, doForceDrawBackParam); |
||||
|
if (!"0".equals(doForceDrawBackResponses.getCode())) { |
||||
|
if ("NO_PERMISSION".equals(doForceDrawBackResponses.getCode())) { |
||||
|
throw new RuntimeException("OA撤回流程异常信息:流程提交异常,无撤回权限,请联系管理员! 导致OA撤回的PLM异常:" + e.getMessage()); |
||||
|
} |
||||
|
throw new RuntimeException("OA撤回流程异常信息:" + doForceDrawBackResponses.getMsg() + " 导致OA撤回的PLM异常:" + e.getMessage()); |
||||
|
} |
||||
|
throw new RuntimeException(e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
private String toLikeParam(String value) { |
||||
|
if (StringUtils.isBlank(value)) { |
||||
|
return null; |
||||
|
} |
||||
|
return "%" + value.trim() + "%"; |
||||
|
} |
||||
|
|
||||
|
private String convertFieldValue(Object valueObj) { |
||||
|
if (valueObj == null) { |
||||
|
return ""; |
||||
|
} |
||||
|
if (valueObj instanceof Date) { |
||||
|
return DateUtils.format((Date) valueObj); |
||||
|
} |
||||
|
return String.valueOf(valueObj); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.spring.modules.lab.vo; |
||||
|
|
||||
|
import com.spring.modules.lab.entity.LabEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* Lab 提交流程参数 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
public class LabSubmitVo extends LabEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String site; |
||||
|
|
||||
|
private String referenceNo; |
||||
|
|
||||
|
/** |
||||
|
* Y=同意, N=驳回 |
||||
|
*/ |
||||
|
private String nodeConclusion; |
||||
|
|
||||
|
private String rejectOpinion; |
||||
|
|
||||
|
private String menuId; |
||||
|
|
||||
|
private String documentNo; |
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
<?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="com.spring.modules.lab.mapper.LabMapper"> |
||||
|
|
||||
|
<resultMap id="BaseResultMap" type="com.spring.modules.lab.entity.LabEntity"> |
||||
|
<result column="site" property="site"/> |
||||
|
<result column="reference_no" property="referenceNo"/> |
||||
|
<result column="applicant" property="applicant"/> |
||||
|
<result column="application_date" property="applicationDate"/> |
||||
|
<result column="apply_department" property="applyDepartment"/> |
||||
|
<result column="requested_date" property="requestedDate"/> |
||||
|
<result column="project_id" property="projectId"/> |
||||
|
<result column="customer_id" property="customerId"/> |
||||
|
<result column="sample_name" property="sampleName"/> |
||||
|
<result column="sample_model" property="sampleModel"/> |
||||
|
<result column="sample_qty" property="sampleQty"/> |
||||
|
<result column="test_purpose" property="testPurpose"/> |
||||
|
<result column="product_stage" property="productStage"/> |
||||
|
<result column="test_type" property="testType"/> |
||||
|
<result column="report_document" property="reportDocument"/> |
||||
|
<result column="return_sample" property="returnSample"/> |
||||
|
<result column="application_surface" property="applicationSurface"/> |
||||
|
<result column="test_lab" property="testLab"/> |
||||
|
<result column="attention" property="attention"/> |
||||
|
<result column="test_start_date" property="testStartDate"/> |
||||
|
<result column="completed_date" property="completedDate"/> |
||||
|
<result column="unnormal_symptom_and_description" property="unnormalSymptomAndDescription"/> |
||||
|
<result column="test_number" property="testNumber"/> |
||||
|
<result column="tester_comments" property="testerComments"/> |
||||
|
<result column="department_manager_comments" property="departmentManagerComments"/> |
||||
|
<result column="lab_comments" property="labComments"/> |
||||
|
<result column="tester" property="tester"/> |
||||
|
<result column="status" property="status"/> |
||||
|
<result column="create_date" property="createDate"/> |
||||
|
<result column="create_by" property="createBy"/> |
||||
|
<result column="update_date" property="updateDate"/> |
||||
|
<result column="update_by" property="updateBy"/> |
||||
|
<result column="step_id" property="stepId"/> |
||||
|
<result column="reject_flag" property="rejectFlag"/> |
||||
|
<result column="reject_step_id" property="rejectStepId"/> |
||||
|
<result column="nodeId" property="nodeId"/> |
||||
|
<result column="nodeName" property="nodeName"/> |
||||
|
<result column="currentApprover" property="currentApprover"/> |
||||
|
<result column="applicantName" property="applicantName"/> |
||||
|
<result column="customerName" property="customerName"/> |
||||
|
<result column="projectName" property="projectName"/> |
||||
|
<result column="testerName" property="testerName"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="Base_Column_List"> |
||||
|
a.site, a.reference_no, a.applicant, a.application_date, a.apply_department, a.requested_date, |
||||
|
a.project_id, a.customer_id, a.sample_name, a.sample_model, a.sample_qty, a.test_purpose, |
||||
|
a.product_stage, a.test_type, a.report_document, a.return_sample, a.application_surface, a.test_lab, |
||||
|
a.attention, a.test_start_date, a.completed_date, a.unnormal_symptom_and_description, a.test_number, |
||||
|
a.tester_comments, a.department_manager_comments, a.lab_comments, a.tester, a.status, a.create_date, |
||||
|
a.create_by, a.update_date, a.update_by, a.step_id, a.reject_flag, a.reject_step_id |
||||
|
</sql> |
||||
|
|
||||
|
<select id="getApprovalList" resultType="com.spring.modules.change.vo.ProcessFormVo"> |
||||
|
exec dbo.get_process_form #{site},#{menuId},#{documentNo} |
||||
|
</select> |
||||
|
|
||||
|
<select id="queryPageWithNames" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List"/>, |
||||
|
d.node_id as nodeId, |
||||
|
d.node_name as nodeName, |
||||
|
dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.reference_no) as currentApprover, |
||||
|
dbo.get_userDisPlay(a.applicant) as applicantName, |
||||
|
dbo.plm_get_customer_desc(a.site, a.customer_id) as customerName, |
||||
|
dbo.plm_get_project_name(a.site, a.project_id) as projectName, |
||||
|
dbo.get_userDisPlay(a.tester) as testerName |
||||
|
from plm_lab a |
||||
|
left join plm_request_header prh on a.site = prh.site and prh.menu_id = #{params.menuId} and prh.status = 'Y' |
||||
|
left join plm_request_node d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id |
||||
|
where 1 = 1 |
||||
|
<if test="params.site != null and params.site != ''"> |
||||
|
and a.site = #{params.site} |
||||
|
</if> |
||||
|
<if test="params.referenceNo != null and params.referenceNo != ''"> |
||||
|
and a.reference_no like #{params.referenceNo} |
||||
|
</if> |
||||
|
<if test="params.status != null and params.status != ''"> |
||||
|
and a.status = #{params.status} |
||||
|
</if> |
||||
|
<if test="params.nodeId != null and params.nodeId != ''"> |
||||
|
and d.node_id = #{params.nodeId} |
||||
|
</if> |
||||
|
<if test="params.currentApprover != null and params.currentApprover != ''"> |
||||
|
and dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.reference_no) like #{params.currentApprover} |
||||
|
</if> |
||||
|
<if test="params.applicant != null and params.applicant != ''"> |
||||
|
and a.applicant like #{params.applicant} |
||||
|
</if> |
||||
|
order by a.application_date desc |
||||
|
</select> |
||||
|
|
||||
|
<select id="getDetailWithNames" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List"/>, |
||||
|
dbo.get_userDisPlay(a.applicant) as applicantName, |
||||
|
dbo.plm_get_customer_desc(a.site, a.customer_id) as customerName, |
||||
|
dbo.plm_get_project_name(a.site, a.project_id) as projectName, |
||||
|
dbo.get_userDisPlay(a.tester) as testerName |
||||
|
from plm_lab a |
||||
|
where a.site = #{site} |
||||
|
and a.reference_no = #{referenceNo} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue