Commit 0c40bf1d026b79babb7122e09cf8e5aaec8572bd
1 parent
9b27c59d
场外加油添加去重复设置
Showing
3 changed files
with
14 additions
and
2 deletions
src/main/java/com/bsth/controller/oil/CwjyController.java
| @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 14 | ||
| 15 | +import com.bsth.common.ResponseCode; | ||
| 15 | import com.bsth.controller.BaseController; | 16 | import com.bsth.controller.BaseController; |
| 16 | import com.bsth.data.BasicData; | 17 | import com.bsth.data.BasicData; |
| 17 | import com.bsth.entity.Line; | 18 | import com.bsth.entity.Line; |
| @@ -35,7 +36,16 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | @@ -35,7 +36,16 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | ||
| 35 | t.setNbbm(t.getNbbm().trim().toUpperCase()); | 36 | t.setNbbm(t.getNbbm().trim().toUpperCase()); |
| 36 | Line line=BasicData.nbbm2LineMap.get(t.getNbbm()); | 37 | Line line=BasicData.nbbm2LineMap.get(t.getNbbm()); |
| 37 | t.setLine(line == null?"" : line.getLineCode()); | 38 | t.setLine(line == null?"" : line.getLineCode()); |
| 38 | - return service.save(t); | 39 | + Map<String, Object> map = new HashMap<>(); |
| 40 | + try { | ||
| 41 | + map=service.save(t); | ||
| 42 | + }catch (Exception e) { | ||
| 43 | + // TODO: handle exception | ||
| 44 | + if(e.getMessage().indexOf("PK_CWJYUK")>0){ | ||
| 45 | + map.put("fage", "存在相同数据,数据已经过滤"); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + return map; | ||
| 39 | } | 49 | } |
| 40 | 50 | ||
| 41 | @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) | 51 | @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
src/main/resources/static/pages/oil/jyszList.html
| @@ -115,7 +115,7 @@ | @@ -115,7 +115,7 @@ | ||
| 115 | <td>{{obj.xgr}}</td> | 115 | <td>{{obj.xgr}}</td> |
| 116 | <td>{{obj.createDate}}</td> | 116 | <td>{{obj.createDate}}</td> |
| 117 | <td> | 117 | <td> |
| 118 | - <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>--> | 118 | + <!-- <button> <i class="fa fa-times"></i> 删除</button>--> |
| 119 | </td> | 119 | </td> |
| 120 | </tr> | 120 | </tr> |
| 121 | {{/each}} | 121 | {{/each}} |