| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.equipage.entity.Car; |
| | | import org.springblade.modules.equipage.service.CarService; |
| | | import org.springblade.modules.equipage.vo.CarVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | */ |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody Car car) throws Exception { |
| | | /*if (car.getId()==null){ |
| | | arg arg = new arg(); |
| | | arg.test01(arg.url+"/car/save",car); |
| | | }*/ |
| | | return R.status(carService.saveOrUpdate(car)); |
| | | boolean status = false; |
| | | if (null==car.getId()) { |
| | | car.setDateForProduction(new Date()); |
| | | //新增 |
| | | status = carService.save(car); |
| | | |
| | | //数据同步 |
| | | String s1 = |
| | | "insert into sys_car(id,car_number,number_type,car_type,dept_id," + |
| | | "person_in_charge,brand,date_for_production,umweltsatz,mode,jurisdiction,picture,driving_conditions) " + |
| | | "values(" + "'" + car.getId() + "'" + "," + |
| | | "'" + car.getCarNumber() + "'" + "," + |
| | | "'" + car.getNumberType() + "'" + "," + |
| | | "'" + car.getCarType() + "'" + "," + |
| | | "'" + car.getDeptId() + "'" + "," + |
| | | "'" + car.getPersonInCharge() + "'" + "," + |
| | | "'" + car.getBrand() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd").format(car.getDateForProduction()) + "'" + "," + |
| | | "'" + car.getUmweltsatz() + "'" + "," + |
| | | "'" + car.getMode() + "'" + "," + |
| | | "'" + car.getJurisdiction() + "'" + "," + |
| | | "'" + car.getPicture() + "'" + "," + |
| | | "'" +car.getDrivingConditions() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }else { |
| | | //修改 |
| | | status = carService.updateById(car); |
| | | //内网同步 |
| | | String s1 = |
| | | "update sys_car set car_number = " + "'" + car.getCarNumber() + "'" + |
| | | ",number_type = " + "'" + car.getNumberType() + "'" + |
| | | ",car_type = " + "'" + car.getCarType() + "'" + |
| | | ",dept_id = " + "'" + car.getDeptId() + "'" + |
| | | ",person_in_charge = " + "'" + car.getJurisdiction() + "'" + |
| | | ",brand = " + "'" + car.getBrand() + "'" + |
| | | ",date_for_production = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(car.getDateForProduction()) + "'" + |
| | | ",umweltsatz = " + "'" + car.getUmweltsatz() + "'" + |
| | | ",mode = " + "'" + car.getMode() + "'" + |
| | | ",jurisdiction = " + "'" + car.getJurisdiction() + "'" + |
| | | ",picture = " + "'" + car.getPicture() + "'" + |
| | | ",driving_conditions = " + "'" + car.getDrivingConditions() + "'" + |
| | | " " +"where id = " + "'" + car.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | return R.status(status); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/remove") |
| | | public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
| | | //arg.sendPostRemoveByIds(arg.url+"/car/remove",ids); |
| | | //内网删除 |
| | | List<Long> list = Func.toLongList(ids); |
| | | list.forEach(id ->{ |
| | | //内网同步 |
| | | String s1 = "delete from sys_car where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }); |
| | | return R.status(carService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |