补贴导出

This commit is contained in:
zt
2025-01-20 14:59:23 +08:00
parent 745f7826c0
commit da83e04ec1
9 changed files with 98 additions and 0 deletions

View File

@ -13,5 +13,6 @@ public class StatisticsVo {
private Long carteenId; private Long carteenId;
private LocalDateTime time; private LocalDateTime time;
private int orderSum; private int orderSum;
private BigDecimal subsidyPurse;
} }

View File

@ -192,4 +192,16 @@ public class CustomizeExcelController {
orderExcelVOS); orderExcelVOS);
} }
@GetMapping("/subsidyExcel")
@Operation(summary = "三峡路社区食堂补贴")
@OperateLog(type = EXPORT)
public void exportSubsidyExcel(String startTime,String endTime,Long carteenId,
HttpServletResponse response) throws IOException {
List<SubsidyExcelVO> orderExcelVOS = excelService.exportSubsidyExcel(startTime, endTime,carteenId);
// 导出 Excel
ExcelUtils.write(response, "部门订单详情统计.xlsx", "数据", SubsidyExcelVO.class,
orderExcelVOS);
}
} }

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class SubsidyExcelVO {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("手机")
private String mobile;
@ExcelProperty("身份证号码")
private String identityCard;
@ExcelProperty("地址")
private String address;
@ExcelProperty("类别")
private String tagName;
@ExcelProperty("市场价格(元)")
@NumberFormat("#0.00")
private BigDecimal marketPrice;
@ExcelProperty("自付(元)")
@NumberFormat("#0.00")
private BigDecimal totalMoney;
@ExcelProperty("补助(元)")
@NumberFormat("#0.00")
private BigDecimal subsidyAmount;
@ExcelProperty("时间段")
private String timeSlot;
@ExcelProperty("日期")
private String createTime;
}

View File

@ -20,4 +20,7 @@ public interface CustomizeExcelMapper {
List<GroupOrderVO> exportGroupOrderExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId, @Param("groupId")Long groupId); List<GroupOrderVO> exportGroupOrderExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId, @Param("groupId")Long groupId);
List<GroupStoreOrderVO> exportGroupStoreOrderExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId, @Param("groupId")Long groupId); List<GroupStoreOrderVO> exportGroupStoreOrderExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId, @Param("groupId")Long groupId);
List<SubsidyExcelVO> exportSubsidyExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId);
} }

View File

@ -191,6 +191,7 @@ public class DeductionServiceImpl implements DeductionService {
statisticsVo.setReduceMoney(dishOrderDO.getReductionAmount()); statisticsVo.setReduceMoney(dishOrderDO.getReductionAmount());
statisticsVo.setTime(dishOrderDO.getCreateTime()); statisticsVo.setTime(dishOrderDO.getCreateTime());
statisticsVo.setOrderId(dishOrderDO.getId()); statisticsVo.setOrderId(dishOrderDO.getId());
statisticsVo.setSubsidyPurse(dishOrderDO.getSubsidyAmount());
businessService.updateStatistics(statisticsVo); businessService.updateStatistics(statisticsVo);
} }

View File

@ -170,6 +170,11 @@ public class BusinessServiceImpl implements BusinessService {
} }
} }
//补贴金额
if(ObjectUtil.isNotEmpty(vo.getSubsidyPurse())){
businessDO.setSubsidyPurse(businessDO.getSubsidyPurse().add(vo.getSubsidyPurse()));
}
businessMapper.updateById(businessDO); businessMapper.updateById(businessDO);
} }
} }

View File

@ -19,4 +19,6 @@ public interface CustomizeExcelService {
List<GroupOrderVO> exportGroupOrderExcel(String startTime, String endTime, Long carteenId, Long groupId); List<GroupOrderVO> exportGroupOrderExcel(String startTime, String endTime, Long carteenId, Long groupId);
List<GroupStoreOrderVO> exportGroupStoreOrderExcel(String startTime, String endTime, Long carteenId, Long groupId); List<GroupStoreOrderVO> exportGroupStoreOrderExcel(String startTime, String endTime, Long carteenId, Long groupId);
List<SubsidyExcelVO> exportSubsidyExcel(String startTime,String endTime,Long carteenId);
} }

View File

@ -40,4 +40,9 @@ public class CustomizeExcelServiceImpl implements CustomizeExcelService {
public List<GroupStoreOrderVO> exportGroupStoreOrderExcel(String startTime, String endTime, Long carteenId, Long groupId) { public List<GroupStoreOrderVO> exportGroupStoreOrderExcel(String startTime, String endTime, Long carteenId, Long groupId) {
return customizeExcelMapper.exportGroupStoreOrderExcel(startTime,endTime,carteenId,groupId); return customizeExcelMapper.exportGroupStoreOrderExcel(startTime,endTime,carteenId,groupId);
} }
@Override
public List<SubsidyExcelVO> exportSubsidyExcel(String startTime, String endTime, Long carteenId) {
return customizeExcelMapper.exportSubsidyExcel(startTime,endTime,carteenId);
}
} }

View File

@ -121,4 +121,28 @@
and DATE_FORMAT(o.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} and DATE_FORMAT(o.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</select> </select>
<select id="exportSubsidyExcel" resultType="cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.SubsidyExcelVO">
select mu.name,
mu.mobile,
mu.identity_card,
mu.address,
mt.name as tagName,
mdo.total_money + mdo.subsidy_amount as marketPrice,
mdo.total_money,
mdo.subsidy_amount,
CASE
WHEN HOUR (mdo.create_time) BETWEEN 0 AND 9 THEN '早上'
WHEN HOUR(mdo.create_time) BETWEEN 10 AND 15 THEN '中午'
WHEN HOUR(mdo.create_time) BETWEEN 16 AND 23 THEN '晚上'
ELSE '未知'
END AS timeSlot,
DATE_FORMAT(mdo.create_time, '%Y-%m-%d') as createTime
from member_dish_order mdo
left join member_user mu on mdo.user_id = mu.id
left join member_tag mt on mu.tag_ids = mt.id
where subsidy_amount > 0 and mdo.deleted = false
and mdo.store_id = #{carteenId}
and DATE_FORMAT(mdo.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</select>
</mapper> </mapper>