Commit e959f39b by 徐高华

企微托管

parent d3b57d7a
......@@ -12,6 +12,7 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.haoban.manage.web.qo.open.AddTaskDataQO;
import com.gic.haoban.manage.web.qo.open.AddTaskMemberPageQO;
import com.gic.haoban.manage.web.qo.open.AddTaskPageQO;
......@@ -23,6 +24,10 @@ import com.gic.haoban.task.manage.api.dto.open.*;
import com.gic.haoban.task.manage.api.qdto.open.AddTaskMemberPageQDTO;
import com.gic.haoban.task.manage.api.qdto.open.QwAddTaskPageQDTO;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordEvaluationContext;
import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import com.gic.member.tag.api.dto.MemberTagDTO;
import com.gic.member.tag.api.dto.MemberTagGroupDTO;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
......@@ -94,6 +99,7 @@ public class QywxOpenTaskController {
* @return
*/
@RequestMapping("save-add-task")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_02, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<OpenQwAddTaskDTO> saveAddTask(@RequestBody OpenQwAddTaskDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
......@@ -102,8 +108,16 @@ public class QywxOpenTaskController {
dto.setEnterpriseId(enterpriseId);
dto.setCreatorId(loginUser.getClerkId());
dto.setCreatorName(loginUser.getClerkName());
Long addTaskId = dto.getAddTaskId();
OpenQwAddTaskDTO oldDTO = null;
if (null != addTaskId) {
ServiceResponse<OpenQwAddTaskDTO> oldResp = this.openQwApiService.getAddTask(addTaskId);
oldDTO = oldResp.getResult();
}
ServiceResponse<OpenQwAddTaskDTO> resp = this.openQwApiService.saveAddTask(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
......@@ -173,11 +187,17 @@ public class QywxOpenTaskController {
* @return
*/
@RequestMapping("stop-add-task")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_02, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<Void> stopAddTask(Long addTaskId) {
ServiceResponse<Void> resp = this.openQwApiService.updateAddTaskStatus(addTaskId, 1);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
ServiceResponse<OpenQwAddTaskDTO> taskResp = this.openQwApiService.getAddTask(addTaskId);
String logContent = "终止【" + taskResp.getResult().getName() + "-" + addTaskId + "】";
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
return RestResponse.successResult();
}
......@@ -297,6 +317,7 @@ public class QywxOpenTaskController {
* @return
*/
@RequestMapping("save-add-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<OpenQwAddTaskSettingDTO> saveTaskSetting(@RequestBody OpenQwAddTaskSettingDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
......@@ -335,16 +356,53 @@ public class QywxOpenTaskController {
* @return
*/
@RequestMapping("save-del-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_DEL, optType = GicLogRecordOptTypeEnum.QW_DEL_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动删好友")
public RestResponse<OpenQwDelTaskDTO> saveDelTaskSetting(@RequestBody OpenQwDelTaskDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenQwDelTaskDTO> oldResp = this.openQwApiService.getDelTask(wxEnterpriseId, enterpriseId);
OpenQwDelTaskDTO oldDTO = null;
if (null != oldResp.getResult()) {
oldDTO = oldResp.getResult();
}
ServiceResponse<OpenQwDelTaskDTO> resp = this.openQwApiService.saveDelTask(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
if (null != oldDTO) {
String logContent1 = "";
String logContent2 = "";
String logContent3 = "";
String oldAddTime = oldDTO.getAddTime();
String newAddTime = dto.getAddTime();
if (!oldAddTime.equals(newAddTime)) {
logContent1 = "删除时段从【" + oldAddTime + "】修改为【" + newAddTime + "】 ";
}
String oldInt = oldDTO.getAddIntervalStart() + "-" + oldDTO.getAddIntervalEnd();
String newInt = dto.getAddIntervalStart() + "-" + dto.getAddIntervalEnd();
if (!oldInt.equals(newInt)) {
logContent2 = "删除间隔从【" + oldInt + "】修改为【" + newInt + "】 ";
}
int oldOpenFlag = oldDTO.getOpenFlag();
int newOpenFlag = dto.getOpenFlag();
if (oldOpenFlag != newOpenFlag) {
if (newOpenFlag == 1) {
logContent3 = "状态从【停用自动删除】修改为【启用自动删除】 ";
} else {
logContent3 = "状态从【启用自动删除】修改为【停用自动删除】 ";
}
}
if (StringUtils.isNotBlank(logContent1) || StringUtils.isNotBlank(logContent2) || StringUtils.isNotBlank(logContent3)) {
GicLogRecordEvaluationContext.putAttribute("logValue", logContent1 + logContent2 + logContent3);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
return RestResponse.successResult(resp.getResult());
}
......@@ -373,16 +431,67 @@ public class QywxOpenTaskController {
* @return
*/
@RequestMapping("save-auto-send-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_AUTO_SEND, optType = GicLogRecordOptTypeEnum.QW_AUTO_SEND_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-任务自动执行")
public RestResponse<OpenQwAutoSendDTO> saveAutoSendTaskSetting(@RequestBody OpenQwAutoSendDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenQwAutoSendDTO> oldResp = this.openQwApiService.getAutoSend(wxEnterpriseId, enterpriseId);
OpenQwAutoSendDTO oldDTO = null;
if (null != oldResp.getResult()) {
oldDTO = oldResp.getResult();
}
ServiceResponse<OpenQwAutoSendDTO> resp = this.openQwApiService.saveAutoSend(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
if (null != oldDTO) {
int oldOpenFlag = oldDTO.getOpenFlag();
int newOpenFlag = dto.getOpenFlag();
String logContent1 = "";
if (oldOpenFlag != newOpenFlag) {
if (newOpenFlag == 1) {
logContent1 = "任务从【关闭】修改为【启用】";
} else {
logContent1 = "任务从【启用】修改为【关闭】";
}
}
String logContent2 = "";
String oldType = "";
String newType = "";
String oldSendType = oldDTO.getSendType();
String newSendType = dto.getSendType();
if (oldSendType.contains("1")) {
oldType += "客户群发";
}
if (newSendType.contains("1")) {
newType += "客户群发";
}
if (oldSendType.contains("2")) {
if (StringUtils.isNotBlank(oldType)) {
oldType += "、";
}
oldType += "社群群发";
}
if (newSendType.contains("2")) {
if (StringUtils.isNotBlank(newType)) {
newType += "、";
}
newType += "社群群发";
}
if (!oldType.equals(newType)) {
logContent2 += "执行消息类型从【" + oldType + "】修改为【" + newType + "】";
}
if (StringUtils.isNotBlank(logContent1) || StringUtils.isNotBlank(logContent2)) {
GicLogRecordEvaluationContext.putAttribute("logValue", logContent1 + " " + logContent2);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
return RestResponse.successResult(resp.getResult());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment