Showing
13 changed files
with
509 additions
and
2 deletions
| @@ -929,4 +929,17 @@ create table `tbl_replenishment_order_line` | @@ -929,4 +929,17 @@ create table `tbl_replenishment_order_line` | ||
| 929 | 929 | ||
| 930 | 930 | ||
| 931 | alter table sys_dept add column user_id varchar(32) comment '部门负责人'; | 931 | alter table sys_dept add column user_id varchar(32) comment '部门负责人'; |
| 932 | -alter table sys_data_dic_item modify column name varchar(50) comment '名称'; | ||
| 932 | +alter table sys_data_dic_item modify column name varchar(50) comment '名称'; | ||
| 933 | + | ||
| 934 | + | ||
| 935 | +create table if not exists customer_visit_record( | ||
| 936 | + id varchar(32) primary key comment 'ID', | ||
| 937 | + customer_id varchar(32) not null comment '客户ID', | ||
| 938 | + user_id varchar(32) not null comment '拜访人员ID', | ||
| 939 | + visit_time date not null comment '拜访时间', | ||
| 940 | + visit_content varchar(500) comment '拜访内容', | ||
| 941 | + create_by_id varchar(32) not null comment '创建人ID', | ||
| 942 | + update_by_id varchar(32) not null comment '更新人ID', | ||
| 943 | + create_time datetime default now() comment '创建时间', | ||
| 944 | + update_time datetime default now() comment '更新时间' | ||
| 945 | +); |
| 1 | +package com.lframework.xingyun.basedata.vo.customer; | ||
| 2 | + | ||
| 3 | +import javax.validation.constraints.NotBlank; | ||
| 4 | +import java.time.LocalDate; | ||
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | +import javax.validation.constraints.NotNull; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 9 | +import org.hibernate.validator.constraints.Length; | ||
| 10 | +import java.io.Serializable; | ||
| 11 | +import lombok.Data; | ||
| 12 | + | ||
| 13 | +@Data | ||
| 14 | +public class CreateCustomerVisitRecordVo implements BaseVo, Serializable { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 客户ID | ||
| 20 | + */ | ||
| 21 | + @ApiModelProperty(value = "客户ID", required = true) | ||
| 22 | + @NotBlank(message = "请输入客户ID!") | ||
| 23 | + @Length(message = "客户ID最多允许32个字符!") | ||
| 24 | + private String customerId; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 拜访人员ID | ||
| 28 | + */ | ||
| 29 | + @ApiModelProperty(value = "拜访人员ID", required = true) | ||
| 30 | + @NotBlank(message = "请输入拜访人员ID!") | ||
| 31 | + @Length(message = "拜访人员ID最多允许32个字符!") | ||
| 32 | + private String userId; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 拜访时间 | ||
| 36 | + */ | ||
| 37 | + @ApiModelProperty(value = "拜访时间", required = true) | ||
| 38 | + @NotNull(message = "请输入拜访时间!") | ||
| 39 | + @TypeMismatch(message = "拜访时间格式有误!") | ||
| 40 | + private LocalDate visitTime; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 拜访内容 | ||
| 44 | + */ | ||
| 45 | + @ApiModelProperty(value = "拜访内容", required = true) | ||
| 46 | + @NotBlank(message = "请输入拜访内容!") | ||
| 47 | + @Length(message = "拜访内容最多允许500个字符!") | ||
| 48 | + private String visitContent; | ||
| 49 | +} |
| 1 | +package com.lframework.xingyun.basedata.vo.customer; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | ||
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | +import io.swagger.annotations.ApiModelProperty; | ||
| 7 | +import java.io.Serializable; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class QueryCustomerVisitRecordVo extends PageVo implements BaseVo, Serializable { | ||
| 11 | + | ||
| 12 | + private static final long serialVersionUID = 1L; | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 客户ID | ||
| 16 | + */ | ||
| 17 | + @ApiModelProperty("客户ID") | ||
| 18 | + private String customerId; | ||
| 19 | + | ||
| 20 | +} |
| 1 | +package com.lframework.xingyun.basedata.vo.customer; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | +import javax.validation.constraints.NotBlank; | ||
| 5 | +import java.time.LocalDate; | ||
| 6 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 7 | +import javax.validation.constraints.NotNull; | ||
| 8 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 9 | +import io.swagger.annotations.ApiModelProperty; | ||
| 10 | +import org.hibernate.validator.constraints.Length; | ||
| 11 | +import java.io.Serializable; | ||
| 12 | + | ||
| 13 | +@Data | ||
| 14 | +public class UpdateCustomerVisitRecordVo implements BaseVo, Serializable { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * ID | ||
| 20 | + */ | ||
| 21 | + @ApiModelProperty(value = "ID", required = true) | ||
| 22 | + @NotBlank(message = "id不能为空!") | ||
| 23 | + private String id; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 拜访人员ID | ||
| 27 | + */ | ||
| 28 | + @ApiModelProperty(value = "拜访人员ID", required = true) | ||
| 29 | + @NotBlank(message = "请输入拜访人员ID!") | ||
| 30 | + @Length(message = "拜访人员ID最多允许32个字符!") | ||
| 31 | + private String userId; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 拜访时间 | ||
| 35 | + */ | ||
| 36 | + @ApiModelProperty(value = "拜访时间", required = true) | ||
| 37 | + @TypeMismatch(message = "拜访时间格式有误!") | ||
| 38 | + @NotNull(message = "请输入拜访时间!") | ||
| 39 | + private LocalDate visitTime; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 拜访内容 | ||
| 43 | + */ | ||
| 44 | + @ApiModelProperty(value = "拜访内容", required = true) | ||
| 45 | + @NotBlank(message = "请输入拜访内容!") | ||
| 46 | + @Length(message = "拜访内容最多允许500个字符!") | ||
| 47 | + private String visitContent; | ||
| 48 | + | ||
| 49 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/customer/develop/GetCustomerDevelopPlanBo.java
| @@ -7,7 +7,9 @@ import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | @@ -7,7 +7,9 @@ import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | ||
| 7 | import com.lframework.starter.common.constants.StringPool; | 7 | import com.lframework.starter.common.constants.StringPool; |
| 8 | import com.lframework.starter.web.core.bo.BaseBo; | 8 | import com.lframework.starter.web.core.bo.BaseBo; |
| 9 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 10 | +import java.util.List; | ||
| 10 | 11 | ||
| 12 | +import com.lframework.xingyun.sc.entity.CustomerVisitRecord; | ||
| 11 | import io.swagger.annotations.ApiModelProperty; | 13 | import io.swagger.annotations.ApiModelProperty; |
| 12 | 14 | ||
| 13 | import lombok.Data; | 15 | import lombok.Data; |
| @@ -148,6 +150,12 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> implem | @@ -148,6 +150,12 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> implem | ||
| 148 | private String flowTaskId; | 150 | private String flowTaskId; |
| 149 | 151 | ||
| 150 | /** | 152 | /** |
| 153 | + * 拜访记录 | ||
| 154 | + */ | ||
| 155 | + @ApiModelProperty("备注") | ||
| 156 | + private List<CustomerVisitRecord> visitRecords; | ||
| 157 | + | ||
| 158 | + /** | ||
| 151 | * 创建人 | 159 | * 创建人 |
| 152 | */ | 160 | */ |
| 153 | @ApiModelProperty("创建人") | 161 | @ApiModelProperty("创建人") |
| 1 | +package com.lframework.xingyun.sc.controller.customer; | ||
| 2 | + | ||
| 3 | +import com.lframework.xingyun.sc.service.customer.CustomerVisitRecordService; | ||
| 4 | +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVisitRecordVo; | ||
| 5 | +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVisitRecordVo; | ||
| 6 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | ||
| 7 | + | ||
| 8 | +import javax.annotation.Resource; | ||
| 9 | +import javax.validation.constraints.NotBlank; | ||
| 10 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 11 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | ||
| 12 | +import io.swagger.annotations.ApiOperation; | ||
| 13 | +import io.swagger.annotations.Api; | ||
| 14 | +import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 15 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | + | ||
| 19 | +import javax.validation.Valid; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 客户拜访记录 Controller | ||
| 23 | + * | ||
| 24 | + */ | ||
| 25 | +@Api(tags = "客户拜访记录") | ||
| 26 | +@Validated | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("/customer/visitRecord") | ||
| 29 | +public class CustomerVisitRecordController extends DefaultBaseController { | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private CustomerVisitRecordService customerVisitRecordService; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 新增 | ||
| 37 | + */ | ||
| 38 | + @ApiOperation("新增") | ||
| 39 | + @PostMapping | ||
| 40 | + public InvokeResult<Void> create(@Valid CreateCustomerVisitRecordVo vo) { | ||
| 41 | + customerVisitRecordService.create(vo); | ||
| 42 | + return InvokeResultBuilder.success(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 修改 | ||
| 47 | + */ | ||
| 48 | + @ApiOperation("修改") | ||
| 49 | + @PutMapping | ||
| 50 | + public InvokeResult<Void> update(@Valid UpdateCustomerVisitRecordVo vo) { | ||
| 51 | + customerVisitRecordService.update(vo); | ||
| 52 | + return InvokeResultBuilder.success(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 根据ID删除 | ||
| 57 | + */ | ||
| 58 | + @ApiOperation("根据ID删除") | ||
| 59 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 60 | + @DeleteMapping | ||
| 61 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | ||
| 62 | + customerVisitRecordService.deleteById(id); | ||
| 63 | + return InvokeResultBuilder.success(); | ||
| 64 | + } | ||
| 65 | +} |
| @@ -9,6 +9,7 @@ import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | @@ -9,6 +9,7 @@ import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | ||
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| 11 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
| 12 | +import java.util.List; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * <p> | 15 | * <p> |
| @@ -139,6 +140,12 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto { | @@ -139,6 +140,12 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto { | ||
| 139 | private String deptCode; | 140 | private String deptCode; |
| 140 | 141 | ||
| 141 | /** | 142 | /** |
| 143 | + * 拜访记录 | ||
| 144 | + */ | ||
| 145 | + @TableField(exist = false) | ||
| 146 | + private List<CustomerVisitRecord> visitRecords; | ||
| 147 | + | ||
| 148 | + /** | ||
| 142 | * 创建人ID | 149 | * 创建人ID |
| 143 | */ | 150 | */ |
| 144 | @TableField(fill = FieldFill.INSERT) | 151 | @TableField(fill = FieldFill.INSERT) |
| 1 | +package com.lframework.xingyun.sc.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 4 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDate; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 9 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 10 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 11 | +import lombok.Data; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * <p> | ||
| 15 | + * 客户拜访记录 | ||
| 16 | + * </p> | ||
| 17 | + * | ||
| 18 | + */ | ||
| 19 | +@Data | ||
| 20 | +@TableName("customer_visit_record") | ||
| 21 | +public class CustomerVisitRecord extends BaseEntity implements BaseDto { | ||
| 22 | + | ||
| 23 | + private static final long serialVersionUID = 1L; | ||
| 24 | + | ||
| 25 | + public static final String CACHE_NAME = "CustomerVisitRecord"; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * ID | ||
| 29 | + */ | ||
| 30 | + private String id; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 客户ID | ||
| 34 | + */ | ||
| 35 | + private String customerId; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 拜访人员ID | ||
| 39 | + */ | ||
| 40 | + private String userId; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 拜访人员姓名 | ||
| 44 | + */ | ||
| 45 | + @TableField(exist = false) | ||
| 46 | + private String userName; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 拜访时间 | ||
| 50 | + */ | ||
| 51 | + private LocalDate visitTime; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 拜访内容 | ||
| 55 | + */ | ||
| 56 | + private String visitContent; | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 创建人ID | ||
| 60 | + */ | ||
| 61 | + @TableField(fill = FieldFill.INSERT) | ||
| 62 | + private String createById; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 更新人ID | ||
| 66 | + */ | ||
| 67 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 68 | + private String updateById; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 创建时间 | ||
| 72 | + */ | ||
| 73 | + @TableField(fill = FieldFill.INSERT) | ||
| 74 | + private LocalDateTime createTime; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 更新时间 | ||
| 78 | + */ | ||
| 79 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 80 | + private LocalDateTime updateTime; | ||
| 81 | + | ||
| 82 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerDevelopPlanServiceImpl.java
| @@ -15,6 +15,7 @@ import com.lframework.xingyun.basedata.entity.Workshop; | @@ -15,6 +15,7 @@ import com.lframework.xingyun.basedata.entity.Workshop; | ||
| 15 | import com.lframework.xingyun.basedata.service.customer.CustomerService; | 15 | import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| 16 | import com.lframework.xingyun.basedata.service.office.OfficeService; | 16 | import com.lframework.xingyun.basedata.service.office.OfficeService; |
| 17 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; | 17 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| 18 | +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVisitRecordVo; | ||
| 18 | import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; | 19 | import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; |
| 19 | import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | 20 | import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; |
| 20 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | 21 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| @@ -25,8 +26,10 @@ import com.lframework.starter.common.utils.ObjectUtil; | @@ -25,8 +26,10 @@ import com.lframework.starter.common.utils.ObjectUtil; | ||
| 25 | import com.lframework.starter.web.core.annotations.oplog.OpLog; | 26 | import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 26 | import com.lframework.starter.common.utils.Assert; | 27 | import com.lframework.starter.common.utils.Assert; |
| 27 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 28 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 29 | +import com.lframework.xingyun.sc.entity.CustomerVisitRecord; | ||
| 28 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | 30 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 29 | import com.lframework.xingyun.sc.handlers.MessageHandler; | 31 | import com.lframework.xingyun.sc.handlers.MessageHandler; |
| 32 | +import com.lframework.xingyun.sc.service.customer.CustomerVisitRecordService; | ||
| 30 | import lombok.extern.slf4j.Slf4j; | 33 | import lombok.extern.slf4j.Slf4j; |
| 31 | import org.apache.commons.collections4.CollectionUtils; | 34 | import org.apache.commons.collections4.CollectionUtils; |
| 32 | import org.apache.commons.lang3.StringUtils; | 35 | import org.apache.commons.lang3.StringUtils; |
| @@ -66,6 +69,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe | @@ -66,6 +69,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe | ||
| 66 | private CustomerService customerService; | 69 | private CustomerService customerService; |
| 67 | @Resource | 70 | @Resource |
| 68 | private OfficeService officeService; | 71 | private OfficeService officeService; |
| 72 | + @Resource | ||
| 73 | + private CustomerVisitRecordService customerVisitRecordService; | ||
| 69 | 74 | ||
| 70 | 75 | ||
| 71 | 76 | ||
| @@ -140,7 +145,14 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe | @@ -140,7 +145,14 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe | ||
| 140 | */ | 145 | */ |
| 141 | @Override | 146 | @Override |
| 142 | public CustomerDevelopPlan findById(String id) { | 147 | public CustomerDevelopPlan findById(String id) { |
| 143 | - return getBaseMapper().selectById(id); | 148 | + CustomerDevelopPlan plan = getBaseMapper().selectById(id); |
| 149 | + | ||
| 150 | + QueryCustomerVisitRecordVo recordVo = new QueryCustomerVisitRecordVo(); | ||
| 151 | + recordVo.setCustomerId(id); | ||
| 152 | + List<CustomerVisitRecord> visitRecordList = customerVisitRecordService.query(recordVo); | ||
| 153 | + plan.setVisitRecords(visitRecordList); | ||
| 154 | + | ||
| 155 | + return plan; | ||
| 144 | } | 156 | } |
| 145 | 157 | ||
| 146 | @OpLog(type = OtherOpLogType.class, name = "新增客户开发计划,ID:{}", params = {"#id"}) | 158 | @OpLog(type = OtherOpLogType.class, name = "新增客户开发计划,ID:{}", params = {"#id"}) |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerVisitRecordServiceImpl.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.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 6 | +import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 7 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 8 | +import com.lframework.starter.web.core.utils.IdUtil; | ||
| 9 | +import com.lframework.starter.common.utils.ObjectUtil; | ||
| 10 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 11 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 12 | +import com.lframework.xingyun.sc.mappers.CustomerVisitRecordMapper; | ||
| 13 | +import com.lframework.xingyun.sc.service.customer.CustomerVisitRecordService; | ||
| 14 | +import org.springframework.transaction.annotation.Transactional; | ||
| 15 | +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVisitRecordVo; | ||
| 16 | +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVisitRecordVo; | ||
| 17 | +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVisitRecordVo; | ||
| 18 | +import org.springframework.stereotype.Service; | ||
| 19 | +import com.lframework.xingyun.sc.entity.CustomerVisitRecord; | ||
| 20 | + | ||
| 21 | +import java.util.List; | ||
| 22 | + | ||
| 23 | +@Service | ||
| 24 | +public class CustomerVisitRecordServiceImpl extends BaseMpServiceImpl<CustomerVisitRecordMapper, CustomerVisitRecord> implements CustomerVisitRecordService { | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public List<CustomerVisitRecord> query(QueryCustomerVisitRecordVo vo) { | ||
| 30 | + return getBaseMapper().query(vo); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public CustomerVisitRecord findById(String id) { | ||
| 35 | + return getBaseMapper().selectById(id); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @OpLog(type = OtherOpLogType.class, name = "新增客户拜访记录,ID:{}", params = {"#id"}) | ||
| 39 | + @Transactional(rollbackFor = Exception.class) | ||
| 40 | + @Override | ||
| 41 | + public String create(CreateCustomerVisitRecordVo vo) { | ||
| 42 | + | ||
| 43 | + CustomerVisitRecord data = new CustomerVisitRecord(); | ||
| 44 | + data.setId(IdUtil.getId()); | ||
| 45 | + data.setCustomerId(vo.getCustomerId()); | ||
| 46 | + data.setUserId(vo.getUserId()); | ||
| 47 | + data.setVisitTime(vo.getVisitTime()); | ||
| 48 | + data.setVisitContent(vo.getVisitContent()); | ||
| 49 | + | ||
| 50 | + getBaseMapper().insert(data); | ||
| 51 | + | ||
| 52 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 53 | + OpLogUtil.setExtra(vo); | ||
| 54 | + | ||
| 55 | + return data.getId(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @OpLog(type = OtherOpLogType.class, name = "修改客户拜访记录,ID:{}", params = {"#id"}) | ||
| 59 | + @Transactional(rollbackFor = Exception.class) | ||
| 60 | + @Override | ||
| 61 | + public void update(UpdateCustomerVisitRecordVo vo) { | ||
| 62 | + CustomerVisitRecord data = getBaseMapper().selectById(vo.getId()); | ||
| 63 | + if (ObjectUtil.isNull(data)) { | ||
| 64 | + throw new DefaultClientException("客户拜访记录不存在!"); | ||
| 65 | + } | ||
| 66 | + LambdaUpdateWrapper<CustomerVisitRecord> updateWrapper = Wrappers.lambdaUpdate(CustomerVisitRecord.class) | ||
| 67 | + .set(CustomerVisitRecord::getUserId, vo.getUserId()) | ||
| 68 | + .set(CustomerVisitRecord::getVisitTime, vo.getVisitTime()) | ||
| 69 | + .set(CustomerVisitRecord::getVisitContent, vo.getVisitContent()) | ||
| 70 | + .eq(CustomerVisitRecord::getId, vo.getId()); | ||
| 71 | + getBaseMapper().update(updateWrapper); | ||
| 72 | + | ||
| 73 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 74 | + OpLogUtil.setExtra(vo); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @OpLog(type = OtherOpLogType.class, name = "删除客户拜访记录,ID:{}", params = {"#id"}) | ||
| 78 | + @Transactional(rollbackFor = Exception.class) | ||
| 79 | + @Override | ||
| 80 | + public void deleteById(String id) { | ||
| 81 | + getBaseMapper().deleteById(id); | ||
| 82 | + } | ||
| 83 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/CustomerVisitRecordMapper.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.mappers; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVisitRecordVo; | ||
| 5 | +import com.lframework.xingyun.sc.entity.CustomerVisitRecord; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * <p> | ||
| 12 | + * 客户拜访记录 Mapper 接口 | ||
| 13 | + * </p> | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | +public interface CustomerVisitRecordMapper extends BaseMapper<CustomerVisitRecord> { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 查询列表 | ||
| 20 | + * | ||
| 21 | + * @param vo 查询条件 | ||
| 22 | + * @return List<CustomerVisitRecord> | ||
| 23 | + */ | ||
| 24 | + List<CustomerVisitRecord> query(@Param("vo") QueryCustomerVisitRecordVo vo); | ||
| 25 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/customer/CustomerVisitRecordService.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.service.customer; | ||
| 2 | + | ||
| 3 | +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVisitRecordVo; | ||
| 4 | +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVisitRecordVo; | ||
| 5 | +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVisitRecordVo; | ||
| 6 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 7 | +import com.lframework.xingyun.sc.entity.CustomerVisitRecord; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 客户拜访记录 Service | ||
| 13 | + */ | ||
| 14 | +public interface CustomerVisitRecordService extends BaseMpService<CustomerVisitRecord> { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 查询列表 | ||
| 18 | + * | ||
| 19 | + * @param vo 查询条件 | ||
| 20 | + * @return List<CustomerVisitRecord> | ||
| 21 | + */ | ||
| 22 | + List<CustomerVisitRecord> query(QueryCustomerVisitRecordVo vo); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 根据ID查询 | ||
| 26 | + * @param id 主键ID | ||
| 27 | + * @return CustomerVisitRecord | ||
| 28 | + */ | ||
| 29 | + CustomerVisitRecord findById(String id); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 创建 | ||
| 33 | + * | ||
| 34 | + * @param vo 数据实体 | ||
| 35 | + * @return String | ||
| 36 | + */ | ||
| 37 | + String create(CreateCustomerVisitRecordVo vo); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 修改 | ||
| 41 | + * | ||
| 42 | + * @param vo 数据实体 | ||
| 43 | + */ | ||
| 44 | + void update(UpdateCustomerVisitRecordVo vo); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 根据ID删除 | ||
| 48 | + * | ||
| 49 | + * @param id 主键ID | ||
| 50 | + */ | ||
| 51 | + void deleteById(String id); | ||
| 52 | +} |
| 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.CustomerVisitRecordMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="CustomerVisitRecord" type="com.lframework.xingyun.sc.entity.CustomerVisitRecord"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="customer_id" property="customerId"/> | ||
| 8 | + <result column="user_id" property="userId"/> | ||
| 9 | + <result column="user_name" property="userName"/> | ||
| 10 | + <result column="visit_time" property="visitTime"/> | ||
| 11 | + <result column="visit_content" property="visitContent"/> | ||
| 12 | + <result column="create_by_id" property="createById"/> | ||
| 13 | + <result column="update_by_id" property="updateById"/> | ||
| 14 | + <result column="create_time" property="createTime"/> | ||
| 15 | + <result column="update_time" property="updateTime"/> | ||
| 16 | + </resultMap> | ||
| 17 | + | ||
| 18 | + <sql id="CustomerVisitRecord_sql"> | ||
| 19 | + SELECT | ||
| 20 | + tb.id, | ||
| 21 | + tb.customer_id, | ||
| 22 | + tb.user_id, | ||
| 23 | + u.name as user_name, | ||
| 24 | + tb.visit_time, | ||
| 25 | + tb.visit_content, | ||
| 26 | + tb.create_by_id, | ||
| 27 | + tb.update_by_id, | ||
| 28 | + tb.create_time, | ||
| 29 | + tb.update_time | ||
| 30 | + FROM customer_visit_record AS tb | ||
| 31 | + LEFT JOIN sys_user AS u ON tb.user_id = u.id | ||
| 32 | + </sql> | ||
| 33 | + | ||
| 34 | + <select id="query" resultMap="CustomerVisitRecord"> | ||
| 35 | + <include refid="CustomerVisitRecord_sql"/> | ||
| 36 | + <where> | ||
| 37 | + <if test="vo.customerId != null and vo.customerId != ''"> | ||
| 38 | + AND tb.customer_id = #{vo.customerId} | ||
| 39 | + </if> | ||
| 40 | + </where> | ||
| 41 | + </select> | ||
| 42 | +</mapper> |