Merge branch 'master' into test0606
This commit is contained in:
commit
90016a24fa
|
|
@ -3,6 +3,8 @@ package com.bonus.canteen.core.account.controller;
|
|||
import com.bonus.canteen.core.account.domain.AccountTrade;
|
||||
import com.bonus.canteen.core.account.domain.param.AccConsumeDetailQueryParam;
|
||||
import com.bonus.canteen.core.account.service.IAccTradeService;
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -19,7 +21,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 账户交易记录Controller
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-04-05
|
||||
*/
|
||||
|
|
@ -30,6 +32,19 @@ public class AccTradeController extends BaseController {
|
|||
@Autowired
|
||||
private IAccTradeService accTradeService;
|
||||
|
||||
@Autowired
|
||||
private TradeReportService tradeReportService;
|
||||
|
||||
@ApiOperation(value = "交易流水")
|
||||
//@RequiresPermissions("health:info:list")
|
||||
@GetMapping("/acct")
|
||||
public TableDataInfo acct(TradeFlowVO param) {
|
||||
startPage();
|
||||
List<TradeFlowVO> list = tradeReportService.selectTradeFlow(param);
|
||||
System.out.println(list.size());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询账户交易记录列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -162,6 +161,27 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
//查询所有的餐次
|
||||
List<CookMealTimeVO> mealTimeList = mapper.getMealTimeList(menuRecipe.getStallId());
|
||||
List<CookRecipeDateCompressVO> dateList = new ArrayList<>();
|
||||
setMealDataByDate(applyDateList, mealTimeList, menuRecipeDetailList, recipeDishList, dateList);
|
||||
logger.info("menuRecipe : {} ", menuRecipe);
|
||||
|
||||
if(menuRecipe.getRecipeType() !=null){
|
||||
issueRecipe.setRecipeType(Integer.valueOf(menuRecipe.getRecipeType()+""));
|
||||
}
|
||||
issueRecipe.setRecipeId(menuRecipe.getRecipeId());
|
||||
if(menuRecipe.getUpdateTime() !=null) {
|
||||
issueRecipe.setUptime(menuRecipe.getUpdateTime().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
} else {
|
||||
issueRecipe.setUptime(LocalDateTime.now());
|
||||
|
||||
}
|
||||
issueRecipe.setDateList(dateList);
|
||||
issueRecipe.setMealList(menuList);
|
||||
return issueRecipe;
|
||||
}
|
||||
|
||||
private static void setMealDataByDate(List<LocalDate> applyDateList, List<CookMealTimeVO> mealTimeList, List<CookMenuAndroidRecipeDetailVO> menuRecipeDetailList, List<CookRecipeDetailCompressVO> recipeDishList, List<CookRecipeDateCompressVO> dateList) {
|
||||
for (LocalDate date : applyDateList){
|
||||
CookRecipeDateCompressVO dateCompressVO = new CookRecipeDateCompressVO();
|
||||
List<CookRecipeIntervalCompressVO> intervalList = new ArrayList<>();
|
||||
|
|
@ -184,23 +204,6 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
dateCompressVO.setIntervalList(intervalList);
|
||||
dateList.add(dateCompressVO);
|
||||
}
|
||||
logger.info("menuRecipe : {} ", menuRecipe);
|
||||
|
||||
if(menuRecipe.getRecipeType() !=null){
|
||||
issueRecipe.setRecipeType(Integer.valueOf(menuRecipe.getRecipeType()+""));
|
||||
}
|
||||
issueRecipe.setRecipeId(menuRecipe.getRecipeId());
|
||||
if(menuRecipe.getUpdateTime() !=null) {
|
||||
issueRecipe.setUptime(menuRecipe.getUpdateTime().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
} else {
|
||||
issueRecipe.setUptime(LocalDateTime.now());
|
||||
|
||||
}
|
||||
issueRecipe.setDateList(dateList);
|
||||
issueRecipe.setMealList(menuList);
|
||||
return issueRecipe;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.bonus.common.core.exception.ServiceException;
|
|||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.device.mapper.DeviceInfoMapper;
|
||||
import com.bonus.canteen.core.device.domain.DeviceInfo;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.bonus.canteen.core.health.controller;
|
|||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
//import com.bonus.canteen.core.health.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -37,6 +40,9 @@ public class HealthPersonInfoController extends BaseController {
|
|||
@Autowired
|
||||
private IHealthPersonInfoService healthPersonInfoService;
|
||||
|
||||
@Autowired
|
||||
private TradeReportService tradeReportService;
|
||||
|
||||
/**
|
||||
* 查询人员健康情况列表
|
||||
*/
|
||||
|
|
@ -49,7 +55,15 @@ public class HealthPersonInfoController extends BaseController {
|
|||
List<HealthPersonInfo> list = healthPersonInfoService.selectHealthPersonInfoList(healthPersonInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "交易流水")
|
||||
//@RequiresPermissions("health:info:list")
|
||||
@GetMapping("/acct")
|
||||
public TableDataInfo acct(TradeFlowVO param) {
|
||||
startPage();
|
||||
List<TradeFlowVO> list = tradeReportService.selectTradeFlow(param);
|
||||
System.out.println(list.size());
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 导出人员健康情况列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ import java.math.RoundingMode;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.health.mapper.HealthPersonInfoMapper;
|
||||
|
|
@ -45,7 +48,13 @@ public class HealthPersonInfoServiceImpl implements IHealthPersonInfoService {
|
|||
*/
|
||||
@Override
|
||||
public List<HealthPersonInfo> selectHealthPersonInfoList(HealthPersonInfo healthPersonInfo) {
|
||||
return healthPersonInfoMapper.selectHealthPersonInfoList(healthPersonInfo);
|
||||
List<HealthPersonInfo> list=healthPersonInfoMapper.selectHealthPersonInfoList(healthPersonInfo);
|
||||
if(CollUtil.isNotEmpty(list)) {
|
||||
for(HealthPersonInfo vo : list) {
|
||||
vo.setMobile(SM4EncryptUtils.sm4Decrypt(vo.getMobile()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -131,6 +133,9 @@ public class OrderInfoController extends BaseController
|
|||
public AjaxResult addSave(@RequestBody @Valid OrderAddParam orderAddParam)
|
||||
{
|
||||
try {
|
||||
if(!orderAddParam.getUserId().equals(SecurityUtils.getUserId())) {
|
||||
throw new ServiceException("用户ID不匹配");
|
||||
}
|
||||
orderInfoService.insertCanteenOrderInfo(orderAddParam);
|
||||
}catch (ServiceException ex) {
|
||||
logger.error("h5下单异常: {}", ex.getMessage(), ex);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.canteen.core.report.controller;
|
||||
|
||||
import com.bonus.canteen.core.health.domain.HealthPersonInfo;
|
||||
import com.bonus.canteen.core.health.service.IHealthPersonInfoService;
|
||||
import com.bonus.canteen.core.report.domain.*;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交易报表
|
||||
*
|
||||
* @author jsk
|
||||
* @date 2025-06-06
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/reportTrade")
|
||||
public class TradeReportController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private TradeReportService tradeReportService;
|
||||
|
||||
@Autowired
|
||||
private IHealthPersonInfoService healthPersonInfoService;
|
||||
|
||||
@ApiOperation(value = "交易流水")
|
||||
//@RequiresPermissions("report:trade:flow")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TradeFlowVO param) {
|
||||
startPage();
|
||||
List<TradeFlowVO> list = tradeReportService.selectTradeFlow(param);
|
||||
System.out.println(list.size());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TradeFlowVO extends BaseEntity {
|
||||
private Long userId;
|
||||
private String userName;
|
||||
private Integer userType;
|
||||
private String phonenumber;
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private String deptFullName;
|
||||
private BigDecimal accountAllBal;
|
||||
private LocalDateTime tradeTime;
|
||||
private Integer tradeType;
|
||||
private Integer payType;
|
||||
private String machineSn;
|
||||
private String deviceName;
|
||||
private String createBy;
|
||||
private BigDecimal income;
|
||||
private BigDecimal outcome;
|
||||
|
||||
private String searchValue;
|
||||
private List<Long> deptIdList;
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startDateTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endDateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.bonus.canteen.core.report.mapper;
|
||||
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TradeReportMapper {
|
||||
public List<TradeFlowVO> selectTradeFlow(@Param("param") TradeFlowVO param,@Param("encryptedSearchValue") String encryptedSearchValue);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.bonus.canteen.core.report.service;
|
||||
|
||||
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TradeReportService {
|
||||
List<TradeFlowVO> selectTradeFlow(TradeFlowVO param);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.canteen.core.report.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import com.bonus.canteen.core.report.mapper.TradeReportMapper;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TradeReportServiceImpl implements TradeReportService {
|
||||
@Resource
|
||||
TradeReportMapper tradeReportMapper;
|
||||
|
||||
@Override
|
||||
public List<TradeFlowVO> selectTradeFlow(TradeFlowVO param) {
|
||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||
List<TradeFlowVO> tradeFlowVOList = tradeReportMapper.selectTradeFlow(param,encryptedSearchValue);
|
||||
if(CollUtil.isNotEmpty(tradeFlowVOList)) {
|
||||
for(TradeFlowVO vo : tradeFlowVOList) {
|
||||
vo.setPhonenumber(SM4EncryptUtils.sm4Decrypt(vo.getPhonenumber()));
|
||||
}
|
||||
}
|
||||
return tradeFlowVOList;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
private static final String DISH = "Dish";
|
||||
private static final int MAX_LAST_DAY = -29;
|
||||
|
||||
private static final String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* 获取数据总览
|
||||
*
|
||||
|
|
@ -175,7 +177,7 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
? mapper.getCanteenOrdersAndSalesTrends(date, DateUtils.getDate())
|
||||
: mapper.getSupermarketOrderAndSalesTrend(date, DateUtils.getDate());
|
||||
|
||||
List<String> dateList = getDatesBetween(date, DateUtils.getDate(), "yyyy-MM-dd");
|
||||
List<String> dateList = getDatesBetween(date, DateUtils.getDate(), YYYY_MM_DD);
|
||||
// 将list中的数据放入map中,key为orderDate,value为EchartsVO 提升查询效率
|
||||
Map<String, EchartsVO> dataMap = list.stream()
|
||||
.collect(Collectors.toMap(EchartsVO::getOrderDate, vo -> vo, (a, b) -> a));
|
||||
|
|
@ -183,6 +185,9 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
List<EchartsVO> result = dateList.stream().map(dateStr -> {
|
||||
EchartsVO echartsVO = dataMap.getOrDefault(dateStr, new EchartsVO());
|
||||
echartsVO.setOrderDate(dateStr);
|
||||
//根据日期设置星期几
|
||||
|
||||
echartsVO.setWeekday(getWeekday(dateStr));
|
||||
echartsVO.setSalesValue(Optional.ofNullable(echartsVO.getSalesValue())
|
||||
.map(value -> new BigDecimal(value).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).toString())
|
||||
.orElse("0"));
|
||||
|
|
@ -250,7 +255,7 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
Calendar calendar = Calendar.getInstance();
|
||||
// 日期减去一天
|
||||
calendar.add(Calendar.DATE, day);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD);
|
||||
return sdf.format(calendar.getTime());
|
||||
}
|
||||
|
||||
|
|
@ -279,4 +284,28 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
}
|
||||
return dates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期字符串获取星期几
|
||||
*
|
||||
* @param dateStr 日期字符串,格式为yyyy-MM-dd
|
||||
* @return 星期几
|
||||
*/
|
||||
private String getWeekday(String dateStr) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD);
|
||||
Date date = sdf.parse(dateStr);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
|
||||
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (dayOfWeek < 0){
|
||||
dayOfWeek = 0;
|
||||
}
|
||||
return weekDays[dayOfWeek];
|
||||
} catch (Exception e) {
|
||||
log.error("日期转换异常", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ public class EchartsVO {
|
|||
private String salesValue;
|
||||
private String orderValue;
|
||||
private String orderDate;
|
||||
private String weekday;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.report.mapper.TradeReportMapper">
|
||||
<select id="selectTradeFlow" resultType="com.bonus.canteen.core.report.domain.TradeFlowVO">
|
||||
select
|
||||
su.user_id,
|
||||
su.user_name,
|
||||
su.user_type,
|
||||
su.phonenumber,
|
||||
sd.dept_id,
|
||||
sd.dept_name,
|
||||
sd.dept_full_name,
|
||||
at2.account_all_bal,
|
||||
at2.trade_time,
|
||||
at2.trade_type,
|
||||
at2.pay_type,
|
||||
at2.machine_sn,
|
||||
di.device_name,
|
||||
at2.create_by,
|
||||
IFNULL(CASE
|
||||
WHEN at2.trade_type in (10, 20, 130) then
|
||||
at2.actual_amount
|
||||
end, 0)as income,
|
||||
IFNULL(CASE
|
||||
WHEN at2.trade_type in (30, 100, 110) then
|
||||
at2.actual_amount
|
||||
end, 0) as outcome
|
||||
from
|
||||
account_trade at2
|
||||
left join sys_user su on
|
||||
at2.user_id = su.user_id
|
||||
left join sys_dept sd on
|
||||
su.dept_id = sd.dept_id
|
||||
left join device_info di on
|
||||
at2.machine_sn = di.device_sn
|
||||
where
|
||||
at2.pay_state = 3
|
||||
and at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and at2.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id IN
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.searchValue != null and param.searchValue != ''">
|
||||
and (
|
||||
su.nick_name like CONCAT('%',#{param.searchValue},'%')
|
||||
or su.phonenumber = #{encryptedSearchValue}
|
||||
or su.user_id like concat('%', #{param.searchValue}, '%')
|
||||
)
|
||||
</if>
|
||||
order by at2.trade_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue