|
@@ -34,18 +34,20 @@ public class ListenerTemplate {
|
|
|
DmDayPcService dmDayPcService;
|
|
|
@Autowired
|
|
|
DmFoodService dmFoodService;
|
|
|
- @Autowired
|
|
|
- DmOrderRecordService dmOrderRecordService;
|
|
|
- @Autowired
|
|
|
- DmOrderItemService dmOrderItemService;
|
|
|
- @Autowired
|
|
|
- DmOrderPaymentService dmOrderPaymentService;
|
|
|
+// @Autowired
|
|
|
+// DmOrderRecordService dmOrderRecordService;
|
|
|
+// @Autowired
|
|
|
+// DmOrderItemService dmOrderItemService;
|
|
|
+// @Autowired
|
|
|
+// DmOrderPaymentService dmOrderPaymentService;
|
|
|
|
|
|
- @RabbitListener(queues = CuisineProduce.NAME, containerFactory = CuisineProduce.LISTENER)
|
|
|
+// @RabbitListener(queues = CuisineProduce.NAME, containerFactory = CuisineProduce.LISTENER)
|
|
|
public void dealDeclareMessage(Message message) throws UnsupportedEncodingException {
|
|
|
String str = new String(message.getBody(),"utf-8");
|
|
|
System.out.println("receivePc:"+str);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(str);
|
|
|
+ Long seq = jsonObject.getLong("seq");
|
|
|
+ System.out.println("pc-seq:"+seq);
|
|
|
JSONArray array = jsonObject.getJSONArray("list");
|
|
|
System.out.println("listData"+array);
|
|
|
try {
|
|
@@ -70,6 +72,8 @@ public class ListenerTemplate {
|
|
|
dmDayPc.setPstate(attendance.getInteger("pstate"));
|
|
|
dmDayPc.setWindowName(attendance.getString("window_name"));
|
|
|
dmDayPc.setCateName(attendance.getString("cate_name"));
|
|
|
+ dmDayPc.setShopname("东信餐厅");
|
|
|
+ dmDayPc.setSeq(seq);
|
|
|
dmDayPc.setDate(new Timestamp(System.currentTimeMillis()));
|
|
|
|
|
|
dmDayPcService.create(dmDayPc);
|
|
@@ -88,66 +92,66 @@ public class ListenerTemplate {
|
|
|
}
|
|
|
|
|
|
// @RabbitListener(queues = OrderProduce.NAME_ORDER, containerFactory = OrderProduce.LISTENER_ORDER)
|
|
|
- public void dealDeclareOrderMessage(Message message) throws UnsupportedEncodingException {
|
|
|
- System.out.println("messageOrder"+message);
|
|
|
- String str = new String(message.getBody(),"utf-8");
|
|
|
- System.out.println("receiveOrder:"+str);
|
|
|
- try {
|
|
|
- JSONObject attendance = JSONObject.parseObject(str);
|
|
|
- DmOrderRecord dmExpenseCalendar = new DmOrderRecord();
|
|
|
-
|
|
|
- dmExpenseCalendar.setSeq(attendance.getLong("seq"));
|
|
|
- dmExpenseCalendar.setCreateDate(attendance.getTimestamp("create_date"));
|
|
|
- dmExpenseCalendar.setCard(attendance.getString("card"));
|
|
|
- dmExpenseCalendar.setCardNo(attendance.getString("card_no"));
|
|
|
- dmExpenseCalendar.setType(attendance.getInteger("type"));
|
|
|
- dmExpenseCalendar.setPart(attendance.getInteger("part"));
|
|
|
- dmExpenseCalendar.setTerm(attendance.getInteger("term"));
|
|
|
- dmExpenseCalendar.setShop(attendance.getInteger("shop"));
|
|
|
- dmExpenseCalendar.setTermName(attendance.getString("term_name"));
|
|
|
- dmExpenseCalendar.setShopName(attendance.getString("shop_name"));
|
|
|
- dmExpenseCalendar.setAmt(attendance.getDouble("amt"));
|
|
|
- dmExpenseCalendar.setMoney(String.valueOf(attendance.getDouble("amt")));
|
|
|
- dmExpenseCalendar.setBalance(attendance.getDouble("balance"));
|
|
|
- dmExpenseCalendar.setAccount(attendance.getInteger("account"));
|
|
|
- dmExpenseCalendar.setUserName(attendance.getString("name"));
|
|
|
- dmExpenseCalendar.setMob(attendance.getString("mob"));
|
|
|
- dmExpenseCalendar.setUserCode(attendance.getString("mob"));
|
|
|
- dmExpenseCalendar.setTel(attendance.getString("tel"));
|
|
|
- dmExpenseCalendar.setCardProfile(attendance.getInteger("card_profile"));
|
|
|
-
|
|
|
- String bh = UUID.randomUUID().toString();
|
|
|
- dmExpenseCalendar.setBh(bh);//关联编号
|
|
|
- JSONArray item = attendance.getJSONArray("details");
|
|
|
- for (int i = 0; i < item.size(); i++) {
|
|
|
- JSONObject userData = item.getJSONObject(i);
|
|
|
- DmOrderItem dmOrderItem = new DmOrderItem();
|
|
|
- DmFood dmFood = new DmFood();
|
|
|
- dmFood.setId(userData.getLong("pid"));
|
|
|
- dmOrderItem.setSeq(attendance.getLong("seq"));
|
|
|
- dmOrderItem.setFood(dmFood);
|
|
|
- dmOrderItem.setBh(bh);
|
|
|
- dmOrderItem.setName(userData.getString("name"));
|
|
|
- dmOrderItem.setPrice(userData.getString("price"));
|
|
|
- dmOrderItem.setAmt(userData.getDouble("amt"));
|
|
|
- dmOrderItem.setMoney(String.valueOf(userData.getDouble("amt")));
|
|
|
- dmOrderItemService.create(dmOrderItem);
|
|
|
- }
|
|
|
- JSONArray payment = attendance.getJSONArray("payments");
|
|
|
- for (int i = 0; i < payment.size(); i++) {
|
|
|
- JSONObject userData = payment.getJSONObject(i);
|
|
|
- DmOrderPayment dmOrderPayment = new DmOrderPayment();
|
|
|
- dmOrderPayment.setBh(bh);
|
|
|
- dmOrderPayment.setType(userData.getString("type"));
|
|
|
- dmOrderPayment.setAmt(userData.getDouble("amt"));
|
|
|
- dmOrderPayment.setBalance(userData.getDouble("balance"));
|
|
|
- dmOrderPayment.setUid(userData.getString("uid"));
|
|
|
- dmOrderPaymentService.create(dmOrderPayment);
|
|
|
- }
|
|
|
- dmOrderRecordService.create(dmExpenseCalendar);
|
|
|
- }catch (Exception ex){
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
+// public void dealDeclareOrderMessage(Message message) throws UnsupportedEncodingException {
|
|
|
+// System.out.println("messageOrder"+message);
|
|
|
+// String str = new String(message.getBody(),"utf-8");
|
|
|
+// System.out.println("receiveOrder:"+str);
|
|
|
+// try {
|
|
|
+// JSONObject attendance = JSONObject.parseObject(str);
|
|
|
+// DmOrderRecord dmExpenseCalendar = new DmOrderRecord();
|
|
|
+//
|
|
|
+// dmExpenseCalendar.setSeq(attendance.getLong("seq"));
|
|
|
+// dmExpenseCalendar.setCreateDate(attendance.getTimestamp("create_date"));
|
|
|
+// dmExpenseCalendar.setCard(attendance.getString("card"));
|
|
|
+// dmExpenseCalendar.setCardNo(attendance.getString("card_no"));
|
|
|
+// dmExpenseCalendar.setType(attendance.getInteger("type"));
|
|
|
+// dmExpenseCalendar.setPart(attendance.getInteger("part"));
|
|
|
+// dmExpenseCalendar.setTerm(attendance.getInteger("term"));
|
|
|
+// dmExpenseCalendar.setShop(attendance.getInteger("shop"));
|
|
|
+// dmExpenseCalendar.setTermName(attendance.getString("term_name"));
|
|
|
+// dmExpenseCalendar.setShopName(attendance.getString("shop_name"));
|
|
|
+// dmExpenseCalendar.setAmt(attendance.getDouble("amt"));
|
|
|
+// dmExpenseCalendar.setMoney(String.valueOf(attendance.getDouble("amt")));
|
|
|
+// dmExpenseCalendar.setBalance(attendance.getDouble("balance"));
|
|
|
+// dmExpenseCalendar.setAccount(attendance.getInteger("account"));
|
|
|
+// dmExpenseCalendar.setUserName(attendance.getString("name"));
|
|
|
+// dmExpenseCalendar.setMob(attendance.getString("mob"));
|
|
|
+// dmExpenseCalendar.setUserCode(attendance.getString("mob"));
|
|
|
+// dmExpenseCalendar.setTel(attendance.getString("tel"));
|
|
|
+// dmExpenseCalendar.setCardProfile(attendance.getInteger("card_profile"));
|
|
|
+//
|
|
|
+// String bh = UUID.randomUUID().toString();
|
|
|
+// dmExpenseCalendar.setBh(bh);//关联编号
|
|
|
+// JSONArray item = attendance.getJSONArray("details");
|
|
|
+// for (int i = 0; i < item.size(); i++) {
|
|
|
+// JSONObject userData = item.getJSONObject(i);
|
|
|
+// DmOrderItem dmOrderItem = new DmOrderItem();
|
|
|
+// DmFood dmFood = new DmFood();
|
|
|
+// dmFood.setId(userData.getLong("pid"));
|
|
|
+// dmOrderItem.setSeq(attendance.getLong("seq"));
|
|
|
+// dmOrderItem.setFood(dmFood);
|
|
|
+// dmOrderItem.setBh(bh);
|
|
|
+// dmOrderItem.setName(userData.getString("name"));
|
|
|
+// dmOrderItem.setPrice(userData.getString("price"));
|
|
|
+// dmOrderItem.setAmt(userData.getDouble("amt"));
|
|
|
+// dmOrderItem.setMoney(String.valueOf(userData.getDouble("amt")));
|
|
|
+// dmOrderItemService.create(dmOrderItem);
|
|
|
+// }
|
|
|
+// JSONArray payment = attendance.getJSONArray("payments");
|
|
|
+// for (int i = 0; i < payment.size(); i++) {
|
|
|
+// JSONObject userData = payment.getJSONObject(i);
|
|
|
+// DmOrderPayment dmOrderPayment = new DmOrderPayment();
|
|
|
+// dmOrderPayment.setBh(bh);
|
|
|
+// dmOrderPayment.setType(userData.getString("type"));
|
|
|
+// dmOrderPayment.setAmt(userData.getDouble("amt"));
|
|
|
+// dmOrderPayment.setBalance(userData.getDouble("balance"));
|
|
|
+// dmOrderPayment.setUid(userData.getString("uid"));
|
|
|
+// dmOrderPaymentService.create(dmOrderPayment);
|
|
|
+// }
|
|
|
+// dmOrderRecordService.create(dmExpenseCalendar);
|
|
|
+// }catch (Exception ex){
|
|
|
+// ex.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
}
|