Merge remote-tracking branch 'origin/master'

This commit is contained in:
zenghuihuang 2025-01-16 18:27:54 +08:00
commit a4b6e2a515
16 changed files with 451 additions and 1 deletions

View File

@ -84,7 +84,10 @@ public class LeniuApiUtil {
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true); // 设置些属性是可以访问的
Object value = field.get(obj);
map.put(field.getName(), value);
if (StringUtils.isNotEmpty(value.toString())){
map.put(field.getName(), value);
}
}
} catch (Exception e) {
log.error("object转map失败");

View File

@ -0,0 +1,41 @@
package com.bonus.canteen.menu.controller;
import com.bonus.canteen.common.utils.LeniuApiUtil;
import com.bonus.canteen.menu.domain.dto.AppletWeekRecipeDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import static com.bonus.canteen.common.utils.NiuStaticUtils.siteurl;
@RestController
@RequestMapping({"/week/recipe"})
public class AppletRecipeV2Controller {
private static final Logger log = LoggerFactory.getLogger(AppletRecipeV2Controller.class);
@ApiOperation("菜谱信息查询(改动)")
@PostMapping({"/detail"})
public String getWeekRecipeDetailList(@RequestBody AppletWeekRecipeDTO appletWeekRecipeDTO) {
String api = siteurl + "/tengyun-api/leopen/recipe/query";
log.info("菜谱信息查询(改动){}",api);
HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(appletWeekRecipeDTO);
return LeniuApiUtil.callLeniuApi(api,bodyMap).body();
}
}

View File

@ -0,0 +1,31 @@
package com.bonus.canteen.menu.domain.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
public class AppletWeekRecipeDTO {
@ApiModelProperty("第三方菜谱id")
private String planId;
@ApiModelProperty("第三方食堂id")
private String thirdCanteenId;
@ApiModelProperty("第三方档口id")
private String thirdStallId;
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("开始日期")
private String startDate;
@ApiModelProperty("结束日期")
private String endDate;
}

View File

@ -0,0 +1,34 @@
package com.bonus.canteen.menu.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Optional;
@Data
@ApiModel("菜品详情(大小份)")
public class AppletCurrentDishesDetailVO {
@ApiModelProperty("菜品id")
private Long dishesId;
@ApiModelProperty("菜品名称")
private String dishesName;
@ApiModelProperty("库存数量")
private Integer surplusNum;
@ApiModelProperty("限购数量")
private Integer restrictNum;
@ApiModelProperty("菜品价格")
private Integer dishesPrice;
@ApiModelProperty("优惠价")
private Integer prefPrice;
@ApiModelProperty("规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
private Long sizeType;
@ApiModelProperty("菜品规格")
private String sizeJson;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("好评率")
private BigDecimal goodProbability;
}

View File

@ -0,0 +1,32 @@
package com.bonus.canteen.menu.domain.vo;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("菜品详情")
public class AppletWeekRecipeDishesVO {
@ApiModelProperty("菜品id")
private Long baseDishesId;
@ApiModelProperty("菜品名称")
private String dishesName;
@ApiModelProperty("菜品图片")
private String dishesImgUrl;
@ApiModelProperty("菜谱详情id")
private Long detailId;
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("大小份详情")
private List<AppletCurrentDishesDetailVO> dishesDetailList;
}

View File

@ -0,0 +1,19 @@
package com.bonus.canteen.menu.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("分类详情")
public class AppletWeekRecipeTypeVO {
@ApiModelProperty("菜品类别id")
private Long typeId;
@ApiModelProperty("菜品类别名称")
private String typeName;
@ApiModelProperty("菜品详情")
private List<AppletWeekRecipeDishesVO> dishesList;
}

View File

@ -0,0 +1,20 @@
package com.bonus.canteen.menu.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("获取一周菜谱详情")
public class AppletWeekRecipeVO {
@ApiModelProperty("餐次类型")
private Integer mealtimeType;
@ApiModelProperty("餐次名称")
private String mealtimeName;
@ApiModelProperty("分类详情")
private List<AppletWeekRecipeTypeVO> typeList;
}

View File

@ -0,0 +1,14 @@
package com.bonus.canteen.menu.mapper;
import com.bonus.canteen.menu.domain.vo.AppletWeekRecipeVO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
public interface MenuAppRecipeMapper {
List<Long> selectWeekRecipeId(@Param("recipeId") Long recipeId, @Param("effIdSet") Set<Long> effIdSet);
}

View File

@ -0,0 +1,20 @@
package com.bonus.canteen.menu.mapper;
import com.bonus.canteen.menu.domain.vo.AppletWeekRecipeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
@Mapper
public interface MenuRecipeMapper {
List<AppletWeekRecipeVO> selectWeekRecipe(@Param("applyDate") LocalDate applyDate, @Param("recipeId") Long recipeId, @Param("recipeIdList") List<Long> recipeIdList);
}

View File

@ -0,0 +1,23 @@
package com.bonus.canteen.menu.service;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.menu.domain.dto.AppletWeekRecipeDTO;
import com.bonus.canteen.menu.domain.vo.AppletWeekRecipeVO;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public interface MenuRecipeService {
String getWeekRecipeDetailList(AppletWeekRecipeDTO content);
}

View File

@ -0,0 +1,38 @@
package com.bonus.canteen.menu.service.impl;
import com.bonus.canteen.common.utils.LeniuApiUtil;
import com.bonus.canteen.menu.domain.dto.AppletWeekRecipeDTO;
import com.bonus.canteen.menu.service.MenuRecipeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@Service
public class MenuRecipeServiceImpl implements MenuRecipeService {
private static final Logger log = LoggerFactory.getLogger(MenuRecipeServiceImpl.class);
public String getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
/*
{
"startDate": "1992-04-17",
"endDate": "1973-04-07",
"planId": "17",
"canteenId": 81,
"thirdCanteenId": "8",
"thirdStallId": "20",
"stallId": 26
}
//传参
HashMap<String, Object> bodyMap = new HashMap<>();
bodyMap.put("pageSize", 2);
bodyMap.put("pageNum", 1);
return LeniuApiUtil.callLeniuApi(recipequeryurl,bodyMap).body();*/
return null;
}
}

View File

@ -0,0 +1,52 @@
package com.bonus.canteen.pay.controller;
import com.bonus.canteen.common.utils.LeniuApiUtil;
import com.bonus.canteen.pay.domain.PayDeviceDTO;
import com.bonus.canteen.pay.domain.PayResDTO;
import com.bonus.canteen.pay.domain.RechargeResDTO;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import static com.bonus.canteen.common.utils.NiuStaticUtils.siteurl;
@RestController
@RequestMapping({"/leopen"})
public class PayController {
@ApiOperation("钱包余额查询")
@PostMapping({"/account/balance/query"})
public String getBalanceQuery(@RequestBody PayResDTO payResDTO) {
String api = siteurl + "/tengyun-api/leopen/account/balance/query";
HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(payResDTO);
return LeniuApiUtil.callLeniuApi(api,bodyMap).body();
}
@ApiOperation("钱包充值")
@PostMapping({"/account/charge"})
public String getAccountCharge(@RequestBody RechargeResDTO rechargeResDTO) {
String api = siteurl + "/tengyun-api/leopen/account/charge";
HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(rechargeResDTO);
return LeniuApiUtil.callLeniuApi(api,bodyMap).body();
}
@ApiOperation("下单支付(食堂)")
@PostMapping({"/pay/device"})
public String getPayDevice(@RequestBody PayDeviceDTO payDeviceDTO) {
String api = siteurl + "/tengyun-api/leopen/pay/device";
HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(payDeviceDTO);
return LeniuApiUtil.callLeniuApi(api,bodyMap).body();
}
}

View File

@ -0,0 +1,18 @@
package com.bonus.canteen.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrdDetailDTO {
@ApiModelProperty("商品类型 1菜品 2商品 3套餐 4按键金额")
private Number detailType;
@ApiModelProperty("商品名称")
private String goodsName;
@ApiModelProperty("价格")
private Number price;
@ApiModelProperty("数量/重量")
private Number quantity;
}

View File

@ -0,0 +1,51 @@
package com.bonus.canteen.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
@Data
public class PayDeviceDTO {
@ApiModelProperty("订单总金额 单位为分")
private Number amount;
@ApiModelProperty("二维码信息(小牛系统个人身份码) 扫码支付必传")
private String authCode;
@ApiModelProperty("人员id (身份支付二选一必填)")
private Long custId;
@ApiModelProperty("第三方人员id (身份支付二选一必填)")
private String custThirdId;
@ApiModelProperty("乐牛餐次号(默认使用ordTime所在餐次)")
private Number intervalId;
@ApiModelProperty("第三方订单流水号")
private String macOrdId;
@ApiModelProperty("乐牛设备SN码由该商户管理员在乐牛后台创建供open接口使用的设备虚拟设备提供设备sn号此设备若被删除则无法调用建议起名【open支付专用设备-xxx对接】")
private String machineSn;
@ApiModelProperty("核身方式 (1刷卡,2身份,3扫码)")
private Number nuClearMode;
@ApiModelProperty("下单时间 yyyy-MM-dd HH:mm:ss")
private String ordTime;
@ApiModelProperty("订单类型 1食堂 2商城10外部预定对支付过程不影响只是记录类型")
private Number ordType;
@ApiModelProperty("配送方式 1:自取堂食,2:商家配送,5:取餐柜配送,6:自取外带,7:取餐点配送")
private String deliveryType;
@ApiModelProperty("取餐柜id配送方式为5时必填")
private Number counterId;
@ApiModelProperty("配送费")
private Number deliveryFee;
@ApiModelProperty("支付方式")
private Number payType;
@ApiModelProperty("配送地址")
private String deliveryAddr;
@ApiModelProperty("订单备注")
private String remark;
@ApiModelProperty("预定日期仅在ordType=10时有效")
private LocalDate reserveDate;
@ApiModelProperty("卡序列号(物理卡号) 刷卡支付必传")
private String serialNum;
@ApiModelProperty("订单详情")
private List<OrdDetailDTO> ordDetailList;
}

View File

@ -0,0 +1,14 @@
package com.bonus.canteen.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PayResDTO {
@ApiModelProperty("人员id (以此为唯一标识)custId和custThirdId二选一")
private Long custId;
@ApiModelProperty("第三方人员id")
private String custThirdId;
}

View File

@ -0,0 +1,40 @@
package com.bonus.canteen.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class RechargeResDTO {
/**
* 账户交易类型 (支付渠道+支付方式为一组) 二者选择一个 账户交易类型存在值 优先走账户交易类型
*/
@ApiModelProperty("账户交易类型 8微信扫码充值 9支付宝扫码充值 10现金充值")
private Integer accTradeType;
@ApiModelProperty("钱包类型 1个人钱包2补贴钱包")
private Integer accType;
/**
* custId和custThirdId二选一
*/
@ApiModelProperty("人员id (以此为唯一标识)")
private Long custId;
/**
* custId和custThirdId二选一
*/
@ApiModelProperty("第三方人员id (以此为唯一标识)")
private String custThirdId;
@ApiModelProperty("支付渠道(详情见支付渠道code-名称对照表)")
private Integer payChannel;
@ApiModelProperty("支付方式(详情见支付方式code-名称对照表)")
private Integer payType;
@ApiModelProperty("充值金额(单位分)")
private Integer rechargeAmount;
@ApiModelProperty("充值备注")
private String remark;
@ApiModelProperty("第三方充值订单号")
private String thirdRechargeNum;
}