Commit 2b7cd9bc by 崔彦峰

add:提交web端有效引荐数列表、有效引荐数审核列表、有效引荐详情。

1 parent 068ac994
......@@ -25,5 +25,6 @@ public class EffectiveReferralCountDTO implements Serializable {
private Integer deliveryCount;
@ApiModelProperty(value = "有效引荐数")
@NotNull(message = "有效引荐数不能为空")
private Integer effectiveReferralCount;
}
package cn.com.glsx.dj.staff.dto.perfSalary;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
......@@ -35,4 +38,17 @@ public class EffectiveReferralReviewCommonDTO extends EffectiveReferralReview {
@ApiModelProperty(value = "商户号集合,无须前端传")
private List<Integer> merchantIds;
@ApiModelProperty(value = "区域经理-提交开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date managerCommitStartTime;
@ApiModelProperty(value = "区域经理-提交结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date managerCommitEndTime;
@ApiModelProperty(value = "主键ids,无须前端传")
private List<Integer> ids;
}
\ No newline at end of file
package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.merchant.CarBrandDTO;
import cn.com.glsx.dj.smartcarlife.response.ServiceStaffRopResponse;
import cn.com.glsx.dj.staff.dto.perfSalary.*;
......@@ -182,20 +181,36 @@ public class EffectiveReferralReviewMiniProgramService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean effectiveReferralStoreSubmit(StoreEffectiveReferralSubmitDTO dto) {
//根据id更新引荐数、上传凭证、备注、状态
//1、根据id查询引荐数
EffectiveReferralReviewCommonDTO commonDTO = new EffectiveReferralReviewCommonDTO();
List<Integer> ids = dto.getEffectiveReferralCountDTOS().stream().map(EffectiveReferralCountDTO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ids)) {
throw new RpcServiceException("主键id不能为空");
}
commonDTO.setIds(ids);
List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(commonDTO);
//将referralReviewCommonDTOS转化为key-value,key为id,value为EffectiveReferralReviewCommonDTO
Map<Integer, EffectiveReferralReviewCommonDTO> referralReviewCommonDTOSMap =
referralReviewCommonDTOS.stream().collect(Collectors.toMap(EffectiveReferralReviewCommonDTO::getId, item -> item));
//2、根据id更新引荐数、上传凭证、备注、状态
dto.getEffectiveReferralCountDTOS().forEach(
item -> {
EffectiveReferralReview review = new EffectiveReferralReview();
review.setId(item.getId());
if (item.getEffectiveReferralCount() != null) {
review.setAreaEffectiveCount(item.getEffectiveReferralCount());
}
if (StringUtils.isNotBlank(dto.getImageUrls())) {
review.setImageUrls(dto.getImageUrls());
}
if (StringUtils.isNotBlank(dto.getRemark())) {
review.setRemark(dto.getRemark());
}
if (referralReviewCommonDTOSMap.containsKey(item.getId()) &&
!item.getEffectiveReferralCount().equals(referralReviewCommonDTOSMap.get(item.getId()).getTotalDeliveryCount())) {
review.setIsNeedReviewed(1);
review.setIsReviewed(0);
}
review.setStatus(dto.getStatus());
review.setUpdatedBy(dto.getUpdatedBy());
review.setUpdatedDate(new Date());
......
......@@ -2,18 +2,27 @@ package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import cn.com.glsx.dj.staff.service.staffPerformance.PerformanceTimeCycleService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
......@@ -23,26 +32,67 @@ public class EffectiveReferralReviewService {
@Resource
private EffectiveReferralReviewMapper effectiveReferralReviewMapper;
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
List<EffectiveReferralReviewCommonDTO> list = null;
Page<EffectiveReferralReviewCommonDTO> page = (Page<EffectiveReferralReviewCommonDTO>) list;
@Resource
private PerformanceTimeCycleService performanceTimeCycleService;
/**
* 查询门店有效数列表
*
* @param pagination 列表参数
* @return 门店列表
*/
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
Page<EffectiveReferralReviewCommonDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
effectiveReferralReviewMapper.selectStoreEffectiveReferralList(pagination.getCondition());
pagination = RpcPagination.copyPage(page);
return pagination;
}
/**
* 查询门店有效数审核列表
*
* @param pagination 查询参数
* @return 门店列表
*/
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralAuditPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
List<EffectiveReferralReviewCommonDTO> list = null;
Page<EffectiveReferralReviewCommonDTO> page = (Page<EffectiveReferralReviewCommonDTO>) list;
//1、查询需要复核的有效引荐数列表
Page<EffectiveReferralReviewCommonDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(pagination.getCondition());
//2、查询T1时间配置
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
//3、填充复核状态,待复核状态下的数据,如果当前时间大于T1时间配置内的结束时间,置为已失效
for (EffectiveReferralReviewCommonDTO item : list) {
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& item.getIsReviewed().equals(0)) {
if (new Date().after(performanceTimeCycleDTO.getEndDate())) {
item.setIsReviewed(2);
}
}
}
//4、返回结果
pagination = RpcPagination.copyPage(page);
return pagination;
}
/**
* 查询有效引荐数详情
*
* @param id 主键
* @return 详情
*/
public EffectiveReferralReviewCommonDTO effectiveReferralDetail(Integer id) {
return (EffectiveReferralReviewCommonDTO) effectiveReferralReviewMapper.selectByPrimaryKey(id);
EffectiveReferralReviewCommonDTO commonDTO = new EffectiveReferralReviewCommonDTO();
commonDTO.setIds(Lists.newArrayList(id));
List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(commonDTO);
if (referralReviewCommonDTOS.isEmpty()) {
return null;
}
return referralReviewCommonDTOS.get(0);
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
......
......@@ -93,8 +93,6 @@
<if test="createdDate != null and createdDate != ''">
AND DATE_FORMAT(serr.created_date, '%Y-%m') = #{createdDate}
</if>
GROUP BY
serr.merchant_id
<if test="submitStatus != null">
HAVING
CASE
......@@ -107,6 +105,8 @@
ELSE 1
END = #{submitStatus}
</if>
GROUP BY
serr.merchant_id
ORDER BY
CONVERT(MIN(dclsm.merchant_name) USING gbk) DESC
</select>
......@@ -119,12 +119,45 @@
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N'
<if test="merchantId != null and merchantId != ''">
<if test="merchantId != null'">
AND serr.merchant_id = #{merchantId}
</if>
<if test="merchantName != null and merchantName != ''">
AND dclsm.merchant_name LIKE CONCAT('%', #{merchantName}, '%')
</if>
<if test="sceneType != null ">
AND serr.scene_type = #{sceneType}
</if>
<if test="managerName != null and managerName != '' ">
AND serr.manager_name LIKE CONCAT('%', #{managerName}, '%')
</if>
<if test="isNeedReviewed != null and isNeedReviewed != '' ">
AND serr.is_need_reviewed = #{isNeedReviewed}
</if>
<if test="isReviewed != null ">
AND serr.is_reviewed = #{isReviewed}
</if>
<if test="brandName != null and brandName != '' ">
AND serr.brand_name = #{brandName}
</if>
<if test="managerCommitStartTime != null">
AND serr.manager_commit_time &gt;= #{managerCommitStartTime}
</if>
<if test="managerCommitEndTime != null ">
AND serr.manager_commit_time &lt;= #{managerCommitEndTime}
</if>
<if test="merchantIdList != null and merchantIdList.size() > 0">
AND serr.merchant_id IN
<foreach collection="merchantIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="ids != null and ids.size() > 0">
AND serr.id IN
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!