作者 蔺文领

修改redis地址

正在显示 38 个修改的文件 包含 1455 行增加415 行删除
@@ -424,6 +424,16 @@ @@ -424,6 +424,16 @@
424 <version>1.1.1</version> 424 <version>1.1.1</version>
425 </dependency> 425 </dependency>
426 426
  427 + <dependency>
  428 + <groupId>com.google.code.gson</groupId>
  429 + <artifactId>gson</artifactId>
  430 + <version>2.8.2</version>
  431 + </dependency>
  432 + <dependency>
  433 + <groupId>com.jfinal</groupId>
  434 + <artifactId>jfinal</artifactId>
  435 + <version>3.4</version>
  436 + </dependency>
427 </dependencies> 437 </dependencies>
428 438
429 <!-- 配置文件 --> 439 <!-- 配置文件 -->
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
  1 +package com.agent.billcheck;
  2 +
  3 +/**
  4 + * Created by cohesion on 2017/4/17.
  5 + *
  6 + * 账单核审
  7 + */
  8 +public class BillCheckBean {
  9 + private Integer fid;
  10 +
  11 + private String code;
  12 +
  13 + private String type;
  14 +
  15 + private String chgseq;
  16 +
  17 + private String eiflag;
  18 +
  19 + private String diflag;
  20 +
  21 + private String bizope;
  22 +
  23 + private String cuscode;
  24 +
  25 + private String cusnm;
  26 +
  27 + private String paymode;
  28 +
  29 + private String cusrnm;
  30 +
  31 + private String cdate;
  32 +
  33 + private String feecd;
  34 +
  35 + private String cfeewt;
  36 +
  37 + private String feewt;
  38 +
  39 + private String fee;
  40 +
  41 + private String rate;
  42 +
  43 + private String feenm;
  44 +
  45 + private String payCostFid;
  46 +
  47 + private String station;
  48 +
  49 + public void setFid(Integer fid) {
  50 + this.fid = fid;
  51 + }
  52 +
  53 + public int getFid() {
  54 + return this.fid;
  55 + }
  56 +
  57 + public void setCode(String code) {
  58 + this.code = code;
  59 + }
  60 +
  61 + public String getCode() {
  62 + return this.code;
  63 + }
  64 +
  65 + public void setType(String type) {
  66 + this.type = type;
  67 + }
  68 +
  69 + public String getType() {
  70 + return this.type;
  71 + }
  72 +
  73 + public void setChgseq(String chgseq) {
  74 + this.chgseq = chgseq;
  75 + }
  76 +
  77 + public String getChgseq() {
  78 + return this.chgseq;
  79 + }
  80 +
  81 + public void setEiflag(String eiflag) {
  82 + this.eiflag = eiflag;
  83 + }
  84 +
  85 + public String getEiflag() {
  86 + return this.eiflag;
  87 + }
  88 +
  89 + public void setDiflag(String diflag) {
  90 + this.diflag = diflag;
  91 + }
  92 +
  93 + public String getDiflag() {
  94 + return this.diflag;
  95 + }
  96 +
  97 + public void setBizope(String bizope) {
  98 + this.bizope = bizope;
  99 + }
  100 +
  101 + public String getBizope() {
  102 + return this.bizope;
  103 + }
  104 +
  105 + public void setCuscode(String cuscode) {
  106 + this.cuscode = cuscode;
  107 + }
  108 +
  109 + public String getCuscode() {
  110 + return this.cuscode;
  111 + }
  112 +
  113 + public void setCusnm(String cusnm) {
  114 + this.cusnm = cusnm;
  115 + }
  116 +
  117 + public String getCusnm() {
  118 + return this.cusnm;
  119 + }
  120 +
  121 + public void setPaymode(String paymode) {
  122 + this.paymode = paymode;
  123 + }
  124 +
  125 + public String getPaymode() {
  126 + return this.paymode;
  127 + }
  128 +
  129 + public void setCusrnm(String cusrnm) {
  130 + this.cusrnm = cusrnm;
  131 + }
  132 +
  133 + public String getCusrnm() {
  134 + return this.cusrnm;
  135 + }
  136 +
  137 + public void setCdate(String cdate) {
  138 + this.cdate = cdate;
  139 + }
  140 +
  141 + public String getCdate() {
  142 + return this.cdate;
  143 + }
  144 +
  145 + public String getFeecd() {
  146 + return feecd;
  147 + }
  148 +
  149 + public void setFeecd(String feecd) {
  150 + this.feecd = feecd;
  151 + }
  152 +
  153 + public String getCfeewt() {
  154 + return cfeewt;
  155 + }
  156 +
  157 + public void setCfeewt(String cfeewt) {
  158 + this.cfeewt = cfeewt;
  159 + }
  160 +
  161 + public String getFeewt() {
  162 + return feewt;
  163 + }
  164 +
  165 + public void setFeewt(String feewt) {
  166 + this.feewt = feewt;
  167 + }
  168 +
  169 + public String getFee() {
  170 + return fee;
  171 + }
  172 +
  173 + public void setFee(String fee) {
  174 + this.fee = fee;
  175 + }
  176 +
  177 + public String getRate() {
  178 + return rate;
  179 + }
  180 +
  181 + public void setRate(String rate) {
  182 + this.rate = rate;
  183 + }
  184 +
  185 + public String getFeenm() {
  186 + return feenm;
  187 + }
  188 +
  189 + public void setFeenm(String feenm) {
  190 + this.feenm = feenm;
  191 + }
  192 +
  193 + public String getPayCostFid() {
  194 + return payCostFid;
  195 + }
  196 +
  197 + public void setPayCostFid(String payCostFid) {
  198 + this.payCostFid = payCostFid;
  199 + }
  200 +
  201 + public String getStation() {
  202 + return station;
  203 + }
  204 +
  205 + public void setStation(String station) {
  206 + this.station = station;
  207 + }
  208 +
  209 +}
  1 +package com.agent.billcheck;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.springframework.scheduling.annotation.Scheduled;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import com.agent.entity.agent.BillCheckEntity;
  11 +import com.agent.service.agent.BillCheckFeeService;
  12 +import com.agent.service.agent.BillCheckService;
  13 +import com.framework.util.JsonKit;
  14 +import com.jfinal.kit.HttpKit;
  15 +import com.jfinal.kit.StrKit;
  16 +
  17 +/**
  18 + * Depiction:
  19 + * <p>
  20 + * Modify:
  21 + * <p>
  22 + * Author: William Lynn
  23 + * <p>
  24 + * Create Date:2018年9月6日 下午12:09:07
  25 + *
  26 + */
  27 +@Component
  28 +public class BillTask {
  29 + public static boolean isRunning = false;
  30 +
  31 + private final static String BILL_API = "http://10.50.3.64:8080/tj/cost/cost";
  32 +
  33 + @Scheduled(cron = "10 * * * * ?")
  34 + public void perform() {
  35 + if (BillTask.isRunning) {
  36 + return;
  37 + }
  38 +
  39 + BillTask.isRunning = true;
  40 + System.err.println();
  41 + System.err.println("BillTask start,will get json data......");
  42 +
  43 + BillCheckService billCheckService = (BillCheckService) SpringContextKit.getBean("billCheckService");
  44 + BillCheckEntity last = billCheckService.last();
  45 + int fid = last != null ? last.getFid() : 0;
  46 + System.err.println("BillTask start,last fid is: " + fid);
  47 +
  48 + Map<String, String> queryParas = new HashMap<>();
  49 + queryParas.put("fid", String.valueOf(fid));
  50 + String json = "";
  51 + try {
  52 + json = HttpKit.get(BILL_API, queryParas);
  53 + } catch (Exception e) {
  54 + System.err.println("BillTask get json data error -->" + e.toString());
  55 + }
  56 + List<BillCheckBean> list = JsonKit.parseArray(json, BillCheckBean.class);
  57 +
  58 + if (list != null && !list.isEmpty()) {
  59 + BillCheckFeeService billCheckFeeService = (BillCheckFeeService) SpringContextKit
  60 + .getBean("billCheckFeeService");
  61 +
  62 + for (BillCheckBean bean : list) {
  63 + String mawbNo = bean.getCode();
  64 + String start = mawbNo.substring(0, 3);
  65 + String end = mawbNo.substring(3, mawbNo.length());
  66 + mawbNo = start + "-" + end;
  67 + bean.setCode(mawbNo);
  68 +
  69 + if (!billCheckService.exist(mawbNo)) {
  70 + bean.setStation(getStationCode(bean.getChgseq()));
  71 +
  72 + billCheckService.save(bean);
  73 + }
  74 +
  75 + if (!billCheckFeeService.exist(mawbNo, bean.getFeenm())) {
  76 + billCheckFeeService.save(bean);
  77 + }
  78 + }
  79 +
  80 + }
  81 +
  82 + System.err.println("BillTask end, get json data finish......");
  83 + BillTask.isRunning = false;
  84 + }
  85 +
  86 + private String getStationCode(String str) {
  87 + if (StrKit.isBlank(str))
  88 + return "";
  89 + String code = str.replaceAll("[^(A-Za-z)]", "");
  90 + return code;
  91 + }
  92 +
  93 +}
  1 +package com.agent.billcheck;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * Depiction:
  10 + * <p>
  11 + * Modify:
  12 + * <p>
  13 + * Author: William Lynn
  14 + * <p>
  15 + * Create Date:2018年9月7日 下午5:00:30
  16 + *
  17 + */
  18 +class FeeMap extends HashMap<String, List<Float>> {
  19 + private static final long serialVersionUID = 1L;
  20 +
  21 + public FeeMap() {
  22 + }
  23 +
  24 + public void push(String code, float fee) {
  25 + if (!containsKey(code)) {
  26 + List<Float> list = new ArrayList<>();
  27 + put(code, list);
  28 + }
  29 +
  30 + List<Float> list = get(code);
  31 + list.add(fee);
  32 + put(code, list);
  33 + }
  34 +
  35 + public String getTotal(String code) {
  36 + float total = 0.0f;
  37 + List<Float> list = get(code);
  38 + if (list != null && !list.isEmpty()) {
  39 + for (Float fee : list) {
  40 + total += fee;
  41 + }
  42 + }
  43 +
  44 + DecimalFormat df = new DecimalFormat("0.00");
  45 + return df.format(total);
  46 + }
  47 +
  48 +}
  1 +package com.agent.billcheck;
  2 +
  3 +import org.springframework.beans.BeansException;
  4 +import org.springframework.beans.factory.NoSuchBeanDefinitionException;
  5 +import org.springframework.context.ApplicationContext;
  6 +import org.springframework.context.ApplicationContextAware;
  7 +
  8 +/**
  9 + * Depiction:
  10 + * <p>
  11 + * Modify:
  12 + * <p>
  13 + * Author: William Lynn
  14 + * <p>
  15 + * Create Date:2018年9月6日 下午3:32:11
  16 + *
  17 + */
  18 +public class SpringContextKit implements ApplicationContextAware {
  19 + private static ApplicationContext applicationContext = null;
  20 +
  21 + @Override
  22 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  23 + if (SpringContextKit.applicationContext == null) {
  24 + SpringContextKit.applicationContext = applicationContext;
  25 + System.out.println(
  26 + "========ApplicationContext配置成功,在普通类可以通过调用ToolSpring.getAppContext()获取applicationContext对象,applicationContext="
  27 + + applicationContext + "========");
  28 + }
  29 + }
  30 +
  31 + public static ApplicationContext getApplicationContext() {
  32 + return applicationContext;
  33 + }
  34 +
  35 + /**
  36 + * 注意 bean name默认 = 类名(首字母小写) 例如: A8sClusterDao = getBean("a8sClusterDao")
  37 + *
  38 + * @param name
  39 + * @return
  40 + * @throws BeansException
  41 + */
  42 + public static Object getBean(String name) throws BeansException {
  43 + return applicationContext.getBean(name);
  44 + }
  45 +
  46 + /**
  47 + * 根据类名获取到bean
  48 + *
  49 + * @param <T>
  50 + * @param clazz
  51 + * @return
  52 + * @throws BeansException
  53 + */
  54 + @SuppressWarnings("unchecked")
  55 + public static <T> T getBeanByName(Class<T> clazz) throws BeansException {
  56 + try {
  57 + char[] cs = clazz.getSimpleName().toCharArray();
  58 + cs[0] += 32;// 首字母大写到小写
  59 + return (T) applicationContext.getBean(String.valueOf(cs));
  60 + } catch (Exception e) {
  61 + e.printStackTrace();
  62 + return null;
  63 + }
  64 + }
  65 +
  66 + public static boolean containsBean(String name) {
  67 + return applicationContext.containsBean(name);
  68 + }
  69 +
  70 + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
  71 + return applicationContext.isSingleton(name);
  72 + }
  73 +
  74 +}
