异常封装之供应商信息后台修改
This commit is contained in:
@@ -73,7 +73,7 @@ public class SupplierController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findBySelect_cus")
|
@PostMapping(value = "/findBySelect_cus")
|
||||||
public JSONArray findBySelectCus(HttpServletRequest request) {
|
public JSONArray findBySelectCus(HttpServletRequest request)throws Exception {
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
try {
|
try {
|
||||||
List<Supplier> supplierList = supplierService.findBySelectCus();
|
List<Supplier> supplierList = supplierService.findBySelectCus();
|
||||||
@@ -108,7 +108,7 @@ public class SupplierController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findBySelect_sup")
|
@PostMapping(value = "/findBySelect_sup")
|
||||||
public JSONArray findBySelectSup(HttpServletRequest request) {
|
public JSONArray findBySelectSup(HttpServletRequest request) throws Exception{
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
try {
|
try {
|
||||||
List<Supplier> supplierList = supplierService.findBySelectSup();
|
List<Supplier> supplierList = supplierService.findBySelectSup();
|
||||||
@@ -135,7 +135,7 @@ public class SupplierController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findBySelect_retail")
|
@PostMapping(value = "/findBySelect_retail")
|
||||||
public JSONArray findBySelectRetail(HttpServletRequest request) {
|
public JSONArray findBySelectRetail(HttpServletRequest request)throws Exception {
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
try {
|
try {
|
||||||
List<Supplier> supplierList = supplierService.findBySelectRetail();
|
List<Supplier> supplierList = supplierService.findBySelectRetail();
|
||||||
@@ -165,7 +165,7 @@ public class SupplierController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findById")
|
@GetMapping(value = "/findById")
|
||||||
public BaseResponseInfo findById(@RequestParam("supplierId") Long supplierId,
|
public BaseResponseInfo findById(@RequestParam("supplierId") Long supplierId,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
@@ -240,7 +240,7 @@ public class SupplierController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findUserCustomer")
|
@PostMapping(value = "/findUserCustomer")
|
||||||
public JSONArray findUserCustomer(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findUserCustomer(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
try {
|
try {
|
||||||
List<Supplier> dataList = supplierService.findUserCustomer();
|
List<Supplier> dataList = supplierService.findUserCustomer();
|
||||||
@@ -295,7 +295,7 @@ public class SupplierController {
|
|||||||
@RequestParam("phonenum") String phonenum,
|
@RequestParam("phonenum") String phonenum,
|
||||||
@RequestParam("telephone") String telephone,
|
@RequestParam("telephone") String telephone,
|
||||||
@RequestParam("description") String description,
|
@RequestParam("description") String description,
|
||||||
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 = "成功";
|
||||||
@@ -382,7 +382,7 @@ public class SupplierController {
|
|||||||
importFun(supplierFile);
|
importFun(supplierFile);
|
||||||
response.sendRedirect("../pages/manage/member.html");
|
response.sendRedirect("../pages/manage/member.html");
|
||||||
}
|
}
|
||||||
public String importFun(MultipartFile supplierFile){
|
public String importFun(MultipartFile supplierFile)throws Exception{
|
||||||
|
|
||||||
BaseResponseInfo info = new BaseResponseInfo();
|
BaseResponseInfo info = new BaseResponseInfo();
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
@@ -436,7 +436,7 @@ public class SupplierController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public class SupplierComponent implements ICommonQuery {
|
|||||||
private SupplierService supplierService;
|
private SupplierService supplierService;
|
||||||
|
|
||||||
@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 getSupplierList(map);
|
return getSupplierList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getSupplierList(Map<String, String> map) {
|
private List<?> getSupplierList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String supplier = StringUtil.getInfo(search, "supplier");
|
String supplier = StringUtil.getInfo(search, "supplier");
|
||||||
String type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -42,7 +42,7 @@ public class SupplierComponent 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 supplier = StringUtil.getInfo(search, "supplier");
|
String supplier = StringUtil.getInfo(search, "supplier");
|
||||||
String type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -53,27 +53,27 @@ public class SupplierComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return supplierService.insertSupplier(beanJson, request);
|
return supplierService.insertSupplier(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return supplierService.updateSupplier(beanJson, id);
|
return supplierService.updateSupplier(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return supplierService.deleteSupplier(id);
|
return supplierService.deleteSupplier(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return supplierService.batchDeleteSupplier(ids);
|
return supplierService.batchDeleteSupplier(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return supplierService.checkIsNameExist(id, name);
|
return supplierService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,55 +47,136 @@ public class SupplierService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DepotHeadMapperEx depotHeadMapperEx;
|
private DepotHeadMapperEx depotHeadMapperEx;
|
||||||
|
|
||||||
public Supplier getSupplier(long id) {
|
public Supplier getSupplier(long id)throws Exception {
|
||||||
return supplierMapper.selectByPrimaryKey(id);
|
Supplier result=null;
|
||||||
|
try{
|
||||||
|
result=supplierMapper.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<Supplier> getSupplier() {
|
public List<Supplier> getSupplier()throws Exception {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list=supplierMapper.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<Supplier> select(String supplier, String type, String phonenum, String telephone, String description, int offset, int rows) {
|
public List<Supplier> select(String supplier, String type, String phonenum,
|
||||||
return supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, description, offset, rows);
|
String telephone, String description, int offset, int rows) throws Exception{
|
||||||
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list=supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, description, 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);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long countSupplier(String supplier, String type, String phonenum, String telephone, String description) {
|
public Long countSupplier(String supplier, String type, String phonenum, String telephone, String description) throws Exception{
|
||||||
return supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, description);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, description);
|
||||||
|
}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 insertSupplier(String beanJson, HttpServletRequest request) {
|
public int insertSupplier(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
||||||
return supplierMapper.insertSelective(supplier);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=supplierMapper.insertSelective(supplier);
|
||||||
|
}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 updateSupplier(String beanJson, Long id) {
|
public int updateSupplier(String beanJson, Long id)throws Exception {
|
||||||
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
||||||
supplier.setId(id);
|
supplier.setId(id);
|
||||||
return supplierMapper.updateByPrimaryKeySelective(supplier);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||||
|
}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 deleteSupplier(Long id) {
|
public int deleteSupplier(Long id)throws Exception {
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=supplierMapper.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 supplierMapper.deleteByPrimaryKey(id);
|
return supplierMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteSupplier(String ids) {
|
public int batchDeleteSupplier(String ids) throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return supplierMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=supplierMapper.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 {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Supplier> list = supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list= supplierMapper.selectByExample(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 list==null?0:list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
@@ -103,45 +184,95 @@ public class SupplierService {
|
|||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
Supplier supplier = supplierMapper.selectByPrimaryKey(supplierId);
|
Supplier supplier=null;
|
||||||
if(supplier!=null){
|
try{
|
||||||
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
supplier = supplierMapper.selectByPrimaryKey(supplierId);
|
||||||
return supplierMapper.updateByPrimaryKeySelective(supplier);
|
}catch(Exception e){
|
||||||
}else{
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
return 0;
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
}
|
}
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
if(supplier!=null){
|
||||||
|
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||||
|
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||||
|
}
|
||||||
|
}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 List<Supplier> findBySelectCus() {
|
public List<Supplier> findBySelectCus()throws Exception {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapper.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<Supplier> findBySelectSup() {
|
public List<Supplier> findBySelectSup()throws Exception {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true)
|
example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapper.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<Supplier> findBySelectRetail() {
|
public List<Supplier> findBySelectRetail()throws Exception {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true)
|
example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapper.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<Supplier> findById(Long supplierId) {
|
public List<Supplier> findById(Long supplierId)throws Exception {
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andIdEqualTo(supplierId)
|
example.createCriteria().andIdEqualTo(supplierId)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapper.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
@@ -154,20 +285,47 @@ public class SupplierService {
|
|||||||
supplier.setEnabled(enabled);
|
supplier.setEnabled(enabled);
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andIdIn(ids);
|
example.createCriteria().andIdIn(ids);
|
||||||
return supplierMapper.updateByExampleSelective(supplier, example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = supplierMapper.updateByExampleSelective(supplier, 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 List<Supplier> findUserCustomer(){
|
public List<Supplier> findUserCustomer()throws Exception{
|
||||||
SupplierExample example = new SupplierExample();
|
SupplierExample example = new SupplierExample();
|
||||||
example.createCriteria().andTypeEqualTo("客户")
|
example.createCriteria().andTypeEqualTo("客户")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
List<Supplier> list = supplierMapper.selectByExample(example);
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapper.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;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Supplier> findByAll(String supplier, String type, String phonenum, String telephone, String description) {
|
public List<Supplier> findByAll(String supplier, String type, String phonenum,
|
||||||
return supplierMapperEx.findByAll(supplier, type, phonenum, telephone, description);
|
String telephone, String description) throws Exception{
|
||||||
|
List<Supplier> list=null;
|
||||||
|
try{
|
||||||
|
list = supplierMapperEx.findByAll(supplier, type, phonenum, telephone, description);
|
||||||
|
}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 BaseResponseInfo importExcel(List<Supplier> mList) throws Exception {
|
public BaseResponseInfo importExcel(List<Supplier> mList) throws Exception {
|
||||||
@@ -183,6 +341,8 @@ public class SupplierService {
|
|||||||
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());
|
||||||
@@ -197,7 +357,16 @@ public class SupplierService {
|
|||||||
((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 supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = supplierMapperEx.batchDeleteSupplierByIds(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
|
||||||
@@ -224,7 +393,15 @@ public class SupplierService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务主表 jsh_accounthead
|
* 校验财务主表 jsh_accounthead
|
||||||
* */
|
* */
|
||||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
|
List<AccountHead> accountHeadList=null;
|
||||||
|
try{
|
||||||
|
accountHeadList = accountHeadMapperEx.getAccountHeadListByOrganIds(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(accountHeadList!=null&&accountHeadList.size()>0){
|
if(accountHeadList!=null&&accountHeadList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -234,7 +411,15 @@ public class SupplierService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据主表 jsh_depothead
|
* 校验单据主表 jsh_depothead
|
||||||
* */
|
* */
|
||||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
|
List<DepotHead> depotHeadList=null;
|
||||||
|
try{
|
||||||
|
depotHeadList = depotHeadMapperEx.getDepotHeadListByOrganIds(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(depotHeadList!=null&&depotHeadList.size()>0){
|
if(depotHeadList!=null&&depotHeadList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
Reference in New Issue
Block a user