派单搜索 + 账单明细 + 订阅号通知

This commit is contained in:
kuang.yife 2023-03-05 18:25:43 +08:00
parent c99691591e
commit cf2c3dcd29
11 changed files with 112 additions and 30 deletions

View File

@ -44,7 +44,7 @@ public class FinancialDetailController extends BaseController {
@ResponseBody
public AjaxResult count(@RequestBody FinancialCountRequest request){
try {
return AjaxResult.success(financialDetailService.count(request.getCountTime(), request.getFinancialDetailTypes(), request.getWorkerId()));
return AjaxResult.success(financialDetailService.count(request.getCountTime(), request.getBillingState(), request.getFinancialDetailTypes(), request.getWorkerId()));
}catch (Exception e){
e.printStackTrace();
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.ghy.common.config.WxConfig;
import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.exception.ServiceException;
import com.ghy.common.utils.ExceptionUtil;
import com.ghy.common.utils.StringUtils;
@ -11,8 +12,10 @@ import com.ghy.common.utils.WxUtils;
import com.ghy.common.utils.http.HttpUtils;
import com.ghy.customer.domain.Customer;
import com.ghy.customer.service.CustomerService;
import com.ghy.system.domain.NoticeMsg;
import com.ghy.system.domain.SysDeptConfig;
import com.ghy.system.service.ISysDeptConfigService;
import com.ghy.system.service.IWxMsgService;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.service.WorkerService;
import org.apache.commons.codec.binary.Base64;
@ -48,6 +51,23 @@ public class WxController extends BaseController {
@Autowired
private WorkerService workerService;
@Autowired
private IWxMsgService wxMsgService;
@PostMapping("/noticeMsg")
@ResponseBody
public AjaxResult noticeMsg(@RequestBody NoticeMsg noticeMsg){
try {
wxMsgService.sendMsg(noticeMsg.getOpenId(), noticeMsg.getRemind(),
noticeMsg.getOrderId(), noticeMsg.getName(), OrderStatus.valueOf(noticeMsg.getOrderStatus()),
System.currentTimeMillis());
return AjaxResult.success();
}catch (Exception e){
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/addUser")
@ResponseBody
public AjaxResult addUser(@RequestBody Customer customer){

View File

@ -12,4 +12,6 @@ public class FinancialCountRequest {
private List<Integer> financialDetailTypes;
private Integer workerId;
private String billingState;
}

View File

@ -83,6 +83,8 @@ public class FinancialDetail extends BaseEntity {
private List<Integer> financialDetailTypes;
private String billingState;
public FinancialDetail() {
}

View File

@ -18,4 +18,6 @@ public class FinancialCountResponse {
private Integer payeeId;
private List<Integer> financialDetailTypes;
private String billingState;
}

View File

@ -20,7 +20,7 @@ public interface FinancialDetailService {
* @param payeeId 收款人id
* @return 月份集合
*/
List<FinancialCountResponse> count(String countTime, List<Integer> financialDetailTypes, Integer payeeId);
List<FinancialCountResponse> count(String countTime, String billingState, List<Integer> financialDetailTypes, Integer payeeId);
/**
* @param orderDetailId 细单id

View File

@ -35,12 +35,13 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
@Override
public List<FinancialCountResponse> count(String countTime, List<Integer> financialDetailTypes, Integer payeeId) {
public List<FinancialCountResponse> count(String countTime, String billingState, List<Integer> financialDetailTypes, Integer payeeId) {
FinancialCountResponse request = new FinancialCountResponse();
request.setCreateTime(countTime);
request.setFlag("true");
request.setFinancialDetailTypes(financialDetailTypes);
request.setPayeeId(payeeId);
request.setBillingState(billingState);
// 查询各月含有收入的费用
List<FinancialCountResponse> list = financialDetailMapper.count(request);
list.forEach(financialCountResponse -> {

View File

@ -43,49 +43,58 @@
<select id="selectFinancialDetailList" parameterType="com.ghy.payment.domain.FinancialDetail"
resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail"/>
SELECT fd.id, fd.dept_id, fd.code, fd.financial_master_id, fd.financial_master_code, fd.order_detail_id, fd.order_detail_code,
fd.total_money, fd.discount_money, fd.pay_money, fd.financial_detail_type,payee_id, fd.reverse_id, fd.pay_type,
fd.pay_status, fd.pay_time, fd.create_by, fd.create_time, fd.update_by, fd.update_time, fd.remark
FROM financial_detail fd left join order_detail od on od.id = fd.order_detail_id
<where>
<if test="financialMasterId != null and financialMasterId != 0">
AND financial_master_id = #{financialMasterId}
AND fd.financial_master_id = #{financialMasterId}
</if>
<if test="financialMasterCode != null and financialMasterCode != ''">
AND financial_master_code LIKE concat('%', #{financialMasterCode}, '%')
AND fd.financial_master_code LIKE concat('%', #{financialMasterCode}, '%')
</if>
<if test="orderDetailId != null and orderDetailId != 0">
AND order_detail_id = #{orderDetailId}
AND fd.order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailCode != null and orderDetailCode != ''">
AND order_detail_code LIKE concat('%', #{orderDetailCode}, '%')
AND fd.order_detail_code LIKE concat('%', #{orderDetailCode}, '%')
</if>
<if test="payType != null">
AND pay_type = #{payType}
AND fd.pay_type = #{payType}
</if>
<if test="payStatus != null">
AND pay_status = #{payStatus}
AND fd.pay_status = #{payStatus}
</if>
<if test="financialDetailType != null">
AND financial_detail_type = #{financialDetailType}
AND fd.financial_detail_type = #{financialDetailType}
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
and date_format(fd.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt; date_format(#{endTime},'%y%m%d')
and date_format(fd.create_time,'%y%m%d') &lt; date_format(#{endTime},'%y%m%d')
</if>
<if test="payeeId != null">
and payee_id = #{payeeId}
and fd.payee_id = #{payeeId}
</if>
<if test="financialDetailType != null">
and financial_detail_type = #{financialDetailType}
and fd.financial_detail_type = #{financialDetailType}
</if>
<if test="financialDetailTypes != null and financialDetailTypes.size > 0">
and financial_detail_type in
and fd.financial_detail_type in
<foreach item="item" collection="financialDetailTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="billingState == '1'">
and od.order_status in ('0','1','2','3','4')
</if>
<if test="billingState != null and billingState != '' and billingState != '1'">
and od.order_status = #{billingState}
</if>
</where>
order by create_time desc
order by fd.create_time desc
</select>
<select id="selectById" parameterType="long" resultMap="FinancialDetailResult">
@ -147,29 +156,36 @@
</select>
<select id="count" resultMap="countResult">
select DATE_FORMAT(create_time,'%Y-%m') as create_time,
sum(pay_money) as income_count from financial_detail
select DATE_FORMAT(fd.create_time,'%Y-%m') as create_time,
sum(fd.pay_money) as income_count from financial_detail fd
left join order_detail od on fd.order_detail_id = od.id
<where>
<if test="createTime != null">
and DATE_FORMAT(create_time,'%Y-%m') = #{createTime}
and DATE_FORMAT(fd.create_time,'%Y-%m') = #{createTime}
</if>
<if test="flag == 'true'">
and pay_money &gt;= 0
and fd.pay_money &gt;= 0
</if>
<if test="flag == 'false'">
and pay_money &lt;= 0
and fd.pay_money &lt;= 0
</if>
<if test="payeeId != null">
and payee_id = #{payeeId}
and fd.payee_id = #{payeeId}
</if>
<if test="financialDetailTypes != null and financialDetailTypes.size > 0">
and financial_detail_type in
and fd.financial_detail_type in
<foreach item="item" collection="financialDetailTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="billingState == '1'">
and od.order_status in ('0','1','2','3','4')
</if>
<if test="billingState != null and billingState != '' and billingState != '1'">
and od.order_status = #{billingState}
</if>
</where>
group by DATE_FORMAT(create_time,'%Y-%m') order by create_time desc
group by DATE_FORMAT(fd.create_time,'%Y-%m') order by DATE_FORMAT(fd.create_time,'%Y-%m') desc
</select>
<insert id="insertFinancialDetail" parameterType="com.ghy.payment.domain.FinancialDetail" useGeneratedKeys="true"

View File

@ -0,0 +1,22 @@
package com.ghy.system.domain;
import lombok.Data;
/**
* 微信订阅通知
* @author clunt
*/
@Data
public class NoticeMsg {
private String openId;
private String remind;
private String orderId;
private String name;
// RECEIVE
private String orderStatus;
}

View File

@ -3,6 +3,7 @@ package com.ghy.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.utils.DateUtils;
import com.ghy.system.config.WxMsgConfig;
import com.ghy.system.service.IWxMsgService;
import lombok.extern.slf4j.Slf4j;
@ -88,13 +89,25 @@ public class WxMsgServiceImpl implements IWxMsgService {
// 基础数据添加
JSONObject jsonObject = new JSONObject();
// 订单编号
jsonObject.put("character_string22", orderId);
JSONObject characterStr = new JSONObject();
characterStr.put("value", orderId);
jsonObject.put("character_string1", characterStr);
// 用户姓名
jsonObject.put("thing19", name);
JSONObject nameStr = new JSONObject();
nameStr.put("value", name);
jsonObject.put("name3", nameStr);
JSONObject thing4Str = new JSONObject();
thing4Str.put("value", "广东省");
jsonObject.put("thing4", thing4Str);
// 下单时间
jsonObject.put("time1", new Date(time));
JSONObject timeStr = new JSONObject();
timeStr.put("value", DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
jsonObject.put("date8", timeStr);
// 提醒信息
jsonObject.put("thing5", remind);
JSONObject remindStr = new JSONObject();
remindStr.put("value", remind);
jsonObject.put("thing2", remindStr);
/**
* 消息推送配置参数拼接
*/
@ -102,7 +115,7 @@ public class WxMsgServiceImpl implements IWxMsgService {
// openId
wxMsgConfig.setTouser(openId);
// 模板id
wxMsgConfig.setTemplate_id("gFoPAYF4J6Y_O5OzzNUbvMxTrsAS7aUWffdNH42xhzM");
wxMsgConfig.setTemplate_id("Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4");
// 数据data
wxMsgConfig.setData(jsonObject);
return wxMsgConfig;

View File

@ -58,6 +58,10 @@
<if test="hasRegistered != null and hasRegistered != ''">
AND w.phone IS NOT NULL
</if>
<if test="workerName != null and workerName != ''">
AND ( wt.worker_name like concat('%',#{workerName},'%')
or w.name like concat('%',#{workerName},'%') )
</if>
</where>
</select>