diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java new file mode 100644 index 000000000..46919c3c8 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java @@ -0,0 +1,66 @@ +package au.com.royalpay.payment.manage.management.clearing.web; + +import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import netscape.javascript.JSObject; +import org.apache.commons.lang3.time.DateUtils; +import org.apache.xerces.impl.validation.ValidationManager; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.util.*; + +/** + * @Description: + * @Author: lujian + * @Date: 2019/1/30 13:50 + */ +@Controller +@RequestMapping("/sys/financial") +public class ArrivalNoticeController { + + @Resource + private ValidationLogMapper validationLogMapper; + + @GetMapping("/notice") + public String noticePage(HashMap map, + @RequestParam("date") String date) throws ParseException { + + JSONArray reports = new JSONArray(); + Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"}); + JSONObject reportItem = validationLogMapper.findByDate(dt); + if (reportItem != null) { + JSONObject result = JSON.parseObject(reportItem.getString("result")); + reports = result.getJSONArray("channel_details"); + for (int i = 0; i < reports.size(); i++) { + JSONObject channelItem = reports.getJSONObject(i); + String channel = channelItem.getString("channel"); + if (channel.equals("Wechat") && result.containsKey("wechat_analysis")) { + JSONObject wechatAnalysis = result.getJSONObject("wechat_analysis"); + List analysis = new ArrayList<>(); + for (Map.Entry entry : wechatAnalysis.entrySet()) { + JSONObject oneMerchant = new JSONObject(); + oneMerchant.put("merchant_id", entry.getKey()); + oneMerchant.put("order_amount", ((JSONObject) JSON.toJSON(entry.getValue())).getJSONObject("wechat_analysis").getBigDecimal("order_amount")); + analysis.add(oneMerchant); + } + channelItem.put("analysis", analysis); + } + if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) { + List analysis = new ArrayList<>(); + analysis.add(result.getJSONObject("bestpay_valid_analysis")); + reports.getJSONObject(i).put("analysis", analysis); + } + } + } + map.put("reports", reports); + map.put("title", "到账提醒"); + return "reports/arrival_notice"; + } +} diff --git a/src/main/resources/templates/reports/arrival_notice.html b/src/main/resources/templates/reports/arrival_notice.html new file mode 100644 index 000000000..9b7280ce4 --- /dev/null +++ b/src/main/resources/templates/reports/arrival_notice.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+ +