|
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.project.project.cases.domain.Case;
|
|
|
|
|
import com.ruoyi.project.project.cases.service.ICaseService;
|
|
|
|
|
import com.ruoyi.project.project.item.domain.Item;
|
|
|
|
|
import com.ruoyi.project.project.item.service.IItemService;
|
|
|
|
|
import com.ruoyi.project.project.util.ValidatorUtils;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
@ -32,6 +33,9 @@ public class CaseController extends BaseController
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICaseService caseService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IItemService itemService;
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("system:case:view")
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String cases()
|
|
|
|
|
@ -70,6 +74,18 @@ public class CaseController extends BaseController
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult addSave(Case cases)
|
|
|
|
|
{
|
|
|
|
|
int i = caseService.selectCaseByCaseNo(cases.getCaseNo());
|
|
|
|
|
if(i != 0){
|
|
|
|
|
return error("案件编号重复,请检查!!!!");
|
|
|
|
|
}
|
|
|
|
|
boolean phone = ValidatorUtils.isValidPhone(cases.getPhone());
|
|
|
|
|
if (!phone){
|
|
|
|
|
return error("手机号格式错误请检查,请检查!!!!");
|
|
|
|
|
}
|
|
|
|
|
boolean userNo = ValidatorUtils.isValidIdCard(cases.getUserNo());
|
|
|
|
|
if (!userNo){
|
|
|
|
|
return error("身份证号格式错误请检查,请检查!!!!");
|
|
|
|
|
}
|
|
|
|
|
return toAjax(caseService.insertCase(cases));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -93,10 +109,10 @@ public class CaseController extends BaseController
|
|
|
|
|
* 修改案件信息
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("system:case:edit")
|
|
|
|
|
@GetMapping("/edit/{caseNo}")
|
|
|
|
|
public String edit(@PathVariable("caseNo") String caseNo, ModelMap mmap)
|
|
|
|
|
@GetMapping("/edit/{id}")
|
|
|
|
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
|
|
|
|
{
|
|
|
|
|
mmap.put("case", caseService.selectCaseById(caseNo));
|
|
|
|
|
mmap.put("case", caseService.selectCaseById(id));
|
|
|
|
|
return prefix + "/edit";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -109,6 +125,14 @@ public class CaseController extends BaseController
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult editSave(Case cases)
|
|
|
|
|
{
|
|
|
|
|
boolean phone = ValidatorUtils.isValidPhone(cases.getPhone());
|
|
|
|
|
if (!phone){
|
|
|
|
|
return error("手机号格式错误请检查,请检查!!!!");
|
|
|
|
|
}
|
|
|
|
|
boolean userNo = ValidatorUtils.isValidIdCard(cases.getUserNo());
|
|
|
|
|
if (!userNo){
|
|
|
|
|
return error("身份证号格式错误请检查,请检查!!!!");
|
|
|
|
|
}
|
|
|
|
|
return toAjax(caseService.updateCase(cases));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -121,6 +145,16 @@ public class CaseController extends BaseController
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult remove(String ids)
|
|
|
|
|
{
|
|
|
|
|
//查询是否有物品信息
|
|
|
|
|
String[] idStr = ids.split(",");
|
|
|
|
|
for (String id : idStr) {
|
|
|
|
|
Case acase = caseService.selectCaseById(Integer.parseInt(id));
|
|
|
|
|
int i = itemService.selectItemByCaseId(id);
|
|
|
|
|
if (i != 0){
|
|
|
|
|
return error(acase.getCaseNo()+"案件中存在物品,请先删除物品!!!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(caseService.deleteCaseByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|