Commit 2a595445 by 张富康

Merge remote-tracking branch 'origin/v5.6.0' into v5.6.0

2 parents 7da63605 451cec9c
package cn.com.glsx.dj.staff.dto.perfSalary;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
public class StoreEffectiveReferralDetailReqDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "门店id", required = true)
@NotNull(message = "门店id不能为空")
private Integer merchantId;
@ApiModelProperty(notes = "复核时间-月份")
@NotNull(message = "复核时间-月份不能为空")
private String reviewMonth;
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.dj.staff.remote.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralDetailDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralDetailReqDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralSubmitDTO;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
......@@ -23,7 +24,7 @@ public interface EffectiveReferralReviewMiniProgramRemote {
@ApiMethod("门店有效引荐数详情")
@ApiParam(name = "id", notes = "门店有效引荐记录id", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiResponse("门店有效引荐数详情")
RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(Integer id);
RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(StoreEffectiveReferralDetailReqDTO request);
@ApiMethod("门店有效引荐数提交")
@ApiParam(name = "dto", notes = "提交信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
......
package cn.com.glsx.dj.staff.remote.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.perfSalary.StoreEffectiveReferralDetailDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralSubmitDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.*;
import cn.com.glsx.dj.staff.service.perfSalary.EffectiveReferralReviewMiniProgramService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
......@@ -32,9 +29,9 @@ public class EffectiveReferralReviewMiniProgramRemoteImpl implements EffectiveRe
}
@Override
public RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(Integer merchantId) {
public RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(StoreEffectiveReferralDetailReqDTO request) {
try{
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreDetail(merchantId));
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreDetail(request));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
......
......@@ -32,6 +32,8 @@ import org.springframework.util.LinkedMultiValueMap;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.time.YearMonth;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
......@@ -98,17 +100,18 @@ public class EffectiveReferralReviewMiniProgramService {
});
}
public StoreEffectiveReferralDetailDTO effectiveReferralStoreDetail(Integer merchantId) {
public StoreEffectiveReferralDetailDTO effectiveReferralStoreDetail(StoreEffectiveReferralDetailReqDTO request) {
//1、根据门店id获取门店所有数据
EffectiveReferralReviewCommonDTO commonDTO = new EffectiveReferralReviewCommonDTO();
commonDTO.setMerchantId(merchantId);
commonDTO.setMerchantId(request.getMerchantId());
commonDTO.setReviewMonth(request.getReviewMonth());
List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(commonDTO);
if (CollectionUtils.isEmpty(referralReviewCommonDTOS)) {
return new StoreEffectiveReferralDetailDTO();
}
//2、查询其它品牌名称
String otherBrandName = getOtherBrandName(merchantId, referralReviewCommonDTOS);
String otherBrandName = getOtherBrandName(request.getMerchantId(), referralReviewCommonDTOS);
//3、封装各业务场景引荐数
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = getSceneTypeEffectiveReferralDTOS(referralReviewCommonDTOS, otherBrandName);
......@@ -116,12 +119,16 @@ public class EffectiveReferralReviewMiniProgramService {
//4、获取是否可编辑标识
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
//5、封装返回参数
//5、当前时间年月是否比核查时间晚并超过1个月, 则不可编辑
long monthDiff = getMonthDiff(referralReviewCommonDTOS.get(0).getReviewMonth());
//6、封装返回参数
StoreEffectiveReferralDetailDTO detailDTO = new StoreEffectiveReferralDetailDTO();
if (Objects.nonNull(performanceTimeCycleDTO)
if ((Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& new Date().after(performanceTimeCycleDTO.getEndDate())) {
&& new Date().after(performanceTimeCycleDTO.getEndDate()))
|| monthDiff > 1) {
detailDTO.setUpdateFlag(0);
}
else {
......@@ -133,6 +140,40 @@ public class EffectiveReferralReviewMiniProgramService {
}
/**
* 获取月份差 当前时间年月 - 核查年月
* @param reviewMonth
* @return
*/
private long getMonthDiff(String reviewMonth) {
YearMonth targetMonth = YearMonth.parse(reviewMonth);
YearMonth currentMonth = YearMonth.now();
//计算月份差(当前 - 目标)
// 转换为LocalDate进行比较
return ChronoUnit.MONTHS.between(
targetMonth.atDay(1), // 转换为LocalDate进行比较
currentMonth.atDay(1)
);
}
public static void main(String[] args) {
String reviewMonth = "2025-12";
// 解析字符串为 YearMonth
YearMonth targetMonth = YearMonth.parse(reviewMonth);
// 获取当前时间的年月
YearMonth currentMonth = YearMonth.now();
//计算月份差(当前 - 目标)
long monthDiff = ChronoUnit.MONTHS.between(
targetMonth.atDay(1), // 转换为LocalDate进行比较
currentMonth.atDay(1)
);
System.out.println(monthDiff > 1);
System.out.println(currentMonth.isBefore(targetMonth));
System.out.println(currentMonth.isAfter(targetMonth));
}
/**
* 获取门店其它品牌名称
*
* @param merchantId
......
......@@ -165,6 +165,9 @@
<if test="id != null ">
AND serr.id = #{id}
</if>
<if test="reviewMonth != null and reviewMonth != ''">
AND serr.review_month = #{reviewMonth}
</if>
ORDER BY serr.id DESC, serr.manager_commit_time DESC
</select>
......
......@@ -129,6 +129,12 @@
AND dsmr.sub_merchant_type IN (6, 8)
AND dsmr.main_merchant_type = 2
AND dsmr.sub_merchant_id = dsi.merchant_id
<if test="merchantIds != null and merchantIds.size()>0">
AND dsmr.main_merchant_id IN
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
)
AND EXISTS (
SELECT 1
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!