|
@@ -1,16 +1,22 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bscommon.sys.dao.SrmIssuesListDao;
|
|
|
import com.rongwei.bscommon.sys.service.SrmIssuesListService;
|
|
|
import com.rongwei.bsentity.domin.SrmIssuesListDo;
|
|
|
import com.rongwei.commonservice.service.SysConfigService;
|
|
|
+import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
|
|
|
+import com.rongwei.rwadmincommon.system.service.SysOrganizationService;
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysOrganizationVo;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
+import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysNotifyAnnounceVo;
|
|
|
import com.rongwei.safecommon.utils.CXCommonUtils;
|
|
|
+import dto.DeparterAndWorkShoperVo;
|
|
|
import dto.SysNoticeVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -20,6 +26,7 @@ import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -38,15 +45,17 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
private SysConfigService sysConfigService;
|
|
|
@Autowired
|
|
|
private SrmIssuesListDao srmIssuesListDao;
|
|
|
+ @Autowired
|
|
|
+ private SysOrganizationService sysOrganizationService;
|
|
|
|
|
|
@Override
|
|
|
public void saveFishBoneImg(SrmIssuesListDo srmIssuesListDo) throws IOException {
|
|
|
- if(srmIssuesListDo.getCauseanalysisimg() != null){
|
|
|
+ if (srmIssuesListDo.getCauseanalysisimg() != null) {
|
|
|
String imgUrl = this.base64ImgSave(srmIssuesListDo.getCauseanalysisimg());
|
|
|
srmIssuesListDo.setCauseanalysisimg(imgUrl.split("@_@")[0]);
|
|
|
srmIssuesListDo.setCauseanalysisimgurl(imgUrl.split("@_@")[1]);
|
|
|
}
|
|
|
- if(srmIssuesListDo.getUndetectedanalysisimg() != null){
|
|
|
+ if (srmIssuesListDo.getUndetectedanalysisimg() != null) {
|
|
|
String imgUrl = this.base64ImgSave(srmIssuesListDo.getUndetectedanalysisimg());
|
|
|
srmIssuesListDo.setUndetectedanalysisimg(imgUrl.split("@_@")[0]);
|
|
|
srmIssuesListDo.setUndetectedanalysisimgurl(imgUrl.split("@_@")[1]);
|
|
@@ -56,7 +65,7 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
|
|
|
private String base64ImgSave(String imgContent) throws IOException {
|
|
|
// 替换到头部标识信息
|
|
|
- imgContent = imgContent.replace("data:image/png;base64,","");
|
|
|
+ imgContent = imgContent.replace("data:image/png;base64,", "");
|
|
|
// 获取存储文件路径
|
|
|
String fileRootPath = sysConfigService.getContentByConfigCode("fileRootPath");
|
|
|
String fileName = SecurityUtil.getUUID() + ".png";
|
|
@@ -83,7 +92,7 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
sysFileItemDo.setFilefolderid("83968772af5042f4b09168e1ee74eac8");
|
|
|
sysFileItemDo.setRelationid("83968772af5042f4b09168e1ee74eac8");
|
|
|
sysFileItemDo.setFullpath(imgPath);
|
|
|
- sysFileItemDo.setUrlpath("/files/mindImg/"+fileName);
|
|
|
+ sysFileItemDo.setUrlpath("/files/mindImg/" + fileName);
|
|
|
sysFileItemDo.setExtends1("files");
|
|
|
sysFileItemDo.setDeleted("0");
|
|
|
sysFileItemDo.setCreatedate(DateUtil.date());
|
|
@@ -102,10 +111,11 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
|
|
|
/**
|
|
|
* 获取问题列表
|
|
|
+ *
|
|
|
* @param mesIds
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<SrmIssuesListDo> getListByMesId(List<String> mesIds){
|
|
|
+ public List<SrmIssuesListDo> getListByMesId(List<String> mesIds) {
|
|
|
return srmIssuesListDao.getListByMesId(mesIds);
|
|
|
}
|
|
|
|
|
@@ -114,7 +124,7 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
//查询需要推送和修改的消息
|
|
|
List<SysNoticeVo> list = this.baseMapper.selectNoticeByProduct();
|
|
|
//没有消息,直接结束
|
|
|
- if (list.size() <= 0){
|
|
|
+ if (list.size() <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
//有消息将消息的NOTIFYTYPE改为production_overdue
|
|
@@ -125,8 +135,48 @@ public class SrmIssuesListServiceImpl extends ServiceImpl<SrmIssuesListDao, SrmI
|
|
|
String title = sysNoticeVo.getNotifytitle();
|
|
|
String content = sysNoticeVo.getNotifycontent();
|
|
|
List<String> userIdList = Arrays.asList(sysNoticeVo.getRecipientIds().split(","));
|
|
|
- CXCommonUtils.pushApp(title,content,userIdList);
|
|
|
+ CXCommonUtils.pushApp(title, content, userIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R getUsersDepartBmzAndCjzr() {
|
|
|
+ SysUserVo currentUser = CXCommonUtils.getCurrentUser();
|
|
|
+ //获取当前用户的部门信息
|
|
|
+ SysOrganizationVo sysOrganizationVo = currentUser.getOrganizationDoList().get(0);
|
|
|
+ //==========开始溯源=============
|
|
|
+ //最终的车间ID
|
|
|
+ String endOrgId = "";
|
|
|
+ //如果当前用户的部门本身为 chejian 等级,溯源结果为当前车间
|
|
|
+ if (ObjectUtil.isNotEmpty(sysOrganizationVo.getOrgtype()) && sysOrganizationVo.getOrgtype().equals("chejian")) {
|
|
|
+ endOrgId = sysOrganizationVo.getId();
|
|
|
+ } else if (sysOrganizationVo.getPid().equals("-1")) {
|
|
|
+ endOrgId = "";
|
|
|
+ } else {
|
|
|
+ //迭代 溯源 chejian 部门
|
|
|
+ endOrgId = selectChejian(sysOrganizationVo.getPid());
|
|
|
+ }
|
|
|
+ List<DeparterAndWorkShoperVo> res = new LinkedList<>();
|
|
|
+ //查询对应部门 以及子部门 的 部门长和车间主任
|
|
|
+ if (ObjectUtil.isNotEmpty(endOrgId)) {
|
|
|
+ res = this.baseMapper.selectDeparterAndWorkShoper(endOrgId);
|
|
|
}
|
|
|
|
|
|
+ return R.ok(res);
|
|
|
+ }
|
|
|
+
|
|
|
+ String selectChejian(String startDepartId) {
|
|
|
+ if (ObjectUtil.isEmpty(startDepartId)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ SysOrganizationDo sysOrganizationDo = sysOrganizationService.getById(startDepartId);
|
|
|
+ if (ObjectUtil.isNotEmpty(sysOrganizationDo.getOrgtype()) && sysOrganizationDo.getOrgtype().equals("chejian")) {
|
|
|
+ return sysOrganizationDo.getId();
|
|
|
+ } else if (sysOrganizationDo.getPid().equals("-1")) {
|
|
|
+ return "";
|
|
|
+ } else {
|
|
|
+ return selectChejian(sysOrganizationDo.getPid());
|
|
|
+ }
|
|
|
}
|
|
|
}
|