Browse Source

10-08-收款查询,收款撤回

milestone-20251016-现金管理
lijianlin 1 day ago
parent
commit
67106e4511
  1. 16
      pom.xml
  2. 3
      src/main/java/com/example/demo/config/FlowableDataSourceConfig.java
  3. 2
      src/main/java/com/example/demo/config/Mysql1DataSourceConfig.java
  4. 50
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  5. 220
      src/main/java/com/example/demo/domain/vo/cash/CashCollection.java
  6. 2
      src/main/java/com/example/demo/domain/vo/coin/Page.java
  7. 18
      src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java
  8. 8
      src/main/java/com/example/demo/service/cash/CashCollectionService.java
  9. 91
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java
  10. 2
      src/main/resources/application.yml
  11. 105
      src/main/resources/cashMapper/CashCollectionMapper.xml

16
pom.xml

@ -209,6 +209,22 @@
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
<!-- 把 src/main/resources 下所有文件照常拷出去 -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.properties</include>
</includes>
</resource>
<!-- 把 src/main/java 里的 xml 也一起拷出去 -->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>

3
src/main/java/com/example/demo/config/FlowableDataSourceConfig.java

@ -7,6 +7,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
@ -16,6 +17,7 @@ import javax.sql.DataSource;
public class FlowableDataSourceConfig { public class FlowableDataSourceConfig {
@Bean(name = "flowableDataSource") @Bean(name = "flowableDataSource")
@Primary
@ConfigurationProperties(prefix = "spring.datasource.flowable") @ConfigurationProperties(prefix = "spring.datasource.flowable")
public DataSource flowableDataSource() { public DataSource flowableDataSource() {
HikariDataSource ds = DataSourceBuilder HikariDataSource ds = DataSourceBuilder
@ -27,6 +29,7 @@ public class FlowableDataSourceConfig {
} }
@Bean(name = "flowableTransactionManager") @Bean(name = "flowableTransactionManager")
@Primary
public PlatformTransactionManager flowableTransactionManager( public PlatformTransactionManager flowableTransactionManager(
@Qualifier("flowableDataSource") DataSource dataSource) { @Qualifier("flowableDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource); return new DataSourceTransactionManager(dataSource);

2
src/main/java/com/example/demo/config/Mysql1DataSourceConfig.java

@ -48,7 +48,7 @@ public DataSource mysql1DataSource() {
@Qualifier("globalConfiguration1") org.apache.ibatis.session.Configuration globalConfiguration1) throws Exception { @Qualifier("globalConfiguration1") org.apache.ibatis.session.Configuration globalConfiguration1) throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); sessionFactory.setDataSource(dataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:{mapper,cashMapper}/*.xml"));
sessionFactory.setConfiguration(globalConfiguration1); sessionFactory.setConfiguration(globalConfiguration1);
return sessionFactory.getObject(); return sessionFactory.getObject();
} }

50
src/main/java/com/example/demo/controller/cash/CashCollectionController.java

@ -1,12 +1,23 @@
package com.example.demo.controller.cash; package com.example.demo.controller.cash;
import com.example.demo.Util.JWTUtil;
import com.example.demo.domain.entity.Admin;
import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.cash.CashCollection;
import com.example.demo.domain.vo.coin.Page;
import com.example.demo.domain.vo.coin.Result; import com.example.demo.domain.vo.coin.Result;
import com.example.demo.service.cash.CashCollectionService; import com.example.demo.service.cash.CashCollectionService;
import com.github.pagehelper.PageInfo;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Arrays;
import java.util.List;
/** /**
* @program: gold-java * @program: gold-java
@ -25,12 +36,49 @@ public class CashCollectionController {
@Autowired @Autowired
private CashCollectionService cashCollectionService; private CashCollectionService cashCollectionService;
//新增收款订单
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody CashCollection cashCollection) { public Result add(@RequestBody CashCollection cashCollection) {
try { try {
return cashCollectionService.add(cashCollection); return cashCollectionService.add(cashCollection);
} catch (Exception e) { } catch (Exception e) {
return Result.error("请检查数据的格式");
return Result.error(e.getMessage());
}
}
//撤回未审核的收款订单
@PostMapping("/cancel")
public Result cancel(@RequestBody CashRecord cashRecord) {
try {
return cashCollectionService.cancel(cashRecord.getOrderCode());
}catch (Exception e){
return Result.error(e.getMessage());
}
}
//重新提交审核的收款订单
@PostMapping("/reSubmit")
public Result reSubmit(@RequestBody CashRecord cashRecord) {
try {
return cashCollectionService.reSubmit(cashRecord);
}catch (Exception e){
return Result.error(e.getMessage());
}
}
//多条件查询收款订单列表----客服版
@PostMapping("/selectCollection1")
public PageInfo<CashCollection> selectCollection1(
@RequestBody Page page) throws Exception{
Integer pageNum = page.getPageNum();
Integer pageSize = page.getPageSize();
CashCollection cashCollection = page.getCashCollection();
//解token权限
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("token");
Admin admin = (Admin) JWTUtil.getUserDetailsList(String.valueOf(token), Admin.class);
if (admin != null) {
List<String> list = Arrays.asList(admin.getMarkets().split(","));
cashCollection.setMarkets(list);
} }
return cashCollectionService.selectCollection1(pageNum, pageSize, cashCollection);
} }
} }

220
src/main/java/com/example/demo/domain/vo/cash/CashCollection.java

@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* @program: gold-java * @program: gold-java
@ -33,7 +34,7 @@ public class CashCollection implements Serializable {
private String orderCode; // 金币订单号 private String orderCode; // 金币订单号
private String bankCode; // 银行流水订单号 private String bankCode; // 银行流水订单号
private String goodsName; // 商品名称 private String goodsName; // 商品名称
private Integer goodsNum; // 商品数量
private Integer goodNum; // 商品数量
//金额信息 //金额信息
private String paymentCurrency; // 付款币种 private String paymentCurrency; // 付款币种
private BigDecimal paymentAmount; // 付款金额 private BigDecimal paymentAmount; // 付款金额
@ -43,11 +44,14 @@ public class CashCollection implements Serializable {
private String receivedMarket; //到账地区 private String receivedMarket; //到账地区
// 支付信息 // 支付信息
private String payType; // 支付方式 private String payType; // 支付方式
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime payTime; // 付款日期秒级 private LocalDateTime payTime; // 付款日期秒级
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime receivedTime; // 到账日期秒级 private LocalDateTime receivedTime; // 到账日期秒级
//状态 操作人 //状态 操作人
private Integer status; // 订单状态 private Integer status; // 订单状态
private Integer submitterId; // 提交人 id private Integer submitterId; // 提交人 id
private String submitterName; // 提交人 姓名
private String voucher; // 转账凭证 private String voucher; // 转账凭证
private String remark; // 备注 private String remark; // 备注
private String rejectReason; // 驳回理由 private String rejectReason; // 驳回理由
@ -56,211 +60,13 @@ public class CashCollection implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime updateTime; private LocalDateTime updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Integer getJwcode() {
return jwcode;
}
public void setJwcode(Integer jwcode) {
this.jwcode = jwcode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMarket() {
return market;
}
public void setMarket(String market) {
this.market = market;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getBankCode() {
return bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public Integer getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(Integer goodsNum) {
this.goodsNum = goodsNum;
}
public String getPaymentCurrency() {
return paymentCurrency;
}
public void setPaymentCurrency(String paymentCurrency) {
this.paymentCurrency = paymentCurrency;
}
public BigDecimal getPaymentAmount() {
return paymentAmount;
}
public void setPaymentAmount(BigDecimal paymentAmount) {
this.paymentAmount = paymentAmount;
}
public String getReceivedCurrency() {
return receivedCurrency;
}
public void setReceivedCurrency(String receivedCurrency) {
this.receivedCurrency = receivedCurrency;
}
public BigDecimal getReceivedAmount() {
return receivedAmount;
}
public void setReceivedAmount(BigDecimal receivedAmount) {
this.receivedAmount = receivedAmount;
}
public BigDecimal getHandlingCharge() {
return handlingCharge;
}
public void setHandlingCharge(BigDecimal handlingCharge) {
this.handlingCharge = handlingCharge;
}
public String getReceivedMarket() {
return receivedMarket;
}
public void setReceivedMarket(String receivedMarket) {
this.receivedMarket = receivedMarket;
}
public String getPayType() {
return payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public LocalDateTime getPayTime() {
return payTime;
}
public void setPayTime(LocalDateTime payTime) {
this.payTime = payTime;
}
public LocalDateTime getReceivedTime() {
return receivedTime;
}
public void setReceivedTime(LocalDateTime receivedTime) {
this.receivedTime = receivedTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSubmitterId() {
return submitterId;
}
public void setSubmitterId(Integer submitterId) {
this.submitterId = submitterId;
}
public String getVoucher() {
return voucher;
}
public void setVoucher(String voucher) {
this.voucher = voucher;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
//搜索筛条件
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime startTime; // 付款时间起
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime endTime; // 付款时间止
private String sortField; //排序字段
private String sortOrder; //排序顺序
private List<String> markets; // 所属地区列表
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
} }
}

2
src/main/java/com/example/demo/domain/vo/coin/Page.java

@ -2,6 +2,7 @@ package com.example.demo.domain.vo.coin;
import com.example.demo.domain.entity.User; import com.example.demo.domain.entity.User;
import com.example.demo.domain.vo.bean.*; import com.example.demo.domain.vo.bean.*;
import com.example.demo.domain.vo.cash.CashCollection;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -40,4 +41,5 @@ public class Page {
private BeanUserCard beanUserCard; //客户金豆卡片 private BeanUserCard beanUserCard; //客户金豆卡片
private BeanAuditInfo beanAuditInfo; //金豆审核信息 private BeanAuditInfo beanAuditInfo; //金豆审核信息
private HistoryRecord historyRecord; //历史记录 private HistoryRecord historyRecord; //历史记录
private CashCollection cashCollection; //现金收款
} }

18
src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java

@ -1,7 +1,11 @@
package com.example.demo.mapper.cash; package com.example.demo.mapper.cash;
import com.example.demo.domain.entity.CashRecord; import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.vo.cash.CashCollection;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @program: gold-java * @program: gold-java
@ -14,6 +18,20 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CashCollectionMapper { public interface CashCollectionMapper {
//根据jwcode获取所属地区
String getMarketByJwcode(@Param("jwcode") Integer jwcode);
//新增收款订单 //新增收款订单
void add(CashRecord cashRecord); void add(CashRecord cashRecord);
//根据订单号获取订单id状态
CashRecord selectByOrderCode(@Param("orderCode") String orderCode);
//更新订单状态
int updateStatus(@Param("orderCode") String orderCode,
@Param("status") Integer status);
//编辑订单
// 编辑订单状态=5后重新提交
int updateByOrderCode(@Param("cashRecord") CashRecord cashRecord);
//多条件查询收款订单列表
List<CashCollection> selectCollection1(@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize,
@Param("cashCollection") CashCollection cashCollection);
} }

8
src/main/java/com/example/demo/service/cash/CashCollectionService.java

@ -1,7 +1,9 @@
package com.example.demo.service.cash; package com.example.demo.service.cash;
import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.cash.CashCollection;
import com.example.demo.domain.vo.coin.Result; import com.example.demo.domain.vo.coin.Result;
import com.github.pagehelper.PageInfo;
/** /**
* @program: gold-java * @program: gold-java
@ -15,4 +17,10 @@ import com.example.demo.domain.vo.coin.Result;
public interface CashCollectionService { public interface CashCollectionService {
//新增收款订单 //新增收款订单
Result add(CashCollection cashCollection); Result add(CashCollection cashCollection);
//撤回未审核的收款订单
Result cancel(String orderCode);
//编辑并重新提交收款订单
Result reSubmit(CashRecord cashRecord);
//多条件查询收款订单列表
PageInfo<CashCollection> selectCollection1(Integer pageNum, Integer pageSize, CashCollection cashCollection);
} }

91
src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

@ -4,10 +4,14 @@ import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.cash.CashCollection;
import com.example.demo.domain.vo.coin.Result; import com.example.demo.domain.vo.coin.Result;
import com.example.demo.mapper.cash.CashCollectionMapper; import com.example.demo.mapper.cash.CashCollectionMapper;
import com.example.demo.mapper.coin.MarketMapper;
import com.example.demo.service.cash.CashCollectionService; import com.example.demo.service.cash.CashCollectionService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -23,6 +27,8 @@ public class CashCollectionServiceImpl implements CashCollectionService {
@Autowired @Autowired
private CashCollectionMapper cashCollectionMapper; private CashCollectionMapper cashCollectionMapper;
@Autowired
private MarketMapper marketMapper;
//新增收款订单 //新增收款订单
@Override @Override
@ -42,7 +48,7 @@ public class CashCollectionServiceImpl implements CashCollectionService {
if(cashCollection.getGoodsName()== null){ if(cashCollection.getGoodsName()== null){
return Result.error("商品名不能为空"); return Result.error("商品名不能为空");
} }
if(cashCollection.getGoodsNum()== null){
if(cashCollection.getGoodNum()== null){
return Result.error("商品数量不能为空"); return Result.error("商品数量不能为空");
} }
if(cashCollection.getPaymentCurrency()== null){ if(cashCollection.getPaymentCurrency()== null){
@ -75,7 +81,7 @@ public class CashCollectionServiceImpl implements CashCollectionService {
cashRecord.setName(cashCollection.getName()); //客户姓名 cashRecord.setName(cashCollection.getName()); //客户姓名
cashRecord.setActivity(cashCollection.getActivity()); // 活动 cashRecord.setActivity(cashCollection.getActivity()); // 活动
cashRecord.setGoodsName(cashCollection.getGoodsName()); //商品名称 cashRecord.setGoodsName(cashCollection.getGoodsName()); //商品名称
cashRecord.setGoodNum(cashCollection.getGoodsNum()); //商品数量
cashRecord.setGoodNum(cashCollection.getGoodNum()); //商品数量
cashRecord.setPaymentCurrency(cashCollection.getPaymentCurrency()); //付款币种 cashRecord.setPaymentCurrency(cashCollection.getPaymentCurrency()); //付款币种
cashRecord.setPaymentAmount(cashCollection.getPaymentAmount()); //付款金额 cashRecord.setPaymentAmount(cashCollection.getPaymentAmount()); //付款金额
cashRecord.setReceivedMarket(cashCollection.getReceivedMarket()); //到账地区 cashRecord.setReceivedMarket(cashCollection.getReceivedMarket()); //到账地区
@ -86,9 +92,90 @@ public class CashCollectionServiceImpl implements CashCollectionService {
cashRecord.setStatus(0); //订单状态付款线下财务待审核 cashRecord.setStatus(0); //订单状态付款线下财务待审核
cashRecord.setSubmitterId(cashCollection.getSubmitterId()); //提交人ID cashRecord.setSubmitterId(cashCollection.getSubmitterId()); //提交人ID
cashRecord.setOrderType(1); //订单类型1-收款 cashRecord.setOrderType(1); //订单类型1-收款
//地区根据jwcode插入
cashRecord.setMarket(cashCollectionMapper.getMarketByJwcode(cashRecord.getJwcode()));
//插入新收款订单 //插入新收款订单
cashCollectionMapper.add(cashRecord); cashCollectionMapper.add(cashRecord);
return Result.success("添加成功"); return Result.success("添加成功");
} }
//撤回未审核的订单
@Override
public Result cancel(String orderCode) {
CashRecord cashRecord = cashCollectionMapper.selectByOrderCode(orderCode);
if (cashRecord == null) {
return Result.error("订单不存在");
}
if (cashRecord.getStatus() != 0){
return Result.error("订单状态不符合条件");
}
//修改订单状态
int rows = cashCollectionMapper.updateStatus(orderCode, 5);
return rows > 0 ? Result.success("撤回成功") : Result.error("撤回失败");
}
//编辑并重新提交收款订单
@Override
public Result reSubmit(CashRecord cashRecord) {
if (cashRecord.getJwcode()==null){
return Result.error("精网号不能为空");
}
if(cashRecord.getJwcode()<10000000||cashRecord.getJwcode()>99999999){
return Result.error("精网号必须为8位");
}
if(cashRecord.getName()== null){
return Result.error("客户姓名不能为空");
}
if(cashRecord.getActivity()== null){
return Result.error("活动不能为空");
}
if(cashRecord.getGoodsName()== null){
return Result.error("商品名不能为空");
}
if(cashRecord.getGoodNum()== null){
return Result.error("商品数量不能为空");
}
if(cashRecord.getPaymentCurrency()== null){
return Result.error("支付币种不能为空");
}
if(cashRecord.getPaymentAmount()== null){
return Result.error("支付金额不能为空");
}
if (cashRecord.getPayType()== null){
return Result.error("支付方式不能为空");
}
if (cashRecord.getReceivedMarket()== null){
return Result.error("到账地区不能为空");
}
if(cashRecord.getPayTime()== null){
return Result.error("付款时间不能为空");
}
if (cashRecord.getVoucher()== null){
return Result.error("转账凭证不能为空");
}
if (cashRecord.getRemark()==null){
return Result.error("备注不能为空");
}
CashRecord status=cashCollectionMapper.selectByOrderCode(cashRecord.getOrderCode());
if (!status.getStatus().equals(5)){
return Result.error("只允许编辑已撤回订单");
}
//地区根据jwcode插入
cashRecord.setMarket(cashCollectionMapper.getMarketByJwcode(cashRecord.getJwcode()));
int rows = cashCollectionMapper.updateByOrderCode(cashRecord);
return rows > 0 ? Result.success("重新提交成功") : Result.error("重新提交失败");
}
//多条件查询收款订单列表
@Override
public PageInfo<CashCollection> selectCollection1(Integer pageNum, Integer pageSize, CashCollection cashCollection) {
//将操作人的地区列表改为id
List<String> markets = marketMapper.getMarketIds(cashCollection.getMarkets());
if (markets.contains("9") || markets.contains("9999")){
markets=null;
}
cashCollection.setMarkets(markets);
PageHelper.startPage(pageNum, pageSize);
List<CashCollection> cashCollections = cashCollectionMapper.selectCollection1(pageNum, pageSize, cashCollection);
return new PageInfo<>(cashCollections);
}
} }

2
src/main/resources/application.yml

@ -15,6 +15,8 @@ spring:
name: demo name: demo
mybatis: mybatis:
type-handlers-package: com.example.demo.Util type-handlers-package: com.example.demo.Util
mapper-locations: classpath*:**/*Mapper.xml
type-aliases-package: com.example.demo.domain.entity
configuration: configuration:
mysql1: mysql1:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true

105
src/main/resources/cashMapper/CashCollectionMapper.xml

@ -3,16 +3,113 @@
<mapper namespace="com.example.demo.mapper.cash.CashCollectionMapper"> <mapper namespace="com.example.demo.mapper.cash.CashCollectionMapper">
<insert id="add">
<insert id="add" parameterType="com.example.demo.domain.entity.CashRecord"
useGeneratedKeys="true" keyProperty="id">
insert into insert into
cash_collection(order_type,jwcode,name,market,activity,
order_code,goods_name,goods_num,
cash_record(order_type,jwcode,name,market,activity,
order_code,goods_name,good_num,
payment_currency,payment_amount,received_market, payment_currency,payment_amount,received_market,
pay_type,pay_time,status,submitter_id, pay_type,pay_time,status,submitter_id,
voucher,remark) voucher,remark)
values(#{orderType},#{jwcode},#{name},#{market},#{activity}, values(#{orderType},#{jwcode},#{name},#{market},#{activity},
#{orderCode},#{goodsName},#{goodsNum},#{paymentCurrency},
#{orderCode},#{goodsName},#{goodNum},#{paymentCurrency},
#{paymentAmount},#{receivedMarket},#{payType},#{payTime}, #{paymentAmount},#{receivedMarket},#{payType},#{payTime},
#{status},#{submitterId},#{voucher},#{remark}) #{status},#{submitterId},#{voucher},#{remark})
</insert> </insert>
<!--更新订单状态-->
<update id="updateStatus">
update cash_record
set status=#{status}
where order_code=#{orderCode}
</update>
<!--更新订单-->
<update id="updateByOrderCode">
UPDATE cash_record
<set>
jwcode = #{cashRecord.jwcode},
name = #{cashRecord.name},
market = #{cashRecord.market},
activity = #{cashRecord.activity},
goods_name = #{cashRecord.goodsName},
good_num = #{cashRecord.goodNum},
payment_currency = #{cashRecord.paymentCurrency},
payment_amount = #{cashRecord.paymentAmount},
received_market = #{cashRecord.receivedMarket},
pay_type = #{cashRecord.payType},
pay_time = #{cashRecord.payTime},
voucher = #{cashRecord.voucher},
remark = #{cashRecord.remark},
status = 0,
</set>
WHERE order_code = #{cashRecord.orderCode}
AND status = 5
</update>
<!--根据jwcode获取所属地区-->
<select id="getMarketByJwcode" resultType="java.lang.String">
select market from user where jwcode=#{jwcode}
</select>
<!--根据订单号获取订单id与状态-->
<select id="selectByOrderCode" resultType="com.example.demo.domain.entity.CashRecord">
select id ,status
from cash_record
where order_code=#{orderCode}
</select>
<!--多条件查询收款订单列表-->
<select id="selectCollection1" resultType="com.example.demo.domain.vo.cash.CashCollection">
select cr.id,cr.jwcode,cr.name,cr.market,cr.activity,cr.order_code,cr.bank_code,
cr.goods_name,cr.good_num,cr.payment_currency,cr.payment_amount,
cr.received_currency,cr.received_amount,cr.handling_charge,
cr.received_market,cr.pay_type,cr.pay_time,cr.received_time,
cr.status,cr.submitter_id,cr.voucher,cr.remark,cr.reject_reason,
cr.create_time,cr.update_time,
a.admin_name as submitterName
from cash_record cr
left join admin a on cr.submitter_id = a.account
<where>
1 = 1
/*判断market 是否不为总部且 markets 不为空*/
<if test="cashCollection.markets != null and cashCollection.markets.size() > 0">
AND (
<foreach collection="cashCollection.markets" item="market" open="" close="" separator=" OR ">
cr.market = #{market}
</foreach>
)
</if>
<if test="cashCollection.market != null and cashCollection.market != ''">
AND cr.market = #{cashCollection.market}
</if>
<if test="cashCollection.jwcode != null and cashCollection.jwcode!=''">
AND cr.jwcode = #{cashCollection.jwcode}
</if>
<if test="cashCollection.name!=null and cashCollection.name !=''">
AND cr.name like concat('%',#{cashCollection.name},'%')
</if>
<if test="cashCollection.activity!=null and cashCollection.activity!=''">
AND cr.activity like concat('%',#{cashCollection.activity},'%')
</if>
<if test="cashCollection.goodsName!=null and cashCollection.goodsName!=''">
AND cr.goods_name like concat('%',#{cashCollection.goodsName},'%')
</if>
<if test="cashCollection.payType!=null and cashCollection.payType!=''">
AND cr.pay_type = #{cashCollection.payType}
</if>
<if test="cashCollection.status!=null and cashCollection.status!=''">
AND cr.status = #{cashCollection.status}
</if>
<if test="cashCollection.startTime!=null and cashCollection.endTime!=null">
AND cr.pay_time between #{cashCollection.startTime} and #{cashCollection.endTime}
</if>
and cr.order_type=1
</where>
<choose>
<when test="cashCollection.sortField != null and cashCollection.sortField.length > 0 or cashCollection.sortOrder != null and cashCollection.sortOrder.length > 0">
ORDER BY ${cashCollection.sortField} ${cashCollection.sortOrder}
</when>
<otherwise>
ORDER BY update_time DESC
</otherwise>
</choose>
</select>
</mapper> </mapper>
Loading…
Cancel
Save