Commit e2fd00ce authored by Quxl's avatar Quxl

x

parent 846be522
......@@ -276,7 +276,42 @@ public class OrderServiceImpl implements OrderService {
throw e;
}
if(count > 0) {
this.sendWxOrderCreateMessage(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/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSalesOrderID + "&isActive=0");
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);
}
}
}
......@@ -855,42 +890,4 @@ 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);
}
}
}
......@@ -528,19 +528,24 @@ public class UserServiceImpl implements UserService {
String salesmanNO1 = (String)parameters.get("salesmanNO1");
String mainBusiness = (String)parameters.get("mainBusiness");
Integer storeCount = (Integer)parameters.get("storeCount");
if(StringUtil.isBlank(salesmanNO1)) {
Map<String, Object> salesman = null;
try {
salesmanNO1 = jdbcTemplate.queryForString("SELECT SalesmanNO = sValue1 FROM tSystemCtrl WHERE sCode = 'DefSalesman'");
salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNO1);
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
}
}
Map<String, Object> salesman = null;
if(salesman == null) {
try {
salesmanNO1 = jdbcTemplate.queryForString("SELECT SalesmanNO = sValue1 FROM tSystemCtrl WHERE sCode = 'DefSalesman'");
try {
salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNO1);
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
}
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
}
}
List<Map<String, Object>> addrNameList = jdbcTemplate.queryForList("select sRegionNO, sRegionDesc from tRegion where sRegionNO = ? or sRegionNO = ? or sRegionNO = ?", provinceId, cityId, districtId);
Map<String, Map<String, Object>> addrmm = Util.listToMM(addrNameList, "sRegionNO");
......
package com.egolm.shop.schedules.qiyewx;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.jdbc.JdbcTemplate;
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 io.netty.util.internal.ThrowableUtil;
@Component
public class QiyeWxMsgTask {
@Autowired
QiyeWxService wxService;
@Autowired
JdbcTemplate jdbcTemplate;
@Scheduled(cron="${qiyewx.msg.timer}")
public void execute() {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nID, sSMS from tSMS where sSendType = '2' and sChannelID = 'qywx' and sSendGroup = '6'");
List<String> ids = list.stream().map(o -> (String)o.get("sSMS")).collect(Collectors.toList());
List<Map<String, Object>> subOrderList = jdbcTemplate.queryForList("select * from tSalesOrderSub where sSubOrderID in (" + StringUtil.join("', '", "'", "'", "''", ids) + ")");
Map<String, Map<String, Object>> mm = Util.listToMM(list, "sSMS");
for(Map<String, Object> subOrderMap : subOrderList) {
Map<String, Object> msg = mm.get(subOrderMap.get("sSubOrderID"));
Number msgId = (Number)msg.get("nId");
try {
this.sendMessage(subOrderMap);
jdbcTemplate.executeUpdate("update tSMS set ");
} catch (Exception e) {
jdbcTemplate.update("update tSMS set sSendErrorLog = ?, nRetry = isnull(nRetry,0) + 1 where nID = ?", ThrowableUtil.stackTraceToString(e), msgId.intValue());
}
}
}
private void sendMessage(Map<String, Object> subOrderMap) {
String sSubOrderID = (String)subOrderMap.get("sSubOrderID");
String sSalesOrderID = (String)subOrderMap.get("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 = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNo);
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.setTitle("客户订单通知知");
notice.setDescription("当前时间");
notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSubOrderID + "&isActive=1");
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);
}
}
package com.egolm.shop.schedules;
package com.egolm.shop.schedules.search;
import java.util.ArrayList;
import java.util.List;
......
package com.egolm.shop.schedules.goods;
package com.egolm.shop.schedules.search;
import java.util.Date;
import java.util.List;
......@@ -19,7 +19,6 @@ import com.egolm.common.FileUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.schedules.AbstractSolrApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......
package com.egolm.shop.schedules;
package com.egolm.shop.schedules.search;
import java.util.List;
import java.util.Map;
......
......@@ -84,5 +84,6 @@ qiyewx.corpid=ww0e86cf527e3e5218
qiyewx.corpsecret=n6weRHp134mpOF3AUPuyEDrUW8zdoG22wuk1hyfXuZA
qiyewx.baseUrl=https://qyapi.weixin.qq.com/cgi-bin
qiyewx.msg.redirect.appid=wxa573a87e45933b56
qiyewx.msg.timer=1/5 * * * * ?
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