检验人员多选

master
shaoyong 1 year ago
parent 63cc8e2053
commit 4e65a7d092

@ -0,0 +1,212 @@
package com.op.quality.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class QcCheckTaskUser extends BaseEntity {
/**
* -- qc_check_task_user
*
* @author Open Platform
* @date 2023-12-22
*/
private static final long serialVersionUID = 1L;
/**
* id
*/
private String recordId;
/**
*
*/
@Excel(name = "检验任务编号")
private String checkNo;
/**
*
*/
@Excel(name = "检测人工号")
private String checkManCode;
/**
*
*/
@Excel(name = "检测人姓名")
private String checkManName;
/**
* 1
*/
@Excel(name = "预留字段1")
private String attr1;
/**
* 2
*/
@Excel(name = "预留字段2")
private String attr2;
/**
* 3
*/
@Excel(name = "预留字段3")
private String attr3;
/**
* 4
*/
@Excel(name = "预留字段4")
private String attr4;
/**
*
*/
@Excel(name = "工厂编码")
private String factoryCode;
/**
* 10
*/
private String delFlag;
/**
*
*/
private String belongTo;
private String manNames;
private String manCodes;
public String getManNames() {
return manNames;
}
public void setManNames(String manNames) {
this.manNames = manNames;
}
public String getManCodes() {
return manCodes;
}
public void setManCodes(String manCodes) {
this.manCodes = manCodes;
}
public String getRecordId() {
return recordId;
}
public void setRecordId(String recordId) {
this.recordId = recordId;
}
public String getCheckNo() {
return checkNo;
}
public void setCheckNo(String checkNo) {
this.checkNo = checkNo;
}
public String getCheckManCode() {
return checkManCode;
}
public void setCheckManCode(String checkManCode) {
this.checkManCode = checkManCode;
}
public String getCheckManName() {
return checkManName;
}
public void setCheckManName(String checkManName) {
this.checkManName = checkManName;
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getBelongTo() {
return belongTo;
}
public void setBelongTo(String belongTo) {
this.belongTo = belongTo;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("recordId", getRecordId())
.append("checkNo", getCheckNo())
.append("checkManCode", getCheckManCode())
.append("checkManName", getCheckManName())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -86,4 +86,6 @@ public interface QcCheckTaskIncomeMapper {
List<QcCheckTaskIncome> getBatchList(QcCheckTaskIncome qcCheckTaskIncome);
String getTypeCode(String checkType);
List<String> selectQcCheckTaskCheckNoByRecordIds(String[] recordIds);
}

@ -71,4 +71,6 @@ public interface QcCheckTaskProduceMapper {
List<QcCheckType> getCheckTypes(QcCheckType qcCheckType);
List<QcCheckTaskProduce> getOrderWorks(ProOrderWorkorderDTO qoWork);
List<String> selectQcCheckTaskCheckNoByRecordIds(String[] recordIds);
}

@ -0,0 +1,74 @@
package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcCheckTaskUser;
import org.apache.ibatis.annotations.Mapper;
/**
* --Mapper
*
* @author Open Platform
* @date 2023-12-22
*/
@Mapper
public interface QcCheckTaskUserMapper {
/**
* --
*
* @param recordId --
* @return --
*/
public QcCheckTaskUser selectQcCheckTaskUserByRecordId(String recordId);
/**
* --
*
* @param qcCheckTaskUser --
* @return --
*/
public List<QcCheckTaskUser> selectQcCheckTaskUserList(QcCheckTaskUser qcCheckTaskUser);
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
public int insertQcCheckTaskUser(QcCheckTaskUser qcCheckTaskUser);
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
public int updateQcCheckTaskUser(QcCheckTaskUser qcCheckTaskUser);
/**
* --
*
* @param recordId --
* @return
*/
public int deleteQcCheckTaskUserByRecordId(String recordId);
/**
* --
*
* @param recordIds
* @return
*/
public int deleteQcCheckTaskUserByRecordIds(String[] recordIds);
/**
*
*/
public int insertQcCheckTaskUserList(List<QcCheckTaskUser> qcCheckTaskUserList);
public int deleteQcCheckTaskUserByBelongTo(String belongTo);
public QcCheckTaskUser selectQcCheckTaskUserByBelongTo(String belongTo);
public int deleteQcCheckTaskUserByBelongTos(String[] belongToArray);
}

@ -0,0 +1,71 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcCheckTaskUser;
/**
* --Service
*
* @author Open Platform
* @date 2023-12-22
*/
public interface IQcCheckTaskUserService {
/**
* --
*
* @param recordId --
* @return --
*/
public QcCheckTaskUser selectQcCheckTaskUserByRecordId(String recordId);
/**
* --
*
* @param qcCheckTaskUser --
* @return --
*/
public List<QcCheckTaskUser> selectQcCheckTaskUserList(QcCheckTaskUser qcCheckTaskUser);
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
public int insertQcCheckTaskUser(QcCheckTaskUser qcCheckTaskUser);
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
public int updateQcCheckTaskUser(List<QcCheckTaskUser> qcCheckTaskUser);
/**
* --
*
* @param recordIds --
* @return
*/
public int deleteQcCheckTaskUserByRecordIds(String[] recordIds);
public int deleteQcCheckTaskUserByBelongTos(String[] belongToArray);
/**
* --
*
* @param recordId --
* @return
*/
public int deleteQcCheckTaskUserByRecordId(String recordId);
/**
*
*/
public int insertQcCheckTaskUserList(List<QcCheckTaskUser> qcCheckTaskUserList);
/**
*
*/
public QcCheckTaskUser selectQcCheckTaskUserByBelongTo(String belongTo);
}

@ -15,6 +15,7 @@ import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.mapper.*;
import com.op.quality.service.IQcCheckTaskProduceService;
import com.op.quality.service.IQcCheckTaskUserService;
import com.op.system.api.domain.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -58,6 +59,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
@Autowired
private QcCheckUnqualifiedMapper qcCheckUnqualifiedMapper;
@Autowired
private IQcCheckTaskUserService qcCheckTaskUserService;
/**
*
*
@ -139,7 +143,25 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
qcCheckTaskIncome.setCreateTime(nowDate);
//String typeCode = qcCheckTaskIncomeMapper.getTypeCode(qcCheckTaskIncome.getCheckType());
qcCheckTaskIncome.setTypeCode("material");//大检验节点
/**qc_task_user start**/
String checkManName = qcCheckTaskIncome.getCheckManName();
String checkManCode = qcCheckTaskIncome.getCheckManCode();
qcCheckTaskIncome.setCheckManName("");
qcCheckTaskIncome.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskIncome.getCheckNo());
qcCheckTaskUser.setBelongTo(beLongId);
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome);
//检验人插入
qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList);
/**qc_check_task_detail**/
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
@ -162,6 +184,24 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
@DS("#header.poolName")
public int updateQcCheckTaskIncome(QcCheckTaskIncome qcCheckTaskIncome) {
qcCheckTaskIncome.setUpdateTime(DateUtils.getNowDate());
/**qc_task_user**/
String checkManName = qcCheckTaskIncome.getCheckManName();
String checkManCode = qcCheckTaskIncome.getCheckManCode();
qcCheckTaskIncome.setCheckManName("");
qcCheckTaskIncome.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskIncome.getCheckNo());
qcCheckTaskUser.setBelongTo(qcCheckTaskIncome.getRecordId());
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskUserService.updateQcCheckTaskUser(qcCheckTaskUserList);
return qcCheckTaskIncomeMapper.updateQcCheckTaskIncome(qcCheckTaskIncome);
}
@ -174,6 +214,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskIncomeByRecordIds(String[] recordIds) {
qcCheckTaskUserService.deleteQcCheckTaskUserByBelongTos(recordIds);
return qcCheckTaskIncomeMapper.deleteQcCheckTaskIncomeByRecordIds(recordIds);
}

