1. 联调
This commit is contained in:
		
							parent
							
								
									11fd8fa493
								
							
						
					
					
						commit
						6383feb843
					
				|  | @ -458,7 +458,7 @@ public class AppVerifyController extends BaseController | |||
|     public AjaxResult lock(String sn) | ||||
|     { | ||||
|         logger.info("【管理员关锁请求】:{}",sn); | ||||
|         Boolean aBoolean =asDeviceService.lock(sn,null); | ||||
|         Boolean aBoolean =asDeviceService.adminLock(sn); | ||||
|         return success(aBoolean); | ||||
|     } | ||||
| 
 | ||||
|  | @ -643,16 +643,19 @@ public class AppVerifyController extends BaseController | |||
|             IDResponse.Result result = (IDResponse.Result)authentication; | ||||
|             if(result.getIsok()){ | ||||
|                //保存身份信息 | ||||
|                 AsUser asUser = new AsUser(); | ||||
|                 // 更新用户并更新缓存 | ||||
|                 LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
|                 AsUser asUser = loginUser.getAsUser(); | ||||
|                 asUser.setUserId(authenticationVo.getUserId()); | ||||
|                 asUser.setRealName(authenticationVo.getRealName()); | ||||
|                 asUser.setIdCard(authenticationVo.getIdCard()); | ||||
|                 asUser.setIsAuthentication(ServiceConstants.IS_AUTHENTICATION_YES); | ||||
|                 int updateUser = asUserService.updateUser(asUser); | ||||
|                 if(updateUser==0){ | ||||
|                     throw new ServiceException("【实名认证】保存身份信息失败"); | ||||
|                 }else{ | ||||
|                     logger.info("【实名认证】保存身份信息成功"); | ||||
|                 if (updateUser>0) | ||||
|                 { | ||||
|                     logger.info("【提现金额】保存身份信息成功"); | ||||
|                     // 更新缓存用户信息 | ||||
|                     tokenService.setLoginUser(loginUser); | ||||
|                 } | ||||
|             } | ||||
|             return AjaxResult.success(authentication); | ||||
|  |  | |||
|  | @ -139,6 +139,9 @@ public class AsUserController extends BaseController | |||
|     public AjaxResult bandSystemUser(@RequestBody AsUser user) | ||||
|     { | ||||
|         Long sysUserId = user.getSysUserId(); | ||||
|         if(sysUserId == null || sysUserId == 0){ | ||||
|             user.setRole("1"); | ||||
|         } | ||||
|         SysUser sysUser = sysUserService.selectUserById(sysUserId); | ||||
|         if(sysUser.getUserName().equals(SpringUtils.getRequiredProperty("et.repairAdmin"))){ | ||||
|             user.setRole("2"); | ||||
|  |  | |||
|  | @ -68,4 +68,7 @@ public class EtFault extends BaseEntity | |||
|     @Excel(name = "设备sn") | ||||
|     private String sn; | ||||
| 
 | ||||
|     @Excel(name = "地址") | ||||
|     private String address; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -137,6 +137,11 @@ public interface IAsDeviceService extends IService<AsDevice> | |||
|      */ | ||||
|     Boolean lock(String mac,String orderNo); | ||||
| 
 | ||||
|     /** | ||||
|      * 管理员锁车 | ||||
|      */ | ||||
|     Boolean adminLock(String mac); | ||||
| 
 | ||||
|     /** | ||||
|      * 临时解锁 | ||||
|      */ | ||||
|  |  | |||
|  | @ -500,13 +500,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | |||
|         Boolean execute = transactionTemplate.execute(e -> { | ||||
|             /** 2.发送命令*/ | ||||
|             sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_OPEN,"管理员开锁"); | ||||
|             //间隔1秒 | ||||
| //            try { | ||||
| //                Thread.sleep(500); | ||||
| //            } catch (InterruptedException ex) { | ||||
| //                ex.printStackTrace(); | ||||
| //            } | ||||
| //            sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_PLAY0,"管理员开锁播报"); | ||||
|             return Boolean.TRUE; | ||||
|         }); | ||||
|         if(!execute)throw new ServiceException("管理员开锁失败"); | ||||
|  | @ -671,51 +664,52 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | |||
|     @Override | ||||
|     public Boolean lock(String sn,String orderNo) { | ||||
|         EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo); | ||||
|         if(order==null)throw new ServiceException("订单不存在"); | ||||
|         if(StrUtil.isBlank(sn)) { | ||||
|             sn = order.getSn(); | ||||
|         } | ||||
|         AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn); | ||||
|         /** 1.获取token*/ | ||||
|         String token = Token.getToken(); | ||||
|         String finalSn = sn; | ||||
|         Boolean execute = transactionTemplate.execute(e -> { | ||||
|             /** 2.发送命令*/ | ||||
|             sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_LLOSE,"临时锁车"); | ||||
|             //间隔1秒 | ||||
| //            try { | ||||
| //                Thread.sleep(500); | ||||
| //            } catch (InterruptedException ex) { | ||||
| //                ex.printStackTrace(); | ||||
| //            } | ||||
| //            sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_PLAY7,"临时锁车播报"); | ||||
|             if(StrUtil.isNotBlank(orderNo)){//有订单号,则是用户临时锁车 | ||||
|                 /**  改变车辆状态:4-临时锁车 */ | ||||
|                 asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);//临时锁车 | ||||
|                 asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE); | ||||
|                 int device = asDeviceMapper.updateAsDevice(asDevice); | ||||
|                 if(device==0){ | ||||
|                     log.info("【临时解锁】改变车辆状态失败"); | ||||
|                     throw new ServiceException("【临时锁车】改变车辆状态失败"); | ||||
|                 } | ||||
|                 /** 5.记录行程*/ | ||||
|                 int tripLog = tripLogService.tripLog(orderNo, finalSn,ServiceConstants.TRIP_LOG_TYPE_TEMPORARILY_LOCK); | ||||
|                 if(tripLog==0){ | ||||
|                     log.info("【临时锁车】记录行程失败"); | ||||
|                     throw new ServiceException("【临时锁车】记录行程失败"); | ||||
|                 } | ||||
|             }else{ | ||||
|                 /**  改变车辆锁状态:1-开   TODO 是否要改变车辆状态?*/ | ||||
|                 asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE); | ||||
|                 int device = asDeviceMapper.updateAsDevice(asDevice); | ||||
|                 if(device==0){ | ||||
|                     log.info("【临时解锁】改变车辆状态失败"); | ||||
|                     throw new ServiceException("【临时解锁】改变车辆状态失败"); | ||||
|                 } | ||||
|         /** 2.发送命令*/ | ||||
|         sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_LLOSE,"临时锁车"); | ||||
|         asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE); | ||||
|         if(StrUtil.isNotBlank(orderNo)){//有订单号,则是用户临时锁车 | ||||
|             /**  改变车辆状态:4-临时锁车 */ | ||||
|             asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);//临时锁车 | ||||
|             /** 5.记录行程*/ | ||||
|             int tripLog = tripLogService.tripLog(orderNo, sn,ServiceConstants.TRIP_LOG_TYPE_TEMPORARILY_LOCK); | ||||
|             if(tripLog==0){ | ||||
|                 log.info("【临时锁车】记录行程失败"); | ||||
|                 throw new ServiceException("【临时锁车】记录行程失败"); | ||||
|             } | ||||
|             return Boolean.TRUE; | ||||
|         }); | ||||
|         if(!execute)throw new ServiceException("临时锁车失败"); | ||||
|         } | ||||
|         int device = asDeviceMapper.updateAsDevice(asDevice); | ||||
|         if(device==0){ | ||||
|             log.info("【临时解锁】改变车辆状态失败"); | ||||
|             throw new ServiceException("【临时锁车】改变车辆状态失败"); | ||||
|         } | ||||
|         return Boolean.TRUE; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 管理员锁车 | ||||
|      * @param sn | ||||
|      * @return | ||||
|      */ | ||||
|     @Transactional | ||||
|     @SneakyThrows | ||||
|     @Override | ||||
|     public Boolean adminLock(String sn) { | ||||
|         if(StrUtil.isBlank(sn))throw new ServiceException("sn不能为空"); | ||||
|         AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn); | ||||
|         /** 2.发送命令*/ | ||||
|         sendCommand(asDevice.getMac(), Token.getToken(),IotConstants.COMMAND_CLOSE,"管理员锁车"); | ||||
|         asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE); | ||||
|         int device = asDeviceMapper.updateAsDevice(asDevice); | ||||
|         if(device==0){ | ||||
|             log.info("【临时解锁】改变车辆状态失败"); | ||||
|             throw new ServiceException("【临时锁车】改变车辆状态失败"); | ||||
|         } | ||||
|         return Boolean.TRUE; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -166,6 +166,7 @@ public class CallbackServiceImpl implements CallbackService { | |||
|                         //创建一个定时器,计算出退还时间后,执行退款操作 | ||||
|                         // 往后推autoRefundDeposit小时执行 | ||||
|                         scheduledExecutorService.schedule(() -> { | ||||
|                             logger.info("【微信支付回调】退还押金定时任务开始"); | ||||
|                             // 退款 | ||||
|                             Long userId = order.getUserId(); | ||||
|                             EtOrder etOrder = new EtOrder(); | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import com.ruoyi.common.constant.ServiceConstants; | |||
| import com.ruoyi.common.core.domain.entity.AsUser; | ||||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| import com.ruoyi.common.exception.ServiceException; | ||||
| import com.ruoyi.common.utils.CommonUtil; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import com.ruoyi.common.utils.uuid.IdUtils; | ||||
| import com.ruoyi.system.domain.*; | ||||
|  | @ -129,9 +130,9 @@ public class EtFaultServiceImpl implements IEtFaultService | |||
|         if(ObjectUtils.isEmpty(asDevice)){ | ||||
|            throw new ServiceException("该设备不存在"); | ||||
|         } | ||||
|         //获取车辆定位,并解析地址,将地址保存数据库 | ||||
| 
 | ||||
| 
 | ||||
|         //解析地址,将地址保存数据库 | ||||
|         etFault.setAddress(CommonUtil.getAddressByGeo(asDevice.getLongitude() + ","+asDevice.getLatitude())); | ||||
|         etFault.setAreaId(asDevice.getAreaId()); | ||||
|         etFault.setCreateTime(DateUtils.getNowDate()); | ||||
|         setType(etFault); | ||||
|         int i = etFaultMapper.insertEtFault(etFault); | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import javax.annotation.PostConstruct; | ||||
| import javax.annotation.Resource; | ||||
| import java.math.BigDecimal; | ||||
| import java.time.LocalDate; | ||||
|  | @ -48,6 +49,14 @@ public class EtTask { | |||
|     private IEtDividendDetailService dividendDetailService; | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 启动时判断是否有未取消预约的订单、已完成的订单未退还押金的 | ||||
|      */ | ||||
|     @PostConstruct | ||||
|     public void init() { | ||||
| 
 | ||||
|         log.info("websocket====>init方法被执行"); | ||||
|     } | ||||
|     /** | ||||
|      *  每天凌晨0点5分执行,计算分账结果 | ||||
|      *  cron: 0 5 0 * * ? | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         <result property="faultId"    column="fault_id"    /> | ||||
|         <result property="userId"    column="user_id"    /> | ||||
|         <result property="deviceMac"    column="device_mac"    /> | ||||
|         <result property="sn"    column="sn"    /> | ||||
|         <result property="type"    column="type"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="picture"    column="picture"    /> | ||||
|  | @ -15,14 +16,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         <result property="orderId"    column="order_id"    /> | ||||
|         <result property="status"    column="status"    /> | ||||
|         <result property="areaId"       column="area_id"       /> | ||||
|         <result property="address"       column="address"       /> | ||||
|     </resultMap> | ||||
| 
 | ||||
|     <sql id="selectEtFaultVo"> | ||||
|         select fault_id, area_id, user_id, device_mac, type, create_time, picture, detail, order_id, status from et_fault | ||||
|         select fault_id, area_id, user_id, device_mac, sn, type, create_time, picture, detail, order_id, status, address from et_fault | ||||
|     </sql> | ||||
| 
 | ||||
|     <select id="selectEtFaultList" parameterType="EtFault" resultMap="EtFaultResult"> | ||||
|         select f.fault_id, f.area_id, f.user_id, f.device_mac, f.type, f.create_time, f.picture, f.detail, f.order_id, f.status from et_fault f | ||||
|         select f.fault_id, f.area_id, f.user_id, f.device_mac, f.sn, f.type, f.create_time, f.picture, f.detail, f.order_id, f.status, f.address from et_fault f | ||||
|         left join et_area_dept ad on ad.area_id = f.area_id | ||||
|         left join sys_dept d on d.dept_id = ad.dept_id | ||||
|         where 1 = 1 | ||||
|  | @ -45,24 +47,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|             <if test="userId != null">user_id,</if> | ||||
|             <if test="areaId != null">area_id,</if> | ||||
|             <if test="deviceMac != null">device_mac,</if> | ||||
|             <if test="sn != null">sn,</if> | ||||
|             <if test="type != null">type,</if> | ||||
|             <if test="createTime != null">create_time,</if> | ||||
|             <if test="picture != null">picture,</if> | ||||
|             <if test="detail != null">detail,</if> | ||||
|             <if test="orderId != null">order_id,</if> | ||||
|             <if test="status != null">status,</if> | ||||
|             <if test="address != null">address,</if> | ||||
|          </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="faultId != null">#{faultId},</if> | ||||
|             <if test="userId != null">#{userId},</if> | ||||
|             <if test="areaId != null">#{areaId},</if> | ||||
|             <if test="deviceMac != null">#{deviceMac},</if> | ||||
|             <if test="sn != null">#{sn},</if> | ||||
|             <if test="type != null">#{type},</if> | ||||
|             <if test="createTime != null">#{createTime},</if> | ||||
|             <if test="picture != null">#{picture},</if> | ||||
|             <if test="detail != null">#{detail},</if> | ||||
|             <if test="orderId != null">#{orderId},</if> | ||||
|             <if test="status != null">#{status},</if> | ||||
|             <if test="address != null">#{address},</if> | ||||
|          </trim> | ||||
|     </insert> | ||||
| 
 | ||||
|  | @ -72,12 +78,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|             <if test="userId != null">user_id = #{userId},</if> | ||||
|             <if test="areaId != null">area_id = #{areaId},</if> | ||||
|             <if test="deviceMac != null">device_mac = #{deviceMac},</if> | ||||
|             <if test="sn != null">sn = #{sn},</if> | ||||
|             <if test="type != null">type = #{type},</if> | ||||
|             <if test="createTime != null">create_time = #{createTime},</if> | ||||
|             <if test="picture != null">picture = #{picture},</if> | ||||
|             <if test="detail != null">detail = #{detail},</if> | ||||
|             <if test="orderId != null">order_id = #{orderId},</if> | ||||
|             <if test="status != null">status = #{status},</if> | ||||
|             <if test="address != null">address = #{address},</if> | ||||
|         </trim> | ||||
|         where fault_id = #{faultId} | ||||
|     </update> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user