调试工单创建接口
This commit is contained in:
parent
bcced53755
commit
17a5f73d8b
@ -43,5 +43,5 @@ public class AliyunTemplateKeyWord {
|
|||||||
/**
|
/**
|
||||||
* 工单派送
|
* 工单派送
|
||||||
*/
|
*/
|
||||||
public static final String WORK_ORDER_CREATED = "新的工单待处理";
|
public static final String WORK_ORDER_CREATED = "新的工单";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/xhpc-order"/>
|
<property name="log.path" value="logs/xhpc-log"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern"
|
<property name="log.pattern"
|
||||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/xhpc-order"/>
|
<property name="log.path" value="logs/xhpc-tradebill"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern"
|
<property name="log.pattern"
|
||||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|||||||
@ -86,31 +86,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.websocket</groupId>
|
|
||||||
<artifactId>javax.websocket-api</artifactId>
|
|
||||||
<version>1.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 支付宝支付 通用版 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alipay.sdk</groupId>
|
|
||||||
<artifactId>alipay-sdk-java</artifactId>
|
|
||||||
<version>4.15.14.ALL</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 微信支付 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.binarywang</groupId>
|
|
||||||
<artifactId>weixin-java-pay</artifactId>
|
|
||||||
<version>4.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.ant</groupId>
|
<groupId>org.apache.ant</groupId>
|
||||||
<artifactId>ant</artifactId>
|
<artifactId>ant</artifactId>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.xhpc.workorder;
|
package com.xhpc;
|
||||||
|
|
||||||
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
||||||
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
||||||
@ -7,15 +7,15 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
|
|
||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
@ConfigurationPropertiesScan(basePackages = {"com.xhpc.workorder.config"})
|
@ConfigurationPropertiesScan(basePackages = {"com.xhpc.workorder.config"})
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@SpringBootApplication
|
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@EnableDiscoveryClient
|
@EnableFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
@MapperScan("com.xhpc.workorder.mapper")
|
@MapperScan("com.xhpc.workorder.mapper")
|
||||||
public class XhpcWorkOrderApplication {
|
public class XhpcWorkOrderApplication {
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package com.xhpc.workorder.api;
|
|
||||||
|
|
||||||
import com.xhpc.common.api.factory.SmsFallbackFactory;
|
|
||||||
import com.xhpc.common.core.constant.ServiceNameConstants;
|
|
||||||
import com.xhpc.common.core.domain.R;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@FeignClient(contextId = "smsService", value = ServiceNameConstants.XHPC_GENERAL, fallbackFactory = SmsFallbackFactory.class)
|
|
||||||
public interface SmsService {
|
|
||||||
|
|
||||||
@PostMapping("/sms/send")
|
|
||||||
R sendNotice(@RequestBody Map<String, String> paramMap);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -10,11 +10,9 @@ public interface XhpcWorkOrderMapper {
|
|||||||
|
|
||||||
List<Map<String, Object>> findOrderListByParams(@Param("params") Map params);
|
List<Map<String, Object>> findOrderListByParams(@Param("params") Map params);
|
||||||
|
|
||||||
XhpcWorkOrderDomain selectByTypeAndTitleAndDeviceSerialNumber(@Param("type")Integer type,
|
XhpcWorkOrderDomain selectByTypeAndTitle(@Param("type")Integer type,
|
||||||
@Param("title")String title,
|
@Param("title")String title,
|
||||||
@Param("serialNumber")String serialNumber,
|
@Param("userId")Long userId);
|
||||||
@Param("userId")Long userId,
|
|
||||||
@Param("status") Integer status);
|
|
||||||
|
|
||||||
int deleteByPrimaryKey(Long workOrderId);
|
int deleteByPrimaryKey(Long workOrderId);
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,19 @@ package com.xhpc.workorder.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.xhpc.common.api.SmsService;
|
import com.xhpc.common.api.SmsService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
import com.xhpc.workorder.domain.XhpcStationDeviceDomain;
|
||||||
import com.xhpc.workorder.domain.XhpcWorkOrderDomain;
|
import com.xhpc.workorder.domain.XhpcWorkOrderDomain;
|
||||||
import com.xhpc.workorder.domain.XhpcWorkOrderPushMessageDomain;
|
import com.xhpc.workorder.domain.XhpcWorkOrderPushMessageDomain;
|
||||||
import com.xhpc.workorder.domain.XhpcWorkUserDomain;
|
import com.xhpc.workorder.domain.XhpcWorkUserDomain;
|
||||||
|
import com.xhpc.workorder.mapper.XhpcStationDeviceMapper;
|
||||||
import com.xhpc.workorder.mapper.XhpcWorkOrderMapper;
|
import com.xhpc.workorder.mapper.XhpcWorkOrderMapper;
|
||||||
import com.xhpc.workorder.mapper.XhpcWorkOrderPushMessageMapper;
|
import com.xhpc.workorder.mapper.XhpcWorkOrderPushMessageMapper;
|
||||||
import com.xhpc.workorder.mapper.XhpcWorkUserMapper;
|
import com.xhpc.workorder.mapper.XhpcWorkUserMapper;
|
||||||
import com.xhpc.workorder.service.WorkOrderService;
|
import com.xhpc.workorder.service.WorkOrderService;
|
||||||
|
import com.xhpc.workorder.service.WorkUserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -16,7 +22,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class WorkOrderServiceImpl implements WorkOrderService {
|
public class WorkOrderServiceImpl implements WorkOrderService {
|
||||||
|
|
||||||
@ -26,12 +32,18 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
|||||||
@Resource
|
@Resource
|
||||||
XhpcWorkUserMapper userMapper;
|
XhpcWorkUserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
XhpcStationDeviceMapper deviceMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
XhpcWorkOrderPushMessageMapper messageMapper;
|
XhpcWorkOrderPushMessageMapper messageMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
SmsService smsService;
|
SmsService smsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
WorkUserService workUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getOrderPage(Map<String,Object> params){
|
public List<Map<String, Object>> getOrderPage(Map<String,Object> params){
|
||||||
return orderMapper.findOrderListByParams(params);
|
return orderMapper.findOrderListByParams(params);
|
||||||
@ -49,36 +61,50 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertOrder(XhpcWorkOrderDomain domain){
|
public Boolean insertOrder(XhpcWorkOrderDomain domain){
|
||||||
|
if (StrUtil.hasBlank(domain.getUserName()) || StrUtil.hasBlank(domain.getUserPhone())){
|
||||||
|
throw new RuntimeException("派发人姓名或手机号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
if(!StrUtil.hasBlank(domain.getUserName()) && !StrUtil.hasBlank(domain.getUserPhone())){
|
|
||||||
XhpcWorkUserDomain userDomain = userMapper.selectByUserNameAndPhone(domain.getUserName(), domain.getUserPhone());
|
XhpcWorkUserDomain userDomain = userMapper.selectByUserNameAndPhone(domain.getUserName(), domain.getUserPhone());
|
||||||
if(userDomain == null){
|
if(userDomain != null){
|
||||||
domain.setUserId(userDomain.getWorkUserId());
|
domain.setUserId(userDomain.getWorkUserId());
|
||||||
domain.setDeptId(userDomain.getDeptId());
|
domain.setDeptId(userDomain.getDeptId());
|
||||||
} else {
|
} else {
|
||||||
// todo
|
userDomain = workUserService.insertUserReturnDomain(domain.getUserName(), domain.getUserPhone());
|
||||||
|
}
|
||||||
|
domain.setUserId(userDomain.getWorkUserId());
|
||||||
|
domain.setDeptId(userDomain.getDeptId());
|
||||||
|
|
||||||
|
if(StringUtils.isNotEmpty(domain.getSerialNumber())){
|
||||||
|
XhpcStationDeviceDomain deviceDomain = deviceMapper.selectStationGunDeviceBySerialNumber(domain.getSerialNumber());
|
||||||
|
if (deviceDomain == null){
|
||||||
|
throw new RuntimeException("设备编码不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
orderMapper.insertSelective(domain);
|
orderMapper.insertSelective(domain);
|
||||||
|
|
||||||
XhpcWorkOrderDomain resDomain = orderMapper.selectByTypeAndTitleAndDeviceSerialNumber(domain.getType().intValue(),
|
XhpcWorkOrderDomain resDomain = orderMapper.selectByTypeAndTitle(domain.getType().intValue(),
|
||||||
domain.getTitle(),
|
domain.getTitle(),
|
||||||
domain.getSerialNumber(),
|
domain.getUserId());
|
||||||
domain.getUserId(),
|
|
||||||
domain.getStatus().intValue());
|
|
||||||
|
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("orderNo", resDomain.getWorkOrderId().toString());
|
paramMap.put("orderNo", resDomain.getWorkOrderId().toString());
|
||||||
paramMap.put("phone", domain.getUserPhone());
|
paramMap.put("phone", domain.getUserPhone());
|
||||||
paramMap.put("content", "【小华充电】您好,您有新的工单(工单号:"+ resDomain.getWorkOrderId() +")待处理,请及时登陆后台查看并处理,谢谢。");
|
paramMap.put("content", "【小华充电】您好,您有新的工单(工单号:"+ resDomain.getWorkOrderId() +")待处理,请及时登陆后台查看并处理,谢谢。");
|
||||||
smsService.sendNotice(paramMap);
|
R r = smsService.sendNotice(paramMap);
|
||||||
|
|
||||||
XhpcWorkOrderPushMessageDomain messageDomain = new XhpcWorkOrderPushMessageDomain();
|
XhpcWorkOrderPushMessageDomain messageDomain = new XhpcWorkOrderPushMessageDomain();
|
||||||
messageDomain.setContent(paramMap.get("content"));
|
messageDomain.setContent(paramMap.get("content"));
|
||||||
messageDomain.setTarget(domain.getUserName());
|
messageDomain.setTarget(domain.getUserPhone());
|
||||||
messageDomain.setType(Short.valueOf("1"));
|
messageDomain.setType(Short.valueOf("1"));
|
||||||
messageDomain.setStatus(Short.valueOf("1"));
|
messageDomain.setStatus(Short.valueOf("1"));
|
||||||
|
if (r!= null && r.getCode() != 200){
|
||||||
|
messageDomain.setFailMsg("发送失败");
|
||||||
|
} else {
|
||||||
messageDomain.setFailMsg("发送成功");
|
messageDomain.setFailMsg("发送成功");
|
||||||
|
}
|
||||||
|
|
||||||
messageMapper.insertSelective(messageDomain);
|
messageMapper.insertSelective(messageDomain);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/xhpc-order"/>
|
<property name="log.path" value="logs/xhpc-workorder"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern"
|
<property name="log.pattern"
|
||||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from xhpc_station_device
|
from xhpc_station_device
|
||||||
where device_id = #{deviceId,jdbcType=INTEGER}
|
where serial_number = #{serialNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectStationGunDeviceListByParams" resultType="map">
|
<select id="selectStationGunDeviceListByParams" resultType="map">
|
||||||
|
|||||||
@ -27,16 +27,16 @@
|
|||||||
update_by
|
update_by
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectByTypeAndTitleAndDeviceSerialNumber" resultType="com.xhpc.workorder.domain.XhpcWorkOrderDomain">
|
<select id="selectByTypeAndTitle" resultType="com.xhpc.workorder.domain.XhpcWorkOrderDomain">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from xhpc_work_order
|
from xhpc_work_order
|
||||||
where del_flag=0
|
where del_flag=0
|
||||||
and type =#{type}
|
and type =#{type}
|
||||||
and title=#{title}
|
and title=#{title}
|
||||||
and serial_number=#{serialNumber}
|
|
||||||
and user_id=#{userId}
|
and user_id=#{userId}
|
||||||
and status=#{status}
|
and status=0 and del_flag=0
|
||||||
|
order by create_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findOrderListByParams" resultType="java.util.Map">
|
<select id="findOrderListByParams" resultType="java.util.Map">
|
||||||
@ -122,9 +122,7 @@
|
|||||||
<if test="disposalMethod != null">
|
<if test="disposalMethod != null">
|
||||||
disposal_method,
|
disposal_method,
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
|
||||||
`status`,
|
`status`,
|
||||||
</if>
|
|
||||||
del_flag,
|
del_flag,
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
tenant_id,
|
tenant_id,
|
||||||
@ -148,7 +146,7 @@
|
|||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
#{content,jdbcType=VARCHAR},
|
#{content,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="faultTIme!=null">
|
<if test="faultTime!=null">
|
||||||
#{faultTime, jdbcType=TIMESTAMP},
|
#{faultTime, jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
<if test="deviceType != null">
|
<if test="deviceType != null">
|
||||||
@ -169,9 +167,7 @@
|
|||||||
<if test="disposalMethod != null">
|
<if test="disposalMethod != null">
|
||||||
#{disposalMethod,jdbcType=VARCHAR},
|
#{disposalMethod,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
0,
|
||||||
#{status,jdbcType=SMALLINT},
|
|
||||||
</if>
|
|
||||||
0,
|
0,
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
#{tenantId,jdbcType=VARCHAR},
|
#{tenantId,jdbcType=VARCHAR},
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
create_time, create_by, update_time,
|
create_time, create_by, update_time,
|
||||||
update_by)
|
update_by)
|
||||||
values (#{target,jdbcType=VARCHAR}, #{type,jdbcType=SMALLINT}, #{content,jdbcType=VARCHAR},
|
values (#{target,jdbcType=VARCHAR}, #{type,jdbcType=SMALLINT}, #{content,jdbcType=VARCHAR},
|
||||||
#{status,jdbcType=SMALLINT}, #{failMsg,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
0, #{failMsg,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||||
sysdate(), #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
sysdate(), #{createBy,jdbcType=VARCHAR}, sysdate(),
|
||||||
#{updateBy,jdbcType=VARCHAR})
|
#{updateBy,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" keyColumn="order_push_id" keyProperty="orderPushId" parameterType="com.xhpc.workorder.domain.XhpcWorkOrderPushMessageDomain" useGeneratedKeys="true">
|
<insert id="insertSelective" keyColumn="order_push_id" keyProperty="orderPushId" parameterType="com.xhpc.workorder.domain.XhpcWorkOrderPushMessageDomain" useGeneratedKeys="true">
|
||||||
@ -50,9 +50,7 @@
|
|||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content,
|
content,
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
|
||||||
`status`,
|
`status`,
|
||||||
</if>
|
|
||||||
<if test="failMsg != null">
|
<if test="failMsg != null">
|
||||||
fail_msg,
|
fail_msg,
|
||||||
</if>
|
</if>
|
||||||
@ -78,9 +76,7 @@
|
|||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
#{content,jdbcType=VARCHAR},
|
#{content,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
0,
|
||||||
#{status,jdbcType=SMALLINT},
|
|
||||||
</if>
|
|
||||||
<if test="failMsg != null">
|
<if test="failMsg != null">
|
||||||
#{failMsg,jdbcType=VARCHAR},
|
#{failMsg,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user