调试工单创建接口
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"?>
|
||||
<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"
|
||||
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"?>
|
||||
<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"
|
||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
@ -86,31 +86,6 @@
|
||||
<scope>compile</scope>
|
||||
</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>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<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.EnableRyFeignClients;
|
||||
@ -7,15 +7,15 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
|
||||
@EnableConfigurationProperties
|
||||
@ConfigurationPropertiesScan(basePackages = {"com.xhpc.workorder.config"})
|
||||
@EnableCustomConfig
|
||||
@SpringBootApplication
|
||||
@EnableRyFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.xhpc.workorder.mapper")
|
||||
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);
|
||||
|
||||
XhpcWorkOrderDomain selectByTypeAndTitleAndDeviceSerialNumber(@Param("type")Integer type,
|
||||
XhpcWorkOrderDomain selectByTypeAndTitle(@Param("type")Integer type,
|
||||
@Param("title")String title,
|
||||
@Param("serialNumber")String serialNumber,
|
||||
@Param("userId")Long userId,
|
||||
@Param("status") Integer status);
|
||||
@Param("userId")Long userId);
|
||||
|
||||
int deleteByPrimaryKey(Long workOrderId);
|
||||
|
||||
|
||||
@ -2,13 +2,19 @@ package com.xhpc.workorder.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.XhpcWorkOrderPushMessageDomain;
|
||||
import com.xhpc.workorder.domain.XhpcWorkUserDomain;
|
||||
import com.xhpc.workorder.mapper.XhpcStationDeviceMapper;
|
||||
import com.xhpc.workorder.mapper.XhpcWorkOrderMapper;
|
||||
import com.xhpc.workorder.mapper.XhpcWorkOrderPushMessageMapper;
|
||||
import com.xhpc.workorder.mapper.XhpcWorkUserMapper;
|
||||
import com.xhpc.workorder.service.WorkOrderService;
|
||||
import com.xhpc.workorder.service.WorkUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -16,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WorkOrderServiceImpl implements WorkOrderService {
|
||||
|
||||
@ -26,12 +32,18 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
||||
@Resource
|
||||
XhpcWorkUserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
XhpcStationDeviceMapper deviceMapper;
|
||||
|
||||
@Resource
|
||||
XhpcWorkOrderPushMessageMapper messageMapper;
|
||||
|
||||
@Resource
|
||||
SmsService smsService;
|
||||
|
||||
@Resource
|
||||
WorkUserService workUserService;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getOrderPage(Map<String,Object> params){
|
||||
return orderMapper.findOrderListByParams(params);
|
||||
@ -49,36 +61,50 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
||||
|
||||
@Override
|
||||
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());
|
||||
if(userDomain == null){
|
||||
domain.setUserId(userDomain.getWorkUserId());
|
||||
domain.setDeptId(userDomain.getDeptId());
|
||||
} else {
|
||||
// todo
|
||||
XhpcWorkUserDomain userDomain = userMapper.selectByUserNameAndPhone(domain.getUserName(), domain.getUserPhone());
|
||||
if(userDomain != null){
|
||||
domain.setUserId(userDomain.getWorkUserId());
|
||||
domain.setDeptId(userDomain.getDeptId());
|
||||
} else {
|
||||
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);
|
||||
|
||||
XhpcWorkOrderDomain resDomain = orderMapper.selectByTypeAndTitleAndDeviceSerialNumber(domain.getType().intValue(),
|
||||
XhpcWorkOrderDomain resDomain = orderMapper.selectByTypeAndTitle(domain.getType().intValue(),
|
||||
domain.getTitle(),
|
||||
domain.getSerialNumber(),
|
||||
domain.getUserId(),
|
||||
domain.getStatus().intValue());
|
||||
domain.getUserId());
|
||||
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("orderNo", resDomain.getWorkOrderId().toString());
|
||||
paramMap.put("phone", domain.getUserPhone());
|
||||
paramMap.put("content", "【小华充电】您好,您有新的工单(工单号:"+ resDomain.getWorkOrderId() +")待处理,请及时登陆后台查看并处理,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
R r = smsService.sendNotice(paramMap);
|
||||
|
||||
XhpcWorkOrderPushMessageDomain messageDomain = new XhpcWorkOrderPushMessageDomain();
|
||||
messageDomain.setContent(paramMap.get("content"));
|
||||
messageDomain.setTarget(domain.getUserName());
|
||||
messageDomain.setTarget(domain.getUserPhone());
|
||||
messageDomain.setType(Short.valueOf("1"));
|
||||
messageDomain.setStatus(Short.valueOf("1"));
|
||||
messageDomain.setFailMsg("发送成功");
|
||||
if (r!= null && r.getCode() != 200){
|
||||
messageDomain.setFailMsg("发送失败");
|
||||
} else {
|
||||
messageDomain.setFailMsg("发送成功");
|
||||
}
|
||||
|
||||
messageMapper.insertSelective(messageDomain);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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"
|
||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_station_device
|
||||
where device_id = #{deviceId,jdbcType=INTEGER}
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectStationGunDeviceListByParams" resultType="map">
|
||||
|
||||
@ -27,16 +27,16 @@
|
||||
update_by
|
||||
</sql>
|
||||
|
||||
<select id="selectByTypeAndTitleAndDeviceSerialNumber" resultType="com.xhpc.workorder.domain.XhpcWorkOrderDomain">
|
||||
<select id="selectByTypeAndTitle" resultType="com.xhpc.workorder.domain.XhpcWorkOrderDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_order
|
||||
where del_flag=0
|
||||
and type =#{type}
|
||||
and title=#{title}
|
||||
and serial_number=#{serialNumber}
|
||||
and user_id=#{userId}
|
||||
and status=#{status}
|
||||
and status=0 and del_flag=0
|
||||
order by create_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="findOrderListByParams" resultType="java.util.Map">
|
||||
@ -122,9 +122,7 @@
|
||||
<if test="disposalMethod != null">
|
||||
disposal_method,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
del_flag,
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
@ -148,7 +146,7 @@
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="faultTIme!=null">
|
||||
<if test="faultTime!=null">
|
||||
#{faultTime, jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deviceType != null">
|
||||
@ -169,10 +167,8 @@
|
||||
<if test="disposalMethod != null">
|
||||
#{disposalMethod,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
create_time, create_by, update_time,
|
||||
update_by)
|
||||
values (#{target,jdbcType=VARCHAR}, #{type,jdbcType=SMALLINT}, #{content,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=SMALLINT}, #{failMsg,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
sysdate(), #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
0, #{failMsg,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
sysdate(), #{createBy,jdbcType=VARCHAR}, sysdate(),
|
||||
#{updateBy,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<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">
|
||||
content,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
<if test="failMsg != null">
|
||||
fail_msg,
|
||||
</if>
|
||||
@ -78,9 +76,7 @@
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
0,
|
||||
<if test="failMsg != null">
|
||||
#{failMsg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user