TbCostomer.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. package com.pj.project.tb_costomer;
  2. import java.io.Serializable;
  3. import java.util.*;
  4. import java.util.stream.Collectors;
  5. import cn.hutool.core.util.StrUtil;
  6. import com.baomidou.mybatisplus.annotation.*;
  7. import com.baomidou.mybatisplus.extension.activerecord.Model;
  8. import com.pj.project4sp.global.BusinessException;
  9. import lombok.AllArgsConstructor;
  10. import lombok.EqualsAndHashCode;
  11. import lombok.Data;
  12. import lombok.Getter;
  13. import lombok.experimental.Accessors;
  14. import org.omg.CORBA.IRObject;
  15. /**
  16. * Model: tb_costomer -- 客户管理
  17. *
  18. * @author qzy
  19. */
  20. @Data
  21. @Accessors(chain = true)
  22. @TableName(TbCostomer.TABLE_NAME)
  23. @EqualsAndHashCode(callSuper = false)
  24. public class TbCostomer extends Model<TbCostomer> implements Serializable {
  25. // ---------- 模块常量 ----------
  26. /**
  27. * 序列化版本id
  28. */
  29. private static final long serialVersionUID = 1L;
  30. /**
  31. * 此模块对应的表名
  32. */
  33. public static final String TABLE_NAME = "tb_costomer";
  34. /**
  35. * 此模块对应的权限码
  36. */
  37. public static final String PERMISSION_CODE = "tb-costomer";
  38. public static final String PARTNER_PERMISSION_CODE = "tb-partner";
  39. public static final String PERMISSION_INFO = "tb-costomer-maintain";
  40. // ---------- 表中字段 ----------
  41. /**
  42. * 主键
  43. */
  44. private String id;
  45. /**
  46. * 名称
  47. */
  48. private String name;
  49. /**
  50. * 联系号码
  51. */
  52. private String phone;
  53. /**
  54. * 负责人
  55. */
  56. private String dutyPeople;
  57. /**
  58. * 地址id
  59. */
  60. private String addressIds;
  61. /**
  62. * 地址
  63. */
  64. private String addressStr;
  65. /**
  66. * 营业执照
  67. */
  68. private String businessLicence;
  69. /**
  70. * 状态(0=否,1=是)
  71. */
  72. private Integer status;
  73. /**
  74. * 创建时间
  75. */
  76. private Date creareTime = null;
  77. /**
  78. * 审核状态(1=未审核,2审核通过,3审核不通过)
  79. */
  80. private Integer judgeStatus = 1;
  81. /**
  82. * 审核时间
  83. */
  84. private Date judgeTime = null;
  85. /**
  86. * 审核意见
  87. */
  88. private String judgeContent;
  89. /**
  90. * 结账方式(1=现结,2=月结)[j]
  91. */
  92. private int payType;
  93. /**
  94. * 类型0、理货员;1、消杀;2、装卸
  95. */
  96. private String type = "0";
  97. /**
  98. * 业务项,关联业务项管理表
  99. */
  100. private String businessType = "1";
  101. /**
  102. * 公众号通知类型,关联业务项管理表
  103. */
  104. private String messageType = "1";
  105. @TableField(exist = false)
  106. private String typeDes;
  107. public String getTypeDes() {
  108. String type = this.type;
  109. StringBuilder sb = new StringBuilder();
  110. StrUtil.splitTrim(type, ",")
  111. .forEach(t -> {
  112. sb.append(CustomerEnum.getDesc(t)).append("、");
  113. });
  114. return sb.substring(0, sb.lastIndexOf("、"));
  115. }
  116. @Getter
  117. @AllArgsConstructor
  118. public static enum CustomerEnum {
  119. BUSINESS_TYPE("0", "理货员"),
  120. DISINFECT_TYPE("1", "消杀"),
  121. TAKE_TYPE("2", "装卸"),
  122. HESUAN_TYPE("3", "核酸"),
  123. ;
  124. private String type;
  125. private String desc;
  126. public static String getDesc(String type) {
  127. return Arrays.stream(CustomerEnum.values()).filter(customerEnum -> customerEnum.getType().equals(type))
  128. .findFirst().orElseThrow(() -> new BusinessException("不存在")).getDesc();
  129. }
  130. public static List<Map<String, String>> getList() {
  131. List<Map<String, String>> list = new ArrayList<>();
  132. for (CustomerEnum customerEnum : CustomerEnum.values()) {
  133. if (customerEnum.getType().equals("0")) {
  134. continue;
  135. }
  136. Map<String, String> map = new HashMap<>();
  137. map.put("id", customerEnum.getType());
  138. map.put("name", customerEnum.getDesc());
  139. list.add(map);
  140. }
  141. return list;
  142. }
  143. }
  144. }