@ -1,5 +1,6 @@
package com.op.quality.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -22,6 +23,7 @@ import com.op.quality.domain.*;
import com.op.quality.mapper.QcCheckTaskDetailMapper;
import com.op.quality.mapper.QcCheckTypeProjectMapper;
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
import com.op.quality.service.IQcCheckTaskUserService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
@ -31,7 +33,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcCheckTaskProduceMapper;
import com.op.quality.service.IQcCheckTaskProduceService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -52,42 +58,55 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
@Autowired
private QcCheckTaskProduceMapper qcCheckTaskProduceMapper;
@Autowired
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
@Autowired
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
@Autowired
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
@Autowired
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
@Autowired
private RemoteUserService remoteUserService;
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckTaskProduce selectQcCheckTaskProduceByRecordId(String recordId) {
return qcCheckTaskProduceMapper.selectQcCheckTaskProduceByRecordId(recordId);
}
@Autowired
private IQcCheckTaskUserService qcCheckTaskUserService;
/**
*
*
* @param qcCheckTaskProduce
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckTaskProduce> selectQcCheckTaskProduceList(QcCheckTaskProduce qcCheckTaskProduce) {
qcCheckTaskProduce.setDelFlag("0");
qcCheckTaskProduce.setTypeCode("produce");
return qcCheckTaskProduceMapper.selectQcCheckTaskProduceList(qcCheckTaskProduce);
}
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckTaskProduce selectQcCheckTaskProduceByRecordId(String recordId) {
QcCheckTaskProduce qcCheckTaskProduce = qcCheckTaskProduceMapper.selectQcCheckTaskProduceByRecordId(recordId);
//获取拼接好的检验人员信息
QcCheckTaskUser qcCheckTaskUser = qcCheckTaskUserService.selectQcCheckTaskUserByBelongTo(recordId);
if (StringUtils.isNotBlank(qcCheckTaskUser.getManNames())) {
qcCheckTaskProduce.setCheckManName(qcCheckTaskUser.getManNames());
}
if (StringUtils.isNotBlank(qcCheckTaskUser.getManCodes())) {
qcCheckTaskProduce.setCheckManCode(qcCheckTaskUser.getManCodes());
}
return qcCheckTaskProduce;
}
/**
*
*
* @param qcCheckTaskProduce
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckTaskProduce> selectQcCheckTaskProduceList(QcCheckTaskProduce qcCheckTaskProduce) {
qcCheckTaskProduce.setDelFlag("0");
qcCheckTaskProduce.setTypeCode("produce");
return qcCheckTaskProduceMapper.selectQcCheckTaskProduceList(qcCheckTaskProduce);
}
/**
*
@ -115,8 +134,8 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
int liushuiNum = qcCheckTaskProduceMapper.getTodayMaxNum(qcCheckTaskProduce);
String liushuiStr = String.format("%04d", liushuiNum);
String createBy = SecurityUtils.getUsername();
Date nowDate= DateUtils.getNowDate();
String createBy = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
qcCheckTaskProduce.setCheckNo(bpDD+liushuiStr);
@ -141,37 +160,72 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
return 0;//没有找到检测项目
}
/**qc_check_task**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckTaskProduce.setRecordId(beLongId);
qcCheckTaskProduce.setFactoryCode(factoryCode);
qcCheckTaskProduce.setCreateTime(nowDate);
qcCheckTaskProduce.setTypeCode("produce");//大检验节点
qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce);
/**qc_check_task_detail**/
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
item.setBelongTo(beLongId);
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("Y");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
/**qc_check_task**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckTaskProduce.setRecordId(beLongId);
qcCheckTaskProduce.setFactoryCode(factoryCode);
qcCheckTaskProduce.setCreateTime(nowDate);
qcCheckTaskProduce.setTypeCode("produce");//大检验节点
/**qc_task_user start**/
String checkManName = qcCheckTaskProduce.getCheckManName();
String checkManCode = qcCheckTaskProduce.getCheckManCode();
qcCheckTaskProduce.setCheckManName("");
qcCheckTaskProduce.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskProduce.getCheckNo());
qcCheckTaskUser.setBelongTo(beLongId);
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce);
//检验人插入
qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList);
/**qc_check_task_detail**/
for (QcCheckTaskDetail item : items) {
item.setRecordId(IdUtils.fastSimpleUUID());
item.setBelongTo(beLongId);
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("Y");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
/**
*
*
* @param qcCheckTaskProduce
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckTaskProduce(QcCheckTaskProduce qcCheckTaskProduce) {
qcCheckTaskProduce.setUpdateTime(DateUtils.getNowDate());
return qcCheckTaskProduceMapper.updateQcCheckTaskProduce(qcCheckTaskProduce);
}
/**
*
*
* @param qcCheckTaskProduce
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckTaskProduce(QcCheckTaskProduce qcCheckTaskProduce) {
qcCheckTaskProduce.setUpdateTime(DateUtils.getNowDate());
/**qc_task_user**/
String checkManName = qcCheckTaskProduce.getCheckManName();
String checkManCode = qcCheckTaskProduce.getCheckManCode();
qcCheckTaskProduce.setCheckManName("");
qcCheckTaskProduce.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskProduce.getCheckNo());
qcCheckTaskUser.setBelongTo(qcCheckTaskProduce.getRecordId());
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskUserService.updateQcCheckTaskUser(qcCheckTaskUserList);
return qcCheckTaskProduceMapper.updateQcCheckTaskProduce(qcCheckTaskProduce);
}
/**
*
@ -182,6 +236,7 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskProduceByRecordIds(String[] recordIds) {
qcCheckTaskUserService.deleteQcCheckTaskUserByBelongTos(recordIds);
return qcCheckTaskProduceMapper.deleteQcCheckTaskProduceByRecordIds(recordIds);
}

@ -0,0 +1,155 @@
package com.op.quality.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcCheckTaskUserMapper;
import com.op.quality.domain.QcCheckTaskUser;
import com.op.quality.service.IQcCheckTaskUserService;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* --Service
*
* @author Open Platform
* @date 2023-12-22
*/
@Service
public class QcCheckTaskUserServiceImpl implements IQcCheckTaskUserService {
@Autowired
private QcCheckTaskUserMapper qcCheckTaskUserMapper;
/**
* --
*
* @param recordId --
* @return --
*/
@Override
@DS("#header.poolName")
public QcCheckTaskUser selectQcCheckTaskUserByRecordId(String recordId) {
return qcCheckTaskUserMapper.selectQcCheckTaskUserByRecordId(recordId);
}
/**
* --
*
* @param qcCheckTaskUser --
* @return --
*/
@Override
@DS("#header.poolName")
public List<QcCheckTaskUser> selectQcCheckTaskUserList(QcCheckTaskUser qcCheckTaskUser) {
return qcCheckTaskUserMapper.selectQcCheckTaskUserList(qcCheckTaskUser);
}
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcCheckTaskUser(QcCheckTaskUser qcCheckTaskUser) {
qcCheckTaskUser.setCreateTime(DateUtils.getNowDate());
return qcCheckTaskUserMapper.insertQcCheckTaskUser(qcCheckTaskUser);
}
/**
* --
*
* @param qcCheckTaskUser --
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckTaskUser(List<QcCheckTaskUser> qcCheckTaskUserList) {
if (CollectionUtils.isEmpty(qcCheckTaskUserList)){
return 0;
}
String belongTo = qcCheckTaskUserList.get(0).getBelongTo();
//根据belongTo删除
qcCheckTaskUserMapper.deleteQcCheckTaskUserByBelongTo(belongTo);
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
//遍历赋值
for (QcCheckTaskUser qcCheckTaskUser : qcCheckTaskUserList){
qcCheckTaskUser.setRecordId(IdUtils.fastSimpleUUID());
qcCheckTaskUser.setCreateTime(DateUtils.getNowDate());
qcCheckTaskUser.setCreateBy(SecurityUtils.getUsername());
qcCheckTaskUser.setFactoryCode(factoryCode);
}
//重新插入数据
return qcCheckTaskUserMapper.insertQcCheckTaskUserList(qcCheckTaskUserList);
}
/**
* --
*
* @param recordIds --
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskUserByRecordIds(String[] recordIds) {
return qcCheckTaskUserMapper.deleteQcCheckTaskUserByRecordIds(recordIds);
}
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskUserByBelongTos(String[] belongToArray) {
return qcCheckTaskUserMapper.deleteQcCheckTaskUserByBelongTos(belongToArray);
}
/**
* --
*
* @param recordId --
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskUserByRecordId(String recordId) {
return qcCheckTaskUserMapper.deleteQcCheckTaskUserByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public int insertQcCheckTaskUserList(List<QcCheckTaskUser> qcCheckTaskUserList) {
if (CollectionUtils.isEmpty(qcCheckTaskUserList)){
return 0;
}
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
//遍历赋值
for (QcCheckTaskUser qcCheckTaskUser : qcCheckTaskUserList){
qcCheckTaskUser.setRecordId(IdUtils.fastSimpleUUID());
qcCheckTaskUser.setCreateTime(DateUtils.getNowDate());
qcCheckTaskUser.setCreateBy(SecurityUtils.getUsername());
qcCheckTaskUser.setFactoryCode(factoryCode);
}
return qcCheckTaskUserMapper.insertQcCheckTaskUserList(qcCheckTaskUserList);
}
@Override
@DS("#header.poolName")
public QcCheckTaskUser selectQcCheckTaskUserByBelongTo(String belongTo) {
return qcCheckTaskUserMapper.selectQcCheckTaskUserByBelongTo(belongTo);
}
}

@ -1,24 +1,24 @@
package com.op.quality.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import ch.qos.logback.core.net.SyslogOutputStream;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTypeProject;
import com.op.quality.domain.QcMaterialGroupDetail;
import com.op.quality.domain.*;
import com.op.quality.mapper.QcCheckTaskDetailMapper;
import com.op.quality.mapper.QcCheckTypeProjectMapper;
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
import com.op.quality.service.IQcCheckTaskUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcCheckTaskWarehousingMapper;
import com.op.quality.domain.QcCheckTaskWarehousing;
import com.op.quality.service.IQcCheckTaskWarehousingService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -47,6 +47,9 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
@Autowired
private IQcCheckTaskUserService qcCheckTaskUserService;
/**
*
*
@ -128,7 +131,25 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
qcCheckTaskWarehousing.setFactoryCode(factoryCode);
qcCheckTaskWarehousing.setCreateTime(nowDate);
qcCheckTaskWarehousing.setTypeCode("product");//大检验节点
/**qc_task_user start**/
String checkManName = qcCheckTaskWarehousing.getCheckManName();
String checkManCode = qcCheckTaskWarehousing.getCheckManCode();
qcCheckTaskWarehousing.setCheckManName("");
qcCheckTaskWarehousing.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskWarehousing.getCheckNo());
qcCheckTaskUser.setBelongTo(beLongId);
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing);
//检验人插入
qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList);
/**qc_check_task_detail**/
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
@ -151,6 +172,23 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
@DS("#header.poolName")
public int updateQcCheckTaskWarehousing(QcCheckTaskWarehousing qcCheckTaskWarehousing) {
qcCheckTaskWarehousing.setUpdateTime(DateUtils.getNowDate());
/**qc_task_user**/
String checkManName = qcCheckTaskWarehousing.getCheckManName();
String checkManCode = qcCheckTaskWarehousing.getCheckManCode();
qcCheckTaskWarehousing.setCheckManName("");
qcCheckTaskWarehousing.setCheckManCode("");
String[] splitNames = checkManName.split(",");
String[] splitCodes = checkManCode.split(",");
List<QcCheckTaskUser> qcCheckTaskUserList = new ArrayList<>();
for (int i = 0; i < splitNames.length; i++) {
QcCheckTaskUser qcCheckTaskUser = new QcCheckTaskUser();
qcCheckTaskUser.setCheckManName(splitNames[i]);
qcCheckTaskUser.setCheckManCode(splitCodes[i]);
qcCheckTaskUser.setCheckNo(qcCheckTaskWarehousing.getCheckNo());
qcCheckTaskUser.setBelongTo(qcCheckTaskWarehousing.getRecordId());
qcCheckTaskUserList.add(qcCheckTaskUser);
}
qcCheckTaskUserService.updateQcCheckTaskUser(qcCheckTaskUserList);
return qcCheckTaskWarehousingMapper.updateQcCheckTaskWarehousing(qcCheckTaskWarehousing);
}
@ -163,6 +201,7 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
@Override
@DS("#header.poolName")
public int deleteQcCheckTaskWarehousingByRecordIds(String[] recordIds) {
qcCheckTaskUserService.deleteQcCheckTaskUserByBelongTos(recordIds);
return qcCheckTaskWarehousingMapper.deleteQcCheckTaskWarehousingByRecordIds(recordIds);
}

