调整线索;调整任务时间

This commit is contained in:
DB 2024-04-02 11:18:55 +08:00
parent 761a2f08d4
commit 7b7efa1369
19 changed files with 193 additions and 30 deletions

View File

@ -120,4 +120,5 @@ public class CloudCustomerStudentHandler {
return page;
}
}
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cpop.api.cloudDb.core.dto.CloudClassCardDto;
import com.cpop.api.cloudDb.handler.CloudClassCardHandler;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.common.utils.http.HttpUtils;
@ -1078,6 +1079,36 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
this.updateChain().set(EASY_LEARN_ORDER.OUT_ORDER_NO, map.get("transaction_id"))
.set(EASY_LEARN_ORDER.ORDER_STATUS, 1)
.where(EASY_LEARN_ORDER.ID.eq(orderId)).update();
//发送通知到财务群
List<String> phoneList = new ArrayList<String>();
// 获取审核管理员手机号
RedisService redisService = SpringUtils.getBean(RedisService.class);
String auditStaffPhone = redisService.getCacheObject("sysConfig:oam:OamCancelAfterVerificationStaffPhone");
phoneList.add(auditStaffPhone);
try {
//获取品牌和校区信息
Row brandAndStore = Db.selectOneByQuery("cp_sys_store", QueryWrapper.create()
.select("css.store_name")
.select("csb.brand_name")
.from("cp_sys_store").as("css")
.leftJoin("cp_sys_brand").as("csb").on("csb.id = css.brand_id")
.where("css.id= ?", easyLearnOrder.getStoreId()));
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText("a885058b-2478-4df8-bdb7-2bb94a08c1f5", phoneList,
"==========用户订单到账==========" +
"\n订单创建时间:" + easyLearnOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) +
"\n品牌:" + brandAndStore.getString("brandName") +
"\n校区:" + brandAndStore.getString("storeName") +
"\n订单类型:" + easyLearnOrder.getOrderType() +
"\n受益人:" + easyLearnOrder.getCustomerName() +
"\n电话:" + easyLearnOrder.getCustomerPhone() +
"\n订单金额:" + easyLearnOrder.getTotalAmount() +
"\n到账金额:" + easyLearnOrder.getTotalPayAmount() +
"\n微信订单号:" + map.get("transaction_id") +
"\n商户号:1618436087",
false);
} catch (IOException e) {
throw new ServiceException("发送任务通知失败!");
}
return wxPayNormalHandler.success();
} else {
// 签名校验失败可能不是微信服务器发出的数据

View File

@ -26,8 +26,8 @@ class CpopMallWebApplicationTests {
*/
@Test
public void initKeyPair() {
String publicFileUrl = "E:\\Cpop\\Cpop-Union\\Cpop-Mall\\Cpop-Mall-Web\\src\\main\\resources\\static\\keyPair\\publicKey";
String privateFileUrl = "E:\\Cpop\\Cpop-Union\\Cpop-Mall\\Cpop-Mall-Web\\src\\main\\resources\\static\\keyPair\\privateKey";
String publicFileUrl = "E:/Cpop/Jambox-Union/Jambox-Core/src/main/resources/static/keypair/publicKey";
String privateFileUrl = "E:/Cpop/Jambox-Union/Jambox-Core/src/main/resources/static/keypair/privateKey";
Map<String, String> keyPairMap = rsaUtils.initKeyPair(publicFileUrl,privateFileUrl);
String publicKey = keyPairMap.get("publicKey");
String privateKey = keyPairMap.get("privateKey");

View File

@ -137,7 +137,7 @@ public class CpopWxPayTests {
public void getOrderInfo() throws WxPayException {
WxPayConfig config = wxPayService.getConfig();
config.setSubMchId("1661323640");
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002123202312279635916930", null);
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002096202401188599394121", null);
System.out.println(JSONObject.toJSONString(wxPayOrderQueryResult));
}
@ -150,7 +150,7 @@ public class CpopWxPayTests {
@Test
public void getSharingInfo() throws WxPayException {
ProfitSharingQueryRequest profitSharingQueryRequest = new ProfitSharingQueryRequest();
profitSharingQueryRequest.setOutOrderNo("1736629608413073417").setTransactionId("4200002123202312279635916930");
profitSharingQueryRequest.setOutOrderNo("1736629608413073412").setTransactionId("4200002096202401188599394121");
profitSharingQueryRequest.setSubMchId("1661323640");
ProfitSharingQueryResult result = wxPayService.getProfitSharingService().profitSharingQuery(profitSharingQueryRequest);
System.out.println(result.getResultCode());

View File

@ -5,6 +5,13 @@ import com.cpop.api.tencent.location.handler.TencentLocationHandler;
import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils;
import com.cpop.jambox.business.entity.StoreExtend;
import com.cpop.jambox.business.service.StoreExtendService;
import com.cpop.oam.business.entity.Clue;
import com.cpop.oam.business.service.ClueService;
import com.cpop.system.business.entity.Store;
import com.cpop.system.business.service.StoreService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowKey;
@ -12,6 +19,11 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
/**
* @author DB
@ -51,4 +63,6 @@ public class CpopClueTests {
clueRecord.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
Db.insert("cp_oam_clue_record",clueRecord);
}
}

View File

@ -11,9 +11,11 @@ import com.cpop.jambox.business.service.BrandExtendService;
import com.cpop.jambox.business.service.CardTemplateExtendService;
import com.cpop.jambox.business.service.CardTemplateService;
import com.cpop.jambox.business.service.StoreExtendService;
import com.cpop.oam.business.entity.Clue;
import com.cpop.oam.business.entity.Task;
import com.cpop.oam.business.entity.TaskWorkOrder;
import com.cpop.oam.business.mapper.TaskWorkOrderMapper;
import com.cpop.oam.business.service.ClueService;
import com.cpop.oam.business.service.TaskService;
import com.cpop.oam.business.service.TaskWorkOrderService;
import com.cpop.system.business.entity.Store;
@ -351,4 +353,41 @@ public class CpopDataSyncTests {
});
}
@Test
public void syncClueData(){
//查询已有线索
ClueService clueService = SpringUtils.getBean(ClueService.class);
List<Clue> clueList = clueService.list();
//查询校区
List<Store> storeList = SpringUtils.getBean(StoreService.class).list(QueryWrapper.create()
.where(STORE.ID.notIn(clueList.stream().map(Clue::getStoreId).collect(Collectors.toList()))));
//设置校区信息
List<StoreExtend> storeExtends = SpringUtils.getBean(StoreExtendService.class).list(
QueryWrapper.create().where(STORE_EXTEND.STORE_ID.in(storeList.stream().map(Store::getId).collect(Collectors.toList()))));
//查询旧库信息
List<Row> rowList;
try {
DataSourceKey.use("jambox");
rowList = DbChain.table("t_mechanism_info")
.select("city","store_id as storeCloudId")
.from("t_mechanism_info")
.in("store_id",storeExtends.stream().map(StoreExtend::getStoreCloudId).collect(Collectors.toSet()))
.list();
} finally {
DataSourceKey.clear();
}
Map<String, String> collect = storeExtends.stream().collect(Collectors.toMap(StoreExtend::getStoreCloudId, StoreExtend::getStoreId));
ArrayList<Clue> clues = new ArrayList<>();
rowList.forEach(item->{
String storeId = collect.get(item.getString("storeCloudId"));
if (StringUtils.isNotBlank(storeId)) {
Clue clue = new Clue();
clue.setCity(item.getString("city"))
.setStoreId(storeId);
clues.add(clue);
}
});
SpringUtils.getBean(ClueService.class).saveBatch(clues);
}
}

View File

@ -2,19 +2,20 @@ package com.cpop.oam.web;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cpop.api.cloudDb.core.constant.CloudDbUrl;
import com.cpop.core.utils.SpringUtils;
import com.cpop.pay.framewok.handler.wxPay.WxPayHandler;
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowKey;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
@ -50,7 +51,8 @@ public class CpopEasyLearnDataAnalyseTest{
.select("out_order_no")
.select("create_time")
.from("j_wx_pay_profit_sharing")
.where("create_time >= ?", "2024-01-01 00:00:00")
.where("create_time >= ?", "2024-03-24 00:00:00")
//.between("create_time", "2023-10-23 00:00:00","2023-11-13 22:00:00")
.list();
List<Row> insertList = new ArrayList<>();
list.forEach(item->{
@ -67,6 +69,16 @@ public class CpopEasyLearnDataAnalyseTest{
row.set("sharing_order_id",item.getString("outOrderNo"));
row.set("transaction_id",item.getString("transactionId"));
row.set("detail_order_id",split[2]);
JSONObject jsonBody = new JSONObject();
jsonBody.put("_type", "merchantPayInfo");
jsonBody.put("merchant_plan_detail_no", split[2]);
JSONObject result = SpringUtils.getBean(RestTemplate.class).postForObject(CloudDbUrl.COMMON_USE_URL, jsonBody, JSONObject.class);
if (result.getBoolean("success")) {
row.set("brand_name", result.getJSONObject("data").getString("brandName"));
row.set("store_name", result.getJSONObject("data").getString("storeName"));
row.set("customer_name", result.getJSONObject("data").getString("customerName"));
row.set("phone", result.getJSONObject("data").getString("customerPhone"));
}
insertList.add(row);
}
} catch (WxPayException e) {

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author DB
@ -36,4 +37,11 @@ public class ClueFollowUpBo {
*/
@ApiModelProperty(value = "记录文件地址")
private String recordFileUrl;
/**
* 更进状态(0:待跟进1:已歇业2:无法联系3:无意向4:已拜访5:跟进中6:已成交
*/
@NotNull(message = "跟进状态不能为空")
@ApiModelProperty(value = "更进状态(0:待跟进、1:已歇业、2:无法联系、3:无意向、4:已拜访、5:跟进中、6:已成交",required = true)
private Integer followStatus;
}

View File

@ -66,8 +66,9 @@ public class BackstageClueController {
@ApiParam(value = "校区") @RequestParam(value = "storeId", required = false) String storeId,
@ApiParam(value = "负责人或手机号") @RequestParam(value = "chargeOrPhone", required = false) String chargeOrPhone,
@ApiParam(value = "员工id") @RequestParam(value = "staffId", required = false) String staffId,
@ApiParam(value = "签约月份") @RequestParam(value = "signMonth", required = false) String signMonth) {
Page<CluePageVo> pageVo = clueService.getPersonCluePage(clueStatus, city, brandId, storeId, chargeOrPhone, staffId, signMonth);
@ApiParam(value = "签约月份") @RequestParam(value = "signMonth", required = false) String signMonth,
@ApiParam(value = "更进状态") @RequestParam(value = "followStatus", required = false) Integer followStatus) {
Page<CluePageVo> pageVo = clueService.getPersonCluePage(clueStatus, city, brandId, storeId, chargeOrPhone, staffId, signMonth,followStatus);
return R.ok(pageVo);
}

View File

@ -85,6 +85,11 @@ public class Clue extends BaseEntity implements Serializable {
*/
private String lastReceiptStaffId;
/**
* 更进状态(0:待跟进1:已歇业2:无法联系3:无意向4:已拜访5:跟进中6:已成交)
*/
private Integer followStatus;
/**
* 是否删除(0否1是)
*/

View File

@ -24,7 +24,7 @@ public interface ClueService extends IService<Clue> {
* @since 2024/2/19
* @return R<Page<SignGoalPageVo>>
*/
Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth);
Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth,Integer followStatus);
/**
* 个人签约目标

View File

@ -411,7 +411,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
//线索归档
ClueService clueService = SpringUtils.getBean(ClueService.class);
Clue clue = clueService.queryChain().where(CLUE.STORE_ID.eq(id)).one();
clue.setClueStatus(1);
clue.setClueStatus(1).setFollowStatus(6);
clueService.updateById(clue);
//线索记录
ClueRecord clueRecord = new ClueRecord();

View File

@ -65,7 +65,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
* @return R<Page<SignGoalPageVo>>
*/
@Override
public Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth) {
public Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth,Integer followStatus) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
QueryWrapper queryWrapper = QueryWrapper.create();
if (clueStatus != null){
@ -100,7 +100,8 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
}
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
queryWrapper
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.CLUE_STATUS)
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.CLUE_STATUS,
CLUE.FOLLOW_STATUS)
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
.select(BRAND.BRAND_NAME)
.select(STORE_SIGN.EXPIRE_DATE,STORE_SIGN.CREATE_TIME.as(CluePageVo::getStoreSignTime))
@ -116,6 +117,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
.and(BRAND.ID.eq(brandId))
//校区
.and(CLUE.STORE_ID.eq(storeId))
.and(CLUE.FOLLOW_STATUS.eq(followStatus))
.and(STORE.PERSON_CHARGE.likeLeft(chargeOrPhone).or(STORE.PHONE.eq(chargeOrPhone)))
.and(STORE_SIGN.SIGN_MONTH.eq(signMonth))
.orderBy(changeOrderColumn(pageDomain)),
@ -266,6 +268,11 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
.set(CLUE.LAST_FOLLOW_UP_CONTENT,bo.getRecordContent())
.where(CLUE.ID.eq(bo.getClueId()))
.update();
//更新跟进状态
this.updateChain()
.set(CLUE.FOLLOW_STATUS,bo.getFollowStatus())
.where(CLUE.ID.eq(bo.getClueId()))
.update();
}
/**
@ -454,8 +461,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
if (cityList == null || cityList.isEmpty()){
throw new ServiceException("您尚未被分配区域,无法查看线索");
}
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
queryWrapper
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), queryWrapper
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.LAST_RECEIPT_TIME,CLUE.LAST_RECEIPT_STAFF_ID)
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
.select(BRAND.BRAND_NAME)
@ -533,8 +539,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
if (!StringUtils.equals("其他", city)) {
queryWrapper.and(CLUE.CITY.eq(city));
}
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
queryWrapper
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), queryWrapper
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.LAST_RECEIPT_TIME,CLUE.LAST_RECEIPT_STAFF_ID)
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
.select(BRAND.BRAND_NAME)

View File

@ -435,10 +435,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
LocalDate now = LocalDate.now();
LocalDate expectedCompletionDate = task.getExpectedCompletionDate();
//测试任务延期一天
long day = expectedCompletionDate.until(now.plusDays(1), ChronoUnit.DAYS);
long day = now.compareTo(expectedCompletionDate.plusDays(1));
// 逾期完成
if (day > 0) {
task.setTaskItem(-1);
//扣除绩点
deductGradePoint(day, bo.getId());
}

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -173,4 +174,10 @@ public class CluePageVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime storeSignTime;
/**
* 更进状态(0:待跟进1:已歇业2:无法联系3:无意向4:已拜访5:跟进中6:已成交
*/
@ApiModelProperty(value = "更进状态(0:待跟进、1:已歇业、2:无法联系、3:无意向、4:已拜访、5:跟进中、6:已成交")
private Integer followStatus;
}

