| | |
| | | import org.springblade.modules.equipage.excel.CarImporter; |
| | | import org.springblade.modules.equipage.service.CarService; |
| | | import org.springblade.modules.equipage.vo.CarVo; |
| | | import org.springblade.modules.system.service.MyAsyncService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | public class CarController { |
| | | |
| | | private final CarService carService; |
| | | private final MyAsyncService myAsyncService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param query page,size |
| | | * @param car 车辆信息对象 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param car 车辆信息对象 |
| | | */ |
| | | @PostMapping("/save") |
| | |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param car 车辆信息对象 |
| | | */ |
| | | @PostMapping("/update") |
| | |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | * |
| | | * @param car 车辆信息对象 |
| | | */ |
| | | @PostMapping("/submit") |
| | |
| | | car.setDateForProduction(new Date()); |
| | | //新增 |
| | | status = carService.save(car); |
| | | |
| | | if (status) { |
| | | //数据同步 |
| | | String s1 = |
| | | "insert into sys_car(id,car_number,number_type,car_type,dept_id," + |
| | |
| | | "'" + car.getUmweltsatz() + "'" + "," + |
| | | "'" + car.getMode() + "'" + "," + |
| | | "'" +car.getJurisdiction() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | } |
| | | |
| | | }else { |
| | | //修改 |
| | | status = carService.updateById(car); |
| | | if (status) { |
| | | //内网同步 |
| | | String s1 = |
| | | "update sys_car set car_number = " + "'" + car.getCarNumber() + "'" + |
| | |
| | | ",mode = " + "'" + car.getMode() + "'" + |
| | | ",jurisdiction = " + "'" + car.getJurisdiction() + "'" + |
| | | " " +"where id = " + "'" + car.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | } |
| | | } |
| | | return R.status(status); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param ids 车辆信息ids 数组 |
| | | */ |
| | | @PostMapping("/remove") |
| | |
| | | list.forEach(id ->{ |
| | | //内网同步 |
| | | String s1 = "delete from sys_car where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | }); |
| | | return R.status(carService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | * |
| | | * @param car 车辆信息对象 |
| | | */ |
| | | @GetMapping("/detail") |