|
|
@@ -163,14 +163,16 @@ public class WxController extends ApiBaseController {
|
|
|
public Object sendApproveMessage() {
|
|
|
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
- obj.checkParameterNotNull("users,chain,order,time,customerCode");
|
|
|
+ obj.checkParameterNotNull("users,chain,order,time,customerCode,customerName");
|
|
|
String users = obj.getString("users");
|
|
|
String chain = obj.getString("chain");
|
|
|
String order = obj.getString("order");
|
|
|
+ String customerName = obj.getString("customerName");
|
|
|
String time = obj.getString("time");
|
|
|
String customerCode = obj.getString("customerCode");
|
|
|
String temple = configService.selectConfigByKey("wx.notification.approve.one");
|
|
|
- String message = String.format(temple, chain, order, time);
|
|
|
+ String orderFormat = getOrderFormat(order, customerName);
|
|
|
+ String message = String.format(temple, chain, orderFormat, time);
|
|
|
qyWxSendMessageUtil.sendApproveProcessMessage(users, message, "11");
|
|
|
|
|
|
//发给经销商
|
|
|
@@ -185,6 +187,19 @@ public class WxController extends ApiBaseController {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ private String getOrderFormat(String order, String customerName){
|
|
|
+ String templeDetail = configService.selectConfigByKey("wx.notification.order.detail");
|
|
|
+
|
|
|
+ String orderFormat = null;
|
|
|
+ String[] orderArrays = order.split(",");
|
|
|
+ for (int i = 0; i < orderArrays.length; i++) {
|
|
|
+ String orderStr = orderArrays[i];
|
|
|
+ String messageDetail = String.format(templeDetail, orderStr, customerName, orderStr);
|
|
|
+ orderFormat = order.replaceAll(orderStr, messageDetail);
|
|
|
+ }
|
|
|
+ return orderFormat;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "小吨位审批通过",
|
|
|
notes = "")
|
|
|
@ApiImplicitParams({
|
|
|
@@ -194,14 +209,18 @@ public class WxController extends ApiBaseController {
|
|
|
public Object sendSmallTonApproveMessage() {
|
|
|
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
- obj.checkParameterNotNull("users,chain,order,time,customerCode");
|
|
|
+ obj.checkParameterNotNull("users,chain,order,time,customerCode,customerName");
|
|
|
String users = obj.getString("users");
|
|
|
String chain = obj.getString("chain");
|
|
|
+ String customerName = obj.getString("customerName");
|
|
|
String order = obj.getString("order");
|
|
|
String time = obj.getString("time");
|
|
|
String customerCode = obj.getString("customerCode");
|
|
|
String temple = configService.selectConfigByKey("wx.notification.approve.two");
|
|
|
- String message = String.format(temple, chain, order, time);
|
|
|
+
|
|
|
+ String orderFormat = getOrderFormat(order, customerName);
|
|
|
+ String message = String.format(temple, chain, orderFormat, time);
|
|
|
+
|
|
|
qyWxSendMessageUtil.sendApproveProcessMessage(users, message, "12");
|
|
|
|
|
|
//发给经销商
|
|
|
@@ -225,12 +244,14 @@ public class WxController extends ApiBaseController {
|
|
|
public Object sendOrderDeliverMessage() {
|
|
|
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
- obj.checkParameterNotNull("chain,order");
|
|
|
+ obj.checkParameterNotNull("chain,order,customerName");
|
|
|
String chain = obj.getString("chain");
|
|
|
+ String customerName = obj.getString("customerName");
|
|
|
String order = obj.getString("order");
|
|
|
String temple = configService.selectConfigByKey("wx.notification.order.complete");
|
|
|
- String message = String.format(temple, order, chain);
|
|
|
+ String orderFormat = getOrderFormat(order, customerName);
|
|
|
|
|
|
+ String message = String.format(temple, orderFormat, chain);
|
|
|
Set<String> customerCodes = new HashSet<>();
|
|
|
customerCodes.add(chain);
|
|
|
logger.info("收到需要通知的经销商组织代码:"+chain);
|
|
|
@@ -255,8 +276,21 @@ public class WxController extends ApiBaseController {
|
|
|
String chain = obj.getString("chain");
|
|
|
String order = obj.getString("order");
|
|
|
String temple = configService.selectConfigByKey("wx.notification.tms.leave.factory");
|
|
|
- String message = String.format(temple, order, chain);
|
|
|
|
|
|
+
|
|
|
+ String templeDetail = configService.selectConfigByKey("wx.notification.order.detail");
|
|
|
+
|
|
|
+
|
|
|
+ String orderFormat = null;
|
|
|
+ String[] orderArrays = order.split(",");
|
|
|
+ String customerName = sysUserService.getCustomNameByCode(chain);
|
|
|
+ for (int i = 0; i < orderArrays.length; i++) {
|
|
|
+ String orderStr = orderArrays[i];
|
|
|
+ String messageDetail = String.format(templeDetail, orderStr, customerName, orderStr);
|
|
|
+ orderFormat = order.replaceAll(orderStr, messageDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ String message = String.format(temple, orderFormat, chain);
|
|
|
Set<String> customerCodes = new HashSet<>();
|
|
|
customerCodes.add(chain);
|
|
|
logger.info("收到需要通知的经销商组织代码:"+chain);
|