Commit 2abe9abb authored by mengmeng's avatar mengmeng

Merge branch 'Shen' into 'master'

Shen

See merge request !14
parents 4a973dde d1bea003
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
......@@ -72,6 +72,18 @@ public class PensionServiceController {
return new Result<List<PensionServiceDTO>>().ok(pensionServiceDTOList);
}
@GetMapping("getServiceTree")
@ApiOperation("获取服务list不分页")
@ApiImplicitParams({
@ApiImplicitParam(name = "keyword", value = "查询字段,", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "serviceType", value = "服务类型", paramType = "query", dataType="String")
})
public Result<List<PensionServiceDTO>> getServiceTree(@ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceDTO> pensionServiceDTOList = pensionServiceService.getServiceTree(params);
return new Result<List<PensionServiceDTO>>().ok(pensionServiceDTOList);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionservice:info")
......
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.constant.Constant;
import io.hmit.common.exception.ErrorCode;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.ExcelUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
......@@ -10,6 +15,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.modules.security.user.SecurityUser;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.excel.UserExcel;
import io.hmit.modules.serviceOrder.service.RoleUserService;
......@@ -18,12 +24,18 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
......@@ -42,6 +54,8 @@ public class UserController {
private UserService userService;
@Autowired
private RoleUserService roleUserService;
@Value("${QR.download-path}")
private String QRPath;
@GetMapping("page")
@ApiOperation("分页")
......@@ -63,7 +77,7 @@ public class UserController {
@RequiresPermissions("serviceOrder:user:info")
public Result<UserDTO> get(@PathVariable("id") Long id){
UserDTO data = userService.get(id);
roleUserService.getRoleIdList(data.getId());
data.setRoleIdList(roleUserService.getRoleIdList(data.getId()));
return new Result<UserDTO>().ok(data);
}
......@@ -119,4 +133,48 @@ public class UserController {
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 {
@ApiModelProperty(value = "订单状态名称")
private String statusName;
@ApiModelProperty(value = "定位坐标")
private String location;
@ApiModelProperty(value = "详细地址")
private String address;
......
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.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.hmit.common.utils.TreeNode;
import io.hmit.modules.sys.dto.SysMenuDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -19,14 +21,14 @@ import java.util.List;
*/
@Data
@ApiModel(value = "服务表")
public class PensionServiceDTO implements Serializable {
public class PensionServiceDTO extends TreeNode<PensionServiceDTO> implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "服务名称")
private String name;
private String serviceName;
@ApiModelProperty(value = "服务内容介绍")
private String serviceContent;
......
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 {
* 详细地址
*/
private String address;
/**
* 定位坐标
*/
private String location;
/**
* 订单所属的服务id
*/
......
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
......@@ -23,7 +24,7 @@ public class PensionServiceEntity extends BaseEntity {
/**
* 服务名称
*/
private String name;
private String serviceName;
/**
* 服务父类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
......@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import java.util.List;
import java.util.Map;
/**
* 服务表
*
......@@ -12,4 +15,5 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
*/
public interface PensionServiceService extends CrudService<PensionServiceEntity, PensionServiceDTO> {
}
\ No newline at end of file
List<PensionServiceDTO> getServiceTree(Map<String, Object> params);
}
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
......@@ -2,13 +2,19 @@ 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.common.utils.ConvertUtils;
import io.hmit.common.utils.TreeUtils;
import io.hmit.modules.serviceOrder.dao.PensionServiceDao;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.hmit.modules.sys.dto.SysMenuDTO;
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.List;
import java.util.Map;
/**
......@@ -20,17 +26,18 @@ import java.util.Map;
@Service
public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao, PensionServiceEntity, PensionServiceDTO> implements PensionServiceService {
@Autowired
private PensionServiceService pensionServiceService;
@Override
public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String keyword = (String)params.get("keyword");
String serviceType = (String)params.get("serviceType");
QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(serviceType), "service_type_id", serviceType);
wrapper.like(StringUtils.isNotBlank(keyword), "name", keyword);
wrapper.like(StringUtils.isNotBlank(keyword), "service_name", keyword);
......@@ -38,4 +45,11 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
}
@Override
public List<PensionServiceDTO> getServiceTree(Map<String, Object> params) {
List<PensionServiceEntity> list = baseDao.selectList(getWrapper(params));
List<PensionServiceDTO> dtos = ConvertUtils.sourceToTarget(list,PensionServiceDTO.class);
return TreeUtils.build(dtos);
}
}
......@@ -38,6 +38,11 @@ spring:
min-idle: 5 # 连接池中的最小空闲连接
activiti:
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:
......
<?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
......@@ -5,8 +5,9 @@
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionServiceEntity" id="pensionServiceMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="serviceTypeId" column="service_type_id"/>
<result property="serviceName" column="service_name"/>
<result property="serviceParentId" column="service_parent_id"/>
<result property="pid" column="pid"/>
<result property="sort" column="sort"/>
<result property="icon" column="icon"/>
<result property="detailPicture" column="detail_picture"/>
......@@ -23,4 +24,4 @@
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
......@@ -246,6 +246,26 @@ public class PensionOrderController {
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}")
......@@ -324,11 +344,12 @@ public class PensionOrderController {
*/
@Login
@GetMapping("organizationHandle")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传")
@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 = "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){
......
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 {
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "定位坐标")
private String location;
@ApiModelProperty(value = "订单所属的服务id")
private Long serviceId;
......
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 {
* 详细地址
*/
private String address;
/**
* 定位坐标
*/
private String location;
/**
* 订单所属的服务id
*/
......
......@@ -3,6 +3,9 @@ package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO;
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;
*/
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
......@@ -48,6 +48,10 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询机构订单
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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.dto.PensionDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionDocumentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
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;
/**
......@@ -30,5 +36,44 @@ public class PensionDocumentServiceImpl extends CrudServiceImpl<PensionDocumentD
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
......@@ -166,7 +166,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
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 (status == 5) { //接单
if (pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(5);
pensionOrderEntity.setStatusName(Constant.OrderStatus.HAND_OUT.getMessage());
......@@ -192,6 +192,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
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;
......@@ -200,6 +201,19 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
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());
......
......@@ -38,6 +38,11 @@ spring:
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
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:
redis:
......@@ -64,4 +69,7 @@ mybatis-plus:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
\ No newline at end of file
jdbc-type-for-null: 'null'
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
......@@ -33,7 +33,7 @@
<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,
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.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
......@@ -43,7 +43,7 @@
<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,
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.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,
......@@ -69,7 +69,7 @@
<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,
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.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,
......@@ -86,7 +86,7 @@
<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,
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.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,
......@@ -97,7 +97,7 @@
<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,
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.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,
......@@ -108,7 +108,7 @@
<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,
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.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,
......@@ -122,7 +122,7 @@
<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,
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.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,
......@@ -133,7 +133,7 @@
<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,
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.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,
......@@ -145,7 +145,7 @@
<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,
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.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,
......
<?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