|
@@ -1,5 +1,6 @@
|
|
package com.fs.qw.controller;
|
|
package com.fs.qw.controller;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.fs.common.annotation.Log;
|
|
import com.fs.common.annotation.Log;
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.controller.BaseController;
|
|
@@ -16,19 +17,27 @@ import com.fs.framework.web.service.TokenService;
|
|
import com.fs.his.vo.OptionsVO;
|
|
import com.fs.his.vo.OptionsVO;
|
|
import com.fs.qw.domain.QwSopUpdateStatus;
|
|
import com.fs.qw.domain.QwSopUpdateStatus;
|
|
import com.fs.qw.service.IQwUserService;
|
|
import com.fs.qw.service.IQwUserService;
|
|
|
|
+import com.fs.qw.vo.QwUserVO;
|
|
import com.fs.sop.domain.QwSop;
|
|
import com.fs.sop.domain.QwSop;
|
|
|
|
+import com.fs.sop.domain.QwSopTempContent;
|
|
|
|
+import com.fs.sop.domain.QwSopTempVoice;
|
|
import com.fs.sop.params.QwSopAutoTime;
|
|
import com.fs.sop.params.QwSopAutoTime;
|
|
import com.fs.sop.params.QwSopEditQwUserParam;
|
|
import com.fs.sop.params.QwSopEditQwUserParam;
|
|
import com.fs.sop.service.IQwSopService;
|
|
import com.fs.sop.service.IQwSopService;
|
|
|
|
+import com.fs.sop.service.IQwSopTempContentService;
|
|
|
|
+import com.fs.sop.service.IQwSopTempVoiceService;
|
|
import com.fs.sop.vo.SopVoiceListVo;
|
|
import com.fs.sop.vo.SopVoiceListVo;
|
|
|
|
+import org.apache.commons.beanutils.ConvertUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 企微sopController
|
|
* 企微sopController
|
|
@@ -52,6 +61,12 @@ public class QwSopController extends BaseController
|
|
private FsUserCourseMapper fsUserCourseMapper;
|
|
private FsUserCourseMapper fsUserCourseMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQwSopTempContentService qwSopTempContentService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQwSopTempVoiceService voiceService;
|
|
/**
|
|
/**
|
|
* 查询企微sop列表
|
|
* 查询企微sop列表
|
|
*/
|
|
*/
|
|
@@ -133,11 +148,62 @@ public class QwSopController extends BaseController
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
qwSop.setCreateBy(loginUser.getUser().getNickName());
|
|
qwSop.setCreateBy(loginUser.getUser().getNickName());
|
|
qwSop.setCreateTime(sdf.format(new Date()));
|
|
qwSop.setCreateTime(sdf.format(new Date()));
|
|
-
|
|
|
|
|
|
+ int count = qwSopService.insertQwSop(qwSop);
|
|
|
|
+ if(count > 0){
|
|
|
|
+ if(qwSop.getQwUserIds() != null){
|
|
|
|
+ updateTempVoiceInfo(qwSop);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return toAjax(qwSopService.insertQwSop(qwSop));
|
|
return toAjax(qwSopService.insertQwSop(qwSop));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 修改qwSop任务,新增或者删除qwUser
|
|
|
|
+ * @param qwSop
|
|
|
|
+ */
|
|
|
|
+ private void updateTempVoiceInfo(QwSop qwSop) {
|
|
|
|
+ try {
|
|
|
|
+ String tempId = qwSop.getTempId();
|
|
|
|
+ String[] split = qwSop.getQwUserIds().split(",");
|
|
|
|
+ Long[] qwUserIds = (Long[]) ConvertUtils.convert(split, Long.class);
|
|
|
|
+
|
|
|
|
+ List<QwSopTempContent> qwSopTempContentList = qwSopTempContentService.selectQwSopTempContentByTempId(tempId);
|
|
|
|
+ if(qwSopTempContentList != null && !qwSopTempContentList.isEmpty()){
|
|
|
|
+ for (QwSopTempContent qwSopTemp : qwSopTempContentList) {
|
|
|
|
+ if(qwSopTemp != null && qwSopTemp.getContent() != null){
|
|
|
|
+ String content = qwSopTemp.getContent();
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
|
+ String voiceTxt = jsonObject.getString("value");
|
|
|
|
+ String contentType = jsonObject.getString("contentType");
|
|
|
|
+ if("7".equals(contentType)){
|
|
|
|
+ List<QwUserVO> qwUserVoS = qwUserService.selectQwUserVOByIds(qwUserIds);
|
|
|
|
+ if(qwUserVoS != null && !qwUserVoS.isEmpty()){
|
|
|
|
+ List<Long> companyUserIdList = qwUserVoS.stream().map(QwUserVO::getCompanyUserId).collect(Collectors.toList());
|
|
|
|
+ for (Long companyUserId : companyUserIdList) {
|
|
|
|
+ QwSopTempVoice qwSopTempVoice = voiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(companyUserId,voiceTxt);
|
|
|
|
+ if(qwSopTempVoice == null){
|
|
|
|
+ if(companyUserId != null && voiceTxt != null){
|
|
|
|
+ QwSopTempVoice tempVoice = new QwSopTempVoice();
|
|
|
|
+ tempVoice.setVoiceTxt(voiceTxt);
|
|
|
|
+ tempVoice.setCompanyUserId(companyUserId);
|
|
|
|
+ tempVoice.setRecordType(0);
|
|
|
|
+ tempVoice.setCreateTime(LocalDateTime.now());
|
|
|
|
+ tempVoice.setTempId(tempId);
|
|
|
|
+ voiceService.insertQwSopTempVoice(tempVoice);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("修改企微sop任务,新增或者删除qwUser异常:" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 修改企微sop
|
|
* 修改企微sop
|
|
*/
|
|
*/
|
|
@@ -146,7 +212,14 @@ public class QwSopController extends BaseController
|
|
@PutMapping
|
|
@PutMapping
|
|
public R edit(@RequestBody QwSop qwSop)
|
|
public R edit(@RequestBody QwSop qwSop)
|
|
{
|
|
{
|
|
- return qwSopService.updateQwSop(qwSop);
|
|
|
|
|
|
+ R sop = qwSopService.updateQwSop(qwSop);
|
|
|
|
+ String code = sop.get("code").toString();
|
|
|
|
+ if(code.equals("200")){
|
|
|
|
+ if(qwSop != null && qwSop.getQwUserIds() != null){
|
|
|
|
+ updateTempVoiceInfo(qwSop);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return sop;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -201,7 +274,15 @@ public class QwSopController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('qw:sop:updateSopQwUser')")
|
|
@PreAuthorize("@ss.hasPermi('qw:sop:updateSopQwUser')")
|
|
public R updateSopQwUser(@RequestBody QwSopEditQwUserParam param)
|
|
public R updateSopQwUser(@RequestBody QwSopEditQwUserParam param)
|
|
{
|
|
{
|
|
- return qwSopService.updateSopQwUser(param);
|
|
|
|
|
|
+ R sop = qwSopService.updateSopQwUser(param);
|
|
|
|
+ String code = sop.get("code").toString();
|
|
|
|
+ if(code.equals("200")){
|
|
|
|
+ QwSop qwSop = qwSopService.selectQwSopById(param.getId());
|
|
|
|
+ if(qwSop != null && qwSop.getQwUserIds() != null){
|
|
|
|
+ updateTempVoiceInfo(qwSop);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return sop;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|