Showing
11 changed files
with
1332 additions
and
0 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/customer/develop/GetCustomerDevelopPlanBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.bo.customer.develop; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.xingyun.basedata.entity.*; | ||
| 5 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 6 | +import com.lframework.starter.common.constants.StringPool; | ||
| 7 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +import io.swagger.annotations.ApiModelProperty; | ||
| 11 | + | ||
| 12 | +import lombok.Data; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * <p> | ||
| 16 | + * 客户开发计划 GetBo | ||
| 17 | + * </p> | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | +@Data | ||
| 21 | +public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> { | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * ID | ||
| 25 | + */ | ||
| 26 | + @ApiModelProperty("ID") | ||
| 27 | + private String id; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 客户基本信息 | ||
| 31 | + */ | ||
| 32 | + @ApiModelProperty("客户基本信息") | ||
| 33 | + private Customer customer; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 厂房信息 | ||
| 37 | + */ | ||
| 38 | + @ApiModelProperty("厂房信息") | ||
| 39 | + private Workshop workshop; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 办事处/科办 | ||
| 43 | + */ | ||
| 44 | + @ApiModelProperty("办事处/科办") | ||
| 45 | + private Office office; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 客户类型 | ||
| 49 | + */ | ||
| 50 | + @ApiModelProperty("客户类型") | ||
| 51 | + private TypeInfo customerType; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 产品品种 | ||
| 55 | + */ | ||
| 56 | + @ApiModelProperty("产品品种") | ||
| 57 | + private ProductVariety productVariety; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 月用量 | ||
| 61 | + */ | ||
| 62 | + @ApiModelProperty("月用量") | ||
| 63 | + private Double monthlyUsage; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 目标量 | ||
| 67 | + */ | ||
| 68 | + @ApiModelProperty("目标量") | ||
| 69 | + private Double targetQuantity; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 行业 | ||
| 73 | + */ | ||
| 74 | + @ApiModelProperty("行业") | ||
| 75 | + private String industry; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 牌号 | ||
| 79 | + */ | ||
| 80 | + @ApiModelProperty("牌号") | ||
| 81 | + private String mark; | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 厚度 | ||
| 85 | + */ | ||
| 86 | + @ApiModelProperty("厚度") | ||
| 87 | + private Double thickness; | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 宽度 | ||
| 91 | + */ | ||
| 92 | + @ApiModelProperty("宽度") | ||
| 93 | + private Double width; | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 材质要求 | ||
| 97 | + */ | ||
| 98 | + @ApiModelProperty("材质要求") | ||
| 99 | + private String materialRequire; | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 品质要求 | ||
| 103 | + */ | ||
| 104 | + @ApiModelProperty("品质要求") | ||
| 105 | + private String qualityRequire; | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * 同行 | ||
| 109 | + */ | ||
| 110 | + @ApiModelProperty("同行") | ||
| 111 | + private String peer; | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 核价模式 | ||
| 115 | + */ | ||
| 116 | + @ApiModelProperty("核价模式") | ||
| 117 | + private String pricingMode; | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * 结算天数 | ||
| 121 | + */ | ||
| 122 | + @ApiModelProperty("结算天数") | ||
| 123 | + private Double settleDays; | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 责任人 | ||
| 127 | + */ | ||
| 128 | + @ApiModelProperty("责任人") | ||
| 129 | + private String chargeUserName; | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 状态 | ||
| 133 | + */ | ||
| 134 | + @ApiModelProperty("状态") | ||
| 135 | + private Integer status; | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * 状态字典值 | ||
| 139 | + */ | ||
| 140 | + @ApiModelProperty("状态字典值") | ||
| 141 | + private String statusDicValue; | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * 创建人 | ||
| 145 | + */ | ||
| 146 | + @ApiModelProperty("创建人") | ||
| 147 | + private String createBy; | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 更新人 | ||
| 151 | + */ | ||
| 152 | + @ApiModelProperty("更新人") | ||
| 153 | + private String updateBy; | ||
| 154 | + | ||
| 155 | + /** | ||
| 156 | + * 创建时间 | ||
| 157 | + */ | ||
| 158 | + @ApiModelProperty("创建时间") | ||
| 159 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 160 | + private LocalDateTime createTime; | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * 更新时间 | ||
| 164 | + */ | ||
| 165 | + @ApiModelProperty("更新时间") | ||
| 166 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 167 | + private LocalDateTime updateTime; | ||
| 168 | + | ||
| 169 | + public GetCustomerDevelopPlanBo() { | ||
| 170 | + | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public GetCustomerDevelopPlanBo(CustomerDevelopPlan dto) { | ||
| 174 | + super(dto); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + @Override | ||
| 178 | + public BaseBo<CustomerDevelopPlan> convert(CustomerDevelopPlan dto) { | ||
| 179 | + return super.convert(dto); | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + @Override | ||
| 183 | + protected void afterInit(CustomerDevelopPlan dto) { | ||
| 184 | + if (dto.getStatus() != null) { | ||
| 185 | + this.status = dto.getStatus().getCode(); | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | +} | 
| 1 | +package com.lframework.xingyun.sc.controller.customer; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | ||
| 4 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | ||
| 5 | +import com.lframework.starter.web.inner.entity.SysUser; | ||
| 6 | +import com.lframework.starter.web.inner.service.system.SysUserService; | ||
| 7 | +import com.lframework.xingyun.basedata.entity.*; | ||
| 8 | +import com.lframework.xingyun.basedata.service.customer.CustomerService; | ||
| 9 | +import com.lframework.xingyun.basedata.service.office.OfficeService; | ||
| 10 | +import com.lframework.xingyun.basedata.service.product.ProductVarietyService; | ||
| 11 | +import com.lframework.xingyun.basedata.service.type.TypeInfoService; | ||
| 12 | +import com.lframework.xingyun.basedata.service.workshop.WorkshopService; | ||
| 13 | +import com.lframework.xingyun.sc.bo.customer.develop.GetCustomerDevelopPlanBo; | ||
| 14 | +import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; | ||
| 15 | +import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; | ||
| 16 | +import com.lframework.xingyun.sc.vo.customer.develop.CreateCustomerDevelopPlanVo; | ||
| 17 | +import com.lframework.xingyun.sc.vo.customer.develop.UpdateCustomerDevelopPlanVo; | ||
| 18 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 19 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 20 | + | ||
| 21 | +import javax.annotation.Resource; | ||
| 22 | +import javax.validation.constraints.NotBlank; | ||
| 23 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 24 | +import io.swagger.annotations.ApiOperation; | ||
| 25 | +import com.lframework.starter.common.utils.CollectionUtil; | ||
| 26 | +import io.swagger.annotations.Api; | ||
| 27 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 28 | +import org.apache.commons.lang3.StringUtils; | ||
| 29 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 30 | +import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 31 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 32 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | ||
| 33 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 34 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | ||
| 35 | +import org.springframework.validation.annotation.Validated; | ||
| 36 | +import org.springframework.web.bind.annotation.*; | ||
| 37 | + | ||
| 38 | +import javax.validation.Valid; | ||
| 39 | +import java.util.ArrayList; | ||
| 40 | +import java.util.HashMap; | ||
| 41 | +import java.util.List; | ||
| 42 | +import java.util.Map; | ||
| 43 | +import java.util.function.Function; | ||
| 44 | +import java.util.stream.Collectors; | ||
| 45 | + | ||
| 46 | +/** | ||
| 47 | + * 客户开发计划 Controller | ||
| 48 | + * | ||
| 49 | + */ | ||
| 50 | +@Api(tags = "客户开发计划") | ||
| 51 | +@Validated | ||
| 52 | +@RestController | ||
| 53 | +@RequestMapping("/customer/develop") | ||
| 54 | +public class CustomerDevelopPlanController extends DefaultBaseController { | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + @Resource | ||
| 58 | + private CustomerDevelopPlanService customerDevelopPlanService; | ||
| 59 | + @Resource | ||
| 60 | + private CustomerService customerService; | ||
| 61 | + @Resource | ||
| 62 | + private WorkshopService workshopService; | ||
| 63 | + @Resource | ||
| 64 | + private OfficeService officeService; | ||
| 65 | + @Resource | ||
| 66 | + private TypeInfoService typeInfoService; | ||
| 67 | + @Resource | ||
| 68 | + private ProductVarietyService productVarietyService; | ||
| 69 | + @Autowired | ||
| 70 | + private SysUserService sysUserService; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 查询列表 | ||
| 75 | + */ | ||
| 76 | + @ApiOperation("查询列表") | ||
| 77 | + @HasPermission({"customer:develop:query"}) | ||
| 78 | + @GetMapping("/query") | ||
| 79 | + public InvokeResult<PageResult<GetCustomerDevelopPlanBo>> query(@Valid QueryCustomerDevelopPlanVo vo) { | ||
| 80 | + PageResult<CustomerDevelopPlan> pageResult = customerDevelopPlanService.query(getPageIndex(vo), getPageSize(vo), vo); | ||
| 81 | + List<CustomerDevelopPlan> dataList = pageResult.getDatas(); | ||
| 82 | + List<GetCustomerDevelopPlanBo> results = null; | ||
| 83 | + if (!CollectionUtil.isEmpty(dataList)) { | ||
| 84 | + results = this.packCustomerDevelopData(dataList); | ||
| 85 | + } | ||
| 86 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 根据ID查询 | ||
| 91 | + */ | ||
| 92 | + @ApiOperation("根据ID查询") | ||
| 93 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 94 | + @HasPermission({"customer:develop:query"}) | ||
| 95 | + @GetMapping | ||
| 96 | + public InvokeResult<GetCustomerDevelopPlanBo> get(@NotBlank(message = "id不能为空!") String id) { | ||
| 97 | + CustomerDevelopPlan data = customerDevelopPlanService.findById(id); | ||
| 98 | + if (data == null) { | ||
| 99 | + throw new DefaultClientException("客户开发计划不存在!"); | ||
| 100 | + } | ||
| 101 | + GetCustomerDevelopPlanBo result = this.packCustomerDevelopData(data); | ||
| 102 | + | ||
| 103 | + return InvokeResultBuilder.success(result); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * 新增 | ||
| 108 | + */ | ||
| 109 | + @ApiOperation("新增") | ||
| 110 | + @HasPermission({"customer:develop:add"}) | ||
| 111 | + @PostMapping | ||
| 112 | + public InvokeResult<Void> create(@Valid CreateCustomerDevelopPlanVo vo) { | ||
| 113 | + customerDevelopPlanService.create(vo); | ||
| 114 | + return InvokeResultBuilder.success(); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 修改 | ||
| 119 | + */ | ||
| 120 | + @ApiOperation("修改") | ||
| 121 | + @HasPermission({"customer:develop:modify"}) | ||
| 122 | + @PutMapping | ||
| 123 | + public InvokeResult<Void> update(@Valid UpdateCustomerDevelopPlanVo vo) { | ||
| 124 | + customerDevelopPlanService.update(vo); | ||
| 125 | + return InvokeResultBuilder.success(); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * 根据ID删除 | ||
| 130 | + */ | ||
| 131 | + @ApiOperation("根据ID删除") | ||
| 132 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 133 | + @HasPermission({"customer:develop:delete"}) | ||
| 134 | + @DeleteMapping | ||
| 135 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | ||
| 136 | + customerDevelopPlanService.deleteById(id); | ||
| 137 | + return InvokeResultBuilder.success(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * 封装客户开发数据 | ||
| 143 | + * | ||
| 144 | + * @param dataList 数据集 | ||
| 145 | + * @return List<GetCustomerDevelopPlanBo> | ||
| 146 | + */ | ||
| 147 | + private List<GetCustomerDevelopPlanBo> packCustomerDevelopData(List<CustomerDevelopPlan> dataList) { | ||
| 148 | + // 处理关联数据 | ||
| 149 | + List<String> customerIds = new ArrayList<>(); | ||
| 150 | + List<String> workshopIds = new ArrayList<>(); | ||
| 151 | + List<String> officeIds = new ArrayList<>(); | ||
| 152 | + List<String> typeIds = new ArrayList<>(); | ||
| 153 | + List<String> productVarietyIds = new ArrayList<>(); | ||
| 154 | + List<String> chargeUserIds = new ArrayList<>(); | ||
| 155 | + for (CustomerDevelopPlan plan : dataList) { | ||
| 156 | + String customerId = plan.getCustomerId(); | ||
| 157 | + String workshopId = plan.getWorkshopId(); | ||
| 158 | + String officeId = plan.getOfficeId(); | ||
| 159 | + String customerTypeId = plan.getCustomerTypeId(); | ||
| 160 | + String productVarietyId = plan.getProductVarietyId(); | ||
| 161 | + String chargeUserId = plan.getChargeUserId(); | ||
| 162 | + if (StringUtils.isNotBlank(customerId) && !customerIds.contains(customerId)) { | ||
| 163 | + customerIds.add(customerId); | ||
| 164 | + } | ||
| 165 | + if (StringUtils.isNotBlank(workshopId) && !workshopIds.contains(workshopId)) { | ||
| 166 | + workshopIds.add(workshopId); | ||
| 167 | + } | ||
| 168 | + if (StringUtils.isNotBlank(officeId) && !officeIds.contains(officeId)) { | ||
| 169 | + officeIds.add(officeId); | ||
| 170 | + } | ||
| 171 | + if (StringUtils.isNotBlank(customerTypeId) && !typeIds.contains(customerTypeId)) { | ||
| 172 | + typeIds.add(customerTypeId); | ||
| 173 | + } | ||
| 174 | + if (StringUtils.isNotBlank(productVarietyId) && !productVarietyIds.contains(productVarietyId)) { | ||
| 175 | + productVarietyIds.add(productVarietyId); | ||
| 176 | + } | ||
| 177 | + if (StringUtils.isNotBlank(chargeUserId) && !chargeUserIds.contains(chargeUserId)) { | ||
| 178 | + chargeUserIds.add(chargeUserId); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + // 获取客户基本信息 | ||
| 182 | + List<Customer> customerList = customerService.listByIds(customerIds); | ||
| 183 | + Map<String, Customer> customerMap = new HashMap<>(); | ||
| 184 | + if (CollectionUtils.isNotEmpty(customerList)) { | ||
| 185 | + customerMap = customerList.stream().collect(Collectors.toMap(Customer::getId, Function.identity())); | ||
| 186 | + } | ||
| 187 | + // 获取厂房信息 | ||
| 188 | + List<Workshop> workshopList = workshopService.listByIds(workshopIds); | ||
| 189 | + Map<String, Workshop> workshopMap = new HashMap<>(); | ||
| 190 | + if (CollectionUtils.isNotEmpty(workshopList)) { | ||
| 191 | + workshopMap = workshopList.stream().collect(Collectors.toMap(Workshop::getId, Function.identity())); | ||
| 192 | + } | ||
| 193 | + // 获取办事处/科办信息 | ||
| 194 | + List<Office> officeList = officeService.listByIds(officeIds); | ||
| 195 | + Map<String, Office> officeMap = new HashMap<>(); | ||
| 196 | + if (CollectionUtils.isNotEmpty(officeList)) { | ||
| 197 | + officeMap = officeList.stream().collect(Collectors.toMap(Office::getId, Function.identity())); | ||
| 198 | + } | ||
| 199 | + // 获取客户类型信息 | ||
| 200 | + List<TypeInfo> typeInfoList = typeInfoService.listByIds(typeIds); | ||
| 201 | + Map<String, TypeInfo> typeInfoMap = new HashMap<>(); | ||
| 202 | + if (CollectionUtils.isNotEmpty(typeInfoList)) { | ||
| 203 | + typeInfoMap = typeInfoList.stream().collect(Collectors.toMap(TypeInfo::getId, Function.identity())); | ||
| 204 | + } | ||
| 205 | + // 获取产品品种信息 | ||
| 206 | + List<ProductVariety> productVarietyList = productVarietyService.listByIds(productVarietyIds); | ||
| 207 | + Map<String, ProductVariety> productVarietyMap = new HashMap<>(); | ||
| 208 | + if (CollectionUtils.isNotEmpty(productVarietyList)) { | ||
| 209 | + productVarietyMap = productVarietyList.stream().collect(Collectors.toMap(ProductVariety::getId, Function.identity())); | ||
| 210 | + } | ||
| 211 | + // 获取责任人数据 | ||
| 212 | + List<SysUser> userList = sysUserService.listByIds(chargeUserIds); | ||
| 213 | + Map<String, SysUser> userMap = new HashMap<>(); | ||
| 214 | + if (CollectionUtils.isNotEmpty(userList)) { | ||
| 215 | + userMap = userList.stream().collect(Collectors.toMap(SysUser::getId, Function.identity())); | ||
| 216 | + } | ||
| 217 | + List<GetCustomerDevelopPlanBo> result = new ArrayList<>(); | ||
| 218 | + for (CustomerDevelopPlan plan : dataList) { | ||
| 219 | + GetCustomerDevelopPlanBo data = new GetCustomerDevelopPlanBo(plan); | ||
| 220 | + // 客户信息 | ||
| 221 | + Customer customer = customerMap.get(plan.getCustomerId()); | ||
| 222 | + data.setCustomer(customer); | ||
| 223 | + // 厂房信息 | ||
| 224 | + Workshop workshop = workshopMap.get(plan.getWorkshopId()); | ||
| 225 | + data.setWorkshop(workshop); | ||
| 226 | + // 办事处/科办 | ||
| 227 | + Office office = officeMap.get(plan.getOfficeId()); | ||
| 228 | + data.setOffice(office); | ||
| 229 | + // 客户类型 | ||
| 230 | + TypeInfo typeInfo = typeInfoMap.get(plan.getCustomerTypeId()); | ||
| 231 | + data.setCustomerType(typeInfo); | ||
| 232 | + // 产品品种 | ||
| 233 | + ProductVariety productVariety = productVarietyMap.get(plan.getProductVarietyId()); | ||
| 234 | + data.setProductVariety(productVariety); | ||
| 235 | + // 责任人 | ||
| 236 | + SysUser user = userMap.get(plan.getChargeUserId()); | ||
| 237 | + data.setChargeUserName(user == null ? null : user.getName()); | ||
| 238 | + | ||
| 239 | + result.add(data); | ||
| 240 | + } | ||
| 241 | + return result; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + | ||
| 245 | + /** | ||
| 246 | + * 封装客户开发数据 | ||
| 247 | + * | ||
| 248 | + * @param plan 数据实体 | ||
| 249 | + * @return GetCustomerDevelopPlanBo | ||
| 250 | + */ | ||
| 251 | + private GetCustomerDevelopPlanBo packCustomerDevelopData(CustomerDevelopPlan plan) { | ||
| 252 | + // 处理关联数据 | ||
| 253 | + String customerId = plan.getCustomerId(); | ||
| 254 | + String workshopId = plan.getWorkshopId(); | ||
| 255 | + String officeId = plan.getOfficeId(); | ||
| 256 | + String customerTypeId = plan.getCustomerTypeId(); | ||
| 257 | + String productVarietyId = plan.getProductVarietyId(); | ||
| 258 | + String chargeUserId = plan.getChargeUserId(); | ||
| 259 | + | ||
| 260 | + GetCustomerDevelopPlanBo data = new GetCustomerDevelopPlanBo(plan); | ||
| 261 | + // 获取客户基本信息 | ||
| 262 | + Customer customer = customerService.findById(customerId); | ||
| 263 | + data.setCustomer(customer); | ||
| 264 | + // 获取厂房信息 | ||
| 265 | + Workshop workshop = workshopService.findById(workshopId); | ||
| 266 | + data.setWorkshop(workshop); | ||
| 267 | + // 获取办事处/科办信息 | ||
| 268 | + Office office = officeService.findById(officeId); | ||
| 269 | + data.setOffice(office); | ||
| 270 | + // 获取客户类型信息 | ||
| 271 | + TypeInfo customerType = typeInfoService.findById(customerTypeId); | ||
| 272 | + data.setCustomerType(customerType); | ||
| 273 | + // 获取产品品种信息 | ||
| 274 | + ProductVariety productVariety = productVarietyService.findById(productVarietyId); | ||
| 275 | + data.setProductVariety(productVariety); | ||
| 276 | + // 获取责任人数据 | ||
| 277 | + SysUser user = sysUserService.findById(chargeUserId); | ||
| 278 | + data.setChargeUserName(user.getName()); | ||
| 279 | + | ||
| 280 | + return data; | ||
| 281 | + } | ||
| 282 | +} | 
| 1 | +package com.lframework.xingyun.sc.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * <p> | ||
| 15 | + * 客户开发计划 | ||
| 16 | + * </p> | ||
| 17 | + */ | ||
| 18 | +@Data | ||
| 19 | +@TableName("customer_develop_plan") | ||
| 20 | +public class CustomerDevelopPlan extends BaseEntity implements BaseDto { | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + private static final long serialVersionUID = 1L; | ||
| 24 | + | ||
| 25 | + public static final String CACHE_NAME = "CustomerDevelopPlan"; | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * ID | ||
| 30 | + */ | ||
| 31 | + private String id; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 客户ID | ||
| 35 | + */ | ||
| 36 | + private String customerId; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 厂房ID | ||
| 40 | + */ | ||
| 41 | + private String workshopId; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 办事处/科办ID | ||
| 45 | + */ | ||
| 46 | + private String officeId; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 客户类型ID | ||
| 50 | + */ | ||
| 51 | + private String customerTypeId; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 产品品种ID | ||
| 55 | + */ | ||
| 56 | + private String productVarietyId; | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 月用量 | ||
| 60 | + */ | ||
| 61 | + private Double monthlyUsage; | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 目标量 | ||
| 65 | + */ | ||
| 66 | + private Double targetQuantity; | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 行业 | ||
| 70 | + */ | ||
| 71 | + private String industry; | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 牌号 | ||
| 75 | + */ | ||
| 76 | + private String mark; | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 厚度 | ||
| 80 | + */ | ||
| 81 | + private Double thickness; | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 宽度 | ||
| 85 | + */ | ||
| 86 | + private Double width; | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 材质要求 | ||
| 90 | + */ | ||
| 91 | + private String materialRequire; | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 品质要求 | ||
| 95 | + */ | ||
| 96 | + private String qualityRequire; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * 同行 | ||
| 100 | + */ | ||
| 101 | + private String peer; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 核价模式 | ||
| 105 | + */ | ||
| 106 | + private String pricingMode; | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * 结算天数 | ||
| 110 | + */ | ||
| 111 | + private Double settleDays; | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 责任人ID | ||
| 115 | + */ | ||
| 116 | + private String chargeUserId; | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * 状态 | ||
| 120 | + */ | ||
| 121 | + private CustomerDevelopStatus status; | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 创建人ID | ||
| 125 | + */ | ||
| 126 | + @TableField(fill = FieldFill.INSERT) | ||
| 127 | + private String createById; | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 创建人 | ||
| 131 | + */ | ||
| 132 | + @TableField(fill = FieldFill.INSERT) | ||
| 133 | + private String createBy; | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 更新人ID | ||
| 137 | + */ | ||
| 138 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 139 | + private String updateById; | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * 更新人 | ||
| 143 | + */ | ||
| 144 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 145 | + private String updateBy; | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * 创建时间 | ||
| 149 | + */ | ||
| 150 | + @TableField(fill = FieldFill.INSERT) | ||
| 151 | + private LocalDateTime createTime; | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 更新时间 | ||
| 155 | + */ | ||
| 156 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 157 | + private LocalDateTime updateTime; | ||
| 158 | + | ||
| 159 | +} | 
| 1 | +package com.lframework.xingyun.sc.enums; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.EnumValue; | ||
| 4 | +import com.lframework.starter.web.core.enums.BaseEnum; | ||
| 5 | + | ||
| 6 | +public enum CustomerDevelopStatus implements BaseEnum<Integer> { | ||
| 7 | + | ||
| 8 | + AUDIT(1, "审核中"), PASS(2, "审核通过"), REFUSE(3, "已驳回"), CANCEL(4, "已取消"); | ||
| 9 | + | ||
| 10 | + @EnumValue | ||
| 11 | + private Integer code; | ||
| 12 | + | ||
| 13 | + private String desc; | ||
| 14 | + | ||
| 15 | + CustomerDevelopStatus(Integer code, String desc) { | ||
| 16 | + this.code = code; | ||
| 17 | + this.desc = desc; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public Integer getCode() { | ||
| 22 | + return this.code; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public String getDesc() { | ||
| 27 | + return this.desc; | ||
| 28 | + } | ||
| 29 | +} | 
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerDevelopPlanServiceImpl.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.impl.customer; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 5 | +import com.github.pagehelper.PageInfo; | ||
| 6 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 7 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 8 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 9 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 10 | +import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 11 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 12 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 13 | +import com.lframework.starter.web.core.utils.IdUtil; | ||
| 14 | +import com.lframework.starter.common.utils.ObjectUtil; | ||
| 15 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 16 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 17 | +import com.lframework.starter.common.utils.Assert; | ||
| 18 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 19 | +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 20 | +import org.springframework.transaction.annotation.Transactional; | ||
| 21 | +import com.lframework.xingyun.sc.mappers.CustomerDevelopPlanMapper; | ||
| 22 | +import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; | ||
| 23 | +import com.lframework.xingyun.sc.vo.customer.develop.CreateCustomerDevelopPlanVo; | ||
| 24 | +import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; | ||
| 25 | +import com.lframework.xingyun.sc.vo.customer.develop.UpdateCustomerDevelopPlanVo; | ||
| 26 | +import org.springframework.stereotype.Service; | ||
| 27 | + | ||
| 28 | +import java.util.List; | ||
| 29 | + | ||
| 30 | +@Service | ||
| 31 | +public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDevelopPlanMapper, CustomerDevelopPlan> implements CustomerDevelopPlanService { | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public PageResult<CustomerDevelopPlan> query(Integer pageIndex, Integer pageSize, QueryCustomerDevelopPlanVo vo) { | ||
| 37 | + Assert.greaterThanZero(pageIndex); | ||
| 38 | + Assert.greaterThanZero(pageSize); | ||
| 39 | + | ||
| 40 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 41 | + List<CustomerDevelopPlan> dataList = this.query(vo); | ||
| 42 | + | ||
| 43 | + return PageResultUtil.convert(new PageInfo<>(dataList)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 查询列表 | ||
| 48 | + * | ||
| 49 | + * @param vo 查询条件 | ||
| 50 | + * @return List<CustomerDevelopPlan> | ||
| 51 | + */ | ||
| 52 | + @Override | ||
| 53 | + public List<CustomerDevelopPlan> query(QueryCustomerDevelopPlanVo vo) { | ||
| 54 | + return getBaseMapper().query(vo); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 根据ID查询 | ||
| 59 | + * | ||
| 60 | + * @param id 主键ID | ||
| 61 | + * @return CustomerDevelopPlan | ||
| 62 | + */ | ||
| 63 | + @Override | ||
| 64 | + public CustomerDevelopPlan findById(String id) { | ||
| 65 | + return getBaseMapper().selectById(id); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @OpLog(type = OtherOpLogType.class, name = "新增客户开发计划,ID:{}", params = {"#id"}) | ||
| 69 | + @Transactional(rollbackFor = Exception.class) | ||
| 70 | + @Override | ||
| 71 | + public String create(CreateCustomerDevelopPlanVo vo) { | ||
| 72 | + CustomerDevelopPlan data = new CustomerDevelopPlan(); | ||
| 73 | + data.setId(IdUtil.getId()); | ||
| 74 | + // 审核中 | ||
| 75 | + data.setStatus(CustomerDevelopStatus.AUDIT); | ||
| 76 | + data.setCustomerId(vo.getCustomerId()); | ||
| 77 | + if (!StringUtil.isBlank(vo.getWorkshopId())) { | ||
| 78 | + data.setWorkshopId(vo.getWorkshopId()); | ||
| 79 | + } | ||
| 80 | + if (!StringUtil.isBlank(vo.getOfficeId())) { | ||
| 81 | + data.setOfficeId(vo.getOfficeId()); | ||
| 82 | + } | ||
| 83 | + if (!StringUtil.isBlank(vo.getCustomerTypeId())) { | ||
| 84 | + data.setCustomerTypeId(vo.getCustomerTypeId()); | ||
| 85 | + } | ||
| 86 | + if (!StringUtil.isBlank(vo.getProductVarietyId())) { | ||
| 87 | + data.setProductVarietyId(vo.getProductVarietyId()); | ||
| 88 | + } | ||
| 89 | + if (vo.getMonthlyUsage() != null) { | ||
| 90 | + data.setMonthlyUsage(vo.getMonthlyUsage()); | ||
| 91 | + } | ||
| 92 | + if (vo.getTargetQuantity() != null) { | ||
| 93 | + data.setTargetQuantity(vo.getTargetQuantity()); | ||
| 94 | + } | ||
| 95 | + if (!StringUtil.isBlank(vo.getIndustry())) { | ||
| 96 | + data.setIndustry(vo.getIndustry()); | ||
| 97 | + } | ||
| 98 | + if (!StringUtil.isBlank(vo.getMark())) { | ||
| 99 | + data.setMark(vo.getMark()); | ||
| 100 | + } | ||
| 101 | + if (vo.getThickness() != null) { | ||
| 102 | + data.setThickness(vo.getThickness()); | ||
| 103 | + } | ||
| 104 | + if (vo.getWidth() != null) { | ||
| 105 | + data.setWidth(vo.getWidth()); | ||
| 106 | + } | ||
| 107 | + if (!StringUtil.isBlank(vo.getMaterialRequire())) { | ||
| 108 | + data.setMaterialRequire(vo.getMaterialRequire()); | ||
| 109 | + } | ||
| 110 | + if (!StringUtil.isBlank(vo.getQualityRequire())) { | ||
| 111 | + data.setQualityRequire(vo.getQualityRequire()); | ||
| 112 | + } | ||
| 113 | + if (!StringUtil.isBlank(vo.getPeer())) { | ||
| 114 | + data.setPeer(vo.getPeer()); | ||
| 115 | + } | ||
| 116 | + if (!StringUtil.isBlank(vo.getPricingMode())) { | ||
| 117 | + data.setPricingMode(vo.getPricingMode()); | ||
| 118 | + } | ||
| 119 | + if (vo.getSettleDays() != null) { | ||
| 120 | + data.setSettleDays(vo.getSettleDays()); | ||
| 121 | + } | ||
| 122 | + data.setChargeUserId(vo.getChargeUserId()); | ||
| 123 | + | ||
| 124 | + getBaseMapper().insert(data); | ||
| 125 | + | ||
| 126 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 127 | + OpLogUtil.setExtra(vo); | ||
| 128 | + return data.getId(); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + @OpLog(type = OtherOpLogType.class, name = "修改客户开发计划,ID:{}", params = {"#id"}) | ||
| 132 | + @Transactional(rollbackFor = Exception.class) | ||
| 133 | + @Override | ||
| 134 | + public void update(UpdateCustomerDevelopPlanVo vo) { | ||
| 135 | + CustomerDevelopPlan data = getBaseMapper().selectById(vo.getId()); | ||
| 136 | + if (ObjectUtil.isNull(data)) { | ||
| 137 | + throw new DefaultClientException("客户开发计划不存在!"); | ||
| 138 | + } | ||
| 139 | + LambdaUpdateWrapper<CustomerDevelopPlan> updateWrapper = Wrappers.lambdaUpdate(CustomerDevelopPlan.class) | ||
| 140 | + .set(CustomerDevelopPlan::getCustomerId, vo.getCustomerId()) | ||
| 141 | + .set(CustomerDevelopPlan::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId()) | ||
| 142 | + .set(CustomerDevelopPlan::getOfficeId, StringUtil.isBlank(vo.getOfficeId()) ? null : vo.getOfficeId()) | ||
| 143 | + .set(CustomerDevelopPlan::getCustomerTypeId, StringUtil.isBlank(vo.getCustomerTypeId()) ? null : vo.getCustomerTypeId()) | ||
| 144 | + .set(CustomerDevelopPlan::getProductVarietyId, StringUtil.isBlank(vo.getProductVarietyId()) ? null : vo.getProductVarietyId()) | ||
| 145 | + .set(CustomerDevelopPlan::getMonthlyUsage, vo.getMonthlyUsage() == null ? null : vo.getMonthlyUsage()) | ||
| 146 | + .set(CustomerDevelopPlan::getTargetQuantity, vo.getTargetQuantity() == null ? null : vo.getTargetQuantity()) | ||
| 147 | + .set(CustomerDevelopPlan::getIndustry, StringUtil.isBlank(vo.getIndustry()) ? null : vo.getIndustry()) | ||
| 148 | + .set(CustomerDevelopPlan::getMark, StringUtil.isBlank(vo.getMark()) ? null : vo.getMark()) | ||
| 149 | + .set(CustomerDevelopPlan::getThickness, vo.getThickness() == null ? null : vo.getThickness()) | ||
| 150 | + .set(CustomerDevelopPlan::getWidth, vo.getWidth() == null ? null : vo.getWidth()) | ||
| 151 | + .set(CustomerDevelopPlan::getMaterialRequire, StringUtil.isBlank(vo.getMaterialRequire()) ? null : vo.getMaterialRequire()) | ||
| 152 | + .set(CustomerDevelopPlan::getQualityRequire, StringUtil.isBlank(vo.getQualityRequire()) ? null : vo.getQualityRequire()) | ||
| 153 | + .set(CustomerDevelopPlan::getPeer, StringUtil.isBlank(vo.getPeer()) ? null : vo.getPeer()) | ||
| 154 | + .set(CustomerDevelopPlan::getPricingMode, StringUtil.isBlank(vo.getPricingMode()) ? null : vo.getPricingMode()) | ||
| 155 | + .set(CustomerDevelopPlan::getSettleDays, vo.getSettleDays() == null ? null : vo.getSettleDays()) | ||
| 156 | + .set(CustomerDevelopPlan::getChargeUserId, vo.getChargeUserId()) | ||
| 157 | + .set(CustomerDevelopPlan::getStatus, CustomerDevelopStatus.AUDIT) | ||
| 158 | + .eq(CustomerDevelopPlan::getId, vo.getId()); | ||
| 159 | + getBaseMapper().update(updateWrapper); | ||
| 160 | + | ||
| 161 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 162 | + OpLogUtil.setExtra(vo); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + @OpLog(type = OtherOpLogType.class, name = "删除客户开发计划,ID:{}", params = {"#id"}) | ||
| 166 | + @Transactional(rollbackFor = Exception.class) | ||
| 167 | + @Override | ||
| 168 | + public void deleteById(String id) { | ||
| 169 | + getBaseMapper().deleteById(id); | ||
| 170 | + } | ||
| 171 | +} | 
xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/CustomerDevelopPlanMapper.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.mappers; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.annotations.sort.Sort; | ||
| 4 | +import com.lframework.starter.web.core.annotations.sort.Sorts; | ||
| 5 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 6 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 7 | +import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; | ||
| 8 | +import org.apache.ibatis.annotations.Param; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * <p> | ||
| 14 | + * 客户开发计划 Mapper 接口 | ||
| 15 | + * </p> | ||
| 16 | + */ | ||
| 17 | +public interface CustomerDevelopPlanMapper extends BaseMapper<CustomerDevelopPlan> { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 查询列表 | ||
| 21 | + * | ||
| 22 | + * @param vo 查询条件 | ||
| 23 | + * @return List<CustomerDevelopPlan> | ||
| 24 | + */ | ||
| 25 | + @Sorts({ | ||
| 26 | + @Sort(value = "c.name", autoParse = true), | ||
| 27 | + @Sort(value = "tb.createTime", autoParse = true), | ||
| 28 | + @Sort(value = "tb.updateTime", autoParse = true), | ||
| 29 | + }) | ||
| 30 | + List<CustomerDevelopPlan> query(@Param("vo") QueryCustomerDevelopPlanVo vo); | ||
| 31 | +} | 
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/customer/CustomerDevelopPlanService.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.service.customer; | ||
| 2 | + | ||
| 3 | +import com.lframework.xingyun.sc.vo.customer.develop.CreateCustomerDevelopPlanVo; | ||
| 4 | +import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; | ||
| 5 | +import com.lframework.xingyun.sc.vo.customer.develop.UpdateCustomerDevelopPlanVo; | ||
| 6 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 7 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 客户开发计划 Service | ||
| 13 | + */ | ||
| 14 | +public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelopPlan> { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 查询列表 | ||
| 18 | + * | ||
| 19 | + * @param pageIndex 分页页码 | ||
| 20 | + * @param pageSize 分页大小 | ||
| 21 | + * @param vo 查询条件 | ||
| 22 | + * @return PageResult<CustomerDevelopPlan> | ||
| 23 | + */ | ||
| 24 | + PageResult<CustomerDevelopPlan> query(Integer pageIndex, Integer pageSize, QueryCustomerDevelopPlanVo vo); | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 查询列表 | ||
| 28 | + * | ||
| 29 | + * @param vo 查询条件 | ||
| 30 | + * @return List<CustomerDevelopPlan> | ||
| 31 | + */ | ||
| 32 | + List<CustomerDevelopPlan> query(QueryCustomerDevelopPlanVo vo); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 根据ID查询 | ||
| 36 | + * | ||
| 37 | + * @param id 主键ID | ||
| 38 | + * @return CustomerDevelopPlan | ||
| 39 | + */ | ||
| 40 | + CustomerDevelopPlan findById(String id); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 创建 | ||
| 44 | + * | ||
| 45 | + * @param vo 数据实体 | ||
| 46 | + * @return String | ||
| 47 | + */ | ||
| 48 | + String create(CreateCustomerDevelopPlanVo vo); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 修改 | ||
| 52 | + * | ||
| 53 | + * @param vo 数据实体 | ||
| 54 | + */ | ||
| 55 | + void update(UpdateCustomerDevelopPlanVo vo); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 根据ID删除 | ||
| 59 | + * | ||
| 60 | + * @param id 主键ID | ||
| 61 | + */ | ||
| 62 | + void deleteById(String id); | ||
| 63 | +} | 
| 1 | +package com.lframework.xingyun.sc.vo.customer.develop; | ||
| 2 | + | ||
| 3 | +import javax.validation.constraints.NotBlank; | ||
| 4 | + | ||
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | +import io.swagger.annotations.ApiModelProperty; | ||
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 8 | +import org.hibernate.validator.constraints.Length; | ||
| 9 | + | ||
| 10 | +import java.io.Serializable; | ||
| 11 | + | ||
| 12 | +import lombok.Data; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +public class CreateCustomerDevelopPlanVo implements BaseVo, Serializable { | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 1L; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 客户ID | ||
| 23 | + */ | ||
| 24 | + @ApiModelProperty(value = "客户ID", required = true) | ||
| 25 | + @NotBlank(message = "请选择客户ID!") | ||
| 26 | + private String customerId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 厂房ID | ||
| 30 | + */ | ||
| 31 | + @ApiModelProperty("厂房ID") | ||
| 32 | + private String workshopId; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 办事处/科办ID | ||
| 36 | + */ | ||
| 37 | + @ApiModelProperty("办事处/科办ID") | ||
| 38 | + private String officeId; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 客户类型ID | ||
| 42 | + */ | ||
| 43 | + @ApiModelProperty("客户类型ID") | ||
| 44 | + @Length(message = "客户类型ID最多允许32个字符!") | ||
| 45 | + private String customerTypeId; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 产品品种ID | ||
| 49 | + */ | ||
| 50 | + @ApiModelProperty("产品品种ID") | ||
| 51 | + @Length(message = "产品品种ID最多允许32个字符!") | ||
| 52 | + private String productVarietyId; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 月用量 | ||
| 56 | + */ | ||
| 57 | + @ApiModelProperty("月用量") | ||
| 58 | + @TypeMismatch(message = "月用量格式有误!") | ||
| 59 | + private Double monthlyUsage; | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 目标量 | ||
| 63 | + */ | ||
| 64 | + @ApiModelProperty("目标量") | ||
| 65 | + @TypeMismatch(message = "目标量格式有误!") | ||
| 66 | + private Double targetQuantity; | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 行业 | ||
| 70 | + */ | ||
| 71 | + @ApiModelProperty("行业") | ||
| 72 | + @Length(message = "行业最多允许50个字符!") | ||
| 73 | + private String industry; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 牌号 | ||
| 77 | + */ | ||
| 78 | + @ApiModelProperty("牌号") | ||
| 79 | + @Length(message = "牌号最多允许50个字符!") | ||
| 80 | + private String mark; | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 厚度 | ||
| 84 | + */ | ||
| 85 | + @ApiModelProperty("厚度") | ||
| 86 | + @TypeMismatch(message = "厚度格式有误!") | ||
| 87 | + private Double thickness; | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 宽度 | ||
| 91 | + */ | ||
| 92 | + @ApiModelProperty("宽度") | ||
| 93 | + @TypeMismatch(message = "宽度格式有误!") | ||
| 94 | + private Double width; | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 材质要求 | ||
| 98 | + */ | ||
| 99 | + @ApiModelProperty("材质要求") | ||
| 100 | + @Length(message = "材质要求最多允许200个字符!") | ||
| 101 | + private String materialRequire; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 品质要求 | ||
| 105 | + */ | ||
| 106 | + @ApiModelProperty("品质要求") | ||
| 107 | + @Length(message = "品质要求最多允许200个字符!") | ||
| 108 | + private String qualityRequire; | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 同行 | ||
| 112 | + */ | ||
| 113 | + @ApiModelProperty("同行") | ||
| 114 | + @Length(message = "同行最多允许50个字符!") | ||
| 115 | + private String peer; | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 核价模式 | ||
| 119 | + */ | ||
| 120 | + @ApiModelProperty("核价模式") | ||
| 121 | + @Length(message = "核价模式最多允许20个字符!") | ||
| 122 | + private String pricingMode; | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 结算天数 | ||
| 126 | + */ | ||
| 127 | + @ApiModelProperty("结算天数") | ||
| 128 | + @TypeMismatch(message = "结算天数格式有误!") | ||
| 129 | + private Double settleDays; | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 责任人ID | ||
| 133 | + */ | ||
| 134 | + @ApiModelProperty(value = "责任人ID", required = true) | ||
| 135 | + @NotBlank(message = "请输入责任人ID!") | ||
| 136 | + @Length(message = "责任人ID最多允许32个字符!") | ||
| 137 | + private String chargeUserId; | ||
| 138 | + | ||
| 139 | +} | 
| 1 | +package com.lframework.xingyun.sc.vo.customer.develop; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.components.validation.IsEnum; | ||
| 4 | +import com.lframework.starter.web.core.vo.SortPageVo; | ||
| 5 | +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 8 | +import io.swagger.annotations.ApiModelProperty; | ||
| 9 | + | ||
| 10 | +import java.io.Serializable; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +public class QueryCustomerDevelopPlanVo extends SortPageVo implements BaseVo, Serializable { | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 客户ID | ||
| 21 | + */ | ||
| 22 | + @ApiModelProperty("客户ID") | ||
| 23 | + private String customerId; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 厂房ID | ||
| 27 | + */ | ||
| 28 | + @ApiModelProperty("厂房ID") | ||
| 29 | + private String workshopId; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 办事处/科办ID | ||
| 33 | + */ | ||
| 34 | + @ApiModelProperty("办事处/科办ID") | ||
| 35 | + private String officeId; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 状态 | ||
| 39 | + */ | ||
| 40 | + @ApiModelProperty("状态") | ||
| 41 | + @IsEnum(message = "状态格式不正确!", enumClass = CustomerDevelopStatus.class) | ||
| 42 | + private Integer status; | ||
| 43 | + | ||
| 44 | +} | 
| 1 | +package com.lframework.xingyun.sc.vo.customer.develop; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import javax.validation.constraints.NotBlank; | ||
| 6 | + | ||
| 7 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 8 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 9 | +import io.swagger.annotations.ApiModelProperty; | ||
| 10 | +import org.hibernate.validator.constraints.Length; | ||
| 11 | + | ||
| 12 | +import java.io.Serializable; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +public class UpdateCustomerDevelopPlanVo implements BaseVo, Serializable { | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 1L; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * ID | ||
| 23 | + */ | ||
| 24 | + @ApiModelProperty(value = "ID", required = true) | ||
| 25 | + @NotBlank(message = "id不能为空!") | ||
| 26 | + private String id; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 客户ID | ||
| 30 | + */ | ||
| 31 | + @ApiModelProperty(value = "客户ID", required = true) | ||
| 32 | + @NotBlank(message = "请选择客户ID!") | ||
| 33 | + private String customerId; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 厂房ID | ||
| 37 | + */ | ||
| 38 | + @ApiModelProperty("厂房ID") | ||
| 39 | + private String workshopId; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 办事处/科办ID | ||
| 43 | + */ | ||
| 44 | + @ApiModelProperty("办事处/科办ID") | ||
| 45 | + private String officeId; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 客户类型ID | ||
| 49 | + */ | ||
| 50 | + @ApiModelProperty("客户类型ID") | ||
| 51 | + @Length(message = "客户类型ID最多允许32个字符!") | ||
| 52 | + private String customerTypeId; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 产品品种ID | ||
| 56 | + */ | ||
| 57 | + @ApiModelProperty("产品品种ID") | ||
| 58 | + @Length(message = "产品品种ID最多允许32个字符!") | ||
| 59 | + private String productVarietyId; | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 月用量 | ||
| 63 | + */ | ||
| 64 | + @ApiModelProperty("月用量") | ||
| 65 | + @TypeMismatch(message = "月用量格式有误!") | ||
| 66 | + private Double monthlyUsage; | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 目标量 | ||
| 70 | + */ | ||
| 71 | + @ApiModelProperty("目标量") | ||
| 72 | + @TypeMismatch(message = "目标量格式有误!") | ||
| 73 | + private Double targetQuantity; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 行业 | ||
| 77 | + */ | ||
| 78 | + @ApiModelProperty("行业") | ||
| 79 | + @Length(message = "行业最多允许50个字符!") | ||
| 80 | + private String industry; | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 牌号 | ||
| 84 | + */ | ||
| 85 | + @ApiModelProperty("牌号") | ||
| 86 | + @Length(message = "牌号最多允许50个字符!") | ||
| 87 | + private String mark; | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 厚度 | ||
| 91 | + */ | ||
| 92 | + @ApiModelProperty("厚度") | ||
| 93 | + @TypeMismatch(message = "厚度格式有误!") | ||
| 94 | + private Double thickness; | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 宽度 | ||
| 98 | + */ | ||
| 99 | + @ApiModelProperty("宽度") | ||
| 100 | + @TypeMismatch(message = "宽度格式有误!") | ||
| 101 | + private Double width; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 材质要求 | ||
| 105 | + */ | ||
| 106 | + @ApiModelProperty("材质要求") | ||
| 107 | + @Length(message = "材质要求最多允许200个字符!") | ||
| 108 | + private String materialRequire; | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 品质要求 | ||
| 112 | + */ | ||
| 113 | + @ApiModelProperty("品质要求") | ||
| 114 | + @Length(message = "品质要求最多允许200个字符!") | ||
| 115 | + private String qualityRequire; | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 同行 | ||
| 119 | + */ | ||
| 120 | + @ApiModelProperty("同行") | ||
| 121 | + @Length(message = "同行最多允许50个字符!") | ||
| 122 | + private String peer; | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 核价模式 | ||
| 126 | + */ | ||
| 127 | + @ApiModelProperty("核价模式") | ||
| 128 | + @Length(message = "核价模式最多允许20个字符!") | ||
| 129 | + private String pricingMode; | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 结算天数 | ||
| 133 | + */ | ||
| 134 | + @ApiModelProperty("结算天数") | ||
| 135 | + @TypeMismatch(message = "结算天数格式有误!") | ||
| 136 | + private Double settleDays; | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * 责任人ID | ||
| 140 | + */ | ||
| 141 | + @ApiModelProperty(value = "责任人ID", required = true) | ||
| 142 | + @NotBlank(message = "请输入责任人ID!") | ||
| 143 | + @Length(message = "责任人ID最多允许32个字符!") | ||
| 144 | + private String chargeUserId; | ||
| 145 | + | ||
| 146 | +} | 
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.lframework.xingyun.sc.mappers.CustomerDevelopPlanMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="CustomerDevelopPlan" type="com.lframework.xingyun.sc.entity.CustomerDevelopPlan"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="customer_id" property="customerId"/> | ||
| 8 | + <result column="workshop_id" property="workshopId"/> | ||
| 9 | + <result column="office_id" property="officeId"/> | ||
| 10 | + <result column="customer_type_id" property="customerTypeId"/> | ||
| 11 | + <result column="product_variety_id" property="productVarietyId"/> | ||
| 12 | + <result column="monthly_usage" property="monthlyUsage"/> | ||
| 13 | + <result column="target_quantity" property="targetQuantity"/> | ||
| 14 | + <result column="industry" property="industry"/> | ||
| 15 | + <result column="mark" property="mark"/> | ||
| 16 | + <result column="thickness" property="thickness"/> | ||
| 17 | + <result column="width" property="width"/> | ||
| 18 | + <result column="material_require" property="materialRequire"/> | ||
| 19 | + <result column="quality_require" property="qualityRequire"/> | ||
| 20 | + <result column="peer" property="peer"/> | ||
| 21 | + <result column="pricing_mode" property="pricingMode"/> | ||
| 22 | + <result column="settle_days" property="settleDays"/> | ||
| 23 | + <result column="charge_user_id" property="chargeUserId"/> | ||
| 24 | + <result column="status" property="status"/> | ||
| 25 | + <result column="create_by_id" property="createById"/> | ||
| 26 | + <result column="create_by" property="createBy"/> | ||
| 27 | + <result column="update_by_id" property="updateById"/> | ||
| 28 | + <result column="update_by" property="updateBy"/> | ||
| 29 | + <result column="create_time" property="createTime"/> | ||
| 30 | + <result column="update_time" property="updateTime"/> | ||
| 31 | + </resultMap> | ||
| 32 | + | ||
| 33 | + <sql id="CustomerDevelopPlan_sql"> | ||
| 34 | + SELECT tb.id, | ||
| 35 | + tb.customer_id, | ||
| 36 | + tb.workshop_id, | ||
| 37 | + tb.office_id, | ||
| 38 | + tb.customer_type_id, | ||
| 39 | + tb.product_variety_id, | ||
| 40 | + tb.monthly_usage, | ||
| 41 | + tb.target_quantity, | ||
| 42 | + tb.industry, | ||
| 43 | + tb.mark, | ||
| 44 | + tb.thickness, | ||
| 45 | + tb.width, | ||
| 46 | + tb.material_require, | ||
| 47 | + tb.quality_require, | ||
| 48 | + tb.peer, | ||
| 49 | + tb.pricing_mode, | ||
| 50 | + tb.settle_days, | ||
| 51 | + tb.charge_user_id, | ||
| 52 | + tb.status, | ||
| 53 | + tb.create_by_id, | ||
| 54 | + tb.create_by, | ||
| 55 | + tb.update_by_id, | ||
| 56 | + tb.update_by, | ||
| 57 | + tb.create_time, | ||
| 58 | + tb.update_time | ||
| 59 | + FROM customer_develop_plan AS tb | ||
| 60 | + INNER JOIN base_data_customer AS c ON tb.customer_id = c.id | ||
| 61 | + </sql> | ||
| 62 | + | ||
| 63 | + <select id="query" resultMap="CustomerDevelopPlan"> | ||
| 64 | + <include refid="CustomerDevelopPlan_sql"/> | ||
| 65 | + <where> | ||
| 66 | + <if test="vo.customerId != null and vo.customerId != ''"> | ||
| 67 | + AND tb.customer_id = #{vo.customerId} | ||
| 68 | + </if> | ||
| 69 | + <if test="vo.workshopId != null and vo.workshopId != ''"> | ||
| 70 | + AND tb.workshop_id = #{vo.workshopId} | ||
| 71 | + </if> | ||
| 72 | + <if test="vo.officeId != null and vo.officeId != ''"> | ||
| 73 | + AND tb.office_id = #{vo.officeId} | ||
| 74 | + </if> | ||
| 75 | + <if test="vo.status != null and vo.status != ''"> | ||
| 76 | + AND tb.status = #{vo.status} | ||
| 77 | + </if> | ||
| 78 | + </where> | ||
| 79 | + </select> | ||
| 80 | +</mapper> |