Order.java 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. /*
  2. *
  3. *
  4. *
  5. */
  6. package com.hboxs.entity;
  7. import com.fasterxml.jackson.annotation.JsonValue;
  8. import javax.persistence.Column;
  9. import javax.persistence.Entity;
  10. import javax.persistence.SequenceGenerator;
  11. import javax.persistence.Table;
  12. import java.math.BigDecimal;
  13. import java.util.Date;
  14. import java.util.HashMap;
  15. import java.util.Map;
  16. /**
  17. * Entity - 订单流水
  18. */
  19. @Entity
  20. @Table(name = "t_order")
  21. @SequenceGenerator(name = "sequenceGenerator", sequenceName = "t_order_sequence")
  22. public class Order extends BaseEntity {
  23. private static final long serialVersionUID = -6614222055528827322L;
  24. public Order(){
  25. super();
  26. }
  27. public Order(String sn , Long productId, String productName, BigDecimal price, String clientId, Long equipmentId, Type type , Long adminId,
  28. Long agencyId , Long merchantId , Long personageId ,
  29. String frp_code, String altInfo, BigDecimal adminProportion, BigDecimal agencyProportion,
  30. BigDecimal merchantProportion, BigDecimal personageProportion, Status status) {
  31. this.sn = sn;
  32. this.productId = productId;
  33. this.productName = productName;
  34. this.price = price;
  35. this.clientId = clientId;
  36. this.equipmentId = equipmentId;
  37. this.adminId = adminId;
  38. this.type = type;
  39. this.agencyId = agencyId;
  40. this.merchantId = merchantId;
  41. this.personageId = personageId;
  42. this.frp_code = frp_code;
  43. this.altInfo = altInfo;
  44. this.adminProportion = adminProportion;
  45. this.agencyProportion = agencyProportion;
  46. this.merchantProportion = merchantProportion;
  47. this.personageProportion = personageProportion;
  48. this.status = status;
  49. }
  50. /**
  51. * 订单编号
  52. */
  53. private String sn;
  54. /**
  55. * 商品id
  56. */
  57. private Long productId;
  58. /**
  59. * 花型名称
  60. */
  61. private String productName;
  62. /**
  63. * 价格
  64. */
  65. private BigDecimal price;
  66. /**
  67. * 设备推送码
  68. */
  69. private String clientId;
  70. /**
  71. * 备注
  72. */
  73. private String note;
  74. /**
  75. * 设备id
  76. */
  77. private Long equipmentId;
  78. /**
  79. * 所属商家id
  80. */
  81. private Long adminId;
  82. /**
  83. * 类型
  84. */
  85. public enum Type {
  86. /**
  87. * 管理员
  88. */
  89. admin,
  90. /**
  91. * 代理商
  92. */
  93. agency,
  94. /**
  95. * 经销商
  96. */
  97. merchant,
  98. /**
  99. * 个人商家
  100. */
  101. personage;
  102. private static Map<String, Type> map = new HashMap<>();
  103. static {
  104. map.put("管理员", admin);
  105. map.put("省级", agency);
  106. map.put("市级", merchant);
  107. map.put("终端", personage);
  108. }
  109. public static Type forValue(String value) {
  110. return map.get(value);
  111. }
  112. @JsonValue
  113. public String toValue() {
  114. for (Map.Entry<String, Type> entry : map.entrySet()) {
  115. if (entry.getValue() == this) {
  116. return entry.getKey();
  117. }
  118. }
  119. return "";
  120. }
  121. }
  122. /**
  123. * 商家类型
  124. */
  125. private Type type;
  126. /**
  127. * 代理商id
  128. */
  129. private Long agencyId;
  130. /**
  131. * 经销商id
  132. */
  133. private Long merchantId;
  134. /**
  135. * 个人商家id
  136. */
  137. private Long personageId;
  138. /**
  139. * 支付方式
  140. */
  141. private String frp_code;
  142. /**
  143. * 分销逻辑
  144. */
  145. private String altInfo;
  146. /**
  147. * 支付时间
  148. */
  149. private Date payDate;
  150. /**
  151. * 退款时间
  152. */
  153. private Date refundDate;
  154. /**
  155. * 支付流水号
  156. */
  157. private String trxNo;
  158. /**
  159. * 退款流水号
  160. */
  161. private String refundTrxNo;
  162. /**
  163. * 退款金额
  164. */
  165. private BigDecimal refundAmount;
  166. /**
  167. * 申请支付时分销的逻辑:admin比例
  168. */
  169. private BigDecimal adminProportion;
  170. /**
  171. * 申请支付时分销的逻辑:代理比例
  172. */
  173. private BigDecimal agencyProportion;
  174. /**
  175. * 申请支付时分销的逻辑:商家比例
  176. */
  177. private BigDecimal merchantProportion;
  178. /**
  179. * 申请支付时分销的逻辑:个人商家比例
  180. */
  181. private BigDecimal personageProportion;
  182. /**
  183. * 状态
  184. */
  185. public enum Status {
  186. /**
  187. * 未支付
  188. */
  189. unpay,
  190. /**
  191. * 已支付
  192. */
  193. pay,
  194. /**
  195. * 退款中:短暂状态
  196. */
  197. applyRefund,
  198. /**
  199. * 已退款
  200. */
  201. refund;
  202. private static Map<String, Status> map = new HashMap<>();
  203. static {
  204. map.put("未支付", unpay);
  205. map.put("已支付", pay);
  206. map.put("退款中", applyRefund);
  207. map.put("已退款", refund);
  208. }
  209. public static Status forValue(String value) {
  210. return map.get(value);
  211. }
  212. @JsonValue
  213. public String toValue() {
  214. for (Map.Entry<String, Status> entry : map.entrySet()) {
  215. if (entry.getValue() == this) {
  216. return entry.getKey();
  217. }
  218. }
  219. return "";
  220. }
  221. }
  222. /**
  223. * 状态
  224. */
  225. private Status status;
  226. @Column(nullable = false, updatable = false, unique = true, length = 100)
  227. public String getSn() {
  228. return sn;
  229. }
  230. public void setSn(String sn) {
  231. this.sn = sn;
  232. }
  233. public String getNote() {
  234. return note;
  235. }
  236. public void setNote(String note) {
  237. this.note = note;
  238. }
  239. public String getProductName() {
  240. return productName;
  241. }
  242. public void setProductName(String productName) {
  243. this.productName = productName;
  244. }
  245. public BigDecimal getPrice() {
  246. return price;
  247. }
  248. public void setPrice(BigDecimal price) {
  249. this.price = price;
  250. }
  251. public String getClientId() {
  252. return clientId;
  253. }
  254. public void setClientId(String clientId) {
  255. this.clientId = clientId;
  256. }
  257. public Long getEquipmentId() {
  258. return equipmentId;
  259. }
  260. public void setEquipmentId(Long equipmentId) {
  261. this.equipmentId = equipmentId;
  262. }
  263. public Long getAdminId() {
  264. return adminId;
  265. }
  266. public void setAdminId(Long adminId) {
  267. this.adminId = adminId;
  268. }
  269. public String getFrp_code() {
  270. return frp_code;
  271. }
  272. public void setFrp_code(String frp_code) {
  273. this.frp_code = frp_code;
  274. }
  275. public String getAltInfo() {
  276. return altInfo;
  277. }
  278. public void setAltInfo(String altInfo) {
  279. this.altInfo = altInfo;
  280. }
  281. public Status getStatus() {
  282. return status;
  283. }
  284. public void setStatus(Status status) {
  285. this.status = status;
  286. }
  287. public Long getProductId() {
  288. return productId;
  289. }
  290. public void setProductId(Long productId) {
  291. this.productId = productId;
  292. }
  293. public BigDecimal getAdminProportion() {
  294. return adminProportion;
  295. }
  296. public void setAdminProportion(BigDecimal adminProportion) {
  297. this.adminProportion = adminProportion;
  298. }
  299. public BigDecimal getAgencyProportion() {
  300. return agencyProportion;
  301. }
  302. public void setAgencyProportion(BigDecimal agencyProportion) {
  303. this.agencyProportion = agencyProportion;
  304. }
  305. public BigDecimal getMerchantProportion() {
  306. return merchantProportion;
  307. }
  308. public void setMerchantProportion(BigDecimal merchantProportion) {
  309. this.merchantProportion = merchantProportion;
  310. }
  311. public BigDecimal getPersonageProportion() {
  312. return personageProportion;
  313. }
  314. public void setPersonageProportion(BigDecimal personageProportion) {
  315. this.personageProportion = personageProportion;
  316. }
  317. public Type getType() {
  318. return type;
  319. }
  320. public void setType(Type type) {
  321. this.type = type;
  322. }
  323. public Long getAgencyId() {
  324. return agencyId;
  325. }
  326. public void setAgencyId(Long agencyId) {
  327. this.agencyId = agencyId;
  328. }
  329. public Long getMerchantId() {
  330. return merchantId;
  331. }
  332. public void setMerchantId(Long merchantId) {
  333. this.merchantId = merchantId;
  334. }
  335. public Long getPersonageId() {
  336. return personageId;
  337. }
  338. public void setPersonageId(Long personageId) {
  339. this.personageId = personageId;
  340. }
  341. public Date getPayDate() {
  342. return payDate;
  343. }
  344. public void setPayDate(Date payDate) {
  345. this.payDate = payDate;
  346. }
  347. public Date getRefundDate() {
  348. return refundDate;
  349. }
  350. public void setRefundDate(Date refundDate) {
  351. this.refundDate = refundDate;
  352. }
  353. public String getTrxNo() {
  354. return trxNo;
  355. }
  356. public void setTrxNo(String trxNo) {
  357. this.trxNo = trxNo;
  358. }
  359. public String getRefundTrxNo() {
  360. return refundTrxNo;
  361. }
  362. public void setRefundTrxNo(String refundTrxNo) {
  363. this.refundTrxNo = refundTrxNo;
  364. }
  365. public BigDecimal getRefundAmount() {
  366. return refundAmount;
  367. }
  368. public void setRefundAmount(BigDecimal refundAmount) {
  369. this.refundAmount = refundAmount;
  370. }
  371. }