package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSONObject; import com.steerinfo.dil.component.ImageFileUtils; import com.steerinfo.dil.service.impl.RmsMaterialServiceImpl; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.utils.misc.IdGenerator; import com.steerinfo.framework.utils.upload.UploadUtils; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartRequest; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; /** * @author luobang * @create 2021-10-10 17:59 */ @RestController @RequestMapping("${api.version}/material") public class RmsMaterialController extends BaseRESTfulController { @Autowired private ImageFileUtils imageFileUtils; @Value("${piction.path}") private String path; @Autowired RmsMaterialServiceImpl rmsMaterialServiceImpl; /** * 1.获取物资 * @return */ @ApiOperation(value = "获取物资下拉框列表") @GetMapping("/getMaterial") public RESTfulResult getMaterial(){ return success(rmsMaterialServiceImpl.getMaterial()); } @ApiOperation(value = "通过excel创建基础数据") @GetMapping("/createMaterial") public RESTfulResult createMaterial() throws IOException { int count= rmsMaterialServiceImpl.createMaterial(); return success(count); } @PostMapping(value = "/updateFiles", headers = "content-type=multipart/form-data") public synchronized List updateFiles( @RequestParam(value = "files") MultipartFile files[]) throws Exception { //首先通过Calendard对象获得年月日 Calendar calendar=Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day= calendar.get(Calendar.DAY_OF_MONTH); //上传文件夹路径 List urls=new ArrayList<>(); for (int i=0;i