|
|
|
@ -10,13 +10,19 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.utils.SpringUtils;
|
|
|
|
|
import com.op.common.core.utils.StringUtils;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.common.datascope.annotation.DataScope;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.quality.domain.vo.TreeSelect;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.quality.mapper.QcMaterialGroupMapper;
|
|
|
|
|
import com.op.quality.domain.QcMaterialGroup;
|
|
|
|
|
import com.op.quality.service.IQcMaterialGroupService;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 物料组Service业务层处理
|
|
|
|
@ -73,7 +79,9 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
|
|
|
|
|
Map<String,List<QcMaterialGroup>> listMap = childList.stream().collect(Collectors.groupingBy(QcMaterialGroup::getParentId));
|
|
|
|
|
for (QcMaterialGroup material : groups) {
|
|
|
|
|
//根据根节点Id进行赋值
|
|
|
|
|
material.setChildren(listMap.get(material.getId()));
|
|
|
|
|
if (listMap.containsKey(material.getId())){
|
|
|
|
|
material.setChildren(listMap.get(material.getId()));
|
|
|
|
|
}
|
|
|
|
|
resultList.add(material);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -116,8 +124,14 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int insertQcMaterialGroup(QcMaterialGroup qcMaterialGroup) {
|
|
|
|
|
qcMaterialGroup.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
qcMaterialGroup.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
qcMaterialGroup.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
qcMaterialGroup.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
return qcMaterialGroupMapper.insertQcMaterialGroup(qcMaterialGroup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -128,8 +142,10 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int updateQcMaterialGroup(QcMaterialGroup qcMaterialGroup) {
|
|
|
|
|
qcMaterialGroup.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
qcMaterialGroup.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
return qcMaterialGroupMapper.updateQcMaterialGroup(qcMaterialGroup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -140,6 +156,7 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int deleteQcMaterialGroupByIds(String[] ids) {
|
|
|
|
|
return qcMaterialGroupMapper.deleteQcMaterialGroupByIds(ids);
|
|
|
|
|
}
|
|
|
|
@ -151,6 +168,7 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int deleteQcMaterialGroupById(String id) {
|
|
|
|
|
return qcMaterialGroupMapper.deleteQcMaterialGroupById(id);
|
|
|
|
|
}
|
|
|
|
|