Commit 608ef577 by 周海宝

Merge branch 'v1.0.1' into 'master'

[+]新增查询数量接口

See merge request !2
2 parents 2b82a30e 07b52206
...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
import java.util.List; import java.util.List;
/** /**
...@@ -39,5 +40,7 @@ public interface CustomerSopJourneyFeignClient { ...@@ -39,5 +40,7 @@ public interface CustomerSopJourneyFeignClient {
@PostMapping("/statistics") @PostMapping("/statistics")
Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request); Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request);
@Operation(description = "查询客户旅程客户数量")
@PostMapping("/journeycount")
Result<Map<String,Integer>> customerSopJourneyCount(@RequestBody CustomerSopJourneySearch request);
} }
...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -94,4 +95,15 @@ public class CustomerSopJourneyController implements CustomerSopJourneyFeignClie ...@@ -94,4 +95,15 @@ public class CustomerSopJourneyController implements CustomerSopJourneyFeignClie
return Result.failure(SysConstants.ResultStatus.failure.getCode(), e.getMessage()); return Result.failure(SysConstants.ResultStatus.failure.getCode(), e.getMessage());
} }
} }
@Operation(description = "查询客户旅程客户数量")
@PostMapping("/journeycount")
@Override
public Result<Map<String,Integer>> customerSopJourneyCount(@RequestBody CustomerSopJourneySearch request) {
log.info("查询客户旅程客户数量参数:{}", request);
RpcPagination<CustomerSopJourneyBO> pagination = CommonUtils.getRpcPagination(request, CustomerSopJourneyBO.class);
Map<String,Integer> data = customerSopJourneyService.customerSopJourneyCount(pagination.getCondition());
log.info("查询客户旅程客户数量返回:{}", data);
return Result.success(data);
}
} }
...@@ -4,13 +4,19 @@ import cn.com.glsx.cdp.modules.entity.CustomerSopJourney; ...@@ -4,13 +4,19 @@ import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO; 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.CustomerSopJourneyStatisticsDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface CustomerSopJourneyMapper extends CommonBaseMapper<CustomerSopJourney> { public interface CustomerSopJourneyMapper extends CommonBaseMapper<CustomerSopJourney> {
List<CustomerSopJourneyBO> listCustomerSopJourney(CustomerSopJourneyBO customerSopJourneyBO); List<CustomerSopJourneyBO> listCustomerSopJourney(CustomerSopJourneyBO customerSopJourneyBO);
List<CustomerSopJourneyStatisticsDTO> statisticsCustomerSopJourney(CustomerSopJourneyBO request); List<CustomerSopJourneyStatisticsDTO> statisticsCustomerSopJourney(CustomerSopJourneyBO request);
@MapKey("sop_journey_stage")
List<Map<String, Integer>> customerSopJourneyCount(CustomerSopJourneyBO customerSopJourneyBO);
} }
\ No newline at end of file \ No newline at end of file
...@@ -19,9 +19,7 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -19,9 +19,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
@Slf4j @Slf4j
@Service @Service
...@@ -93,4 +91,14 @@ public class CustomerSopJourneyService { ...@@ -93,4 +91,14 @@ public class CustomerSopJourneyService {
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR); throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
} }
} }
public Map<String, Integer> customerSopJourneyCount(CustomerSopJourneyBO customerSopJourneyBO) {
Map<String, Integer> stringIntegerMap=new HashMap<>();
List<Map<String, Integer>> maps = customerSopJourneyMapper.customerSopJourneyCount(customerSopJourneyBO);
System.out.println(maps);
for (Map<String, Integer> map : maps) {
stringIntegerMap.put(map.get("sop_journey_stage")+"",Integer.parseInt(map.get("count")+""));
}
return stringIntegerMap;
}
} }
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" /> <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" /> <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap> </resultMap>
<resultMap id="BOResultMap" type="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO" extends="BaseResultMap"> <resultMap id="BOResultMap" type="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO" extends="BaseResultMap">
<association property="customer" javaType="cn.com.glsx.cdp.modules.model.CustomerBO"> <association property="customer" javaType="cn.com.glsx.cdp.modules.model.CustomerBO">
<result column="org_id" jdbcType="VARCHAR" property="orgId" /> <result column="org_id" jdbcType="VARCHAR" property="orgId" />
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
<result column="c_ex_json" jdbcType="LONGVARCHAR" property="exJson" /> <result column="c_ex_json" jdbcType="LONGVARCHAR" property="exJson" />
</association> </association>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -158,5 +160,16 @@ ...@@ -158,5 +160,16 @@
</where> </where>
group by csj.sop_journey_id, csj.sop_journey_stage group by csj.sop_journey_id, csj.sop_journey_stage
</select> </select>
<select id="customerSopJourneyCount" resultType="java.util.Map"
parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO">
select
csj.sop_journey_stage as sop_journey_stage,count(1) 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_stage
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cn.com.glsx; package cn.com.glsx.cn.com.glsx;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.service.CustomerSopJourneyService;
import cn.com.glsx.cdp.modules.service.UserDemoService; import cn.com.glsx.cdp.modules.service.UserDemoService;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Map;
/** /**
* 测试spring cloud 服务调用方式 * 测试spring cloud 服务调用方式
*/ */
...@@ -18,9 +23,17 @@ public class TestApplication { ...@@ -18,9 +23,17 @@ public class TestApplication {
@Autowired @Autowired
private UserDemoService userDemoService; private UserDemoService userDemoService;
@Autowired
private CustomerSopJourneyService customerSopJourneyService;
@Test @Test
public void test() { public void test() {
CustomerSopJourneyBO customerSopJourneyBO=new CustomerSopJourneyBO();
customerSopJourneyBO.setSopJourneyId("xblc7");
customerSopJourneyBO.setOrgId("44211227");
customerSopJourneyBO.setSopFollowUpPersonPhone("13800000001");
Map<String, Integer> stringIntegerMap = customerSopJourneyService.customerSopJourneyCount(customerSopJourneyBO);
System.out.println(JSONObject.toJSONString(stringIntegerMap));
} }
} }
\ No newline at end of file \ 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!