Commit 2723f560 authored by Shen's avatar Shen

1. 添加机构端查看本机构活动

2. 添加活动状态枚举类接口,删除无用方法
3. 优化前端接口接收字段
4. 更新公众号信息,优化模板消息推送(待微信审核未测试)
parent 6cdd2a41
......@@ -33,7 +33,7 @@ public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com")
// .host("byyl.zjhmit.com")
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,生成接口文档
......
......@@ -10,6 +10,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.PensionEventDTO;
import io.hmit.modules.serviceOrder.excel.PensionEventExcel;
import io.hmit.modules.serviceOrder.service.PensionEventService;
......@@ -55,6 +56,22 @@ public class PensionEventController {
return new Result<PageData<PensionEventDTO>>().ok(page);
}
@GetMapping("eventByOrg")
@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:pensionevent:page")
public Result<PageData<PensionEventDTO>> eventByOrg(@ApiIgnore @RequestParam Map<String, Object> params){
params.put("event_org_id", SecurityUser.getUser());
PageData<PensionEventDTO> page = pensionEventService.page(params);
return new Result<PageData<PensionEventDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionevent:info")
......
......@@ -146,22 +146,38 @@ public class PensionOrderController {
/**
* 机构处理
*/
@GetMapping("organizationHandle")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,需要recipient_id和appointment_time;传参为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 = "status", value = "处理状态: 5接单 1派单 3取消 4机构完成", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "recipientId", value = "接单服务人员ID", paramType = "query", dataType="long") ,
@ApiImplicitParam(name = "appointmentTime", value = "预约时间", paramType = "query", dataType="Date") ,
@ApiImplicitParam(name = "cancelReason", value = "订单取消原因", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "remark", value = "备注", paramType = "query", defaultValue = "null", dataType="String")
})
public Result organizationHandle(@ApiIgnore @RequestParam Map<String, Object> params){
// Boolean result = pensionOrderService.organizationHandle(params, SecurityUser.getUserId());
Boolean result = pensionOrderService.organizationHandle(params, 1L);
Boolean result = pensionOrderService.organizationHandle(params, SecurityUser.getUserId());
if (!result) {
return new Result().error();
}
return new Result();
}
// @GetMapping("organizationHandle")
// @ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传")
// @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")
// })
// public Result organizationHandle(@ApiIgnore @RequestParam Map<String, Object> params){
//// Boolean result = pensionOrderService.organizationHandle(params, SecurityUser.getUserId());
// Boolean result = pensionOrderService.organizationHandle(params, 1L);
// if (!result) {
// return new Result().error();
// }
// return new Result();
// }
/**
* 本机构全部人员
......
......@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -91,18 +92,23 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
//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) {//接单
pensionOrderEntity.setRemark(null != params.get("remark") ? params.get("remark").toString() : "");
int status = Integer.parseInt(params.get("status").toString());
if (status == 5) { //接单
if (pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(5);
pensionOrderEntity.setStatusName(Constant.OrderStatus.HAND_OUT.getMessage());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
pensionOrderEntity.setAppointmentTime(sdf.parse(params.get("appointmentTime").toString()));
}catch (Exception ignored){}
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) {
Long recipient_id = Long.parseLong(params.get("recipientId").toString());
if (pensionOrderEntity.getStatus() == 5 || pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(1);
pensionOrderEntity.setStatusName(Constant.OrderStatus.ORDER.getMessage());
UserEntity recipient = userService.getUserByUserId(recipient_id);
......@@ -118,12 +124,59 @@ 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());
pensionOrderEntity.setCancelReason(params.get("cancelReason").toString());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
} else {
return false;
}
}else if (status == 4) {
if (pensionOrderEntity.getStatus() == Constant.OrderStatus.ORDER.geStatus()) {
pensionOrderEntity.setStatus(Constant.OrderStatus.WAIT_EVALUATE.geStatus());
pensionOrderEntity.setStatusName(Constant.OrderStatus.WAIT_EVALUATE.getMessage());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}
}
return true;
}
// @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;
// }
}
package io.hmit.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/**
* @Description : TODO
* @Author : Shen Yuanfeng
* @Date : 2021/5/7 13:48
*/
//@Configuration
public class StaticMvcConfigurer extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("file:/home/websoft/java_jar/pension_service/myfile/");
registry.addResourceHandler("swagger-ui.html", "/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/","classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}
......@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
// .host("byyl.zjhmit.com")
.host("byyl.zjhmit.com")
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,才生成接口文档
......
package io.hmit.modules.serviceOrder.controller;
import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant;
import io.hmit.common.enums.EventEnum;
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.PensionEventDTO;
import io.hmit.modules.serviceOrder.excel.PensionEventExcel;
import io.hmit.modules.serviceOrder.service.PensionEventService;
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.HashMap;
import java.util.Map;
......@@ -48,7 +39,6 @@ public class PensionEventController {
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@RequiresPermissions("serviceOrder:pensionevent:page")
public Result<PageData<PensionEventDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionEventDTO> page = pensionEventService.page(params);
......@@ -57,60 +47,54 @@ public class PensionEventController {
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionevent:info")
public Result<PensionEventDTO> get(@PathVariable("id") Long id){
PensionEventDTO data = pensionEventService.get(id);
return new Result<PensionEventDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("serviceOrder:pensionevent:save")
public Result save(@RequestBody PensionEventDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pensionEventService.save(dto);
return new Result();
@GetMapping("getAllStatus")
@ApiOperation("获取状态枚举")
public Result getAllStatus() {
Map<String, String> map = new HashMap<>();
EventEnum[] status = EventEnum.values();
for (EventEnum eventEnum : status) {
map.put(eventEnum.getCode().toString(), eventEnum.getMsg());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("serviceOrder:pensionevent:update")
public Result update(@RequestBody PensionEventDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionEventService.update(dto);
return new Result();
return new Result().ok(map);
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("serviceOrder:pensionevent:delete")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
pensionEventService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("serviceOrder:pensionevent:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PensionEventDTO> list = pensionEventService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PensionEventExcel.class);
}
// @PostMapping
// @ApiOperation("保存")
// public Result save(@RequestBody PensionEventDTO dto){
// //校验数据
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
//
// pensionEventService.save(dto);
//
// return new Result();
// }
// @PutMapping
// @ApiOperation("修改")
// public Result update(@RequestBody PensionEventDTO dto){
// //校验数据
// ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
//
// pensionEventService.update(dto);
//
// return new Result();
// }
// @DeleteMapping
// @ApiOperation("删除")
// public Result delete(@RequestBody Long[] ids){
// //校验数据
// AssertUtils.isArrayEmpty(ids, "id");
//
// pensionEventService.delete(ids);
//
// return new Result();
// }
}
\ No newline at end of file
......@@ -56,10 +56,10 @@ public class EnrollDTO implements Serializable {
private String remark;
@ApiModelProperty(value = "创建时间")
private Date createTime;
private Date createDate;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -16,9 +16,11 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_enroll")
public class EnrollEntity extends BaseEntity {
public class EnrollEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 用户id
*/
......@@ -66,9 +68,9 @@ public class EnrollEntity extends BaseEntity {
/**
* 创建时间
*/
private Date createTime;
private Date createDate;
/**
* 更新时间
*/
private Date updateTime;
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -16,9 +16,11 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_event")
public class PensionEventEntity extends BaseEntity {
public class PensionEventEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 活动名称
*/
......@@ -91,6 +93,14 @@ public class PensionEventEntity extends BaseEntity {
* 备注
*/
private String remark;
/**
* 创建者
*/
private Long creator;
/**
* 创建时间
*/
private Date createDate;
/**
* 更新时间
*/
......
......@@ -11,6 +11,7 @@ import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -30,6 +31,9 @@ import java.util.Map;
@Service
public class PushMessageImpl implements PushMessage {
@Value("${SYSURL.url}")
private String SYSURL;
@Autowired
private WxMpService wxMpService;
......@@ -57,6 +61,7 @@ public class PushMessageImpl implements PushMessage {
new WxMpTemplateData("remark", "当前状态:" + pensionOrderDTO.getStatusName())
);
templateMessage.setData(data);
templateMessage.setUrl(SYSURL + "/?openid=" + openId + "#/orderDetail?id=" + pensionOrderDTO.getId());
try{
wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
}catch (WxErrorException e){
......
......@@ -75,8 +75,12 @@ QR:
# download-path: D:/123/ /home/websoft/java_jar/pension_service/myfile/
download-path: /home/websoft/java_jar/pension_service/myfile/
SYSURL:
url: https://byyl.zjhmit.com
wechat:
mpAppId: wx6e3288074243a47f
mpAppId: wx35380be533d0e4f9
# mpAppId: wx6e3288074243a47f
mpAppSecret: f7b1120a49de078dd1be0080832ad42f
# mpAppSecret: 603d6ebf4db906bdb24eb9a1c0cbb444
templateId: _7PQQku6jHU4yE42NZIbX9cyvRWeeMSAGKhhs0uzWYM
\ No newline at end of file
......@@ -16,8 +16,8 @@
<result property="mobile" column="mobile"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="createDate" column="create_time"/>
<result property="createDate" column="update_time"/>
</resultMap>
......
......@@ -25,4 +25,5 @@ public enum EventEnum {
this.code = code;
this.msg = msg;
}
}
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