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

增加第二列结果查询 接口

上级 5a25c92c
...@@ -25,8 +25,6 @@ import com.ruoyi.common.core.page.TableDataInfo; ...@@ -25,8 +25,6 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import javax.validation.Valid;
/** /**
* 经销商信息Controller * 经销商信息Controller
* *
...@@ -34,8 +32,7 @@ import javax.validation.Valid; ...@@ -34,8 +32,7 @@ import javax.validation.Valid;
*/ */
@RestController @RestController
@RequestMapping("/dealer/baseInfo") @RequestMapping("/dealer/baseInfo")
public class DealerBaseInfoController extends BaseController public class DealerBaseInfoController extends BaseController {
{
@Autowired @Autowired
private IDealerBaseInfoService dealerBaseInfoService; private IDealerBaseInfoService dealerBaseInfoService;
@Autowired @Autowired
...@@ -46,8 +43,7 @@ public class DealerBaseInfoController extends BaseController ...@@ -46,8 +43,7 @@ public class DealerBaseInfoController extends BaseController
*/ */
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:list')") // @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(DealerBaseInfo dealerBaseInfo) public TableDataInfo list(DealerBaseInfo dealerBaseInfo) {
{
startPage(); startPage();
List<DealerBaseInfo> list = dealerBaseInfoService.queryList(dealerBaseInfo); List<DealerBaseInfo> list = dealerBaseInfoService.queryList(dealerBaseInfo);
return getDataTable(list); return getDataTable(list);
...@@ -59,22 +55,19 @@ public class DealerBaseInfoController extends BaseController ...@@ -59,22 +55,19 @@ public class DealerBaseInfoController extends BaseController
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:export')") // @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:export')")
@Log(title = "经销商信息", businessType = BusinessType.EXPORT) @Log(title = "经销商信息", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(DealerBaseInfo dealerBaseInfo) public AjaxResult export(DealerBaseInfo dealerBaseInfo) {
{
List<DealerBaseInfo> list = dealerBaseInfoService.queryList(dealerBaseInfo); List<DealerBaseInfo> list = dealerBaseInfoService.queryList(dealerBaseInfo);
ExcelUtil<DealerBaseInfo> util = new ExcelUtil<DealerBaseInfo>(DealerBaseInfo.class); ExcelUtil<DealerBaseInfo> util = new ExcelUtil<DealerBaseInfo>(DealerBaseInfo.class);
return util.exportExcel(list, "dealerBaseInfo"); return util.exportExcel(list, "dealerBaseInfo");
} }
/** /**
* 获取经销商信息详细信息 * 获取经销商当前轮次的详细信息
*/ */
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:query')")
@GetMapping(value = "/round") @GetMapping(value = "/round")
public AjaxResult getRoundInfo() public AjaxResult getRoundInfo() {
{ Long dealerId = SecurityUtils.getUserId();
Long userId = SecurityUtils.getUserId(); return AjaxResult.success(dealerBaseInfoService.getDealerRoundInfoByDealerId(dealerId));
return AjaxResult.success(dealerBaseInfoService.getInfoById(userId));
} }
/** /**
...@@ -83,8 +76,7 @@ public class DealerBaseInfoController extends BaseController ...@@ -83,8 +76,7 @@ public class DealerBaseInfoController extends BaseController
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:add')") // @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:add')")
@Log(title = "经销商填写预付款信息", businessType = BusinessType.INSERT) @Log(title = "经销商填写预付款信息", businessType = BusinessType.INSERT)
@PostMapping(value = "/round") @PostMapping(value = "/round")
public AjaxResult addRoundInfo(@Validated @RequestBody WechatDealerRoundInfoReq dealerRoundInfoReq) public AjaxResult addRoundInfo(@Validated @RequestBody WechatDealerRoundInfoReq dealerRoundInfoReq) {
{
return toAjax(dealerRoundInfoService.saveRoundInfo(dealerRoundInfoReq)); return toAjax(dealerRoundInfoService.saveRoundInfo(dealerRoundInfoReq));
} }
...@@ -94,8 +86,7 @@ public class DealerBaseInfoController extends BaseController ...@@ -94,8 +86,7 @@ public class DealerBaseInfoController extends BaseController
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:edit')") // @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:edit')")
@Log(title = "经销商信息", businessType = BusinessType.UPDATE) @Log(title = "经销商信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody DealerBaseInfo DealerBaseInfo) public AjaxResult edit(@RequestBody DealerBaseInfo DealerBaseInfo) {
{
return toAjax(dealerBaseInfoService.updateById(DealerBaseInfo)); return toAjax(dealerBaseInfoService.updateById(DealerBaseInfo));
} }
...@@ -105,8 +96,7 @@ public class DealerBaseInfoController extends BaseController ...@@ -105,8 +96,7 @@ public class DealerBaseInfoController extends BaseController
// @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:remove')") // @PreAuthorize("@ss.hasPermi('system:dealerBaseInfo:remove')")
@Log(title = "经销商信息", businessType = BusinessType.DELETE) @Log(title = "经销商信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{dealerBaseInfoIds}") @DeleteMapping("/{dealerBaseInfoIds}")
public AjaxResult remove(@PathVariable Long[] dealerBaseInfoIds) public AjaxResult remove(@PathVariable Long[] dealerBaseInfoIds) {
{
return toAjax(dealerBaseInfoService.removeByIds(Arrays.asList(dealerBaseInfoIds))); return toAjax(dealerBaseInfoService.removeByIds(Arrays.asList(dealerBaseInfoIds)));
} }
} }
...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.controller.BaseController; ...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenDynamicRes; import com.ruoyi.dealer.domain.dto.DealerBigScreenDynamicRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes; import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import com.ruoyi.dealer.service.DealerRoundInfoService; import com.ruoyi.dealer.service.DealerRoundInfoService;
import com.ruoyi.dealer.service.IDealerBaseInfoService; import com.ruoyi.dealer.service.IDealerBaseInfoService;
import com.ruoyi.dealer.service.IDealerRoundResultService; import com.ruoyi.dealer.service.IDealerRoundResultService;
...@@ -41,7 +42,13 @@ public class DealerBigScreenController extends BaseController { ...@@ -41,7 +42,13 @@ public class DealerBigScreenController extends BaseController {
return success(list); return success(list);
} }
@GetMapping("/group/{CategoryName}")
/**
* 第一列 按照分组 A B C 获取前几名
* @param CategoryName
* @return
*/
@GetMapping("/group/category/{CategoryName}")
public AjaxResult groupList(@PathVariable("CategoryName") String CategoryName) { public AjaxResult groupList(@PathVariable("CategoryName") String CategoryName) {
List<DealerBigScreenGroupListRes> list = resultService.groupList(CategoryName); List<DealerBigScreenGroupListRes> list = resultService.groupList(CategoryName);
...@@ -50,4 +57,33 @@ public class DealerBigScreenController extends BaseController { ...@@ -50,4 +57,33 @@ public class DealerBigScreenController extends BaseController {
} }
/**
* 第二列 按照分组获取分组合计的
*
*/
@GetMapping("/group/region")
public AjaxResult groupTotalList() {
List<DealerBigScreenGroupResultRes> list = resultService.groupTotalList();
return success(list);
}
/**
* 按照轮次查询轮次结果
*
*/
@GetMapping("/result/round/{roundTime}")
public AjaxResult groupRoundList(@PathVariable("roundTime") Integer roundTime) {
List<DealerBigScreenGroupListRes> list = resultService.groupRoundList(roundTime);
return success(list);
}
} }
...@@ -60,9 +60,9 @@ public class SysLoginController { ...@@ -60,9 +60,9 @@ public class SysLoginController {
@ResponseBody @ResponseBody
public AjaxResult ajaxLoginEnter(@RequestBody DealerEnterReq req) { public AjaxResult ajaxLoginEnter(@RequestBody DealerEnterReq req) {
String phone = req.getPhone(); String phone = req.getPhone();
// DigestUtil.md5HexTo16(); // 检测是否存在经销商表中 TODO 防止多个手机号绑定一个经销商
// 检测是否存在经销商表中 DealerBaseInfo dealer = dealerBaseInfoService.getOne(new LambdaQueryWrapper<DealerBaseInfo>()
DealerBaseInfo dealer = dealerBaseInfoService.getOne(new LambdaQueryWrapper<DealerBaseInfo>().eq(DealerBaseInfo::getPhone, phone)); .like(DealerBaseInfo::getPhone, phone));
if (dealer == null) { if (dealer == null) {
return AjaxResult.error(400, "该手机号未关联经销商信息"); return AjaxResult.error(400, "该手机号未关联经销商信息");
} }
......
...@@ -5,7 +5,7 @@ import io.jsonwebtoken.Claims; ...@@ -5,7 +5,7 @@ import io.jsonwebtoken.Claims;
/** /**
* 通用常量信息 * 通用常量信息
* *
* @author ruoyi * @author ruoyi
*/ */
public class Constants public class Constants
...@@ -170,4 +170,5 @@ public class Constants ...@@ -170,4 +170,5 @@ public class Constants
*/ */
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" }; "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
public static final String DEALER_ROUND = "dealer.round";
} }
...@@ -94,5 +94,8 @@ public class DealerBaseInfo { ...@@ -94,5 +94,8 @@ public class DealerBaseInfo {
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String salesRegionGroupName;
} }
...@@ -52,15 +52,15 @@ public class DealerRoundResult { ...@@ -52,15 +52,15 @@ public class DealerRoundResult {
*/ */
private String phone; private String phone;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/** /**
* 创建时间 * 创建时间
*/ */
private LocalDateTime createTime; private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/** /**
* 经销商分类 * 经销商分类
......
...@@ -15,4 +15,8 @@ public class DealerBigScreenGroupListRes { ...@@ -15,4 +15,8 @@ public class DealerBigScreenGroupListRes {
*/ */
private String paymentPercentage; private String paymentPercentage;
private Integer paymentTtl;
private Integer goalTtlAct;
} }
package com.ruoyi.dealer.domain.dto;
import lombok.Data;
/**
* 第二列的分组结果
*/
@Data
public class DealerBigScreenGroupResultDto {
private Integer roundTime;
private String groupName;
private Integer paymentTtl;
private Integer goalTtlAct;
/**
* 达成率
*/
private Double paymentPercentage;
}
package com.ruoyi.dealer.domain.dto;
import lombok.Data;
/**
* 第二列的分组结果
*/
@Data
public class DealerBigScreenGroupResultRes {
private Integer roundTime;
private String groupName;
private Integer paymentTtl;
private Integer goalTtlAct;
/**
* 达成率
*/
private String paymentPercentage;
}
package com.ruoyi.dealer.domain.dto;
import lombok.Data;
/**
* 第二列的分组结果
*/
@Data
public class DealerBigScreenRoundResultRes {
private Integer roundTime;
private String groupName;
private Integer paymentTtl;
private Integer goalTtlAct;
/**
* 达成率
*/
private String paymentPercentage;
}
...@@ -5,6 +5,6 @@ import lombok.Data; ...@@ -5,6 +5,6 @@ import lombok.Data;
@Data @Data
public class RoundInfoDto { public class RoundInfoDto {
private Integer roundTime; private Integer roundTime;
private String reward; // private String reward;
} }
...@@ -9,7 +9,7 @@ import java.math.BigDecimal; ...@@ -9,7 +9,7 @@ import java.math.BigDecimal;
public class WechatDealerRoundInfoReq { public class WechatDealerRoundInfoReq {
@NotNull(message = "轮次不能为空") @NotNull(message = "轮次不能为空")
private Integer roundTime; private Integer roundTime;
private String reward; // private String reward;
/** /**
* 经销商id * 经销商id
*/ */
......
...@@ -2,12 +2,10 @@ package com.ruoyi.dealer.domain.dto; ...@@ -2,12 +2,10 @@ package com.ruoyi.dealer.domain.dto;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@Data @Data
public class WechatDealerRoudInfoRes { public class WechatDealerRoundInfoRes {
private Integer roundTime; private Integer roundTime;
private String reward; // private String reward;
/** /**
* 销售大区(非空) * 销售大区(非空)
*/ */
...@@ -66,12 +64,13 @@ public class WechatDealerRoudInfoRes { ...@@ -66,12 +64,13 @@ public class WechatDealerRoudInfoRes {
/** /**
* 分组名称-按照目标分组 A 麒麟组 B 青龙组 C 鲲鹏组 * 分组名称-按照目标分组 A 麒麟组 B 青龙组 C 鲲鹏组
* 第二列 销售大区分组名称
*/ */
private String groupName; private String groupName;
/** /**
* 销售大区分组名称 * 销售大区分组名称
*/ */
private String salesRegionGroupName; // private String salesRegionGroupName;
} }
...@@ -3,9 +3,15 @@ package com.ruoyi.dealer.mapper; ...@@ -3,9 +3,15 @@ package com.ruoyi.dealer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.dealer.domain.DealerRoundResult; import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultDto;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 经销商轮次结果 Mapper 接口 * 经销商轮次结果 Mapper 接口
*/ */
...@@ -17,6 +23,18 @@ public interface DealerRoundResultMapper extends BaseMapper<DealerRoundResult> { ...@@ -17,6 +23,18 @@ public interface DealerRoundResultMapper extends BaseMapper<DealerRoundResult> {
*/ */
@Select("select * from dealer_round_result where dealer_category = #{categoryName} and round_time = 1 " + @Select("select * from dealer_round_result where dealer_category = #{categoryName} and round_time = 1 " +
"order by payment_percentage desc limit 4") "order by payment_percentage desc limit 4")
void getGroupList(String categoryName); 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 ,sales_region_group_name order by payment_percentage desc limit 4")
// 手动指定映射:column(数据库字段)→ property(Java属性)
@Results({
@Result(column = "round_time", property = "roundTime"),
@Result(column = "group_name", property = "groupName"),
@Result(column = "payment_ttl", property = "paymentTtl"),
@Result(column = "goal_ttl_act", property = "goalTtlAct"),
@Result(column = "payment_percentage", property = "paymentPercentage")// 字段名与属性名一致时可省略
})
List<DealerBigScreenGroupResultDto> groupTotalList();
// 若需要自定义 SQL 方法,可在此添加 // 若需要自定义 SQL 方法,可在此添加
} }
...@@ -2,7 +2,7 @@ package com.ruoyi.dealer.service; ...@@ -2,7 +2,7 @@ package com.ruoyi.dealer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.dealer.domain.DealerBaseInfo; import com.ruoyi.dealer.domain.DealerBaseInfo;
import com.ruoyi.dealer.domain.dto.WechatDealerRoudInfoRes; import com.ruoyi.dealer.domain.dto.WechatDealerRoundInfoRes;
import java.util.List; import java.util.List;
...@@ -15,5 +15,5 @@ public interface IDealerBaseInfoService extends IService<DealerBaseInfo> ...@@ -15,5 +15,5 @@ public interface IDealerBaseInfoService extends IService<DealerBaseInfo>
{ {
public List<DealerBaseInfo> queryList(DealerBaseInfo sysStudent); public List<DealerBaseInfo> queryList(DealerBaseInfo sysStudent);
WechatDealerRoudInfoRes getInfoById(Long dealerBaseInfoId); WechatDealerRoundInfoRes getDealerRoundInfoByDealerId(Long dealerBaseInfoId);
} }
...@@ -4,6 +4,7 @@ package com.ruoyi.dealer.service; ...@@ -4,6 +4,7 @@ package com.ruoyi.dealer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.dealer.domain.DealerRoundResult; import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes; import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupResultRes;
import java.util.List; import java.util.List;
...@@ -12,5 +13,9 @@ import java.util.List; ...@@ -12,5 +13,9 @@ import java.util.List;
*/ */
public interface IDealerRoundResultService extends IService<DealerRoundResult> { public interface IDealerRoundResultService extends IService<DealerRoundResult> {
List<DealerBigScreenGroupListRes> groupList(String CategoryName); List<DealerBigScreenGroupListRes> groupList(String CategoryName);
List<DealerBigScreenGroupResultRes> groupTotalList();
List<DealerBigScreenGroupListRes> groupRoundList(Integer roundTime);
// 自定义业务方法声明(可选) // 自定义业务方法声明(可选)
} }
...@@ -4,16 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,16 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.dealer.domain.DealerBaseInfo; import com.ruoyi.dealer.domain.DealerBaseInfo;
import com.ruoyi.dealer.domain.DealerRoundResult; import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.DealerBaseInfoDto; import com.ruoyi.dealer.domain.dto.WechatDealerRoundInfoRes;
import com.ruoyi.dealer.domain.dto.RoundInfoDto;
import com.ruoyi.dealer.domain.dto.WechatDealerRoudInfoRes;
import com.ruoyi.dealer.mapper.DealerBaseInfoMapper; import com.ruoyi.dealer.mapper.DealerBaseInfoMapper;
import com.ruoyi.dealer.service.DealerRoundInfoService; import com.ruoyi.dealer.service.DealerRoundInfoService;
import com.ruoyi.dealer.service.IDealerBaseInfoService; import com.ruoyi.dealer.service.IDealerBaseInfoService;
import com.ruoyi.dealer.service.IDealerRoundResultService; import com.ruoyi.dealer.service.IDealerRoundResultService;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -33,6 +33,8 @@ public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, Dealer ...@@ -33,6 +33,8 @@ public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, Dealer
private DealerRoundInfoService dealerRoundInfoService; private DealerRoundInfoService dealerRoundInfoService;
@Autowired @Autowired
private IDealerRoundResultService resultService; private IDealerRoundResultService resultService;
@Autowired
private ISysConfigService configService;
@Override @Override
public List<DealerBaseInfo> queryList(DealerBaseInfo sysStudent) { public List<DealerBaseInfo> queryList(DealerBaseInfo sysStudent) {
...@@ -53,24 +55,47 @@ public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, Dealer ...@@ -53,24 +55,47 @@ public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, Dealer
} }
@Override @Override
public WechatDealerRoudInfoRes getInfoById(Long dealerBaseInfoId) { public WechatDealerRoundInfoRes getDealerRoundInfoByDealerId(Long dealerId) {
DealerBaseInfo dealerBaseInfo = this.getById(dealerBaseInfoId);
String config = configService.selectConfigByKeyFromDb(Constants.DEALER_ROUND);
Integer round = Integer.parseInt(config);
if (round <= 0) {
throw new ServiceException("轮次未开始");
}
DealerBaseInfo dealerBaseInfo = this.getById(dealerId);
if (dealerBaseInfo == null) { if (dealerBaseInfo == null) {
throw new ServiceException("经销商不存在"); throw new ServiceException("经销商不存在");
} }
// 查询当前的轮次 // 查询当前的轮次
WechatDealerRoudInfoRes dealerBaseInfoRes = new WechatDealerRoudInfoRes(); WechatDealerRoundInfoRes roundInfoRes = new WechatDealerRoundInfoRes();
BeanUtils.copyProperties(dealerBaseInfo, dealerBaseInfoRes); BeanUtils.copyProperties(dealerBaseInfo, roundInfoRes);
dealerBaseInfoRes.setPaymentPercentage(Math.round(dealerBaseInfo.getPaymentTtl() * 100.0 / dealerBaseInfo.getGoalTtlAct())+"%"); roundInfoRes.setPaymentPercentage(Math.round(dealerBaseInfo.getPaymentTtl() * 100.0 / dealerBaseInfo.getGoalTtlAct()) + "%");
dealerBaseInfoRes.setRoundTime(1);
dealerBaseInfoRes.setReward("老铺黄金-葫芦1号吊坠"); // 轮次
roundInfoRes.setRoundTime(round);
// 区分分组信息
// roundInfoRes.setReward("老铺黄金-葫芦1号吊坠");
// 查询结果表,如果有值,更新覆盖 // 查询结果表,如果有值,更新覆盖
DealerRoundResult result = resultService.getOne(new LambdaQueryWrapper<DealerRoundResult>() DealerRoundResult result = resultService.getOne(new LambdaQueryWrapper<DealerRoundResult>()
.eq(DealerRoundResult::getDealerId, dealerBaseInfoId)); .eq(DealerRoundResult::getRoundTime, round)
.eq(DealerRoundResult::getDealerId, dealerId));
if (result != null) { if (result != null) {
dealerBaseInfoRes.setPaymentTtl(result.getPaymentTtl()); roundInfoRes.setPaymentTtl(result.getPaymentTtl());
dealerBaseInfoRes.setPaymentPercentage(Math.round(result.getPaymentTtl() * 100.0 / dealerBaseInfo.getGoalTtlAct())+"%"); roundInfoRes.setPaymentPercentage(Math.round(result.getPaymentTtl() * 100.0 / dealerBaseInfo.getGoalTtlAct()) + "%");
}
if (round == 2) {
roundInfoRes.setGroupName(dealerBaseInfo.getSalesRegionGroupName());
// 第二轮第一次 查询结果
if (result == null) {
// 查询第一轮的结果
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()) + "%");
}
} }
return dealerBaseInfoRes; return roundInfoRes;
} }
} }
...@@ -4,6 +4,8 @@ package com.ruoyi.dealer.service.impl; ...@@ -4,6 +4,8 @@ package com.ruoyi.dealer.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.dealer.domain.dto.DealerBigScreenGroupListRes; 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.mapper.DealerRoundResultMapper; import com.ruoyi.dealer.mapper.DealerRoundResultMapper;
import com.ruoyi.dealer.domain.DealerRoundResult; import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.service.IDealerRoundResultService; import com.ruoyi.dealer.service.IDealerRoundResultService;
...@@ -26,8 +28,6 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM ...@@ -26,8 +28,6 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM
.orderByDesc(DealerRoundResult::getPaymentPercentage, DealerRoundResult::getPaymentTtl) .orderByDesc(DealerRoundResult::getPaymentPercentage, DealerRoundResult::getPaymentTtl)
); );
// this.getBaseMapper().getGroupList(CategoryName);
List<DealerBigScreenGroupListRes> list =new ArrayList<>(); List<DealerBigScreenGroupListRes> list =new ArrayList<>();
resultList.forEach(item -> { resultList.forEach(item -> {
DealerBigScreenGroupListRes res = new DealerBigScreenGroupListRes(); DealerBigScreenGroupListRes res = new DealerBigScreenGroupListRes();
...@@ -37,10 +37,56 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM ...@@ -37,10 +37,56 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM
res.setPhone(item.getPhone()); res.setPhone(item.getPhone());
res.setGroupName(item.getGroupName()); res.setGroupName(item.getGroupName());
res.setRoundTime(item.getRoundTime()); res.setRoundTime(item.getRoundTime());
res.setGoalTtlAct(item.getGoalTtlAct());
res.setPaymentTtl(item.getPaymentTtl());
res.setPaymentPercentage(Math.round(item.getPaymentTtl() * 100.0 / item.getGoalTtlAct() ) + "%"); res.setPaymentPercentage(Math.round(item.getPaymentTtl() * 100.0 / item.getGoalTtlAct() ) + "%");
list.add(res); list.add(res);
}); });
return list; return list;
} }
}
@Override
public List<DealerBigScreenGroupResultRes> groupTotalList() {
List<DealerBigScreenGroupResultDto> dealerBigScreenGroupResultRes = this.getBaseMapper().groupTotalList();
List<DealerBigScreenGroupResultRes> list = new ArrayList<>();
dealerBigScreenGroupResultRes.forEach(item -> {
DealerBigScreenGroupResultRes res = new DealerBigScreenGroupResultRes();
res.setRoundTime(item.getRoundTime());
res.setGroupName(item.getGroupName());
res.setPaymentTtl(item.getPaymentTtl());
res.setGoalTtlAct(item.getGoalTtlAct());
res.setPaymentPercentage(Math.round(item.getPaymentPercentage()) + "%");
list.add(res);
});
return list;
}
@Override
public List<DealerBigScreenGroupListRes> groupRoundList(Integer roundTime) {
List<DealerRoundResult> dealerBigScreenGroupResultRes = this.list(new LambdaQueryWrapper<DealerRoundResult>()
.eq(DealerRoundResult::getRoundTime, roundTime));
List<DealerBigScreenGroupListRes> list = new ArrayList<>();
dealerBigScreenGroupResultRes.forEach(item -> {
DealerBigScreenGroupListRes res = new DealerBigScreenGroupListRes();
res.setRoundTime(item.getRoundTime());
res.setGroupName(item.getGroupName());
res.setDealerCategory(item.getDealerCategory());
res.setDealerName(item.getDealerName());
res.setDealerId(item.getDealerId());
res.setPhone(item.getPhone());
res.setPaymentTtl(item.getPaymentTtl());
res.setGoalTtlAct(item.getGoalTtlAct());
res.setPaymentPercentage(Math.round(item.getPaymentTtl() * 100.0 / item.getGoalTtlAct()) + "%");
list.add(res);
});
return list;
}
}
...@@ -5,14 +5,14 @@ import com.ruoyi.system.domain.SysConfig; ...@@ -5,14 +5,14 @@ import com.ruoyi.system.domain.SysConfig;
/** /**
* 参数配置 服务层 * 参数配置 服务层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface ISysConfigService public interface ISysConfigService
{ {
/** /**
* 查询参数配置信息 * 查询参数配置信息
* *
* @param configId 参数配置ID * @param configId 参数配置ID
* @return 参数配置信息 * @return 参数配置信息
*/ */
...@@ -20,22 +20,24 @@ public interface ISysConfigService ...@@ -20,22 +20,24 @@ public interface ISysConfigService
/** /**
* 根据键名查询参数配置信息 * 根据键名查询参数配置信息
* *
* @param configKey 参数键名 * @param configKey 参数键名
* @return 参数键值 * @return 参数键值
*/ */
public String selectConfigByKey(String configKey); public String selectConfigByKey(String configKey);
String selectConfigByKeyFromDb(String configKey);
/** /**
* 获取验证码开关 * 获取验证码开关
* *
* @return true开启,false关闭 * @return true开启,false关闭
*/ */
public boolean selectCaptchaEnabled(); public boolean selectCaptchaEnabled();
/** /**
* 查询参数配置列表 * 查询参数配置列表
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 参数配置集合 * @return 参数配置集合
*/ */
...@@ -43,7 +45,7 @@ public interface ISysConfigService ...@@ -43,7 +45,7 @@ public interface ISysConfigService
/** /**
* 新增参数配置 * 新增参数配置
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 结果 * @return 结果
*/ */
...@@ -51,7 +53,7 @@ public interface ISysConfigService ...@@ -51,7 +53,7 @@ public interface ISysConfigService
/** /**
* 修改参数配置 * 修改参数配置
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 结果 * @return 结果
*/ */
...@@ -59,7 +61,7 @@ public interface ISysConfigService ...@@ -59,7 +61,7 @@ public interface ISysConfigService
/** /**
* 批量删除参数信息 * 批量删除参数信息
* *
* @param configIds 需要删除的参数ID * @param configIds 需要删除的参数ID
*/ */
public void deleteConfigByIds(Long[] configIds); public void deleteConfigByIds(Long[] configIds);
...@@ -81,7 +83,7 @@ public interface ISysConfigService ...@@ -81,7 +83,7 @@ public interface ISysConfigService
/** /**
* 校验参数键名是否唯一 * 校验参数键名是否唯一
* *
* @param config 参数信息 * @param config 参数信息
* @return 结果 * @return 结果
*/ */
......
...@@ -19,7 +19,7 @@ import com.ruoyi.system.service.ISysConfigService; ...@@ -19,7 +19,7 @@ import com.ruoyi.system.service.ISysConfigService;
/** /**
* 参数配置 服务层实现 * 参数配置 服务层实现
* *
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
...@@ -42,7 +42,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -42,7 +42,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 查询参数配置信息 * 查询参数配置信息
* *
* @param configId 参数配置ID * @param configId 参数配置ID
* @return 参数配置信息 * @return 参数配置信息
*/ */
...@@ -57,7 +57,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -57,7 +57,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 根据键名查询参数配置信息 * 根据键名查询参数配置信息
* *
* @param configKey 参数key * @param configKey 参数key
* @return 参数键值 * @return 参数键值
*/ */
...@@ -80,9 +80,23 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -80,9 +80,23 @@ public class SysConfigServiceImpl implements ISysConfigService
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
@Override
public String selectConfigByKeyFromDb(String configKey)
{
SysConfig config = new SysConfig();
config.setConfigKey(configKey);
SysConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig))
{
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
return StringUtils.EMPTY;
}
/** /**
* 获取验证码开关 * 获取验证码开关
* *
* @return true开启,false关闭 * @return true开启,false关闭
*/ */
@Override @Override
...@@ -98,7 +112,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -98,7 +112,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 查询参数配置列表 * 查询参数配置列表
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 参数配置集合 * @return 参数配置集合
*/ */
...@@ -110,7 +124,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -110,7 +124,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 新增参数配置 * 新增参数配置
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 结果 * @return 结果
*/ */
...@@ -127,7 +141,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -127,7 +141,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 修改参数配置 * 修改参数配置
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 结果 * @return 结果
*/ */
...@@ -150,7 +164,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -150,7 +164,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 批量删除参数信息 * 批量删除参数信息
* *
* @param configIds 需要删除的参数ID * @param configIds 需要删除的参数ID
*/ */
@Override @Override
...@@ -203,7 +217,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -203,7 +217,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 校验参数键名是否唯一 * 校验参数键名是否唯一
* *
* @param config 参数配置信息 * @param config 参数配置信息
* @return 结果 * @return 结果
*/ */
...@@ -221,7 +235,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -221,7 +235,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/** /**
* 设置cache key * 设置cache key
* *
* @param configKey 参数键 * @param configKey 参数键
* @return 缓存键key * @return 缓存键key
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论