Commit 767db4b6 by 张富康

更新第一笔订单时间

1 parent f7cdb9e9
package cn.com.glsx.dj.peanalysis.dto;
import cn.com.glsx.dj.peanalysis.model.ServiceMerchant;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 服务商户
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceMerchantDTO extends ServiceMerchant {
private static final long serialVersionUID = 1L;
}
package cn.com.glsx.dj.peanalysis.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "dj_car_life_service_merchant")
public class ServiceMerchant implements Serializable{
/**
*
*/
private static final long serialVersionUID = -4263919007776607621L;
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 商户号
*/
@ApiModelProperty(name="merchantId", notes = "商户号", dataType = "int")
@Column(name = "merchant_id")
private Integer merchantId;
/**
* 商户名称
*/
@ApiModelProperty(name="merchantName", notes = "商户名称", dataType = "string")
@Column(name = "merchant_name")
private String merchantName;
/**
* 商户简称
*/
@ApiModelProperty(name="shortName", notes = "商户简称", dataType = "string")
@Column(name = "short_name")
private String shortName;
/**
* 商户类型
*/
@ApiModelProperty(name="userType", notes = "商户类型", dataType = "byte")
@Column(name = "user_type")
private Integer userType;
/**
* 商户账号类型
*/
@ApiModelProperty(name="merchantType", notes = "商户账号类型", dataType = "byte")
@Column(name = "merchant_type")
private Integer merchantType;
/**
* 登录账号
*/
@ApiModelProperty(name="accountName", notes = "登录账号", dataType = "string")
@Column(name = "account_name")
private String accountName;
/**
* 联系人
*/
@ApiModelProperty(name="contactName", notes = "联系人", dataType = "string")
@Column(name = "contact_name")
private String contactName;
/**
* 电话
*/
@ApiModelProperty(name="phone", notes = "电话", dataType = "string")
private String phone;
/**
* 详细地址
*/
@ApiModelProperty(name="address", notes = "详细地址", dataType = "string")
private String address;
/**
* 省份ID
*/
@ApiModelProperty(name="provinceId", notes = "省份ID", dataType = "int")
@Column(name = "province_id")
private Integer provinceId;
/**
* 省份名称
*/
@ApiModelProperty(name="provinceName", notes = "省份名称", dataType = "string")
@Column(name = "province_name")
private String provinceName;
/**
* 城市ID
*/
@ApiModelProperty(name="cityId", notes = "城市ID", dataType = "int")
@Column(name = "city_id")
private Integer cityId;
/**
* 城市名称
*/
@ApiModelProperty(name="cityName", notes = "城市名称", dataType = "string")
@Column(name = "city_name")
private String cityName;
/**
* 区县ID
*/
@ApiModelProperty(name="areaId", notes = "区县ID", dataType = "int")
@Column(name = "area_id")
private Integer areaId;
/**
* 区县名称
*/
@ApiModelProperty(name="areaName", notes = "区县名称", dataType = "string")
@Column(name = "area_name")
private String areaName;
/**
* 经度(高德坐标)
*/
@ApiModelProperty(name="lng", notes = "经度(高德坐标)", dataType = "double")
private Double lng;
/**
* 纬度(高德坐标)
*/
@ApiModelProperty(name="lat", notes = "纬度(高德坐标)", dataType = "double")
private Double lat;
/**
* 门店照片
*/
@ApiModelProperty(name="shopPhoto", notes = "门店照片", dataType = "string")
@Column(name = "shop_photo")
private String shopPhoto;
/**
* 渠道
*/
@ApiModelProperty(name="channelType", notes = "渠道 1-嘀加 2-广汇 8-直营", dataType = "byte")
@Column(name = "channel_type")
private Integer channelType;
/**
* 银盛虚账关联标志(Y:已关联,N:未关联)
*/
@ApiModelProperty(name="ysemRefedFlag", notes = "银盛虚账关联标志(Y:已关联,N:未关联)", dataType = "string")
@Column(name = "ysem_refed_flag")
private String ysemRefedFlag;
/**
* 虚拟账户状态(1未申请,2审核中,3已生效,4失败)
*/
@ApiModelProperty(name="accountStatus", notes = "虚拟账户状态(1未申请,2审核中,3已生效,4失败)", dataType = "int")
@Column(name = "account_status")
private Byte accountStatus;
/**
* 银盛虚账ID
*/
@Column(name = "yse_merchant_id")
private Integer yseMerchantId;
/**
* 银盛商户号
*/
@Column(name = "yse_user_code")
private String yseUserCode;
/**
* 区域
*/
@ApiModelProperty(name="region", notes = "区域", dataType = "string")
@Column(name = "region")
private String region;
/**
* 驻店联系人
*/
@ApiModelProperty(name="stayContactName", notes = "驻店联系人", dataType = "string")
@Column(name = "stay_contact_name")
private String stayContactName;
/**
* 驻店电话
*/
@ApiModelProperty(name="stayPhone", notes = "驻店电话", dataType = "string")
@Column(name = "stay_phone")
private String stayPhone;
/**
* 分账测试标识(Y:已测试,N:未测试)
*/
@ApiModelProperty(name="divisionTestFlag", notes = "分账测试标识(Y:已测试,N:未测试)", dataType = "string")
@Column(name = "division_test_flag")
private String divisionTestFlag;
/**
* 开通精品升级时间
*/
@Column(name = "open_date")
private Date openDate;
/**
* 入驻日期
*/
@Column(name = "entry_date")
private Date entryDate;
/**
* 来源(1:商户关联;2:4s店上级;3:园区店上级)
*/
@Column(name = "source_type")
private Byte sourceType;
/**
* 门店编码
*/
@Column(name = "store_code")
private String storeCode;
/**
* 业务性质(1:直营渠道,2:直营4S店,3:合资收购(已废弃),4:投资收购-利丰,5:投资收购-内蒙古,6:服务商投资,7:投资收购-龙南,8:投资收购-湖北正旺,9:系统实施-新疆东捷,10:系统实施-捷通达)
*/
@Column(name = "business_type")
private Byte businessType;
/**
* 最新订单时间
*/
@Column(name ="latest_order_time")
private Date latestOrderTime;
/**
* 第一笔支付时间
*/
@Column(name ="first_pay_time")
private Date firstPayTime;
/**
* 权益-第一笔支付时间
*/
@Column(name = "benefits_first_pay_time")
private Date benefitsFirstPayTime;
/**
* 延保-第一笔支付时间
*/
@Column(name = "ext_warranty_first_pay_time")
private Date extWarrantyFirstPayTime;
/**
* 轻改-第一笔支付时间
*/
@Column(name = "light_mod_first_pay_time")
private Date lightModFirstPayTime;
/**
* 二手车-第一笔支付时间
*/
@Column(name = "used_car_first_pay_time")
private Date usedCarFirstPayTime;
/**
* 最新支付时间
*/
@Column(name ="latest_pay_time")
private Date latestPayTime;
/**
* 默认的支付渠道ID
*/
@Column(name = "payment_channel_id")
private String paymentChannelId;
/**
* 质保卡二维码展示标志位,0-展示,1-不展示
*/
@ApiModelProperty(name="cardCodeFlag", notes = "质保卡二维码展示标志位(0:展示,1:不展示)", dataType = "int")
@Column(name = "card_code_flag")
private Integer cardCodeFlag;
/**
* 流量失效标识(Y:启用,N:禁用)
*/
@Column(name = "traffic_expire_flag")
@ApiModelProperty(notes = "流量失效标识(Y:启用,N:禁用)")
private String trafficExpireFlag;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_date")
private Date createdDate;
/**
* 修改人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 修改时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 删除标识(D:已删除;N:未删除)
*/
@Column(name = "deleted_flag")
private String deletedFlag;
}
\ No newline at end of file \ No newline at end of file
...@@ -35,4 +35,6 @@ public interface UsedCarDataStatsRemote { ...@@ -35,4 +35,6 @@ public interface UsedCarDataStatsRemote {
@ApiOperation("流量贡献排行榜") @ApiOperation("流量贡献排行榜")
RpcResponse<FlowContributionRankingRes> getFlowContributionRanking(FlowContributionRankingReq request); RpcResponse<FlowContributionRankingRes> getFlowContributionRanking(FlowContributionRankingReq request);
@ApiOperation("更新第一笔订单时间")
RpcResponse<Boolean> updateFirstOrderTime();
} }
...@@ -21,5 +21,24 @@ ...@@ -21,5 +21,24 @@
<groupId>org.oreframework.common</groupId> <groupId>org.oreframework.common</groupId>
<artifactId>ore-common-office</artifactId> <artifactId>ore-common-office</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.oreframework.boot</groupId>
<artifactId>ore-boot-starter-elasticjob</artifactId>
</dependency>
<dependency>
<groupId>org.oreframework.boot</groupId>
<artifactId>ore-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.38</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.peanalysis.job;
import cn.com.glsx.dj.peanalysis.service.UpdateMerchantService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import javax.annotation.Resource;
@Slf4j
@ElasticJobConf(name = "UpdateMerchantJob", cron = "0 30 1 * * ?", description = "更新不同业务第一笔订单时间", overwrite = false)
public class UpdateMerchantJob implements SimpleJob {
@Resource
private UpdateMerchantService updateMerchantService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("----------------更新不同业务第一笔订单时间-----------------");
try {
updateMerchantService.updateFirstOrderTime(shardingContext.getJobParameter());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
log.info("----------------更新不同业务第一笔订单时间-----------------");
}
}
package cn.com.glsx.dj.peanalysis.mapper;
import cn.com.glsx.dj.peanalysis.model.ServiceMerchant;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface ServiceMerchantMapper extends OreMapper<ServiceMerchant> {
void updateFirstPayTime(List<Integer> merchantIds);
}
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.peanalysis.remote; ...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.peanalysis.remote;
import cn.com.glsx.dj.peanalysis.dto.req.UserdCarDataStats.*; import cn.com.glsx.dj.peanalysis.dto.req.UserdCarDataStats.*;
import cn.com.glsx.dj.peanalysis.dto.res.UserdCarDataStats.*; import cn.com.glsx.dj.peanalysis.dto.res.UserdCarDataStats.*;
import cn.com.glsx.dj.peanalysis.service.UpdateMerchantService;
import cn.com.glsx.dj.peanalysis.service.UsedCarDataStatsService; import cn.com.glsx.dj.peanalysis.service.UsedCarDataStatsService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
...@@ -19,6 +20,8 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote{ ...@@ -19,6 +20,8 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote{
@Resource @Resource
private UsedCarDataStatsService usedCarDataStatsService; private UsedCarDataStatsService usedCarDataStatsService;
@Resource
private UpdateMerchantService updateMerchantService;
/** /**
* 经营情况-累计至今 * 经营情况-累计至今
...@@ -111,4 +114,18 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote{ ...@@ -111,4 +114,18 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote{
} }
} }
/**
* 更新第一笔订单时间
*/
@Override
public RpcResponse<Boolean> updateFirstOrderTime() {
try {
updateMerchantService.updateFirstOrderTime("");
return RpcResponse.success(true);
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
} }
package cn.com.glsx.dj.peanalysis.service; package cn.com.glsx.dj.peanalysis.service;
import cn.com.glsx.dj.peanalysis.dto.req.MerchantBiMatterSearchReq; import cn.com.glsx.dj.peanalysis.dto.req.MerchantBiMatterSearchReq;
import cn.com.glsx.dj.peanalysis.listener.ImportResultVO;
import cn.com.glsx.dj.peanalysis.listener.MerchantProfitRecordExcelDTO;
import cn.com.glsx.dj.peanalysis.listener.MerchantProfitRecordExportDTO;
import cn.com.glsx.dj.peanalysis.listener.MerchantProfitRecordImportListener;
import cn.com.glsx.dj.peanalysis.mapper.MerchantBiMatterMapper; import cn.com.glsx.dj.peanalysis.mapper.MerchantBiMatterMapper;
import cn.com.glsx.dj.peanalysis.mapper.MerchantProfitOpeLogMapper;
import cn.com.glsx.dj.peanalysis.mapper.MerchantProfitRecordMapper;
import cn.com.glsx.dj.peanalysis.model.MerchantBiMatter; import cn.com.glsx.dj.peanalysis.model.MerchantBiMatter;
import cn.com.glsx.dj.peanalysis.model.MerchantProfitOpeLog;
import cn.com.glsx.dj.peanalysis.model.MerchantProfitRecord;
import cn.com.glsx.dj.peanalysis.util.excel.EasyExcelUtil;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.io.ByteArrayInputStream; import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhouhb * @author zhouhb
...@@ -78,16 +57,16 @@ public class MerchantBiMatterService { ...@@ -78,16 +57,16 @@ public class MerchantBiMatterService {
*/ */
public void updateMerchantBiMatter(MerchantBiMatter merchantBiMatter) { public void updateMerchantBiMatter(MerchantBiMatter merchantBiMatter) {
Long id = merchantBiMatter.getId(); Long id = merchantBiMatter.getId();
if (id == null){ if (id == null) {
throw new RpcServiceException("id不能为空"); throw new RpcServiceException("id不能为空");
} }
MerchantBiMatter merchantBiMatternew = merchantBiMatterMapper.selectByPrimaryKey(id); MerchantBiMatter merchantBiMatternew = merchantBiMatterMapper.selectByPrimaryKey(id);
if (merchantBiMatternew == null){ if (merchantBiMatternew == null) {
throw new RpcServiceException("记录不存在"); throw new RpcServiceException("记录不存在");
} }
if (merchantBiMatternew.getStatus() != null && merchantBiMatternew.getStatus() == 2){ if (merchantBiMatternew.getStatus() != null && merchantBiMatternew.getStatus() == 2) {
throw new RpcServiceException("事项状态已处理,无法进行处理,请确认后重新操作"); throw new RpcServiceException("事项状态已处理,无法进行处理,请确认后重新操作");
} }
......
...@@ -14,21 +14,17 @@ import cn.com.glsx.framework.core.exception.RpcServiceException; ...@@ -14,21 +14,17 @@ import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhouhb * @author zhouhb
...@@ -105,7 +101,7 @@ public class MerchantProfitRecordService { ...@@ -105,7 +101,7 @@ public class MerchantProfitRecordService {
record.setCreatedAt(new Date()); record.setCreatedAt(new Date());
record.setDelFlag(0); record.setDelFlag(0);
profitRecordMapper.insert(record); profitRecordMapper.insert(record);
}else { } else {
record.setUpdatedAt(new Date()); record.setUpdatedAt(new Date());
profitRecordMapper.updateByPrimaryKeySelective(record); profitRecordMapper.updateByPrimaryKeySelective(record);
} }
...@@ -131,7 +127,7 @@ public class MerchantProfitRecordService { ...@@ -131,7 +127,7 @@ public class MerchantProfitRecordService {
// ==================== 导入逻辑 ==================== // ==================== 导入逻辑 ====================
@Transactional @Transactional
public ImportResultVO importFromExcel(byte[] content, String operator) { public ImportResultVO importFromExcel(byte[] content, String operator) {
MerchantProfitRecordImportListener listener = new MerchantProfitRecordImportListener( this, operator); MerchantProfitRecordImportListener listener = new MerchantProfitRecordImportListener(this, operator);
// 使用 ByteArrayInputStream 包装 byte[] // 使用 ByteArrayInputStream 包装 byte[]
EasyExcel.read(new ByteArrayInputStream(content), MerchantProfitRecordExcelDTO.class, listener) EasyExcel.read(new ByteArrayInputStream(content), MerchantProfitRecordExcelDTO.class, listener)
...@@ -192,7 +188,7 @@ public class MerchantProfitRecordService { ...@@ -192,7 +188,7 @@ public class MerchantProfitRecordService {
public String exportRecords(MerchantProfitRecord condition) { public String exportRecords(MerchantProfitRecord condition) {
List<MerchantProfitRecordExportDTO> exportList = new ArrayList<>(); List<MerchantProfitRecordExportDTO> exportList = new ArrayList<>();
List<MerchantProfitRecord> records = profitRecordMapper.selectProfitRecordList(condition); List<MerchantProfitRecord> records = profitRecordMapper.selectProfitRecordList(condition);
if (CollectionUtils.isNotEmpty( records)){ if (CollectionUtils.isNotEmpty(records)) {
exportList = records.stream().map(record -> { exportList = records.stream().map(record -> {
MerchantProfitRecordExportDTO exportDTO = new MerchantProfitRecordExportDTO(); MerchantProfitRecordExportDTO exportDTO = new MerchantProfitRecordExportDTO();
exportDTO.setBusinessType(record.getBusinessType()); exportDTO.setBusinessType(record.getBusinessType());
...@@ -231,7 +227,7 @@ public class MerchantProfitRecordService { ...@@ -231,7 +227,7 @@ public class MerchantProfitRecordService {
} }
public void batchSaveProfitRecords(List<MerchantProfitRecord> successList, String operator) { public void batchSaveProfitRecords(List<MerchantProfitRecord> successList, String operator) {
for (MerchantProfitRecord r : successList){ for (MerchantProfitRecord r : successList) {
this.saveOrUpdateRecord(r, operator); this.saveOrUpdateRecord(r, operator);
} }
} }
......
...@@ -9,13 +9,14 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -9,13 +9,14 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/** /**
* @author zhouhb * @author zhouhb
* @version V1.0 * @version V1.0
...@@ -38,19 +39,19 @@ public class ProvinceRganizationService { ...@@ -38,19 +39,19 @@ public class ProvinceRganizationService {
@Transactional @Transactional
private void update(ProvinceUpdateReq provinceUpdateReq) { private void update(ProvinceUpdateReq provinceUpdateReq) {
Integer provinceId = provinceUpdateReq.getProvinceId(); Integer provinceId = provinceUpdateReq.getProvinceId();
if (provinceId == null){ if (provinceId == null) {
throw new RpcServiceException("省id不能为空"); throw new RpcServiceException("省id不能为空");
} }
List<ProvinceRganization> provinceRganizationnew = provinceRganizationMapper.selectListByProvinceId(provinceId); List<ProvinceRganization> provinceRganizationnew = provinceRganizationMapper.selectListByProvinceId(provinceId);
if (CollectionUtils.isNotEmpty(provinceRganizationnew)){ if (CollectionUtils.isNotEmpty(provinceRganizationnew)) {
throw new RpcServiceException("记录不存在"); throw new RpcServiceException("记录不存在");
} }
provinceRganizationMapper.updateDelByProvinceId(provinceId,provinceUpdateReq.getUpdatedBy()); provinceRganizationMapper.updateDelByProvinceId(provinceId, provinceUpdateReq.getUpdatedBy());
List<ProvinceRganization> provinceRganizationList = provinceUpdateReq.getProvinceRganizationList(); List<ProvinceRganization> provinceRganizationList = provinceUpdateReq.getProvinceRganizationList();
if (CollectionUtils.isEmpty(provinceRganizationList)){ if (CollectionUtils.isEmpty(provinceRganizationList)) {
throw new RpcServiceException("记录不能为空"); throw new RpcServiceException("记录不能为空");
} }
......
package cn.com.glsx.dj.peanalysis.service;
import cn.com.glsx.dj.peanalysis.mapper.ServiceMerchantMapper;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class UpdateMerchantService {
@Resource
private ServiceMerchantMapper serviceMerchantMapper;
public void updateFirstOrderTime(String MerchantIdStr) {
log.info("更新商户第一笔订单时间开始");
log.info("商户ids:{}", MerchantIdStr);
if (StrUtil.isNotBlank(MerchantIdStr)) {
List<Integer> idList = Arrays.stream(MerchantIdStr.split(",")).map(Integer::valueOf).collect(Collectors.toList());
serviceMerchantMapper.updateFirstPayTime(idList);
} else {
serviceMerchantMapper.updateFirstPayTime(null);
}
log.info("更新商户第一笔订单时间结束");
}
}
...@@ -65,4 +65,9 @@ public class UsedCarDataStatsService { ...@@ -65,4 +65,9 @@ public class UsedCarDataStatsService {
return null; return null;
} }
/**
* 更新第一笔订单时间
*/
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.dj.peanalysis.mapper.ServiceMerchantMapper">
<!-- ========== BaseResultMap ========== -->
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.peanalysis.model.ServiceMerchant">
<!-- WARNING - @mbg.generated -->
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR"/>
<result column="short_name" property="shortName" jdbcType="VARCHAR"/>
<result column="user_type" property="userType" jdbcType="INTEGER"/>
<result column="merchant_type" property="merchantType" jdbcType="VARCHAR"/>
<result column="account_name" property="accountName" jdbcType="VARCHAR"/>
<result column="contact_name" property="contactName" jdbcType="VARCHAR"/>
<result column="phone" property="phone" jdbcType="VARCHAR"/>
<result column="address" property="address" jdbcType="VARCHAR"/>
<result column="province_id" property="provinceId" jdbcType="INTEGER"/>
<result column="province_name" property="provinceName" jdbcType="VARCHAR"/>
<result column="city_id" property="cityId" jdbcType="INTEGER"/>
<result column="city_name" property="cityName" jdbcType="VARCHAR"/>
<result column="area_id" property="areaId" jdbcType="INTEGER"/>
<result column="area_name" property="areaName" jdbcType="VARCHAR"/>
<result column="lng" property="lng" jdbcType="DOUBLE"/>
<result column="lat" property="lat" jdbcType="DOUBLE"/>
<result column="shop_photo" property="shopPhoto" jdbcType="VARCHAR"/>
<result column="channel_type" property="channelType" jdbcType="INTEGER"/>
<result column="account_status" property="accountStatus" jdbcType="INTEGER"/>
<result column="yse_merchant_id" property="yseMerchantId" jdbcType="INTEGER"/>
<result column="yse_user_code" property="yseUserCode" jdbcType="VARCHAR"/>
<result column="region" property="region" jdbcType="VARCHAR"/>
<result column="stay_contact_name" property="stayContactName" jdbcType="VARCHAR"/>
<result column="stay_phone" property="stayPhone" jdbcType="VARCHAR"/>
<result column="division_test_flag" property="divisionTestFlag" jdbcType="VARCHAR"/>
<result column="open_date" property="openDate" jdbcType="TIMESTAMP"/>
<result column="entry_date" property="entryDate" jdbcType="TIMESTAMP"/>
<result column="source_type" property="sourceType" jdbcType="INTEGER"/>
<result column="store_code" property="storeCode" jdbcType="VARCHAR"/>
<result column="card_code_flag" property="cardCodeFlag" jdbcType="INTEGER"/>
<result column="business_type" property="businessType" jdbcType="INTEGER"/>
<result column="latest_order_time" property="latestOrderTime" jdbcType="TIMESTAMP"/>
<result column="payment_channel_id" property="paymentChannelId" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="VARCHAR"/>
<result column="ysem_refed_flag" property="ysemRefedFlag" jdbcType="VARCHAR"/>
<result column="traffic_expire_flag" property="trafficExpireFlag" jdbcType="VARCHAR"/>
</resultMap>
<!-- ========== DTO ResultMap (继承 BaseResultMap) ========== -->
<resultMap id="DTOResult" extends="BaseResultMap" type="cn.com.glsx.dj.peanalysis.dto.ServiceMerchantDTO">
<!-- 可在此扩展 DTO 特有字段 -->
</resultMap>
<!-- ========== Base_Column_List ========== -->
<sql id="Base_Column_List">
<!-- WARNING - @mbg.generated -->
id,
merchant_id,
merchant_name,
short_name,
user_type,
merchant_type,
account_name,
contact_name,
phone,
address,
province_id,
province_name,
city_id,
city_name,
area_id,
area_name,
lng,
lat,
shop_photo,
channel_type,
account_status,
yse_merchant_id,
yse_user_code,
region,
stay_contact_name,
stay_phone,
division_test_flag,
open_date,
entry_date,
source_type,
store_code,
card_code_flag,
business_type,
latest_order_time,
payment_channel_id,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag,
ysem_refed_flag,
traffic_expire_flag
</sql>
<update id="updateFirstPayTime">
UPDATE dj_car_life_service_merchant m
LEFT JOIN (SELECT g.merchant_id,
MIN(CASE WHEN g.scene_type = 0 AND g.business_type = 1 THEN p.success_date END) AS benefits,
MIN(CASE WHEN g.scene_type = 0 AND g.business_type = 2 THEN p.success_date END) AS ext_warranty,
MIN(CASE WHEN g.scene_type = 1 THEN p.success_date END) AS light_mod
FROM dj_car_life_goods_order g
JOIN dj_car_life_pay_order p ON g.order_code = p.order_code
WHERE g.deleted_flag = 'N'
AND p.deleted_flag = 'N'
AND p.success_date IS NOT NULL
GROUP BY g.merchant_id) AS pay_data ON m.merchant_id = pay_data.merchant_id
LEFT JOIN (SELECT source_store AS merchant_id,
MIN(purchase_time) AS used_car
FROM vcp_car_manage_info
WHERE deleted_flag = 'N'
AND purchase_time IS NOT NULL
GROUP BY source_store) AS car_data ON m.merchant_id = car_data.merchant_id
SET m.benefits_first_pay_time = pay_data.benefits,
m.ext_warranty_first_pay_time = pay_data.ext_warranty,
m.light_mod_first_pay_time = pay_data.light_mod,
m.used_car_first_pay_time = car_data.used_car
where merchant_type = 2
<if test="merchantIds != null and merchantIds.size() > 0">
and merchant_id in
<foreach item="item" collection="merchantIds" separator="," index="index" open="("
close=")">
#{item}
</foreach>
</if>
and deleted_flag = 'N';
</update>
</mapper>
\ 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!