Commit d2396024 by 叶立庆

Merge branch 'master' into V5.5.3

2 parents d36839d7 d5af456b
......@@ -62,4 +62,8 @@ public class CustomerOrderTemp {
@Column(name = "order_transaction_amount")
private BigDecimal orderTransactionAmount; // 推荐使用 BigDecimal 处理金额
@Column(name = "is_anxin_package")
private Integer isAnxinPackage;
}
\ No newline at end of file
......@@ -82,30 +82,17 @@ public class ConversationBatchService {
RpcPagination<ConversationBatchRequestDTO> req) {
PageHelper.startPage(req.getPageNum(), req.getPageSize());
Page<ConversationBatchDTO> res = conversationBatchMapper.page(req.getCondition());
List<String> phones=conversationBatchMapper.findAllFinishPhone("安心");
//成交订单手机号
List<String> allPhones=conversationBatchMapper.findAllOrderPhone();
if(CollectionUtils.isNotEmpty(res)){
List<Integer> collected = res.stream().map(ConversationBatchDTO::getMerchantId)
List<Integer> collected = res.stream().filter(index->index.getMerchantId()!=null).map(ConversationBatchDTO::getMerchantId)
.collect(Collectors.toList());
if(CollectionUtils.isEmpty(collected)) {
return res;
}
ListMerchantRequest listMerchantRequest = new ListMerchantRequest();
String merchantNos = org.apache.commons.lang3.StringUtils.join(collected, ",");
listMerchantRequest.setMerchantNoStrSet(merchantNos);
List<MerchantRopResponse> merchantListByCondition = merchantService.findMerchantListByCondition(
listMerchantRequest);
for (ConversationBatchDTO extBatchById : res) {
if(CollectionUtils.isNotEmpty(phones)){
String phoneNumber = extBatchById.getPhoneNumber();
if(phones.contains(phoneNumber)){
extBatchById.setFinishFlag(true);
}
}
if(CollectionUtils.isNotEmpty(allPhones)){
String phoneNumber = extBatchById.getPhoneNumber();
if(allPhones.contains(phoneNumber)){
extBatchById.setOrderFinishFlag(true);
}
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(merchantListByCondition)) {
for (ConversationBatchDTO merchantDTO : res) {
List<MerchantRopResponse> merchantRopResponses = merchantListByCondition.stream()
......@@ -117,7 +104,6 @@ public class ConversationBatchService {
}
}
}
}
return res;
}
......@@ -323,7 +309,7 @@ public class ConversationBatchService {
*/
public List<ConversationBatchDTO> findExtBatchByIds(List<Integer> collect) {
List<ConversationBatchDTO> extBatchByIds = conversationBatchMapper.findExtBatchByIds(collect);
// 安心包成交订单手机号
/* // 安心包成交订单手机号
List<String> axPhones=conversationBatchMapper.findAllFinishPhone("安心");
//成交订单手机号
......@@ -342,7 +328,7 @@ public class ConversationBatchService {
}
}
}
}
}*/
return extBatchByIds;
}
......
......@@ -5,8 +5,10 @@ import cn.com.glsx.dj.mindworkplate.model.CustomerOrderTemp;
import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
......@@ -34,6 +36,18 @@ public class CustomerOrderTempService {
if (CollectionUtils.isNotEmpty(allOrder)){
for (CustomerOrderTemp customerOrderTemp : allOrder) {
CustomerOrderTemp newcustomerOrderTemp=customerOrderTempMapper.findByOrderCode(customerOrderTemp.getOrderCode());
log.info("订单详情{}", JSONObject.toJSONString(customerOrderTemp));
boolean isAnxin = Arrays.asList(
customerOrderTemp.getUpgradeGoodsName(),
customerOrderTemp.getUpgradeGoodsAlias(),
customerOrderTemp.getPackageName()
).stream()
.filter(Objects::nonNull) // 先过滤 null
.anyMatch(s -> s.contains("安心"));
if (customerOrderTemp.getOrderStatus()!=null) {
boolean b = 4 == customerOrderTemp.getOrderStatus() || 6 == customerOrderTemp.getOrderStatus();
customerOrderTemp.setIsAnxinPackage(isAnxin && b ? 1 : 0);
}
if(newcustomerOrderTemp==null){
customerOrderTemp.setUpdateTime(new Date());
customerOrderTempMapper.insert(customerOrderTemp);
......@@ -55,6 +69,17 @@ public class CustomerOrderTempService {
CustomerOrderTemp customerOrderTemp=customerOrderTempMapper.searchByOrderCode(orderCode);
if(customerOrderTemp!=null){
log.info("订单详情{}", JSONObject.toJSONString(customerOrderTemp));
boolean isAnxin = Arrays.asList(
customerOrderTemp.getUpgradeGoodsName(),
customerOrderTemp.getUpgradeGoodsAlias(),
customerOrderTemp.getPackageName()
).stream()
.filter(Objects::nonNull) // 先过滤 null
.anyMatch(s -> s.contains("安心"));
if (customerOrderTemp.getOrderStatus()!=null) {
boolean b = 4 == customerOrderTemp.getOrderStatus() || 6 == customerOrderTemp.getOrderStatus();
customerOrderTemp.setIsAnxinPackage(isAnxin && b ? 1 : 0);
}
if(newcustomerOrderTemp==null){
customerOrderTempMapper.insert(customerOrderTemp);
customerOrderTemp.setUpdateTime(new Date());
......@@ -65,4 +90,5 @@ public class CustomerOrderTempService {
}
}
}
......@@ -637,8 +637,8 @@ public class EmployeeBadgeService {
}
}
return EasyExcelUtil.exportExcelMuliLevel(badgeCheckExportModels,
UUID.randomUUID().toString().replace("-", "") + "设备质检_",
"yyyy-MM-dd", Thread.currentThread().getContextClassLoader()
"接待记录明细列表_"+employeeBadgeDTO.getSearchStartDate()+"~"+employeeBadgeDTO.getSearchEndDate(),
DateUtils.YEARMONTHDATEHOURMINUTESECOND, Thread.currentThread().getContextClassLoader()
.getResourceAsStream("templates/rec_template.xlsx"),
1);
} catch (Exception e) {
......
......@@ -234,9 +234,8 @@ public class DigitalManagementStaffRecordService {
public List<Date> mySubmittedDateRecord(SubmittedDateRequestDTO request) {
if (StringUtils.isBlank(request.getTemplateCode())) {
request.setExcludeTemplateCode(templateService.getLightChangeTemplateCode());
}else {
request.setExcludeTemplateCode(null);
// 默认模板,屏蔽飞行督导和导师
request.setTemplateCode(templateService.getDefaultTemplateCode());
}
return staffRecordMapper.mySubmittedDateRecord(request);
}
......@@ -246,6 +245,9 @@ public class DigitalManagementStaffRecordService {
String uuid = dto.getUuid();
Integer loginRole = dto.getLoginRole();
String templateCode = dto.getTemplateCode();
if (StringUtils.isBlank(templateCode)) {
templateCode = templateService.getDefaultTemplateCode();
}
DigitalManagementStaffRecord staffRecord = getMyRecordDetail(uuid, date, templateCode);
if (Objects.isNull(staffRecord)) {
return getStaffRecordTemplateInfo(loginRole, uuid, date, templateCode);
......@@ -256,9 +258,11 @@ public class DigitalManagementStaffRecordService {
public DigitalManagementStaffRecord getMyRecordDetail(String uuid, Date date, String templateCode) {
// 轻改入口会指定模板code,如果没有传,应该过滤轻改模板
// 没有就传走默认模板,屏蔽导师和飞行督导
String excludeTemplateCode = null;
if (StringUtils.isBlank(templateCode)) {
excludeTemplateCode = templateService.getLightChangeTemplateCode();
templateCode = templateService.getDefaultTemplateCode();
// excludeTemplateCode = templateService.getLightChangeTemplateCode();
}
return staffRecordMapper.myRecordDetail(uuid, date, excludeTemplateCode, templateCode);
}
......@@ -343,6 +347,9 @@ public class DigitalManagementStaffRecordService {
Integer loginRole = dto.getLoginRole();
String uuid = dto.getUuid();
String templateCode = dto.getTemplateCode();
if (StringUtils.isBlank(templateCode)) {
templateCode = templateService.getDefaultTemplateCode();
}
Date reportDate = DateUtils.parseDate(form.get(RECORD_ITEM_KEY_REPORT_DATE));
Date today = reportDate == null ? new Date() : reportDate;
......
......@@ -274,9 +274,6 @@ public class DigitalManagementTemplateService {
p -> DigitalManagementStaffInfoDTO.buildByMerchantStaff(p),
(p1, p2) -> p2));
}else {
boolean isLightChangeTemplate = staffRecordService.isLightChangeTemplate(templateDTO.getCode());
// 轻改模板:查所有驻店
if (isLightChangeTemplate) {
DigitalManagementStaffRequestDTO staffRequestDTO = new DigitalManagementStaffRequestDTO();
staffRequestDTO.setStaffUuidList(staffUuids);
List<DigitalManagementStaffResponseDTO> staffResponseDTOS = staffRecordMapper.selectStaffInfo(staffRequestDTO);
......@@ -290,23 +287,6 @@ public class DigitalManagementTemplateService {
p -> new DigitalManagementStaffInfoDTO(p.getStaffUuid(), p.getStaffName(), p.getStaffPhone(), p.getMerchantId(), p.getMerchantName()),
(p1, p2) -> p2));
}
// 驻店管理查督导
ShopMerchantDirectorConfigDTO req = ShopMerchantDirectorConfigDTO.builder()
.directorTypes(Lists.newArrayList(DirectorTypeEnum.AREA_SUPERVISION_1_1.getValue(),DirectorTypeEnum.AREA_SUPERVISION_2_1.getValue()))
.directorUserIdList(staffUuids)
.build();
RpcResponse<List<ShopMerchantDirectorConfigDTO>> staffRes = shopMerchantDirectorConfigRemote.list(req);
if (staffRes.isFailed() || CollectionUtils.isEmpty(staffRes.getResult())) {
log.error("获取员工信息失败! req:{},msg:{}", req, staffRes.getMessage());
return new HashMap<>();
}
return staffRes.getResult().stream()
.filter(p -> StringUtils.hasLength(p.getDirectorUserId()) && staffUuids.contains(p.getDirectorUserId()))
.collect(Collectors.toMap(
p -> p.getDirectorUserId(),
p -> new DigitalManagementStaffInfoDTO(p.getDirectorUserId(), p.getDirectorName(), p.getDirectorPhone(), p.getMerchantId(), p.getMerchantName()),
(p1, p2) -> p2));
}
}
public DigitalManagementTemplateDTO myTemplate(Integer loginRole, String uuid) {
......@@ -453,6 +433,10 @@ public class DigitalManagementTemplateService {
return env.getProperty("digital.management.light.change.template", "qinggai-temp-001");
}
public String getDefaultTemplateCode(){
return env.getProperty("digital.management.default.template", "uuid-temp-001");
}
/**
* 同步模板圈人,针对无法进行圈人操作的模板。
* 目前有:飞行督导、导师两个模板
......@@ -509,7 +493,7 @@ public class DigitalManagementTemplateService {
log.info("getTemplateByStaffUuid loginRole: {}, uuid: {}", loginRole, uuid);
if (loginRole == null) {
// 系统默认角色的loginRile=null, 也返回导师模板
return templateMapper.findByCode(getTeachTemplateCode());
return templateMapper.findByCode(getDefaultTemplateCode());
}
switch (loginRole){
// 区域运营角色,查询圈人
......
......@@ -41,6 +41,7 @@
<result column="defence_result_flag" property="defence" jdbcType="INTEGER"/>
<result column="axbOpenFlag" property="axbOpenFlag" jdbcType="BOOLEAN"/>
<result column="isOrderFinishFlag" property="orderFinishFlag" jdbcType="BOOLEAN"/>
<result column="isFinishFlag" property="finishFlag" jdbcType="BOOLEAN"/>
<result column="employeeName" property="employeeName" jdbcType="VARCHAR"/>
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="reception_start_time" property="receptionStartTime" jdbcType="TIMESTAMP"/>
......@@ -68,13 +69,24 @@
parameterType="cn.com.glsx.dj.mindworkplate.dto.ConversationBatchRequestDTO"
resultMap="DTOResultMap">
select cb.*,re.customer_name,re.phone_number,re.car_brand,re.car_model,re.reception_status,re.bussiness_type,ind.customer_type,ind.avg_defence as def_score,
ibr.defence_result_flag, ibr.defence_task_id,if(t3.Is_mentioned=1,true,false) as axbOpenFlag, re.merchant_id, re.reception_start_time,ibr.check_history_flag as checkHistoryFlag
ibr.defence_result_flag, ibr.defence_task_id,if(t3.Is_mentioned=1,true,false) as axbOpenFlag, re.merchant_id, re.reception_start_time,ibr.check_history_flag as checkHistoryFlag,
COALESCE(orders.has_anxin, 0) AS isFinishFlag, -- 安心包是否成交 → isFinishFlag
COALESCE(orders.has_completed, 0) AS isOrderFinishFlag -- 订单是否成交 → isOrderFinishFlag
from
inspection_conversation_batch cb
left join reception_customer_info re on cb.task_id = re.id
left join inspection_defence ind on ind.batch_id = cb.id and ind.deleted_flag = 'N'
left join inspection_badge_recordings ibr on ibr.id = cb.record_id and ibr.deleted_flag = 'N'
left join recording_batch_model_call_axb t3 on cb.id=t3.batch_id
LEFT JOIN (
SELECT
phone,
1 AS has_completed, -- 因为 WHERE 已限定 order_status IN (4,6)
MAX(is_anxin_package) AS has_anxin
FROM dj_smartcarlife.customer_order_temp
WHERE order_status IN (4, 6)
GROUP BY phone
) orders ON re.phone_number = orders.phone
<where>
cb.deleted_flag = 'N'
<if test="id != null">
......@@ -214,11 +226,23 @@
<select id="findExtBatchByIds"
resultType="cn.com.glsx.dj.mindworkplate.dto.ConversationBatchDTO">
select t1.conversation_id as conversationId,t2.customer_name as customerName,t2.phone_number as phoneNumber,t2.reception_status,t1.start_time,t1.file_url,t1.duration,
if(t3.Is_mentioned=1,true,false) as axbOpenFlag,if(t4.Is_mentioned=1,true,false) as dtcOpenFlag
if(t3.Is_mentioned=1,true,false) as axbOpenFlag,if(t4.Is_mentioned=1,true,false) as dtcOpenFlag,
-- 👇 关键:按你的 Java 字段命名
COALESCE(orders.has_anxin, 0) AS isFinishFlag, -- 安心包是否成交 → isFinishFlag
COALESCE(orders.has_completed, 0) AS isOrderFinishFlag -- 订单是否成交 → isOrderFinishFlag
from inspection_conversation_batch t1
left join reception_customer_info t2 on t1.task_id = t2.id
left join recording_batch_model_call_axb t3 on t1.id=t3.batch_id
left join recording_batch_model_call_dtc t4 on t1.id=t4.batch_id
LEFT JOIN (
SELECT
phone,
1 AS has_completed, -- 因为 WHERE 已限定 order_status IN (4,6)
MAX(is_anxin_package) AS has_anxin -- 👈 关键:取最大值(0/1),只要有一个1就是1
FROM dj_smartcarlife.customer_order_temp
WHERE order_status IN (4, 6) and scene_type=0
GROUP BY phone
) orders ON t2.phone_number = orders.phone
<where>
<if test="ids != null and ids.size>0">
t1.conversation_id in
......
......@@ -386,57 +386,36 @@
<select id="findPhoneListByRecMerchantNo" resultType="cn.com.glsx.dj.mindworkplate.dto.EmployeeSearch">
select distinct t2.badge_id as badgeId,date_format(t2.recording_start_time,'%Y-%m-%d') as audioTime from reception_customer_info t1
left join inspection_badge_recordings t2 on t1.id=t2.reception_id
where 1=1
<!-- 条件1:安心包是否成交(is_anxin_package = 1) -->
<if test="condition.orderAxbTransactionFlag != null">
left join (select
distinct dclgoc.customer_phone
from dj_car_life_goods_order dclgo
left join dj_car_life_goods_sub_order dclgso
on dclgo.order_code = dclgso.order_code and dclgso.deleted_flag = 'N'
left join dj_car_life_goods_order_customer dclgoc
on dclgoc.order_code = dclgo.order_code and dclgoc.deleted_flag = 'N'
left join dj_car_life_pay_order dclpo on dclpo.order_code = dclgo.order_code and dclpo.deleted_flag = 'N'
where dclgo.deleted_flag = 'N' and dclgo.scene_type = #{bussinessType}
and dclgo.status in (4, 6) and upgrade_flag = 'Y' and (upgrade_goods_name like concat('%', '安心包','%')
or upgrade_goods_alias like concat('%', '安心','%')
or package_name like concat('%', '安心','%') )
<if test="condition.orderTransactionAmount != null ">
and dclgo.total_price> #{condition.orderTransactionAmount}
AND EXISTS (
SELECT 1
FROM dj_smartcarlife.customer_order_temp cot
WHERE cot.phone = t1.phone_number
AND cot.scene_type = #{bussinessType}
AND cot.order_status IN (4, 6)
AND cot.is_anxin_package = 1
<if test="condition.orderTransactionAmount != null">
AND cot.order_transaction_amount > #{condition.orderTransactionAmount}
</if>
) t3 on t3.customer_phone = t1.phone_number
)
</if>
<!-- 条件2:是否有成交订单(不关心是否安心包) -->
<if test="condition.orderTransactionFlag != null">
left join (select
distinct dclgoc.customer_phone
from dj_car_life_goods_order dclgo
left join dj_car_life_goods_sub_order dclgso
on dclgo.order_code = dclgso.order_code and dclgso.deleted_flag = 'N'
left join dj_car_life_goods_order_customer dclgoc
on dclgoc.order_code = dclgo.order_code and dclgoc.deleted_flag = 'N'
left join dj_car_life_pay_order dclpo on dclpo.order_code = dclgo.order_code and dclpo.deleted_flag = 'N'
where dclgo.deleted_flag = 'N' and dclgo.scene_type= #{bussinessType}
and dclgo.status in (4, 6) and upgrade_flag = 'Y'
<if test="condition.orderTransactionAmount != null ">
and dclgo.total_price> #{condition.orderTransactionAmount}
</if>
) t4 on t4.customer_phone = t1.phone_number
</if>
AND EXISTS (
SELECT 1
FROM dj_smartcarlife.customer_order_temp cot
WHERE cot.phone = t1.phone_number
AND cot.scene_type = #{bussinessType}
AND cot.order_status IN (4, 6)
<if test="condition.orderTransactionAmount != null">
left join (select
distinct dclgoc.customer_phone
from dj_car_life_goods_order dclgo
left join dj_car_life_goods_sub_order dclgso
on dclgo.order_code = dclgso.order_code and dclgso.deleted_flag = 'N'
left join dj_car_life_goods_order_customer dclgoc
on dclgoc.order_code = dclgo.order_code and dclgoc.deleted_flag = 'N'
left join dj_car_life_pay_order dclpo on dclpo.order_code = dclgo.order_code and dclpo.deleted_flag = 'N'
where dclgo.deleted_flag = 'N' and dclgo.scene_type = #{bussinessType}
and dclgo.status in (4, 6) and upgrade_flag = 'Y'
<if test="condition.orderTransactionAmount != null ">
and dclgo.total_price> #{condition.orderTransactionAmount}
AND cot.order_transaction_amount > #{condition.orderTransactionAmount}
</if>
) t5 on t5.customer_phone = t1.phone_number
)
</if>
where 1=1
<if test="recMerchantNo != null and recMerchantNo.size>0">
and t1.merchant_id in
<foreach close=")" collection="recMerchantNo" item="item" open="(" separator=",">
......@@ -480,22 +459,6 @@
<if test="condition.enterpriseCustomerFlag != null and condition.enterpriseCustomerFlag ==1 ">
and t1.customer_name like concat('%','公司','%')
</if>
<if test="condition.orderAxbTransactionFlag != null and condition.orderAxbTransactionFlag==1 ">
and t3.customer_phone is not null
</if>
<if test="condition.orderAxbTransactionFlag!=null and condition.orderAxbTransactionFlag==0 ">
and t3.customer_phone is null
</if>
<if test="condition.orderTransactionFlag!=null and condition.orderTransactionFlag==1 ">
and t4.customer_phone is not null
</if>
<if test="condition.orderTransactionFlag!=null and condition.orderTransactionFlag==0 ">
and t4.customer_phone is null
</if>
<if test="condition.orderTransactionAmount!=null">
and t5.customer_phone is not null
</if>
and t2.badge_id is not null
</select>
......
......@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -24,16 +25,33 @@ public class ConversationBatchServiceTest extends BaseServiceTest {
public void conversationBatchPage() {
RpcPagination<ConversationBatchRequestDTO> req=new RpcPagination<>();
req.setPageSize(1);
req.setPageSize(200);
req.setPageSize(9987);
ConversationBatchRequestDTO conversationBatchRequestDTO=new ConversationBatchRequestDTO();
// conversationBatchRequestDTO.setConversationDateId(40);
req.setCondition(conversationBatchRequestDTO);
Page<ConversationBatchDTO> res = conversationBatchService
.conversationBatchPage(req);
System.out.println(JSONObject.toJSONString( res.stream().filter(index->index.isOrderFinishFlag()&& index.isFinishFlag()).collect(
Collectors.toList())));
}
@Test
public void findBatchByPhone() {
List<ConversationBatchDTO> res = conversationBatchService
.findBatchByPhone("13700000001");
System.out.println(res);
}
@Test
public void findExtBatchByIds() {
List<ConversationBatchDTO> res = conversationBatchService
.findExtBatchByIds(Arrays.asList(41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87));
System.out.println(JSONObject.toJSONString( res));
}
@Test
public void conversationDetailPage() {
Page<ConversationDetailDTO> res = conversationBatchService
.conversationDetailPage(RpcPagination.copyPage(ConversationDetailRequestDTO.builder()
......
......@@ -75,7 +75,6 @@ public class EmployeeBadgeServiceTest extends BaseServiceTest{
rpcPagination.setPageSize(10);
EmployeeBadgeDTO employeeBadgeDTO=new EmployeeBadgeDTO();
employeeBadgeDTO.setOrderTransactionAmount(new BigDecimal(10));
employeeBadgeDTO.setOrderAxbTransactionFlag(1);
employeeBadgeDTO.setOrderTransactionFlag(1);
employeeBadgeDTO.setBussinessType(1);
rpcPagination.setCondition(employeeBadgeDTO);
......@@ -106,6 +105,8 @@ public class EmployeeBadgeServiceTest extends BaseServiceTest{
EmployeeBadgeDTO employeeBadgeDTO=new EmployeeBadgeDTO();
employeeBadgeDTO.setBussinessType(2);
employeeBadgeDTO.setServiceMerchantNo(44209468);
employeeBadgeDTO.setSearchStartDate("2024-06-01");
employeeBadgeDTO.setSearchEndDate( "2024-06-30");
String s = employeeBadgeService.customerBaseListExport(employeeBadgeDTO);
log.info("返回结果{}", JSONObject.toJSONString(s));
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!