@@ -11,11 +11,9 @@ import javax.servlet.http.HttpServletRequest; @@ -11,11 +11,9 @@ import javax.servlet.http.HttpServletRequest;
11 import org.springframework.stereotype.Controller; 11 import org.springframework.stereotype.Controller;
12 import org.springframework.ui.Model; 12 import org.springframework.ui.Model;
13 import org.springframework.web.bind.annotation.RequestMapping; 13 import org.springframework.web.bind.annotation.RequestMapping;
14 -import org.springframework.web.bind.annotation.RequestMethod;  
15 import org.springframework.web.bind.annotation.ResponseBody; 14 import org.springframework.web.bind.annotation.ResponseBody;
16 15
17 import com.agent.controller.BasicController; 16 import com.agent.controller.BasicController;
18 -import com.agent.entity.agent.BillCheckEntity;  
19 import com.agent.entity.agent.MakeHawbEntity; 17 import com.agent.entity.agent.MakeHawbEntity;
20 import com.agent.entity.agent.MakeMawbEntity; 18 import com.agent.entity.agent.MakeMawbEntity;
21 import com.agent.entity.agent.PubStationEntity; 19 import com.agent.entity.agent.PubStationEntity;
@@ -24,7 +22,6 @@ import com.agent.service.agent.BillCheckService; @@ -24,7 +22,6 @@ import com.agent.service.agent.BillCheckService;
24 import com.agent.service.agent.MakeHawbService; 22 import com.agent.service.agent.MakeHawbService;
25 import com.agent.service.agent.MakeMawbService; 23 import com.agent.service.agent.MakeMawbService;
26 import com.agent.service.agent.PubStationService; 24 import com.agent.service.agent.PubStationService;
27 -import com.agent.util.HttpJsonMsg;  
28 import com.agent.vo.ResponseModel; 25 import com.agent.vo.ResponseModel;
29 import com.alibaba.fastjson.JSONObject; 26 import com.alibaba.fastjson.JSONObject;
30 import com.framework.util.DateFormat; 27 import com.framework.util.DateFormat;
@@ -38,193 +35,117 @@ import tools.DataSerieal; @@ -38,193 +35,117 @@ import tools.DataSerieal;
38 35
39 /** 36 /**
40 * 账单核审 37 * 账单核审
  38 + *
41 * @author 61004 39 * @author 61004
42 * 40 *
43 */ 41 */
44 @Controller 42 @Controller
45 @RequestMapping(value = "/billcheck") 43 @RequestMapping(value = "/billcheck")
46 -public class BillCheckController extends BasicController{  
47 - 44 +public class BillCheckController extends BasicController {
  45 +
  46 + @Resource
  47 + private PubStationService stationService;
  48 +
  49 + @Resource
  50 + private BillCheckService billCheckService;
  51 +
  52 + @Resource
  53 + private MakeMawbService makeMawbService;
  54 +
48 @Resource 55 @Resource
49 - private PubStationService stationService;  
50 -  
51 - @Resource  
52 - private BillCheckService billCheckService;  
53 -  
54 - @Resource  
55 - private MakeMawbService makeMawbService;  
56 -  
57 - @Resource  
58 - private MakeHawbService makeHawbService;  
59 -  
60 - @Resource  
61 - private BasicAgentService agentService;  
62 -  
63 -  
64 - @RequestMapping(value="/list")  
65 - public String list(Model model) {  
66 - //交运货站  
67 - List<PubStationEntity> stations = stationService.findAll();  
68 - Date date = new Date();  
69 - model.addAttribute("stations",stations);  
70 - model.addAttribute("dateModel",DateFormat.formatString(date, "yyyy-MM-dd"));  
71 - return "billcheck/report";  
72 - }  
73 -  
74 -  
75 - @RequestMapping(value="search")  
76 - @ResponseBody  
77 - public ResponseModel search(HttpServletRequest request){  
78 - ResponseModel model = new ResponseModel(1, "", null);  
79 - String deliveryStation = tools.RequestUtils.getQueryParam(request, "deliveryStation");  
80 - int start_position = 1, end_position = 99999999;  
81 - String total = request.getParameter("total");  
82 - String length = request.getParameter("length");  
83 - String start_time = request.getParameter("start_time");  
84 - String end_time = request.getParameter("end_time");  
85 -  
86 - if(total != null && length != null)  
87 - {  
88 - int itotal = Integer.parseInt(total);  
89 - int ilength = Integer.parseInt(length);  
90 - start_position = (itotal-1) * ilength + 1;  
91 - end_position = start_position + ilength - 1;  
92 - }  
93 -  
94 - //System.out.println("start_position:"+start_position+" end_position:"+end_position);  
95 - //System.out.println("deliveryStation:"+deliveryStation+" start:"+start_time+" end:"+end_time);  
96 - List<BillCheckReturnData> bcrd = new ArrayList<BillCheckReturnData>();  
97 -  
98 - List<MakeMawbEntity> list1 = makeMawbService.findByDate(deliveryStation,start_time, end_time, start_position, end_position);  
99 - model.setCount(makeMawbService.findByDateCount(deliveryStation, start_time, end_time));  
100 - //查找分单  
101 - for(int i = 0; i < list1.size(); i ++)  
102 - {  
103 - MakeHawbEntity mhe = makeHawbService.findByMawbNo(list1.get(i).getMawbNo());  
104 - BillCheckReturnData rd = new BillCheckReturnData();  
105 - rd.setMawblist(list1.get(i));  
106 - rd.setHawblist(mhe);  
107 - bcrd.add(rd);  
108 - }  
109 - model.setData(bcrd);  
110 - //System.out.println("count:"+model.getCount());  
111 - return model;  
112 - } 56 + private MakeHawbService makeHawbService;
  57 +
  58 + @Resource
  59 + private BasicAgentService agentService;
  60 +
  61 + @RequestMapping(value = "/list")
  62 + public String list(Model model) {
  63 + // 交运货站
  64 + List<PubStationEntity> stations = stationService.findAll();
  65 + Date date = new Date();
  66 + model.addAttribute("stations", stations);
  67 + model.addAttribute("dateModel", DateFormat.formatString(date, "yyyy-MM-dd"));
  68 + return "billcheck/list";
  69 + }
  70 +
  71 + @RequestMapping(value = "search")
  72 + @ResponseBody
  73 + public ResponseModel search(HttpServletRequest request) {
  74 + ResponseModel model = new ResponseModel(1, "", null);
  75 + String deliveryStation = tools.RequestUtils.getQueryParam(request, "deliveryStation");
  76 + int start_position = 1, end_position = 99999999;
  77 + String total = request.getParameter("total");
  78 + String length = request.getParameter("length");
  79 + String start_time = request.getParameter("start_time");
  80 + String end_time = request.getParameter("end_time");
  81 +
  82 + if (total != null && length != null) {
  83 + int itotal = Integer.parseInt(total);
  84 + int ilength = Integer.parseInt(length);
  85 + start_position = (itotal - 1) * ilength + 1;
  86 + end_position = start_position + ilength - 1;
  87 + }
  88 +
  89 + // System.out.println("start_position:"+start_position+"
  90 + // end_position:"+end_position);
  91 + // System.out.println("deliveryStation:"+deliveryStation+" start:"+start_time+"
  92 + // end:"+end_time);
  93 + List<BillCheckReturnData> bcrd = new ArrayList<BillCheckReturnData>();
  94 +
  95 + List<MakeMawbEntity> list1 = makeMawbService.findByDate(deliveryStation, start_time, end_time, start_position,
  96 + end_position);
  97 + model.setCount(makeMawbService.findByDateCount(deliveryStation, start_time, end_time));
  98 + // 查找分单
  99 + for (int i = 0; i < list1.size(); i++) {
  100 + MakeHawbEntity mhe = makeHawbService.findByMawbNo(list1.get(i).getMawbNo());
  101 + BillCheckReturnData rd = new BillCheckReturnData();
  102 + rd.setMawblist(list1.get(i));
  103 + rd.setHawblist(mhe);
  104 + bcrd.add(rd);
  105 + }
  106 + model.setData(bcrd);
  107 + // System.out.println("count:"+model.getCount());
  108 + return model;
  109 + }
  110 +
113 @RequestMapping("search2") 111 @RequestMapping("search2")
114 @ResponseBody 112 @ResponseBody
115 - public ResponseModel search2(HttpServletRequest request){  
116 - 113 + public ResponseModel search2(HttpServletRequest request) {
  114 +
117 ResponseModel model = new ResponseModel(1, "", null); 115 ResponseModel model = new ResponseModel(1, "", null);
118 BillCheckServiceProxy bcsp = new BillCheckServiceProxy(); 116 BillCheckServiceProxy bcsp = new BillCheckServiceProxy();
119 QueryData qd = new QueryData(); 117 QueryData qd = new QueryData();
120 String total = request.getParameter("total"); 118 String total = request.getParameter("total");
121 String length = request.getParameter("length"); 119 String length = request.getParameter("length");
122 DataSerieal.ModelSet(qd, request); 120 DataSerieal.ModelSet(qd, request);
123 - if(qd.getStart_time() == null || qd.getEnd_time() == null)  
124 - { 121 + if (qd.getStart_time() == null || qd.getEnd_time() == null) {
125 model.setStatus(2); 122 model.setStatus(2);
126 model.setMsg("请输入日期"); 123 model.setMsg("请输入日期");
127 return model; 124 return model;
128 } 125 }
129 - if(total != null && length != null)  
130 - { 126 + if (total != null && length != null) {
131 qd.setStart_page(Integer.parseInt(total)); 127 qd.setStart_page(Integer.parseInt(total));
132 qd.setPage_length(Integer.parseInt(length)); 128 qd.setPage_length(Integer.parseInt(length));
133 - qd.setStart_position((qd.getStart_page()-1)*qd.getPage_length()+1);  
134 - qd.setEnd_position(qd.getStart_position()+qd.getPage_length()-1); 129 + qd.setStart_position((qd.getStart_page() - 1) * qd.getPage_length() + 1);
  130 + qd.setEnd_position(qd.getStart_position() + qd.getPage_length() - 1);
135 } 131 }
136 System.out.println(JSONObject.toJSONString(qd)); 132 System.out.println(JSONObject.toJSONString(qd));
137 try { 133 try {
138 ReturnData rd = bcsp.getByQuery(qd); 134 ReturnData rd = bcsp.getByQuery(qd);
139 - 135 +
140 List<ReturnRecode> list = new ArrayList<ReturnRecode>(); 136 List<ReturnRecode> list = new ArrayList<ReturnRecode>();
141 ReturnRecode rrs[] = rd.getRecode_list(); 137 ReturnRecode rrs[] = rd.getRecode_list();
142 - for(int i = 0; i < rrs.length; i ++)  
143 - { 138 + for (int i = 0; i < rrs.length; i++) {
144 list.add(rrs[i]); 139 list.add(rrs[i]);
145 } 140 }
146 model.setCount(rd.getRecode_all_count()); 141 model.setCount(rd.getRecode_all_count());
147 model.setData(list); 142 model.setData(list);
148 - 143 +
149 } catch (RemoteException e) { 144 } catch (RemoteException e) {
150 - // TODO Auto-generated catch block  
151 e.printStackTrace(); 145 e.printStackTrace();
152 } 146 }
153 - 147 +
154 return model; 148 return model;
155 } 149 }
156 - /**  
157 - * 销售日报  
158 - * @return  
159 - */  
160 - @RequestMapping(value="/report")  
161 - public String report(/*Model model,Long id,String deliveryStation,String date, */HttpServletRequest request) {  
162 - String start_date = request.getParameter("start_date");  
163 - String end_date = request.getParameter("end_date");  
164 - Date sd = new Date(start_date.replace('-', '/'));  
165 - Date ed = new Date(end_date.replace('-', '/'));  
166 -// System.out.println("report entry!");  
167 -// //交运货站  
168 -// List<PubStationEntity> stations = stationService.findAll();  
169 -// model.addAttribute("stations",stations);  
170 -//  
171 -// BillCheckEntity check = null;  
172 -// if(id!=null){  
173 -// check = billCheckService.findOne(id);  
174 -// }else{  
175 -// check = billCheckService.findByStationAndDate(deliveryStation,date,SessionUtil.getUser().getId());  
176 -// }  
177 -// System.out.println("report entry 2!");  
178 -// if(check ==null){  
179 -// check = new BillCheckEntity();  
180 -// BasicAgentEntity agent = agentService.findOne(SessionUtil.getUser().getAgent());  
181 -// check.setAgent(agent.getNameCn());  
182 -// check.setPayDate(date);  
183 -// check.setDeliveryStation(deliveryStation);  
184 -// if(StringUtils.isNotEmpty(deliveryStation)){  
185 -// //代理人  
186 -// BasicAgentEntity baiscAgent = agentService.findOne(SessionUtil.getUser().getAgent());  
187 -// Object[] obj = (Object[]) makeMawbService.countCash(deliveryStation,date, baiscAgent.getThreeCode());  
188 -// check.setMawbCash(obj[0]==null?0:Double.valueOf(String.valueOf(obj[0])));  
189 -// check.setHawbCash(obj[1]==null?0:Double.valueOf(String.valueOf(obj[1])));  
190 -// check.setTotalCash((obj[0]==null?0:Double.valueOf(String.valueOf(obj[0]))) + (obj[1]==null?0:Double.valueOf(String.valueOf(obj[1]))));  
191 -// }  
192 -// }  
193 -// System.out.println("report entry 3!");  
194 -// if(StringUtils.isNotEmpty(check.getPayDate())){  
195 -// check.setPayDate(DateFormat.formatString(check.getPayDate(), "yyyy-MM"));  
196 -// }else {  
197 -// date=DateFormat.formatString(new Date(), "yyyy-MM");  
198 -// check.setPayDate(date);  
199 -// }  
200 -// model.addAttribute("dateModel",check.getPayDate());  
201 -// model.addAttribute("check",check);  
202 - //System.out.println("report exit");  
203 - return "billcheck/report";  
204 - }  
205 -  
206 -  
207 - /**  
208 - * 保存  
209 - * @param check  
210 - * @return  
211 - */  
212 - @RequestMapping(value="/save",method = RequestMethod.POST)  
213 - @ResponseBody  
214 - public ResponseModel save(BillCheckEntity check) {  
215 - ResponseModel model = new ResponseModel();  
216 - try{  
217 - check = billCheckService.save(check);  
218 - model.setStatus(200);  
219 - model.setMsg(HttpJsonMsg.SUCCESS);  
220 - model.setData(check.getId());  
221 - } catch(Exception e){  
222 - model.setStatus(500);  
223 - model.setMsg(HttpJsonMsg.ERROR);  
224 - }  
225 -  
226 - return model;  
227 - }  
228 -  
229 150
230 } 151 }
1 package com.agent.entity.agent; 1 package com.agent.entity.agent;
2 2
3 -import com.agent.entity.BasicEntity; 3 +import java.util.Date;
4 4
5 import javax.persistence.Column; 5 import javax.persistence.Column;
6 import javax.persistence.Entity; 6 import javax.persistence.Entity;
7 import javax.persistence.Table; 7 import javax.persistence.Table;
8 8
  9 +import com.agent.entity.IdEntity;
  10 +
