Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
68fdd4f485
|
|
@ -255,6 +255,12 @@
|
|||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.23</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.bonus.common.houqin.mq.rabbit;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.alibaba.nacos.common.utils.MapUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bonus.canteen.core.menu.controller;
|
||||
|
||||
import com.bonus.canteen.core.menu.dto.AppletDishesDetailDTO;
|
||||
import com.bonus.canteen.core.menu.dto.AppletWeekCanteenDTO;
|
||||
import com.bonus.canteen.core.menu.service.AppletRecipeH5Service;
|
||||
import com.bonus.canteen.core.menu.vo.AppletDishesDetailVO;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 static com.bonus.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/4/15 16:31
|
||||
*/
|
||||
//@RestController
|
||||
@RequestMapping("/api/applet/menurecipe")
|
||||
public class AppletRecipeH5Controller extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private AppletRecipeH5Service appletRecipeH5Service;
|
||||
|
||||
|
||||
@PostMapping({"/list/week/canteen"})
|
||||
@ApiOperation("获取一周菜谱食堂列表")
|
||||
public AjaxResult getWeekMealList(@RequestBody AppletWeekCanteenDTO appletWeekCanteenDTO) {
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(appletWeekCanteenDTO.getUserId()))){
|
||||
return AjaxResult.error("客户id不能为空");
|
||||
}
|
||||
return AjaxResult.success(this.appletRecipeH5Service.getWeekMealList(appletWeekCanteenDTO));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("获取一周菜谱食堂列表失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/detail"})
|
||||
@ApiOperation("根据菜品id获取菜品详情")
|
||||
public AjaxResult getRecipeDetail(@RequestBody AppletDishesDetailDTO dto) {
|
||||
AppletDishesDetailVO dishesDetailVO = this.appletRecipeH5Service.getDishesDetailByDishesId(dto);
|
||||
return success(dishesDetailVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.canteen.core.menu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bonus.canteen.core.menu.domain.MenuMaterial;
|
||||
import com.bonus.canteen.core.menu.dto.DrpUnitPageDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuDishesTypeAddDTO;
|
||||
import com.bonus.canteen.core.menu.service.MenuDishesTypeService;
|
||||
import com.bonus.canteen.core.menu.vo.DrpUnitPageVO;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
|
|
@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
|
|
@ -55,4 +60,11 @@ public class MenuDishesTypeController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/getDrpUnit"})
|
||||
@ApiOperation("获取计量单位")
|
||||
public AjaxResult getDrpUnitPage(@RequestBody DrpUnitPageDTO dto) {
|
||||
List<DrpUnitPageVO> resultPage = menuDishesTypeService.getDrpUnitPage(dto);
|
||||
return AjaxResult.success(resultPage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ public class MenuNutritionController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "获取食材营养基础信息详细信息")
|
||||
//@RequiresPermissions("menu:nutrition:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(menuNutritionService.selectMenuNutritionById(id));
|
||||
@PostMapping(value = "/getInfo")
|
||||
public AjaxResult getInfo(@RequestBody MenuNutritionDTO menuNutrition) {
|
||||
return success(menuNutritionService.selectMenuNutritionById(menuNutrition.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AppletDishesDetailDTO implements Serializable {
|
||||
@ApiModelProperty("客户id")
|
||||
private Long custId;
|
||||
@ApiModelProperty("菜谱详情id")
|
||||
private Long detailId;
|
||||
@ApiModelProperty("菜品id")
|
||||
private Long baseDishesId;
|
||||
@ApiModelProperty("是否删除(1删除,2未删除)")
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppletWeekCanteenDTO {
|
||||
@ApiModelProperty("人员id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import com.bonus.canteen.core.utils.SysUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("获取一周菜谱食堂列表")
|
||||
public class AppletWeekCanteenVO {
|
||||
@ApiModelProperty("菜谱id")
|
||||
@JsonFormat(
|
||||
shape = JsonFormat.Shape.STRING
|
||||
)
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("档口名称")
|
||||
private String stallName;
|
||||
@ApiModelProperty("食堂名称")
|
||||
private String canteenName;
|
||||
@ApiModelProperty("食堂图片")
|
||||
private String canteenImgUrl;
|
||||
@ApiModelProperty("档口图片")
|
||||
private String stallImgUrl;
|
||||
@ApiModelProperty("档口标签")
|
||||
private List<String> labelList;
|
||||
|
||||
public String getCanteenImgUrl() {
|
||||
return SysUtil.getCutFileUrl(this.canteenImgUrl);
|
||||
}
|
||||
|
||||
public String getStallImgUrl() {
|
||||
return SysUtil.getCutFileUrl(this.stallImgUrl);
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return this.stallName;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return this.canteenName;
|
||||
}
|
||||
|
||||
public List<String> getLabelList() {
|
||||
return this.labelList;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setStallName(final String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public void setCanteenName(final String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public void setCanteenImgUrl(final String canteenImgUrl) {
|
||||
this.canteenImgUrl = canteenImgUrl;
|
||||
}
|
||||
|
||||
public void setStallImgUrl(final String stallImgUrl) {
|
||||
this.stallImgUrl = stallImgUrl;
|
||||
}
|
||||
|
||||
public void setLabelList(final List<String> labelList) {
|
||||
this.labelList = labelList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DrpUnitPageDTO {
|
||||
@ApiModelProperty("计量单位id")
|
||||
private Long unitId;
|
||||
@ApiModelProperty("计量单位名称")
|
||||
private String unitName;
|
||||
@ApiModelProperty("单位类型(1-按份,2-称重)")
|
||||
private Integer weighType;
|
||||
@ApiModelProperty("区域ID")
|
||||
private Long areaId;
|
||||
private List<Long> areaAuth;
|
||||
@ApiModelProperty("是否列表使用(1是)")
|
||||
private Integer ifListUse;
|
||||
|
||||
public Long getUnitId() {
|
||||
return this.unitId;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return this.unitName;
|
||||
}
|
||||
|
||||
public Integer getWeighType() {
|
||||
return this.weighType;
|
||||
}
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public List<Long> getAreaAuth() {
|
||||
return this.areaAuth;
|
||||
}
|
||||
|
||||
public Integer getIfListUse() {
|
||||
return this.ifListUse;
|
||||
}
|
||||
|
||||
public void setUnitId(final Long unitId) {
|
||||
this.unitId = unitId;
|
||||
}
|
||||
|
||||
public void setUnitName(final String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public void setWeighType(final Integer weighType) {
|
||||
this.weighType = weighType;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaAuth(final List<Long> areaAuth) {
|
||||
this.areaAuth = areaAuth;
|
||||
}
|
||||
|
||||
public void setIfListUse(final Integer ifListUse) {
|
||||
this.ifListUse = ifListUse;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public enum MgrRoleTypeV2Enum {
|
||||
ROLE_ADMIN(1, "全数据类"),
|
||||
ROLE_ORG(2, "组织类"),
|
||||
ROLE_MERCHANT(3, "商户/仓库类");
|
||||
|
||||
private final Integer key;
|
||||
private final String value;
|
||||
|
||||
public static MgrRoleTypeV2Enum getEnumByKey(Integer key) {
|
||||
MgrRoleTypeV2Enum[] var1 = values();
|
||||
int var2 = var1.length;
|
||||
|
||||
for(int var3 = 0; var3 < var2; ++var3) {
|
||||
MgrRoleTypeV2Enum roleType = var1[var3];
|
||||
if (Objects.equals(roleType.key, key)) {
|
||||
return roleType;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private MgrRoleTypeV2Enum(final Integer key, final String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// $FF: synthetic method
|
||||
private static MgrRoleTypeV2Enum[] $values() {
|
||||
return new MgrRoleTypeV2Enum[]{ROLE_ADMIN, ROLE_ORG, ROLE_MERCHANT};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public enum MktEffTypeEnum {
|
||||
USER_SORT(1, "人员类"),
|
||||
CANTEEN_SORT(2, "食堂类"),
|
||||
PRODUCT_SORT(3, "商品类"),
|
||||
WAREHOUSE_SORT(4, "仓库类");
|
||||
|
||||
private final Integer key;
|
||||
private final String value;
|
||||
|
||||
MktEffTypeEnum(Integer key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static Integer getKey(String value) {
|
||||
MktEffTypeEnum[] mktEffTypeEnums = values();
|
||||
MktEffTypeEnum[] var2 = mktEffTypeEnums;
|
||||
int var3 = mktEffTypeEnums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
MktEffTypeEnum mktEffTypeEnum = var2[var4];
|
||||
if (mktEffTypeEnum.value().equals(value)) {
|
||||
return mktEffTypeEnum.key();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getValue(Integer key) {
|
||||
MktEffTypeEnum[] mktEffTypeEnums = values();
|
||||
MktEffTypeEnum[] var2 = mktEffTypeEnums;
|
||||
int var3 = mktEffTypeEnums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
MktEffTypeEnum mktEffTypeEnum = var2[var4];
|
||||
if (mktEffTypeEnum.key().equals(key)) {
|
||||
return mktEffTypeEnum.value();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public enum MktUserTypeEnum {
|
||||
INTERSECTION(1, "交集"),
|
||||
UNION_SET(2, "并集");
|
||||
|
||||
private final Integer key;
|
||||
private final String value;
|
||||
|
||||
MktUserTypeEnum(Integer key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public enum RoleCodeV2Enum {
|
||||
ROLE_SUPER_ADMIN("ROLE_ADMIN", "管理员"),
|
||||
ROLE_ADMIN("ROLE_ADMIN", "全数据类"),
|
||||
ROLE_ORG("ROLE_ORG", "组织类"),
|
||||
ROLE_MERCHANT("ROLE_MERCHANT", "商户/仓库类");
|
||||
|
||||
private final String key;
|
||||
private final String value;
|
||||
|
||||
private RoleCodeV2Enum(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getKey(String value) {
|
||||
RoleCodeV2Enum[] roleCodeEnums = values();
|
||||
RoleCodeV2Enum[] var2 = roleCodeEnums;
|
||||
int var3 = roleCodeEnums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
RoleCodeV2Enum roleCodeEnum = var2[var4];
|
||||
if (roleCodeEnum.value().equals(value)) {
|
||||
return roleCodeEnum.key();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getValue(String key) {
|
||||
RoleCodeV2Enum[] roleCodeEnums = values();
|
||||
RoleCodeV2Enum[] var2 = roleCodeEnums;
|
||||
int var3 = roleCodeEnums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
RoleCodeV2Enum roleCodeEnum = var2[var4];
|
||||
if (roleCodeEnum.key().equals(key)) {
|
||||
return roleCodeEnum.value();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Map<String, String>> getAllEnumsList() {
|
||||
RoleCodeV2Enum[] roleCodeEnums = values();
|
||||
List<Map<String, String>> roleCodeList = new ArrayList();
|
||||
RoleCodeV2Enum[] var2 = roleCodeEnums;
|
||||
int var3 = roleCodeEnums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
RoleCodeV2Enum roleCodeEnum = var2[var4];
|
||||
Map<String, String> roleCodeMap = new HashMap();
|
||||
roleCodeMap.put("key", roleCodeEnum.key);
|
||||
roleCodeMap.put("value", roleCodeEnum.value);
|
||||
roleCodeList.add(roleCodeMap);
|
||||
}
|
||||
|
||||
return roleCodeList;
|
||||
}
|
||||
|
||||
public String key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
// $FF: synthetic method
|
||||
private static RoleCodeV2Enum[] $values() {
|
||||
return new RoleCodeV2Enum[]{ROLE_SUPER_ADMIN, ROLE_ADMIN, ROLE_ORG, ROLE_MERCHANT};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.canteen.core.menu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.android.vo.UserInfoVo;
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishesType;
|
||||
import com.bonus.canteen.core.menu.dto.AppletDishesDetailDTO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletDishesDetailVO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家食材原料信息Mapper接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface AppletRecipeH5Mapper {
|
||||
|
||||
|
||||
UserInfoVo selectMessageByUserId(UserInfoVo userInfoVo);
|
||||
|
||||
List<AppletWeekCanteenVO> selectWeekCanteenList();
|
||||
|
||||
AppletDishesDetailVO selectDishesDetailByDishesId(AppletDishesDetailDTO dishesDetailDTO);
|
||||
}
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
package com.bonus.canteen.core.menu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishesType;
|
||||
import com.bonus.canteen.core.menu.domain.MenuMaterial;
|
||||
import com.bonus.canteen.core.menu.dto.DrpUnitPageDTO;
|
||||
import com.bonus.canteen.core.menu.po.MgrUserAuthPO;
|
||||
import com.bonus.canteen.core.menu.vo.DrpUnitPageVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -17,4 +22,8 @@ public interface MenuDishesTypeMapper extends BaseMapper<MenuDishesType> {
|
|||
|
||||
List<MenuDishesTypeAllVO> getAllMenuDishesTypeList();
|
||||
|
||||
List<DrpUnitPageVO> selectAllList(DrpUnitPageDTO dto);
|
||||
|
||||
|
||||
List<Long> getTenantAreaIdList(@Param("excludeMiddle") Integer excludeMiddle, @Param("authPO") MgrUserAuthPO mgrUserAuthPO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.device.domain.DeviceInfo;
|
||||
import com.bonus.canteen.core.menu.domain.MenuAppRecipe;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bonus.canteen.core.alloc.domain.AllocCanteen;
|
||||
|
|
@ -196,4 +197,5 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
@Select({"select * from menu_recipe_dishes ${ew.customSqlSegment}"})
|
||||
List<MenuRecipeDishes> selectMenuRecipeDishList(@Param("ew") Wrapper<MenuRecipeDishes> wrapper);
|
||||
|
||||
List<String> getSnByCanteenId(Long canteenId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.canteen.core.menu.service;
|
||||
|
||||
import com.bonus.canteen.core.menu.dto.AppletDishesDetailDTO;
|
||||
import com.bonus.canteen.core.menu.dto.AppletWeekCanteenDTO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletDishesDetailVO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/4/15 16:37
|
||||
*/
|
||||
public interface AppletRecipeH5Service {
|
||||
|
||||
List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO appletWeekCanteenDTO);
|
||||
Set<Long> getShopstallIdListByCustId(Long custId, boolean checkCustInfo);
|
||||
|
||||
AppletDishesDetailVO getDishesDetailByDishesId(AppletDishesDetailDTO dto);
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.canteen.core.menu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishesType;
|
||||
import com.bonus.canteen.core.menu.dto.DrpUnitPageDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuDishesTypeAddDTO;
|
||||
import com.bonus.canteen.core.menu.vo.DrpUnitPageVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -17,4 +20,6 @@ public interface MenuDishesTypeService extends IService<MenuDishesType> {
|
|||
List<MenuDishesTypeAllVO> getAllMenuDishesTypeList();
|
||||
|
||||
int addMenuDishesType(MenuDishesTypeAddDTO content);
|
||||
|
||||
List<DrpUnitPageVO> getDrpUnitPage(DrpUnitPageDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
package com.bonus.canteen.core.menu.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bonus.canteen.core.android.vo.UserInfoVo;
|
||||
import com.bonus.canteen.core.menu.dto.AppletDishesDetailDTO;
|
||||
import com.bonus.canteen.core.menu.dto.AppletWeekCanteenDTO;
|
||||
import com.bonus.canteen.core.menu.enums.MktEffTypeEnum;
|
||||
import com.bonus.canteen.core.menu.enums.MktUserTypeEnum;
|
||||
import com.bonus.canteen.core.menu.mapper.AppletRecipeH5Mapper;
|
||||
import com.bonus.canteen.core.menu.mapper.MenuDishesMapper;
|
||||
import com.bonus.canteen.core.menu.service.AppletRecipeH5Service;
|
||||
import com.bonus.canteen.core.menu.vo.AppletDishesDetailVO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletDishesSizeV2VO;
|
||||
import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO;
|
||||
import com.bonus.canteen.core.menu.vo.MktEffectiveUserVO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.DelFlagEnum;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/4/15 16:38
|
||||
*/
|
||||
@Service
|
||||
public class AppletRecipeH5ServiceImpl implements AppletRecipeH5Service {
|
||||
|
||||
@Resource
|
||||
private AppletRecipeH5Mapper appletRecipeH5Mapper;
|
||||
|
||||
@Override
|
||||
public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) {
|
||||
//人员范围 暂时不用
|
||||
// Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getUserId(), false);
|
||||
// if (ObjectUtil.isEmpty(effIdSet)) {
|
||||
// effIdSet = Sets.newTreeSet();
|
||||
// effIdSet.add(-1L);
|
||||
// }
|
||||
|
||||
// return this.menuAppRecipeMapper.selectWeekCanteenList();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getShopstallIdListByCustId(Long custId, boolean checkCustInfo) {
|
||||
Set<Long> effIdSet = Sets.newTreeSet();
|
||||
// UserInfoVo userInfoVo = new UserInfoVo();
|
||||
// userInfoVo.setUserId(String.valueOf(custId));
|
||||
// userInfoVo.setAccStatus("1");
|
||||
// UserInfoVo custInfo = menuAppRecipeMapper.selectMessageByUserId(userInfoVo);
|
||||
// if (ObjectUtil.isNull(custInfo)) {
|
||||
// if (checkCustInfo) {
|
||||
// throw new ServiceException("菜单绑定错误");
|
||||
// } else {
|
||||
// throw new ServiceException("***[获取全档口菜谱信息]_未查询到人员信息,直接返回********************");
|
||||
// return effIdSet;
|
||||
// }
|
||||
// } else {
|
||||
// List<MktEffectiveUserVO> effectiveUserVOList = menuRecipeMapper.selectAllUserEff(MktEffTypeEnum.USER_SORT.key(), DelFlagEnum.DEL_FALSE.key());
|
||||
// Long orgId = custInfo.getOrgId();
|
||||
// Integer psnType = custInfo.getPsnType();
|
||||
// if (ObjectUtil.isNotEmpty(effectiveUserVOList)) {
|
||||
// List<MktEffectiveUserVO> collect = effectiveUserVOList.stream().filter((u) -> {
|
||||
// boolean containsOrg = ObjectUtil.isNotEmpty(u.getOrgIdList()) && u.getOrgIdList().contains(orgId);
|
||||
// boolean containsPsn = ObjectUtil.isNotEmpty(u.getPsnTypeList()) && u.getPsnTypeList().contains(psnType);
|
||||
// return MktUserTypeEnum.INTERSECTION.key().equals(u.getUserType()) && containsOrg && containsPsn || MktUserTypeEnum.UNION_SET.key().equals(u.getUserType()) && (containsOrg || containsPsn);
|
||||
// }).collect(Collectors.toList());
|
||||
// if (ObjectUtil.isNotEmpty(collect)) {
|
||||
// effIdSet = collect.stream().map(MktEffectiveUserVO::getEffId).collect(Collectors.toSet());
|
||||
// effIdSet.add(-1L);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("***[获取指定人员折扣比例]_指定人员的生效范围effIdSet: {}", effIdSet);
|
||||
// return effIdSet;
|
||||
// }
|
||||
return effIdSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppletDishesDetailVO getDishesDetailByDishesId(AppletDishesDetailDTO dishesDetailDTO) {
|
||||
dishesDetailDTO.setDelFlag(DelFlagEnum.DEL_FALSE.key());
|
||||
Long baseDishesId = dishesDetailDTO.getBaseDishesId();
|
||||
Long custId = dishesDetailDTO.getCustId();
|
||||
// if (!ObjectUtil.isNull(custId) && custId != -1L) {
|
||||
// AppletDishesDetailVO appletDishesDetailVO = menuAppRecipeMapper.selectDishesDetailByDishesId(dishesDetailDTO);
|
||||
// Long countDishes = this.menuCollectionDishesMapper.selectCount(Wrappers.lambdaQuery(MenuCollectionDishes.class)
|
||||
// .eq(MenuCollectionDishes::getCustId, custId).eq(MenuCollectionDishes::getDishesId, baseDishesId));
|
||||
// if (ObjectUtil.isNotNull(countDishes) && countDishes > 0L) {
|
||||
// appletDishesDetailVO.setIsFavorites(1);
|
||||
// } else {
|
||||
// appletDishesDetailVO.setIsFavorites(2);
|
||||
// }
|
||||
//
|
||||
// Long dishesId = ((AppletDishesSizeV2VO) appletDishesDetailVO.getDishesDetailList().get(0)).getDishesId();
|
||||
// List materialList;
|
||||
// if (appletDishesDetailVO.getMealType() == 1) {
|
||||
// materialList = this.menuMaterialDishesMapper.getMenuMaterialById(dishesId);
|
||||
// appletDishesDetailVO.setMaterialList(materialList);
|
||||
// } else {
|
||||
// materialList = this.menuPackageDishesMapper.selectDishesName(dishesId);
|
||||
// appletDishesDetailVO.setPackageDishesList(materialList);
|
||||
// }
|
||||
// return appletDishesDetailVO;
|
||||
// } else {
|
||||
// throw new ServiceException(I18n.getMessage("menu_no_cust_info", new Object[0]));
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ import com.bonus.canteen.core.menu.service.IMenuDishesService;
|
|||
import com.bonus.canteen.core.utils.Arith;
|
||||
import com.bonus.canteen.core.utils.NutritionEntity;
|
||||
import com.bonus.canteen.core.utils.NutritionEntityUtil;
|
||||
import com.bonus.canteen.core.utils.PinyinUtil;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
|
|
@ -72,6 +73,8 @@ public class MenuDishesServiceImpl implements IMenuDishesService {
|
|||
public int insertMenuDishes(MenuDishes menuDishes) {
|
||||
menuDishes.setCreateTime(LocalDateTime.now());
|
||||
try {
|
||||
menuDishes.setPinyinFull(PinyinUtil.getFirstLetterFromChinese(menuDishes.getDishesName()));
|
||||
menuDishes.setPinyinFull(PinyinUtil.convertChineseToPinyin(menuDishes.getDishesName()));
|
||||
return menuDishesMapper.insertMenuDishes(menuDishes);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
|
|
|
|||
|
|
@ -2,22 +2,35 @@ package com.bonus.canteen.core.menu.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.menu.dto.DrpUnitPageDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuDishesTypeAddDTO;
|
||||
import com.bonus.canteen.core.menu.enums.MgrRoleTypeV2Enum;
|
||||
import com.bonus.canteen.core.menu.enums.RoleCodeV2Enum;
|
||||
import com.bonus.canteen.core.menu.mapper.MenuDishesTypeMapper;
|
||||
import com.bonus.canteen.core.menu.po.MgrUserAuthPO;
|
||||
import com.bonus.canteen.core.menu.service.MenuDishesTypeService;
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishesType;
|
||||
import com.bonus.canteen.core.menu.vo.DrpUnitPageVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO;
|
||||
import com.bonus.canteen.core.utils.BnsConstants;
|
||||
import com.bonus.canteen.core.utils.GlobalConstants;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.DelFlagEnum;
|
||||
import com.bonus.common.houqin.constant.LeConstants;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
|
|
@ -41,7 +54,7 @@ public class MenuDishesTypeServiceImpl extends ServiceImpl<MenuDishesTypeMapper
|
|||
.eq(MenuDishesType::getTypeName, content.getTypeName())
|
||||
.eq(MenuDishesType::getDelFlag, DelFlagEnum.DEL_FALSE.key()));
|
||||
if (CollUtil.isNotEmpty(cookList)) {
|
||||
throw new ServiceException(I18n.getMessage("menu_type_name_repeat", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("菜品已存在", new Object[0]));
|
||||
} else {
|
||||
String username = SecurityUtils.getUsername();
|
||||
MenuDishesType dishesType = new MenuDishesType();
|
||||
|
|
@ -51,4 +64,54 @@ public class MenuDishesTypeServiceImpl extends ServiceImpl<MenuDishesTypeMapper
|
|||
return this.baseMapper.insert(dishesType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DrpUnitPageVO> getDrpUnitPage(DrpUnitPageDTO dto) {
|
||||
// dto.setAreaAuth(getTenantAreaIdList(BnsConstants.COMMON_YES));
|
||||
return menuDishesTypeMapper.selectAllList(dto);
|
||||
}
|
||||
|
||||
public List<Long> getTenantAreaIdList(Integer excludeMiddle) {
|
||||
MgrUserAuthPO mgrUserAuthPO = this.getUserAuthPO();
|
||||
return ObjectUtil.equal(mgrUserAuthPO.getRoleType(), LeConstants.DATA_DEFAULT_INTEGER) ? CollUtil.newArrayList(new Long[0]) : this.menuDishesTypeMapper.getTenantAreaIdList(excludeMiddle, mgrUserAuthPO);
|
||||
}
|
||||
|
||||
public MgrUserAuthPO getUserAuthPO() {
|
||||
MgrUserAuthPO userAuthPO = new MgrUserAuthPO();
|
||||
LoginUser user = SecurityUtils.getLoginUser();
|
||||
user.setUserid(SecurityUtils.getUserId());
|
||||
user.setUsername(SecurityUtils.getUsername());
|
||||
Set<String> roleSet = user.getRoles();
|
||||
if (CollectionUtils.isEmpty(roleSet)) {
|
||||
throw new ServiceException(I18n.getMessage("auth_user_no_role_code", new Object[0]));
|
||||
}
|
||||
Integer roleType = null;
|
||||
String roleCodeResult = null;
|
||||
// for (String roleCode : roleSet) {
|
||||
// roleCodeResult = roleCode;
|
||||
// if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) || GlobalConstants.SUPER_ADMIN_ROLE_KEY.equals(roleCode)) {
|
||||
// roleType = MgrRoleTypeV2Enum.ROLE_ADMIN.getKey();
|
||||
//// if (CharSequenceUtil.split(roleCode, "&&").size() > 1) {
|
||||
//// roleType = MgrRoleTypeV2Enum.ROLE_ADMIN.getKey();
|
||||
//// } else {
|
||||
//// roleType = LeConstants.DATA_DEFAULT_INTEGER;
|
||||
//// }
|
||||
// break;
|
||||
// } else if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ORG.key())) {
|
||||
// roleType = MgrRoleTypeV2Enum.ROLE_ORG.getKey();
|
||||
// break;
|
||||
// } else {
|
||||
// if (!roleCode.startsWith(RoleCodeV2Enum.ROLE_MERCHANT.key())) {
|
||||
// throw new ServiceException(I18n.getMessage("auth_role_type_error", new Object[0]));
|
||||
// }
|
||||
// roleType = MgrRoleTypeV2Enum.ROLE_MERCHANT.getKey();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
userAuthPO.setUserId(user.getUserid());
|
||||
userAuthPO.setRoleType(roleType);
|
||||
userAuthPO.setRoleCode(roleCodeResult);
|
||||
userAuthPO.setUserName(user.getUsername());
|
||||
return userAuthPO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,11 @@ public class MenuMaterialCategoryServiceImpl extends ServiceImpl<MenuMaterialCat
|
|||
if(one != null){
|
||||
throw new ServiceException(I18n.getMessage("修改物品已存在!", new Object[0]));
|
||||
}
|
||||
return menuMaterialCategoryMapper.updateMenuMaterialCategory(menuMaterialCategory);
|
||||
int num = menuMaterialCategoryMapper.updateMenuMaterialCategory(menuMaterialCategory);
|
||||
if(num >0){
|
||||
this.generateCategoryNum(menuMaterialCategory.getCategoryId(), menuMaterialCategory.getParentId(), menuMaterialCategory.getCategoryType());
|
||||
}
|
||||
return num;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(""+e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ public class MenuNutritionServiceImpl implements IMenuNutritionService {
|
|||
*/
|
||||
@Override
|
||||
public MenuNutrition selectMenuNutritionById(Long id) {
|
||||
return menuNutritionMapper.selectMenuNutritionById(id);
|
||||
MenuNutrition menuNutrition = menuNutritionMapper.selectMenuNutritionById(id);
|
||||
return menuNutrition;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -595,13 +595,24 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
return menuSendByDTO;
|
||||
}).collect(Collectors.toList());
|
||||
//TODO 发送mq
|
||||
// this.deviceApi.sendMenuByCanteen(result.getRecipeId(), menuSendByDTOS);
|
||||
// this.deviceApi.sendMenuByCanteen(result.getRecipeId(), menuSendByDTOS);
|
||||
// MqUtil.pushToSingleTxDevice((new DeviceMqSendUpdateConfigDto()).setNeedupdate(LeConstants.COMMON_YES), LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, machineSn);
|
||||
}
|
||||
}
|
||||
|
||||
MqUtil.sendDataChange(menuRecipe, type, LeMqConstant.Topic.DATA_CHANGE_RECIPE);
|
||||
redisKey = String.format("yst:%s:recipe:%s:detail:%s", TenantContextHolder.getTenantId(), result.getRecipeId(), "*");
|
||||
RedisUtil.deleteByPattern(redisKey);
|
||||
//sendMq(menuRecipe);
|
||||
}
|
||||
|
||||
private void sendMq(MenuRecipe menuRecipe) {
|
||||
List<String> deviceInfos = menuRecipeMapper.getSnByCanteenId(menuRecipe.getCanteenId());
|
||||
if (ObjectUtil.isNotEmpty(deviceInfos)) {
|
||||
deviceInfos.forEach((s) -> {
|
||||
DeviceMqMessage.deviceUpdateMenuConfigV4(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public RecipeProcessResult processDefault(MenuRecipeAddDTO content, Long recipeId) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,130 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import com.bonus.canteen.core.utils.SysUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("小程序菜品详情")
|
||||
public class AppletDishesDetailVO {
|
||||
@ApiModelProperty("菜品id")
|
||||
private Long baseDishesId;
|
||||
@ApiModelProperty("类型(1-菜品,2-套餐)")
|
||||
private Integer mealType;
|
||||
@ApiModelProperty("自定义id")
|
||||
private Long customId;
|
||||
@ApiModelProperty("菜品名称")
|
||||
private String dishesName;
|
||||
@ApiModelProperty("菜品别称")
|
||||
private String aliasName;
|
||||
@ApiModelProperty("菜品图片url")
|
||||
private String imageUrl;
|
||||
@ApiModelProperty("菜品简介")
|
||||
private String intro;
|
||||
@ApiModelProperty("菜品详情")
|
||||
private String particulars;
|
||||
@ApiModelProperty("是否收藏(1-收藏,2-未收藏)")
|
||||
private Integer isFavorites;
|
||||
@ApiModelProperty("菜品规格")
|
||||
private List<AppletDishesSizeV2VO> dishesDetailList;
|
||||
List<MenuMaterialBasVO> materialList;
|
||||
@ApiModelProperty("套餐菜品明细")
|
||||
private List<String> packageDishesList;
|
||||
|
||||
public String getImageUrl() {
|
||||
return SysUtil.getCutFileUrl(this.imageUrl);
|
||||
}
|
||||
|
||||
public Long getBaseDishesId() {
|
||||
return this.baseDishesId;
|
||||
}
|
||||
|
||||
public Integer getMealType() {
|
||||
return this.mealType;
|
||||
}
|
||||
|
||||
public Long getCustomId() {
|
||||
return this.customId;
|
||||
}
|
||||
|
||||
public String getDishesName() {
|
||||
return this.dishesName;
|
||||
}
|
||||
|
||||
public String getAliasName() {
|
||||
return this.aliasName;
|
||||
}
|
||||
|
||||
public String getIntro() {
|
||||
return this.intro;
|
||||
}
|
||||
|
||||
public String getParticulars() {
|
||||
return this.particulars;
|
||||
}
|
||||
|
||||
public Integer getIsFavorites() {
|
||||
return this.isFavorites;
|
||||
}
|
||||
|
||||
public List<AppletDishesSizeV2VO> getDishesDetailList() {
|
||||
return this.dishesDetailList;
|
||||
}
|
||||
|
||||
public List<MenuMaterialBasVO> getMaterialList() {
|
||||
return this.materialList;
|
||||
}
|
||||
|
||||
public List<String> getPackageDishesList() {
|
||||
return this.packageDishesList;
|
||||
}
|
||||
|
||||
public void setBaseDishesId(final Long baseDishesId) {
|
||||
this.baseDishesId = baseDishesId;
|
||||
}
|
||||
|
||||
public void setMealType(final Integer mealType) {
|
||||
this.mealType = mealType;
|
||||
}
|
||||
|
||||
public void setCustomId(final Long customId) {
|
||||
this.customId = customId;
|
||||
}
|
||||
|
||||
public void setDishesName(final String dishesName) {
|
||||
this.dishesName = dishesName;
|
||||
}
|
||||
|
||||
public void setAliasName(final String aliasName) {
|
||||
this.aliasName = aliasName;
|
||||
}
|
||||
|
||||
public void setImageUrl(final String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public void setIntro(final String intro) {
|
||||
this.intro = intro;
|
||||
}
|
||||
|
||||
public void setParticulars(final String particulars) {
|
||||
this.particulars = particulars;
|
||||
}
|
||||
|
||||
public void setIsFavorites(final Integer isFavorites) {
|
||||
this.isFavorites = isFavorites;
|
||||
}
|
||||
|
||||
public void setDishesDetailList(final List<AppletDishesSizeV2VO> dishesDetailList) {
|
||||
this.dishesDetailList = dishesDetailList;
|
||||
}
|
||||
|
||||
public void setMaterialList(final List<MenuMaterialBasVO> materialList) {
|
||||
this.materialList = materialList;
|
||||
}
|
||||
|
||||
public void setPackageDishesList(final List<String> packageDishesList) {
|
||||
this.packageDishesList = packageDishesList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import com.bonus.canteen.core.utils.BigDecimalSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Optional;
|
||||
|
||||
@ApiModel("菜品详情(大小份)")
|
||||
public class AppletDishesSizeV2VO {
|
||||
@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;
|
||||
@ApiModelProperty("热量(千卡/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal calories;
|
||||
@ApiModelProperty("蛋白质(g/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal protein;
|
||||
@ApiModelProperty("脂肪(g/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal fat;
|
||||
@ApiModelProperty("碳水化合物(g/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal carbohydrate;
|
||||
@ApiModelProperty("膳食纤维(g/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal dietaryFiber;
|
||||
@ApiModelProperty("胆固醇(mg/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal cholesterol;
|
||||
@ApiModelProperty("钙(mg/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal calcium;
|
||||
@ApiModelProperty("钠(mg/100g)")
|
||||
@JsonSerialize(
|
||||
using = BigDecimalSerializer.class
|
||||
)
|
||||
private BigDecimal sodium;
|
||||
@ApiModelProperty("热量NRV(千卡/100g)")
|
||||
private BigDecimal caloriesNrv;
|
||||
@ApiModelProperty("蛋白质NRV(g/100g)")
|
||||
private BigDecimal proteinNrv;
|
||||
@ApiModelProperty("脂肪NRV(g/100g)")
|
||||
private BigDecimal fatNrv;
|
||||
@ApiModelProperty("碳水化合物NRV(g/100g)")
|
||||
private BigDecimal carbohydrateNrv;
|
||||
@ApiModelProperty("膳食纤维NRV(g/100g)")
|
||||
private BigDecimal dietaryFiberNrv;
|
||||
@ApiModelProperty("胆固醇NRV(mg/100g)")
|
||||
private BigDecimal cholesterolNrv;
|
||||
@ApiModelProperty("钙NRV(mg/100g)")
|
||||
private BigDecimal calciumNrv;
|
||||
@ApiModelProperty("钠NRV(mg/100g)")
|
||||
private BigDecimal sodiumNrv;
|
||||
|
||||
public Integer getMonthlySales() {
|
||||
return (Integer)Optional.ofNullable(this.monthlySales).orElse(0);
|
||||
}
|
||||
|
||||
public BigDecimal getGoodProbability() {
|
||||
return (BigDecimal)Optional.ofNullable(this.goodProbability).orElse(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
public Long getSizeType() {
|
||||
return (Long)Optional.ofNullable(this.sizeType).orElse(1L);
|
||||
}
|
||||
|
||||
public BigDecimal getCaloriesNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.calories).orElse(BigDecimal.ZERO)).multiply(new BigDecimal("4.185")).divide(new BigDecimal("8400"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getProteinNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.protein).orElse(BigDecimal.ZERO)).divide(new BigDecimal("60"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getFatNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.fat).orElse(BigDecimal.ZERO)).divide(new BigDecimal("60"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getCarbohydrateNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.carbohydrate).orElse(BigDecimal.ZERO)).divide(new BigDecimal("300"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getDietaryFiberNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.dietaryFiber).orElse(BigDecimal.ZERO)).divide(new BigDecimal("25"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getCholesterolNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.cholesterol).orElse(BigDecimal.ZERO)).divide(new BigDecimal("300"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getCalciumNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.calcium).orElse(BigDecimal.ZERO)).divide(new BigDecimal("800"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public BigDecimal getSodiumNrv() {
|
||||
return ((BigDecimal)Optional.ofNullable(this.sodium).orElse(BigDecimal.ZERO)).divide(new BigDecimal("2000"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
public Long getDishesId() {
|
||||
return this.dishesId;
|
||||
}
|
||||
|
||||
public String getDishesName() {
|
||||
return this.dishesName;
|
||||
}
|
||||
|
||||
public Integer getSurplusNum() {
|
||||
return this.surplusNum;
|
||||
}
|
||||
|
||||
public Integer getRestrictNum() {
|
||||
return this.restrictNum;
|
||||
}
|
||||
|
||||
public Integer getDishesPrice() {
|
||||
return this.dishesPrice;
|
||||
}
|
||||
|
||||
public Integer getPrefPrice() {
|
||||
return this.prefPrice;
|
||||
}
|
||||
|
||||
public String getSizeJson() {
|
||||
return this.sizeJson;
|
||||
}
|
||||
|
||||
public BigDecimal getCalories() {
|
||||
return this.calories;
|
||||
}
|
||||
|
||||
public BigDecimal getProtein() {
|
||||
return this.protein;
|
||||
}
|
||||
|
||||
public BigDecimal getFat() {
|
||||
return this.fat;
|
||||
}
|
||||
|
||||
public BigDecimal getCarbohydrate() {
|
||||
return this.carbohydrate;
|
||||
}
|
||||
|
||||
public BigDecimal getDietaryFiber() {
|
||||
return this.dietaryFiber;
|
||||
}
|
||||
|
||||
public BigDecimal getCholesterol() {
|
||||
return this.cholesterol;
|
||||
}
|
||||
|
||||
public BigDecimal getCalcium() {
|
||||
return this.calcium;
|
||||
}
|
||||
|
||||
public BigDecimal getSodium() {
|
||||
return this.sodium;
|
||||
}
|
||||
|
||||
public void setDishesId(final Long dishesId) {
|
||||
this.dishesId = dishesId;
|
||||
}
|
||||
|
||||
public void setDishesName(final String dishesName) {
|
||||
this.dishesName = dishesName;
|
||||
}
|
||||
|
||||
public void setSurplusNum(final Integer surplusNum) {
|
||||
this.surplusNum = surplusNum;
|
||||
}
|
||||
|
||||
public void setRestrictNum(final Integer restrictNum) {
|
||||
this.restrictNum = restrictNum;
|
||||
}
|
||||
|
||||
public void setDishesPrice(final Integer dishesPrice) {
|
||||
this.dishesPrice = dishesPrice;
|
||||
}
|
||||
|
||||
public void setPrefPrice(final Integer prefPrice) {
|
||||
this.prefPrice = prefPrice;
|
||||
}
|
||||
|
||||
public void setSizeType(final Long sizeType) {
|
||||
this.sizeType = sizeType;
|
||||
}
|
||||
|
||||
public void setSizeJson(final String sizeJson) {
|
||||
this.sizeJson = sizeJson;
|
||||
}
|
||||
|
||||
public void setMonthlySales(final Integer monthlySales) {
|
||||
this.monthlySales = monthlySales;
|
||||
}
|
||||
|
||||
public void setGoodProbability(final BigDecimal goodProbability) {
|
||||
this.goodProbability = goodProbability;
|
||||
}
|
||||
|
||||
public void setCalories(final BigDecimal calories) {
|
||||
this.calories = calories;
|
||||
}
|
||||
|
||||
public void setProtein(final BigDecimal protein) {
|
||||
this.protein = protein;
|
||||
}
|
||||
|
||||
public void setFat(final BigDecimal fat) {
|
||||
this.fat = fat;
|
||||
}
|
||||
|
||||
public void setCarbohydrate(final BigDecimal carbohydrate) {
|
||||
this.carbohydrate = carbohydrate;
|
||||
}
|
||||
|
||||
public void setDietaryFiber(final BigDecimal dietaryFiber) {
|
||||
this.dietaryFiber = dietaryFiber;
|
||||
}
|
||||
|
||||
public void setCholesterol(final BigDecimal cholesterol) {
|
||||
this.cholesterol = cholesterol;
|
||||
}
|
||||
|
||||
public void setCalcium(final BigDecimal calcium) {
|
||||
this.calcium = calcium;
|
||||
}
|
||||
|
||||
public void setSodium(final BigDecimal sodium) {
|
||||
this.sodium = sodium;
|
||||
}
|
||||
|
||||
public void setCaloriesNrv(final BigDecimal caloriesNrv) {
|
||||
this.caloriesNrv = caloriesNrv;
|
||||
}
|
||||
|
||||
public void setProteinNrv(final BigDecimal proteinNrv) {
|
||||
this.proteinNrv = proteinNrv;
|
||||
}
|
||||
|
||||
public void setFatNrv(final BigDecimal fatNrv) {
|
||||
this.fatNrv = fatNrv;
|
||||
}
|
||||
|
||||
public void setCarbohydrateNrv(final BigDecimal carbohydrateNrv) {
|
||||
this.carbohydrateNrv = carbohydrateNrv;
|
||||
}
|
||||
|
||||
public void setDietaryFiberNrv(final BigDecimal dietaryFiberNrv) {
|
||||
this.dietaryFiberNrv = dietaryFiberNrv;
|
||||
}
|
||||
|
||||
public void setCholesterolNrv(final BigDecimal cholesterolNrv) {
|
||||
this.cholesterolNrv = cholesterolNrv;
|
||||
}
|
||||
|
||||
public void setCalciumNrv(final BigDecimal calciumNrv) {
|
||||
this.calciumNrv = calciumNrv;
|
||||
}
|
||||
|
||||
public void setSodiumNrv(final BigDecimal sodiumNrv) {
|
||||
this.sodiumNrv = sodiumNrv;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import com.bonus.canteen.core.utils.SysUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("获取一周菜谱食堂列表")
|
||||
public class AppletWeekCanteenVO {
|
||||
@ApiModelProperty("菜谱id")
|
||||
@JsonFormat(
|
||||
shape = JsonFormat.Shape.STRING
|
||||
)
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("档口名称")
|
||||
private String stallName;
|
||||
@ApiModelProperty("食堂名称")
|
||||
private String canteenName;
|
||||
@ApiModelProperty("食堂图片")
|
||||
private String canteenImgUrl;
|
||||
@ApiModelProperty("档口图片")
|
||||
private String stallImgUrl;
|
||||
@ApiModelProperty("档口标签")
|
||||
private List<String> labelList;
|
||||
|
||||
public String getCanteenImgUrl() {
|
||||
return SysUtil.getCutFileUrl(this.canteenImgUrl);
|
||||
}
|
||||
|
||||
public String getStallImgUrl() {
|
||||
return SysUtil.getCutFileUrl(this.stallImgUrl);
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return this.stallName;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return this.canteenName;
|
||||
}
|
||||
|
||||
public List<String> getLabelList() {
|
||||
return this.labelList;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setStallName(final String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public void setCanteenName(final String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public void setCanteenImgUrl(final String canteenImgUrl) {
|
||||
this.canteenImgUrl = canteenImgUrl;
|
||||
}
|
||||
|
||||
public void setStallImgUrl(final String stallImgUrl) {
|
||||
this.stallImgUrl = stallImgUrl;
|
||||
}
|
||||
|
||||
public void setLabelList(final List<String> labelList) {
|
||||
this.labelList = labelList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ApiModel
|
||||
public class DrpUnitPageVO {
|
||||
@ApiModelProperty("计量单位id")
|
||||
private Long unitId;
|
||||
@ApiModelProperty("计量单位名称")
|
||||
private String unitName;
|
||||
@ApiModelProperty("换算比率(换算成?g)")
|
||||
private BigDecimal rate;
|
||||
@ApiModelProperty("单位类型(1-按份,2-称重)")
|
||||
private Integer weighType;
|
||||
@ApiModelProperty("创建人")
|
||||
private String crby;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime crtime;
|
||||
@ApiModelProperty("更新人")
|
||||
private String upby;
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime uptime;
|
||||
@ApiModelProperty("所属区域id")
|
||||
private Long areaId;
|
||||
@ApiModelProperty("所属区域")
|
||||
private String areaName;
|
||||
|
||||
public Long getUnitId() {
|
||||
return this.unitId;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return this.unitName;
|
||||
}
|
||||
|
||||
public BigDecimal getRate() {
|
||||
return this.rate;
|
||||
}
|
||||
|
||||
public Integer getWeighType() {
|
||||
return this.weighType;
|
||||
}
|
||||
|
||||
public String getCrby() {
|
||||
return this.crby;
|
||||
}
|
||||
|
||||
public LocalDateTime getCrtime() {
|
||||
return this.crtime;
|
||||
}
|
||||
|
||||
public String getUpby() {
|
||||
return this.upby;
|
||||
}
|
||||
|
||||
public LocalDateTime getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return this.areaName;
|
||||
}
|
||||
|
||||
public void setUnitId(final Long unitId) {
|
||||
this.unitId = unitId;
|
||||
}
|
||||
|
||||
public void setUnitName(final String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public void setRate(final BigDecimal rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public void setWeighType(final Integer weighType) {
|
||||
this.weighType = weighType;
|
||||
}
|
||||
|
||||
public void setCrby(final String crby) {
|
||||
this.crby = crby;
|
||||
}
|
||||
|
||||
public void setCrtime(final LocalDateTime crtime) {
|
||||
this.crtime = crtime;
|
||||
}
|
||||
|
||||
public void setUpby(final String upby) {
|
||||
this.upby = upby;
|
||||
}
|
||||
|
||||
public void setUptime(final LocalDateTime uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaName(final String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import com.bonus.canteen.core.utils.SysUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("菜品标签分页返回")
|
||||
public class MenuMaterialBasVO implements Serializable {
|
||||
@ApiModelProperty("食材id")
|
||||
private Long materialId;
|
||||
@ApiModelProperty("食材名称")
|
||||
private String materialName;
|
||||
@ApiModelProperty("原料编号")
|
||||
private String materialCode;
|
||||
@ApiModelProperty("食材重量(g)")
|
||||
private Double weight;
|
||||
@ApiModelProperty("材料类型(1主料,2辅料,3配料)")
|
||||
private Integer materialType;
|
||||
@ApiModelProperty("大类")
|
||||
private String bigType;
|
||||
@ApiModelProperty("小类")
|
||||
private String littleType;
|
||||
@ApiModelProperty("原料图片")
|
||||
private String imageUrl;
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = SysUtil.getCutPath(imageUrl);
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return SysUtil.getCutFileUrl(this.imageUrl);
|
||||
}
|
||||
|
||||
public Long getMaterialId() {
|
||||
return this.materialId;
|
||||
}
|
||||
|
||||
public String getMaterialName() {
|
||||
return this.materialName;
|
||||
}
|
||||
|
||||
public String getMaterialCode() {
|
||||
return this.materialCode;
|
||||
}
|
||||
|
||||
public Double getWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
|
||||
public Integer getMaterialType() {
|
||||
return this.materialType;
|
||||
}
|
||||
|
||||
public String getBigType() {
|
||||
return this.bigType;
|
||||
}
|
||||
|
||||
public String getLittleType() {
|
||||
return this.littleType;
|
||||
}
|
||||
|
||||
public void setMaterialId(final Long materialId) {
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public void setMaterialName(final String materialName) {
|
||||
this.materialName = materialName;
|
||||
}
|
||||
|
||||
public void setMaterialCode(final String materialCode) {
|
||||
this.materialCode = materialCode;
|
||||
}
|
||||
|
||||
public void setWeight(final Double weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public void setMaterialType(final Integer materialType) {
|
||||
this.materialType = materialType;
|
||||
}
|
||||
|
||||
public void setBigType(final String bigType) {
|
||||
this.bigType = bigType;
|
||||
}
|
||||
|
||||
public void setLittleType(final String littleType) {
|
||||
this.littleType = littleType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
@Data
|
||||
public class MktEffectiveUserVO implements Serializable {
|
||||
private Long effId;
|
||||
private Integer userType;
|
||||
private List<Long> orgIdList;
|
||||
private List<Integer> psnTypeList;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.canteen.core.utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class BigDecimalSerializer extends JsonSerializer<BigDecimal> {
|
||||
@Override
|
||||
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value != null) {
|
||||
BigDecimal number = value.setScale(2, RoundingMode.HALF_UP);
|
||||
gen.writeNumber(number);
|
||||
} else {
|
||||
gen.writeNumber(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.bonus.canteen.core.utils;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.bonus.canteen.core.common.utils.SpringContextHolder;
|
||||
import com.bonus.canteen.core.utils.oos.OssProperties;
|
||||
import com.bonus.canteen.core.utils.oos.OssTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class SysUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysUtil.class);
|
||||
@Value("${system.sysfile.prefixOffline}")
|
||||
private String prefixOffline;
|
||||
@Value("${system.sysfile.bucket}")
|
||||
private String prefixBucket;
|
||||
@Value("${system.sysfile.prefixOnline}")
|
||||
private String prefixOnline;
|
||||
private static final SysUtilProxy sysUtilProxy = new SysUtilProxy();
|
||||
private static String prefixOn;
|
||||
private static String bucket;
|
||||
private static String prefixOff;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
prefixOn = this.prefixOnline;
|
||||
bucket = this.prefixBucket;
|
||||
prefixOff = this.prefixOffline;
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return sysUtilProxy.getPrefix(prefixOn, prefixOff);
|
||||
}
|
||||
|
||||
public static String getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public static String getCutFileUrl(String fileUrl) {
|
||||
log.info("出参_补图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
|
||||
String cutFileUrl = null;
|
||||
try {
|
||||
cutFileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket());
|
||||
} catch (Exception e) {
|
||||
log.error("获取存储桶图片地址失败, " + e.getMessage());
|
||||
cutFileUrl = fileUrl;
|
||||
}
|
||||
log.info("出参_补图_补图后路径:{}", cutFileUrl);
|
||||
return cutFileUrl;
|
||||
}
|
||||
|
||||
public static String getCutPath(String fileUrl) {
|
||||
log.info("入参_裁图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
|
||||
if (!CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getBucket())) {
|
||||
if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
|
||||
return fileUrl.replace(getPrefix(), getBucket());
|
||||
} else {
|
||||
fileUrl = getUnEncodeUrl(fileUrl);
|
||||
fileUrl = fileUrl.replace(getPrefix(), getBucket());
|
||||
fileUrl = getCutSignUrl(fileUrl);
|
||||
log.info("入参_裁图_裁剪后路径:{}", fileUrl);
|
||||
return fileUrl;
|
||||
}
|
||||
} else {
|
||||
return fileUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCutPathMulti(String fileUrl) {
|
||||
return CharSequenceUtil.contains(fileUrl, ",") ? (String)CharSequenceUtil.split(fileUrl, ",", true, true).stream().map(SysUtil::getCutPath).collect(Collectors.joining(",")) : getCutPath(fileUrl);
|
||||
}
|
||||
|
||||
public static String getFilePath(String fileUrl) {
|
||||
if (CharSequenceUtil.isBlank(fileUrl)) {
|
||||
return fileUrl;
|
||||
} else {
|
||||
String cutPath = getCutPath(fileUrl);
|
||||
return cutPath.replace(getBucket(), "");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getObjectName(String fileUrl) {
|
||||
if (CharSequenceUtil.isBlank(fileUrl)) {
|
||||
return fileUrl;
|
||||
} else {
|
||||
String cutPath = getCutPath(fileUrl);
|
||||
String replace = cutPath.replace(getBucket(), "");
|
||||
if (CharSequenceUtil.startWith(replace, "/")) {
|
||||
replace = replace.substring(1);
|
||||
}
|
||||
|
||||
return replace;
|
||||
}
|
||||
}
|
||||
|
||||
public static OssTemplate getOssTemplate() {
|
||||
return (OssTemplate) SpringContextHolder.getBean(OssTemplate.class);
|
||||
}
|
||||
|
||||
public static OssProperties getOssProperties() {
|
||||
return (OssProperties)SpringContextHolder.getBean(OssProperties.class);
|
||||
}
|
||||
|
||||
public static String getUnEncodeUrl(String url) {
|
||||
if (CharSequenceUtil.isBlank(url)) {
|
||||
return url;
|
||||
} else {
|
||||
try {
|
||||
String decodedUrl = URLDecoder.decode(url, String.valueOf(StandardCharsets.UTF_8));
|
||||
return !decodedUrl.equals(url) ? decodedUrl : url;
|
||||
} catch (IllegalArgumentException var2) {
|
||||
log.info("图片url解码失败,图片url:{},异常信息_:{},详情_:", new Object[]{url, var2.getMessage(), var2});
|
||||
return url;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCutSignUrl(String fileUrl) {
|
||||
return CharSequenceUtil.isNotBlank(fileUrl) && fileUrl.contains("?") ? fileUrl.substring(0, fileUrl.indexOf("?")) : fileUrl;
|
||||
}
|
||||
|
||||
public static String getCutFileUrl(String fileUrl, String filePrefix, String prefixBucket) {
|
||||
if (CharSequenceUtil.isBlank(fileUrl)) {
|
||||
return fileUrl;
|
||||
} else if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
|
||||
return !fileUrl.startsWith("http") && !fileUrl.startsWith("https") ? fileUrl.replace(prefixBucket, filePrefix) : fileUrl;
|
||||
} else {
|
||||
if (fileUrl.startsWith("http") || fileUrl.startsWith("https")) {
|
||||
fileUrl = fileUrl.replace(filePrefix + "/", "");
|
||||
}
|
||||
|
||||
fileUrl = getCutSignUrl(fileUrl);
|
||||
fileUrl = fileUrl.replace(prefixBucket + "/", "");
|
||||
return getOssTemplate().getObjectURL(prefixBucket, fileUrl, getOssProperties().getExpiresTime());
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeOssObject(String fileUrl) {
|
||||
if (!CharSequenceUtil.isBlank(fileUrl)) {
|
||||
OssTemplate ossTemplate = (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
|
||||
OssProperties ossProperties = (OssProperties)SpringContextHolder.getBean(OssProperties.class);
|
||||
|
||||
try {
|
||||
ossTemplate.removeObject(ossProperties.getBucketName(), getObjectName(fileUrl));
|
||||
} catch (Exception var4) {
|
||||
log.error("路径:{}删除异常:{}", new Object[]{fileUrl, var4.getMessage(), var4});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.canteen.core.utils;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SysUtilProxy {
|
||||
public String getPrefix(String prefixOn, String prefixOff) {
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
String headerValue = request.getHeader("X-Env");
|
||||
return "online".equals(headerValue) ? prefixOn : prefixOff;
|
||||
} else {
|
||||
return prefixOff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.canteen.core.utils.oos;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@EnableConfigurationProperties({OssProperties.class})
|
||||
//@AutoConfiguration
|
||||
@Configuration
|
||||
public class OssAutoConfiguration {
|
||||
private final OssProperties properties;
|
||||
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean({OssTemplate.class})
|
||||
// @ConditionalOnProperty(
|
||||
// name = {"oss.enable"},
|
||||
// havingValue = "true",
|
||||
// matchIfMissing = true
|
||||
// )
|
||||
public OssTemplate ossTemplate() {
|
||||
return new OssTemplate(this.properties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(
|
||||
name = {"oss.info"},
|
||||
havingValue = "true"
|
||||
)
|
||||
public OssEndpoint ossEndpoint(OssTemplate template) {
|
||||
return new OssEndpoint(template);
|
||||
}
|
||||
|
||||
public OssAutoConfiguration(final OssProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package com.bonus.canteen.core.utils.oos;
|
||||
|
||||
import com.amazonaws.services.s3.model.Bucket;
|
||||
import com.amazonaws.services.s3.model.S3Object;
|
||||
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//@RestController
|
||||
@RequestMapping({"/oss"})
|
||||
public class OssEndpoint {
|
||||
private final OssTemplate template;
|
||||
|
||||
@PostMapping({"/bucket/{bucketName}"})
|
||||
public Bucket createBucker(@PathVariable String bucketName) {
|
||||
try {
|
||||
this.template.createBucket(bucketName);
|
||||
return (Bucket)this.template.getBucket(bucketName).get();
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
@GetMapping({"/bucket"})
|
||||
public List<Bucket> getBuckets() {
|
||||
try {
|
||||
return this.template.getAllBuckets();
|
||||
} catch (Throwable var2) {
|
||||
throw var2;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/bucket/{bucketName}"})
|
||||
public Bucket getBucket(@PathVariable String bucketName) {
|
||||
try {
|
||||
return (Bucket)this.template.getBucket(bucketName).orElseThrow(() -> {
|
||||
return new IllegalArgumentException("Bucket Name not found!");
|
||||
});
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping({"/bucket/{bucketName}"})
|
||||
@ResponseStatus(HttpStatus.ACCEPTED)
|
||||
public void deleteBucket(@PathVariable String bucketName) {
|
||||
try {
|
||||
this.template.removeBucket(bucketName);
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@PostMapping({"/object/{bucketName}"})
|
||||
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) {
|
||||
try {
|
||||
String name = object.getOriginalFilename();
|
||||
this.template.putObject(bucketName, name, object.getInputStream(), object.getSize(), object.getContentType());
|
||||
return this.template.getObjectInfo(bucketName, name);
|
||||
} catch (Throwable var4) {
|
||||
throw var4;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@PostMapping({"/object/{bucketName}/{objectName}"})
|
||||
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName, @PathVariable String objectName) {
|
||||
try {
|
||||
this.template.putObject(bucketName, objectName, object.getInputStream(), object.getSize(), object.getContentType());
|
||||
return this.template.getObjectInfo(bucketName, objectName);
|
||||
} catch (Throwable var5) {
|
||||
throw var5;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/object/{bucketName}/{objectName}"})
|
||||
public List<S3ObjectSummary> filterObject(@PathVariable String bucketName, @PathVariable String objectName) {
|
||||
try {
|
||||
return this.template.getAllObjectsByPrefix(bucketName, objectName, true);
|
||||
} catch (Throwable var4) {
|
||||
throw var4;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/object/{bucketName}/{objectName}/{expires}"})
|
||||
public Map<String, Object> getObject(@PathVariable String bucketName, @PathVariable String objectName, @PathVariable Integer expires) {
|
||||
try {
|
||||
Map<String, Object> responseBody = new HashMap(8);
|
||||
responseBody.put("bucket", bucketName);
|
||||
responseBody.put("object", objectName);
|
||||
responseBody.put("url", this.template.getObjectURL(bucketName, objectName, expires));
|
||||
responseBody.put("expires", expires);
|
||||
return responseBody;
|
||||
} catch (Throwable var5) {
|
||||
throw var5;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@ResponseStatus(HttpStatus.ACCEPTED)
|
||||
@DeleteMapping({"/object/{bucketName}/{objectName}/"})
|
||||
public void deleteObject(@PathVariable String bucketName, @PathVariable String objectName) {
|
||||
try {
|
||||
this.template.removeObject(bucketName, objectName);
|
||||
} catch (Throwable var4) {
|
||||
throw var4;
|
||||
}
|
||||
}
|
||||
|
||||
public OssEndpoint(final OssTemplate template) {
|
||||
this.template = template;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.bonus.canteen.core.utils.oos;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Component
|
||||
@ConfigurationProperties(
|
||||
prefix = "oss"
|
||||
)
|
||||
public class OssProperties {
|
||||
private String endpoint;
|
||||
private String customDomain;
|
||||
private Boolean pathStyleAccess = true;
|
||||
private String appId;
|
||||
private String region;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
private String bucketName = "lnyst";
|
||||
private Boolean useHttp = false;
|
||||
private Integer expiresTime = 604800;
|
||||
private Boolean useToken = false;
|
||||
|
||||
public String getEndpoint() {
|
||||
return this.endpoint;
|
||||
}
|
||||
|
||||
public String getCustomDomain() {
|
||||
return this.customDomain;
|
||||
}
|
||||
|
||||
public Boolean getPathStyleAccess() {
|
||||
return this.pathStyleAccess;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return this.appId;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return this.region;
|
||||
}
|
||||
|
||||
public String getAccessKey() {
|
||||
return this.accessKey;
|
||||
}
|
||||
|
||||
public String getSecretKey() {
|
||||
return this.secretKey;
|
||||
}
|
||||
|
||||
public String getBucketName() {
|
||||
return this.bucketName;
|
||||
}
|
||||
|
||||
public Boolean getUseHttp() {
|
||||
return this.useHttp;
|
||||
}
|
||||
|
||||
public Integer getExpiresTime() {
|
||||
return this.expiresTime;
|
||||
}
|
||||
|
||||
public Boolean getUseToken() {
|
||||
return this.useToken;
|
||||
}
|
||||
|
||||
public void setEndpoint(final String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
public void setCustomDomain(final String customDomain) {
|
||||
this.customDomain = customDomain;
|
||||
}
|
||||
|
||||
public void setPathStyleAccess(final Boolean pathStyleAccess) {
|
||||
this.pathStyleAccess = pathStyleAccess;
|
||||
}
|
||||
|
||||
public void setAppId(final String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public void setRegion(final String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public void setAccessKey(final String accessKey) {
|
||||
this.accessKey = accessKey;
|
||||
}
|
||||
|
||||
public void setSecretKey(final String secretKey) {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public void setBucketName(final String bucketName) {
|
||||
this.bucketName = bucketName;
|
||||
}
|
||||
|
||||
public void setUseHttp(final Boolean useHttp) {
|
||||
this.useHttp = useHttp;
|
||||
}
|
||||
|
||||
public void setExpiresTime(final Integer expiresTime) {
|
||||
this.expiresTime = expiresTime;
|
||||
}
|
||||
|
||||
public void setUseToken(final Boolean useToken) {
|
||||
this.useToken = useToken;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
package com.bonus.canteen.core.utils.oos;
|
||||
|
||||
import com.amazonaws.ClientConfiguration;
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.AWSCredentialsProvider;
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3Client;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.model.*;
|
||||
import com.amazonaws.util.IOUtils;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class OssTemplate implements InitializingBean {
|
||||
private final OssProperties ossProperties;
|
||||
private AmazonS3 amazonS3;
|
||||
|
||||
public void createBucket(String bucketName) {
|
||||
try {
|
||||
if (!this.amazonS3.doesBucketExistV2(bucketName)) {
|
||||
this.amazonS3.createBucket(bucketName);
|
||||
}
|
||||
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Bucket> getAllBuckets() {
|
||||
try {
|
||||
return this.amazonS3.listBuckets();
|
||||
} catch (Throwable var2) {
|
||||
throw var2;
|
||||
}
|
||||
}
|
||||
|
||||
public Optional<Bucket> getBucket(String bucketName) {
|
||||
try {
|
||||
return this.amazonS3.listBuckets().stream().filter((b) -> {
|
||||
return b.getName().equals(bucketName);
|
||||
}).findFirst();
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeBucket(String bucketName) {
|
||||
try {
|
||||
this.amazonS3.deleteBucket(bucketName);
|
||||
} catch (Throwable var3) {
|
||||
throw var3;
|
||||
}
|
||||
}
|
||||
|
||||
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
|
||||
try {
|
||||
ObjectListing objectListing = this.amazonS3.listObjects(bucketName, prefix);
|
||||
return new ArrayList(objectListing.getObjectSummaries());
|
||||
} catch (Throwable var5) {
|
||||
throw var5;
|
||||
}
|
||||
}
|
||||
|
||||
public CopyObjectResult copyObject(String bucketName, String objectName, String destbucketName, String destobjectName) {
|
||||
try {
|
||||
CopyObjectResult copyObjectResult = this.amazonS3.copyObject(bucketName, objectName, destbucketName, destobjectName);
|
||||
return copyObjectResult;
|
||||
} catch (Throwable var6) {
|
||||
throw var6;
|
||||
}
|
||||
}
|
||||
|
||||
public String getObjectURL(String bucketName, String objectName, Integer expires) {
|
||||
try {
|
||||
Date date = new Date();
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(date);
|
||||
calendar.add(13, expires);
|
||||
URL url = this.amazonS3.generatePresignedUrl(bucketName, objectName, calendar.getTime());
|
||||
return url.toString();
|
||||
} catch (Throwable var7) {
|
||||
throw var7;
|
||||
}
|
||||
}
|
||||
|
||||
public InputStream getObject(String bucketName, String objectName) {
|
||||
try {
|
||||
return this.amazonS3.getObject(bucketName, objectName).getObjectContent();
|
||||
} catch (Throwable var4) {
|
||||
throw var4;
|
||||
}
|
||||
}
|
||||
|
||||
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
|
||||
this.putObject(bucketName, objectName, stream, (long) stream.available(), "application/octet-stream");
|
||||
}
|
||||
|
||||
public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size, String contextType) throws Exception {
|
||||
byte[] bytes = IOUtils.toByteArray(stream);
|
||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||
objectMetadata.setContentLength(size);
|
||||
objectMetadata.setContentType(contextType);
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||
return this.amazonS3.putObject(bucketName, objectName, byteArrayInputStream, objectMetadata);
|
||||
}
|
||||
|
||||
public S3Object getObjectInfo(String bucketName, String objectName) throws Exception {
|
||||
return this.amazonS3.getObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
public void removeObject(String bucketName, String objectName) throws Exception {
|
||||
this.amazonS3.deleteObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(this.ossProperties.getEndpoint(), this.ossProperties.getRegion());
|
||||
AWSCredentials awsCredentials = new BasicAWSCredentials(this.ossProperties.getAccessKey(), this.ossProperties.getSecretKey());
|
||||
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
|
||||
if (this.ossProperties.getUseHttp()) {
|
||||
System.setProperty("com.amazonaws.sdk.disableCertChecking", "true");
|
||||
}
|
||||
|
||||
this.amazonS3 = (AmazonS3) ((AmazonS3ClientBuilder) ((AmazonS3ClientBuilder) ((AmazonS3ClientBuilder) ((AmazonS3ClientBuilder) ((AmazonS3ClientBuilder) AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)).withClientConfiguration(clientConfiguration)).withCredentials(awsCredentialsProvider)).disableChunkedEncoding()).withPathStyleAccessEnabled(this.ossProperties.getPathStyleAccess())).build();
|
||||
}
|
||||
|
||||
public OssTemplate(final OssProperties ossProperties) {
|
||||
this.ossProperties = ossProperties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -364,11 +364,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteAccInfoByUserId" parameterType="Long">
|
||||
update acc_info set del_flag = '2' where user_id = #{userId}
|
||||
update acc_info set del_flag = '1' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAccInfoByIds" parameterType="String">
|
||||
update acc_info set del_flag = '2' where acc_id in
|
||||
update acc_info set del_flag = '1' where acc_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{accId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -109,11 +109,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<delete id="deleteAccWalletInfoByUserId" parameterType="Long">
|
||||
update acc_wallet_info set del_flag = '2' where user_id = #{userId}
|
||||
update acc_wallet_info set del_flag = '1' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAccWalletInfoByUserIds" parameterType="String">
|
||||
update acc_wallet_info set del_flag = '2' where user_id in
|
||||
update acc_wallet_info set del_flag = '1' where user_id in
|
||||
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
<?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.menu.mapper.AppletRecipeH5Mapper">
|
||||
|
||||
|
||||
|
||||
<select id="selectMessageByUserId" resultType="com.bonus.canteen.core.android.vo.UserInfoVo" parameterType="com.bonus.canteen.core.android.vo.UserInfoVo">
|
||||
select dept_id as org_id, is_built_in
|
||||
from sys_user
|
||||
where user_id =#{userId}
|
||||
</select>
|
||||
|
||||
<resultMap id="appletWeekCanteenVO" type="com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO">
|
||||
<result property="recipeId" column="recipe_id"/>
|
||||
<result property="stallName" column="stall_name"/>
|
||||
<result property="canteenName" column="canteen_name"/>
|
||||
<result property="canteenImgUrl" column="canteen_img_url"/>
|
||||
<result property="stallImgUrl" column="stall_img_url"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectWeekCanteenList" resultMap="appletWeekCanteenVO">
|
||||
|
||||
select
|
||||
mr.recipe_id,
|
||||
ass.stall_name,
|
||||
ac.canteen_name,
|
||||
ac.img_url as canteen_img_url,
|
||||
ass.img_url as stall_img_url
|
||||
from
|
||||
menu_app_recipe mar
|
||||
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
|
||||
left join alloc_stall ass on mr.stall_id = ass.stall_id
|
||||
where
|
||||
bind_type = 3
|
||||
</select>
|
||||
|
||||
<resultMap id="appletDishesDetailVO" type="com.bonus.canteen.core.menu.vo.AppletDishesDetailVO">
|
||||
<result property="baseDishesId" column="base_dishes_id"/>
|
||||
<result property="mealType" column="meal_type"/>
|
||||
<result property="customId" column="custom_d"/>
|
||||
<result property="dishesName" column="dishes_name"/>
|
||||
<result property="aliasName" column="alias_name"/>
|
||||
<result property="imageUrl" column="image_url"/>
|
||||
<result property="intro" column="intro"/>
|
||||
<result property="particulars" column="particulars"/>
|
||||
<collection property="dishesDetailList" ofType="com.bonus.canteen.core.menu.vo.AppletDishesSizeV2VO">
|
||||
<result property="dishesId" column="dishes_id"/>
|
||||
<result property="dishesName" column="real_dishes_name"/>
|
||||
<result property="surplusNum" column="surplus_num"/>
|
||||
<result property="restrictNum" column="restrict_num"/>
|
||||
<result property="dishesPrice" column="dishes_price"/>
|
||||
<result property="prefPrice" column="pref_price"/>
|
||||
<result property="sizeType" column="size_type"/>
|
||||
<result property="sizeJson" column="size_json"/>
|
||||
<result property="calories" column="calories"/>
|
||||
<result property="protein" column="protein"/>
|
||||
<result property="fat" column="fat"/>
|
||||
<result property="carbohydrate" column="carbohydrate"/>
|
||||
<result property="dietaryFiber" column="dietary_fiber"/>
|
||||
<result property="cholesterol" column="cholesterol"/>
|
||||
<result property="calcium" column="calcium"/>
|
||||
<result property="sodium" column="sodium"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDishesDetailByDishesId" resultMap="appletDishesDetailVO" >
|
||||
select
|
||||
mdb.base_dishes_id,
|
||||
md.dishes_id,
|
||||
md.meal_type,
|
||||
md.custom_id,
|
||||
mdb.dishes_name,
|
||||
md.dishes_name as real_dishes_name,
|
||||
md.alias_name,
|
||||
md.image_url,
|
||||
md.intro,
|
||||
md.particulars,
|
||||
mrd.size_type,
|
||||
md.size_json,
|
||||
mrd.price as dishes_price,
|
||||
mrd.sale_price as pref_price,
|
||||
mrd.supply_num - mrd.surplus_num as sales_num,
|
||||
mrd.surplus_num,
|
||||
mrd.restrict_num,
|
||||
md.calories,
|
||||
md.protein,
|
||||
md.fat,
|
||||
md.carbohydrate,
|
||||
md.dietary_fiber,
|
||||
md.cholesterol,
|
||||
md.calcium,
|
||||
md.sodium
|
||||
from
|
||||
menu_dishes_base mdb
|
||||
left join menu_dishes md on mdb.base_dishes_id = md.base_dishes_id
|
||||
left join menu_recipe_dishes mrd on md.dishes_id = mrd.dishes_id
|
||||
where
|
||||
mdb.base_dishes_id = #{baseDishesId}
|
||||
and mrd.detail_id = #{detailId}
|
||||
and md.del_flag = #{delFlag}
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -9,4 +9,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by crtime desc
|
||||
</select>
|
||||
|
||||
<select id="selectAllList" resultType="com.bonus.canteen.core.menu.vo.DrpUnitPageVO" parameterType="com.bonus.canteen.core.menu.vo.DrpUnitPageVO">
|
||||
select du.unit_id unitId,
|
||||
du.unit_name unitName,
|
||||
du.rate,
|
||||
du.weigh_type weighType,
|
||||
du.crby,
|
||||
du.crtime,
|
||||
du.upby,
|
||||
du.uptime,
|
||||
du.area_id,
|
||||
aa.area_name
|
||||
from drp_unit du
|
||||
left join alloc_area aa on du.area_id = aa.area_id
|
||||
<!-- where du.del_flag = #{delFlag}-->
|
||||
where 1=1
|
||||
<if test="unitId != null">
|
||||
and du.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and (du.area_id = #{areaId} or du.area_id is null)
|
||||
</if>
|
||||
<if test="ifListUse == 1 and areaId == null">
|
||||
and du.area_id is null
|
||||
</if>
|
||||
<!--区域权限-->
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and (du.area_id in
|
||||
<foreach collection="content.areaAuth" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
or du.area_id is null )
|
||||
</if>
|
||||
<if test="unitName != null and unitName != ''">
|
||||
and du.unit_name like concat(concat('%', #{unitName}), '%')
|
||||
</if>
|
||||
order by du.id desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getTenantAreaIdList" resultType="java.lang.Long">
|
||||
SELECT r.area_id
|
||||
FROM sys_role_area r
|
||||
LEFT JOIN sys_role o ON o.role_id = r.role_id
|
||||
LEFT JOIN sys_user_role u ON r.role_id = u.role_id
|
||||
WHERE u.user_id = #{authPO.userId}
|
||||
AND o.role_key = #{authPO.roleCode}
|
||||
AND o.del_flag = 2
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_user_role u ON r.role_id = u.role_id
|
||||
WHERE u.user_id = #{authPO.userId}
|
||||
AND o.role_key = #{authPO.roleCode}
|
||||
AND o.del_flag = 0
|
||||
AND o.del_flag = 2
|
||||
</select>
|
||||
|
||||
<select id="getOne" resultMap="MenuMaterialCategoryResult">
|
||||
|
|
|
|||
|
|
@ -96,19 +96,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectBigTypeList" resultMap="MenuNutritionTypeResult">
|
||||
select * from menu_nutrition_type where level = 1 and del_flag = 0
|
||||
select * from menu_nutrition_type where level = 1 and del_flag = 2
|
||||
</select>
|
||||
|
||||
<select id="selectLittleTypeList" resultType="com.bonus.canteen.core.menu.vo.NutritionTypeV2VO">
|
||||
select id,name as bigType from menu_nutrition_type where level = 2 and del_flag = 0 and parent_id = #{parentId}
|
||||
select id,name as bigType from menu_nutrition_type where level = 2 and del_flag = 2 and parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="getOne" resultMap="MenuNutritionTypeResult" parameterType="com.bonus.canteen.core.menu.domain.MenuNutritionType">
|
||||
select * from menu_nutrition_type where name = #{name} and parent_id = #{parentId} and del_flag = 0 limit 1
|
||||
select * from menu_nutrition_type where name = #{name} and parent_id = #{parentId} and del_flag = 2 limit 1
|
||||
</select>
|
||||
|
||||
<select id="getParentOne" resultMap="MenuNutritionTypeResult" parameterType="com.bonus.canteen.core.menu.domain.MenuNutritionType">
|
||||
select * from menu_nutrition_type where id = #{parentId} and del_flag = 0 limit 1
|
||||
select * from menu_nutrition_type where id = #{parentId} and del_flag = 2 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="selectDetailIdListByWrapper" resultType="java.lang.Long">
|
||||
SELECT detail_id FROM menu_recipe_detail
|
||||
WHERE del_flag = 0
|
||||
WHERE del_flag = 2
|
||||
AND recipe_id = #{recipeId}
|
||||
AND apply_date IN
|
||||
<foreach item="date" collection="applyDateList" open="(" separator="," close=")">
|
||||
|
|
@ -951,5 +951,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into menu_app_recipe (recipe_id,bind_type,bind_time,meal_line_id)
|
||||
values (#{recipeId},#{bindType},now(),#{mealLineId})
|
||||
</insert>
|
||||
|
||||
<select id="getSnByCanteenId" resultType="string">
|
||||
select
|
||||
device_id as deviceId
|
||||
where canteen_id = #{canteenId}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue