|
@@ -21,7 +21,7 @@ import com.xy.utils.enums.DictSonEnum;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -46,11 +46,12 @@ import static com.xy.utils.PlusBeans.toPageBean;
|
|
|
* @since 2023-01-11
|
|
|
*/
|
|
|
@Service
|
|
|
-@AllArgsConstructor(onConstructor_ = @Lazy)
|
|
|
+@AllArgsConstructor(onConstructor_ = @Autowired)
|
|
|
@Api(tags = "设备统计数据")
|
|
|
public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceData> implements DeviceDataService {
|
|
|
|
|
|
private final DeviceInfoServiceImpl deviceInfoService;
|
|
|
+
|
|
|
@PostMapping("sumPage")
|
|
|
@ApiOperation("设备销售统计")
|
|
|
public R<PageBean<DeviceDataDto.SumPageVo>> sumPage(@RequestBody @Valid DeviceDataDto.SumPageDto dto) {
|
|
@@ -67,18 +68,18 @@ public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceD
|
|
|
LambdaQueryWrapper<DeviceData> lqw = new QueryWrapper<DeviceData>()
|
|
|
.select(String.format("%s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s"
|
|
|
, deviceId, salesCount, salesCount, salesMoney, salesMoney, goodsCount, goodsCount
|
|
|
- ,refundMoney,refundMoney,refundCount,refundCount,riskCount,riskCount,zeroCount,zeroCount
|
|
|
+ , refundMoney, refundMoney, refundCount, refundCount, riskCount, riskCount, zeroCount, zeroCount
|
|
|
))
|
|
|
.orderByAsc("asc".equals(dto.getOrderBy()), dto.getOrderByKey())
|
|
|
.orderByDesc("desc".equals(dto.getOrderBy()), dto.getOrderByKey())
|
|
|
.lambda()
|
|
|
- .eq(Emptys.check(dto.getMercId()),DeviceData::getMercId, dto.getMercId())
|
|
|
+ .eq(Emptys.check(dto.getMercId()), DeviceData::getMercId, dto.getMercId())
|
|
|
.eq(DeviceData::getType, dto.getType())
|
|
|
.ge(Emptys.check(dto.getBeginDate()), DeviceData::getDateValue, dto.getBeginDate())
|
|
|
.le(Emptys.check(dto.getEndDate()), DeviceData::getDateValue, dto.getEndDate())
|
|
|
.groupBy(DeviceData::getDeviceId);
|
|
|
IPage<DeviceData> ipage = page(toIPage(pageBean), lqw);
|
|
|
- if(Emptys.check(ipage.getRecords())) {
|
|
|
+ if (Emptys.check(ipage.getRecords())) {
|
|
|
List<Long> deviceIdList = ipage.getRecords().stream().map(DeviceData::getDeviceId).collect(Collectors.toList());
|
|
|
Map<Long, String> deviceMap = deviceInfoService.getDeviceNameList(new DeviceInfoDto.DeviceIdDto().setDeviceId(deviceIdList)).getData();
|
|
|
PageBean<DeviceDataDto.SumPageVo> sumPageVoPageBean = toPageBean(DeviceDataDto.SumPageVo.class, ipage);
|
|
@@ -104,14 +105,14 @@ public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceD
|
|
|
LambdaQueryWrapper<DeviceData> lqw = new QueryWrapper<DeviceData>()
|
|
|
.select(String.format("sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s,sum(%s) %s"
|
|
|
, salesCount, salesCount, salesMoney, salesMoney, goodsCount, goodsCount
|
|
|
- ,refundMoney,refundMoney,refundCount,refundCount,riskCount,riskCount,zeroCount,zeroCount
|
|
|
+ , refundMoney, refundMoney, refundCount, refundCount, riskCount, riskCount, zeroCount, zeroCount
|
|
|
))
|
|
|
.lambda()
|
|
|
- .eq(Emptys.check(dto.getMercId()),DeviceData::getMercId, dto.getMercId())
|
|
|
+ .eq(Emptys.check(dto.getMercId()), DeviceData::getMercId, dto.getMercId())
|
|
|
.eq(DeviceData::getType, dto.getType())
|
|
|
.ge(Emptys.check(dto.getBeginDate()), DeviceData::getDateValue, dto.getBeginDate())
|
|
|
.le(Emptys.check(dto.getEndDate()), DeviceData::getDateValue, dto.getEndDate());
|
|
|
- return R.ok(copy(DeviceDataDto.SumCountVo.class,getOne(lqw)));
|
|
|
+ return R.ok(copy(DeviceDataDto.SumCountVo.class, getOne(lqw)));
|
|
|
}
|
|
|
|
|
|
@PostMapping("obj")
|