Commit 98829443 authored by lings's avatar lings

Merge remote-tracking branch 'origin/master'

parents 35871824 2abe9abb
package io.hmit.modules.serviceOrder.controller;
import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.ExcelUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
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.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.excel.PensionOrderDocumentExcel;
import io.hmit.modules.serviceOrder.service.PensionOrderDocumentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@RestController
@RequestMapping("serviceOrder/pensionorderdocument")
@Api(tags="订单及相关图片附件关联表")
public class PensionOrderDocumentController {
@Autowired
private PensionOrderDocumentService pensionOrderDocumentService;
@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")
})
@RequiresPermissions("serviceOrder:pensionorderdocument:page")
public Result<PageData<PensionOrderDocumentDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionOrderDocumentDTO> page = pensionOrderDocumentService.page(params);
return new Result<PageData<PensionOrderDocumentDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionorderdocument:info")
public Result<PensionOrderDocumentDTO> get(@PathVariable("id") Long id){
PensionOrderDocumentDTO data = pensionOrderDocumentService.get(id);
return new Result<PensionOrderDocumentDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("serviceOrder:pensionorderdocument:save")
public Result save(@RequestBody PensionOrderDocumentDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pensionOrderDocumentService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("serviceOrder:pensionorderdocument:update")
public Result update(@RequestBody PensionOrderDocumentDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionOrderDocumentService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("serviceOrder:pensionorderdocument:delete")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
pensionOrderDocumentService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("serviceOrder:pensionorderdocument:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PensionOrderDocumentDTO> list = pensionOrderDocumentService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PensionOrderDocumentExcel.class);
}
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.controller; package io.hmit.modules.serviceOrder.controller;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import io.hmit.common.annotation.LogOperation; import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.exception.ErrorCode;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.ExcelUtils; import io.hmit.common.utils.ExcelUtils;
import io.hmit.common.utils.Result; import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils; import io.hmit.common.validator.AssertUtils;
...@@ -10,6 +15,7 @@ import io.hmit.common.validator.ValidatorUtils; ...@@ -10,6 +15,7 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup; import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup; import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.security.user.SecurityUser;
import io.hmit.modules.serviceOrder.dto.UserDTO; import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.excel.UserExcel; import io.hmit.modules.serviceOrder.excel.UserExcel;
import io.hmit.modules.serviceOrder.service.RoleUserService; import io.hmit.modules.serviceOrder.service.RoleUserService;
...@@ -18,12 +24,18 @@ import io.swagger.annotations.Api; ...@@ -18,12 +24,18 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -42,6 +54,8 @@ public class UserController { ...@@ -42,6 +54,8 @@ public class UserController {
private UserService userService; private UserService userService;
@Autowired @Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Value("${QR.download-path}")
private String QRPath;
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
...@@ -63,7 +77,7 @@ public class UserController { ...@@ -63,7 +77,7 @@ public class UserController {
@RequiresPermissions("serviceOrder:user:info") @RequiresPermissions("serviceOrder:user:info")
public Result<UserDTO> get(@PathVariable("id") Long id){ public Result<UserDTO> get(@PathVariable("id") Long id){
UserDTO data = userService.get(id); UserDTO data = userService.get(id);
roleUserService.getRoleIdList(data.getId()); data.setRoleIdList(roleUserService.getRoleIdList(data.getId()));
return new Result<UserDTO>().ok(data); return new Result<UserDTO>().ok(data);
} }
...@@ -119,4 +133,48 @@ public class UserController { ...@@ -119,4 +133,48 @@ public class UserController {
ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class);
} }
@PostMapping("importUserByExcel")
@ApiOperation("导入")
@LogOperation("导入")
// @RequiresPermissions("ops:assets:export")
public Result importUserByExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws Exception {
if (file.isEmpty()) {
return new Result<>().error(ErrorCode.UPLOAD_FILE_EMPTY);
}
String file_path = QRPath + file.getOriginalFilename();
File filePath = new File(file_path);
if (!filePath.getParentFile().exists()) {
filePath.mkdirs();
}
try {
file.transferTo(filePath);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
ImportParams params_import = new ImportParams();
params_import.setHeadRows(1);
params_import.setTitleRows(0);
String[] importFields = {"用户名","手机号","生日","地址_地区","详细地址"};
params_import.setImportFields(importFields);
params_import.setNeedVerify(true);
try {
// List<UserExcel> list = ExcelImportUtil.importExcel(filePath, UserExcel.class, params_import);
ExcelImportResult<UserExcel> result = null;
result = ExcelImportUtil.importExcelMore(filePath, UserExcel.class, params_import);
if (!result.isVerfiyFail()) {
List<UserExcel> list = result.getList();
for (UserExcel userExcel : list) {
userService.save(ConvertUtils.sourceToTarget(userExcel,UserDTO.class));
}
return new Result().ok("成功");
}else{
return new Result().error("上传的表格内容存在空值和错误!");
}
} catch (Exception e) {
// throw new IOException(e.getMessage());
return new Result().error(e.getMessage());
}
}
} }
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Mapper
public interface PensionOrderDocumentDao extends BaseDao<PensionOrderDocumentEntity> {
}
\ No newline at end of file
...@@ -31,6 +31,9 @@ public class PensionOrderDTO implements Serializable { ...@@ -31,6 +31,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "订单状态名称") @ApiModelProperty(value = "订单状态名称")
private String statusName; private String statusName;
@ApiModelProperty(value = "定位坐标")
private String location;
@ApiModelProperty(value = "详细地址") @ApiModelProperty(value = "详细地址")
private String address; private String address;
...@@ -49,6 +52,9 @@ public class PensionOrderDTO implements Serializable { ...@@ -49,6 +52,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "预约时间") @ApiModelProperty(value = "预约时间")
private Date appointmentTime; private Date appointmentTime;
@ApiModelProperty(value = "取消原因")
private String cancelReason;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
......
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@ApiModel(value = "订单及相关图片附件关联表")
public class PensionOrderDocumentDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "订单id")
private Long orderId;
@ApiModelProperty(value = "文件id")
private Long docId;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "文件链接")
private String filePath;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "更新者")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
\ No newline at end of file
...@@ -27,10 +27,6 @@ public class PensionServiceDTO extends TreeNode<PensionServiceDTO> implements Se ...@@ -27,10 +27,6 @@ public class PensionServiceDTO extends TreeNode<PensionServiceDTO> implements Se
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
@ApiModelProperty(value = "pid")
private Long pid;
@ApiModelProperty(value = "服务名称") @ApiModelProperty(value = "服务名称")
private String serviceName; private String serviceName;
......
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_order_document")
public class PensionOrderDocumentEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 文件id
*/
private Long docId;
/**
* 文件名
*/
private String fileName;
/**
* 文件链接
*/
private String filePath;
/**
* 备注
*/
private String remark;
/**
* 更新者
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
...@@ -35,6 +35,10 @@ public class PensionOrderEntity extends BaseEntity { ...@@ -35,6 +35,10 @@ public class PensionOrderEntity extends BaseEntity {
* 详细地址 * 详细地址
*/ */
private String address; private String address;
/**
* 定位坐标
*/
private String location;
/** /**
* 订单所属的服务id * 订单所属的服务id
*/ */
...@@ -55,6 +59,10 @@ public class PensionOrderEntity extends BaseEntity { ...@@ -55,6 +59,10 @@ public class PensionOrderEntity extends BaseEntity {
* 预约时间 * 预约时间
*/ */
private Date appointmentTime; private Date appointmentTime;
/**
* 取消原因
*/
private String cancelReason;
/** /**
* 备注 * 备注
*/ */
......
...@@ -25,9 +25,6 @@ public class PensionServiceEntity extends BaseEntity { ...@@ -25,9 +25,6 @@ public class PensionServiceEntity extends BaseEntity {
* 服务名称 * 服务名称
*/ */
private String serviceName; private String serviceName;
private Long pid;
/** /**
* 服务父类id * 服务父类id
*/ */
......
package io.hmit.modules.serviceOrder.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
public class PensionOrderDocumentExcel {
@Excel(name = "")
private Long id;
@Excel(name = "服务id")
private Long orderId;
@Excel(name = "文件id")
private Long docId;
@Excel(name = "文件名")
private String fileName;
@Excel(name = "文件链接")
private String filePath;
@Excel(name = "备注")
private String remark;
@Excel(name = "创建者")
private Long creator;
@Excel(name = "创建时间")
private Date createDate;
@Excel(name = "更新者")
private Long updater;
@Excel(name = "更新时间")
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
public interface PensionOrderDocumentService extends CrudService<PensionOrderDocumentEntity, PensionOrderDocumentDTO> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOrderDocumentDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderDocumentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Service
public class PensionOrderDocumentServiceImpl extends CrudServiceImpl<PensionOrderDocumentDao, PensionOrderDocumentEntity, PensionOrderDocumentDTO> implements PensionOrderDocumentService {
@Override
public QueryWrapper<PensionOrderDocumentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<PensionOrderDocumentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}
\ No newline at end of file
...@@ -38,6 +38,11 @@ spring: ...@@ -38,6 +38,11 @@ spring:
min-idle: 5 # 连接池中的最小空闲连接 min-idle: 5 # 连接池中的最小空闲连接
activiti: activiti:
check-process-definitions: false check-process-definitions: false
# mvc:
# static-path-pattern: /static/**
# resources:
# static-locations: file:${QR.download-path},classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/
#静态资源对外暴露的访问路径
fdfs: fdfs:
......
<?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="io.hmit.modules.serviceOrder.dao.PensionOrderDocumentDao">
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity" id="pensionOrderDocumentMap">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="docId" column="doc_id"/>
<result property="fileName" column="file_name"/>
<result property="filePath" column="file_path"/>
<result property="remark" column="remark"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao; ...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 用户 * 用户
* *
...@@ -15,4 +17,7 @@ public interface UserDao extends BaseDao<UserEntity> { ...@@ -15,4 +17,7 @@ public interface UserDao extends BaseDao<UserEntity> {
UserEntity getUserByMobile(String mobile); UserEntity getUserByMobile(String mobile);
UserEntity getUserByUserId(Long userId); UserEntity getUserByUserId(Long userId);
List<Long> getAllOrganizationStaff(Long userId);
} }
package io.hmit.modules.serviceOrder.controller; package io.hmit.modules.serviceOrder.controller;
import com.sun.xml.internal.bind.v2.TODO;
import io.hmit.annotation.Login; import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser; import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
...@@ -15,6 +14,7 @@ import io.hmit.entity.UserEntity; ...@@ -15,6 +14,7 @@ import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO; import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.service.PensionOrderService; import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.service.UserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -39,6 +39,9 @@ public class PensionOrderController { ...@@ -39,6 +39,9 @@ public class PensionOrderController {
@Autowired @Autowired
private PensionOrderService pensionOrderService; private PensionOrderService pensionOrderService;
@Autowired
private UserService userService;
@Login @Login
@GetMapping("page") @GetMapping("page")
@ApiOperation("全部订单(志愿者)") @ApiOperation("全部订单(志愿者)")
...@@ -243,6 +246,26 @@ public class PensionOrderController { ...@@ -243,6 +246,26 @@ public class PensionOrderController {
return new Result<PageData<PensionOrderDTO>>().ok(page); return new Result<PageData<PensionOrderDTO>>().ok(page);
} }
/**
* 老人、子女取消订单
*/
@Login
@GetMapping("elderFamilyCancel")
@ApiOperation(value = "老人、子女取消订单")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "订单ID", paramType = "query", required = true, dataType="long") ,
@ApiImplicitParam(name = "cancel_reason", value = "订单取消原因", paramType = "query", dataType="String")
})
public Result elderFamilyCancel(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
Boolean result = pensionOrderService.elderFamilyCancel(Long.parseLong(params.get("id").toString()), params.get("cancel_reason").toString());
if (!result) {
return new Result().error();
}
return new Result();
}
//新订单接口 //新订单接口
@GetMapping("{id}") @GetMapping("{id}")
...@@ -259,6 +282,8 @@ public class PensionOrderController { ...@@ -259,6 +282,8 @@ public class PensionOrderController {
public Result reservationOrder(@ApiIgnore @LoginUser UserEntity user,@RequestBody ReservationDTO dto){ public Result reservationOrder(@ApiIgnore @LoginUser UserEntity user,@RequestBody ReservationDTO dto){
PensionOrderDTO data = new PensionOrderDTO().assemblePensionOrder(dto,user); PensionOrderDTO data = new PensionOrderDTO().assemblePensionOrder(dto,user);
data.setCommunityId(user.getCommunityId());
data.setCommunityName(user.getCommunityName());
pensionOrderService.reservation(data); pensionOrderService.reservation(data);
return new Result(); return new Result();
} }
...@@ -296,4 +321,43 @@ public class PensionOrderController { ...@@ -296,4 +321,43 @@ public class PensionOrderController {
return new Result(); return new Result();
} }
/**
* 本机构全部人员
*/
@Login
@GetMapping("organizationStaff")
@ApiOperation(value = "本机构全部人员(机构)")
@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<UserEntity>> organizationStaff(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserEntity> page = userService.getOrganizationAllUsers(params, user.getId());
return new Result<PageData<UserEntity>>().ok(page);
}
/**
* 机构处理
*/
@Login
@GetMapping("organizationHandle")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传;传参为3(取消)时,cancel_reason必传;")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "订单ID", paramType = "query", required = true, dataType="long") ,
@ApiImplicitParam(name = "status", value = "处理状态: 5接单 1派单 3取消", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "recipient_id", value = "接单服务人员ID", paramType = "query", dataType="long") ,
@ApiImplicitParam(name = "cancel_reason", value = "订单取消原因", paramType = "query", dataType="String")
})
public Result organizationHandle(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
Boolean result = pensionOrderService.organizationHandle(params, user.getId());
if (!result) {
return new Result().error();
}
return new Result();
}
} }
package io.hmit.modules.serviceOrder.controller;
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;
import io.hmit.common.validator.AssertUtils;
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.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionDocumentService;
import io.hmit.modules.serviceOrder.service.PensionOrderDocumentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@RestController
@RequestMapping("serviceOrder/pensionorderdocument")
@Api(tags="订单及相关图片附件关联表")
public class PensionOrderDocumentController {
@Autowired
private PensionOrderDocumentService pensionOrderDocumentService;
@Autowired
private PensionDocumentService pensionDocumentService;
@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")
})
public Result<PageData<PensionOrderDocumentDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionOrderDocumentDTO> page = pensionOrderDocumentService.page(params);
return new Result<PageData<PensionOrderDocumentDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<PensionOrderDocumentDTO> get(@PathVariable("id") Long id){
PensionOrderDocumentDTO data = pensionOrderDocumentService.get(id);
return new Result<PensionOrderDocumentDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody PensionOrderDocumentDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pensionOrderDocumentService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody PensionOrderDocumentDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionOrderDocumentService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
pensionOrderDocumentService.delete(ids);
return new Result();
}
/**
* 上传文件
*/
@PostMapping("/uploadFile")
@ApiOperation("附件上传")
public Result<Map<String, Object>> uploadFile(@RequestParam("file") MultipartFile file,
@RequestParam("orderId") Long orderId){
Map<String, Object> fileMap = pensionDocumentService.uploadFile(file);
if (null != fileMap) {
PensionOrderDocumentDTO dto = new PensionOrderDocumentDTO();
dto.setCreateDate(new Date());
dto.setOrderId(orderId);
dto.setDocId(Long.parseLong(fileMap.get("docId").toString()));
dto.setFileName(fileMap.get("fileName").toString());
dto.setFilePath(fileMap.get("filePath").toString());
pensionOrderDocumentService.save(dto);
} else {
return null;
}
return new Result<Map<String, Object>>().ok(fileMap);
}
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Mapper
public interface PensionOrderDocumentDao extends BaseDao<PensionOrderDocumentEntity> {
}
\ No newline at end of file
...@@ -37,6 +37,9 @@ public class PensionOrderDTO implements Serializable { ...@@ -37,6 +37,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "详细地址") @ApiModelProperty(value = "详细地址")
private String address; private String address;
@ApiModelProperty(value = "定位坐标")
private String location;
@ApiModelProperty(value = "订单所属的服务id") @ApiModelProperty(value = "订单所属的服务id")
private Long serviceId; private Long serviceId;
...@@ -52,6 +55,9 @@ public class PensionOrderDTO implements Serializable { ...@@ -52,6 +55,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "预约时间") @ApiModelProperty(value = "预约时间")
private Date appointmentTime; private Date appointmentTime;
@ApiModelProperty(value = "取消原因")
private String cancelReason;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
......
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@ApiModel(value = "订单及相关图片附件关联表")
public class PensionOrderDocumentDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "订单id")
private Long orderId;
@ApiModelProperty(value = "文件id")
private Long docId;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "文件链接")
private String filePath;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "更新者")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_order_document")
public class PensionOrderDocumentEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 文件id
*/
private Long docId;
/**
* 文件名
*/
private String fileName;
/**
* 文件链接
*/
private String filePath;
/**
* 备注
*/
private String remark;
/**
* 更新者
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
...@@ -35,6 +35,10 @@ public class PensionOrderEntity extends BaseEntity { ...@@ -35,6 +35,10 @@ public class PensionOrderEntity extends BaseEntity {
* 详细地址 * 详细地址
*/ */
private String address; private String address;
/**
* 定位坐标
*/
private String location;
/** /**
* 订单所属的服务id * 订单所属的服务id
*/ */
...@@ -55,6 +59,10 @@ public class PensionOrderEntity extends BaseEntity { ...@@ -55,6 +59,10 @@ public class PensionOrderEntity extends BaseEntity {
* 预约时间 * 预约时间
*/ */
private Date appointmentTime; private Date appointmentTime;
/**
* 取消原因
*/
private String cancelReason;
/** /**
* 备注 * 备注
*/ */
......
...@@ -3,6 +3,9 @@ package io.hmit.modules.serviceOrder.service; ...@@ -3,6 +3,9 @@ package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService; import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO; import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity; import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/** /**
* 文件信息表 * 文件信息表
...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity; ...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
*/ */
public interface PensionDocumentService extends CrudService<PensionDocumentEntity, PensionDocumentDTO> { public interface PensionDocumentService extends CrudService<PensionDocumentEntity, PensionDocumentDTO> {
Map<String, Object> uploadFile(MultipartFile file);
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
public interface PensionOrderDocumentService extends CrudService<PensionOrderDocumentEntity, PensionOrderDocumentDTO> {
}
\ No newline at end of file
...@@ -47,4 +47,11 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen ...@@ -47,4 +47,11 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询机构订单 //查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId); PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
//机构处理订单状态
Boolean organizationHandle(Map<String, Object> params, Long userId);
//老人、子女取消订单
Boolean elderFamilyCancel(Long id, String reason);
} }
...@@ -2,13 +2,19 @@ package io.hmit.modules.serviceOrder.service.impl; ...@@ -2,13 +2,19 @@ package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.Result;
import io.hmit.modules.serviceOrder.dao.PensionDocumentDao; import io.hmit.modules.serviceOrder.dao.PensionDocumentDao;
import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO; import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity; import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionDocumentService; import io.hmit.modules.serviceOrder.service.PensionDocumentService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,5 +36,44 @@ public class PensionDocumentServiceImpl extends CrudServiceImpl<PensionDocumentD ...@@ -30,5 +36,44 @@ public class PensionDocumentServiceImpl extends CrudServiceImpl<PensionDocumentD
return wrapper; return wrapper;
} }
@Value("${QR.download-path}")
private String QRPath;
@Override
public Map<String, Object> uploadFile(MultipartFile file) {
if (file.isEmpty()) {
return null;
}
//生成随机时间错
Long currenttime=System.currentTimeMillis();
//上传文件
String file_path = "/static/"+ currenttime +"-" + file.getOriginalFilename();
String file_path_act = QRPath + currenttime+"-"+file.getOriginalFilename();
System.out.println(file_path_act);
File fileAct = new File(file_path_act);
if (!fileAct.getParentFile().exists()) {
fileAct.getParentFile().mkdirs();
}
try {
file.transferTo(fileAct);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
//保存文件信息
PensionDocumentEntity pensionDocumentEntity = new PensionDocumentEntity();
pensionDocumentEntity.setFileName(fileAct.getName());
pensionDocumentEntity.setFilePath(file_path);
pensionDocumentEntity.setFilePathAct(fileAct.getPath());
pensionDocumentEntity.setFileSize(Double.parseDouble(String.valueOf(file.getSize())));
pensionDocumentEntity.setFileType(file.getContentType());
pensionDocumentEntity.setStatus("1");
insert(pensionDocumentEntity);
Map<String, Object> result = new HashMap<>();
result.put("fileName",fileAct.getName());
result.put("filePath",file_path);
result.put("docId", pensionDocumentEntity.getId());
return result;
}
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOrderDocumentDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderDocumentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 订单及相关图片附件关联表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Service
public class PensionOrderDocumentServiceImpl extends CrudServiceImpl<PensionOrderDocumentDao, PensionOrderDocumentEntity, PensionOrderDocumentDTO> implements PensionOrderDocumentService {
@Override
public QueryWrapper<PensionOrderDocumentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<PensionOrderDocumentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}
\ No newline at end of file
...@@ -6,19 +6,21 @@ import io.hmit.common.constant.Constant; ...@@ -6,19 +6,21 @@ import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils; import io.hmit.common.utils.ConvertUtils;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao; import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderServiceDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderServiceDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity; import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService; import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.modules.serviceOrder.service.PensionOrderServiceService; import io.hmit.modules.serviceOrder.service.PensionOrderServiceService;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService; import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import io.hmit.service.UserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -50,6 +52,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -50,6 +52,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired @Autowired
private PensionOrganizationService pensionOrganizationService; private PensionOrganizationService pensionOrganizationService;
@Autowired
private UserService userService;
//查询全部订单 //查询全部订单
@Override @Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
...@@ -106,7 +111,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -106,7 +111,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Override @Override
public PageData<PensionOrderDTO> getElderAllOrderOrByStatusPage(Map<String, Object> params, Long creator, Integer status) { public PageData<PensionOrderDTO> getElderAllOrderOrByStatusPage(Map<String, Object> params, Long creator, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); // IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<PensionOrderDTO> list = new ArrayList<>(); List<PensionOrderDTO> list = new ArrayList<>();
if (null == status) { if (null == status) {
list = pensionOrderDao.getElderAllOrderOrByStatusList(params, creator, status); list = pensionOrderDao.getElderAllOrderOrByStatusList(params, creator, status);
...@@ -118,8 +123,8 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -118,8 +123,8 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
list.addAll(list1); list.addAll(list1);
list.addAll(list2); list.addAll(list2);
} }
page.setTotal(list.size()); // page.setTotal(list.size());
return getPageData(list, page.getTotal(), PensionOrderDTO.class); return getPageData(getSubList(params, list), list.size(), PensionOrderDTO.class);
} }
@Override @Override
...@@ -139,7 +144,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -139,7 +144,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Override @Override
public PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId) {
//登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List) //登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List)
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); // IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = pensionOrganizationService.findServiceIdListByServiceUserId(userId); List<Long> serviceIds = pensionOrganizationService.findServiceIdListByServiceUserId(userId);
Integer status = null; Integer status = null;
if (null != params.get("status")) { if (null != params.get("status")) {
...@@ -150,8 +155,82 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -150,8 +155,82 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
List<PensionOrderDTO> list = pensionOrderDao.getAllOrderByServiceId(id, status); List<PensionOrderDTO> list = pensionOrderDao.getAllOrderByServiceId(id, status);
result.addAll(list); result.addAll(list);
} }
page.setTotal(result.size()); // page.setTotal(result.size());
return getPageData(result, page.getTotal(), PensionOrderDTO.class);
return getPageData(getSubList(params, result), result.size(), PensionOrderDTO.class);
}
@Override
public Boolean organizationHandle(Map<String, Object> params, Long userId) {
//userId 可用于校验是否属于本机构的订单,暂未使用
Long orderId = Long.parseLong(params.get("id").toString());
PensionOrderEntity pensionOrderEntity = pensionOrderDao.selectById(orderId);
Integer status = Integer.parseInt(params.get("status").toString());
if (status == 5) { //接单
if (pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(5);
pensionOrderEntity.setStatusName(Constant.OrderStatus.HAND_OUT.getMessage());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 1){ //派单
Long recipient_id = Long.parseLong(params.get("recipient_id").toString());
if (pensionOrderEntity.getStatus() == 5) {
pensionOrderEntity.setStatus(1);
pensionOrderEntity.setStatusName(Constant.OrderStatus.ORDER.getMessage());
UserEntity recipient = userService.getUserByUserId(recipient_id);
pensionOrderEntity.setOrderRecipientId(recipient_id);
pensionOrderEntity.setOrderRecipientName(recipient.getUsername());
pensionOrderEntity.setOrderRecipientPhone(recipient.getMobile());
pensionOrderEntity.setOrderRecipientTime(new Date());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 3) {
if (pensionOrderEntity.getStatus() != 2 && pensionOrderEntity.getStatus() != 4) {
pensionOrderEntity.setStatus(3);
pensionOrderEntity.setStatusName(Constant.OrderStatus.CANCEL.getMessage());
pensionOrderEntity.setCancelReason(params.get("cancel_reason").toString());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
} else {
return false;
}
}
return true;
}
@Override
public Boolean elderFamilyCancel(Long id, String reason) {
PensionOrderEntity pensionOrderEntity = pensionOrderDao.selectById(id);
if (null != pensionOrderEntity.getStatus() && pensionOrderEntity.getStatus() != 2 && pensionOrderEntity.getStatus() != 4) {
pensionOrderEntity.setStatus(3);
pensionOrderEntity.setStatusName(Constant.OrderStatus.CANCEL.getMessage());
pensionOrderEntity.setCancelReason(reason);
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
return true;
}
return false;
}
//对List进行手动分页
private List<PensionOrderDTO> getSubList(Map<String, Object> params, List<PensionOrderDTO> list){
Integer pageNum = Integer.parseInt(params.get("page").toString());
Integer pageSize = Integer.parseInt(params.get("limit").toString());
Integer count = list.size();
Integer pageNo = (pageNum - 1) * pageSize;
List<PensionOrderDTO> list2 ;
if (pageNo+pageSize > count) {
if (pageNo > count){
list2 = new ArrayList<>();
}else {
list2 = list.subList(pageNo, count);
}
}else {
list2 = list.subList(pageNo, pageNo+pageSize);
}
return list2;
} }
} }
package io.hmit.service; package io.hmit.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.BaseService; import io.hmit.common.service.BaseService;
import io.hmit.dto.LoginDTO; import io.hmit.dto.LoginDTO;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import java.util.Map; import java.util.Map;
...@@ -24,4 +26,7 @@ public interface UserService extends BaseService<UserEntity> { ...@@ -24,4 +26,7 @@ public interface UserService extends BaseService<UserEntity> {
* @return 返回登录信息 * @return 返回登录信息
*/ */
Map<String, Object> login(LoginDTO dto); Map<String, Object> login(LoginDTO dto);
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
} }
package io.hmit.service.impl; package io.hmit.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.exception.ErrorCode; import io.hmit.common.exception.ErrorCode;
import io.hmit.common.exception.HmitException; import io.hmit.common.exception.HmitException;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.BaseServiceImpl; import io.hmit.common.service.impl.BaseServiceImpl;
import io.hmit.common.validator.AssertUtils; import io.hmit.common.validator.AssertUtils;
import io.hmit.dao.UserDao; import io.hmit.dao.UserDao;
...@@ -14,7 +17,9 @@ import org.apache.commons.codec.digest.DigestUtils; ...@@ -14,7 +17,9 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
...@@ -23,6 +28,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -23,6 +28,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired
private UserDao userDao;
@Override @Override
public UserEntity getByMobile(String mobile) { public UserEntity getByMobile(String mobile) {
return baseDao.getUserByMobile(mobile); return baseDao.getUserByMobile(mobile);
...@@ -54,4 +62,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -54,4 +62,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return map; return map;
} }
@Override
public PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId) {
IPage<UserEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = userDao.getAllOrganizationStaff(userId);
List<UserEntity> list = new ArrayList<>();
for (Long id : serviceIds) {
UserEntity userEntity = userDao.selectById(id);
list.add(userEntity);
}
page.setTotal(list.size());
return getPageData(list, page.getTotal(), UserEntity.class);
}
} }
\ No newline at end of file
...@@ -38,6 +38,11 @@ spring: ...@@ -38,6 +38,11 @@ spring:
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接 max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接 min-idle: 5 # 连接池中的最小空闲连接
# mvc:
# static-path-pattern: /static/**
# resources:
# static-locations: file:${QR.download-path},classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/
# #静态资源对外暴露的访问路径
hmit: hmit:
redis: redis:
...@@ -64,4 +69,7 @@ mybatis-plus: ...@@ -64,4 +69,7 @@ mybatis-plus:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
cache-enabled: false cache-enabled: false
call-setters-on-nulls: true call-setters-on-nulls: true
jdbc-type-for-null: 'null' jdbc-type-for-null: 'null'
\ No newline at end of file QR:
# download-path: /home/resourse/bsqzc/ D:/123/ /home/websoft/java_jar/bl_workorder/myfile/
download-path: D:/123/
\ No newline at end of file
...@@ -10,4 +10,10 @@ ...@@ -10,4 +10,10 @@
<select id="getUserByUserId" resultType="io.hmit.entity.UserEntity"> <select id="getUserByUserId" resultType="io.hmit.entity.UserEntity">
select * from tb_user where id = #{value} select * from tb_user where id = #{value}
</select> </select>
<select id="getAllOrganizationStaff" resultType="Long">
SELECT user_id FROM pension_organization_user
WHERE organization_id = (SELECT organization_id FROM pension_organization_user
WHERE user_id = #{userId});
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity"> <select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date po.creator, po.creator_name, po.creator_tel, po.create_date
FROM pension_order po FROM pension_order po
WHERE po.id = #{orderId} AND po.status = #{status} WHERE po.id = #{orderId} AND po.status = #{status}
...@@ -43,9 +43,9 @@ ...@@ -43,9 +43,9 @@
<select id="getOrderPageByStatusOrUserId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getOrderPageByStatusOrUserId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
...@@ -69,9 +69,9 @@ ...@@ -69,9 +69,9 @@
<select id="getOrderInfoByIdAndUserIdOrStatus" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getOrderInfoByIdAndUserIdOrStatus" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
...@@ -86,9 +86,9 @@ ...@@ -86,9 +86,9 @@
<select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
...@@ -97,9 +97,9 @@ ...@@ -97,9 +97,9 @@
<select id="getElderTodayOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getElderTodayOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
...@@ -108,9 +108,9 @@ ...@@ -108,9 +108,9 @@
<select id="getElderAllOrderOrByStatusList" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getElderAllOrderOrByStatusList" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
...@@ -122,9 +122,9 @@ ...@@ -122,9 +122,9 @@
<select id="getAllOrderByCommunityUserIdPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getAllOrderByCommunityUserIdPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps, tb_user tu FROM pension_order po, pension_service ps, tb_user tu
...@@ -133,9 +133,9 @@ ...@@ -133,9 +133,9 @@
<select id="getElderAllOrderByCommunityUserIdPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getElderAllOrderByCommunityUserIdPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps, tb_user tu FROM pension_order po, pension_service ps, tb_user tu
...@@ -145,9 +145,9 @@ ...@@ -145,9 +145,9 @@
<select id="getAllOrderByServiceId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO"> <select id="getAllOrderByServiceId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name, SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.location,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone, po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id, po.act_price, po.community_name, po.community_id, po.dept_id, po.cancel_reason,
po.creator, po.creator_name, po.creator_tel, po.create_date, po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon ps.icon
FROM pension_order po, pension_service ps FROM pension_order po, pension_service ps
......
<?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="io.hmit.modules.serviceOrder.dao.PensionOrderDocumentDao">
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity" id="pensionOrderDocumentMap">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="docId" column="doc_id"/>
<result property="fileName" column="file_name"/>
<result property="filePath" column="file_path"/>
<result property="remark" column="remark"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
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