View File

@ -1,6 +1,7 @@
package com.cpop.oam.framework.handler.wxOpen;
import com.cpop.oam.framework.config.wxOpen.WxOpenProperties;
import lombok.Getter;
import me.chanjar.weixin.open.api.impl.WxOpenInRedisTemplateConfigStorage;
import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter;
import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl;
@ -27,6 +28,7 @@ public class WxOpenService extends WxOpenServiceImpl {
@Autowired
private WxOpenProperties wxOpenProperties;
@Getter
private WxOpenMessageRouter wxOpenMessageRouter;
@Autowired
@ -47,8 +49,5 @@ public class WxOpenService extends WxOpenServiceImpl {
}).next();
}
public WxOpenMessageRouter getWxOpenMessageRouter(){
return wxOpenMessageRouter;
}
}

View File

@ -235,7 +235,7 @@ public class OamScheduledTasks {
StaffInfoVo staffInfo = SpringUtils.getBean(StaffService.class).getStaffInfo(item.getResponsibleStaffId());
phoneList.add(staffInfo.getPhoneNumber());
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList,
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.PRODUCT_BOT, phoneList,
"==========您有一个任务今天即将到期,请及时处理==========\n" + item.getTaskContent(),
false);
} catch (IOException e) {
@ -250,7 +250,7 @@ public class OamScheduledTasks {
ArrayList<String> phoneList = new ArrayList<>();
phoneList.add(testStaffPhones);
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList,
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.PRODUCT_BOT, phoneList,
"==========您有一个测试任务今天即将到期,请及时处理==========\n" + item.getTaskContent(),
false);
} catch (IOException e) {

View File

@ -29,6 +29,10 @@
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
</dependency>
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Api</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,15 +1,20 @@
package com.cpop.pay.framewok.task;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.common.utils.StringUtils;
import com.cpop.core.base.enums.OrderSource;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.service.RedisService;
import com.cpop.core.utils.SpringUtils;
import com.cpop.pay.framewok.config.wxPay.WxPayProperties;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingRequest;
import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row;
@ -18,11 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
* @author DB
@ -138,6 +142,40 @@ public class WxPayAsyncTask {
.set("profit_sharing_status", 1)
.where("id = ?", profitSharingResult.getOutOrderNo())
.update();
//发送通知到财务群
List<String> phoneList = new ArrayList<String>();
// 获取审核管理员手机号
RedisService redisService = SpringUtils.getBean(RedisService.class);
String auditStaffPhone = redisService.getCacheObject("sysConfig:oam:OamCancelAfterVerificationStaffPhone");
phoneList.add(auditStaffPhone);
try {
//获取订单信息
Row order = Db.selectOneByQuery("cp_j_easy_learn_order", QueryWrapper.create()
.select("cjelo.id", "cjelo.order_content", "cjelo.out_order_no", "cjelo.order_type", "cjelo.customer_name", "cjelo.customer_phone", "cjelo.total_pay_amount","cjelo.create_time")
.select("csb.brand_name")
.select("css.store_name")
.from("cp_j_easy_learn_order").as("cjelo")
.leftJoin("cp_sys_brand").as("csb").on("csb.id= cjelo.brand_id")
.leftJoin("cp_sys_store").as("css").on("css.id= cjelo.store_id")
.where("cjelo.id = ?", profitSharingResult.getOutOrderNo()));
JSONObject receiver = JSONObject.parseArray(profitSharingRequest.getReceivers()).getJSONObject(0);
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText("a885058b-2478-4df8-bdb7-2bb94a08c1f5", phoneList,
"==========用户订单分账到账==========" +
"\n订单创建时间:" + order.getLocalDateTime("createTime").format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) +
"\n品牌:" + order.getString("brandName") +
"\n校区:" + order.getString("storeName") +
"\n订单类型:" + order.getInt("orderType") +
"\n受益人:" + order.getInt("customerName") +
"\n电话:" + order.getInt("customerPhone") +
"\n订单金额:" + order.getBigDecimal("totalPayAmount") +
"\n分账金额:" + receiver.get("amount") +
"\n微信订单号:" + profitSharingRequest.getTransactionId() +
"\n商户号:" + profitSharingRequest.getSubMchId() +
"\n到账商户号:" + wxPayProperties.getSharingAccount(),
false);
} catch (IOException e) {
throw new ServiceException("发送任务通知失败!");
}
} else {
throw new ServiceException(profitSharingResult.getReturnMsg());
}