| | |
| | | package com.matrix; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; |
| | | import com.matrix.config.RabbitMqConfig; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.ShoppingGoods; |
| | | import com.matrix.system.hive.bean.SysSourceFlow; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.MoneyCardUseDao; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.hive.dao.SysSourceFlowDao; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; |
| | | import com.matrix.system.shopXcx.vo.SalesmanVo; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @date 2019年2月25日 |
| | | */ |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest |
| | | @SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class SourceFlowTests { |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private SysVipInfoDao vipInfoDao; |
| | | |
| | | @Autowired |
| | | RabiitMqTemplate rabiitMqTemplate; |
| | | @Autowired |
| | | WeixinServiceUtil weixinServiceUtil; |
| | | |
| | | /** |
| | | * 企业付款到个人 |
| | | * @throws InterruptedException |
| | | */ |
| | | @Test |
| | | public void testPay() throws InterruptedException { |
| | | weixinServiceUtil.comPay("提现","TX123",1,"oJkRK4yelehsY4S7I6Ee1ydWtQMI",36L); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发送订阅消息 |
| | | * @throws InterruptedException |
| | | */ |
| | | @Test |
| | | public void testTopic() throws InterruptedException { |
| | | rabiitMqTemplate.sendTopicMsg(RabbitMqConfig.MQ_EXCHANGE_TOPIC +"dev", MQTaskRouting.CREATE_ORDER+"dev", "123"); |
| | | Thread.sleep(10000); |
| | | } |
| | | |
| | | @Test |
| | | @Transactional |
| | |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private SysOrderDao sysOrderDao; |
| | | |
| | | @Autowired |
| | | private CodeService codeService; |
| | | |
| | | @Autowired |
| | | private SysOrderItemDao sysOrderItemDao; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowDao sysOrderFlowDao; |
| | | |
| | | /** |
| | | * sysOrderFlowDao.xml insert语句需将createTime和updateTime修改 |
| | | * SysOrderDao.xml insert语句需将update语句中cashPay加上 or cashPay == 0 |
| | | * |
| | | */ |
| | | @Test |
| | | public void orderTransfer() { |
| | | SysOrder query = new SysOrder(); |
| | | query.setStatu("已付款"); |
| | | List<SysOrder> sysOrders = sysOrderDao.selectByModel(query); |
| | | |
| | | for (SysOrder sysOrder : sysOrders) { |
| | | sysOrder.setCashPay(sysOrder.getZkTotal()); |
| | | sysOrder.setCardPay(0D); |
| | | sysOrderDao.update(sysOrder); |
| | | |
| | | List<SysOrderItem> items = sysOrderItemDao.selectByOrderId(sysOrder.getId()); |
| | | |
| | | SysOrderFlow flow = new SysOrderFlow(); |
| | | flow.setFlowNo("F" + sysOrder.getOrderNo().substring(1) + "-" + 1); |
| | | if (items.size() <= 0) { |
| | | continue; |
| | | } |
| | | Long goodsId = items.get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | |
| | | int j = 1; |
| | | boolean flag = false; |
| | | while (goods == null) { |
| | | if (items.size() <= 1) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | goodsId = items.get(j).getGoodsId(); |
| | | goods = shoppingGoodsDao.selectById(goodsId); |
| | | j++; |
| | | if (j + 1 >= items.size()) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (flag) { |
| | | continue; |
| | | } |
| | | |
| | | flow.setFlowContent(goods.getName().trim() + "等" + items.size() + "件产品"); |
| | | flow.setOrderId(sysOrder.getId()); |
| | | flow.setAmount(BigDecimal.valueOf(sysOrder.getZkTotal())); |
| | | flow.setVipId(sysOrder.getVipId()); |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); |
| | | flow.setPayMethod("现金"); |
| | | flow.setShopId(sysOrder.getShopId()); |
| | | flow.setCreateTime(sysOrder.getOrderTime()); |
| | | flow.setUpdateTime(sysOrder.getOrderTime()); |
| | | flow.setCompanyId(sysOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private ShopSalesmanApplyDao salesmanApplyDao; |
| | | |
| | | |
| | | |
| | | } |