diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderWarnRecordController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderWarnRecordController.java new file mode 100644 index 00000000..a31bd9aa --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderWarnRecordController.java @@ -0,0 +1,202 @@ +package com.ghy.web.controller.order; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.ghy.common.enums.WxMsgEnum; +import com.ghy.common.utils.WechatMsgUtils; +import com.ghy.customer.domain.Customer; +import com.ghy.customer.service.CustomerService; +import com.ghy.order.domain.OrderDetail; +import com.ghy.order.domain.OrderMaster; +import com.ghy.order.service.OrderDetailService; +import com.ghy.order.service.OrderMasterService; +import com.ghy.worker.domain.Worker; +import com.ghy.worker.service.WorkerService; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import com.ghy.common.annotation.Log; +import com.ghy.common.enums.BusinessType; +import com.ghy.order.domain.OrderWarnRecord; +import com.ghy.order.service.IOrderWarnRecordService; +import com.ghy.common.core.controller.BaseController; +import com.ghy.common.core.domain.AjaxResult; +import com.ghy.common.utils.poi.ExcelUtil; +import com.ghy.common.core.page.TableDataInfo; + +import javax.annotation.Resource; + +/** + * 订单急报记录Controller + * + * @author clunt + * @date 2024-02-18 + */ +@Controller +@RequestMapping("/warn/record") +public class OrderWarnRecordController extends BaseController +{ + private String prefix = "warn/record"; + + @Autowired + private IOrderWarnRecordService orderWarnRecordService; + + @Resource + private OrderMasterService orderMasterService; + + @Resource + private OrderDetailService orderDetailService; + + @Resource + private WorkerService workerService; + + @Resource + private CustomerService customerService; + + @RequiresPermissions("warn:record:view") + @GetMapping() + public String record() + { + return prefix + "/record"; + } + + /** + * 查询订单急报记录列表 + */ + @RequiresPermissions("warn:record:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(OrderWarnRecord orderWarnRecord) + { + startPage(); + List list = orderWarnRecordService.selectOrderWarnRecordList(orderWarnRecord); + return getDataTable(list); + } + + /** + * App查询订单急报记录列表 + */ + @ApiOperation("急报操作记录列表") + @PostMapping("/app/list") + @ResponseBody + public TableDataInfo appList(@RequestBody OrderWarnRecord orderWarnRecord) + { + startPage(); + List list = orderWarnRecordService.selectOrderWarnRecordList(orderWarnRecord); + return getDataTable(list); + } + + @ApiOperation("新增急报记录(约单/催单)") + @PostMapping("/app/add") + @ResponseBody + public AjaxResult appAdd(@RequestBody OrderWarnRecord orderWarnRecord) + { + Worker worker; + Customer customer; + if("01".equals(orderWarnRecord.getOrderType())){ + OrderMaster orderMaster = orderMasterService.selectById(orderWarnRecord.getOrderId()); + worker = workerService.selectById(orderMaster.getWorkerId()); + customer = customerService.selectByCustomerId(orderMaster.getCustomerId()); + }else { + OrderDetail orderDetail = orderDetailService.selectById(orderWarnRecord.getOrderId()); + worker = workerService.selectById(orderDetail.getWorkerId()); + customer = customerService.selectByCustomerId(orderDetail.getCustomerId()); + } + // 发送急报 + // 推送公众号通知数据。 + try { + // 消息组装。 + Map params = new HashMap<>(); + // 订单编号 + params.put("thing3", customer.getName()); + // 名称 + params.put("thing14", orderWarnRecord.getContent()); + // 反馈时间 + params.put("time6", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date())); + // 消息推送 + WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.WARN_ORDER, params); + } catch (Exception e) { + // 暂时不做任何操作。 + logger.error(e.getMessage(), e); + } + return toAjax(orderWarnRecordService.insertOrderWarnRecord(orderWarnRecord)); + } + + + /** + * 导出订单急报记录列表 + */ + @RequiresPermissions("warn:record:export") + @Log(title = "订单急报记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(OrderWarnRecord orderWarnRecord) + { + List list = orderWarnRecordService.selectOrderWarnRecordList(orderWarnRecord); + ExcelUtil util = new ExcelUtil(OrderWarnRecord.class); + return util.exportExcel(list, "订单急报记录数据"); + } + + /** + * 新增订单急报记录 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存订单急报记录 + */ + @RequiresPermissions("warn:record:add") + @Log(title = "订单急报记录", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(OrderWarnRecord orderWarnRecord) + { + return toAjax(orderWarnRecordService.insertOrderWarnRecord(orderWarnRecord)); + } + + /** + * 修改订单急报记录 + */ + @RequiresPermissions("warn:record:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) + { + OrderWarnRecord orderWarnRecord = orderWarnRecordService.selectOrderWarnRecordById(id); + mmap.put("orderWarnRecord", orderWarnRecord); + return prefix + "/edit"; + } + + /** + * 修改保存订单急报记录 + */ + @RequiresPermissions("warn:record:edit") + @Log(title = "订单急报记录", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(OrderWarnRecord orderWarnRecord) + { + return toAjax(orderWarnRecordService.updateOrderWarnRecord(orderWarnRecord)); + } + + /** + * 删除订单急报记录 + */ + @RequiresPermissions("warn:record:remove") + @Log(title = "订单急报记录", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(orderWarnRecordService.deleteOrderWarnRecordByIds(ids)); + } +} diff --git a/ghy-common/src/main/java/com/ghy/common/enums/WxMsgEnum.java b/ghy-common/src/main/java/com/ghy/common/enums/WxMsgEnum.java index b26bf25e..59e0152d 100644 --- a/ghy-common/src/main/java/com/ghy/common/enums/WxMsgEnum.java +++ b/ghy-common/src/main/java/com/ghy/common/enums/WxMsgEnum.java @@ -15,6 +15,9 @@ public enum WxMsgEnum { CUSTOMER_ORDER("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM"), /** 测试 **/ TEXT("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM"), + + /** 急报 **/ + WARN_ORDER("", "0RSuVHHP_okErJ1acQmIirBU7TrQYR0xPBgBHyt_azA") ; /** 超时消息通知 */ // OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"), diff --git a/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java b/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java index e06987ae..7e4e4a8b 100644 --- a/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java +++ b/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java @@ -291,6 +291,7 @@ public class ShiroConfig filterChainDefinitionMap.put("/customer/address/**", "anon"); filterChainDefinitionMap.put("/customer/place/app/**", "anon"); filterChainDefinitionMap.put("/order/operate/app/**", "anon"); + filterChainDefinitionMap.put("/warn/record/app/**", "anon"); filterChainDefinitionMap.put("/customer/selection/app/**", "anon"); filterChainDefinitionMap.put("/jim/**", "anon"); filterChainDefinitionMap.put("/MP_verify_bRFuvYpyQ4WLr0on.txt", "anon"); diff --git a/ghy-order/src/main/java/com/ghy/order/domain/OrderWarnRecord.java b/ghy-order/src/main/java/com/ghy/order/domain/OrderWarnRecord.java new file mode 100644 index 00000000..4bb06d2b --- /dev/null +++ b/ghy-order/src/main/java/com/ghy/order/domain/OrderWarnRecord.java @@ -0,0 +1,41 @@ +package com.ghy.order.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ghy.common.annotation.Excel; +import com.ghy.common.core.domain.BaseEntity; + +/** + * 订单急报记录对象 order_warn_record + * + * @author clunt + * @date 2024-02-18 + */ +@Data +@ApiModel(value = "急报请求(约单,催单)") +public class OrderWarnRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 订单id */ + @Excel(name = "订单id") + @ApiModelProperty(value = "订单id") + private Long orderId; + + /** 订单类型 01.主单 02.子单 */ + @Excel(name = "订单类型 01.主单 02.子单") + @ApiModelProperty(value = "订单类型 01.主单 02.子单") + private String orderType; + + /** 内容(不超过20字) */ + @Excel(name = "内容(不超过20字)") + @ApiModelProperty(value = "格式为 催单或者约单,期待时间yyyy-hh-dd hh:mm") + private String content; + +} diff --git a/ghy-order/src/main/java/com/ghy/order/mapper/OrderWarnRecordMapper.java b/ghy-order/src/main/java/com/ghy/order/mapper/OrderWarnRecordMapper.java new file mode 100644 index 00000000..efc129df --- /dev/null +++ b/ghy-order/src/main/java/com/ghy/order/mapper/OrderWarnRecordMapper.java @@ -0,0 +1,61 @@ +package com.ghy.order.mapper; + +import java.util.List; +import com.ghy.order.domain.OrderWarnRecord; + +/** + * 订单急报记录Mapper接口 + * + * @author clunt + * @date 2024-02-18 + */ +public interface OrderWarnRecordMapper +{ + /** + * 查询订单急报记录 + * + * @param id 订单急报记录主键 + * @return 订单急报记录 + */ + public OrderWarnRecord selectOrderWarnRecordById(Long id); + + /** + * 查询订单急报记录列表 + * + * @param orderWarnRecord 订单急报记录 + * @return 订单急报记录集合 + */ + public List selectOrderWarnRecordList(OrderWarnRecord orderWarnRecord); + + /** + * 新增订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + public int insertOrderWarnRecord(OrderWarnRecord orderWarnRecord); + + /** + * 修改订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + public int updateOrderWarnRecord(OrderWarnRecord orderWarnRecord); + + /** + * 删除订单急报记录 + * + * @param id 订单急报记录主键 + * @return 结果 + */ + public int deleteOrderWarnRecordById(Long id); + + /** + * 批量删除订单急报记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteOrderWarnRecordByIds(String[] ids); +} \ No newline at end of file diff --git a/ghy-order/src/main/java/com/ghy/order/service/IOrderWarnRecordService.java b/ghy-order/src/main/java/com/ghy/order/service/IOrderWarnRecordService.java new file mode 100644 index 00000000..be1fb3db --- /dev/null +++ b/ghy-order/src/main/java/com/ghy/order/service/IOrderWarnRecordService.java @@ -0,0 +1,61 @@ +package com.ghy.order.service; + +import java.util.List; +import com.ghy.order.domain.OrderWarnRecord; + +/** + * 订单急报记录Service接口 + * + * @author clunt + * @date 2024-02-18 + */ +public interface IOrderWarnRecordService +{ + /** + * 查询订单急报记录 + * + * @param id 订单急报记录主键 + * @return 订单急报记录 + */ + public OrderWarnRecord selectOrderWarnRecordById(Long id); + + /** + * 查询订单急报记录列表 + * + * @param orderWarnRecord 订单急报记录 + * @return 订单急报记录集合 + */ + public List selectOrderWarnRecordList(OrderWarnRecord orderWarnRecord); + + /** + * 新增订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + public int insertOrderWarnRecord(OrderWarnRecord orderWarnRecord); + + /** + * 修改订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + public int updateOrderWarnRecord(OrderWarnRecord orderWarnRecord); + + /** + * 批量删除订单急报记录 + * + * @param ids 需要删除的订单急报记录主键集合 + * @return 结果 + */ + public int deleteOrderWarnRecordByIds(String ids); + + /** + * 删除订单急报记录信息 + * + * @param id 订单急报记录主键 + * @return 结果 + */ + public int deleteOrderWarnRecordById(Long id); +} diff --git a/ghy-order/src/main/java/com/ghy/order/service/impl/OrderWarnRecordServiceImpl.java b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderWarnRecordServiceImpl.java new file mode 100644 index 00000000..f23524b3 --- /dev/null +++ b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderWarnRecordServiceImpl.java @@ -0,0 +1,97 @@ +package com.ghy.order.service.impl; + +import java.util.List; +import com.ghy.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ghy.order.mapper.OrderWarnRecordMapper; +import com.ghy.order.domain.OrderWarnRecord; +import com.ghy.order.service.IOrderWarnRecordService; +import com.ghy.common.core.text.Convert; + +/** + * 订单急报记录Service业务层处理 + * + * @author clunt + * @date 2024-02-18 + */ +@Service +public class OrderWarnRecordServiceImpl implements IOrderWarnRecordService +{ + @Autowired + private OrderWarnRecordMapper orderWarnRecordMapper; + + /** + * 查询订单急报记录 + * + * @param id 订单急报记录主键 + * @return 订单急报记录 + */ + @Override + public OrderWarnRecord selectOrderWarnRecordById(Long id) + { + return orderWarnRecordMapper.selectOrderWarnRecordById(id); + } + + /** + * 查询订单急报记录列表 + * + * @param orderWarnRecord 订单急报记录 + * @return 订单急报记录 + */ + @Override + public List selectOrderWarnRecordList(OrderWarnRecord orderWarnRecord) + { + return orderWarnRecordMapper.selectOrderWarnRecordList(orderWarnRecord); + } + + /** + * 新增订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + @Override + public int insertOrderWarnRecord(OrderWarnRecord orderWarnRecord) + { + orderWarnRecord.setCreateTime(DateUtils.getNowDate()); + return orderWarnRecordMapper.insertOrderWarnRecord(orderWarnRecord); + } + + /** + * 修改订单急报记录 + * + * @param orderWarnRecord 订单急报记录 + * @return 结果 + */ + @Override + public int updateOrderWarnRecord(OrderWarnRecord orderWarnRecord) + { + orderWarnRecord.setUpdateTime(DateUtils.getNowDate()); + return orderWarnRecordMapper.updateOrderWarnRecord(orderWarnRecord); + } + + /** + * 批量删除订单急报记录 + * + * @param ids 需要删除的订单急报记录主键 + * @return 结果 + */ + @Override + public int deleteOrderWarnRecordByIds(String ids) + { + return orderWarnRecordMapper.deleteOrderWarnRecordByIds(Convert.toStrArray(ids)); + } + + /** + * 删除订单急报记录信息 + * + * @param id 订单急报记录主键 + * @return 结果 + */ + @Override + public int deleteOrderWarnRecordById(Long id) + { + return orderWarnRecordMapper.deleteOrderWarnRecordById(id); + } +} diff --git a/ghy-order/src/main/resources/mapper/order/OrderWarnRecordMapper.xml b/ghy-order/src/main/resources/mapper/order/OrderWarnRecordMapper.xml new file mode 100644 index 00000000..167d3ea3 --- /dev/null +++ b/ghy-order/src/main/resources/mapper/order/OrderWarnRecordMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + select id, order_id, order_type, content, create_time, create_by, update_time, update_by, remark from order_warn_record + + + + + + + + insert into order_warn_record + + order_id, + order_type, + content, + create_time, + create_by, + update_time, + update_by, + remark, + + + #{orderId}, + #{orderType}, + #{content}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{remark}, + + + + + update order_warn_record + + order_id = #{orderId}, + order_type = #{orderType}, + content = #{content}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + + where id = #{id} + + + + delete from order_warn_record where id = #{id} + + + + delete from order_warn_record where id in + + #{id} + + + + \ No newline at end of file