派单搜索 + 账单明细 + 订阅号通知
This commit is contained in:
parent
c99691591e
commit
cf2c3dcd29
|
|
@ -44,7 +44,7 @@ public class FinancialDetailController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult count(@RequestBody FinancialCountRequest request){
|
public AjaxResult count(@RequestBody FinancialCountRequest request){
|
||||||
try {
|
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){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ghy.common.config.WxConfig;
|
import com.ghy.common.config.WxConfig;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
|
import com.ghy.common.enums.OrderStatus;
|
||||||
import com.ghy.common.exception.ServiceException;
|
import com.ghy.common.exception.ServiceException;
|
||||||
import com.ghy.common.utils.ExceptionUtil;
|
import com.ghy.common.utils.ExceptionUtil;
|
||||||
import com.ghy.common.utils.StringUtils;
|
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.common.utils.http.HttpUtils;
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
import com.ghy.customer.service.CustomerService;
|
import com.ghy.customer.service.CustomerService;
|
||||||
|
import com.ghy.system.domain.NoticeMsg;
|
||||||
import com.ghy.system.domain.SysDeptConfig;
|
import com.ghy.system.domain.SysDeptConfig;
|
||||||
import com.ghy.system.service.ISysDeptConfigService;
|
import com.ghy.system.service.ISysDeptConfigService;
|
||||||
|
import com.ghy.system.service.IWxMsgService;
|
||||||
import com.ghy.worker.domain.Worker;
|
import com.ghy.worker.domain.Worker;
|
||||||
import com.ghy.worker.service.WorkerService;
|
import com.ghy.worker.service.WorkerService;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
@ -48,6 +51,23 @@ public class WxController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkerService workerService;
|
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")
|
@PostMapping("/addUser")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addUser(@RequestBody Customer customer){
|
public AjaxResult addUser(@RequestBody Customer customer){
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,6 @@ public class FinancialCountRequest {
|
||||||
private List<Integer> financialDetailTypes;
|
private List<Integer> financialDetailTypes;
|
||||||
|
|
||||||
private Integer workerId;
|
private Integer workerId;
|
||||||
|
|
||||||
|
private String billingState;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ public class FinancialDetail extends BaseEntity {
|
||||||
|
|
||||||
private List<Integer> financialDetailTypes;
|
private List<Integer> financialDetailTypes;
|
||||||
|
|
||||||
|
private String billingState;
|
||||||
|
|
||||||
public FinancialDetail() {
|
public FinancialDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,6 @@ public class FinancialCountResponse {
|
||||||
private Integer payeeId;
|
private Integer payeeId;
|
||||||
|
|
||||||
private List<Integer> financialDetailTypes;
|
private List<Integer> financialDetailTypes;
|
||||||
|
|
||||||
|
private String billingState;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public interface FinancialDetailService {
|
||||||
* @param payeeId 收款人id
|
* @param payeeId 收款人id
|
||||||
* @return 月份集合
|
* @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
|
* @param orderDetailId 细单id
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,13 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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();
|
FinancialCountResponse request = new FinancialCountResponse();
|
||||||
request.setCreateTime(countTime);
|
request.setCreateTime(countTime);
|
||||||
request.setFlag("true");
|
request.setFlag("true");
|
||||||
request.setFinancialDetailTypes(financialDetailTypes);
|
request.setFinancialDetailTypes(financialDetailTypes);
|
||||||
request.setPayeeId(payeeId);
|
request.setPayeeId(payeeId);
|
||||||
|
request.setBillingState(billingState);
|
||||||
// 查询各月含有收入的费用
|
// 查询各月含有收入的费用
|
||||||
List<FinancialCountResponse> list = financialDetailMapper.count(request);
|
List<FinancialCountResponse> list = financialDetailMapper.count(request);
|
||||||
list.forEach(financialCountResponse -> {
|
list.forEach(financialCountResponse -> {
|
||||||
|
|
|
||||||
|
|
@ -43,49 +43,58 @@
|
||||||
|
|
||||||
<select id="selectFinancialDetailList" parameterType="com.ghy.payment.domain.FinancialDetail"
|
<select id="selectFinancialDetailList" parameterType="com.ghy.payment.domain.FinancialDetail"
|
||||||
resultMap="FinancialDetailResult">
|
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>
|
<where>
|
||||||
<if test="financialMasterId != null and financialMasterId != 0">
|
<if test="financialMasterId != null and financialMasterId != 0">
|
||||||
AND financial_master_id = #{financialMasterId}
|
AND fd.financial_master_id = #{financialMasterId}
|
||||||
</if>
|
</if>
|
||||||
<if test="financialMasterCode != null and financialMasterCode != ''">
|
<if test="financialMasterCode != null and financialMasterCode != ''">
|
||||||
AND financial_master_code LIKE concat('%', #{financialMasterCode}, '%')
|
AND fd.financial_master_code LIKE concat('%', #{financialMasterCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="orderDetailId != null and orderDetailId != 0">
|
<if test="orderDetailId != null and orderDetailId != 0">
|
||||||
AND order_detail_id = #{orderDetailId}
|
AND fd.order_detail_id = #{orderDetailId}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderDetailCode != null and orderDetailCode != ''">
|
<if test="orderDetailCode != null and orderDetailCode != ''">
|
||||||
AND order_detail_code LIKE concat('%', #{orderDetailCode}, '%')
|
AND fd.order_detail_code LIKE concat('%', #{orderDetailCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="payType != null">
|
<if test="payType != null">
|
||||||
AND pay_type = #{payType}
|
AND fd.pay_type = #{payType}
|
||||||
</if>
|
</if>
|
||||||
<if test="payStatus != null">
|
<if test="payStatus != null">
|
||||||
AND pay_status = #{payStatus}
|
AND fd.pay_status = #{payStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="financialDetailType != null">
|
<if test="financialDetailType != null">
|
||||||
AND financial_detail_type = #{financialDetailType}
|
AND fd.financial_detail_type = #{financialDetailType}
|
||||||
</if>
|
</if>
|
||||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||||
and date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
and date_format(fd.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||||
and date_format(create_time,'%y%m%d') < date_format(#{endTime},'%y%m%d')
|
and date_format(fd.create_time,'%y%m%d') < date_format(#{endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="payeeId != null">
|
<if test="payeeId != null">
|
||||||
and payee_id = #{payeeId}
|
and fd.payee_id = #{payeeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="financialDetailType != null">
|
<if test="financialDetailType != null">
|
||||||
and financial_detail_type = #{financialDetailType}
|
and fd.financial_detail_type = #{financialDetailType}
|
||||||
</if>
|
</if>
|
||||||
<if test="financialDetailTypes != null and financialDetailTypes.size > 0">
|
<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=")">
|
<foreach item="item" collection="financialDetailTypes" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</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>
|
</where>
|
||||||
order by create_time desc
|
order by fd.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectById" parameterType="long" resultMap="FinancialDetailResult">
|
<select id="selectById" parameterType="long" resultMap="FinancialDetailResult">
|
||||||
|
|
@ -147,29 +156,36 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="count" resultMap="countResult">
|
<select id="count" resultMap="countResult">
|
||||||
select DATE_FORMAT(create_time,'%Y-%m') as create_time,
|
select DATE_FORMAT(fd.create_time,'%Y-%m') as create_time,
|
||||||
sum(pay_money) as income_count from financial_detail
|
sum(fd.pay_money) as income_count from financial_detail fd
|
||||||
|
left join order_detail od on fd.order_detail_id = od.id
|
||||||
<where>
|
<where>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
and DATE_FORMAT(create_time,'%Y-%m') = #{createTime}
|
and DATE_FORMAT(fd.create_time,'%Y-%m') = #{createTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="flag == 'true'">
|
<if test="flag == 'true'">
|
||||||
and pay_money >= 0
|
and fd.pay_money >= 0
|
||||||
</if>
|
</if>
|
||||||
<if test="flag == 'false'">
|
<if test="flag == 'false'">
|
||||||
and pay_money <= 0
|
and fd.pay_money <= 0
|
||||||
</if>
|
</if>
|
||||||
<if test="payeeId != null">
|
<if test="payeeId != null">
|
||||||
and payee_id = #{payeeId}
|
and fd.payee_id = #{payeeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="financialDetailTypes != null and financialDetailTypes.size > 0">
|
<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=")">
|
<foreach item="item" collection="financialDetailTypes" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</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>
|
</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>
|
</select>
|
||||||
|
|
||||||
<insert id="insertFinancialDetail" parameterType="com.ghy.payment.domain.FinancialDetail" useGeneratedKeys="true"
|
<insert id="insertFinancialDetail" parameterType="com.ghy.payment.domain.FinancialDetail" useGeneratedKeys="true"
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ghy.system.service.impl;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ghy.common.enums.OrderStatus;
|
import com.ghy.common.enums.OrderStatus;
|
||||||
|
import com.ghy.common.utils.DateUtils;
|
||||||
import com.ghy.system.config.WxMsgConfig;
|
import com.ghy.system.config.WxMsgConfig;
|
||||||
import com.ghy.system.service.IWxMsgService;
|
import com.ghy.system.service.IWxMsgService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -88,13 +89,25 @@ public class WxMsgServiceImpl implements IWxMsgService {
|
||||||
// 基础数据添加。
|
// 基础数据添加。
|
||||||
JSONObject jsonObject = new JSONObject();
|
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
|
// openId
|
||||||
wxMsgConfig.setTouser(openId);
|
wxMsgConfig.setTouser(openId);
|
||||||
// 模板id
|
// 模板id
|
||||||
wxMsgConfig.setTemplate_id("gFoPAYF4J6Y_O5OzzNUbvMxTrsAS7aUWffdNH42xhzM");
|
wxMsgConfig.setTemplate_id("Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4");
|
||||||
// 数据data
|
// 数据data
|
||||||
wxMsgConfig.setData(jsonObject);
|
wxMsgConfig.setData(jsonObject);
|
||||||
return wxMsgConfig;
|
return wxMsgConfig;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,10 @@
|
||||||
<if test="hasRegistered != null and hasRegistered != ''">
|
<if test="hasRegistered != null and hasRegistered != ''">
|
||||||
AND w.phone IS NOT NULL
|
AND w.phone IS NOT NULL
|
||||||
</if>
|
</if>
|
||||||
|
<if test="workerName != null and workerName != ''">
|
||||||
|
AND ( wt.worker_name like concat('%',#{workerName},'%')
|
||||||
|
or w.name like concat('%',#{workerName},'%') )
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue