diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/common/utils/LeniuApiUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/common/utils/LeniuApiUtil.java index e8b6e34..e409b1a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/common/utils/LeniuApiUtil.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/common/utils/LeniuApiUtil.java @@ -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失败"); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/controller/AppletRecipeV2Controller.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/controller/AppletRecipeV2Controller.java new file mode 100644 index 0000000..dfd280d --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/controller/AppletRecipeV2Controller.java @@ -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 bodyMap = (HashMap) LeniuApiUtil.convertObjectToMap(appletWeekRecipeDTO); + return LeniuApiUtil.callLeniuApi(api,bodyMap).body(); + } + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/dto/AppletWeekRecipeDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/dto/AppletWeekRecipeDTO.java new file mode 100644 index 0000000..7d0164b --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/dto/AppletWeekRecipeDTO.java @@ -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; + + + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletCurrentDishesDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletCurrentDishesDetailVO.java new file mode 100644 index 0000000..e29629c --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletCurrentDishesDetailVO.java @@ -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; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeDishesVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeDishesVO.java new file mode 100644 index 0000000..cf7dd88 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeDishesVO.java @@ -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 dishesDetailList; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeTypeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeTypeVO.java new file mode 100644 index 0000000..a487d69 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeTypeVO.java @@ -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 dishesList; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeVO.java new file mode 100644 index 0000000..de9be32 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/domain/vo/AppletWeekRecipeVO.java @@ -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 typeList; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuAppRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuAppRecipeMapper.java new file mode 100644 index 0000000..90242b1 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuAppRecipeMapper.java @@ -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 selectWeekRecipeId(@Param("recipeId") Long recipeId, @Param("effIdSet") Set effIdSet); + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuRecipeMapper.java new file mode 100644 index 0000000..e79e019 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/mapper/MenuRecipeMapper.java @@ -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 selectWeekRecipe(@Param("applyDate") LocalDate applyDate, @Param("recipeId") Long recipeId, @Param("recipeIdList") List recipeIdList); + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/MenuRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/MenuRecipeService.java new file mode 100644 index 0000000..21b841c --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/MenuRecipeService.java @@ -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); + + + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/impl/MenuRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/impl/MenuRecipeServiceImpl.java new file mode 100644 index 0000000..2defbbe --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/menu/service/impl/MenuRecipeServiceImpl.java @@ -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 bodyMap = new HashMap<>(); + bodyMap.put("pageSize", 2); + bodyMap.put("pageNum", 1); + return LeniuApiUtil.callLeniuApi(recipequeryurl,bodyMap).body();*/ + return null; + } + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/controller/PayController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/controller/PayController.java new file mode 100644 index 0000000..a91ab0c --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/controller/PayController.java @@ -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 bodyMap = (HashMap) 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 bodyMap = (HashMap) 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 bodyMap = (HashMap) LeniuApiUtil.convertObjectToMap(payDeviceDTO); + return LeniuApiUtil.callLeniuApi(api,bodyMap).body(); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/OrdDetailDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/OrdDetailDTO.java new file mode 100644 index 0000000..51b7d60 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/OrdDetailDTO.java @@ -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; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayDeviceDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayDeviceDTO.java new file mode 100644 index 0000000..7248c44 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayDeviceDTO.java @@ -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 ordDetailList; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayResDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayResDTO.java new file mode 100644 index 0000000..1d17bbf --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/PayResDTO.java @@ -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; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/RechargeResDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/RechargeResDTO.java new file mode 100644 index 0000000..cfe66a9 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/pay/domain/RechargeResDTO.java @@ -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; +}