提交 ff6eecc6 authored 作者: 吕本才's avatar 吕本才

修改接口问题,增加查询,脱敏限制,接口优化

上级 23e2e604
......@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenDynamicRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import com.ruoyi.dealer.domain.dto.DealerRoundDetailListRes;
import com.ruoyi.dealer.service.DealerRoundInfoService;
import com.ruoyi.dealer.service.IDealerBaseInfoService;
import com.ruoyi.dealer.service.IDealerRoundResultService;
......@@ -72,9 +73,9 @@ public class DealerBigScreenController extends BaseController {
*
*/
@GetMapping("/result/round/{roundTime}")
public AjaxResult groupRoundList(@PathVariable("roundTime") Integer roundTime) {
public AjaxResult groupRoundList(@PathVariable("roundTime") Integer roundTime, String phone, String dealerName) {
List<DealerBigScreenGroupListRes> list = resultService.groupRoundList(roundTime);
List<DealerRoundDetailListRes> list = resultService.groupRoundList(roundTime,phone,dealerName);
return success(list);
}
......
......@@ -28,7 +28,7 @@ public class DealerRoundController extends BaseController {
private IDealerRoundResultService resultService;
@Log(title = "结束第一轮次或者第二轮次", businessType = BusinessType.INSERT)
@GetMapping(value = "/turnRound")
@PostMapping(value = "/turnRound")
public AjaxResult turnRoundInfo(@RequestBody TurnRoundInfoReq turnRoundInfoReq) {
List<SysConfig> sysConfigs = dealerRoundInfoService.turnRoundInfo(turnRoundInfoReq);
return AjaxResult.success(sysConfigs);
......@@ -38,7 +38,7 @@ public class DealerRoundController extends BaseController {
* 修改经销商信息
*/
@Log(title = "初始化第二轮数据", businessType = BusinessType.UPDATE)
@GetMapping("/init")
@PostMapping("/init")
public AjaxResult initRoundInfo() {
return toAjax(resultService.initRoundInfo());
}
......
package com.ruoyi.common.config.serializer;
import java.io.IOException;
import java.util.Objects;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
......@@ -9,9 +7,10 @@ import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.DesensitizedType;
import com.ruoyi.common.utils.SecurityUtils;
import java.io.IOException;
import java.util.Objects;
/**
* 数据脱敏序列化过滤
......@@ -53,15 +52,17 @@ public class SensitiveJsonSerializer extends JsonSerializer<String> implements C
*/
private boolean desensitization()
{
try
{
LoginUser securityUser = SecurityUtils.getLoginUser();
// 管理员不脱敏
return !securityUser.getUser().isAdmin();
}
catch (Exception e)
{
return true;
}
// try
// {
// LoginUser securityUser = SecurityUtils.getLoginUser();
// // 读取数据库配置信息
// // 管理员不脱敏
// return !securityUser.getUser().isAdmin();
// }
// catch (Exception e)
// {
// return true;
// }
return true;
}
}
......@@ -24,10 +24,9 @@ public interface DealerRoundResultMapper extends BaseMapper<DealerRoundResult> {
@Select("select * from dealer_round_result where dealer_category = #{categoryName} and round_time = 1 " +
"order by payment_percentage desc limit 4")
List<DealerBigScreenGroupResultRes> getGroupList(String categoryName);
@Select("select result.round_time, base.sales_region_group_name as group_Name , sum(result.payment_ttl) as payment_ttl,sum(result.goal_ttl_act) as goal_ttl_act , 100*sum(result.payment_ttl) / sum(result.goal_ttl_act) as payment_percentage from dealer_round_result result " +
"left join dealer_base_info base on result.dealer_id = base.dealer_id " +
"where round_time = 2 " +
"group by round_time ,base.sales_region_group_name order by payment_percentage desc ")
@Select("select result.round_time, result.sales_region_group_name as group_Name , sum(result.payment_ttl) as payment_ttl,sum(result.goal_ttl_act) as goal_ttl_act , 100*sum(result.payment_ttl)/sum(result.goal_ttl_act) as payment_percentage from dealer_round_result result " +
"where round_time = 2 " +
"group by round_time ,result.sales_region_group_name order by payment_percentage desc ")
// 手动指定映射:column(数据库字段)→ property(Java属性)
@Results({
@Result(column = "round_time", property = "roundTime"),
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import com.ruoyi.dealer.domain.dto.DealerRoundDetailListRes;
import java.util.List;
......@@ -16,7 +17,8 @@ public interface IDealerRoundResultService extends IService<DealerRoundResult> {
List<DealerBigScreenGroupResultRes> groupTotalList();
List<DealerBigScreenGroupListRes> groupRoundList(Integer roundTime);
List<DealerRoundDetailListRes> groupRoundList(Integer roundTime, String phone, String dealerName);
int initRoundInfo();
// 自定义业务方法声明(可选)
......
......@@ -92,6 +92,7 @@ public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, Dealer
result = resultService.getOne(new LambdaQueryWrapper<DealerRoundResult>()
.eq(DealerRoundResult::getRoundTime, 1)
.eq(DealerRoundResult::getDealerId, dealerId));
roundInfoRes.setPaymentTtl(result.getPaymentTtl());
roundInfoRes.setPaymentPercentage(Math.round(result.getPaymentTtl() * 100.0 / dealerBaseInfo.getGoalTtlAct()) + "%");
}
......
// 文件路径:ruoyi-system/src/main/java/com/ruoyi/dealer/service/impl/DealerRoundResultServiceImpl.java
package com.ruoyi.dealer.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultDto;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import com.ruoyi.dealer.domain.dto.DealerRoundDetailListRes;
import com.ruoyi.dealer.mapper.DealerRoundResultMapper;
import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.service.IDealerRoundResultService;
import org.springframework.stereotype.Service;
......@@ -65,12 +67,15 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM
}
@Override
public List<DealerBigScreenGroupListRes> groupRoundList(Integer roundTime) {
public List<DealerRoundDetailListRes> groupRoundList(Integer roundTime ,String phone,String dealerName) {
List<DealerRoundResult> dealerBigScreenGroupResultRes = this.list(new LambdaQueryWrapper<DealerRoundResult>()
.eq(DealerRoundResult::getRoundTime, roundTime));
List<DealerBigScreenGroupListRes> list = new ArrayList<>();
.eq(DealerRoundResult::getRoundTime, roundTime)
.like(ObjectUtil.isNotEmpty(phone), DealerRoundResult::getPhone, phone)
.like(ObjectUtil.isNotEmpty(dealerName), DealerRoundResult::getDealerName, dealerName)
.orderByDesc(DealerRoundResult::getSalesRegionGroupName, DealerRoundResult::getPaymentPercentage));
List<DealerRoundDetailListRes> list = new ArrayList<>();
dealerBigScreenGroupResultRes.forEach(item -> {
DealerBigScreenGroupListRes res = new DealerBigScreenGroupListRes();
DealerRoundDetailListRes res = new DealerRoundDetailListRes();
res.setRoundTime(item.getRoundTime());
res.setGroupName(item.getGroupName());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论