Commit 93dace23 by 林永健

[+] 增加旅程实例的阶段-客户统计接口

1 parent 0d206630
package cn.com.glsx.cdp.api.customer;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch;
import cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest;
import cn.com.glsx.cdp.modules.model.customer.*;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.Result;
import io.swagger.v3.oas.annotations.Operation;
......@@ -13,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author caiym
* @version V1.0.0
......@@ -36,5 +35,9 @@ public interface CustomerSopJourneyFeignClient {
@PostMapping("/sopJourneyStage/modify")
Result<Boolean> modifyStage(@RequestBody ModifySopJourneyStageRequest request);
@Operation(description = "查询客户旅程客户统计数据")
@PostMapping("/statistics")
Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request);
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@Schema(description = "客户sop旅程统计信息")
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class CustomerSopJourneyStatisticsDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "sop旅程ID")
private String sopJourneyId;
@Schema(description = "sop旅程阶段")
private String sopJourneyStage;
@Schema(description = "数量")
private Long count;
}
......@@ -3,10 +3,7 @@ package cn.com.glsx.cdp.modules.api.customer;
import cn.com.glsx.cdp.api.customer.CustomerSopJourneyFeignClient;
import cn.com.glsx.cdp.modules.converter.CustomerSopJourneyBOConvert;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch;
import cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest;
import cn.com.glsx.cdp.modules.model.customer.*;
import cn.com.glsx.cdp.modules.service.CustomerSopJourneyService;
import cn.com.glsx.cdp.modules.util.CommonUtils;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
......@@ -23,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
......@@ -71,6 +69,7 @@ public class CustomerSopJourneyController implements CustomerSopJourneyFeignClie
@Operation(description = "修改客户旅程")
@PostMapping("/sopJourneyStage/modify")
@Override
public Result<Boolean> modifyStage(ModifySopJourneyStageRequest request) {
log.info("修改客户旅程:{}", request);
try {
......@@ -78,9 +77,21 @@ public class CustomerSopJourneyController implements CustomerSopJourneyFeignClie
} catch (Exception e) {
log.error("修改客户旅程失败", e);
String msg = e != null && e.getMessage() != null ? e.getMessage() : "";
return Result.failure(SysConstants.ResultStatus.failure.getCode(), "修改客户旅程失败:"+ msg);
return Result.failure(SysConstants.ResultStatus.failure.getCode(), "修改客户旅程失败:" + msg);
}
log.info("修改客户旅程成功");
return Result.success(true);
}
@Operation(description = "查询客户旅程客户统计数据")
@PostMapping("/statistics")
@Override
public Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request) {
CustomerSopJourneyBO requestBO = CommonUtils.convertRequest(request, CustomerSopJourneyBO.class);
try {
return Result.success(customerSopJourneyService.statistics(requestBO));
} catch (Exception e) {
return Result.failure(SysConstants.ResultStatus.failure.getCode(), e.getMessage());
}
}
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -10,4 +11,6 @@ import java.util.List;
@Mapper
public interface CustomerSopJourneyMapper extends CommonBaseMapper<CustomerSopJourney> {
List<CustomerSopJourneyBO> listCustomerSopJourney(CustomerSopJourneyBO customerSopJourneyBO);
List<CustomerSopJourneyStatisticsDTO> statisticsCustomerSopJourney(CustomerSopJourneyBO request);
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import cn.com.glsx.cdp.modules.mapper.CustomerSopJourneyMapper;
import cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO;
import cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
......@@ -83,4 +84,13 @@ public class CustomerSopJourneyService {
.updatedBy(request.getOprBy()).updatedTime(new Date()).build();
customerSopJourneyMapper.updateByExampleSelective(customerSopJourney, example);
}
public List<CustomerSopJourneyStatisticsDTO> statistics(CustomerSopJourneyBO request) {
try {
return customerSopJourneyMapper.statisticsCustomerSopJourney(request);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
}
......@@ -71,20 +71,7 @@
-->
ex_json
</sql>
<select id="listCustomerSopJourney" parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO" resultMap="BOResultMap">
select
csj.id, csj.org_id, csj.one_id, csj.sop_journey_id, csj.sop_journey_stage,
csj.sop_journey_enter_time, csj.sop_journey_stage_enter_time, csj.sop_follow_up_person_id,
csj.sop_follow_up_person_name, csj.sop_follow_up_person_phone, csj.sop_follow_up_person_aiSpeech,
csj.sop_follow_up_person_sms, csj.add_way,
c.customer_name, c.gender, c.birthday, c.age, c.customer_phone, c.customer_email,
c.id_number, c.nationality, c.province, c.city, c.region, c.address, c.marital_status,
c.occupation, c.customer_annual_income, c.customer_company, c.education_level, c.notes, c.wechat_id,
c.wechat_nickname, c.wechat_avatar_url, c.wechat_union_id,
c.add_way as c_add_way
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
<sql id="base_param" >
csj.del_flag = 0
<if test="oneId != null">
and csj.one_id = #{oneId}
......@@ -140,7 +127,36 @@
<if test="sopJourneyEnterTimeEnd != null and sopJourneyEnterTimeEnd != ''">
and csj.sop_journey_enter_time &lt;= #{sopJourneyEnterTimeEnd}
</if>
</sql>
<select id="listCustomerSopJourney" parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO" resultMap="BOResultMap">
select
csj.id, csj.org_id, csj.one_id, csj.sop_journey_id, csj.sop_journey_stage,
csj.sop_journey_enter_time, csj.sop_journey_stage_enter_time, csj.sop_follow_up_person_id,
csj.sop_follow_up_person_name, csj.sop_follow_up_person_phone, csj.sop_follow_up_person_aiSpeech,
csj.sop_follow_up_person_sms, csj.add_way,
c.customer_name, c.gender, c.birthday, c.age, c.customer_phone, c.customer_email,
c.id_number, c.nationality, c.province, c.city, c.region, c.address, c.marital_status,
c.occupation, c.customer_annual_income, c.customer_company, c.education_level, c.notes, c.wechat_id,
c.wechat_nickname, c.wechat_avatar_url, c.wechat_union_id,
c.add_way as c_add_way
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
<include refid="base_param" />
</where>
</select>
<select id="statisticsCustomerSopJourney" parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO"
resultType="cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO">
select
csj.sop_journey_id as sopJourneyId,
csj.sop_journey_stage as sopJourneyStage,
count(csj.id) as count
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
<include refid="base_param" />
</where>
group by csj.sop_journey_id, csj.sop_journey_stage
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!