@ -304,4 +304,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<select id="selectQcCheckTaskCheckNoByRecordIds" parameterType="String" resultMap="QcCheckTaskIncomeResult">
select check_no from qc_check_task where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</select>
</mapper>

@ -172,7 +172,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</if>
<if test="checkType != null">check_type,</if>
<if test="typeCode != null">type_code,</if>
<if test="sampleQuality != null">sample_quality,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
@ -210,7 +209,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
<if test="checkType != null">#{checkType},</if>
<if test="typeCode != null">#{typeCode},</if>
<if test="sampleQuality != null">#{sampleQuality},</if>
</trim>
</insert>
@ -249,7 +247,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="sampleQuality != null">sample_quality = #{sampleQuality},</if>
</trim>
where record_id = #{recordId}
</update>
@ -264,4 +261,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<select id="selectQcCheckTaskCheckNoByRecordIds" parameterType="String" resultMap="QcCheckTaskProduceResult">
select check_no from qc_check_task where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</select>
</mapper>

@ -0,0 +1,178 @@
<?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.op.quality.mapper.QcCheckTaskUserMapper">
<resultMap type="QcCheckTaskUser" id="QcCheckTaskUserResult">
<result property="recordId" column="record_id" />
<result property="checkNo" column="check_no" />
<result property="checkManCode" column="check_man_code" />
<result property="checkManName" column="check_man_name" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectQcCheckTaskUserVo">
select record_id, check_no, check_man_code, check_man_name, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_task_user
</sql>
<select id="selectQcCheckTaskUserList" parameterType="QcCheckTaskUser" resultMap="QcCheckTaskUserResult">
<include refid="selectQcCheckTaskUserVo"/>
<where>
<if test="checkNo != null and checkNo != ''"> and check_no = #{checkNo}</if>
<if test="checkManCode != null and checkManCode != ''"> and check_man_code = #{checkManCode}</if>
<if test="checkManName != null and checkManName != ''"> and check_man_name like concat('%', #{checkManName}, '%')</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectQcCheckTaskUserByRecordId" parameterType="String" resultMap="QcCheckTaskUserResult">
<include refid="selectQcCheckTaskUserVo"/>
where record_id = #{recordId}
</select>
<insert id="insertQcCheckTaskUser" parameterType="QcCheckTaskUser">
insert into qc_check_task_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="checkNo != null">check_no,</if>
<if test="checkManCode != null">check_man_code,</if>
<if test="checkManName != null">check_man_name,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
<if test="belongTo != null">belong_to,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="checkNo != null">#{checkNo},</if>
<if test="checkManCode != null">#{checkManCode},</if>
<if test="checkManName != null">#{checkManName},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="belongTo != null">#{belongTo},</if>
</trim>
</insert>
<update id="updateQcCheckTaskUser" parameterType="QcCheckTaskUser">
update qc_check_task_user
<trim prefix="SET" suffixOverrides=",">
<if test="checkNo != null">check_no = #{checkNo},</if>
<if test="checkManCode != null">check_man_code = #{checkManCode},</if>
<if test="checkManName != null">check_man_name = #{checkManName},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="belongTo != null">belong_to = #{belongTo},</if>
</trim>
where record_id = #{recordId}
</update>
<delete id="deleteQcCheckTaskUserByRecordId" parameterType="String">
delete from qc_check_task_user where record_id = #{recordId}
</delete>
<delete id="deleteQcCheckTaskUserByRecordIds" parameterType="String">
delete from qc_check_task_user where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
<delete id="deleteQcCheckTaskUserByBelongTo" parameterType="String">
delete from qc_check_task_user where belong_to = #{belongTo}
</delete>
<insert id="insertQcCheckTaskUserList" parameterType="List">
insert into qc_check_task_user(
record_id,
check_no,
check_man_code,
check_man_name,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time,
factory_code,
del_flag,
belong_to
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.recordId},
#{item.checkNo},
#{item.checkManCode},
#{item.checkManName},
#{item.attr1},
#{item.attr2},
#{item.attr3},
#{item.attr4},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.factoryCode},
#{item.delFlag},
#{item.belongTo}
)
</foreach>
</insert>
<select id="selectQcCheckTaskUserByBelongTo" parameterType="String" resultMap="QcCheckTaskUserResult">
select
STRING_AGG(check_man_code,',') AS 'manCodes',
STRING_AGG(check_man_name,',') AS 'manNames',
belong_to
from qc_check_task_user
where belong_to = #{belongTo}
group by belong_to
</select>
<delete id="deleteQcCheckTaskUserByBelongTos" parameterType="String">
delete from qc_check_task_user where belong_to in
<foreach item="belongTo" collection="Array" open="(" separator="," close=")">
#{belongTo}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save