Plan.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package com.ruoyi.demo.entity;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableId;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import com.fasterxml.jackson.annotation.JsonFormat;
  7. import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
  8. import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  9. import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
  10. import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
  11. import com.ruoyi.demo.entity.bo.PlanAddBo;
  12. import com.ruoyi.demo.utils.OnStateUtil;
  13. import com.ruoyi.demo.utils.StateUtil;
  14. import lombok.Data;
  15. import java.time.LocalDateTime;
  16. import java.time.ZoneId;
  17. import java.time.format.DateTimeFormatter;
  18. @Data
  19. @TableName("dl_plan")
  20. public class Plan {
  21. @TableId(value = "plan_id",type = IdType.ASSIGN_ID)
  22. private String planId;
  23. @TableField("plan_name")
  24. private String planName;
  25. @TableField("commercial_id")
  26. private String commercialId;
  27. @TableField("commercial_name")
  28. private String commercialName;
  29. @TableField("appkey")
  30. private String appkey;
  31. @TableField("app_name")
  32. private String appName;
  33. @TableField("vendor_id")
  34. private String vendorId;
  35. @TableField("vendor_name")
  36. private String vendorName;
  37. @TableField("goods_id")
  38. private String goodsId;
  39. @TableField("goods_img")
  40. private String goodsImg;
  41. @TableField("goods_name")
  42. private String goodsName;
  43. @TableField("goods_logo")
  44. private String goodsLogo;
  45. @TableField("goods_introduce")
  46. private String goodsIntroduce;
  47. @TableField("goods_price")
  48. private Float goodsPrice;
  49. @TableField("goods_classify")
  50. private String goodsClassify;
  51. @TableField("plan_create_time")
  52. @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  53. @JsonSerialize(using = LocalDateTimeSerializer.class)
  54. @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  55. private LocalDateTime planCreateTime;
  56. @TableField("plan_start_time")
  57. @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  58. @JsonSerialize(using = LocalDateTimeSerializer.class)
  59. @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  60. private LocalDateTime planStartTime;
  61. @TableField("plan_end_time")
  62. @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  63. @JsonSerialize(using = LocalDateTimeSerializer.class)
  64. @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  65. private LocalDateTime planEndTime;
  66. @TableField("state")
  67. private Integer state;
  68. @TableField("on_state")
  69. private Integer onState;
  70. @TableField("principal_name")
  71. private String principalName;
  72. @TableField("principal_telephone")
  73. private String principalTelephone;
  74. @TableField("deleted")
  75. private int deleted;
  76. public Plan(){}
  77. public Plan(App app, PlanAddBo bo){
  78. this.setCommercialId(app.getCommercialId());
  79. this.setCommercialName(app.getCommercialName());
  80. this.setAppkey(app.getAppkey());
  81. this.setAppName(app.getAppName());
  82. this.setPlanName(bo.getPlanName());
  83. this.setVendorId(bo.getVendorId());
  84. this.setVendorName(bo.getVendorName());
  85. this.setGoodsId(bo.getGoodsId());
  86. this.setGoodsImg(bo.getGoodsImg());
  87. this.setGoodsName(bo.getGoodsName());
  88. this.setGoodsLogo(bo.getGoodsLogo());
  89. this.setGoodsPrice(bo.getGoodsPrice());
  90. this.setGoodsIntroduce(bo.getGoodsIntroduce());
  91. this.setGoodsClassify(bo.getGoodsClassify());
  92. this.setPlanCreateTime(LocalDateTime.now(ZoneId.of("Asia/Shanghai")));
  93. DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  94. this.setPlanStartTime(LocalDateTime.parse(bo.getPlanStartTime(), dateTimeFormatter));
  95. this.setPlanEndTime(LocalDateTime.parse(bo.getPlanEndTime(), dateTimeFormatter));
  96. this.setState(StateUtil.NOT_AUDITED);
  97. this.setOnState(OnStateUtil.UP);
  98. this.setPrincipalName(bo.getPrincipalName());
  99. this.setPrincipalTelephone(bo.getPrincipalTelephone());
  100. }
  101. }