Commit 3670ce25 authored by mengmeng's avatar mengmeng

20210129 first commit v1

parent 27c355a8
......@@ -41,6 +41,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/api/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionservicetype/**");
}
@Override
......@@ -79,4 +80,4 @@ public class WebMvcConfig implements WebMvcConfigurer {
converter.setObjectMapper(mapper);
return converter;
}
}
\ No newline at end of file
}
......@@ -2,12 +2,16 @@ package io.hmit.controller;
import io.hmit.annotation.Login;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.dto.LoginDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity;
import io.hmit.service.TokenService;
import io.hmit.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -53,4 +57,26 @@ public class ApiLoginController {
return new Result();
}
}
\ No newline at end of file
@Login
@GetMapping("getUserInfoById")
@ApiOperation("根据ID查询用户信息")
@ApiImplicitParam(name = "roleId", value = "用户角色", paramType = "query", dataType = "int")
public Result<UserInfoDTO> getUserInfoById(Long userId) {
UserInfoDTO data = ConvertUtils.sourceToTarget(userService.getUserByUserId(userId),UserInfoDTO.class);
return new Result().ok(data);
}
@Login
@PostMapping("update")
@ApiOperation("修改用户信息")
public Result getUserInfoById(@RequestBody UserInfoDTO userInfoDTO) {
UserEntity userEntity = ConvertUtils.sourceToTarget(userInfoDTO,UserEntity.class);
userService.updateById(userEntity);
return new Result();
}
}
package io.hmit.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel(value = "用户信息")
public class UserInfoDTO {
@ApiModelProperty(value = "用户id")
private Long id;
/**
* 用户名
*/
@ApiModelProperty(value = "用户名")
private String username;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号")
private String mobile;
/**
* 生日
*/
@ApiModelProperty(value = "生日")
private Date birthday;
/**
* 地址_地区
*/
@ApiModelProperty(value = "地址_地区")
private String addressArea;
/**
* 详细地址
*/
@ApiModelProperty(value = "详细地址")
private String address;
}
......@@ -42,4 +42,25 @@ public class UserEntity implements Serializable {
*/
private Date createDate;
}
\ No newline at end of file
/**
* 关联sys_user中的id
*/
private Long userId;
/**
* 微信openid
*/
private String openid;
/**
* 生日
*/
private Date birthday;
/**
* 地址_地区
*/
private String addressArea;
/**
* 详细地址
*/
private String address;
}
......@@ -9,6 +9,7 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.NewsDTO;
import io.hmit.modules.serviceOrder.service.NewsDocumentService;
import io.hmit.modules.serviceOrder.service.NewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -36,6 +38,9 @@ public class NewsController {
@Autowired
private NewsService newsService;
@Autowired
private NewsDocumentService newsDocumentService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
......@@ -47,6 +52,12 @@ public class NewsController {
public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<NewsDTO> page = newsService.page(params);
Map<String, Object> params2 = new HashMap<>();
page.getList().stream().forEach(item ->{
params2.put("newId",item.getId());
item.setNewsDocumentDTOList(newsDocumentService.list(params2));
});
return new Result<PageData<NewsDTO>>().ok(page);
}
......@@ -55,6 +66,10 @@ public class NewsController {
public Result<NewsDTO> get(@PathVariable("id") Long id){
NewsDTO data = newsService.get(id);
Map<String, Object> params = new HashMap<>();
params.put("newId",data.getId());
data.setNewsDocumentDTOList(newsDocumentService.list(params));
return new Result<NewsDTO>().ok(data);
}
......
......@@ -91,6 +91,7 @@ public class PensionOrderController {
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "status", value = "订单状态: 0未接单 1已接单 2已完成 3已取消", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
......@@ -99,6 +100,22 @@ public class PensionOrderController {
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
// @Login
// @GetMapping("todayOrderPage")
// @ApiOperation("今日订单分页(未接单)")
// @ApiImplicitParams({
// @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
// @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
// })
// public Result<PageData<PensionOrderDTO>> todayOrderPage(@ApiIgnore @LoginUser UserEntity user,
// @ApiIgnore @RequestParam Map<String, Object> params){
// PageData<PensionOrderDTO> page = pensionOrderService.getTodayOrderPage(params, user.getId());
//
// return new Result<PageData<PensionOrderDTO>>().ok(page);
// }
@Login
@GetMapping("orderInfo/{id}")
@ApiOperation("预约订单详情(带图片)")
......
package io.hmit.modules.serviceOrder.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result;
......@@ -10,6 +12,7 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -37,13 +40,16 @@ public class PensionServiceController {
@Autowired
private PensionServiceService pensionServiceService;
private BaseMapper baseMapper;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "serviceTypeId", value = "服务大类ID", paramType = "query", dataType="int")
})
public Result<PageData<PensionServiceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionServiceDTO> page = pensionServiceService.page(params);
......@@ -53,16 +59,25 @@ public class PensionServiceController {
@GetMapping("{id}")
@ApiOperation("信息")
//@RequiresPermissions("serviceOrder:pensionservice:info")
public Result<PensionServiceDTO> get(@PathVariable("id") Long id){
PensionServiceDTO data = pensionServiceService.get(id);
return new Result<PensionServiceDTO>().ok(data);
}
@GetMapping("getByServiceTypeId/{serviceTypeId}")
@ApiOperation("根据服务大类获取详情")
public Result<PensionServiceDTO> getByServiceTypeId(@PathVariable("serviceTypeId") Long serviceTypeId){
List<PensionServiceDTO> data = baseMapper.selectList(
new QueryWrapper<PensionServiceDTO>().lambda()
.eq(PensionServiceDTO::getServiceTypeId,serviceTypeId));
return new Result<PensionServiceDTO>().ok(data.get(0));
}
@PostMapping
@ApiOperation("保存")
//@RequiresPermissions("serviceOrder:pensionservice:save")
public Result save(@RequestBody PensionServiceDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
......
package io.hmit.modules.serviceOrder.controller;
import com.baomidou.mybatisplus.extension.api.R;
import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result;
......@@ -9,6 +12,7 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.swagger.annotations.Api;
......@@ -51,6 +55,33 @@ public class PensionServiceTypeController {
return new Result<PageData<PensionServiceTypeDTO>>().ok(page);
}
@GetMapping("list")
@ApiOperation("根据用户角色获取服务列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleId", value = "用户角色Id", paramType = "query", dataType="int") ,
@ApiImplicitParam(name = "isFree", value = "是否免费:1 是, 2 否", paramType = "query", dataType="String")
})
public Result<List<PensionServiceTypeDTO>> getServiceList( @ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceTypeDTO> list = pensionServiceTypeService.getServiceListByRole(params);
return new Result<List<PensionServiceTypeDTO>>().ok(list);
}
@GetMapping("getAllList")
@ApiOperation("获取所有大类")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleId", value = "用户角色Id", paramType = "query", dataType="int")
})
public Result<List<PensionServiceTypeDTO>> getALlList( @ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceTypeDTO> list = pensionServiceTypeService.getALLListByRole(params);
return new Result<List<PensionServiceTypeDTO>>().ok(list);
}
@Login
@GetMapping("{id}")
@ApiOperation("信息")
public Result<PensionServiceTypeDTO> get(@PathVariable("id") Long id){
......@@ -92,4 +123,5 @@ public class PensionServiceTypeController {
return new Result();
}
}
......@@ -23,4 +23,4 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
}
\ No newline at end of file
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
......@@ -28,6 +29,9 @@ public class NewsDTO implements Serializable {
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "附件列表")
private List<NewsDocumentDTO> newsDocumentDTOList;
@ApiModelProperty(value = "发布时间")
private Date pubDate;
......@@ -47,4 +51,4 @@ public class NewsDTO implements Serializable {
private Date updateDate;
}
\ No newline at end of file
}
......@@ -5,7 +5,6 @@ import io.hmit.entity.UserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import sun.plugin2.util.SystemUtil;
import java.io.Serializable;
import java.util.Date;
......@@ -112,4 +111,6 @@ public class PensionOrderDTO implements Serializable {
pensionOrder.setAppointmentTime(reservationDTO.getAppointmentTime());
return pensionOrder;
}
}
......@@ -43,5 +43,12 @@ public class PensionOrderServiceDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
\ No newline at end of file
public PensionOrderServiceDTO assemblePensionOrderService(PensionOrderDTO pensionOrderDTO){
PensionOrderServiceDTO dto = new PensionOrderServiceDTO();
dto.setOrderId(pensionOrderDTO.getId());
dto.setServiceId(pensionOrderDTO.getServiceId());
dto.setRemark("");
return dto;
}
}
......@@ -23,7 +23,7 @@ public class PensionServiceDTO implements Serializable {
private Long id;
@ApiModelProperty(value = "服务名称")
private String name;
private String serviceName;
@ApiModelProperty(value = "服务类型")
private Long serviceTypeId;
......
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/28
*/
@Data
@ApiModel(value = "老人预约服务")
public class ReservationDTO {
@ApiModelProperty(value = "订单所属的服务id")
private Long serviceId;
@ApiModelProperty(value = "订单所属的服务名称")
private String serviceName;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "预约人")
private String appointmentPerson;
@ApiModelProperty(value = "预约人电话")
private String appointmentPhone;
@ApiModelProperty(value = "预约时间")
private Date appointmentTime;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.annotations.Property;
import java.math.BigDecimal;
import java.util.Date;
......@@ -23,7 +24,8 @@ public class PensionServiceEntity extends BaseEntity {
/**
* 服务名称
*/
private String name;
// @Property(value = "name")
private String serviceName;
/**
* 服务类型
*/
......@@ -36,6 +38,10 @@ public class PensionServiceEntity extends BaseEntity {
* 首页图标地址
*/
private String icon;
/**
* 是否免费
*/
private String isFree;
/**
* 详情页大图地址
*/
......@@ -72,4 +78,4 @@ public class PensionServiceEntity extends BaseEntity {
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
}
......@@ -3,7 +3,6 @@ package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import java.util.Map;
......@@ -20,7 +19,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId);
//查询今日订单
PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params, Long userId);
PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params);
//根据订单Id和订单状态查询 (接单时使用)
PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
......
......@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
import java.util.List;
import java.util.Map;
/**
* 服务种类表
*
......@@ -12,4 +15,7 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
*/
public interface PensionServiceTypeService extends CrudService<PensionServiceTypeEntity, PensionServiceTypeDTO> {
}
\ No newline at end of file
List<PensionServiceTypeDTO> getALLListByRole(Map<String, Object> params);
List<PensionServiceTypeDTO> getServiceListByRole(Map<String, Object> params);
}
......@@ -47,6 +47,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
//查询全部订单
@Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
//分页
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderDTO> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, null);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
......@@ -70,7 +71,6 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Override
public void reservation(PensionOrderDTO pensionOrderDTO) {
save(pensionOrderDTO);
PensionOrderServiceDTO orderServiceDTO = new PensionOrderServiceDTO().assemblePensionOrderService(pensionOrderDTO);
pensionOrderServiceService.save(orderServiceDTO);
......
......@@ -9,6 +9,7 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -23,12 +24,17 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
@Override
public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String serviceTypeId = params.get("serviceTypeId") ==null?"":params.get("serviceTypeId").toString();
String isFree = (String)params.get("isFree");
QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(serviceTypeId), "service_type_id", serviceTypeId);
wrapper.eq(StringUtils.isNotBlank(isFree), "is_free", isFree);
return wrapper;
}
}
\ No newline at end of file
}
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionServiceDao;
import io.hmit.modules.serviceOrder.dao.PensionServiceTypeDao;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.dto.RoleUserDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 服务种类表
......@@ -20,6 +33,21 @@ import java.util.Map;
@Service
public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServiceTypeDao, PensionServiceTypeEntity, PensionServiceTypeDTO> implements PensionServiceTypeService {
@Autowired
private RoleServiceService roleServiceService;
@Autowired
private PensionServiceService pensionServiceService;
@Autowired
private RoleUserService roleUserService;
@Autowired
private PensionServiceDao pensionServiceDao;
// @Autowired
private BaseMapper baseMapper;
@Override
public QueryWrapper<PensionServiceTypeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -31,4 +59,40 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic
}
}
\ No newline at end of file
@Override
public List<PensionServiceTypeDTO> getALLListByRole(Map<String, Object> params) {
List<Long> servicesTypeIds = roleServiceService.list(params).stream().map(dto -> dto.getServiceTypeId()).collect(Collectors.toList());
List<PensionServiceTypeDTO> resultList = new ArrayList<>();
for (Long typeId:servicesTypeIds) {
PensionServiceTypeDTO pensionServiceTypeDTO = get(typeId);
resultList.add(pensionServiceTypeDTO);
}
return resultList;
}
@Override
public List<PensionServiceTypeDTO> getServiceListByRole(Map<String, Object> params) {
// List<Long> userRole = roleUserService.list(params).stream().map(dto -> dto.getRoleId()).collect(Collectors.toList());
List<Long> allServicesTypeIds = roleServiceService.list(params).stream().map(dto -> dto.getServiceTypeId()).collect(Collectors.toList());
String isFree = (String)params.get("isFree");
List<PensionServiceEntity> pensionServices = pensionServiceDao.selectList(
new QueryWrapper<PensionServiceEntity>()
.in("service_type_id",allServicesTypeIds)
.eq(StringUtils.isNotBlank(isFree),"is_free",isFree).select("DISTINCT service_type_id"));
// pensionServices.stream().collect(Collectors.groupingBy(PensionServiceEntity::getServiceTypeId))
List<PensionServiceTypeDTO> resultList = new ArrayList<>();
for (PensionServiceEntity pensionService:pensionServices) {
PensionServiceTypeDTO pensionServiceTypeDTO = get(pensionService.getServiceTypeId());
resultList.add(pensionServiceTypeDTO);
}
return resultList;
}
}
......@@ -23,10 +23,11 @@ public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, Role
@Override
public QueryWrapper<RoleServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String o = (String)params.get("id");
String roleId = params.get("roleId") != null ?params.get("roleId").toString():"";
QueryWrapper<RoleServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(roleId), "role_id", roleId);
return wrapper;
}
......
......@@ -23,12 +23,14 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn
@Override
public QueryWrapper<RoleUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String userId = params.get("userId") != null?params.get("userId").toString():"";
QueryWrapper<RoleUserEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(userId), "user_id", userId);
return wrapper;
}
}
\ No newline at end of file
}
......@@ -5,9 +5,10 @@
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionServiceEntity" id="pensionServiceMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="serviceName" column="name"/>
<result property="serviceTypeId" column="service_type_id"/>
<result property="sort" column="sort"/>
<result property="isFree" column="is_free"/>
<result property="icon" column="icon"/>
<result property="detailPicture" column="detail_picture"/>
<result property="price" column="price"/>
......@@ -23,4 +24,4 @@
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
package io.hmit.test;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.dto.RoleServiceDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.management.relation.Role;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class TypeServiceTest {
@Autowired
private PensionServiceTypeService pensionServiceTypeService;
@Autowired
private PensionServiceService pensionServiceService;
@Autowired
private RoleServiceService roleServiceService;
@Autowired
private RoleService roleService;
@Test
public void test(){
System.out.println("hello world!!");
}
@Test
public void getList(){
List<Long> roleIds = new ArrayList<>();
roleIds.add(1354991196866453506L);
roleIds.add(1354991197348798465L);
Map<String, Object> params = new HashMap<>();
List<Long> servicesTypeIds =pensionServiceTypeService.list(params).stream().map(PensionServiceTypeDTO::getId).collect(Collectors.toList());
roleIds.forEach(roleId -> {
for (Long typeId:servicesTypeIds){
RoleServiceDTO roleServiceDTO = new RoleServiceDTO();
roleServiceDTO.setRoleId(roleId);
roleServiceDTO.setServiceTypeId(typeId);
roleServiceService.save(roleServiceDTO);
}
});
}
@Test
public void updateTime(){
Map<String, Object> params = new HashMap<>();
List<PensionServiceDTO> pensionServiceDTOS =pensionServiceService.list(params);
pensionServiceDTOS.stream().forEach(item ->{
item.setServiceTime("周一 ~ 周日 09:00-18:00");
item.setTimesNum(18);
item.setRemark("为老人提供免费的"+item.getServiceName()+"服务");
pensionServiceService.update(item);
});
}
@Test
public void saveServiceType(){
List<String> names = new ArrayList<>();
names.add("健康检查");
names.add("家政服务");
names.add("心理慰藉");
names.add("理发");
names.add("送药上门");
names.add("健康养生");
names.add("临终关怀");
names.forEach(name ->{
PensionServiceTypeDTO pensionServiceTypeDTO = new PensionServiceTypeDTO();
pensionServiceTypeDTO.setName(name);
pensionServiceTypeDTO.setSort(1);
pensionServiceTypeDTO.setIcon("");
pensionServiceTypeDTO.setRemark("");
pensionServiceTypeService.save(pensionServiceTypeDTO);
});
}
}
......@@ -198,7 +198,7 @@ public interface Constant {
/**
* 已取消
*/
CANCLE(3,"已取消");
CANCEL(3,"已取消");
private int status;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment