Переглянути джерело

ecu刷写文件签名,平板设备和客户端用户的bug

bmmx 1 рік тому
батько
коміт
ba4b24e8b2

+ 4 - 1
pom.xml

@@ -200,7 +200,10 @@
             <artifactId>pdfa</artifactId>
             <version>${itext7.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.freemarker</groupId>
             <artifactId>freemarker</artifactId>

BIN
sign/FV200_G050_1JA30.s19


+ 28 - 0
sign/private_key.pem

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCzwwZE2Ce7CgIF
+tsnZ5X8La6jEAtbTMmXheLHIMnL0njDpbT1DWAaGo73R1GIA2cQikpo7ql0PXsTh
+6lkWXhfBHC0kGzjIrFnN5lskrcupcL+Tx5W5Yj7DGl/axrCPYD/7uFcNdEU0V4hq
+YttL/RvrzmwiRaY820oeBWNWFdidFhlXtxKPszmHn9EkMXs+2zqoisepR0St4PCp
+iS0kyPNt2/9f+tNkKbIxpIf4VjFDKAZ7MqdS+CneX2OGVRdskYtQAVx1xQ97P1YP
+zQkEFBWcD+lNOf81b24plK1wBOzkXaaJDQxnoeTyunuvpcWyDGih2qiS0bQ67TCE
+7LEKG1v7AgMBAAECggEAB/6D0Fr2hVxgE6X52w1YNYdPpYvkxtambj0CVv9bWmKQ
+lUjs4QpQm/s7LVIvG4+Tp9/yKPYeFllmEw/rb1G257kbjtABGfeENOJqKjrqZDol
+4uoM0AY8+Us6eQ29+1pR7h1YDbqee0HrSKPl0b7LV5TB/VIwnuM3rBccQE9PZ0jp
+kEY6CLmKb4OOXMFE1LMwZq0bFbv/EsxX4l1A53bZ3mi7cz9oUs7D23YHqgY1kx/c
+ZgQj8EAXHdy5YsjdL/Q+Om4jW+EV/Vj6f3sm8UzaaUaJF5d2X/iqt3PdrRyqTE+E
+SMhnq+tpVpPB8OWfiUQ3aKOEX0/NvLfU62uJh/iWtQKBgQD0e2yY94DQwoR2tWbk
+4vPzwt+Ip7oDj7YAUeTurCBWJkA4n8qk8Ay20xjV9Y05BePt/hm3dSTJbdT1831j
+LEVbyIR1prYurGfXfhkbqsTI52wFhlKfF4oV1LInI4EQG5axB7PBIx+R+UYQsr79
+2HSAydRrkhAaVNNlp7CBopAyTQKBgQC8OwqL9ObmSKSb40BTKqtRzPx43E1IQCr3
+e5k9qWK2Bt0u4gSQddy3AzSYI2IxLA4/8Cj4naiRaajXdb8n/fFvMhQWSHQImpTt
+gqtp58x+A73mqhatrrDj2YLQstCYfk7VgaO9VsWVmXwaHuN+HusSU1qEQOfOSp+v
+9syjCm0bZwKBgQC9ZQgiEErYbnhTxf/p/O9jvWmR4e22aJRj9w1U4D9EvekudIt1
+7wjKcQpiZhF7RVbnvduKRdOzv8QkrPZL57XrfpEu23FzAtiHFga5ajd8M9t5BC/p
+U0ED3HwO2fBX3CeHCSJ10pHYcbWXpgFTgWXvh2tp0gNrgp8ptxiDtL3kWQKBgQC1
+vJuWPcKiHQkxqdx1cAExXaV2W94SIEJb6G4wZtbzwPTVS0v03pdX7DRfn+oyZ8Lq
+YMpuIGqc21M1lG4YAsuU/NkAGrxNglLAbyVpf3ClSp+Tki2LS9tmYqA3OC7GzUz4
+P88EBD+JDUQRRDmJj/iPHQOMJc6qEsrTbopt8KcfiQJ/CdqmJIHdmZUDgbBw+Frn
+kZFAeVYzBgP3cZBm2Xg+UbR/+tY2lhixkq8yYLFnC0jSjtB/3jaHrcv5ZCdxboru
++LVVTgxTGxwUc+29moB1sCfM7//AkQxBH/8J6/4zW6KUe753bT78eUT+Es/QpPtX
+5f8wXXk0XTkKsvsmyLQmpg==
+-----END PRIVATE KEY-----

+ 8 - 1
src/main/java/com/om/controller/admin/AppUserController.java

@@ -87,7 +87,7 @@ public class AppUserController {
     @ApiOperation("获取客户端用户List集合")
     public Result<List<User>> list(){
 
-        return Result.ok(userService.list());
+        return Result.ok(userService.listByDevice());
     }
 
     @GetMapping("/relieve(未写)")
@@ -141,4 +141,11 @@ public class AppUserController {
     public Result updateDefaultVci(@RequestParam Integer userId,@RequestParam Integer vciId,@RequestParam Integer status){
         return userService.updateDefaultVci(userId,vciId,status);
     }
+
+    @GetMapping("resetPassword")
+    @ApiOperation("重置用户密码")
+    public Result resetPassword(@RequestParam Integer id){
+        return userService.resetPassword(id);
+    }
+
 }

+ 59 - 3
src/main/java/com/om/controller/admin/DeviceController.java

@@ -1,13 +1,21 @@
 package com.om.controller.admin;
 
 
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.om.entity.dto.DeviceQueryPageDTO;
 import com.om.entity.po.Device;
+import com.om.entity.po.User;
 import com.om.entity.vo.DeviceQueryPageVO;
+import com.om.exception.BadReqException;
+import com.om.mapper.UserMapper;
 import com.om.service.IDeviceService;
 import com.om.utils.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -30,6 +38,8 @@ public class DeviceController {
 
     @Resource
     private IDeviceService deviceService;
+    @Autowired
+    private UserMapper userMapper;
 
     @ApiOperation("分页查询接口")
     @PostMapping("getPageList")
@@ -51,20 +61,66 @@ public class DeviceController {
 
     @ApiOperation("新增平板设备")
     @PostMapping("add")
+    @Transactional
     public Result add(@RequestBody Device device) {
         device.setCreateTime(LocalDateTime.now());
-        return Result.ok(deviceService.save(device));
+        String deviceSn = device.getDeviceSn();
+        Device one = deviceService.lambdaQuery()
+                .eq(Device::getDeviceSn, deviceSn)
+                .one();
+        if (BeanUtil.isNotEmpty(one)){
+            throw new BadReqException("该设备sn号已经存在");
+        }
+
+        if (StringUtils.isNotBlank(device.getUsername())) {
+            LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(User::getUsername, device.getUsername());
+            User user = userMapper.selectOne(queryWrapper);
+            user.setDeviceSn(device.getDeviceSn());
+            user.setUpdateTime(LocalDateTime.now());
+            userMapper.updateById(user);
+        }
+        deviceService.save(device);
+        return Result.ok();
     }
 
     @ApiOperation("根据id修改平板设备")
     @PostMapping("update")
+    @Transactional
     public Result update(@RequestBody Device device) {
-        return Result.ok(deviceService.updateById(device));
+        if (StringUtils.isNotBlank(device.getUsername())) {
+            LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(User::getUsername, device.getUsername());
+            User user = userMapper.selectOne(queryWrapper);
+            user.setDeviceSn(device.getDeviceSn());
+            user.setUpdateTime(LocalDateTime.now());
+            userMapper.updateById(user);
+        }
+        deviceService.updateById(device);
+        return Result.ok();
     }
 
     @ApiOperation("根据id删除平板设备")
     @GetMapping("delete")
+    @Transactional
     public Result delete(@RequestParam("id") Integer id) {
-        return Result.ok(deviceService.removeById(id));
+        Device device = deviceService.getById(id);
+
+        String username = device.getUsername();
+        if (StringUtils.isNotBlank(username)) {
+            LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(User::getUsername, username);
+            User user = userMapper.selectOne(queryWrapper);
+            user.setDeviceSn("");
+            userMapper.updateById(user);
+        }
+        deviceService.removeById(id);
+        return Result.ok();
+    }
+
+    @GetMapping("unbind")
+    @ApiOperation("平板设备解除客户端用户绑定")
+    public Result unbind(@RequestParam("id") Integer id) {
+        return deviceService.unbind(id);
     }
 }

+ 6 - 0
src/main/java/com/om/controller/admin/WxscController.java

@@ -83,4 +83,10 @@ public class WxscController {
     public Result deleteById(@PathVariable Integer id) {
         return wxscService.deleteById(id);
     }
+
+    @GetMapping("/push")
+    @ApiOperation("推送维修资料")
+    public Result pushWxzl(@RequestParam Integer id) {
+        return wxscService.pushWxzl(id);
+    }
 }

+ 1 - 0
src/main/java/com/om/service/IDeviceService.java

@@ -22,4 +22,5 @@ public interface IDeviceService extends IService<Device> {
 
     List<String> deviceList();
 
+    Result unbind(Integer id);
 }

+ 5 - 0
src/main/java/com/om/service/IUserService.java

@@ -64,4 +64,9 @@ public interface IUserService extends IService<User> {
     Result relieveVci(AppBindVO bindVO);
 
     Result updateDefaultVci(Integer userId,Integer vciId, Integer status);
+
+    Result resetPassword(Integer id);
+
+    List<User> listByDevice();
+
 }

+ 2 - 0
src/main/java/com/om/service/IWxscService.java

@@ -26,4 +26,6 @@ public interface IWxscService extends IService<Wxsc> {
     Result<Wxsc> appGetById(AppWxscDTO dto);
 
     Result deleteById(Integer id);
+
+    Result pushWxzl(Integer id);
 }

+ 3 - 6
src/main/java/com/om/service/impl/AppServiceImpl.java

@@ -132,14 +132,11 @@ public class AppServiceImpl extends ServiceImpl<AppMapper, App> implements IAppS
             }else {
                 appVO.setVersionNum("");
             }
-
+            String clientNums = appInfo.getClientNums();
+            String[] n = clientNums.substring(1, clientNums.length() - 1).split(",");
             //在取出来客户端编号
-            LambdaQueryWrapper<AppsClients> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(AppsClients::getAppId,id);
-            List<AppsClients> list = clientsService.list(queryWrapper);
-            String [] n = new String[list.size()];
             for (int j = 0; j < n.length; j++) {
-                String clientNum = list.get(j).getClientNum();
+                String clientNum = n[j];
                 LambdaQueryWrapper<Client> clientLambdaQueryWrapper = new LambdaQueryWrapper<>();
                 clientLambdaQueryWrapper.eq(Client::getNumber,clientNum);
                 Client client = clientMapper.selectOne(clientLambdaQueryWrapper);

+ 6 - 5
src/main/java/com/om/service/impl/BrushFileServiceImpl.java

@@ -173,16 +173,17 @@ public class BrushFileServiceImpl extends ServiceImpl<BrushFileMapper, BrushFile
 
     @Override
     public Result<BrushUploadVO> uploadBrush(MultipartFile file) {
+        try {
+            file = FileSigner.sign(file);
+        } catch (Exception e) {
+            throw new BizException("ECU刷写文件签名出错");
+        }
         long fileSize = file.getSize();
         String size = FileSizeConverter.convertBytes(fileSize);
         String filename = file.getOriginalFilename();
 
         //上传文件
-        LocalDate now = LocalDate.now();
-        int year = now.getYear();
-        int monthValue = now.getMonthValue();
-        int day = now.getDayOfMonth();
-        String prefix = BRUSH_PREFIX + "/" + year + "/" + monthValue + "/" + day;
+        String prefix = "ecu";
         try {
             String upload = obsUtil.upload(file, prefix);
             BrushUploadVO vo = new BrushUploadVO();

+ 41 - 4
src/main/java/com/om/service/impl/DeviceServiceImpl.java

@@ -1,13 +1,18 @@
 package com.om.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.om.entity.dto.DeviceQueryPageDTO;
 import com.om.entity.po.Device;
 import com.om.entity.po.DiagnosticMenu;
 import com.om.entity.po.Repair;
+import com.om.entity.po.User;
 import com.om.entity.vo.DeviceQueryPageVO;
 import com.om.entity.vo.RepairQueryPageVO;
+import com.om.exception.BadReqException;
 import com.om.mapper.DeviceMapper;
+import com.om.mapper.UserMapper;
 import com.om.service.IDeviceService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.om.utils.Result;
@@ -16,11 +21,12 @@ import org.springframework.stereotype.Service;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author bmmx
@@ -29,6 +35,12 @@ import java.util.stream.Collectors;
 @Service
 public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements IDeviceService {
 
+    private final UserMapper userMapper;
+
+    public DeviceServiceImpl(UserMapper userMapper) {
+        this.userMapper = userMapper;
+    }
+
     @Override
     public Result<DeviceQueryPageVO> getPageList(DeviceQueryPageDTO dto) {
         Integer pageIndex = dto.getPageIndex();
@@ -50,12 +62,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
         vo.setPages((int) page.getPages());
         vo.setTotal((int) page.getTotal());
 
-        if (StringUtils.isNotBlank(searchDeviceSn) || StringUtils.isNotBlank(searchUsername) || StringUtils.isNotBlank(searchClientNum) ) {
+        if (StringUtils.isNotBlank(searchDeviceSn) || StringUtils.isNotBlank(searchUsername) || StringUtils.isNotBlank(searchClientNum)) {
             vo.setSearchCount(true);
         }
 
         List<Device> records = page.getRecords();
-        if (records.isEmpty()){
+        if (records.isEmpty()) {
             return Result.ok(vo);
         }
         vo.setRecords(records);
@@ -65,7 +77,32 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
     @Override
     public List<String> deviceList() {
         List<Device> deviceList = this.list();
-        List<String> collect = deviceList.stream().map(c -> c.getDeviceSn()).distinct().collect(Collectors.toList());
+        List<String> collect = deviceList.stream().map(c -> c.getDeviceSn())
+                .filter(deviceSn -> StringUtils.isBlank(lambdaQuery()
+                        .eq(Device::getDeviceSn, deviceSn).one().getUsername()))
+                .distinct().collect(Collectors.toList());
         return collect;
     }
+
+    @Override
+    public Result unbind(Integer id) {
+        Device device = this.getById(id);
+        if (BeanUtil.isEmpty(device)){
+            throw new BadReqException("该平板设备不存在");
+        }
+        String username = device.getUsername();
+        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(User::getUsername, username);
+        User user = userMapper.selectOne(wrapper);
+        if (BeanUtil.isEmpty(user)){
+            throw new BadReqException("该平板设备绑定的用户不存在");
+        }
+        user.setDeviceSn("");
+        device.setUsername("");
+
+        userMapper.updateById(user);
+        this.updateById(device);
+
+        return Result.ok();
+    }
 }

+ 76 - 25
src/main/java/com/om/service/impl/UserServiceImpl.java

@@ -1,6 +1,7 @@
 package com.om.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.ListUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -28,11 +29,9 @@ import org.springframework.util.DigestUtils;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 /**
@@ -251,12 +250,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
 
         String deviceSn = user.getDeviceSn();
+
         if (StringUtils.isNotBlank(deviceSn)) {
-            Device device = new Device();
-            device.setDeviceSn(deviceSn);
-            device.setUsername(user.getUsername());
-            device.setCreateTime(LocalDateTime.now());
-            deviceService.save(device);
+            Device device = deviceService.lambdaQuery()
+                    .eq(Device::getDeviceSn, deviceSn)
+                    .one();
+            if (!BeanUtil.isEmpty(device)) {
+                device.setUsername(user.getUsername());
+                deviceService.updateById(device);
+            }
+
         }
         this.save(addUser);
         List<String> vciSns = user.getVciSn();
@@ -308,15 +311,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         }
 
         //查询 设备表
-        List<Device> deviceList = deviceService.lambdaQuery()
+        Device device = deviceService.lambdaQuery()
                 .eq(Device::getUsername, user.getUsername())
-                .list();
-        if (!deviceList.isEmpty()) {
-            //删除设备
-            List<Integer> deviceIds = deviceList.stream().map(c -> c.getId()).collect(Collectors.toList());
-            deviceService.removeByIds(deviceIds);
-        }
+                .one();
 
+        if (!BeanUtil.isEmpty(device)) {
+            device.setUsername("");
+            deviceService.updateById(device);
+        }
         boolean deleteById = this.removeById(id);
         if (deleteById == false) {
             return Result.error().message("删除失败");
@@ -456,12 +458,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     }
 
     @Override
+    @Transactional
     public Result updateUserInfo(UserAddVO user) {
         Integer userId = user.getId();
 
         User userById = getById(userId);
 
+        String password = user.getPassword();
         BeanUtil.copyProperties(user, userById);
+        try {
+            password = AesUtil.Encrypt(password);
+        } catch (Exception e) {
+            throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
+        }
+        userById.setPassword(password);
+
     /*    if (!password.equals(userById.getPassword())){
             //密码加密
             try {
@@ -475,35 +486,49 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
         }*/
 
+        String deviceSn = user.getDeviceSn();
+        if (deviceSn != null && !deviceSn.isEmpty()) {
+            Device one = deviceService.lambdaQuery()
+                    .eq(Device::getDeviceSn, deviceSn)
+                    .one();
+            if (BeanUtil.isEmpty(one)) {
+                throw new BadReqException("该平板设备不存在");
+            }
+            one.setUsername(user.getUsername());
+            deviceService.updateById(one);
+        }
 
         Integer distributorId = userById.getDistributorId();
         //根据id查询维修厂
-        Distributor distributor = distributorService.getById(distributorId);
-        if (BeanUtil.isEmpty(distributor)) {
-            throw new BadReqException("该维修厂不存在");
+        if (distributorId != null){
+            Distributor distributor = distributorService.getById(distributorId);
+            if (BeanUtil.isEmpty(distributor)) {
+                throw new BadReqException("该维修厂不存在");
+            }
+            userById.setDistributorName(distributor.getCompany());
+
         }
-        userById.setDistributorName(distributor.getCompany());
 
         List<String> vciSns = user.getVciSn();
 
-        if (!vciSns.isEmpty()) {
+        if (CollectionUtil.isNotEmpty(vciSns)) {
             List<UserVci> userVciList = new ArrayList<>();
             int i = 1;
             for (String vciSn : vciSns) {
                 UserVci userVci = new UserVci();
                 //根据vciSn查询
                 VciInfo vciInfo = vciInfoService.lambdaQuery()
-                        .eq(VciInfo::getVciNum, user.getVciSn())
+                        .eq(VciInfo::getVciNum, vciSn)
                         .one();
                 if (vciInfo == null) {
                     throw new BadReqException("该VCI设备不存在");
                 }
                 //先查询uservci
-                UserVci one = userVciService.lambdaQuery()
+                List<UserVci> userVciList1 = userVciService.lambdaQuery()
                         .eq(UserVci::getVciInfoId, vciInfo.getId())
                         .eq(UserVci::getUserId, userId)
-                        .one();
-                if (BeanUtil.isEmpty(one)) {
+                        .list();
+                if (userVciList1.isEmpty()) {
                     userVci.setVciInfoId(vciInfo.getId());
                     userVci.setUserId(userId);
                     if (i==1){
@@ -736,5 +761,31 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return Result.ok();
     }
 
+    @Override
+    public Result resetPassword(Integer id) {
+        User user = this.getById(id);
+        if (BeanUtil.isEmpty(user)) {
+            throw new BadReqException("该用户不存在");
+        }
+
+        try {
+            String encrypt = AesUtil.Encrypt("111111");
+            user.setPassword(encrypt);
+        } catch (Exception e) {
+            throw new BadReqException("密码加密错误");
+        }
+
+        this.updateById(user);
+        return Result.ok();
+    }
+
+    @Override
+    public List<User> listByDevice() {
+        List<User> userList = this.lambdaQuery().list();
+        List<User> collect = userList.stream().filter(user -> StringUtils.isBlank(user.getDeviceSn()))
+                .collect(Collectors.toList());
+        return collect;
+    }
+
 
 }

+ 4 - 0
src/main/java/com/om/service/impl/VciInfoServiceImpl.java

@@ -325,6 +325,10 @@ public class VciInfoServiceImpl extends ServiceImpl<VciInfoMapper, VciInfo> impl
         com.om.entity.dto.VciInfo vciInfo1 = new com.om.entity.dto.VciInfo();
         List<SDKData> sdkData = new ArrayList<>();
         List<AppData> appData = new ArrayList<>();
+
+
+
+
         return null;
     }
 

+ 17 - 4
src/main/java/com/om/service/impl/WxscServiceImpl.java

@@ -3,10 +3,7 @@ package com.om.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.PageUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.om.entity.dto.AppBaseDTO;
-import com.om.entity.dto.AppWxscDTO;
-import com.om.entity.dto.AppWxscQueryPageDTO;
-import com.om.entity.dto.GuidDTO;
+import com.om.entity.dto.*;
 import com.om.entity.po.Wxsc;
 import com.om.entity.vo.AppWxscQueryPageVO;
 import com.om.entity.vo.AppWxscVO;
@@ -121,4 +118,20 @@ public class WxscServiceImpl extends ServiceImpl<WxscMapper, Wxsc> implements IW
         this.removeById(id);
         return Result.ok();
     }
+
+    @Override
+    public Result pushWxzl(Integer id) {
+        Wxsc wxsc = this.getById(id);
+        if (BeanUtil.isEmpty(wxsc)){
+            throw new BadReqException("该维修手册不存在");
+        }
+        PushInfo pushInfo = new PushInfo();
+        pushInfo.setPushInfoType(4);
+
+        MaintenanceManualInfo maintenanceManualInfo = new MaintenanceManualInfo();
+        maintenanceManualInfo.setType("0");
+        List<Describe> describeList = new ArrayList<>();
+
+        return null;
+    }
 }

+ 156 - 0
src/main/java/com/om/utils/FileSigner.java

@@ -0,0 +1,156 @@
+package com.om.utils;
+
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.*;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
+
+public class FileSigner {
+
+    private static final String PRIVATE_KEY_PATH = "sign/private_key.pem"; // 私钥文件路径
+    private static final String INPUT_FILE_PATH = "sign/FV200_G050_1JA30.s19"; // 待签名文件路径
+   // private static final String SIGNATURE_FILE_PATH = "sign/signature.bin"; // 签名文件输出路径
+
+    public static MultipartFile sign(MultipartFile file) throws Exception {
+        // 加载私钥
+        PrivateKey privateKey = loadPrivateKey(PRIVATE_KEY_PATH);
+
+        // 读取待签名文件内容
+        byte[] fileContent = file.getBytes();
+
+        // 使用SHA256withRSA算法签名文件
+        Signature signer = Signature.getInstance("SHA256withRSA");
+        signer.initSign(privateKey);
+        signer.update(fileContent);
+        byte[] signature = signer.sign();
+
+        // 将签名信息拼接到文件内容中
+        byte[] lengthBytes = intToByteArray(signature.length);
+        byte[] concatenated = concatenate(lengthBytes, signature);
+        byte[] signedFileContent = concatenate(concatenated, fileContent);
+
+        // 创建一个新的 MultipartFile 对象来代表签名后的文件
+        MultipartFile signedFile = new MockMultipartFile(
+                file.getName(), file.getOriginalFilename(), file.getContentType(), signedFileContent);
+
+        System.out.println("File signed successfully!");
+
+        return signedFile;
+    }
+
+    public static void signTest(MultipartFile file) throws Exception {
+        // 加载私钥
+        PrivateKey privateKey = loadPrivateKey(PRIVATE_KEY_PATH);
+
+        // 读取待签名文件内容
+        byte[] fileContent = file.getBytes();
+
+        // 使用SHA256withRSA算法签名文件
+        Signature signer = Signature.getInstance("SHA256withRSA");
+        signer.initSign(privateKey);
+        signer.update(fileContent);
+        byte[] signature = signer.sign();
+
+        // 将签名信息保存签名到文件
+        // Files.write(Paths.get(SIGNATURE_FILE_PATH), signature);
+
+        // 刷写文件数据和签名信息拼接保存到文件
+        byte[] lengthBytes = intToByteArray(signature.length);//签名长度
+        System.out.println("签名字节长度int:"+signature.length);
+        System.out.println("签名字节长度:"+bytesToHexString(lengthBytes,lengthBytes.length));
+        byte[] concatenate = concatenate(lengthBytes, signature);//签名长度+签名
+        System.out.println("签名字节长度+签名字节:"+bytesToHexString(concatenate,concatenate.length));
+        Files.write(Paths.get(INPUT_FILE_PATH), concatenate(concatenate,fileContent));//签名长度+签名+刷写文件
+
+        System.out.println("File signed successfully!");
+    }
+
+    public static void main(String[] args) throws Exception {
+        // 加载私钥
+        PrivateKey privateKey = loadPrivateKey(PRIVATE_KEY_PATH);
+
+        // 读取待签名文件内容
+        byte[] fileContent = Files.readAllBytes(Paths.get(INPUT_FILE_PATH));
+
+        // 使用SHA256withRSA算法签名文件
+        Signature signer = Signature.getInstance("SHA256withRSA");
+        signer.initSign(privateKey);
+        signer.update(fileContent);
+        byte[] signature = signer.sign();
+
+        // 将签名信息保存签名到文件
+       // Files.write(Paths.get(SIGNATURE_FILE_PATH), signature);
+
+        // 刷写文件数据和签名信息拼接保存到文件
+        byte[] lengthBytes = intToByteArray(signature.length);//签名长度
+        System.out.println("签名字节长度int:"+signature.length);
+        System.out.println("签名字节长度:"+bytesToHexString(lengthBytes,lengthBytes.length));
+        byte[] concatenate = concatenate(lengthBytes, signature);//签名长度+签名
+        System.out.println("签名字节长度+签名字节:"+bytesToHexString(concatenate,concatenate.length));
+        Files.write(Paths.get(INPUT_FILE_PATH), concatenate(concatenate,fileContent));//签名长度+签名+刷写文件
+
+        System.out.println("File signed successfully!");
+    }
+
+    private static PrivateKey loadPrivateKey(String keyPath) throws Exception {
+        // 这里是简化代码,实际中你可能需要使用PEM解析器来加载私钥  
+        // 这里假设私钥是PKCS#8格式,并且没有密码保护  
+        String privateKeyContent = new String(Files.readAllBytes(Paths.get(keyPath)));
+        privateKeyContent = privateKeyContent.replace("-----BEGIN PRIVATE KEY-----", "")
+                .replace("-----END PRIVATE KEY-----", "")
+                .replaceAll("\\s", "");
+
+        byte[] pkcs8EncodedBytes = Base64.getDecoder().decode(privateKeyContent);
+
+        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+
+        PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
+        return keyFactory.generatePrivate(keySpec);
+    }
+
+    public static byte[] intToByteArray(int i) {
+        byte[] result = new byte[4];
+        result[0] = (byte) ((i >> 24) & 0xFF);
+        result[1] = (byte) ((i >> 16) & 0xFF);
+        result[2] = (byte) ((i >> 8) & 0xFF);
+        result[3] = (byte) (i & 0xFF);
+        return result;
+    }
+
+    public static String bytesToHexString(byte[] src, int nLen) {
+        return bytesToHexString( src, 0, nLen);
+    }
+
+
+    public static String bytesToHexString(byte[] src, int offset, int nLen) {
+        StringBuilder stringBuilder = new StringBuilder("");
+
+        if (src == null || src.length <= 0 || nLen <= 0) {
+            return "";
+        }
+        for (int i = offset; (i+offset) < src.length && i < nLen; i++) {
+            int v = src[i] & 0xFF;
+            String hv = Integer.toHexString(v).toUpperCase();
+            if (hv.length() < 2) {
+                stringBuilder.append(0);
+            }
+            stringBuilder.append(hv);
+            stringBuilder.append(' ');
+        }
+        return stringBuilder.toString();
+    }
+
+
+    public static byte[] concatenate(byte[] first, byte[] second) {
+        byte[] result = new byte[first.length + second.length];
+        System.arraycopy(first, 0, result, 0, first.length);
+        System.arraycopy(second, 0, result, first.length, second.length);
+        return result;
+    }
+
+
+}