|
@@ -1,5 +1,6 @@
|
|
package com.fs.company.controller.qw;
|
|
package com.fs.company.controller.qw;
|
|
|
|
|
|
|
|
+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;
|
|
@@ -17,21 +18,29 @@ import com.fs.framework.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.ICompanySopRoleService;
|
|
import com.fs.sop.service.ICompanySopRoleService;
|
|
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.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 企微sopController
|
|
* 企微sopController
|
|
@@ -64,6 +73,13 @@ public class QwSopController extends BaseController
|
|
@Autowired
|
|
@Autowired
|
|
private IQwUserService iQwUserService;
|
|
private IQwUserService iQwUserService;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQwSopTempContentService qwSopTempContentService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQwSopTempVoiceService voiceService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询企微sop列表
|
|
* 查询企微sop列表
|
|
*/
|
|
*/
|
|
@@ -228,7 +244,12 @@ public class QwSopController extends BaseController
|
|
qwSop.setCompanyId(companyId);
|
|
qwSop.setCompanyId(companyId);
|
|
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));
|
|
|
|
|
|
}
|
|
}
|
|
@@ -241,7 +262,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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -267,6 +295,52 @@ public class QwSopController extends BaseController
|
|
return toAjax(qwSopService.updateAutoSopTime(param));
|
|
return toAjax(qwSopService.updateAutoSopTime(param));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 修改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
|
|
*/
|
|
*/
|
|
@@ -307,7 +381,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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|