Commit b4c93ca8 by liyanlin

fix

parent 3d75cc0e
...@@ -83,12 +83,10 @@ public class FinalCheckState extends CostState { ...@@ -83,12 +83,10 @@ public class FinalCheckState extends CostState {
" \"msgtype\": \"markdown\",\n" + " \"msgtype\": \"markdown\",\n" +
" \"markdown\": {\n" + " \"markdown\": {\n" +
" \"content\": \"单号【<font color=\\\"info\\\">%s</font>】通过人工操作最终审核。\\n" + " \"content\": \"单号【<font color=\\\"info\\\">%s</font>】通过人工操作最终审核。\\n" +
">金额: <font color=\\\"info\\\">%s</font>\\n" +
">审核人: <font color=\\\"info\\\">%s</font>\\n" + ">审核人: <font color=\\\"info\\\">%s</font>\\n" +
">审核时间: <font color=\\\"info\\\">%s</font>\"" + ">审核时间: <font color=\\\"info\\\">%s</font>\"" +
" }\n" + " }\n" +
"}", costDomain.getCostNo(), "}", costDomain.getCostNo(),
"CNY " + costDomain.getAmountRmb(),
userDomain == null ? currentUserId : userDomain.getUsername(), userDomain == null ? currentUserId : userDomain.getUsername(),
LocalDateTime.now().format(dtf)); LocalDateTime.now().format(dtf));
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
......
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.config.property.WxWebHook;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.database.model.CostCompanyDomain; import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.database.model.CostLogDomain; import com.blt.other.database.model.CostLogDomain;
import com.blt.other.database.model.UserDomain;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper; import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.model.ApprovalHistoryDomain; import com.blt.other.module.cost.model.ApprovalHistoryDomain;
...@@ -13,11 +16,15 @@ import com.blt.other.module.cost.model.CostTemplate; ...@@ -13,11 +16,15 @@ import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.service.ApprovalHistoryService; import com.blt.other.module.cost.service.ApprovalHistoryService;
import com.blt.other.module.sys.model.CostReviewer; import com.blt.other.module.sys.model.CostReviewer;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -43,6 +50,30 @@ public class FinancialCheckState extends CostState { ...@@ -43,6 +50,30 @@ public class FinancialCheckState extends CostState {
@Resource @Resource
ApprovalHistoryService approvalHistoryService; ApprovalHistoryService approvalHistoryService;
@Resource
WxWebHook webHook;
@Resource
RestTemplate restTemplate;
@Resource
UserDao userDao;
private void sendWxMsg(CostDomain costDomain, Integer currentUserId) {
UserDomain userDomain = userDao.selectByuserid(currentUserId);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String msg = String.format("{\n" +
" \"msgtype\": \"markdown\",\n" +
" \"markdown\": {\n" +
" \"content\": \"单号【<font color=\\\"info\\\">%s</font>】通过人工操作财务审核。\\n" +
">审核人: <font color=\\\"info\\\">%s</font>\\n" +
">审核时间: <font color=\\\"info\\\">%s</font>\"" +
" }\n" +
"}", costDomain.getCostNo(),
userDomain == null ? currentUserId : userDomain.getUsername(),
LocalDateTime.now().format(dtf));
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
restTemplate.postForEntity(webHook.getUrl() + webHook.getFinalReview(), msg, Object.class);
}
@Override @Override
void nextState(CostState costState) { void nextState(CostState costState) {
super.nextState(costState); super.nextState(costState);
...@@ -95,7 +126,7 @@ public class FinancialCheckState extends CostState { ...@@ -95,7 +126,7 @@ public class FinancialCheckState extends CostState {
costDao.updateById(costDomain); costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.FINANCIAL_MANUAL_PASS); costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.FINANCIAL_MANUAL_PASS);
sendWxMsg(costDomain, currentUserId);
approvalHistoryService.save(approvalHistoryDomain); approvalHistoryService.save(approvalHistoryDomain);
//流转状态 //流转状态
nextState(finalCheckState); nextState(finalCheckState);
......
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