Commit 846be522 authored by Quxl's avatar Quxl

x

parent 76e456c6
......@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -25,6 +26,9 @@ import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql;
import com.egolm.shop.api.service.OrderService;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.bean.TSalesOrder;
import com.egolm.shop.bean.TSalesOrderDtl;
import com.egolm.shop.common.XException;
......@@ -35,6 +39,9 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
QiyeWxService wxService;
/**
* 订单检查
* <p>Title: orderCheck</p>
......@@ -258,7 +265,7 @@ public class OrderServiceImpl implements OrderService {
Dialect dialect = jdbcTemplate.getDialect();
Sql sqlDesc = dialect.argsInsert("tSalesOrderPay", map);
String sql = "if not exists (select * from tSalesOrderPay where sTransTraceNO = '" + sTransTraceNO + "') " + sqlDesc.getSql();
jdbcTemplate.update(sql, sqlDesc.getArgs());
int count = jdbcTemplate.update(sql, sqlDesc.getArgs());
jdbcTemplate.update("update tSalesOrder set nOrderStatus = nOrderStatus|32 where sSalesOrderID = ?", sSalesOrderID);
try {
jdbcTemplate.executeMutil("exec Up_Ego_SplitOrderPrd '" + sSalesOrderID + "'");
......@@ -268,6 +275,9 @@ public class OrderServiceImpl implements OrderService {
}
throw e;
}
if(count > 0) {
this.sendWxOrderCreateMessage(sSalesOrderID);
}
}
@Override
......@@ -845,4 +855,42 @@ public class OrderServiceImpl implements OrderService {
return jdbcTemplate.queryForList("select * from tSalesOrderDeliverSubDtl where nTag&1 = 0 and sAocOrderID = ?", aocOrderID);
}
private void sendWxOrderCreateMessage(String sSalesOrderID) {
TSalesOrder order = jdbcTemplate.queryForBean("select * from tSalesOrder where sSalesOrderID = ?", TSalesOrder.class, sSalesOrderID);
String salesmanNo = order.getsSalesmanNO();
String shopNo = order.getsShopNO();
BigDecimal totalAmount = order.getnTotalSaleAmount();
BigDecimal totalSaleQty = order.getnTotalSaleQty();
String payType = order.getsSalesOrderPayType();
Map<String, Object> salesman = null;
try {
salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNo);
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
}
if(salesman != null) {
Map<String, Object> shop = jdbcTemplate.queryForMap("select * from tShop where sShopNO = ?", shopNo);
String custNo = (String)shop.get("sCustNO");
String shopMemo = (String)shop.get("sMemo");
Map<String, Object> cust = jdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo);;
String custName = (String)cust.get("sCustName");
String sCompanyAccountID = (String)salesman.get("sCompanyAccountID");
WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice);
notice.setDescription("当前时间");
notice.setTitle("认证审核通知");
notice.setPage("pages/customer/customer_detail/customer_detail?SalesmanNO=" + salesmanNo + "&isShare=1&custNo=" + custNo + "&shopNo=" + shopNo + "");
Map<Object, Object> params = new LinkedHashMap<Object, Object>();
params.put("订单状态", "待审核");
params.put("客户", custName);
params.put("订单金额", totalAmount);
params.put("商品数量", totalSaleQty);
params.put("支付方式", payType);
params.put("订单时间", DateUtil.format(new Date()));
params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo);
notice.setContent_item(params);
wxService.sendMessage(wxMessage);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment