异常封装之商品信息后台修改

This commit is contained in:
qiankunpingtai
2019-04-18 21:48:22 +08:00
parent fd7df68740
commit ff9a0de5ac
3 changed files with 227 additions and 58 deletions

View File

@@ -46,7 +46,7 @@ public class MaterialController {
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs, @RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
@RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2, @RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
@RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId, @RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId,
HttpServletRequest request) { HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>(); Map<String, Object> objectMap = new HashMap<String, Object>();
int exist = materialService.checkIsExist(id, name, model, color, standard, mfrs, int exist = materialService.checkIsExist(id, name, model, color, standard, mfrs,
otherField1, otherField2, otherField3, unit, unitId); otherField1, otherField2, otherField3, unit, unitId);
@@ -85,7 +85,7 @@ public class MaterialController {
* @return * @return
*/ */
@GetMapping(value = "/findById") @GetMapping(value = "/findById")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) { public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
try { try {
List<MaterialVo4Unit> list = materialService.findById(id); List<MaterialVo4Unit> list = materialService.findById(id);
@@ -106,7 +106,7 @@ public class MaterialController {
* @return * @return
*/ */
@GetMapping(value = "/findBySelect") @GetMapping(value = "/findBySelect")
public JSONArray findBySelect(@RequestParam("mpList") String mpList, HttpServletRequest request) { public JSONArray findBySelect(@RequestParam("mpList") String mpList, HttpServletRequest request) throws Exception{
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
try { try {
List<MaterialVo4Unit> dataList = materialService.findBySelect(); List<MaterialVo4Unit> dataList = materialService.findBySelect();
@@ -163,7 +163,7 @@ public class MaterialController {
* @return * @return
*/ */
@GetMapping(value = "/findByOrder") @GetMapping(value = "/findByOrder")
public BaseResponseInfo findByOrder(HttpServletRequest request) { public BaseResponseInfo findByOrder(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
try { try {
@@ -203,7 +203,7 @@ public class MaterialController {
@RequestParam("model") String model, @RequestParam("model") String model,
@RequestParam("categoryId") Long categoryId, @RequestParam("categoryId") Long categoryId,
@RequestParam("categoryIds") String categoryIds, @RequestParam("categoryIds") String categoryIds,
HttpServletRequest request, HttpServletResponse response) { HttpServletRequest request, HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String message = "成功"; String message = "成功";
@@ -303,7 +303,7 @@ public class MaterialController {
response.sendRedirect("../pages/materials/material.html"); response.sendRedirect("../pages/materials/material.html");
} }
public BigDecimal parseBigDecimalEx(String str){ public BigDecimal parseBigDecimalEx(String str)throws Exception{
if(!StringUtil.isEmpty(str)) { if(!StringUtil.isEmpty(str)) {
return new BigDecimal(str); return new BigDecimal(str);
} else { } else {
@@ -313,7 +313,7 @@ public class MaterialController {
@RequestMapping(value = "/getMaterialEnableSerialNumberList") @RequestMapping(value = "/getMaterialEnableSerialNumberList")
public String getMaterialEnableSerialNumberList(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize, public String getMaterialEnableSerialNumberList(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage, @RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = Constants.SEARCH, required = false) String search) { @RequestParam(value = Constants.SEARCH, required = false) String search)throws Exception {
Map<String, Object> parameterMap = new HashMap<String, Object>(); Map<String, Object> parameterMap = new HashMap<String, Object>();
//查询参数 //查询参数
JSONObject obj=JSON.parseObject(search); JSONObject obj=JSON.parseObject(search);

View File

@@ -21,16 +21,16 @@ public class MaterialComponent implements ICommonQuery {
private MaterialService materialService; private MaterialService materialService;
@Override @Override
public Object selectOne(String condition) { public Object selectOne(String condition)throws Exception {
return null; return null;
} }
@Override @Override
public List<?> select(Map<String, String> map) { public List<?> select(Map<String, String> map)throws Exception {
return getMaterialList(map); return getMaterialList(map);
} }
private List<?> getMaterialList(Map<String, String> map) { private List<?> getMaterialList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
String model = StringUtil.getInfo(search, "model"); String model = StringUtil.getInfo(search, "model");
@@ -42,7 +42,7 @@ public class MaterialComponent implements ICommonQuery {
} }
@Override @Override
public Long counts(Map<String, String> map) { public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
String model = StringUtil.getInfo(search, "model"); String model = StringUtil.getInfo(search, "model");
@@ -53,27 +53,27 @@ public class MaterialComponent implements ICommonQuery {
} }
@Override @Override
public int insert(String beanJson, HttpServletRequest request) { public int insert(String beanJson, HttpServletRequest request) throws Exception{
return materialService.insertMaterial(beanJson, request); return materialService.insertMaterial(beanJson, request);
} }
@Override @Override
public int update(String beanJson, Long id) { public int update(String beanJson, Long id)throws Exception {
return materialService.updateMaterial(beanJson, id); return materialService.updateMaterial(beanJson, id);
} }
@Override @Override
public int delete(Long id) { public int delete(Long id)throws Exception {
return materialService.deleteMaterial(id); return materialService.deleteMaterial(id);
} }
@Override @Override
public int batchDelete(String ids) { public int batchDelete(String ids)throws Exception {
return materialService.batchDeleteMaterial(ids); return materialService.batchDeleteMaterial(ids);
} }
@Override @Override
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name)throws Exception {
return materialService.checkIsNameExist(id, name); return materialService.checkIsNameExist(id, name);
} }

View File

@@ -39,20 +39,47 @@ public class MaterialService {
@Resource @Resource
private DepotItemMapperEx depotItemMapperEx; private DepotItemMapperEx depotItemMapperEx;
public Material getMaterial(long id) { public Material getMaterial(long id)throws Exception {
return materialMapper.selectByPrimaryKey(id); Material result=null;
try{
result=materialMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
} }
public List<Material> getMaterial() { public List<Material> getMaterial() throws Exception{
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return materialMapper.selectByExample(example); List<Material> list=null;
try{
list=materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
} }
public List<MaterialVo4Unit> select(String name, String model,Long categoryId, String categoryIds,String mpList, int offset, int rows) { public List<MaterialVo4Unit> select(String name, String model,Long categoryId, String categoryIds,String mpList, int offset, int rows)
throws Exception{
String[] mpArr = mpList.split(","); String[] mpArr = mpList.split(",");
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>(); List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
List<MaterialVo4Unit> list = materialMapperEx.selectByConditionMaterial(name, model,categoryId,categoryIds,mpList, offset, rows); List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.selectByConditionMaterial(name, model,categoryId,categoryIds,mpList, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if (null != list) { if (null != list) {
for (MaterialVo4Unit m : list) { for (MaterialVo4Unit m : list) {
//扩展信息 //扩展信息
@@ -84,53 +111,106 @@ public class MaterialService {
return resList; return resList;
} }
public Long countMaterial(String name, String model,Long categoryId, String categoryIds,String mpList) { public Long countMaterial(String name, String model,Long categoryId, String categoryIds,String mpList)throws Exception {
return materialMapperEx.countsByMaterial(name, model,categoryId,categoryIds,mpList); Long result =null;
try{
result= materialMapperEx.countsByMaterial(name, model,categoryId,categoryIds,mpList);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterial(String beanJson, HttpServletRequest request) { public int insertMaterial(String beanJson, HttpServletRequest request)throws Exception {
Material material = JSONObject.parseObject(beanJson, Material.class); Material material = JSONObject.parseObject(beanJson, Material.class);
material.setEnabled(true); material.setEnabled(true);
return materialMapper.insertSelective(material); int result =0;
try{
result= materialMapper.insertSelective(material);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterial(String beanJson, Long id) { public int updateMaterial(String beanJson, Long id) throws Exception{
Material material = JSONObject.parseObject(beanJson, Material.class); Material material = JSONObject.parseObject(beanJson, Material.class);
material.setId(id); material.setId(id);
int res = materialMapper.updateByPrimaryKeySelective(material); int res =0;
Long unitId = material.getUnitid(); try{
if(unitId != null) { res= materialMapper.updateByPrimaryKeySelective(material);
materialMapperEx.updatePriceNullByPrimaryKey(id); //将价格置空 Long unitId = material.getUnitid();
} else { if(unitId != null) {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空 materialMapperEx.updatePriceNullByPrimaryKey(id); //将价格置空
} else {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
} }
return res; return res;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMaterial(Long id) { public int deleteMaterial(Long id)throws Exception {
return materialMapper.deleteByPrimaryKey(id); int result =0;
try{
result= materialMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterial(String ids) { public int batchDeleteMaterial(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
return materialMapper.deleteByExample(example); int result =0;
try{
result= materialMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
} }
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name)throws Exception {
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Material> list = materialMapper.selectByExample(example); List<Material> list =null;
return list.size(); try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list==null?0:list.size();
} }
public int checkIsExist(Long id, String name, String model, String color, String standard, String mfrs, public int checkIsExist(Long id, String name, String model, String color, String standard, String mfrs,
String otherField1, String otherField2, String otherField3, String unit, Long unitId) { String otherField1, String otherField2, String otherField3, String unit, Long unitId)throws Exception {
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
MaterialExample.Criteria criteria = example.createCriteria(); MaterialExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(name).andModelEqualTo(model).andColorEqualTo(color) criteria.andNameEqualTo(name).andModelEqualTo(model).andColorEqualTo(color)
@@ -145,8 +225,16 @@ public class MaterialService {
if (unitId !=null) { if (unitId !=null) {
criteria.andUnitidEqualTo(unitId); criteria.andUnitidEqualTo(unitId);
} }
List<Material> list = materialMapper.selectByExample(example); List<Material> list =null;
return list.size(); try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list==null?0:list.size();
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -159,31 +247,84 @@ public class MaterialService {
material.setEnabled(enabled); material.setEnabled(enabled);
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andIdIn(ids); example.createCriteria().andIdIn(ids);
return materialMapper.updateByExampleSelective(material, example); int result =0;
try{
result= materialMapper.updateByExampleSelective(material, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
} }
public String findUnitName(Long mId){ public String findUnitName(Long mId)throws Exception{
return materialMapperEx.findUnitName(mId); String result =null;
try{
result= materialMapperEx.findUnitName(mId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
} }
public List<MaterialVo4Unit> findById(Long id){ public List<MaterialVo4Unit> findById(Long id)throws Exception{
return materialMapperEx.findById(id); List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.findById(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
} }
public List<MaterialVo4Unit> findBySelect(){ public List<MaterialVo4Unit> findBySelect()throws Exception{
return materialMapperEx.findBySelect(); List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.findBySelect();
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
} }
public List<Material> findByOrder(){ public List<Material> findByOrder()throws Exception{
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Name,Model asc"); example.setOrderByClause("Name,Model asc");
return materialMapper.selectByExample(example); List<Material> list =null;
try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
} }
public List<MaterialVo4Unit> findByAll(String name, String model, Long categoryId, String categoryIds) { public List<MaterialVo4Unit> findByAll(String name, String model, Long categoryId, String categoryIds)throws Exception {
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>(); List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
List<MaterialVo4Unit> list = materialMapperEx.findByAll(name, model, categoryId, categoryIds); List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.findByAll(name, model, categoryId, categoryIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if (null != list) { if (null != list) {
for (MaterialVo4Unit m : list) { for (MaterialVo4Unit m : list) {
resList.add(m); resList.add(m);
@@ -205,6 +346,8 @@ public class MaterialService {
info.code = 200; info.code = 200;
data.put("message", "成功"); data.put("message", "成功");
} catch (Exception e) { } catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
e.printStackTrace(); e.printStackTrace();
info.code = 500; info.code = 500;
data.put("message", e.getMessage()); data.put("message", e.getMessage());
@@ -213,8 +356,17 @@ public class MaterialService {
return info; return info;
} }
public List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap) { public List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap)throws Exception {
return materialMapperEx.getMaterialEnableSerialNumberList(parameterMap); List<Material> list =null;
try{
list= materialMapperEx.getMaterialEnableSerialNumberList(parameterMap);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIds(String ids) throws Exception{ public int batchDeleteMaterialByIds(String ids) throws Exception{
@@ -223,7 +375,16 @@ public class MaterialService {
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); int result =0;
try{
result= materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
} }
/** /**
* create by: qiankunpingtai * create by: qiankunpingtai
@@ -250,7 +411,15 @@ public class MaterialService {
/** /**
* 校验单据子表 jsh_depotitem * 校验单据子表 jsh_depotitem
* */ * */
List<DepotItem> depotItemList=depotItemMapperEx.getDepotItemListListByMaterialIds(idArray); List<DepotItem> depotItemList =null;
try{
depotItemList= depotItemMapperEx.getDepotItemListListByMaterialIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if(depotItemList!=null&&depotItemList.size()>0){ if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]", logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids); ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);