| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.moral.api.entity.Supervision; |
| | | import com.moral.api.service.SupervisionService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | |
| | | private SupervisionService supervisionService; |
| | | |
| | | @PostMapping("add") |
| | | public ResultMessage add(MultipartFile[] files, Supervision supervision) { |
| | | public ResultMessage add(HttpServletRequest request) { |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files"); |
| | | Supervision supervision = JSONObject.parseObject(JSONObject.toJSONString(params), Supervision.class); |
| | | Map<String, Object> response = supervisionService.add(files, supervision); |
| | | if (!response.isEmpty()) { |
| | | return ResultMessage.fail(Integer.parseInt(response.get("code").toString()), response.get("msg").toString()); |
| | |
| | | |
| | | @ApiOperation(value = "修改督办单", notes = "修改督办单") |
| | | @PostMapping("update") |
| | | public ResultMessage update(MultipartFile[] files, Supervision supervision) { |
| | | public ResultMessage update(HttpServletRequest request) { |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files"); |
| | | Supervision supervision = JSONObject.parseObject(JSONObject.toJSONString(params), Supervision.class); |
| | | Map<String, Object> response = supervisionService.updateSupervision(files, supervision); |
| | | if (!response.isEmpty()) { |
| | | return ResultMessage.fail(Integer.parseInt(response.get("code").toString()), response.get("msg").toString()); |