forked from rongchao/epmet-cloud-rizhao
26 changed files with 2030 additions and 0 deletions
@ -0,0 +1,58 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CanteenDishesDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -6277790230274824935L; |
||||
|
|
||||
|
/** |
||||
|
* 菜品主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 食堂ID |
||||
|
*/ |
||||
|
private String canteenId; |
||||
|
|
||||
|
/** |
||||
|
* 菜品名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 菜品编码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 菜品单价 |
||||
|
*/ |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
/** |
||||
|
* 菜品图片 |
||||
|
*/ |
||||
|
private String img; |
||||
|
|
||||
|
/** |
||||
|
* 在售状态 0、上架 1、下架 |
||||
|
*/ |
||||
|
private Integer status; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CanteenMenusDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 548014811507509126L; |
||||
|
|
||||
|
/** |
||||
|
* 菜单主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂主键ID |
||||
|
*/ |
||||
|
private String canteenId; |
||||
|
|
||||
|
/** |
||||
|
* 菜品 |
||||
|
*/ |
||||
|
private String[] dishesMenus; |
||||
|
|
||||
|
/** |
||||
|
* 菜单应用开始时间 |
||||
|
*/ |
||||
|
private String startTime; |
||||
|
|
||||
|
/** |
||||
|
* 菜单应用结束时间 |
||||
|
*/ |
||||
|
private String endTime; |
||||
|
|
||||
|
/** |
||||
|
* 0、早餐 1、午餐 2、晚餐 |
||||
|
*/ |
||||
|
private Integer meals; |
||||
|
|
||||
|
/** |
||||
|
* 是否默认菜单 0、否 1、是 |
||||
|
*/ |
||||
|
private Integer def; |
||||
|
|
||||
|
private String dishesName; |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 菜单列表对象 |
||||
|
* @create 2023/8/18 10:24 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CanteenMenusListDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 643911101457641518L; |
||||
|
|
||||
|
/** |
||||
|
* 菜单日期 |
||||
|
*/ |
||||
|
private String time; |
||||
|
|
||||
|
/** |
||||
|
* 食堂ID |
||||
|
*/ |
||||
|
private String canteenId; |
||||
|
|
||||
|
/** |
||||
|
* 菜单详情参数 |
||||
|
*/ |
||||
|
private List<CanteenMenus> mealses; |
||||
|
|
||||
|
@Data |
||||
|
public static class CanteenMenus { |
||||
|
/** |
||||
|
* 菜单ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
/** |
||||
|
* 三餐标示 0、早餐 1、中餐 2、晚餐 |
||||
|
*/ |
||||
|
private Integer meals; |
||||
|
/** |
||||
|
* 菜单菜品名称 |
||||
|
*/ |
||||
|
private String dishesNames; |
||||
|
/** |
||||
|
* 菜品ID |
||||
|
*/ |
||||
|
private String[] dishesMenus; |
||||
|
} |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityCanteenDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -8077509649657658146L; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 组织Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
private String agencyName; |
||||
|
|
||||
|
/** |
||||
|
* 负责人 |
||||
|
*/ |
||||
|
private String principal; |
||||
|
|
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 营业状态 0、营业中 1、歇业 |
||||
|
*/ |
||||
|
private Integer business; |
||||
|
|
||||
|
/** |
||||
|
* 三餐供给(0,1,2):0、早餐 1、午餐 2、晚餐 |
||||
|
*/ |
||||
|
private String[] threeMeals; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 营业时间 08:00,18:00 |
||||
|
*/ |
||||
|
private String[] businessHours; |
||||
|
|
||||
|
/** |
||||
|
* 食堂图片 |
||||
|
*/ |
||||
|
private String imgUrl; |
||||
|
|
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.CanteenDishesDTO; |
||||
|
import com.epmet.service.CanteenDishesService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("canteenDishes") |
||||
|
public class CanteenDishesController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CanteenDishesService canteenDishesService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<CanteenDishesDTO>> page(@RequestBody Map<String, Object> params) { |
||||
|
PageData<CanteenDishesDTO> page = canteenDishesService.page(params); |
||||
|
return new Result<PageData<CanteenDishesDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
||||
|
public Result<CanteenDishesDTO> get(@PathVariable("id") String id) { |
||||
|
CanteenDishesDTO data = canteenDishesService.get(id); |
||||
|
return new Result<CanteenDishesDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "list",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<List<CanteenDishesDTO>> list(@RequestBody Map<String, Object> params) { |
||||
|
return new Result<List<CanteenDishesDTO>>().ok(canteenDishesService.list(params)); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody CanteenDishesDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
canteenDishesService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody CanteenDishesDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
canteenDishesService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
canteenDishesService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,92 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.CanteenMenusDTO; |
||||
|
import com.epmet.dto.CanteenMenusListDTO; |
||||
|
import com.epmet.service.CanteenMenusService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("canteenMenus") |
||||
|
public class CanteenMenusController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CanteenMenusService canteenMenusService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<CanteenMenusDTO>> page(@RequestBody Map<String, Object> params) { |
||||
|
PageData<CanteenMenusDTO> page = canteenMenusService.page(params); |
||||
|
return new Result<PageData<CanteenMenusDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
||||
|
public Result<CanteenMenusDTO> get(@PathVariable("id") String id) { |
||||
|
CanteenMenusDTO data = canteenMenusService.get(id); |
||||
|
return new Result<CanteenMenusDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "list", method = {RequestMethod.POST, RequestMethod.GET}) |
||||
|
public Result<List<CanteenMenusListDTO>> list(@RequestBody Map<String, Object> params) { |
||||
|
return new Result<List<CanteenMenusListDTO>>().ok(canteenMenusService.list(params)); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping("historyMenus") |
||||
|
public Result<List<CanteenMenusDTO>> historyMenus(@RequestBody Map<String, Object> params) { |
||||
|
return new Result<List<CanteenMenusDTO>>().ok(canteenMenusService.historyMenus((String) params.get("canteenId"))); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody CanteenMenusDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
canteenMenusService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("saveOrUpdate") |
||||
|
public Result saveOrUpdate(@RequestBody CanteenMenusDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
canteenMenusService.saveOrUpdateDto(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody CanteenMenusDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
canteenMenusService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
canteenMenusService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.CommunityCanteenDTO; |
||||
|
import com.epmet.service.CommunityCanteenService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("communityCanteen") |
||||
|
public class CommunityCanteenController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CommunityCanteenService communityCanteenService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<CommunityCanteenDTO>> page(@RequestBody Map<String, Object> params) { |
||||
|
PageData<CommunityCanteenDTO> page = communityCanteenService.page(params); |
||||
|
return new Result<PageData<CommunityCanteenDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
||||
|
public Result<CommunityCanteenDTO> get(@PathVariable("id") String id) { |
||||
|
CommunityCanteenDTO data = communityCanteenService.get(id); |
||||
|
return new Result<CommunityCanteenDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody CommunityCanteenDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
communityCanteenService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody CommunityCanteenDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
communityCanteenService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
communityCanteenService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CanteenDishesEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CanteenDishesDao extends BaseDao<CanteenDishesEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CanteenMenusEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CanteenMenusDao extends BaseDao<CanteenMenusEntity> { |
||||
|
|
||||
|
List<CanteenMenusEntity> historyMenus(@Param("canteenId") String canteenId); |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CommunityCanteenEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CommunityCanteenDao extends BaseDao<CommunityCanteenEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 根据agencyId获取食堂的ID |
||||
|
* @param agencyId |
||||
|
* @return |
||||
|
*/ |
||||
|
String getCanteentByAgencyId(String agencyId); |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("canteen_dishes") |
||||
|
public class CanteenDishesEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 食堂ID |
||||
|
*/ |
||||
|
private String canteenId; |
||||
|
|
||||
|
/** |
||||
|
* 菜品名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 菜品编码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 菜品单价 |
||||
|
*/ |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
/** |
||||
|
* 菜品图片 |
||||
|
*/ |
||||
|
private String img; |
||||
|
|
||||
|
/** |
||||
|
* 在售状态 0、上架 1、下架 |
||||
|
*/ |
||||
|
private Integer status; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("canteen_menus") |
||||
|
public class CanteenMenusEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String customerId; |
||||
|
|
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂主键ID |
||||
|
*/ |
||||
|
private String canteenId; |
||||
|
|
||||
|
/** |
||||
|
* 菜品 |
||||
|
*/ |
||||
|
private String dishesMenus; |
||||
|
|
||||
|
/** |
||||
|
* 菜单应用开始时间 |
||||
|
*/ |
||||
|
private Date startTime; |
||||
|
|
||||
|
/** |
||||
|
* 菜单应用结束时间 |
||||
|
*/ |
||||
|
private Date endTime; |
||||
|
|
||||
|
/** |
||||
|
* 0、早餐 1、午餐 2、晚餐 |
||||
|
*/ |
||||
|
private Integer meals; |
||||
|
|
||||
|
/** |
||||
|
* 是否默认菜单 0、否 1、是 |
||||
|
*/ |
||||
|
private Integer def; |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("community_canteen") |
||||
|
public class CommunityCanteenEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 组织Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 负责人 |
||||
|
*/ |
||||
|
private String principal; |
||||
|
|
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 营业状态 0、营业中 1、歇业 |
||||
|
*/ |
||||
|
private Integer business; |
||||
|
|
||||
|
/** |
||||
|
* 三餐供给(0,1,2):0、早餐 1、午餐 2、晚餐 |
||||
|
*/ |
||||
|
private String threeMeals; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 营业时间 08:00,18:00 |
||||
|
*/ |
||||
|
private String businessHours; |
||||
|
|
||||
|
/** |
||||
|
* 食堂图片 |
||||
|
*/ |
||||
|
private String imgUrl; |
||||
|
|
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CanteenDishesExcel { |
||||
|
|
||||
|
@Excel(name = "菜品主键ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "客户Id") |
||||
|
private String customerId; |
||||
|
|
||||
|
@Excel(name = "菜品名称") |
||||
|
private String name; |
||||
|
|
||||
|
@Excel(name = "菜品编码") |
||||
|
private String code; |
||||
|
|
||||
|
@Excel(name = "菜品单价") |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
@Excel(name = "菜品图片") |
||||
|
private String img; |
||||
|
|
||||
|
@Excel(name = "在售状态 0、上架 1、下架") |
||||
|
private Integer status; |
||||
|
|
||||
|
@Excel(name = "排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@Excel(name = "删除标识:0.未删除 1.已删除") |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CanteenMenusExcel { |
||||
|
|
||||
|
@Excel(name = "菜单主键ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "社区食堂主键ID") |
||||
|
private String canteenId; |
||||
|
|
||||
|
@Excel(name = "菜品") |
||||
|
private String dishesMenus; |
||||
|
|
||||
|
@Excel(name = "菜单应用开始时间") |
||||
|
private Date startTime; |
||||
|
|
||||
|
@Excel(name = "菜单应用结束时间") |
||||
|
private Date endTime; |
||||
|
|
||||
|
@Excel(name = "0、早餐 1、午餐 2、晚餐") |
||||
|
private Integer meals; |
||||
|
|
||||
|
@Excel(name = "是否默认菜单 0、否 1、是") |
||||
|
private Integer def; |
||||
|
|
||||
|
@Excel(name = "删除标识:0.未删除 1.已删除") |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityCanteenExcel { |
||||
|
|
||||
|
@Excel(name = "社区食堂主键ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "客户Id") |
||||
|
private String customerId; |
||||
|
|
||||
|
@Excel(name = "社区食堂名称") |
||||
|
private String name; |
||||
|
|
||||
|
@Excel(name = "社区食堂地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Excel(name = "组织Id") |
||||
|
private String agencyId; |
||||
|
|
||||
|
@Excel(name = "负责人") |
||||
|
private String principal; |
||||
|
|
||||
|
@Excel(name = "负责人电话") |
||||
|
private String mobile; |
||||
|
|
||||
|
@Excel(name = "营业状态 0、营业中 1、歇业") |
||||
|
private Integer business; |
||||
|
|
||||
|
@Excel(name = "三餐供给(0,1,2):0、早餐 1、午餐 2、晚餐") |
||||
|
private String threeMeals; |
||||
|
|
||||
|
@Excel(name = "经度") |
||||
|
private String longitude; |
||||
|
|
||||
|
@Excel(name = "纬度") |
||||
|
private String latitude; |
||||
|
|
||||
|
@Excel(name = "营业时间 08:00,18:00") |
||||
|
private String businessHours; |
||||
|
|
||||
|
@Excel(name = "食堂图片") |
||||
|
private String imgUrl; |
||||
|
|
||||
|
@Excel(name = "排序字段") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@Excel(name = "备注") |
||||
|
private String remarks; |
||||
|
|
||||
|
@Excel(name = "删除标识:0.未删除 1.已删除") |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.CanteenDishesDTO; |
||||
|
import com.epmet.entity.CanteenDishesEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
public interface CanteenDishesService extends BaseService<CanteenDishesEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<CanteenDishesDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
PageData<CanteenDishesDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<CanteenDishesDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
List<CanteenDishesDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CanteenDishesDTO |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
CanteenDishesDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void save(CanteenDishesDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void update(CanteenDishesDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 根据id获取菜品信息 |
||||
|
* @param dishesIds |
||||
|
* @return |
||||
|
*/ |
||||
|
List<CanteenDishesDTO> selectByIds(List<String> dishesIds); |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.CanteenMenusDTO; |
||||
|
import com.epmet.dto.CanteenMenusListDTO; |
||||
|
import com.epmet.entity.CanteenMenusEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
public interface CanteenMenusService extends BaseService<CanteenMenusEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<CanteenMenusDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
PageData<CanteenMenusDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<CanteenMenusDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
List<CanteenMenusListDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CanteenMenusDTO |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
CanteenMenusDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void save(CanteenMenusDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void update(CanteenMenusDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-16 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 获取历史菜单 |
||||
|
* @return |
||||
|
*/ |
||||
|
List<CanteenMenusDTO> historyMenus(String canteenId); |
||||
|
|
||||
|
/** |
||||
|
* 自定义保存或更新 |
||||
|
* @param dto |
||||
|
*/ |
||||
|
void saveOrUpdateDto(CanteenMenusDTO dto); |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.CommunityCanteenDTO; |
||||
|
import com.epmet.entity.CommunityCanteenEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
public interface CommunityCanteenService extends BaseService<CommunityCanteenEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<CommunityCanteenDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
PageData<CommunityCanteenDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<CommunityCanteenDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
List<CommunityCanteenDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CommunityCanteenDTO |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
CommunityCanteenDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
void save(CommunityCanteenDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
void update(CommunityCanteenDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-08-14 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 根据AgencyId获取食堂ID |
||||
|
* @param agencyId |
||||
|
* @return |
||||
|
*/ |
||||
|
String getCanteentByAgencyId(String agencyId); |
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.dao.CanteenDishesDao; |
||||
|
import com.epmet.dto.CanteenDishesDTO; |
||||
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
||||
|
import com.epmet.entity.CanteenDishesEntity; |
||||
|
import com.epmet.remote.EpmetUserRemoteService; |
||||
|
import com.epmet.service.CanteenDishesService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 日照:食堂菜品 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CanteenDishesServiceImpl extends BaseServiceImpl<CanteenDishesDao, CanteenDishesEntity> implements CanteenDishesService { |
||||
|
|
||||
|
/** |
||||
|
* 菜品编码前缀 |
||||
|
*/ |
||||
|
private static final String PREFIX = "ST"; |
||||
|
|
||||
|
@Resource |
||||
|
private EpmetUserRemoteService remoteService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<CanteenDishesDTO> page(Map<String, Object> params) { |
||||
|
IPage<CanteenDishesEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, CanteenDishesDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CanteenDishesDTO> list(Map<String, Object> params) { |
||||
|
params.put("status", 0); |
||||
|
List<CanteenDishesEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, CanteenDishesDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<CanteenDishesEntity> getWrapper(Map<String, Object> params) { |
||||
|
QueryWrapper<CanteenDishesEntity> wrapper = new QueryWrapper<>(); |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
String name = (String) params.get(FieldConstant.NAME_HUMP); |
||||
|
String canteenId = (String) params.get("canteenId"); |
||||
|
if (null != params.get("status")) { |
||||
|
if (StringUtils.isNotEmpty(String.valueOf(params.get("status")))) { |
||||
|
Integer state = (Integer) params.get("status"); |
||||
|
wrapper.eq(true, "STATUS", state); |
||||
|
} |
||||
|
} |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
wrapper.like(StringUtils.isNotBlank(name), FieldConstant.NAME, name); |
||||
|
wrapper.eq(StringUtils.isNotEmpty(canteenId), "CANTEEN_ID", canteenId); |
||||
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
||||
|
wrapper.likeRight(StringUtils.isNotEmpty(userDetails.getOrgIdPath()), "AGENCY_ID", userDetails.getOrgIdPath()); |
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CanteenDishesDTO get(String id) { |
||||
|
CanteenDishesEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, CanteenDishesDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CanteenDishesDTO dto) { |
||||
|
CanteenDishesEntity entity = ConvertUtils.sourceToTarget(dto, CanteenDishesEntity.class); |
||||
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
||||
|
entity.setCustomerId(userDetails.getCustomerId()); |
||||
|
entity.setAgencyId(userDetails.getOrgIdPath()); |
||||
|
entity.setCode(createCodeNum(dto.getCanteenId())); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CanteenDishesDTO dto) { |
||||
|
CanteenDishesEntity entity = ConvertUtils.sourceToTarget(dto, CanteenDishesEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CanteenDishesDTO> selectByIds(List<String> dishesIds) { |
||||
|
return ConvertUtils.sourceToTarget(baseDao.selectBatchIds(dishesIds), CanteenDishesDTO.class); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 菜品编码生成器 |
||||
|
* @param canteenId |
||||
|
* @return |
||||
|
*/ |
||||
|
private String createCodeNum(String canteenId) { |
||||
|
String codeNum = PREFIX; |
||||
|
QueryWrapper<CanteenDishesEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotEmpty(canteenId), "CANTEEN_ID", canteenId); |
||||
|
Integer count = baseDao.selectCount(wrapper); |
||||
|
if (count < 999999) { |
||||
|
codeNum += String.valueOf(count + 1).length() == 1 ? "00000" + (count + 1) : |
||||
|
String.valueOf(count + 1).length() == 2 ? "0000" + (count + 1) : |
||||
|
String.valueOf(count + 1).length() == 3 ? "000" + (count + 1) : |
||||
|
String.valueOf(count + 1).length() == 4 ? "00" + (count + 1) : |
||||
|
String.valueOf(count + 1).length() == 5 ? "0" + (count + 1) : String.valueOf(count + 1); |
||||
|
|
||||
|
} |
||||
|
return codeNum; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,314 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.date.DateField; |
||||
|
import cn.hutool.core.date.DateTime; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
||||
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.PidUtils; |
||||
|
import com.epmet.dao.CanteenMenusDao; |
||||
|
import com.epmet.dto.CanteenDishesDTO; |
||||
|
import com.epmet.dto.CanteenMenusDTO; |
||||
|
import com.epmet.dto.CanteenMenusListDTO; |
||||
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
||||
|
import com.epmet.entity.CanteenMenusEntity; |
||||
|
import com.epmet.remote.EpmetUserRemoteService; |
||||
|
import com.epmet.service.CanteenDishesService; |
||||
|
import com.epmet.service.CanteenMenusService; |
||||
|
import com.epmet.service.CommunityCanteenService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂菜单 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CanteenMenusServiceImpl extends BaseServiceImpl<CanteenMenusDao, CanteenMenusEntity> implements CanteenMenusService { |
||||
|
|
||||
|
@Resource |
||||
|
private EpmetUserRemoteService remoteService; |
||||
|
|
||||
|
@Autowired |
||||
|
private CanteenDishesService canteenDishesService; |
||||
|
|
||||
|
@Autowired |
||||
|
private CommunityCanteenService communityCanteenService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<CanteenMenusDTO> page(Map<String, Object> params) { |
||||
|
IPage<CanteenMenusEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
PageData<CanteenMenusDTO> reuslt = getPageData(page, CanteenMenusDTO.class); |
||||
|
if (!CollectionUtils.isEmpty(page.getRecords())) { |
||||
|
page.getRecords().forEach(entity -> { |
||||
|
reuslt.getList().forEach(dto -> { |
||||
|
if (dto.getId().equals(entity.getId())) { |
||||
|
buildDate(dto, entity); |
||||
|
List<CanteenDishesDTO> dtoList = canteenDishesService.selectByIds(Arrays.asList(entity.getDishesMenus().split(","))); |
||||
|
if (!CollectionUtils.isEmpty(dtoList)) { |
||||
|
String names = dtoList.stream().map(CanteenDishesDTO::getName).collect(Collectors.joining(",")); |
||||
|
dto.setDishesName(names); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
return reuslt; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CanteenMenusListDTO> list(Map<String, Object> params) { |
||||
|
List<CanteenMenusEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
List<CanteenMenusListDTO> menusList = new ArrayList<>(); |
||||
|
Set<String> dates = new HashSet<>(); |
||||
|
if (!CollectionUtils.isEmpty(entityList)) { |
||||
|
for (CanteenMenusEntity entity : entityList) { |
||||
|
String date = DateUtil.formatDate(entity.getStartTime()); |
||||
|
if (!dates.contains(date)) { |
||||
|
dates.add(date); |
||||
|
CanteenMenusListDTO menus = new CanteenMenusListDTO(); |
||||
|
menus.setTime(DateUtil.formatDate(entity.getStartTime())); |
||||
|
menus.setCanteenId(entity.getCanteenId()); |
||||
|
List<CanteenMenusListDTO.CanteenMenus> mealses = new ArrayList<>(); |
||||
|
menus.setMealses(mealses); |
||||
|
menusList.add(menus); |
||||
|
} |
||||
|
} |
||||
|
if (!CollectionUtils.isEmpty(menusList)) { |
||||
|
menusList.forEach(menus -> { |
||||
|
entityList.forEach(entity -> { |
||||
|
if (DateUtil.formatDate(entity.getStartTime()).equals(menus.getTime())) { |
||||
|
buildData(entity, menus.getMealses()); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
return menusList.stream().sorted(Comparator.comparing(CanteenMenusListDTO::getTime).thenComparing(CanteenMenusListDTO::getTime)).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
private void buildData(CanteenMenusEntity entity, List<CanteenMenusListDTO.CanteenMenus> mealses) { |
||||
|
CanteenMenusListDTO.CanteenMenus canteenMenus = new CanteenMenusListDTO.CanteenMenus(); |
||||
|
canteenMenus.setDishesMenus(entity.getDishesMenus().split(",")); |
||||
|
canteenMenus.setId(entity.getId()); |
||||
|
canteenMenus.setMeals(entity.getMeals()); |
||||
|
List<CanteenDishesDTO> dtoList = canteenDishesService.selectByIds(Arrays.asList(entity.getDishesMenus().split(","))); |
||||
|
if (!CollectionUtils.isEmpty(dtoList)) { |
||||
|
String names = dtoList.stream().map(CanteenDishesDTO::getName).collect(Collectors.joining(",")); |
||||
|
canteenMenus.setDishesNames(names); |
||||
|
} |
||||
|
mealses.add(canteenMenus); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<CanteenMenusEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
String agencyId = (String) params.get("agencyId"); |
||||
|
String startTime = (String) params.get("startTime"); |
||||
|
String canteenId = (String) params.get("canteenId"); |
||||
|
String endTime = (String) params.get("endTime"); |
||||
|
|
||||
|
QueryWrapper<CanteenMenusEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
wrapper.eq(StringUtils.isNotEmpty(canteenId), "CANTEEN_ID", canteenId); |
||||
|
if (StringUtils.isNotEmpty(agencyId)) { |
||||
|
AgencyInfoCache info = CustomerOrgRedis.getAgencyInfo(agencyId); |
||||
|
agencyId = PidUtils.convertPid2OrgIdPath(agencyId, info.getPids()); |
||||
|
wrapper.likeRight(StringUtils.isNotEmpty(agencyId), "AGENCY_ID", agencyId); |
||||
|
} |
||||
|
if (null != params.get("meals")) { |
||||
|
if (StringUtils.isNotEmpty(String.valueOf(params.get("meals")))) { |
||||
|
Integer state = (Integer) params.get("meals"); |
||||
|
wrapper.eq(true, "MEALS", state); |
||||
|
} |
||||
|
} |
||||
|
if (null != params.get("def")) { |
||||
|
if (StringUtils.isNotEmpty(String.valueOf(params.get("def")))) { |
||||
|
Integer def = (Integer) params.get("def"); |
||||
|
wrapper.eq(true, "DEF", def); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) { |
||||
|
wrapper.between("START_TIME", startTime, endTime); |
||||
|
} |
||||
|
// LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
|
||||
|
// wrapper.likeRight(StringUtils.isNotEmpty(userDetails.getOrgIdPath()), "AGENCY_ID", userDetails.getOrgIdPath());
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CanteenMenusDTO get(String id) { |
||||
|
CanteenMenusEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, CanteenMenusDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CanteenMenusDTO dto) { |
||||
|
CanteenMenusEntity entity = ConvertUtils.sourceToTarget(dto, CanteenMenusEntity.class); |
||||
|
if (null != dto.getDishesMenus() && dto.getDishesMenus().length > 0) { |
||||
|
entity.setDishesMenus(StringUtils.join(dto.getDishesMenus(), ",")); |
||||
|
} |
||||
|
if (null == dto.getDef()) { |
||||
|
entity.setDef(0); |
||||
|
if (StringUtils.isNotEmpty(dto.getStartTime())) { |
||||
|
entity.setStartTime(DateUtil.parseDate(dto.getStartTime())); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(dto.getEndTime())) { |
||||
|
entity.setEndTime(DateUtil.parseDate(dto.getEndTime())); |
||||
|
} |
||||
|
} |
||||
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
||||
|
entity.setCustomerId(userDetails.getCustomerId()); |
||||
|
entity.setAgencyId(userDetails.getOrgIdPath()); |
||||
|
if (StringUtils.isEmpty(dto.getCanteenId())) { |
||||
|
String canteenId = communityCanteenService.getCanteentByAgencyId(userDetails.getOrgIdPath()); |
||||
|
entity.setCanteenId(canteenId); |
||||
|
} |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CanteenMenusDTO dto) { |
||||
|
CanteenMenusEntity entity = ConvertUtils.sourceToTarget(dto, CanteenMenusEntity.class); |
||||
|
if (null != dto.getDishesMenus() && dto.getDishesMenus().length > 0) { |
||||
|
entity.setDishesMenus(StringUtils.join(dto.getDishesMenus(), ",")); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(dto.getStartTime())) { |
||||
|
entity.setStartTime(DateUtil.parseDate(dto.getStartTime())); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(dto.getEndTime())) { |
||||
|
entity.setEndTime(DateUtil.parseDate(dto.getEndTime())); |
||||
|
} |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CanteenMenusDTO> historyMenus(String canteenId) { |
||||
|
List<CanteenMenusEntity> historyList = baseDao.historyMenus(canteenId); |
||||
|
List<CanteenMenusDTO> resultList = ConvertUtils.sourceToTarget(historyList, CanteenMenusDTO.class); |
||||
|
if (!CollectionUtils.isEmpty(historyList)) { |
||||
|
historyList.forEach(entity -> { |
||||
|
resultList.forEach(res -> { |
||||
|
if (entity.getId().equals(res.getId())) { |
||||
|
buildDate(res, entity); |
||||
|
List<CanteenDishesDTO> dtoList = canteenDishesService.selectByIds(Arrays.asList(entity.getDishesMenus().split(","))); |
||||
|
String names = dtoList.stream().map(CanteenDishesDTO::getName).collect(Collectors.joining("、")); |
||||
|
res.setDishesName(names); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void saveOrUpdateDto(CanteenMenusDTO dto) { |
||||
|
if (StringUtils.isNotEmpty(dto.getStartTime()) && StringUtils.isNotEmpty(dto.getEndTime())) { |
||||
|
QueryWrapper<CanteenMenusEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotEmpty(dto.getCanteenId()), "CANTEEN_ID", dto.getCanteenId()); |
||||
|
wrapper.between("START_TIME", dto.getStartTime(), dto.getEndTime()); |
||||
|
wrapper.eq(true, "MEALS", dto.getMeals()); |
||||
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
||||
|
wrapper.likeRight(StringUtils.isNotEmpty(userDetails.getOrgIdPath()), "AGENCY_ID", userDetails.getOrgIdPath()); |
||||
|
//获取是否已经存在菜单
|
||||
|
List<CanteenMenusEntity> resultList = baseDao.selectList(wrapper); |
||||
|
List<CanteenMenusEntity> updateList = new ArrayList<>(); |
||||
|
List<CanteenMenusEntity> saveList = new ArrayList<>(); |
||||
|
//获取两个时间之间的所有时间(包含自己)
|
||||
|
List<DateTime> dateList = getDateList(dto.getStartTime(), dto.getEndTime()); |
||||
|
//用时间比较已经存在的菜单
|
||||
|
if (!CollectionUtils.isEmpty(resultList)) { |
||||
|
dateList.forEach(dateTime -> { |
||||
|
resultList.forEach(entity -> { |
||||
|
if (entity.getStartTime() == dateTime) {//如果村砸,则更新菜单
|
||||
|
entity.setDishesMenus(StringUtils.join(dto.getDishesMenus(), ",")); |
||||
|
updateList.add(entity); |
||||
|
} else {//如果不存在,则保存
|
||||
|
entity.setDishesMenus(StringUtils.join(dto.getDishesMenus(), ",")); |
||||
|
entity.setStartTime(dateTime); |
||||
|
entity.setEndTime(dateTime); |
||||
|
entity.setCanteenId(dto.getCanteenId()); |
||||
|
entity.setMeals(dto.getMeals()); |
||||
|
entity.setDef(0); |
||||
|
entity.setCustomerId(userDetails.getCustomerId()); |
||||
|
entity.setAgencyId(userDetails.getOrgIdPath()); |
||||
|
saveList.add(entity); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} else {//如果都不存在,则所有的都保存
|
||||
|
dateList.forEach(dateTime -> { |
||||
|
CanteenMenusEntity entity = new CanteenMenusEntity(); |
||||
|
entity.setDishesMenus(StringUtils.join(dto.getDishesMenus(), ",")); |
||||
|
entity.setStartTime(dateTime); |
||||
|
entity.setEndTime(dateTime); |
||||
|
entity.setCanteenId(dto.getCanteenId()); |
||||
|
entity.setMeals(dto.getMeals()); |
||||
|
entity.setDef(0); |
||||
|
entity.setCustomerId(userDetails.getCustomerId()); |
||||
|
entity.setAgencyId(userDetails.getOrgIdPath()); |
||||
|
saveList.add(entity); |
||||
|
}); |
||||
|
} |
||||
|
if (!CollectionUtils.isEmpty(saveList)) { |
||||
|
saveOrUpdateBatch(saveList); |
||||
|
} |
||||
|
if (!CollectionUtils.isEmpty(updateList)) { |
||||
|
updateBatchById(updateList); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private List<DateTime> getDateList(String startDate, String endDate) { |
||||
|
if (StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)) { |
||||
|
return DateUtil.rangeToList(DateUtil.parseDate(startDate), DateUtil.parseDate(endDate), DateField.DAY_OF_YEAR); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 抽取封装数据 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @param entity |
||||
|
* @return |
||||
|
*/ |
||||
|
private CanteenMenusDTO buildDate(CanteenMenusDTO dto, CanteenMenusEntity entity) { |
||||
|
if (null != entity.getStartTime()) { |
||||
|
dto.setStartTime(DateUtil.formatDate(entity.getStartTime())); |
||||
|
} |
||||
|
if (null != entity.getEndTime()) { |
||||
|
dto.setEndTime(DateUtil.formatDate(entity.getEndTime())); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(entity.getDishesMenus())) { |
||||
|
dto.setDishesMenus(entity.getDishesMenus().split(",")); |
||||
|
} |
||||
|
return dto; |
||||
|
} |
||||
|
} |
@ -0,0 +1,165 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
||||
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.PidUtils; |
||||
|
import com.epmet.dao.CommunityCanteenDao; |
||||
|
import com.epmet.dto.CommunityCanteenDTO; |
||||
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
||||
|
import com.epmet.entity.CommunityCanteenEntity; |
||||
|
import com.epmet.remote.EpmetUserRemoteService; |
||||
|
import com.epmet.service.CommunityCanteenService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CommunityCanteenServiceImpl extends BaseServiceImpl<CommunityCanteenDao, CommunityCanteenEntity> implements CommunityCanteenService { |
||||
|
|
||||
|
@Resource |
||||
|
private EpmetUserRemoteService remoteService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<CommunityCanteenDTO> page(Map<String, Object> params) { |
||||
|
IPage<CommunityCanteenEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
PageData<CommunityCanteenDTO> pageData = getPageData(page, CommunityCanteenDTO.class); |
||||
|
page.getRecords().forEach(entity -> { |
||||
|
pageData.getList().forEach(dto -> { |
||||
|
if (entity.getId().equals(dto.getId())) { |
||||
|
dto.setThreeMeals(entity.getThreeMeals().split(",")); |
||||
|
dto.setBusinessHours(entity.getBusinessHours().split(",")); |
||||
|
dto.setAgencyId(entity.getAgencyId().substring(entity.getAgencyId().lastIndexOf(":") + 1)); |
||||
|
dto.setAgencyName(CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()).getOrganizationName()); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
return pageData; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CommunityCanteenDTO> list(Map<String, Object> params) { |
||||
|
List<CommunityCanteenEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
List<CommunityCanteenDTO> dtoList = ConvertUtils.sourceToTarget(entityList, CommunityCanteenDTO.class); |
||||
|
if (!CollectionUtils.isEmpty(dtoList)) { |
||||
|
for (CommunityCanteenEntity entity : entityList) { |
||||
|
for (CommunityCanteenDTO dto : dtoList) { |
||||
|
if (entity.getId().equals(dto.getId())) { |
||||
|
dto.setThreeMeals(entity.getThreeMeals().split(",")); |
||||
|
dto.setBusinessHours(entity.getBusinessHours().split(",")); |
||||
|
dto.setAgencyId(entity.getAgencyId().substring(entity.getAgencyId().lastIndexOf(":") + 1)); |
||||
|
dto.setAgencyName(CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()).getOrganizationName()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return dtoList; |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<CommunityCanteenEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
String name = (String) params.get("name"); |
||||
|
String agencyId = (String) params.get("agencyId"); |
||||
|
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
||||
|
if (StringUtils.isEmpty(agencyId)) { |
||||
|
agencyId = userDetails.getOrgIdPath(); |
||||
|
} else { |
||||
|
AgencyInfoCache info = CustomerOrgRedis.getAgencyInfo(agencyId); |
||||
|
agencyId = PidUtils.convertPid2OrgIdPath(agencyId, info.getPids()); |
||||
|
} |
||||
|
String business = ""; |
||||
|
if (null != params.get("business")) { |
||||
|
business = String.valueOf(params.get("business")); |
||||
|
} |
||||
|
String principal = (String) params.get("principal"); |
||||
|
String mobile = (String) params.get("mobile"); |
||||
|
QueryWrapper<CommunityCanteenEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
wrapper.like(StringUtils.isNotBlank(name), FieldConstant.NAME, name); |
||||
|
wrapper.like(StringUtils.isNotBlank(principal), "PRINCIPAL", principal); |
||||
|
wrapper.like(StringUtils.isNotBlank(mobile), "MOBILE", mobile); |
||||
|
wrapper.likeRight(StringUtils.isNotBlank(agencyId), "AGENCY_ID", agencyId); |
||||
|
wrapper.eq(StringUtils.isNotEmpty(business), "BUSINESS", business); |
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CommunityCanteenDTO get(String id) { |
||||
|
CommunityCanteenEntity entity = baseDao.selectById(id); |
||||
|
CommunityCanteenDTO dto = ConvertUtils.sourceToTarget(entity, CommunityCanteenDTO.class); |
||||
|
if (StringUtils.isNotEmpty(entity.getBusinessHours())) { |
||||
|
dto.setBusinessHours(entity.getBusinessHours().split(",")); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(entity.getThreeMeals())) { |
||||
|
dto.setThreeMeals(entity.getThreeMeals().split(",")); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(dto.getAgencyId())) { |
||||
|
dto.setAgencyId(dto.getAgencyId().substring(dto.getAgencyId().lastIndexOf(":"), dto.getAgencyId().length() - 1)); |
||||
|
} |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CommunityCanteenDTO dto) { |
||||
|
CommunityCanteenEntity entity = ConvertUtils.sourceToTarget(dto, CommunityCanteenEntity.class); |
||||
|
if (null != dto.getBusinessHours() && dto.getBusinessHours().length > 0) { |
||||
|
entity.setBusinessHours(StringUtils.join(dto.getBusinessHours(), ",")); |
||||
|
} |
||||
|
if (null != dto.getThreeMeals() && dto.getThreeMeals().length > 0) { |
||||
|
entity.setThreeMeals(StringUtils.join(dto.getThreeMeals(), ",")); |
||||
|
} |
||||
|
if (StringUtils.isNotEmpty(dto.getAgencyId())) { |
||||
|
AgencyInfoCache info = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()); |
||||
|
entity.setAgencyId(PidUtils.convertPid2OrgIdPath(dto.getAgencyId(), info.getPids())); |
||||
|
entity.setCustomerId(info.getCustomerId()); |
||||
|
} |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CommunityCanteenDTO dto) { |
||||
|
CommunityCanteenEntity entity = ConvertUtils.sourceToTarget(dto, CommunityCanteenEntity.class); |
||||
|
if (null != dto.getBusinessHours() && dto.getBusinessHours().length > 0) { |
||||
|
entity.setBusinessHours(StringUtils.join(dto.getBusinessHours())); |
||||
|
} |
||||
|
if (null != dto.getThreeMeals() && dto.getThreeMeals().length > 0) { |
||||
|
entity.setThreeMeals(StringUtils.join(dto.getThreeMeals())); |
||||
|
} |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getCanteentByAgencyId(String agencyId) { |
||||
|
return baseDao.getCanteentByAgencyId(agencyId); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
<?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.epmet.dao.CanteenDishesDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.CanteenDishesEntity" id="canteenDishesMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="agencyId" column="AGENCY_ID"/> |
||||
|
<result property="canteenId" column="CANTEEN_ID"/> |
||||
|
<result property="name" column="NAME"/> |
||||
|
<result property="code" column="CODE"/> |
||||
|
<result property="price" column="PRICE"/> |
||||
|
<result property="img" column="IMG"/> |
||||
|
<result property="status" column="STATUS"/> |
||||
|
<result property="sort" column="SORT"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,41 @@ |
|||||
|
<?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.epmet.dao.CanteenMenusDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.CanteenMenusEntity" id="canteenMenusMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID" /> |
||||
|
<result property="agencyId" column="AGENCY_ID"/> |
||||
|
<result property="canteenId" column="CANTEEN_ID"/> |
||||
|
<result property="dishesMenus" column="DISHES_MENUS"/> |
||||
|
<result property="startTime" column="START_TIME"/> |
||||
|
<result property="endTime" column="END_TIME"/> |
||||
|
<result property="meals" column="MEALS"/> |
||||
|
<result property="def" column="DEF"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="historyMenus" resultType="com.epmet.entity.CanteenMenusEntity"> |
||||
|
SELECT |
||||
|
cm.ID, |
||||
|
cm.CANTEEN_ID, |
||||
|
cm.START_TIME, |
||||
|
cm.END_TIME, |
||||
|
cm.MEALS, |
||||
|
cm.DISHES_MENUS |
||||
|
FROM canteen_menus cm |
||||
|
<where> |
||||
|
cm.DEL_FLAG = 0 AND cm.DEF = 0 AND cm.START_TIME < NOW() AND cm.END_TIME < NOW() |
||||
|
<if test="null != canteenId and canteenId != ''"> |
||||
|
AND cm.CANTEEN_ID = #{canteenId} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,33 @@ |
|||||
|
<?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.epmet.dao.CommunityCanteenDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.CommunityCanteenEntity" id="communityCanteenMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="name" column="NAME"/> |
||||
|
<result property="address" column="ADDRESS"/> |
||||
|
<result property="agencyId" column="AGENCY_ID"/> |
||||
|
<result property="principal" column="PRINCIPAL"/> |
||||
|
<result property="mobile" column="MOBILE"/> |
||||
|
<result property="business" column="BUSINESS"/> |
||||
|
<result property="threeMeals" column="THREE_MEALS"/> |
||||
|
<result property="longitude" column="LONGITUDE"/> |
||||
|
<result property="latitude" column="LATITUDE"/> |
||||
|
<result property="businessHours" column="BUSINESS_HOURS"/> |
||||
|
<result property="imgUrl" column="IMG_URL"/> |
||||
|
<result property="sort" column="SORT"/> |
||||
|
<result property="remarks" column="REMARKS"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="getCanteentByAgencyId" resultType="java.lang.String"> |
||||
|
select cc.ID from community_canteen cc where cc.DEL_FLAG = 0 and cc.AGENCY_ID = #{agencyId} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,89 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日照:社区食堂 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-08-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityCanteenDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 社区食堂地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 组织Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 负责人 |
||||
|
*/ |
||||
|
private String principal; |
||||
|
|
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 营业状态 0、营业中 1、歇业 |
||||
|
*/ |
||||
|
private Integer business; |
||||
|
|
||||
|
/** |
||||
|
* 三餐供给(0,1,2):0、早餐 1、午餐 2、晚餐 |
||||
|
*/ |
||||
|
private String[] threeMeals; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 营业时间 08:00,18:00 |
||||
|
*/ |
||||
|
private String[] businessHours; |
||||
|
|
||||
|
/** |
||||
|
* 食堂图片 |
||||
|
*/ |
||||
|
private String imgUrl; |
||||
|
|
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
} |
Loading…
Reference in new issue