Merge remote-tracking branch 'origin/master'

master
mengjiao 8 months ago
commit 775727698e

@ -46,6 +46,34 @@ public class SysNoticeGroup extends BaseEntity {
private String[] groupNames; private String[] groupNames;
private String userCode;
private String noticeContent;
private String wxId;
public String getWxId() {
return wxId;
}
public void setWxId(String wxId) {
this.wxId = wxId;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getNoticeContent() {
return noticeContent;
}
public void setNoticeContent(String noticeContent) {
this.noticeContent = noticeContent;
}
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }

@ -434,7 +434,8 @@
select shift_code shiftId,min(change_time) startTime,work_date,device_code deviceCode select shift_code shiftId,min(change_time) startTime,work_date,device_code deviceCode
from mes_changeshift_info from mes_changeshift_info
where device_code = #{equipmentCode} where device_code = #{equipmentCode}
and CONVERT(varchar(10),change_time, 120) in (${ymd}) <!--and CONVERT(varchar(10),change_time, 120) in (${ymd})-->
and work_date in (${ymd})
group by shift_code,work_date,device_code group by shift_code,work_date,device_code
) t order by t.startTime ) t order by t.startTime
</select> </select>

@ -2,11 +2,14 @@ package com.op.quality.mapper;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import com.op.quality.domain.*; import com.op.quality.domain.*;
import com.op.system.api.domain.SysDictData; import com.op.system.api.domain.SysDictData;
import com.op.system.api.domain.SysNoticeGroup;
import com.op.system.api.domain.SysUser; import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.quality.QcUserMaterialDTO; import com.op.system.api.domain.quality.QcUserMaterialDTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -114,4 +117,13 @@ public interface QcCheckTaskIncomeMapper {
List<QcDefectType> getCheckLocList(QcDefectType qcDefectType); List<QcDefectType> getCheckLocList(QcDefectType qcDefectType);
List<String> getTodayIncomeLists(); List<String> getTodayIncomeLists();
List<SysNoticeGroup> getNotices(SysNoticeGroup noticeQo);
List<String> getWxId(@Param("list") List<String> users);
@MapKey("userCode")
Map<String,SysUser> getWxIdMap(List<String> userCodes);
List<SysNoticeGroup> getNoticesGroup(SysNoticeGroup noticeQo);
} }

@ -17,7 +17,10 @@ import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*; import com.op.quality.domain.*;
import com.op.quality.mapper.*; import com.op.quality.mapper.*;
import com.op.quality.service.*; import com.op.quality.service.*;
import com.op.system.api.RemoteOpenService;
import com.op.system.api.domain.SysNoticeGroup;
import com.op.system.api.domain.SysUser; import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.quality.QcUserMaterialDTO; import com.op.system.api.domain.quality.QcUserMaterialDTO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -66,8 +69,8 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
@Autowired @Autowired
private IQcCheckTaskUserService qcCheckTaskUserService; private IQcCheckTaskUserService qcCheckTaskUserService;
// @Autowired @Autowired
// private RemoteOpenService remoteOpenService; private RemoteOpenService remoteOpenService;
@Autowired @Autowired
private QMSFileMapper qmsFileMapper; private QMSFileMapper qmsFileMapper;
@ -192,6 +195,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
//String typeCode = qcCheckTaskIncomeMapper.getTypeCode(qcCheckTaskIncome.getCheckType()); //String typeCode = qcCheckTaskIncomeMapper.getTypeCode(qcCheckTaskIncome.getCheckType());
qcCheckTaskIncome.setTypeCode("material");//大检验节点 qcCheckTaskIncome.setTypeCode("material");//大检验节点
/**qc_task_user start**/ /**qc_task_user start**/
List<QcUserMaterialDTO> users = null;
if(StringUtils.isNotBlank(qcCheckTaskIncome.getCheckManName())){//管理系统创建任务 if(StringUtils.isNotBlank(qcCheckTaskIncome.getCheckManName())){//管理系统创建任务
String checkManName = qcCheckTaskIncome.getCheckManName(); String checkManName = qcCheckTaskIncome.getCheckManName();
String checkManCode = qcCheckTaskIncome.getCheckManCode(); String checkManCode = qcCheckTaskIncome.getCheckManCode();
@ -216,7 +220,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qcCheckTaskIncome.setCheckManName(""); qcCheckTaskIncome.setCheckManName("");
qcCheckTaskIncome.setCheckManCode(""); qcCheckTaskIncome.setCheckManCode("");
/**qc_user_material取默认检查人**/ /**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getCheckUser(qcCheckTaskIncome); users = qcCheckTaskIncomeMapper.getCheckUser(qcCheckTaskIncome);
if(CollectionUtils.isEmpty(users)){ if(CollectionUtils.isEmpty(users)){
QcUserMaterialDTO dto0 = new QcUserMaterialDTO(); QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
dto0.setId(IdUtils.fastSimpleUUID()); dto0.setId(IdUtils.fastSimpleUUID());
@ -264,7 +268,37 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
item.setFactoryCode(factoryCode); item.setFactoryCode(factoryCode);
item.setStatus("N"); item.setStatus("N");
} }
return qcCheckTaskDetailMapper.addBatch(items); int s = qcCheckTaskDetailMapper.addBatch(items);
//发企业微信--------------------开始(跟班组无关)
SysNoticeGroup noticeQo = new SysNoticeGroup();
noticeQo.setNoticeId(6L);
List<SysNoticeGroup> notices = qcCheckTaskIncomeMapper.getNotices(noticeQo);
if(!CollectionUtils.isEmpty(notices)) {
List<WechartDTO> wecharts = new ArrayList<>();
//去主库查微信id
DynamicDataSourceContextHolder.push("master");// 这是数据源的key
List<String> userCodes = users.stream()
.map(QcUserMaterialDTO::getUserCode)
.collect(Collectors.toList());
List<String> wxids = qcCheckTaskIncomeMapper.getWxId(userCodes);
for (String wxid : wxids) {
WechartDTO wechart0 = new WechartDTO();
wechart0.setUserId(wxid);
wechart0.setText(notices.get(0).getNoticeContent());
wecharts.add(wechart0);
}
logger.info("来料检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("来料检验企业微信提醒结果:" + JSONObject.toJSONString(result));
}).start();
}
//发企业微信--------------------结束
}
return s;
} }
/** /**
@ -583,7 +617,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public int commitCheckResults(QcCheckTaskIncome qcCheckTaskIncome) { public int commitCheckResults(QcCheckTaskIncome qcCheckTaskIncome) {
List<QcCheckTaskDetail> details = qcCheckTaskIncome.getQcCheckTaskDetails(); List<QcCheckTaskDetail> details = qcCheckTaskIncome.getQcCheckTaskDetails();
@ -780,6 +814,45 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
unqualified.setUser("999999"); unqualified.setUser("999999");
qcCheckUnqualifiedService.updateQcCheckUnqualified(unqualified); qcCheckUnqualifiedService.updateQcCheckUnqualified(unqualified);
} }
//发企业微信--------------------开始(跟班组有关)
SysNoticeGroup noticeQo = new SysNoticeGroup();
noticeQo.setNoticeId(9L);
List<SysNoticeGroup> notices = qcCheckTaskIncomeMapper.getNoticesGroup(noticeQo);
if(!CollectionUtils.isEmpty(notices)) {
List<WechartDTO> wecharts = new ArrayList<>();
//去主库查微信id
DynamicDataSourceContextHolder.push("master");// 这是数据源的key
List<String> userCodes = notices.stream()
.map(SysNoticeGroup::getUserCode)
.collect(Collectors.toList());
//Map<String, SysUser> wxidsMap = qcCheckTaskIncomeMapper.getWxIdMap(userCodes);
for (SysNoticeGroup noticedto : notices) {
// SysUser sysUser = wxidsMap.get(noticedto.getUserCode());
// if (sysUser != null) {
WechartDTO wechart0 = new WechartDTO();
wechart0.setUserId(noticedto.getWxId());
String contentInfo = noticedto.getNoticeContent();
contentInfo = contentInfo.replace("${materialCode}", qcCheckTaskIncome.getMaterialCode())
.replace("${materialName}", qcCheckTaskIncome.getMaterialName())
//.replace("${incomeBatchNo}", qcCheckTaskIncome.getIncomeBatchNo())
//.replace("${orderNo}", qcCheckTaskIncome.getOrderNo())
;
wechart0.setText(contentInfo);
wecharts.add(wechart0);
//}
}
logger.info("来料检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
AjaxResult wxresult = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("来料检验企业微信提醒结果:" + JSONObject.toJSONString(wxresult));
}).start();
}
//发企业微信--------------------结束
}
} }
return 1 ; return 1 ;
} }

@ -476,6 +476,42 @@
where check_type = 'checkTypeLL' where check_type = 'checkTypeLL'
and CONVERT(varchar(10),GETDATE(), 120) = CONVERT(varchar(10),create_time, 120) and CONVERT(varchar(10),GETDATE(), 120) = CONVERT(varchar(10),create_time, 120)
</select> </select>
<select id="getNotices" resultType="com.op.system.api.domain.SysNoticeGroup">
select
sn.notice_title noticeTitle,
sn.notice_type noticeType,
sn.notice_content noticeContent
from sys_notice sn
where sn.notice_id = #{noticeId}
</select>
<select id="getNoticesGroup" resultType="com.op.system.api.domain.SysNoticeGroup">
select sng.notice_id noticeId,
sn.notice_title noticeTitle,
sn.notice_type noticeType,
sn.notice_content noticeContent,
btu.user_name userCode,
btu.wx_id wxId
from sys_notice_group sng
left join sys_notice sn on sng.notice_id = sn.notice_id
left join base_team_user btu on sng.group_code = btu.team_code
where sng.notice_id = #{noticeId}
</select>
<select id="getWxId" resultType="java.lang.String">
select wx_id from sys_user where del_flag = '0' and wx_id is not null
and user_name in
<foreach item="userCode" collection="list" open="(" separator="," close=")">
#{userCode}
</foreach>
</select>
<select id="getWxIdMap" resultType="com.op.system.api.domain.SysUser">
select wx_id wxId,
user_name userCode
from sys_user where del_flag = '0' and wx_id is not null
and user_name in
<foreach item="userCode" collection="list" open="(" separator="," close=")">
#{userCode}
</foreach>
</select>
<!--批量更新原始表--> <!--批量更新原始表-->
<update id="updateIncomeBatchList"> <update id="updateIncomeBatchList">

@ -311,11 +311,11 @@ public class SysUserServiceImpl implements ISysUserService {
userPostMapper.deleteUserPostByUserId(userId); userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理 // 新增用户与岗位管理
insertUserPost(user); insertUserPost(user);
// 加工厂数据权限 // // 加工厂数据权限(会把之前分配的给覆盖掉有问题)
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName"; // String key = "#header.poolName";
user.setDeptId(Long.parseLong(request.getHeader(key.substring(8)).replace("ds_",""))); // user.setDeptId(Long.parseLong(request.getHeader(key.substring(8)).replace("ds_","")));
insertUserDB(user); // insertUserDB(user);
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }

Loading…
Cancel
Save