9 /** 11 /**
10 * Created by cohesion on 2017/4/17. 12 * Created by cohesion on 2017/4/17.
11 * 13 *
@@ -13,131 +15,187 @@ import javax.persistence.Table; @@ -13,131 +15,187 @@ import javax.persistence.Table;
13 */ 15 */
14 @Entity 16 @Entity
15 @Table(name = "BILL_CHECK") 17 @Table(name = "BILL_CHECK")
16 -public class BillCheckEntity extends BasicEntity{  
17 -  
18 -  
19 - /**  
20 - * 交运货站  
21 - */  
22 - private String deliveryStation;  
23 - /**  
24 - * 代理人  
25 - */  
26 - private String agent;  
27 -  
28 - /**  
29 - * 收款人  
30 - */  
31 - private String payee;  
32 -  
33 - /**  
34 - * 付款月份  
35 - */  
36 - private String payDate;  
37 -  
38 - /**  
39 - * 付款方式  
40 - */  
41 - private String paymentMethod;  
42 -  
43 - /**  
44 - * 主单金额  
45 - */  
46 - private Double mawbCash;  
47 -  
48 - /**  
49 - * 分单金额  
50 - */  
51 - private Double hawbCash;  
52 -  
53 - /**  
54 - * 总金额  
55 - */  
56 - private Double totalCash;  
57 -  
58 - /**  
59 - * 付款状态  
60 - */  
61 - private Integer paymentStatus = 0;  
62 -  
63 - @Column(name = "AGENT")  
64 - public String getAgent() {  
65 - return agent;  
66 - }  
67 -  
68 - public void setAgent(String agent) {  
69 - this.agent = agent;  
70 - }  
71 -  
72 - @Column(name = "PAYEE")  
73 - public String getPayee() {  
74 - return payee;  
75 - }  
76 -  
77 - public void setPayee(String payee) {  
78 - this.payee = payee;  
79 - }  
80 -  
81 - @Column(name = "PAY_DATE")  
82 - public String getPayDate() {  
83 - return payDate;  
84 - }  
85 -  
86 - public void setPayDate(String payDate) {  
87 - this.payDate = payDate;  
88 - }  
89 -  
90 - @Column(name = "PAYMENT_METHOD")  
91 - public String getPaymentMethod() {  
92 - return paymentMethod;  
93 - }  
94 -  
95 - public void setPaymentMethod(String paymentMethod) {  
96 - this.paymentMethod = paymentMethod;  
97 - }  
98 -  
99 - @Column(name = "MAWB_CASH")  
100 - public Double getMawbCash() {  
101 - return mawbCash;  
102 - }  
103 -  
104 - public void setMawbCash(Double mawbCash) {  
105 - this.mawbCash = mawbCash;  
106 - }  
107 -  
108 - @Column(name = "HAWB_CASH")  
109 - public Double getHawbCash() {  
110 - return hawbCash;  
111 - }  
112 -  
113 - public void setHawbCash(Double hawbCash) {  
114 - this.hawbCash = hawbCash;  
115 - }  
116 -  
117 - @Column(name = "TOTAL_CASH")  
118 - public Double getTotalCash() {  
119 - return totalCash;  
120 - }  
121 -  
122 - public void setTotalCash(Double totalCash) {  
123 - this.totalCash = totalCash;  
124 - }  
125 -  
126 - @Column(name = "PAYMENT_STATUS")  
127 - public Integer getPaymentStatus() {  
128 - return paymentStatus;  
129 - }  
130 -  
131 - public void setPaymentStatus(Integer paymentStatus) {  
132 - this.paymentStatus = paymentStatus;  
133 - }  
134 -  
135 - @Column(name = "DELIVERY_STATION")  
136 - public String getDeliveryStation() {  
137 - return deliveryStation;  
138 - }  
139 -  
140 - public void setDeliveryStation(String deliveryStation) {  
141 - this.deliveryStation = deliveryStation;  
142 - } 18 +public class BillCheckEntity extends IdEntity {
  19 + private Integer fid;
  20 +
  21 + private String code;
  22 +
  23 + private String type;
  24 +
  25 + private String chgseq;
  26 +
  27 + private String eiflag;
  28 +
  29 + private String diflag;
  30 +
  31 + private String bizope;
  32 +
  33 + private String cuscode;
  34 +
  35 + private String cusnm;
  36 +
  37 + private String paymode;
  38 +
  39 + private String cusrnm;
  40 +
  41 + private String cdate;
  42 +
  43 + private String station;
  44 +
  45 + private String total;
  46 +
  47 + /**
  48 + * 创建时间
  49 + */
  50 + private Date createDate;
  51 +
  52 + /**
  53 + * 修改时间
  54 + */
  55 + private Date modifyDate;
  56 +
  57 + /**
  58 + * 是否删除 1删除 在里不让在修改主单号
  59 + */
  60 + private Integer isdelete = 0;
  61 +
  62 + public void setFid(Integer fid) {
  63 + this.fid = fid;
  64 + }
  65 +
  66 + public int getFid() {
  67 + return this.fid;
  68 + }
  69 +
  70 + public void setCode(String code) {
  71 + this.code = code;
  72 + }
  73 +
  74 + public String getCode() {
  75 + return this.code;
  76 + }
  77 +
  78 + public void setType(String type) {
  79 + this.type = type;
  80 + }
  81 +
  82 + public String getType() {
  83 + return this.type;
  84 + }
  85 +
  86 + public void setChgseq(String chgseq) {
  87 + this.chgseq = chgseq;
  88 + }
  89 +
  90 + public String getChgseq() {
  91 + return this.chgseq;
  92 + }
  93 +
  94 + public void setEiflag(String eiflag) {
  95 + this.eiflag = eiflag;
  96 + }
  97 +
  98 + public String getEiflag() {
  99 + return this.eiflag;
  100 + }
  101 +
  102 + public void setDiflag(String diflag) {
  103 + this.diflag = diflag;
  104 + }
  105 +
  106 + public String getDiflag() {
  107 + return this.diflag;
  108 + }
  109 +
  110 + public void setBizope(String bizope) {
  111 + this.bizope = bizope;
  112 + }
  113 +
  114 + public String getBizope() {
  115 + return this.bizope;
  116 + }
  117 +
  118 + public void setCuscode(String cuscode) {
  119 + this.cuscode = cuscode;
  120 + }
  121 +
  122 + public String getCuscode() {
  123 + return this.cuscode;
  124 + }
  125 +
  126 + public void setCusnm(String cusnm) {
  127 + this.cusnm = cusnm;
  128 + }
  129 +
  130 + public String getCusnm() {
  131 + return this.cusnm;
  132 + }
  133 +
  134 + public void setPaymode(String paymode) {
  135 + this.paymode = paymode;
  136 + }
  137 +
  138 + public String getPaymode() {
  139 + return this.paymode;
  140 + }
  141 +
  142 + public void setCusrnm(String cusrnm) {
  143 + this.cusrnm = cusrnm;
  144 + }
  145 +
  146 + public String getCusrnm() {
  147 + return this.cusrnm;
  148 + }
  149 +
  150 + public void setCdate(String cdate) {
  151 + this.cdate = cdate;
  152 + }
  153 +
  154 + public String getCdate() {
  155 + return this.cdate;
  156 + }
  157 +
  158 + public String getStation() {
  159 + return station;
  160 + }
  161 +
  162 + public void setStation(String station) {
  163 + this.station = station;
  164 + }
  165 +
  166 + public void setIsdelete(Integer isdelete) {
  167 + this.isdelete = isdelete;
  168 + }
  169 +
  170 + public String getTotal() {
  171 + return total;
  172 + }
  173 +
  174 + public void setTotal(String total) {
  175 + this.total = total;
  176 + }
  177 +
  178 + @Column(name = "CREATE_DATE", updatable = false)
  179 + public Date getCreateDate() {
  180 + return createDate;
  181 + }
  182 +
  183 + public void setCreateDate(Date createDate) {
  184 + this.createDate = createDate;
  185 + }
  186 +
  187 + @Column(name = "MODIFY_DATE")
  188 + public Date getModifyDate() {
  189 + return modifyDate;
  190 + }
  191 +
  192 + public void setModifyDate(Date modifyDate) {
  193 + this.modifyDate = modifyDate;
  194 + }
  195 +
  196 + @Column(name = "IS_DELETE")
  197 + public Integer getIsdelete() {
  198 + return isdelete;
  199 + }
  200 +
143 } 201 }
  1 +package com.agent.entity.agent;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.Table;
  8 +
  9 +import com.agent.entity.IdEntity;
  10 +
  11 +/**
  12 + * Created by cohesion on 2017/4/17.
  13 + *
  14 + * 账单核审
  15 + */
  16 +@Entity
  17 +@Table(name = "BILL_CHECK_FEE")
  18 +public class BillCheckFeeEntity extends IdEntity {
  19 + private String code;
  20 +
  21 + private String feecd;
  22 +
  23 + private String cfeewt;
  24 +
  25 + private String feewt;
  26 +
  27 + private String fee;
  28 +
  29 + private String rate;
  30 +
  31 + private String feenm;
  32 +
  33 + private String payCostFid;
  34 +
  35 + /**
  36 + * 创建时间
  37 + */
  38 + private Date createDate;
  39 +
  40 + /**
  41 + * 修改时间
  42 + */
  43 + private Date modifyDate;
  44 +
  45 + /**
  46 + * 是否删除 1删除 在里不让在修改主单号
  47 + */
  48 + private Integer isdelete = 0;
  49 +
  50 + public void setFeecd(String feecd) {
  51 + this.feecd = feecd;
  52 + }
  53 +
  54 + public String getFeecd() {
  55 + return this.feecd;
  56 + }
  57 +
  58 + public void setCfeewt(String cfeewt) {
  59 + this.cfeewt = cfeewt;
  60 + }
  61 +
  62 + public String getCfeewt() {
  63 + return this.cfeewt;
  64 + }
  65 +
  66 + public void setFeewt(String feewt) {
  67 + this.feewt = feewt;
  68 + }
  69 +
  70 + public String getFeewt() {
  71 + return this.feewt;
  72 + }
  73 +
  74 + public void setFee(String fee) {
  75 + this.fee = fee;
  76 + }
  77 +
  78 + public String getFee() {
  79 + return this.fee;
  80 + }
  81 +
  82 + public void setRate(String rate) {
  83 + this.rate = rate;
  84 + }
  85 +
  86 + public String getRate() {
  87 + return this.rate;
  88 + }
  89 +
  90 + public void setFeenm(String feenm) {
  91 + this.feenm = feenm;
  92 + }
  93 +
  94 + public String getFeenm() {
  95 + return this.feenm;
  96 + }
  97 +
  98 + public void setPayCostFid(String payCostFid) {
  99 + this.payCostFid = payCostFid;
  100 + }
  101 +
  102 + public String getPayCostFid() {
  103 + return this.payCostFid;
  104 + }
  105 +
  106 + public void setIsdelete(Integer isdelete) {
  107 + this.isdelete = isdelete;
  108 + }
  109 +
  110 + @Column(name = "CREATE_DATE", updatable = false)
  111 + public Date getCreateDate() {
  112 + return createDate;
  113 + }
  114 +
  115 + public void setCreateDate(Date createDate) {
  116 + this.createDate = createDate;
  117 + }
  118 +
  119 + @Column(name = "MODIFY_DATE")
  120 + public Date getModifyDate() {
  121 + return modifyDate;
  122 + }
  123 +
  124 + public void setModifyDate(Date modifyDate) {
  125 + this.modifyDate = modifyDate;
  126 + }
  127 +
  128 + @Column(name = "IS_DELETE")
  129 + public Integer getIsdelete() {
  130 + return isdelete;
  131 + }
  132 +
  133 + public String getCode() {
  134 + return code;
  135 + }
  136 +
  137 + public void setCode(String code) {
  138 + this.code = code;
  139 + }
  140 +
  141 +}
