催单/约单

This commit is contained in:
kuang.yife 2024-02-18 15:33:21 +08:00
parent 2f488a71e1
commit 7cdbfe8e9d
8 changed files with 553 additions and 0 deletions

View File

@ -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<OrderWarnRecord> list = orderWarnRecordService.selectOrderWarnRecordList(orderWarnRecord);
return getDataTable(list);
}
/**
* App查询订单急报记录列表
*/
@ApiOperation("急报操作记录列表")
@PostMapping("/app/list")
@ResponseBody
public TableDataInfo appList(@RequestBody OrderWarnRecord orderWarnRecord)
{
startPage();
List<OrderWarnRecord> 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<String, Object> 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<OrderWarnRecord> list = orderWarnRecordService.selectOrderWarnRecordList(orderWarnRecord);
ExcelUtil<OrderWarnRecord> util = new ExcelUtil<OrderWarnRecord>(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));
}
}

View File

@ -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"),

View File

@ -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");

View File

@ -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;
}

View File

@ -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<OrderWarnRecord> 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);
}

View File

@ -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<OrderWarnRecord> 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);
}

View File

@ -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<OrderWarnRecord> 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);
}
}

View File

@ -0,0 +1,87 @@
<?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="com.ghy.order.mapper.OrderWarnRecordMapper">
<resultMap type="OrderWarnRecord" id="OrderWarnRecordResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="orderType" column="order_type" />
<result property="content" column="content" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectOrderWarnRecordVo">
select id, order_id, order_type, content, create_time, create_by, update_time, update_by, remark from order_warn_record
</sql>
<select id="selectOrderWarnRecordList" parameterType="OrderWarnRecord" resultMap="OrderWarnRecordResult">
<include refid="selectOrderWarnRecordVo"/>
<where>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
</select>
<select id="selectOrderWarnRecordById" parameterType="Long" resultMap="OrderWarnRecordResult">
<include refid="selectOrderWarnRecordVo"/>
where id = #{id}
</select>
<insert id="insertOrderWarnRecord" parameterType="OrderWarnRecord" useGeneratedKeys="true" keyProperty="id">
insert into order_warn_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if>
<if test="orderType != null">order_type,</if>
<if test="content != null">content,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
<if test="orderType != null">#{orderType},</if>
<if test="content != null">#{content},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateOrderWarnRecord" parameterType="OrderWarnRecord">
update order_warn_record
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if>
<if test="orderType != null">order_type = #{orderType},</if>
<if test="content != null">content = #{content},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOrderWarnRecordById" parameterType="Long">
delete from order_warn_record where id = #{id}
</delete>
<delete id="deleteOrderWarnRecordByIds" parameterType="String">
delete from order_warn_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>