| | |
| | | |
| | | import com.yuanchu.mom.pojo.RawInspect; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.*; |
| | |
| | | |
| | | @ApiOperation(value = "新增检验单") |
| | | @PostMapping("/addRawInspects") |
| | | public Result addRawInspects(@RequestHeader("token") String token, @RequestBody RawInspect rawInspect) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String userName = jsonObject.getString("name"); |
| | | return Result.success(rawInspectService.addRawInspects(userName, rawInspect)); |
| | | public Result addRawInspects(@RequestHeader("token") String token, @RequestBody RawInspect rawInspect) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | return Result.success(rawInspectService.addRawInspects(data.get("name").replaceAll("\"", ""), rawInspect)); |
| | | } |
| | | |
| | | } |