@@ -289,8 +289,9 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -289,8 +289,9 @@ public class ManifestEntity extends BasicEntity implements Serializable {
289 private Long save_time; 289 private Long save_time;
290 private Long USER_ID; // 报文所属的用户id 290 private Long USER_ID; // 报文所属的用户id
291 291
  292 +
292 public String getUnlodingcode() { 293 public String getUnlodingcode() {
293 - return StringUtils.isBlank(unlodingcode)?getDestinationstation():unlodingcode; 294 + return StringUtils.isBlank(unlodingcode) ? getDestinationstation() : unlodingcode;
294 } 295 }
295 296
296 public void setUnlodingcode(String unlodingcode) { 297 public void setUnlodingcode(String unlodingcode) {
@@ -565,7 +566,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -565,7 +566,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
565 @Column(name = "STOWAGEDATE") 566 @Column(name = "STOWAGEDATE")
566 public Date getStowagedate() { 567 public Date getStowagedate() {
567 // return stowagedate; 568 // return stowagedate;
568 - return new Date(System.currentTimeMillis()+6*3600); 569 + return new Date(System.currentTimeMillis() + 6 * 3600);
569 } 570 }
570 571
571 public void setStowagedate(Date stowagedate) { 572 public void setStowagedate(Date stowagedate) {
@@ -879,7 +880,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -879,7 +880,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
879 880
880 @Column(name = "REACH_STATION") 881 @Column(name = "REACH_STATION")
881 public String getReach_station() { 882 public String getReach_station() {
882 - return StringUtils.isBlank(reach_station)?getDestinationstation():reach_station; 883 + return StringUtils.isBlank(reach_station) ? getDestinationstation() : reach_station;
883 } 884 }
884 885
885 public void setReach_station(String reach_station) { 886 public void setReach_station(String reach_station) {
1 package com.agent.entity.agent; 1 package com.agent.entity.agent;
2 2
  3 +import java.io.Serializable;
3 import java.util.Calendar; 4 import java.util.Calendar;
4 import java.util.Date; 5 import java.util.Date;
5 6
@@ -17,8 +18,10 @@ import com.agent.entity.BasicEntity; @@ -17,8 +18,10 @@ import com.agent.entity.BasicEntity;
17 * 预配舱单分单表 18 * 预配舱单分单表
18 */ 19 */
19 @Entity 20 @Entity
20 -@Table(name = "preparesecondary")  
21 -public class PreparesecondaryEntity extends BasicEntity { 21 +@Table(name = "PREPARESECONDARY")
  22 +public class PreparesecondaryEntity extends BasicEntity implements Serializable {
  23 + private static final long serialVersionUID = 1L;
  24 +
22 private String unlodingcode;// 卸货地代码 25 private String unlodingcode;// 卸货地代码
23 private String cnecusid;// 收货人代码 26 private String cnecusid;// 收货人代码
24 private String shpcusid;// 发货人代码 27 private String shpcusid;// 发货人代码
@@ -299,7 +302,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -299,7 +302,7 @@ public class PreparesecondaryEntity extends BasicEntity {
299 private Long USER_ID; 302 private Long USER_ID;
300 303
301 public String getUnlodingcode() { 304 public String getUnlodingcode() {
302 - return StringUtils.isBlank(unlodingcode)?getDestinationstation():unlodingcode; 305 + return StringUtils.isBlank(unlodingcode) ? getDestinationstation() : unlodingcode;
303 } 306 }
304 307
305 public void setUnlodingcode(String unlodingcode) { 308 public void setUnlodingcode(String unlodingcode) {
@@ -592,7 +595,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -592,7 +595,7 @@ public class PreparesecondaryEntity extends BasicEntity {
592 @Column(name = "STOWAGEDATE") 595 @Column(name = "STOWAGEDATE")
593 public Date getStowagedate() { 596 public Date getStowagedate() {
594 // return stowagedate; 597 // return stowagedate;
595 - return new Date(System.currentTimeMillis()+6*3600); 598 + return new Date(System.currentTimeMillis() + 6 * 3600);
596 } 599 }
597 600
598 public void setStowagedate(Date stowagedate) { 601 public void setStowagedate(Date stowagedate) {
@@ -799,7 +802,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -799,7 +802,7 @@ public class PreparesecondaryEntity extends BasicEntity {
799 802
800 @Column(name = "SH_COUNTRY") 803 @Column(name = "SH_COUNTRY")
801 public String getSh_country() { 804 public String getSh_country() {
802 - return sh_country!=null?sh_country.toUpperCase():""; 805 + return sh_country != null ? sh_country.toUpperCase() : "";
803 } 806 }
804 807
805 public void setSh_country(String sh_country) { 808 public void setSh_country(String sh_country) {
@@ -916,7 +919,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -916,7 +919,7 @@ public class PreparesecondaryEntity extends BasicEntity {
916 919
917 @Column(name = "REACH_STATION") 920 @Column(name = "REACH_STATION")
918 public String getReach_station() { 921 public String getReach_station() {
919 - return StringUtils.isBlank(reach_station)?getDestinationstation():reach_station; 922 + return StringUtils.isBlank(reach_station) ? getDestinationstation() : reach_station;
920 } 923 }
921 924
922 public void setReach_station(String reach_station) { 925 public void setReach_station(String reach_station) {
不能预览此文件类型
@@ -17,9 +17,9 @@ public class JgText { @@ -17,9 +17,9 @@ public class JgText {
17 protected static final String APP_KEY ="267886222ecf11912a0648ac"; 17 protected static final String APP_KEY ="267886222ecf11912a0648ac";
18 protected static final String MASTER_SECRET = "08d9c08812997d66184d9b02"; 18 protected static final String MASTER_SECRET = "08d9c08812997d66184d9b02";
19 19
20 - public static final String TITLE = "Test from API example"; 20 + public static final String TITLE = "BillTask from API example";
21 public static final String ALERT = "我在郑州给你送信息!"; 21 public static final String ALERT = "我在郑州给你送信息!";
22 - public static final String MSG_CONTENT = "Test from API Example - msgContent"; 22 + public static final String MSG_CONTENT = "BillTask from API Example - msgContent";
23 public static final String REGISTRATION_ID = "0900e8d85ef"; 23 public static final String REGISTRATION_ID = "0900e8d85ef";
24 24
25 public static void main(String[] args) { 25 public static void main(String[] args) {
  1 +package com.agent.repository.agent;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.data.repository.PagingAndSortingRepository;
  8 +
  9 +import com.agent.entity.agent.BillCheckFeeEntity;
  10 +
  11 +/**
  12 + * Created by cohesion on 2017/4/17.
  13 + */
  14 +public interface BillCheckFeeRepository
  15 + extends PagingAndSortingRepository<BillCheckFeeEntity, Long>, JpaSpecificationExecutor<BillCheckFeeEntity> {
  16 + @Query(value = "SELECT * FROM BILL_CHECK_FEE WHERE CODE=?1 ORDER BY ID DESC", nativeQuery = true)
  17 + public List<BillCheckFeeEntity> findList(String mawbNo);
  18 +
  19 + @Query(value = "SELECT * FROM BILL_CHECK_FEE WHERE CODE=?1 AND FEENM=?2 ORDER BY ID DESC", nativeQuery = true)
  20 + public List<BillCheckFeeEntity> exist(String mawbNo, String feenm);
  21 +}
1 package com.agent.repository.agent; 1 package com.agent.repository.agent;
2 2
3 -import com.agent.entity.agent.BillCheckEntity; 3 +import java.util.List;
  4 +
4 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
5 import org.springframework.data.jpa.repository.Query; 6 import org.springframework.data.jpa.repository.Query;
6 import org.springframework.data.repository.PagingAndSortingRepository; 7 import org.springframework.data.repository.PagingAndSortingRepository;
7 8
  9 +import com.agent.entity.agent.BillCheckEntity;
  10 +
8 /** 11 /**
9 * Created by cohesion on 2017/4/17. 12 * Created by cohesion on 2017/4/17.
10 */ 13 */
@@ -16,4 +19,10 @@ public interface BillCheckRepository extends PagingAndSortingRepository<BillChec @@ -16,4 +19,10 @@ public interface BillCheckRepository extends PagingAndSortingRepository<BillChec
16 19
17 @Query(value = "SELECT * FROM BILL_CHECK WHERE IS_DELETE = 0 AND DELIVERY_STATION IS NULL AND PAY_DATE=?1 AND CREATOR=?2 ORDER BY ID DESC",nativeQuery = true) 20 @Query(value = "SELECT * FROM BILL_CHECK WHERE IS_DELETE = 0 AND DELIVERY_STATION IS NULL AND PAY_DATE=?1 AND CREATOR=?2 ORDER BY ID DESC",nativeQuery = true)
18 public BillCheckEntity findByDate(String date,Long creator); 21 public BillCheckEntity findByDate(String date,Long creator);
  22 +
  23 + @Query(value = "SELECT * FROM BILL_CHECK WHERE CODE=?1 ORDER BY ID DESC",nativeQuery = true)
  24 + public List<BillCheckEntity> exist(String mawbNo);
  25 +
  26 + @Query(value = "SELECT * FROM BILL_CHECK where rownum<=1 ORDER BY FID DESC",nativeQuery = true)
  27 + public BillCheckEntity last();
19 } 28 }
  1 +package com.agent.service.agent;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import javax.annotation.Resource;
  7 +
  8 +import org.springframework.stereotype.Service;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.agent.billcheck.BillCheckBean;
  12 +import com.agent.entity.agent.BillCheckFeeEntity;
  13 +import com.agent.repository.agent.BillCheckFeeRepository;
  14 +import com.agent.service.BasicService;
  15 +
  16 +/**
  17 + * Created by cohesion on 2017/4/17.
  18 + */
  19 +@Service("billCheckFeeService")
  20 +public class BillCheckFeeService extends BasicService<BillCheckFeeEntity> {
  21 +
  22 + @Resource
  23 + private BillCheckFeeRepository billCheckFeeRepository;
  24 +
  25 + public List<BillCheckFeeEntity> findList(String mawbNo) {
  26 + List<BillCheckFeeEntity> list = billCheckFeeRepository.findList(mawbNo);
  27 + return list;
  28 + }
  29 +
  30 + @Transactional
  31 + public BillCheckFeeEntity save(BillCheckBean bean) {
  32 + if (bean == null) {
  33 + return null;
  34 + }
  35 +
  36 + BillCheckFeeEntity check = new BillCheckFeeEntity();
  37 + check.setCfeewt(bean.getCfeewt());
  38 + check.setCode(bean.getCode());
  39 + check.setCreateDate(new Date());
  40 + check.setFee(bean.getFee());
  41 + check.setFeecd(bean.getFeecd());
  42 + check.setFeenm(bean.getFeenm());
  43 + check.setFeewt(bean.getFeewt());
  44 + check.setPayCostFid(bean.getPayCostFid());
  45 + check.setRate(bean.getRate());
  46 + return billCheckFeeRepository.save(check);
  47 + }
  48 +
  49 + public boolean exist(String mawbNo, String feenm) {
  50 + List<BillCheckFeeEntity> list = billCheckFeeRepository.exist(mawbNo, feenm);
  51 + return list != null && !list.isEmpty();
  52 + }
  53 +}
1 package com.agent.service.agent; 1 package com.agent.service.agent;
2 2
3 -import com.agent.entity.agent.BillCheckEntity;  
4 -import com.agent.repository.agent.BillCheckRepository;  
5 -import com.agent.service.BasicService;  
6 -import com.framework.shiro.SessionUtil;  
7 -import com.plugin.easyui.EasyPage; 3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import javax.annotation.Resource;
  7 +
8 import org.apache.commons.lang.StringUtils; 8 import org.apache.commons.lang.StringUtils;
9 import org.springframework.data.domain.Page; 9 import org.springframework.data.domain.Page;
10 import org.springframework.data.domain.PageRequest; 10 import org.springframework.data.domain.PageRequest;
@@ -12,56 +12,99 @@ import org.springframework.data.jpa.domain.Specification; @@ -12,56 +12,99 @@ import org.springframework.data.jpa.domain.Specification;
12 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Transactional; 13 import org.springframework.transaction.annotation.Transactional;
14 14
15 -import javax.annotation.Resource;  
16 -import java.util.Date; 15 +import com.agent.billcheck.BillCheckBean;
  16 +import com.agent.entity.agent.BillCheckEntity;
  17 +import com.agent.repository.agent.BillCheckRepository;
  18 +import com.agent.service.BasicService;
  19 +import com.plugin.easyui.EasyPage;
17 20
18 /** 21 /**
19 * Created by cohesion on 2017/4/17. 22 * Created by cohesion on 2017/4/17.
20 */ 23 */
21 -@Service  
22 -public class BillCheckService extends BasicService<BillCheckEntity> {  
23 -  
24 - @Resource  
25 - private BillCheckRepository billCheckRepository;  
26 -  
27 - /**  
28 - * 分页查询  
29 - *  
30 - * @param pageForm 分页对象  
31 - * @return 包含分页信息和数据的分页对象  
32 - */  
33 - public Page<BillCheckEntity> getPage(EasyPage<BillCheckEntity> pageForm) {  
34 - PageRequest pageRequest = buildPageRequest(pageForm);  
35 - Specification<BillCheckEntity> spec = buildSpecification(pageForm);  
36 - Page<BillCheckEntity> page = billCheckRepository.findAll(spec, pageRequest);  
37 - return page;  
38 - }  
39 -  
40 - public BillCheckEntity findByStationAndDate(String station,String date,Long creator){  
41 - if(StringUtils.isEmpty(station)){  
42 - return billCheckRepository.findByDate(date,creator);  
43 - }else {  
44 - return billCheckRepository.findByStationAndDate(station,date,creator);  
45 - }  
46 - }  
47 -  
48 - public BillCheckEntity findOne(Long id){  
49 - return billCheckRepository.findOne(id);  
50 - }  
51 -  
52 - @Transactional  
53 - public BillCheckEntity save(BillCheckEntity check){  
54 - if(check==null){  
55 - return null;  
56 - }  
57 - if(check.getId()==null) {  
58 - check.setCreator(SessionUtil.getUser());  
59 - check.setCreateDate(new Date());  
60 - }  
61 - else {  
62 - check.setModifier(SessionUtil.getUser());  
63 - check.setModifyDate(new Date());  
64 - }  
65 - return billCheckRepository.save(check);  
66 - } 24 +@Service("billCheckService")
  25 +public class BillCheckService extends BasicService<BillCheckEntity> {
  26 +
  27 + @Resource
  28 + private BillCheckRepository billCheckRepository;
  29 +
  30 + /**
  31 + * 分页查询
  32 + *
  33 + * @param pageForm 分页对象
  34 + * @return 包含分页信息和数据的分页对象
  35 + */
  36 + public Page<BillCheckEntity> getPage(EasyPage<BillCheckEntity> pageForm) {
  37 + PageRequest pageRequest = buildPageRequest(pageForm);
  38 + Specification<BillCheckEntity> spec = buildSpecification(pageForm);
  39 + Page<BillCheckEntity> page = billCheckRepository.findAll(spec, pageRequest);
  40 + return page;
  41 + }
  42 +
  43 + public BillCheckEntity findByStationAndDate(String station, String date, Long creator) {
  44 + if (StringUtils.isEmpty(station)) {
  45 + return billCheckRepository.findByDate(date, creator);
  46 + } else {
  47 + return billCheckRepository.findByStationAndDate(station, date, creator);
  48 + }
  49 + }
  50 +
  51 + public BillCheckEntity findOne(Long id) {
  52 + return billCheckRepository.findOne(id);
  53 + }
  54 +
  55 + public BillCheckEntity last() {
  56 + return billCheckRepository.last();
  57 + }
  58 +
  59 + public boolean exist(String mawbNo) {
  60 + List<BillCheckEntity> list = billCheckRepository.exist(mawbNo);
  61 + return list != null && !list.isEmpty();
  62 + }
  63 +
  64 + public BillCheckEntity find(String mawbNo) {
  65 + List<BillCheckEntity> list = billCheckRepository.exist(mawbNo);
  66 + if (list != null && !list.isEmpty()) {
  67 + return list.get(0);
  68 + }
  69 +
  70 + return null;
  71 + }
  72 +
  73 + @Transactional
  74 + public BillCheckEntity save(BillCheckBean bean) {
  75 + if (bean == null) {
  76 + return null;
  77 + }
  78 +
  79 + BillCheckEntity check = new BillCheckEntity();
  80 + check.setBizope(bean.getBizope());
  81 + check.setCdate(bean.getCdate());
  82 + check.setChgseq(bean.getChgseq());
  83 + check.setCode(bean.getCode());
  84 + check.setCreateDate(new Date());
  85 + check.setCuscode(bean.getCuscode());
  86 + check.setCusnm(bean.getCusnm());
  87 + check.setCusrnm(bean.getCusrnm());
  88 + check.setDiflag(bean.getDiflag());
  89 + check.setEiflag(bean.getEiflag());
  90 + check.setFid(bean.getFid());
  91 + check.setPaymode(bean.getPaymode());
  92 + check.setStation(bean.getStation());
  93 + check.setType(bean.getType());
  94 +
  95 + return billCheckRepository.save(check);
  96 + }
  97 +
  98 + @Transactional
  99 + public BillCheckEntity updateTotal(String mawbNo, String total) {
  100 + if (mawbNo == null || total == null) {
  101 + return null;
  102 + }
  103 +
  104 + BillCheckEntity check = find(mawbNo);
  105 + check.setCode(mawbNo);
  106 + check.setTotal(total);
  107 +
  108 + return billCheckRepository.save(check);
  109 + }
67 } 110 }
@@ -98,7 +98,7 @@ import tools.Tools; @@ -98,7 +98,7 @@ import tools.Tools;
98 /** 98 /**
99 * Created by cohesion on 2017/4/19. 99 * Created by cohesion on 2017/4/19.
100 */ 100 */
101 -@Service 101 +@Service("manifestService")
102 public class ManifestService extends BasicService<ManifestEntity> { 102 public class ManifestService extends BasicService<ManifestEntity> {
103 103
104 @Resource 104 @Resource
@@ -199,6 +199,15 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -199,6 +199,15 @@ public class ManifestService extends BasicService<ManifestEntity> {
199 public List<ManifestEntity> findByManifestNo(String mawbNo) { 199 public List<ManifestEntity> findByManifestNo(String mawbNo) {
200 return manifestRepository.findByMawbNo(mawbNo); 200 return manifestRepository.findByMawbNo(mawbNo);
201 } 201 }
  202 +
  203 + public ManifestEntity findFirst(String mawbNo) {
  204 + List<ManifestEntity> list = manifestRepository.findByMawbNo(mawbNo);
  205 + if(list!=null&&!list.isEmpty()) {
  206 + return list.get(0);
  207 + }
  208 +
  209 + return null;
  210 + }
202 211
203 public List<ManifestEntity> queryAll() { 212 public List<ManifestEntity> queryAll() {
204 return manifestRepository.queryAll(); 213 return manifestRepository.queryAll();
@@ -342,7 +351,7 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -342,7 +351,7 @@ public class ManifestService extends BasicService<ManifestEntity> {
342 mcs.setCategory(manifest.getCategory() != null ? manifest.getCategory() : ""); 351 mcs.setCategory(manifest.getCategory() != null ? manifest.getCategory() : "");
343 352
344 ManifestConsigneeXml consignee = new ManifestConsigneeXml(); 353 ManifestConsigneeXml consignee = new ManifestConsigneeXml();
345 - consignee.setName(manifest.getSh_name()); 354 + consignee.setName(manifest.getSh_company());
346 355
347 ManifestAddressXml madd = new ManifestAddressXml(); 356 ManifestAddressXml madd = new ManifestAddressXml();
348 madd.setLine(manifest.getSh_address()); 357 madd.setLine(manifest.getSh_address());
@@ -17,7 +17,8 @@ import redis.clients.jedis.Jedis; @@ -17,7 +17,8 @@ import redis.clients.jedis.Jedis;
17 */ 17 */
18 class XmlSendTask extends Thread { 18 class XmlSendTask extends Thread {
19 // 创建 缓存服务器的地址ip 19 // 创建 缓存服务器的地址ip
20 - private Jedis jedis = new Jedis("10.50.3.71", 6379); 20 +// private Jedis jedis = new Jedis("10.50.3.71", 6379);
  21 + private Jedis jedis = new Jedis("10.50.3.84", 6379);
21 22
22 private String xml; 23 private String xml;
23 24
  1 +package com.framework.util;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.Date;
  5 +
  6 +import javax.crypto.Cipher;
  7 +import javax.crypto.spec.IvParameterSpec;
  8 +import javax.crypto.spec.SecretKeySpec;
  9 +
  10 +import com.jfinal.kit.HttpKit;
  11 +
  12 +import sun.misc.BASE64Decoder;
  13 +import sun.misc.BASE64Encoder;
  14 +
  15 +public class AesCBC {
  16 + /*
  17 + * 已确认 加密用的Key 可以用26个字母和数字组成 此处使用AES-128-CBC加密模式,key需要为16位。
  18 + */
  19 +// public final static String sKey = "aaaaaaaaaaaaaaaa";
  20 + public final static String ivParameter = "0000000000000000";
  21 + private static AesCBC instance = null;
  22 +
  23 + // private static
  24 + private AesCBC() {
  25 +
  26 + }
  27 +
  28 + public static AesCBC getInstance() {
  29 + if (instance == null)
  30 + instance = new AesCBC();
  31 + return instance;
  32 + }
  33 +
  34 + public static String getKey() {
  35 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
  36 + Date date = new Date();
  37 + String formatDate = sdf.format(date);
  38 + Date d = new Date(System.currentTimeMillis());
  39 + String key = formatDate + "owenkasduf" + (new SimpleDateFormat("MM")).format(d);
  40 + return key;
  41 + }
  42 +
  43 + // 加密
  44 + public String encrypt(String sSrc, String encodingFormat, String sKey, String ivParameter) {
  45 + try {
  46 + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  47 + byte[] raw = sKey.getBytes();
  48 + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
  49 + IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes());// 使用CBC模式,需要一个向量iv,可增加加密算法的强度
  50 + cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
  51 +// cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
  52 + byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat));
  53 + return new BASE64Encoder().encode(encrypted);// 此处使用BASE64做转码。
  54 + } catch (Exception e) {
  55 + }
  56 +
  57 + return null;
  58 + }
  59 +
  60 + // 解密
  61 + public String decrypt(String sSrc, String encodingFormat, String sKey, String ivParameter) {
  62 + try {
  63 + byte[] raw = sKey.getBytes("ASCII");
  64 + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
  65 + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  66 + IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes());
  67 + cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
  68 +// cipher.init(Cipher.DECRYPT_MODE, skeySpec);
  69 + byte[] encrypted1 = new BASE64Decoder().decodeBuffer(sSrc);// 先用base64解密
  70 + byte[] original = cipher.doFinal(encrypted1);
  71 + String originalString = new String(original, encodingFormat);
  72 + return originalString;
  73 + } catch (Exception ex) {
  74 + return null;
  75 + }
  76 + }
  77 +
  78 + public static void main(String[] args) throws Exception {
  79 + // 需要加密的字串
  80 +// String cSrc = "aqswed1234";
  81 +// System.out.println("加密前的字串是:" + cSrc);
  82 +// // 加密
  83 +// String enString = AesCBC.getInstance().encrypt(cSrc, "utf-8", getKey(), ivParameter);
  84 +// System.out.println("加密后的字串是:" + enString);
  85 +// BASE64Encoder encoder = new BASE64Encoder();
  86 +// List<NameValuePair> params = new ArrayList<NameValuePair>();
  87 +// params.add(new BasicNameValuePair("data", enString));
  88 + String params = "data=YCbPytqeduiEj0PGGIeF5Q4rgxJNd59JCtJ5duHrzN8bKvlc8wGhqVyCraamqwNCwb+eGhCBoZ3v\r\n" +
  89 + "6SD39qXHKZTDCh/69wufSze7D1b9KMQ=";
  90 + String result = HttpKit.post("http://zzcargo.com:8080/index.php?r=api/index", params);
  91 + System.out.println(result);
  92 + // 解密
  93 +// String DeString = AesCBC.getInstance().decrypt(result,"utf-8",sKey,ivParameter);
  94 +// System.out.println("解密后的字串是:" + DeString);
  95 + }
  96 +}
  1 +package com.framework.util;
  2 +
  3 +import java.lang.reflect.Type;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +
  7 +import com.google.gson.Gson;
  8 +import com.google.gson.JsonArray;
  9 +import com.google.gson.JsonElement;
  10 +import com.google.gson.JsonParser;
  11 +
  12 +/**
  13 + * Depiction:
  14 + * <p>
  15 + * Modify:
  16 + * <p>
  17 + * Author: Kevin Lynn
  18 + * <p>
  19 + * Create Date:2018年4月23日 下午6:48:25
  20 + *
  21 + */
  22 +public class JsonKit {
  23 +
  24 + public JsonKit() {
  25 + }
  26 +
  27 + /**
  28 + * Json数据解析
  29 + *
  30 + * @param <T>
  31 + * @param json
  32 + * json源串
  33 + * @return List<T>
  34 + */
  35 + public static <T> List<T> parseArray(String json, Class<T> type) {
  36 + List<T> list = new ArrayList<T>();
  37 + try {
  38 + Gson gson = new Gson();
  39 + JsonParser parser = new JsonParser();
  40 + JsonArray jsonarray = parser.parse(json).getAsJsonArray();
  41 + for (JsonElement element : jsonarray) {
  42 + list.add(gson.fromJson(element, type));
  43 + }
  44 + } catch (Exception e) {
  45 + System.err.println("JsonKit parseArray()" + e.toString());
  46 + System.err.println();
  47 + }
  48 + return list;
  49 + }
  50 +
  51 + /**
  52 + * Json数据解析
  53 + *
  54 + * @param json
  55 + * json源串
  56 + * @param cls
  57 + * 存储json的实体类
  58 + * @return 相应的实体类对象
  59 + */
  60 + public static <T> T parseJson(String json, Type cls) {
  61 + try {
  62 + Gson gson = new Gson();
  63 + return gson.fromJson(json, cls);
  64 + } catch (Exception e) {
  65 + System.err.println(cls.getClass().getSimpleName() + " parseJson()" + e.toString());
  66 + System.err.println();
  67 + }
  68 + return null;
  69 + }
  70 +}
@@ -4,52 +4,60 @@ import java.util.HashMap; @@ -4,52 +4,60 @@ import java.util.HashMap;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import com.agent.entity.system.UserEntity; 6 import com.agent.entity.system.UserEntity;
7 -import com.alibaba.fastjson.JSONObject; 7 +import com.framework.util.AesCBC;
8 8
9 import tools.HttpTools; 9 import tools.HttpTools;
10 10
11 public class FLogin { 11 public class FLogin {
  12 +
  13 + public static void main(String[] args) {
  14 + UserEntity user = new UserEntity();
  15 + user.setLoginaccount("wangshan");
  16 + user.setPassword("123456");
  17 + LoginData ret = login(user);
  18 + System.err.println("ret-->" + ret.toJson());
  19 + }
  20 +
12 public static LoginData login(UserEntity user) { 21 public static LoginData login(UserEntity user) {
13 LoginData logindata = new LoginData(); 22 LoginData logindata = new LoginData();
14 23
15 InfoData info = new InfoData(); 24 InfoData info = new InfoData();
16 - String param = "ssid=5672813&data=";  
17 - InterfaceData id = new InterfaceData();  
18 - id.setKey("owenkasduf"); 25 +// String param = "ssid=5672813&data=";
  26 + InterfaceData params = new InterfaceData();
  27 + params.setKey("owenkasduf");
19 // id.setUsername("wangshan"); 28 // id.setUsername("wangshan");
20 // id.setPwd("123456"); 29 // id.setPwd("123456");
21 - id.setUsername(user.getLoginaccount());  
22 - id.setPwd(user.getPassword());  
23 - id.setType("2");  
24 - // System.out.println(Security.getKey()); 30 + params.setUsername(user.getLoginaccount());
  31 + params.setPwd(user.getPassword());
  32 + params.setType("2");
  33 +
25 // 构造请求数据包(并且加密data数据) 34 // 构造请求数据包(并且加密data数据)
26 - String data = Security.encrypt(JSONObject.toJSONString(id), Security.getKey());  
27 - param = param + data;  
28 - // System.err.println("param-->"+param);  
29 - // 发送登录消息  
30 - // String receive =  
31 - // HttpRequest.sendPost("http://10.50.2.24/index.php?r=api/index", param);  
32 - // String receive =  
33 - // HttpRequest.sendPost("http://10.50.2.20/index.php?r=api/index", param);  
34 - // String receive =  
35 - // HttpRequest.sendPost("http://www.zzcargo.com/index.php?r=api/index", param); 35 +// String data = Security.encrypt(JSONObject.toJSONString(id), Security.getKey());
  36 +// param = param + data;
  37 +
  38 + String source = params.toJson();
  39 + System.err.println("source-->" + source);
  40 +
  41 + String key = AesCBC.getKey();
  42 + System.err.println("key-->" + key);
  43 +
  44 + String data = AesCBC.getInstance().encrypt(source, "utf-8", key, AesCBC.ivParameter);
  45 +
  46 + System.err.println("参数密文:" + data);
36 47
37 Map<String, String> map = new HashMap<String, String>(); 48 Map<String, String> map = new HashMap<String, String>();
38 map.put("ssid", "5672813"); 49 map.put("ssid", "5672813");
39 map.put("data", data); 50 map.put("data", data);
40 String receive = HttpTools.sendPost("http://www.zzcargo.com/index.php?r=api/index", map, "UTF-8"); 51 String receive = HttpTools.sendPost("http://www.zzcargo.com/index.php?r=api/index", map, "UTF-8");
41 - /// index.php?r=site/login  
42 -// System.err.println("receive-->"+receive); 52 +// String receive = HttpTools.sendPost("http://zzcargo.com:8080/index.php?r=api/index", map, "UTF-8");
43 try { 53 try {
44 // 转换接收到的数据 54 // 转换接收到的数据
45 FJSON.JsonToObject(logindata, receive); 55 FJSON.JsonToObject(logindata, receive);
46 // 验证通过 56 // 验证通过
47 if (logindata.getCode() == 20000) { 57 if (logindata.getCode() == 20000) {
48 // 对传回的数据解密 58 // 对传回的数据解密
49 - String raw = Security.decrypt(logindata.getInfo(), Security.getKey());  
50 - // show message  
51 -// System.err.println("raw-->"+raw);  
52 - 59 +// String raw = Security.decrypt(logindata.getInfo(), Security.getKey());
  60 + String raw = AesCBC.getInstance().decrypt(logindata.getInfo(), "utf-8", key, AesCBC.ivParameter);
53 logindata.setInfo(raw); 61 logindata.setInfo(raw);
54 // 将解密后的数据转回json 62 // 将解密后的数据转回json
55 FJSON.JsonToObject(info, logindata.getInfo()); 63 FJSON.JsonToObject(info, logindata.getInfo());
@@ -60,17 +68,6 @@ public class FLogin { @@ -60,17 +68,6 @@ public class FLogin {
60 logindata.setCode(0); 68 logindata.setCode(0);
61 69
62 } 70 }
63 - // 测试的数据  
64 - // InfoData id = new InfoData();  
65 - //  
66 - // id.setMobile("fadf");  
67 - // id.setCompany_info("flasdjf");  
68 - // id.setQq("fasdf");  
69 - // id.setContact("fffffffff");  
70 - // id.setAddress("fafda");  
71 - // id.setCompany("fafdadf");  
72 - // logindata.setCode(20000);  
73 - // logindata.setInfodata(id);  
74 return logindata; 71 return logindata;
75 } 72 }
76 } 73 }
1 package login; 1 package login;
2 2
  3 +import com.google.gson.Gson;
  4 +
3 public class InterfaceData { 5 public class InterfaceData {
4 private String key; 6 private String key;
5 private String username; 7 private String username;
@@ -37,4 +39,8 @@ public class InterfaceData { @@ -37,4 +39,8 @@ public class InterfaceData {
37 public void setType(String type) { 39 public void setType(String type) {
38 this.type = type; 40 this.type = type;
39 } 41 }
  42 +
  43 + public String toJson() {
  44 + return new Gson().toJson(this);
  45 + }
40 } 46 }
1 package login; 1 package login;
2 2
  3 +import com.google.gson.Gson;
  4 +
3 public class LoginData { 5 public class LoginData {
4 private int code; 6 private int code;
5 private String info; 7 private String info;
@@ -28,5 +30,8 @@ public class LoginData { @@ -28,5 +30,8 @@ public class LoginData {
28 this.infodata = infodata; 30 this.infodata = infodata;
29 } 31 }
30 32
  33 + public String toJson() {
  34 + return new Gson().toJson(this);
  35 + }
31 36
32 } 37 }
1 package login; 1 package login;
2 2
3 -  
4 import java.text.SimpleDateFormat; 3 import java.text.SimpleDateFormat;
5 import java.util.Date; 4 import java.util.Date;
6 5
@@ -10,38 +9,39 @@ import javax.crypto.spec.SecretKeySpec; @@ -10,38 +9,39 @@ import javax.crypto.spec.SecretKeySpec;
10 import org.apache.commons.codec.binary.Base64; 9 import org.apache.commons.codec.binary.Base64;
11 10
12 public class Security { 11 public class Security {
13 - public static String getKey(){ 12 + public static String getKey() {
14 SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); 13 SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
15 - Date date = new Date();  
16 - String formatDate = sdf.format(date); 14 + Date date = new Date();
  15 + String formatDate = sdf.format(date);
17 Date d = new Date(System.currentTimeMillis()); 16 Date d = new Date(System.currentTimeMillis());
18 - String key = formatDate+"owenkasduf"+(new SimpleDateFormat("MM")).format(d); 17 + String key = formatDate + "owenkasduf" + (new SimpleDateFormat("MM")).format(d);
19 return key; 18 return key;
20 } 19 }
21 - public static String encrypt(String input, String key){  
22 - byte[] crypted = null;  
23 - try{  
24 - SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES");  
25 - Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");  
26 - cipher.init(Cipher.ENCRYPT_MODE, skey);  
27 - crypted = cipher.doFinal(input.getBytes());  
28 - }catch(Exception e){  
29 - System.out.println(e.toString());  
30 - }  
31 - return new String(Base64.encodeBase64(crypted)); 20 +
  21 + public static String encrypt(String input, String key) {
  22 + byte[] crypted = null;
  23 + try {
  24 + SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES");
  25 + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
  26 + cipher.init(Cipher.ENCRYPT_MODE, skey);
  27 + crypted = cipher.doFinal(input.getBytes());
  28 + } catch (Exception e) {
  29 + System.out.println(e.toString());
  30 + }
  31 + return new String(Base64.encodeBase64(crypted));
32 } 32 }
33 -  
34 - public static String decrypt(String input, String key){  
35 - byte[] output = null;  
36 - try{  
37 - SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES");  
38 - Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");  
39 - cipher.init(Cipher.DECRYPT_MODE, skey);  
40 - output = cipher.doFinal(Base64.decodeBase64(input));  
41 - }catch(Exception e){  
42 - System.out.println(e.toString());  
43 - }  
44 - return new String(output); 33 +
  34 + public static String decrypt(String input, String key) {
  35 + byte[] output = null;
  36 + try {
  37 + SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES");
  38 + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
  39 + cipher.init(Cipher.DECRYPT_MODE, skey);
  40 + output = cipher.doFinal(Base64.decodeBase64(input));
  41 + } catch (Exception e) {
  42 + System.out.println(e.toString());
  43 + }
  44 + return new String(output);
45 } 45 }
46 46
47 } 47 }
不能预览此文件类型
@@ -141,5 +141,7 @@ @@ -141,5 +141,7 @@
141 </bean> 141 </bean>
142 142
143 <bean id="startupListener" class="com.agent.listener.StartupListener"/> 143 <bean id="startupListener" class="com.agent.listener.StartupListener"/>
  144 +
  145 + <bean id="SpringContextKit" class="com.agent.billcheck.SpringContextKit" scope="singleton"></bean>
144 146
145 </beans> 147 </beans>
@@ -120,4 +120,7 @@ @@ -120,4 +120,7 @@
120 </bean> 120 </bean>
121 </mvc:interceptors> 121 </mvc:interceptors>
122 122
  123 + <!-- <context:component-scan base-package="com.agent.billcheck"/>
  124 + <task:annotation-driven/> -->
  125 +
123 </beans> 126 </beans>
  1 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  8 + + path + "/";
  9 +%>
  10 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  11 +<html>
  12 +<head>
  13 +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  14 +<meta name="viewport" content="width=device-width, initial-scale=1">
  15 +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  16 +<title><spring:message code="menu.consignee_info_set" /></title>
  17 +<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js?version=${version}"></script>
  18 +<script type="text/javascript"
  19 + src="<%=basePath%>resource/validate/jquery.validate.js?version=${version}"></script>
  20 +<script type="text/javascript"
  21 + src="<%=basePath%>resource/validate/validate-extends.js?version=${version}"></script>
  22 +<!-- validate 验证中英文 -->
  23 +<script type="text/javascript"
  24 + src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js?version=${version}"></script>
  25 +<link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css?version=${version}"
  26 + media="all">
  27 +<script type="text/javascript" src="<%=basePath%>resource/layui/layui.js?version=${version}"></script>
  28 +<script type="text/javascript" src="<%=basePath%>resource/js/tools.js?version=${version}"></script>
  29 +</head>
  30 +<body>
  31 + <div>
  32 + <div class="layui-row">
  33 + <div class="layui-col-md1">
  34 + <h4 style="margin-top: 10px;">交运货站:</h4>
  35 + </div>
  36 + <div class="layui-col-md2" style="margin-left: -30px;">
  37 + <form class="layui-form">
  38 + <select id="status" name="status">
  39 + <option value="-1">全部</option>
  40 + <option value="0">西货运区国内主体货站</option>
  41 + <option value="1">西货运区国际主体货站</option>
  42 + <option value="2">西货运区国际二级货站</option>
  43 + <option value="2">西货运区国际综保货站</option>
  44 + <option value="2">西货运区国际快邮货站</option>
  45 + </select>
  46 + </form>
  47 + </div>
  48 +
  49 + <div class="layui-col-md1">
  50 + <h4 style="margin-top: 10px; margin-left: 30px;">付款月份:</h4>
  51 + </div>
  52 +
  53 + <div class="layui-col-md2">
  54 + <input type="text" class="layui-input" id="start_time" name="start_time" autocomplete="off">
  55 + </div>
  56 + <div class="layui-col-md2" style="margin-left: 10px;">
  57 + <input type="text" class="layui-input" id="end_time" name="end_time" autocomplete="off">
  58 + </div>
  59 + <div class="layui-col-md1" style="margin-left: 10px;">
  60 + <button class="layui-btn layui-btn-normal" onclick="doSearch()">搜索</button>
  61 + </div>
  62 + </div>
  63 + <table id="data-table" class="layui-hide" lay-filter="data-table"></table>
  64 + </div>
  65 +
  66 + <script type="text/html" id="opt-bar">
  67 + <div class="layui-btn-group">
  68 + <button class="layui-btn layui-btn-sm" lay-event="details">
  69 + 明细
  70 + </button>
  71 + </div>
  72 + </script>
  73 +
  74 + <script>
  75 + var layer;
  76 + layui.use(['layer','element','laydate'], function() {
  77 + layer = layui.layer;
  78 + var element = layui.element;
  79 +
  80 + var laydate = layui.laydate;
  81 + laydate.render({
  82 + elem : '#start_time',
  83 + format: "yyyy-MM-dd",
  84 + value: new Date()
  85 + });
  86 +
  87 + laydate.render({
  88 + elem : '#end_time',
  89 + format: "yyyy-MM-dd",
  90 + value: new Date()
  91 + });
  92 + });
  93 +
  94 + $(window).load(function() {
  95 + doSearch();
  96 + });
  97 +
  98 + var table;
  99 + function doSearch() {
  100 + var api = "<%=basePath%>billcheck/search";
  101 + var start_date = $("#start_time").val();
  102 + var end_date = $("#end_time").val();
  103 +
  104 + layui.use('table', function() {
  105 + table = layui.table;
  106 + table.render({
  107 + elem : '#data-table',
  108 + url : api,
  109 + limit : 10,
  110 + page : true,
  111 + loading : true,
  112 + limits : [ 10, 15, 20, 25, 30, 35, 40, 45, 50 ],
  113 + text : {none:'暂无数据'},
  114 + cols : [ [ //表头
  115 + {
  116 + field : 'code',
  117 + title : '运单号',
  118 + width : 120
  119 + }, {
  120 + field : 'eiflag',
  121 + title : '进出港标识'
  122 + }, {
  123 + field : 'diflag',
  124 + title : '国际国内标识'
  125 + }, {
  126 + field : 'station',
  127 + title : '营业点'
  128 + }, {
  129 + field : 'cdate',
  130 + title : '计费时间'
  131 + },{
  132 + field : 'cusnm',
  133 + title : '缴费人'
  134 + }, {
  135 + field : 'paymode',
  136 + title : '支付方式'
  137 + },{
  138 + field : 'total',
  139 + title : '总计',
  140 + width : 100
  141 + },{
  142 + field : '',
  143 + title : '操作',
  144 + toolbar : '#opt-bar',
  145 + width : 80
  146 + } ] ]
  147 + });
  148 + });
  149 + }
  150 +
  151 + layui.use('table', function() {
  152 + var table = layui.table;
  153 + table.on('tool(data-table)', function(obj) {
  154 + var data = obj.data;
  155 + var layEvent = obj.event;
  156 + var tr = obj.tr; //获得当前行 tr 的DOM对象
  157 +
  158 + if (layEvent === 'details') {
  159 + //明细
  160 +
  161 + }
  162 + });
  163 + });
  164 +
  165 + </script>
  166 +</body>
  167 +</html>