@@ -284,14 +284,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('#btnSetFunctions').click(function () {
|
|
||||||
var currentRow = $("#tableData").datagrid("getSelected");
|
|
||||||
if (currentRow == null) {
|
|
||||||
$.messager.alert('提示',"请选择一条数据再操作!",'warning');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.href = "/pages/manage/roleFunctions.html?id=" + currentRow.id;
|
|
||||||
});
|
|
||||||
//查询父级商品类别
|
//查询父级商品类别
|
||||||
$("#lookForSelectMaterialCategory").on("click", function () {
|
$("#lookForSelectMaterialCategory").on("click", function () {
|
||||||
$('#forSelectMaterialCategoryDlg').dialog({
|
$('#forSelectMaterialCategoryDlg').dialog({
|
||||||
|
|||||||
@@ -18,6 +18,17 @@ public class ExceptionConstants {
|
|||||||
**/
|
**/
|
||||||
public static final int SERVICE_SUCCESS_CODE = 200;
|
public static final int SERVICE_SUCCESS_CODE = 200;
|
||||||
public static final String SERVICE_SUCCESS_MSG = "操作成功";
|
public static final String SERVICE_SUCCESS_MSG = "操作成功";
|
||||||
|
/**
|
||||||
|
* 数据查询异常
|
||||||
|
*/
|
||||||
|
public static final int DATA_READ_FAIL_CODE = 300;
|
||||||
|
public static final String DATA_READ_FAIL_MSG = "数据查询异常";
|
||||||
|
/**
|
||||||
|
* 数据写入异常
|
||||||
|
*/
|
||||||
|
public static final int DATA_WRITE_FAIL_CODE = 301;
|
||||||
|
public static final String DATA_WRITE_FAIL_MSG = "数据写入异常";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统运行时未知错误
|
* 系统运行时未知错误
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.jsh.erp.controller;
|
package com.jsh.erp.controller;
|
||||||
|
|
||||||
import com.alibaba.druid.util.StringUtils;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
@@ -41,7 +40,7 @@ public class AccountController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findBySelect")
|
@GetMapping(value = "/findBySelect")
|
||||||
public String findBySelect(HttpServletRequest request) {
|
public String findBySelect(HttpServletRequest request) throws Exception {
|
||||||
String res = null;
|
String res = null;
|
||||||
try {
|
try {
|
||||||
List<Account> dataList = accountService.findBySelect();
|
List<Account> dataList = accountService.findBySelect();
|
||||||
@@ -70,7 +69,7 @@ public class AccountController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getAccount")
|
@GetMapping(value = "/getAccount")
|
||||||
public BaseResponseInfo getAccount(HttpServletRequest request) {
|
public BaseResponseInfo getAccount(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 {
|
||||||
@@ -100,7 +99,7 @@ public class AccountController {
|
|||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam("accountId") Long accountId,
|
@RequestParam("accountId") Long accountId,
|
||||||
@RequestParam("initialAmount") BigDecimal initialAmount,
|
@RequestParam("initialAmount") BigDecimal initialAmount,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -133,7 +132,7 @@ public class AccountController {
|
|||||||
@PostMapping(value = "/updateAmountIsDefault")
|
@PostMapping(value = "/updateAmountIsDefault")
|
||||||
public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
|
public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
|
||||||
@RequestParam("accountId") Long accountId,
|
@RequestParam("accountId") Long accountId,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = accountService.updateAmountIsDefault(isDefault, accountId);
|
int res = accountService.updateAmountIsDefault(isDefault, accountId);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class AccountHeadController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getMaxId")
|
@GetMapping(value = "/getMaxId")
|
||||||
public BaseResponseInfo getMaxId(HttpServletRequest request) {
|
public BaseResponseInfo getMaxId(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 {
|
||||||
@@ -68,7 +68,7 @@ public class AccountHeadController {
|
|||||||
public BaseResponseInfo findTotalPay(@RequestParam("supplierId") Integer supplierId,
|
public BaseResponseInfo findTotalPay(@RequestParam("supplierId") Integer supplierId,
|
||||||
@RequestParam("endTime") String endTime,
|
@RequestParam("endTime") String endTime,
|
||||||
@RequestParam("supType") String supType,
|
@RequestParam("supType") String supType,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -106,7 +106,7 @@ public class AccountHeadController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getDetailByNumber")
|
@GetMapping(value = "/getDetailByNumber")
|
||||||
public BaseResponseInfo getDetailByNumber(@RequestParam("billNo") String billNo,
|
public BaseResponseInfo getDetailByNumber(@RequestParam("billNo") String billNo,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
AccountHeadVo4ListEx ahl = new AccountHeadVo4ListEx();
|
AccountHeadVo4ListEx ahl = new AccountHeadVo4ListEx();
|
||||||
try {
|
try {
|
||||||
@@ -132,7 +132,7 @@ public class AccountHeadController {
|
|||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal allMoney(String getS, String type, String mode, String endTime) {
|
public BigDecimal allMoney(String getS, String type, String mode, String endTime)throws Exception {
|
||||||
BigDecimal allMoney = BigDecimal.ZERO;
|
BigDecimal allMoney = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
Integer supplierId = Integer.valueOf(getS);
|
Integer supplierId = Integer.valueOf(getS);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class AccountItemController {
|
|||||||
@RequestParam("updated") String updated,
|
@RequestParam("updated") String updated,
|
||||||
@RequestParam("headerId") Long headerId,
|
@RequestParam("headerId") Long headerId,
|
||||||
@RequestParam("listType") String listType,
|
@RequestParam("listType") String listType,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
|
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
try {
|
try {
|
||||||
@@ -70,7 +70,7 @@ public class AccountItemController {
|
|||||||
|
|
||||||
@GetMapping(value = "/getDetailList")
|
@GetMapping(value = "/getDetailList")
|
||||||
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class AppController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findAppByUserId")
|
@GetMapping(value = "/findAppByUserId")
|
||||||
public JSONObject findAppByUserId(@RequestParam("userId") String userId, HttpServletRequest request) {
|
public JSONObject findAppByUserId(@RequestParam("userId") String userId, HttpServletRequest request)throws Exception {
|
||||||
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
|
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
|
||||||
String roles = null;
|
String roles = null;
|
||||||
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
|
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
|
||||||
@@ -109,7 +109,7 @@ public class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/findDesk")
|
@GetMapping(value = "/findDesk")
|
||||||
public JSONObject findDesk(HttpServletRequest request) {
|
public JSONObject findDesk(HttpServletRequest request)throws Exception {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
List<App> dockList = appService.findDock();
|
List<App> dockList = appService.findDock();
|
||||||
JSONArray dockArray = new JSONArray();
|
JSONArray dockArray = new JSONArray();
|
||||||
@@ -160,7 +160,7 @@ public class AppController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findRoleAPP")
|
@PostMapping(value = "/findRoleAPP")
|
||||||
public JSONArray findRoleAPP(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findRoleAPP(@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<App> dataListApp = appService.findRoleAPP();
|
List<App> dataListApp = appService.findRoleAPP();
|
||||||
@@ -229,7 +229,7 @@ public class AppController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/uploadImg")
|
@PostMapping(value = "/uploadImg")
|
||||||
public BaseResponseInfo uploadImg(MultipartFile fileInfo, @RequestParam("fileInfoName") String fileName,
|
public BaseResponseInfo uploadImg(MultipartFile fileInfo, @RequestParam("fileInfoName") String fileName,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
if (fileInfo != null) {
|
if (fileInfo != null) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class DepotController {
|
|||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
@GetMapping(value = "/getAllList")
|
@GetMapping(value = "/getAllList")
|
||||||
public BaseResponseInfo getAllList(HttpServletRequest request) {
|
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<Depot> depotList = depotService.getAllList();
|
List<Depot> depotList = depotService.getAllList();
|
||||||
@@ -64,7 +64,7 @@ public class DepotController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findUserDepot")
|
@PostMapping(value = "/findUserDepot")
|
||||||
public JSONArray findUserDepot(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findUserDepot(@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<Depot> dataList = depotService.findUserDepot();
|
List<Depot> dataList = depotService.findUserDepot();
|
||||||
@@ -104,7 +104,7 @@ public class DepotController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/findDepotByUserId")
|
@RequestMapping(value = "/findDepotByUserId")
|
||||||
public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findDepotByUserId(@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<Depot> dataList = depotService.findUserDepot();
|
List<Depot> dataList = depotService.findUserDepot();
|
||||||
@@ -145,7 +145,7 @@ public class DepotController {
|
|||||||
public String getDepotList(
|
public String getDepotList(
|
||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
@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);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class DepotHeadController {
|
|||||||
@PostMapping(value = "/batchSetStatus")
|
@PostMapping(value = "/batchSetStatus")
|
||||||
public String batchSetStatus(@RequestParam("status") String status,
|
public String batchSetStatus(@RequestParam("status") String status,
|
||||||
@RequestParam("depotHeadIDs") String depotHeadIDs,
|
@RequestParam("depotHeadIDs") String depotHeadIDs,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = depotHeadService.batchSetStatus(status, depotHeadIDs);
|
int res = depotHeadService.batchSetStatus(status, depotHeadIDs);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
@@ -71,7 +71,7 @@ public class DepotHeadController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/buildNumber")
|
@GetMapping(value = "/buildNumber")
|
||||||
public BaseResponseInfo buildNumber(HttpServletRequest request) {
|
public BaseResponseInfo buildNumber(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 {
|
||||||
@@ -93,7 +93,7 @@ public class DepotHeadController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getMaxId")
|
@GetMapping(value = "/getMaxId")
|
||||||
public BaseResponseInfo getMaxId(HttpServletRequest request) {
|
public BaseResponseInfo getMaxId(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 {
|
||||||
@@ -117,7 +117,7 @@ public class DepotHeadController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findByMonth")
|
@GetMapping(value = "/findByMonth")
|
||||||
public BaseResponseInfo findByMonth(@RequestParam("monthTime") String monthTime,
|
public BaseResponseInfo findByMonth(@RequestParam("monthTime") String monthTime,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -164,7 +164,7 @@ public class DepotHeadController {
|
|||||||
@RequestParam("beginTime") String beginTime,
|
@RequestParam("beginTime") String beginTime,
|
||||||
@RequestParam("endTime") String endTime,
|
@RequestParam("endTime") String endTime,
|
||||||
@RequestParam("type") String type,
|
@RequestParam("type") String type,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -211,7 +211,7 @@ public class DepotHeadController {
|
|||||||
@RequestParam("beginTime") String beginTime,
|
@RequestParam("beginTime") String beginTime,
|
||||||
@RequestParam("endTime") String endTime,
|
@RequestParam("endTime") String endTime,
|
||||||
@RequestParam("type") String type,
|
@RequestParam("type") String type,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -254,7 +254,7 @@ public class DepotHeadController {
|
|||||||
@RequestParam("endTime") String endTime,
|
@RequestParam("endTime") String endTime,
|
||||||
@RequestParam("organId") Integer organId,
|
@RequestParam("organId") Integer organId,
|
||||||
@RequestParam("supType") String supType,
|
@RequestParam("supType") String supType,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -338,7 +338,7 @@ public class DepotHeadController {
|
|||||||
public BaseResponseInfo findTotalPay(@RequestParam("supplierId") Integer supplierId,
|
public BaseResponseInfo findTotalPay(@RequestParam("supplierId") Integer supplierId,
|
||||||
@RequestParam("endTime") String endTime,
|
@RequestParam("endTime") String endTime,
|
||||||
@RequestParam("supType") String supType,
|
@RequestParam("supType") String supType,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -376,7 +376,7 @@ public class DepotHeadController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getDetailByNumber")
|
@GetMapping(value = "/getDetailByNumber")
|
||||||
public BaseResponseInfo getDetailByNumber(@RequestParam("number") String number,
|
public BaseResponseInfo getDetailByNumber(@RequestParam("number") String number,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
DepotHeadVo4List dhl = new DepotHeadVo4List();
|
DepotHeadVo4List dhl = new DepotHeadVo4List();
|
||||||
try {
|
try {
|
||||||
@@ -403,7 +403,7 @@ public class DepotHeadController {
|
|||||||
* @param mode 合计或者金额
|
* @param mode 合计或者金额
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal allMoney(String getS, String type, String subType, String mode, String endTime) {
|
public BigDecimal allMoney(String getS, String type, String subType, String mode, String endTime)throws Exception {
|
||||||
BigDecimal allMoney = BigDecimal.ZERO;
|
BigDecimal allMoney = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
Integer supplierId = Integer.valueOf(getS);
|
Integer supplierId = Integer.valueOf(getS);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class DepotItemController {
|
|||||||
@GetMapping(value = "/getHeaderIdByMaterial")
|
@GetMapping(value = "/getHeaderIdByMaterial")
|
||||||
public BaseResponseInfo getHeaderIdByMaterial(@RequestParam("materialParam") String materialParam,
|
public BaseResponseInfo getHeaderIdByMaterial(@RequestParam("materialParam") String materialParam,
|
||||||
@RequestParam("depotIds") String depotIds,
|
@RequestParam("depotIds") String depotIds,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<DepotItemVo4HeaderId> depotItemList = depotItemService.getHeaderIdByMaterial(materialParam, depotIds);
|
List<DepotItemVo4HeaderId> depotItemList = depotItemService.getHeaderIdByMaterial(materialParam, depotIds);
|
||||||
@@ -89,7 +89,7 @@ public class DepotItemController {
|
|||||||
public String findDetailByTypeAndMaterialId(
|
public String findDetailByTypeAndMaterialId(
|
||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
@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("materialId") String mId, HttpServletRequest request) {
|
@RequestParam("materialId") String mId, HttpServletRequest request)throws Exception {
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||||
parameterMap.put("mId", mId);
|
parameterMap.put("mId", mId);
|
||||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
PageQueryInfo queryInfo = new PageQueryInfo();
|
||||||
@@ -139,7 +139,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("projectId") Integer pid,
|
@RequestParam("projectId") Integer pid,
|
||||||
@RequestParam("materialId") String mId,
|
@RequestParam("materialId") String mId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||||
parameterMap.put("mId", mId);
|
parameterMap.put("mId", mId);
|
||||||
parameterMap.put("monthTime", monthTime);
|
parameterMap.put("monthTime", monthTime);
|
||||||
@@ -203,7 +203,7 @@ public class DepotItemController {
|
|||||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
||||||
@RequestParam("materialId") String mId,
|
@RequestParam("materialId") String mId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||||
parameterMap.put("mId", mId);
|
parameterMap.put("mId", mId);
|
||||||
parameterMap.put("monthTime", monthTime);
|
parameterMap.put("monthTime", monthTime);
|
||||||
@@ -250,7 +250,7 @@ public class DepotItemController {
|
|||||||
* @param mId
|
* @param mId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int sumNumberByMaterialId(String type, Long mId) {
|
public int sumNumberByMaterialId(String type, Long mId)throws Exception {
|
||||||
int allNumber = 0;
|
int allNumber = 0;
|
||||||
try {
|
try {
|
||||||
allNumber = depotItemService.findByTypeAndMaterialId(type, mId);
|
allNumber = depotItemService.findByTypeAndMaterialId(type, mId);
|
||||||
@@ -291,7 +291,7 @@ public class DepotItemController {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String findUnitName(Long mId) {
|
public String findUnitName(Long mId)throws Exception {
|
||||||
String unitName = "";
|
String unitName = "";
|
||||||
try {
|
try {
|
||||||
unitName = materialService.findUnitName(mId);
|
unitName = materialService.findUnitName(mId);
|
||||||
@@ -310,7 +310,7 @@ public class DepotItemController {
|
|||||||
@GetMapping(value = "/getDetailList")
|
@GetMapping(value = "/getDetailList")
|
||||||
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
||||||
@RequestParam("mpList") String mpList,
|
@RequestParam("mpList") String mpList,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -382,7 +382,7 @@ public class DepotItemController {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx) {
|
public String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx)throws Exception {
|
||||||
String materialOther = "";
|
String materialOther = "";
|
||||||
for (int i = 0; i < mpArr.length; i++) {
|
for (int i = 0; i < mpArr.length; i++) {
|
||||||
if (mpArr[i].equals("颜色")) {
|
if (mpArr[i].equals("颜色")) {
|
||||||
@@ -427,7 +427,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
@RequestParam("mpList") String mpList,
|
@RequestParam("mpList") String mpList,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -497,7 +497,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -540,7 +540,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
@RequestParam("mpList") String mpList,
|
@RequestParam("mpList") String mpList,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -600,7 +600,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
@RequestParam("mpList") String mpList,
|
@RequestParam("mpList") String mpList,
|
||||||
HttpServletRequest request) {
|
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 {
|
||||||
@@ -665,7 +665,7 @@ public class DepotItemController {
|
|||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
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 = "成功";
|
||||||
@@ -731,7 +731,7 @@ public class DepotItemController {
|
|||||||
* @param isPrev
|
* @param isPrev
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal sumNumber(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
public BigDecimal sumNumber(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
|
||||||
BigDecimal sumNumber = BigDecimal.ZERO;
|
BigDecimal sumNumber = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
BigDecimal sum = depotItemService.findByType(type, ProjectId, MId, MonthTime, isPrev);
|
BigDecimal sum = depotItemService.findByType(type, ProjectId, MId, MonthTime, isPrev);
|
||||||
@@ -744,7 +744,7 @@ public class DepotItemController {
|
|||||||
return sumNumber;
|
return sumNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal assembleNumber(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
public BigDecimal assembleNumber(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws Exception{
|
||||||
BigDecimal assembleNumber = BigDecimal.ZERO;
|
BigDecimal assembleNumber = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
BigDecimal sum = depotItemService.findAssembleByType(subType, mType, ProjectId, MId, MonthTime, isPrev);
|
BigDecimal sum = depotItemService.findAssembleByType(subType, mType, ProjectId, MId, MonthTime, isPrev);
|
||||||
@@ -766,7 +766,7 @@ public class DepotItemController {
|
|||||||
* @param isPrev
|
* @param isPrev
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal sumPrice(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
public BigDecimal sumPrice(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws Exception{
|
||||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
BigDecimal sumPrice = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
BigDecimal sum = depotItemService.findPriceByType(type, ProjectId, MId, MonthTime, isPrev);
|
BigDecimal sum = depotItemService.findPriceByType(type, ProjectId, MId, MonthTime, isPrev);
|
||||||
@@ -779,7 +779,7 @@ public class DepotItemController {
|
|||||||
return sumPrice;
|
return sumPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime) {
|
public BigDecimal sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
||||||
BigDecimal sumNumber = BigDecimal.ZERO;
|
BigDecimal sumNumber = BigDecimal.ZERO;
|
||||||
String sumType = "Number";
|
String sumType = "Number";
|
||||||
try {
|
try {
|
||||||
@@ -793,7 +793,7 @@ public class DepotItemController {
|
|||||||
return sumNumber;
|
return sumNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime) {
|
public BigDecimal sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
||||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
BigDecimal sumPrice = BigDecimal.ZERO;
|
||||||
String sumType = "Price";
|
String sumType = "Price";
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class FunctionsController {
|
|||||||
@PostMapping(value = "/findMenu")
|
@PostMapping(value = "/findMenu")
|
||||||
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
|
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
|
||||||
@RequestParam(value="hasFunctions") String hasFunctions,
|
@RequestParam(value="hasFunctions") String hasFunctions,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
try {
|
try {
|
||||||
@@ -124,7 +124,7 @@ public class FunctionsController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findRoleFunctions")
|
@PostMapping(value = "/findRoleFunctions")
|
||||||
public JSONArray findRoleFunctions(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findRoleFunctions(@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<Functions> dataListFun = functionsService.findRoleFunctions("0");
|
List<Functions> dataListFun = functionsService.findRoleFunctions("0");
|
||||||
@@ -277,7 +277,7 @@ public class FunctionsController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findByIds")
|
@GetMapping(value = "/findByIds")
|
||||||
public BaseResponseInfo findByIds(@RequestParam("functionsIds") String functionsIds,
|
public BaseResponseInfo findByIds(@RequestParam("functionsIds") String functionsIds,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<Functions> dataList = functionsService.findByIds(functionsIds);
|
List<Functions> dataList = functionsService.findByIds(functionsIds);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class InOutItemController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findBySelect")
|
@GetMapping(value = "/findBySelect")
|
||||||
public String findBySelect(@RequestParam("type") String type, HttpServletRequest request) {
|
public String findBySelect(@RequestParam("type") String type, HttpServletRequest request) throws Exception{
|
||||||
String res = null;
|
String res = null;
|
||||||
try {
|
try {
|
||||||
List<InOutItem> dataList = inOutItemService.findBySelect(type);
|
List<InOutItem> dataList = inOutItemService.findBySelect(type);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class MaterialCategoryController {
|
|||||||
private MaterialCategoryService materialCategoryService;
|
private MaterialCategoryService materialCategoryService;
|
||||||
|
|
||||||
@GetMapping(value = "/getAllList")
|
@GetMapping(value = "/getAllList")
|
||||||
public BaseResponseInfo getAllList(@RequestParam("parentId") Long parentId, HttpServletRequest request) {
|
public BaseResponseInfo getAllList(@RequestParam("parentId") Long parentId, HttpServletRequest request) throws Exception{
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<MaterialCategory> materialCategoryList = materialCategoryService.getAllList(parentId);
|
List<MaterialCategory> materialCategoryList = materialCategoryService.getAllList(parentId);
|
||||||
@@ -56,7 +56,7 @@ public class MaterialCategoryController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/findById")
|
@RequestMapping(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<MaterialCategory> dataList = materialCategoryService.findById(id);
|
List<MaterialCategory> dataList = materialCategoryService.findById(id);
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -68,7 +68,7 @@ public class MaterialController {
|
|||||||
@PostMapping(value = "/batchSetEnable")
|
@PostMapping(value = "/batchSetEnable")
|
||||||
public String batchSetEnable(@RequestParam("enabled") Boolean enabled,
|
public String batchSetEnable(@RequestParam("enabled") Boolean enabled,
|
||||||
@RequestParam("materialIDs") String materialIDs,
|
@RequestParam("materialIDs") String materialIDs,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = materialService.batchSetEnable(enabled, materialIDs);
|
int res = materialService.batchSetEnable(enabled, materialIDs);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class PersonController {
|
|||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
@GetMapping(value = "/getAllList")
|
@GetMapping(value = "/getAllList")
|
||||||
public BaseResponseInfo getAllList(HttpServletRequest request) {
|
public BaseResponseInfo getAllList(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 {
|
||||||
@@ -53,7 +53,8 @@ public class PersonController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getPersonByIds")
|
@GetMapping(value = "/getPersonByIds")
|
||||||
public BaseResponseInfo getPersonByIds(@RequestParam("personIDs") String personIDs, HttpServletRequest request) {
|
public BaseResponseInfo getPersonByIds(@RequestParam("personIDs") String personIDs,
|
||||||
|
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 {
|
||||||
@@ -76,7 +77,8 @@ public class PersonController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getPersonByType")
|
@GetMapping(value = "/getPersonByType")
|
||||||
public BaseResponseInfo getPersonByType(@RequestParam("type") String type, HttpServletRequest request) {
|
public BaseResponseInfo getPersonByType(@RequestParam("type") String type,
|
||||||
|
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 {
|
||||||
@@ -99,7 +101,8 @@ public class PersonController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/getPersonByNumType")
|
@PostMapping(value = "/getPersonByNumType")
|
||||||
public JSONArray getPersonByNumType(@RequestParam("type") String typeNum, HttpServletRequest request) {
|
public JSONArray getPersonByNumType(@RequestParam("type") String typeNum,
|
||||||
|
HttpServletRequest request)throws Exception {
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
try {
|
try {
|
||||||
String type = "";
|
String type = "";
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.service.CommonQueryManager;
|
import com.jsh.erp.service.CommonQueryManager;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ public class ResourceController {
|
|||||||
private CommonQueryManager configResourceManager;
|
private CommonQueryManager configResourceManager;
|
||||||
|
|
||||||
@GetMapping(value = "/test/heart")
|
@GetMapping(value = "/test/heart")
|
||||||
public JSONObject exitHeart(HttpServletRequest request) {
|
public JSONObject exitHeart(HttpServletRequest request)throws Exception {
|
||||||
return JsonUtils.ok();
|
return JsonUtils.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +37,7 @@ public class ResourceController {
|
|||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
@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,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||||
parameterMap.put(Constants.SEARCH, search);
|
parameterMap.put(Constants.SEARCH, search);
|
||||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
PageQueryInfo queryInfo = new PageQueryInfo();
|
||||||
@@ -60,7 +63,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"})
|
||||||
public String addResource(@PathVariable("apiName") String apiName,
|
public String addResource(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam("info") String beanJson, HttpServletRequest request) {
|
@RequestParam("info") String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int insert = configResourceManager.insert(apiName, beanJson, request);
|
int insert = configResourceManager.insert(apiName, beanJson, request);
|
||||||
if(insert > 0) {
|
if(insert > 0) {
|
||||||
@@ -73,7 +76,7 @@ public class ResourceController {
|
|||||||
@PostMapping(value = "/{apiName}/update", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/update", produces = {"application/javascript", "application/json"})
|
||||||
public String updateResource(@PathVariable("apiName") String apiName,
|
public String updateResource(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam("info") String beanJson,
|
@RequestParam("info") String beanJson,
|
||||||
@RequestParam("id") Long id, HttpServletRequest request) {
|
@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int update = configResourceManager.update(apiName, beanJson, id, request);
|
int update = configResourceManager.update(apiName, beanJson, id, request);
|
||||||
if(update > 0) {
|
if(update > 0) {
|
||||||
@@ -85,7 +88,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/{id}/delete", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/{id}/delete", produces = {"application/javascript", "application/json"})
|
||||||
public String deleteResource(@PathVariable("apiName") String apiName,
|
public String deleteResource(@PathVariable("apiName") String apiName,
|
||||||
@PathVariable Long id, HttpServletRequest request) {
|
@PathVariable Long id, HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int delete = configResourceManager.delete(apiName, id, request);
|
int delete = configResourceManager.delete(apiName, id, request);
|
||||||
if(delete > 0) {
|
if(delete > 0) {
|
||||||
@@ -97,7 +100,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/batchDelete", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/batchDelete", produces = {"application/javascript", "application/json"})
|
||||||
public String batchDeleteResource(@PathVariable("apiName") String apiName,
|
public String batchDeleteResource(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam("ids") String ids, HttpServletRequest request) {
|
@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int delete = configResourceManager.batchDelete(apiName, ids, request);
|
int delete = configResourceManager.batchDelete(apiName, ids, request);
|
||||||
if(delete > 0) {
|
if(delete > 0) {
|
||||||
@@ -110,7 +113,7 @@ public class ResourceController {
|
|||||||
@GetMapping(value = "/{apiName}/checkIsNameExist")
|
@GetMapping(value = "/{apiName}/checkIsNameExist")
|
||||||
public String checkIsNameExist(@PathVariable("apiName") String apiName,
|
public String checkIsNameExist(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int exist = configResourceManager.checkIsNameExist(apiName, id, name);
|
int exist = configResourceManager.checkIsNameExist(apiName, id, name);
|
||||||
if(exist > 0) {
|
if(exist > 0) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class RoleController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/findUserRole")
|
@PostMapping(value = "/findUserRole")
|
||||||
public JSONArray findUserRole(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
public JSONArray findUserRole(@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<Role> dataList = roleService.findUserRole();
|
List<Role> dataList = roleService.findUserRole();
|
||||||
@@ -76,7 +76,7 @@ public class RoleController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/list")
|
@PostMapping(value = "/list")
|
||||||
public List<Role> list(HttpServletRequest request) {
|
public List<Role> list(HttpServletRequest request)throws Exception {
|
||||||
return roleService.getRole();
|
return roleService.getRole();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class SerialNumberController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/serialNumber/addSerialNumber")
|
@PostMapping("/serialNumber/addSerialNumber")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object addSerialNumber(@RequestParam("info") String beanJson){
|
public Object addSerialNumber(@RequestParam("info") String beanJson)throws Exception{
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
JSONObject result = ExceptionConstants.standardSuccess();
|
||||||
SerialNumberEx sne= JSON.parseObject(beanJson, SerialNumberEx.class);
|
SerialNumberEx sne= JSON.parseObject(beanJson, SerialNumberEx.class);
|
||||||
serialNumberService.addSerialNumber(sne);
|
serialNumberService.addSerialNumber(sne);
|
||||||
@@ -78,7 +78,7 @@ public class SerialNumberController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/serialNumber/updateSerialNumber")
|
@PostMapping("/serialNumber/updateSerialNumber")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object updateSerialNumber(@RequestParam("info") String beanJson){
|
public Object updateSerialNumber(@RequestParam("info") String beanJson)throws Exception{
|
||||||
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
JSONObject result = ExceptionConstants.standardSuccess();
|
||||||
SerialNumberEx sne= JSON.parseObject(beanJson, SerialNumberEx.class);
|
SerialNumberEx sne= JSON.parseObject(beanJson, SerialNumberEx.class);
|
||||||
@@ -100,7 +100,7 @@ public class SerialNumberController {
|
|||||||
@PostMapping("/serialNumber/batAddSerialNumber")
|
@PostMapping("/serialNumber/batAddSerialNumber")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object batAddSerialNumber(@RequestParam("materialName") String materialName, @RequestParam("serialNumberPrefix") String serialNumberPrefix,
|
public Object batAddSerialNumber(@RequestParam("materialName") String materialName, @RequestParam("serialNumberPrefix") String serialNumberPrefix,
|
||||||
@RequestParam("batAddTotal") Integer batAddTotal,@RequestParam("remark") String remark){
|
@RequestParam("batAddTotal") Integer batAddTotal,@RequestParam("remark") String remark)throws Exception{
|
||||||
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
JSONObject result = ExceptionConstants.standardSuccess();
|
||||||
serialNumberService.batAddSerialNumber(materialName,serialNumberPrefix,batAddTotal,remark);
|
serialNumberService.batAddSerialNumber(materialName,serialNumberPrefix,batAddTotal,remark);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class SupplierController {
|
|||||||
@PostMapping(value = "/updateAdvanceIn")
|
@PostMapping(value = "/updateAdvanceIn")
|
||||||
public String updateAdvanceIn(@RequestParam("supplierId") Long supplierId,
|
public String updateAdvanceIn(@RequestParam("supplierId") Long supplierId,
|
||||||
@RequestParam("advanceIn") BigDecimal advanceIn,
|
@RequestParam("advanceIn") BigDecimal advanceIn,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = supplierService.updateAdvanceIn(supplierId, advanceIn);
|
int res = supplierService.updateAdvanceIn(supplierId, advanceIn);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
@@ -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();
|
||||||
@@ -221,7 +221,7 @@ public class SupplierController {
|
|||||||
@PostMapping(value = "/batchSetEnable")
|
@PostMapping(value = "/batchSetEnable")
|
||||||
public String batchSetEnable(@RequestParam("enabled") Boolean enabled,
|
public String batchSetEnable(@RequestParam("enabled") Boolean enabled,
|
||||||
@RequestParam("supplierIDs") String supplierIDs,
|
@RequestParam("supplierIDs") String supplierIDs,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = supplierService.batchSetEnable(enabled, supplierIDs);
|
int res = supplierService.batchSetEnable(enabled, supplierIDs);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class UserBusinessController {
|
|||||||
@GetMapping(value = "/getBasicData")
|
@GetMapping(value = "/getBasicData")
|
||||||
public BaseResponseInfo getBasicData(@RequestParam(value = "KeyId") String keyId,
|
public BaseResponseInfo getBasicData(@RequestParam(value = "KeyId") String keyId,
|
||||||
@RequestParam(value = "Type") String type,
|
@RequestParam(value = "Type") String type,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<UserBusiness> list = userBusinessService.getBasicData(keyId, type);
|
List<UserBusiness> list = userBusinessService.getBasicData(keyId, type);
|
||||||
@@ -55,7 +55,7 @@ public class UserBusinessController {
|
|||||||
@GetMapping(value = "/checkIsValueExist")
|
@GetMapping(value = "/checkIsValueExist")
|
||||||
public String checkIsValueExist(@RequestParam(value ="type", required = false) String type,
|
public String checkIsValueExist(@RequestParam(value ="type", required = false) String type,
|
||||||
@RequestParam(value ="keyId", required = false) String keyId,
|
@RequestParam(value ="keyId", required = false) String keyId,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
Long id = userBusinessService.checkIsValueExist(type, keyId);
|
Long id = userBusinessService.checkIsValueExist(type, keyId);
|
||||||
if(id != null) {
|
if(id != null) {
|
||||||
@@ -76,7 +76,7 @@ public class UserBusinessController {
|
|||||||
@PostMapping(value = "/updateBtnStr")
|
@PostMapping(value = "/updateBtnStr")
|
||||||
public BaseResponseInfo updateBtnStr(@RequestParam(value ="userBusinessId", required = false) Long userBusinessId,
|
public BaseResponseInfo updateBtnStr(@RequestParam(value ="userBusinessId", required = false) Long userBusinessId,
|
||||||
@RequestParam(value ="btnStr", required = false) String btnStr,
|
@RequestParam(value ="btnStr", required = false) String btnStr,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
int back = userBusinessService.updateBtnStr(userBusinessId, btnStr);
|
int back = userBusinessService.updateBtnStr(userBusinessId, btnStr);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class UserController {
|
|||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
public BaseResponseInfo login(@RequestParam(value = "loginame", required = false) String loginame,
|
public BaseResponseInfo login(@RequestParam(value = "loginame", required = false) String loginame,
|
||||||
@RequestParam(value = "password", required = false) String password,
|
@RequestParam(value = "password", required = false) String password,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
logger.info("============用户登录 login 方法调用开始==============");
|
logger.info("============用户登录 login 方法调用开始==============");
|
||||||
String msgTip = "";
|
String msgTip = "";
|
||||||
User user=null;
|
User user=null;
|
||||||
@@ -150,7 +150,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/getUserSession")
|
@GetMapping(value = "/getUserSession")
|
||||||
public BaseResponseInfo getSessionUser(HttpServletRequest request) {
|
public BaseResponseInfo getSessionUser(HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
@@ -171,7 +171,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/logout")
|
@GetMapping(value = "/logout")
|
||||||
public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response) {
|
public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
request.getSession().removeAttribute("user");
|
request.getSession().removeAttribute("user");
|
||||||
@@ -192,7 +192,7 @@ public class UserController {
|
|||||||
|
|
||||||
@PostMapping(value = "/resetPwd")
|
@PostMapping(value = "/resetPwd")
|
||||||
public String resetPwd(@RequestParam("id") Long id,
|
public String resetPwd(@RequestParam("id") Long id,
|
||||||
HttpServletRequest request) throws NoSuchAlgorithmException {
|
HttpServletRequest request) throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
String password = "123456";
|
String password = "123456";
|
||||||
String md5Pwd = Tools.md5Encryp(password);
|
String md5Pwd = Tools.md5Encryp(password);
|
||||||
@@ -206,7 +206,7 @@ public class UserController {
|
|||||||
|
|
||||||
@PostMapping(value = "/updatePwd")
|
@PostMapping(value = "/updatePwd")
|
||||||
public String updatePwd(@RequestParam("userId") Long userId, @RequestParam("password") String password,
|
public String updatePwd(@RequestParam("userId") Long userId, @RequestParam("password") String password,
|
||||||
@RequestParam("oldpwd") String oldpwd, HttpServletRequest request) {
|
@RequestParam("oldpwd") String oldpwd, HttpServletRequest request)throws Exception {
|
||||||
Integer flag = 0;
|
Integer flag = 0;
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
try {
|
try {
|
||||||
@@ -242,7 +242,7 @@ public class UserController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getAllList")
|
@GetMapping(value = "/getAllList")
|
||||||
public BaseResponseInfo getAllList(HttpServletRequest request) {
|
public BaseResponseInfo getAllList(HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
@@ -425,7 +425,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getTenantStatus")
|
@GetMapping("/getTenantStatus")
|
||||||
public BaseResponseInfo getTenantStatus(HttpServletRequest request) {
|
public BaseResponseInfo getTenantStatus(HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ public class GlobalExceptionHandler {
|
|||||||
status.put(ExceptionConstants.GLOBAL_RETURNS_CODE, ExceptionConstants.SERVICE_SYSTEM_ERROR_CODE);
|
status.put(ExceptionConstants.GLOBAL_RETURNS_CODE, ExceptionConstants.SERVICE_SYSTEM_ERROR_CODE);
|
||||||
status.put(ExceptionConstants.GLOBAL_RETURNS_MESSAGE, ExceptionConstants.SERVICE_SYSTEM_ERROR_MSG);
|
status.put(ExceptionConstants.GLOBAL_RETURNS_MESSAGE, ExceptionConstants.SERVICE_SYSTEM_ERROR_MSG);
|
||||||
log.error("Global Exception Occured => url : {}, msg : {}", request.getRequestURL(), e.getMessage());
|
log.error("Global Exception Occured => url : {}, msg : {}", request.getRequestURL(), e.getMessage());
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* create time: 2019/4/18 17:41
|
||||||
|
* website:https://qiankunpingtai.cn
|
||||||
|
* description:
|
||||||
|
* 这里输出完整的堆栈信息,否则有些异常完全不知道哪里出错了。
|
||||||
|
*/
|
||||||
|
log.error("Global Exception Occured => url : {}", request.getRequestURL(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.jsh.erp.service;
|
package com.jsh.erp.service;
|
||||||
|
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.Log;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.mappers.LogMapper;
|
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -12,12 +9,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.jsh.erp.utils.Tools.getLocalIp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jishenghua 752718920 2018-10-7 15:25:58
|
* @author jishenghua 752718920 2018-10-7 15:25:58
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +30,7 @@ public class CommonQueryManager {
|
|||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
* @param id ID
|
* @param id ID
|
||||||
*/
|
*/
|
||||||
public Object selectOne(String apiName, String id) {
|
public Object selectOne(String apiName, String id) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName) && StringUtil.isNotEmpty(id)) {
|
if (StringUtil.isNotEmpty(apiName) && StringUtil.isNotEmpty(id)) {
|
||||||
return container.getCommonQuery(apiName).selectOne(id);
|
return container.getCommonQuery(apiName).selectOne(id);
|
||||||
}
|
}
|
||||||
@@ -49,7 +43,7 @@ public class CommonQueryManager {
|
|||||||
* @param parameterMap
|
* @param parameterMap
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<?> select(String apiName, Map<String, String> parameterMap) {
|
public List<?> select(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).select(parameterMap);
|
return container.getCommonQuery(apiName).select(parameterMap);
|
||||||
}
|
}
|
||||||
@@ -62,7 +56,7 @@ public class CommonQueryManager {
|
|||||||
* @param parameterMap
|
* @param parameterMap
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Long counts(String apiName, Map<String, String> parameterMap) {
|
public Long counts(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).counts(parameterMap);
|
return container.getCommonQuery(apiName).counts(parameterMap);
|
||||||
}
|
}
|
||||||
@@ -76,7 +70,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insert(String apiName, String beanJson, HttpServletRequest request) {
|
public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||||
return container.getCommonQuery(apiName).insert(beanJson, request);
|
return container.getCommonQuery(apiName).insert(beanJson, request);
|
||||||
@@ -92,7 +86,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int update(String apiName, String beanJson, Long id, HttpServletRequest request) {
|
public int update(String apiName, String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName,
|
logService.insertLog(apiName,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
||||||
@@ -108,7 +102,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int delete(String apiName, Long id, HttpServletRequest request) {
|
public int delete(String apiName, Long id, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName,
|
logService.insertLog(apiName,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
||||||
@@ -124,7 +118,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDelete(String apiName, String ids, HttpServletRequest request) {
|
public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName, "批量删除,id集:" + ids, request);
|
logService.insertLog(apiName, "批量删除,id集:" + ids, request);
|
||||||
return container.getCommonQuery(apiName).batchDelete(ids);
|
return container.getCommonQuery(apiName).batchDelete(ids);
|
||||||
@@ -139,7 +133,7 @@ public class CommonQueryManager {
|
|||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int checkIsNameExist(String apiName, Long id, String name) {
|
public int checkIsNameExist(String apiName, Long id, String name) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
|
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface ICommonQuery {
|
|||||||
* @param condition 资源id
|
* @param condition 资源id
|
||||||
* @return 资源
|
* @return 资源
|
||||||
*/
|
*/
|
||||||
Object selectOne(String condition);
|
Object selectOne(String condition) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询
|
* 自定义查询
|
||||||
@@ -26,7 +26,7 @@ public interface ICommonQuery {
|
|||||||
* @param parameterMap 查询参数
|
* @param parameterMap 查询参数
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
List<?> select(Map<String, String> parameterMap);
|
List<?> select(Map<String, String> parameterMap) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数量
|
* 查询数量
|
||||||
@@ -34,7 +34,7 @@ public interface ICommonQuery {
|
|||||||
* @param parameterMap 查询参数
|
* @param parameterMap 查询参数
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
Long counts(Map<String, String> parameterMap);
|
Long counts(Map<String, String> parameterMap) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
@@ -42,7 +42,7 @@ public interface ICommonQuery {
|
|||||||
* @param beanJson
|
* @param beanJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int insert(String beanJson, HttpServletRequest request);
|
int insert(String beanJson, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新数据
|
* 更新数据
|
||||||
@@ -50,7 +50,7 @@ public interface ICommonQuery {
|
|||||||
* @param beanJson
|
* @param beanJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int update(String beanJson, Long id);
|
int update(String beanJson, Long id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据
|
* 删除数据
|
||||||
@@ -58,7 +58,7 @@ public interface ICommonQuery {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int delete(Long id);
|
int delete(Long id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除数据
|
* 批量删除数据
|
||||||
@@ -66,7 +66,7 @@ public interface ICommonQuery {
|
|||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int batchDelete(String ids);
|
int batchDelete(String ids) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询名称是否存在
|
* 查询名称是否存在
|
||||||
@@ -74,5 +74,5 @@ public interface ICommonQuery {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int checkIsNameExist(Long id, String name);
|
int checkIsNameExist(Long id, String name) throws Exception;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.jsh.erp.service.account;
|
package com.jsh.erp.service.account;
|
||||||
|
|
||||||
import com.jsh.erp.service.ICommonQuery;
|
import com.jsh.erp.service.ICommonQuery;
|
||||||
import com.jsh.erp.service.depot.DepotResource;
|
|
||||||
import com.jsh.erp.service.depot.DepotService;
|
|
||||||
import com.jsh.erp.utils.Constants;
|
import com.jsh.erp.utils.Constants;
|
||||||
import com.jsh.erp.utils.QueryUtils;
|
import com.jsh.erp.utils.QueryUtils;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -26,11 +24,11 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<?> select(Map<String, String> map) {
|
public List<?> select(Map<String, String> map)throws Exception {
|
||||||
return getAccountList(map);
|
return getAccountList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getAccountList(Map<String, String> map) {
|
private List<?> getAccountList(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 serialNo = StringUtil.getInfo(search, "serialNo");
|
String serialNo = StringUtil.getInfo(search, "serialNo");
|
||||||
@@ -40,7 +38,7 @@ public class AccountComponent 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 serialNo = StringUtil.getInfo(search, "serialNo");
|
String serialNo = StringUtil.getInfo(search, "serialNo");
|
||||||
@@ -49,27 +47,27 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return accountService.insertAccount(beanJson, request);
|
return accountService.insertAccount(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return accountService.updateAccount(beanJson, id);
|
return accountService.updateAccount(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return accountService.deleteAccount(id);
|
return accountService.deleteAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return accountService.batchDeleteAccount(ids);
|
return accountService.batchDeleteAccount(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return accountService.checkIsNameExist(id, name);
|
return accountService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,15 +62,33 @@ public class AccountService {
|
|||||||
return accountMapper.selectByPrimaryKey(id);
|
return accountMapper.selectByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Account> getAccount() {
|
public List<Account> getAccount() throws Exception{
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return accountMapper.selectByExample(example);
|
List<Account> list=null;
|
||||||
|
try{
|
||||||
|
list=accountMapper.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<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) {
|
public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) throws Exception{
|
||||||
List<AccountVo4List> resList = new ArrayList<AccountVo4List>();
|
List<AccountVo4List> resList = new ArrayList<AccountVo4List>();
|
||||||
List<AccountVo4List> list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows);
|
List<AccountVo4List> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, 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);
|
||||||
|
}
|
||||||
String timeStr = Tools.getCurrentMonth();
|
String timeStr = Tools.getCurrentMonth();
|
||||||
if (null != list && null !=timeStr) {
|
if (null != list && null !=timeStr) {
|
||||||
for (AccountVo4List al : list) {
|
for (AccountVo4List al : list) {
|
||||||
@@ -89,53 +107,114 @@ public class AccountService {
|
|||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long countAccount(String name, String serialNo, String remark) {
|
public Long countAccount(String name, String serialNo, String remark)throws Exception {
|
||||||
return accountMapperEx.countsByAccount(name, serialNo, remark);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=accountMapperEx.countsByAccount(name, serialNo, remark);
|
||||||
|
}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 insertAccount(String beanJson, HttpServletRequest request) {
|
public int insertAccount(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||||
if(account.getInitialamount() == null) {
|
if(account.getInitialamount() == null) {
|
||||||
account.setInitialamount(BigDecimal.ZERO);
|
account.setInitialamount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
account.setIsdefault(false);
|
account.setIsdefault(false);
|
||||||
return accountMapper.insertSelective(account);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.insertSelective(account);
|
||||||
|
}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 updateAccount(String beanJson, Long id) {
|
public int updateAccount(String beanJson, Long id)throws Exception {
|
||||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||||
account.setId(id);
|
account.setId(id);
|
||||||
return accountMapper.updateByPrimaryKeySelective(account);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.updateByPrimaryKeySelective(account);
|
||||||
|
}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 deleteAccount(Long id) {
|
public int deleteAccount(Long id) throws Exception{
|
||||||
return accountMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.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 batchDeleteAccount(String ids) {
|
public int batchDeleteAccount(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return accountMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.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 {
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
|
List<Account> list=null;
|
||||||
List<Account> list = accountMapper.selectByExample(example);
|
try{
|
||||||
return list.size();
|
list = accountMapper.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 List<Account> findBySelect() {
|
public List<Account> findBySelect()throws Exception {
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return accountMapper.selectByExample(example);
|
List<Account> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapper.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,7 +223,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSum(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSum(Long id, String timeStr, String type) throws Exception{
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
@@ -164,7 +243,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
|
List<DepotHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = depotHeadMapper.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);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (DepotHead depotHead : dataList) {
|
for (DepotHead depotHead : dataList) {
|
||||||
if(depotHead.getChangeamount()!=null) {
|
if(depotHead.getChangeamount()!=null) {
|
||||||
@@ -184,7 +271,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSumByHead(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSumByHead(Long id, String timeStr, String type) throws Exception{
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
@@ -205,7 +292,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidEqualTo(id)
|
example.createCriteria().andAccountidEqualTo(id)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
|
List<AccountHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = accountHeadMapper.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);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (AccountHead accountHead : dataList) {
|
for (AccountHead accountHead : dataList) {
|
||||||
if(accountHead.getChangeamount()!=null) {
|
if(accountHead.getChangeamount()!=null) {
|
||||||
@@ -225,7 +320,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSumByDetail(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSumByDetail(Long id, String timeStr, String type)throws Exception {
|
||||||
BigDecimal accountSum =BigDecimal.ZERO ;
|
BigDecimal accountSum =BigDecimal.ZERO ;
|
||||||
try {
|
try {
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
@@ -241,7 +336,15 @@ public class AccountService {
|
|||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
|
List<AccountHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = accountHeadMapper.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);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
String ids = "";
|
String ids = "";
|
||||||
for (AccountHead accountHead : dataList) {
|
for (AccountHead accountHead : dataList) {
|
||||||
@@ -283,7 +386,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getManyAccountSum(Long id, String timeStr, String type) {
|
public BigDecimal getManyAccountSum(Long id, String timeStr, String type)throws Exception {
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
@@ -304,7 +407,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
|
List<DepotHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = depotHeadMapper.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);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (DepotHead depotHead : dataList) {
|
for (DepotHead depotHead : dataList) {
|
||||||
String accountIdList = depotHead.getAccountidlist();
|
String accountIdList = depotHead.getAccountidlist();
|
||||||
@@ -326,32 +437,68 @@ public class AccountService {
|
|||||||
return accountSum;
|
return accountSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, Integer offset, Integer rows) {
|
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, Integer offset, Integer rows) throws Exception{
|
||||||
return accountMapperEx.findAccountInOutList(accountId, offset, rows);
|
List<AccountVo4InOutList> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapperEx.findAccountInOutList(accountId, 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 int findAccountInOutListCount(Long accountId) {
|
public int findAccountInOutListCount(Long accountId) throws Exception{
|
||||||
return accountMapperEx.findAccountInOutListCount(accountId);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapperEx.findAccountInOutListCount(accountId);
|
||||||
|
}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 updateAmountIsDefault(Boolean isDefault, Long accountId) {
|
public int updateAmountIsDefault(Boolean isDefault, Long accountId) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setIsdefault(isDefault);
|
account.setIsdefault(isDefault);
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdEqualTo(accountId);
|
example.createCriteria().andIdEqualTo(accountId);
|
||||||
return accountMapper.updateByExampleSelective(account, example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.updateByExampleSelective(account, 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;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAccountByIds(String ids) {
|
public int batchDeleteAccountByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapperEx.batchDeleteAccountByIds(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
|
||||||
@@ -379,7 +526,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务主表 jsh_accounthead
|
* 校验财务主表 jsh_accounthead
|
||||||
* */
|
* */
|
||||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByAccountIds(idArray);
|
List<AccountHead> accountHeadList=null;
|
||||||
|
try{
|
||||||
|
accountHeadList = accountHeadMapperEx.getAccountHeadListByAccountIds(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("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -389,7 +544,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务子表 jsh_accountitem
|
* 校验财务子表 jsh_accountitem
|
||||||
* */
|
* */
|
||||||
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByAccountIds(idArray);
|
List<AccountItem> accountItemList=null;
|
||||||
|
try{
|
||||||
|
accountItemList = accountItemMapperEx.getAccountItemListByAccountIds(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(accountItemList!=null&&accountItemList.size()>0){
|
if(accountItemList!=null&&accountItemList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -399,7 +562,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据主表 jsh_depothead
|
* 校验单据主表 jsh_depothead
|
||||||
* */
|
* */
|
||||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByAccountIds(idArray);
|
List<DepotHead> depotHeadList =null;
|
||||||
|
try{
|
||||||
|
depotHeadList = depotHeadMapperEx.getDepotHeadListByAccountIds(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("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class AccountHeadComponent implements ICommonQuery {
|
|||||||
private AccountHeadService accountHeadService;
|
private AccountHeadService accountHeadService;
|
||||||
|
|
||||||
@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 getAccountHeadList(map);
|
return getAccountHeadList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getAccountHeadList(Map<String, String> map) {
|
private List<?> getAccountHeadList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
String billNo = StringUtil.getInfo(search, "billNo");
|
String billNo = StringUtil.getInfo(search, "billNo");
|
||||||
@@ -39,7 +39,7 @@ public class AccountHeadComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
String billNo = StringUtil.getInfo(search, "billNo");
|
String billNo = StringUtil.getInfo(search, "billNo");
|
||||||
@@ -49,27 +49,27 @@ public class AccountHeadComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return accountHeadService.insertAccountHead(beanJson, request);
|
return accountHeadService.insertAccountHead(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return accountHeadService.updateAccountHead(beanJson, id);
|
return accountHeadService.updateAccountHead(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return accountHeadService.deleteAccountHead(id);
|
return accountHeadService.deleteAccountHead(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return accountHeadService.batchDeleteAccountHead(ids);
|
return accountHeadService.batchDeleteAccountHead(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return accountHeadService.checkIsNameExist(id, name);
|
return accountHeadService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,18 +42,44 @@ public class AccountHeadService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountItemMapperEx accountItemMapperEx;
|
private AccountItemMapperEx accountItemMapperEx;
|
||||||
|
|
||||||
public AccountHead getAccountHead(long id) {
|
public AccountHead getAccountHead(long id) throws Exception {
|
||||||
return accountHeadMapper.selectByPrimaryKey(id);
|
AccountHead result=null;
|
||||||
|
try{
|
||||||
|
result=accountHeadMapper.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<AccountHead> getAccountHead() {
|
public List<AccountHead> getAccountHead() throws Exception{
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
return accountHeadMapper.selectByExample(example);
|
List<AccountHead> list=null;
|
||||||
|
try{
|
||||||
|
list=accountHeadMapper.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<AccountHeadVo4ListEx> select(String type, String billNo, String beginTime, String endTime, int offset, int rows) {
|
public List<AccountHeadVo4ListEx> select(String type, String billNo, String beginTime, String endTime, int offset, int rows) throws Exception{
|
||||||
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
||||||
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, billNo, beginTime, endTime, offset, rows);
|
List<AccountHeadVo4ListEx> list=null;
|
||||||
|
try{
|
||||||
|
list = accountHeadMapperEx.selectByConditionAccountHead(type, billNo, beginTime, endTime, 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 (AccountHeadVo4ListEx ah : list) {
|
for (AccountHeadVo4ListEx ah : list) {
|
||||||
if(ah.getChangeamount() != null) {
|
if(ah.getChangeamount() != null) {
|
||||||
@@ -68,45 +94,107 @@ public class AccountHeadService {
|
|||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long countAccountHead(String type, String billNo, String beginTime, String endTime) {
|
public Long countAccountHead(String type, String billNo, String beginTime, String endTime) throws Exception{
|
||||||
return accountHeadMapperEx.countsByAccountHead(type, billNo, beginTime, endTime);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapperEx.countsByAccountHead(type, billNo, beginTime, endTime);
|
||||||
|
}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 insertAccountHead(String beanJson, HttpServletRequest request) {
|
public int insertAccountHead(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||||
return accountHeadMapper.insertSelective(accountHead);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapper.insertSelective(accountHead);
|
||||||
|
}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 updateAccountHead(String beanJson, Long id) {
|
public int updateAccountHead(String beanJson, Long id)throws Exception {
|
||||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||||
accountHead.setId(id);
|
accountHead.setId(id);
|
||||||
return accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
||||||
|
}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 deleteAccountHead(Long id) {
|
public int deleteAccountHead(Long id)throws Exception {
|
||||||
return accountHeadMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapper.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 batchDeleteAccountHead(String ids) {
|
public int batchDeleteAccountHead(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return accountHeadMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapper.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 {
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<AccountHead> list = accountHeadMapper.selectByExample(example);
|
List<AccountHead> list = null;
|
||||||
return list.size();
|
try{
|
||||||
|
list = accountHeadMapper.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 Long getMaxId() {
|
public Long getMaxId()throws Exception {
|
||||||
return accountHeadMapperEx.getMaxId();
|
Long result = null;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapperEx.getMaxId();
|
||||||
|
}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 BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
||||||
@@ -116,12 +204,29 @@ public class AccountHeadService {
|
|||||||
} else if (mode.equals("合计")) {
|
} else if (mode.equals("合计")) {
|
||||||
modeName = "TotalPrice";
|
modeName = "TotalPrice";
|
||||||
}
|
}
|
||||||
return accountHeadMapperEx.findAllMoney(supplierId, type, modeName, endTime);
|
BigDecimal result = null;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapperEx.findAllMoney(supplierId, type, modeName, endTime);
|
||||||
|
}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<AccountHeadVo4ListEx> getDetailByNumber(String billNo) {
|
public List<AccountHeadVo4ListEx> getDetailByNumber(String billNo)throws Exception {
|
||||||
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
||||||
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.getDetailByNumber(billNo);
|
List<AccountHeadVo4ListEx> list = null;
|
||||||
|
try{
|
||||||
|
list = accountHeadMapperEx.getDetailByNumber(billNo);
|
||||||
|
}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 (AccountHeadVo4ListEx ah : list) {
|
for (AccountHeadVo4ListEx ah : list) {
|
||||||
if(ah.getChangeamount() != null) {
|
if(ah.getChangeamount() != null) {
|
||||||
@@ -136,13 +241,22 @@ public class AccountHeadService {
|
|||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAccountHeadByIds(String ids) {
|
public int batchDeleteAccountHeadByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapperEx.batchDeleteAccountHeadByIds(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
|
||||||
@@ -168,7 +282,15 @@ public class AccountHeadService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务子表 jsh_accountitem
|
* 校验财务子表 jsh_accountitem
|
||||||
* */
|
* */
|
||||||
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByHeaderIds(idArray);
|
List<AccountItem> accountItemList = null;
|
||||||
|
try{
|
||||||
|
accountItemList = accountItemMapperEx.getAccountItemListByHeaderIds(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(accountItemList!=null&&accountItemList.size()>0){
|
if(accountItemList!=null&&accountItemList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class AccountItemComponent implements ICommonQuery {
|
|||||||
private AccountItemService accountItemService;
|
private AccountItemService accountItemService;
|
||||||
|
|
||||||
@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 getAccountItemList(map);
|
return getAccountItemList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getAccountItemList(Map<String, String> map) {
|
private List<?> getAccountItemList(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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -38,7 +38,7 @@ public class AccountItemComponent 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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -47,27 +47,27 @@ public class AccountItemComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return accountItemService.insertAccountItem(beanJson, request);
|
return accountItemService.insertAccountItem(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return accountItemService.updateAccountItem(beanJson, id);
|
return accountItemService.updateAccountItem(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return accountItemService.deleteAccountItem(id);
|
return accountItemService.deleteAccountItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return accountItemService.batchDeleteAccountItem(ids);
|
return accountItemService.batchDeleteAccountItem(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return accountItemService.checkIsNameExist(id, name);
|
return accountItemService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package com.jsh.erp.service.accountItem;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
|
import com.jsh.erp.datasource.entities.AccountHead;
|
||||||
import com.jsh.erp.datasource.entities.AccountItem;
|
import com.jsh.erp.datasource.entities.AccountItem;
|
||||||
import com.jsh.erp.datasource.entities.AccountItemExample;
|
import com.jsh.erp.datasource.entities.AccountItemExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.AccountItemMapper;
|
import com.jsh.erp.datasource.mappers.AccountItemMapper;
|
||||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.ErpInfo;
|
import com.jsh.erp.utils.ErpInfo;
|
||||||
@@ -43,72 +46,179 @@ public class AccountItemService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
public AccountItem getAccountItem(long id) {
|
public AccountItem getAccountItem(long id)throws Exception {
|
||||||
return accountItemMapper.selectByPrimaryKey(id);
|
AccountItem result=null;
|
||||||
|
try{
|
||||||
|
result=accountItemMapper.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<AccountItem> getAccountItem() {
|
public List<AccountItem> getAccountItem()throws Exception {
|
||||||
AccountItemExample example = new AccountItemExample();
|
AccountItemExample example = new AccountItemExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return accountItemMapper.selectByExample(example);
|
List<AccountItem> list=null;
|
||||||
|
try{
|
||||||
|
list=accountItemMapper.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<AccountItem> select(String name, Integer type, String remark, int offset, int rows) {
|
public List<AccountItem> select(String name, Integer type, String remark, int offset, int rows)throws Exception {
|
||||||
return accountItemMapperEx.selectByConditionAccountItem(name, type, remark, offset, rows);
|
List<AccountItem> list=null;
|
||||||
|
try{
|
||||||
|
list = accountItemMapperEx.selectByConditionAccountItem(name, type, remark, 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 countAccountItem(String name, Integer type, String remark) {
|
public Long countAccountItem(String name, Integer type, String remark)throws Exception {
|
||||||
return accountItemMapperEx.countsByAccountItem(name, type, remark);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result = accountItemMapperEx.countsByAccountItem(name, type, remark);
|
||||||
|
}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 insertAccountItem(String beanJson, HttpServletRequest request) {
|
public int insertAccountItem(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
||||||
return accountItemMapper.insertSelective(accountItem);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.insertSelective(accountItem);
|
||||||
|
}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 updateAccountItem(String beanJson, Long id) {
|
public int updateAccountItem(String beanJson, Long id)throws Exception {
|
||||||
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
||||||
accountItem.setId(id);
|
accountItem.setId(id);
|
||||||
return accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
||||||
|
}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 deleteAccountItem(Long id) {
|
public int deleteAccountItem(Long id)throws Exception {
|
||||||
return accountItemMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.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 batchDeleteAccountItem(String ids) {
|
public int batchDeleteAccountItem(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AccountItemExample example = new AccountItemExample();
|
AccountItemExample example = new AccountItemExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return accountItemMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.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 {
|
||||||
AccountItemExample example = new AccountItemExample();
|
AccountItemExample example = new AccountItemExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<AccountItem> list = accountItemMapper.selectByExample(example);
|
List<AccountItem> list = null;
|
||||||
return list.size();
|
try{
|
||||||
|
list = accountItemMapper.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)
|
||||||
public int insertAccountItemWithObj(AccountItem accountItem) {
|
public int insertAccountItemWithObj(AccountItem accountItem)throws Exception {
|
||||||
return accountItemMapper.insertSelective(accountItem);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.insertSelective(accountItem);
|
||||||
|
}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 updateAccountItemWithObj(AccountItem accountItem) {
|
public int updateAccountItemWithObj(AccountItem accountItem)throws Exception {
|
||||||
return accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
||||||
|
}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<AccountItemVo4List> getDetailList(Long headerId) {
|
public List<AccountItemVo4List> getDetailList(Long headerId) {
|
||||||
return accountItemMapperEx.getDetailList(headerId);
|
List<AccountItemVo4List> list=null;
|
||||||
|
try{
|
||||||
|
list = accountItemMapperEx.getDetailList(headerId);
|
||||||
|
}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 String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws DataAccessException {
|
public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -181,12 +291,21 @@ public class AccountItemService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAccountItemByIds(String ids) {
|
public int batchDeleteAccountItemByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 accountItemMapperEx.batchDeleteAccountItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountItemMapperEx.batchDeleteAccountItemByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class AppComponent implements ICommonQuery {
|
|||||||
private AppService appService;
|
private AppService appService;
|
||||||
|
|
||||||
@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 getAppList(map);
|
return getAppList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getAppList(Map<String, String> map) {
|
private List<?> getAppList(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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -37,7 +37,7 @@ public class AppComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -45,27 +45,27 @@ public class AppComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return appService.insertApp(beanJson, request);
|
return appService.insertApp(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return appService.updateApp(beanJson, id);
|
return appService.updateApp(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return appService.deleteApp(id);
|
return appService.deleteApp(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return appService.batchDeleteApp(ids);
|
return appService.batchDeleteApp(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package com.jsh.erp.service.app;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.App;
|
import com.jsh.erp.datasource.entities.App;
|
||||||
import com.jsh.erp.datasource.entities.AppExample;
|
import com.jsh.erp.datasource.entities.AppExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
import com.jsh.erp.datasource.entities.UserBusiness;
|
||||||
import com.jsh.erp.datasource.mappers.AppMapper;
|
import com.jsh.erp.datasource.mappers.AppMapper;
|
||||||
import com.jsh.erp.datasource.mappers.AppMapperEx;
|
import com.jsh.erp.datasource.mappers.AppMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||||
@@ -40,11 +42,19 @@ public class AppService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
public List<App> findDock(){
|
public List<App> findDock()throws Exception{
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<App> list = appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -55,86 +65,191 @@ public class AppService {
|
|||||||
* @Param: null
|
* @Param: null
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<App> findDesk(){
|
public List<App> findDesk()throws Exception{
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<App> list = appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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 App getApp(long id) {
|
public App getApp(long id)throws Exception {
|
||||||
return appMapper.selectByPrimaryKey(id);
|
App result=null;
|
||||||
|
try{
|
||||||
|
result=appMapper.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<App> getApp() {
|
public List<App> getApp()throws Exception {
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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<App> select(String name, String type, int offset, int rows) {
|
public List<App> select(String name, String type, int offset, int rows)throws Exception {
|
||||||
return appMapperEx.selectByConditionApp(name, type, offset, rows);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapperEx.selectByConditionApp(name, type, 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 countApp(String name, String type) {
|
public Long countApp(String name, String type)throws Exception {
|
||||||
return appMapperEx.countsByApp(name, type);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=appMapperEx.countsByApp(name, type);
|
||||||
|
}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 insertApp(String beanJson, HttpServletRequest request) {
|
public int insertApp(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
App app = JSONObject.parseObject(beanJson, App.class);
|
App app = JSONObject.parseObject(beanJson, App.class);
|
||||||
return appMapper.insertSelective(app);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=appMapper.insertSelective(app);
|
||||||
|
}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 updateApp(String beanJson, Long id) {
|
public int updateApp(String beanJson, Long id) throws Exception{
|
||||||
App app = JSONObject.parseObject(beanJson, App.class);
|
App app = JSONObject.parseObject(beanJson, App.class);
|
||||||
app.setId(id);
|
app.setId(id);
|
||||||
return appMapper.updateByPrimaryKeySelective(app);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=appMapper.updateByPrimaryKeySelective(app);
|
||||||
|
}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 deleteApp(Long id) {
|
public int deleteApp(Long id)throws Exception {
|
||||||
return appMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=appMapper.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 batchDeleteApp(String ids) {
|
public int batchDeleteApp(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return appMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=appMapper.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 List<App> findRoleAPP(){
|
public List<App> findRoleAPP()throws Exception{
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<App> list = appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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<App> findAppInIds(String ids, String type){
|
public List<App> findAppInIds(String ids, String type)throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList)
|
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<App> list = appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAppByIds(String ids) {
|
public int batchDeleteAppByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_APP,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_APP,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 appMapperEx.batchDeleteAppByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=appMapperEx.batchDeleteAppByIds(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<App> findAppByUserId(String userId) {
|
public List<App> findAppByUserId(String userId)throws Exception {
|
||||||
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
|
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
|
||||||
String roles = null;
|
String roles = null;
|
||||||
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
|
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
|
||||||
@@ -162,10 +277,19 @@ public class AppService {
|
|||||||
* @param numberList
|
* @param numberList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<App> findAppByNumber(List<String> numberList) {
|
public List<App> findAppByNumber(List<String> numberList) throws Exception{
|
||||||
|
|
||||||
AppExample example = new AppExample();
|
AppExample example = new AppExample();
|
||||||
example.createCriteria().andEnabledEqualTo(true).andNumberIn(numberList);
|
example.createCriteria().andEnabledEqualTo(true).andNumberIn(numberList);
|
||||||
return appMapper.selectByExample(example);
|
List<App> list=null;
|
||||||
|
try{
|
||||||
|
list=appMapper.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ public class DepotComponent implements ICommonQuery {
|
|||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
|
|
||||||
@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 getDepotList(map);
|
return getDepotList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getDepotList(Map<String, String> map) {
|
private List<?> getDepotList(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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -39,7 +39,7 @@ public class DepotComponent 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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -48,27 +48,27 @@ public class DepotComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return depotService.insertDepot(beanJson, request);
|
return depotService.insertDepot(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return depotService.updateDepot(beanJson, id);
|
return depotService.updateDepot(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return depotService.deleteDepot(id);
|
return depotService.deleteDepot(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return depotService.batchDeleteDepot(ids);
|
return depotService.batchDeleteDepot(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return depotService.checkIsNameExist(id, name);
|
return depotService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,91 +41,214 @@ public class DepotService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DepotItemMapperEx depotItemMapperEx;
|
private DepotItemMapperEx depotItemMapperEx;
|
||||||
|
|
||||||
public Depot getDepot(long id) {
|
public Depot getDepot(long id)throws Exception {
|
||||||
return depotMapper.selectByPrimaryKey(id);
|
Depot result=null;
|
||||||
|
try{
|
||||||
|
result=depotMapper.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<Depot> getDepot() {
|
public List<Depot> getDepot()throws Exception {
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return depotMapper.selectByExample(example);
|
List<Depot> list=null;
|
||||||
|
try{
|
||||||
|
list=depotMapper.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<Depot> getAllList() {
|
public List<Depot> getAllList()throws Exception {
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("sort");
|
example.setOrderByClause("sort");
|
||||||
return depotMapper.selectByExample(example);
|
List<Depot> list=null;
|
||||||
|
try{
|
||||||
|
list=depotMapper.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<Depot> select(String name, Integer type, String remark, int offset, int rows) {
|
public List<Depot> select(String name, Integer type, String remark, int offset, int rows)throws Exception {
|
||||||
return depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows);
|
List<Depot> list=null;
|
||||||
|
try{
|
||||||
|
list=depotMapperEx.selectByConditionDepot(name, type, remark, 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 countDepot(String name, Integer type, String remark) {
|
public Long countDepot(String name, Integer type, String remark)throws Exception {
|
||||||
return depotMapperEx.countsByDepot(name, type, remark);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=depotMapperEx.countsByDepot(name, type, remark);
|
||||||
|
}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 insertDepot(String beanJson, HttpServletRequest request) {
|
public int insertDepot(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
||||||
return depotMapper.insertSelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=depotMapper.insertSelective(depot);
|
||||||
|
}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 updateDepot(String beanJson, Long id) {
|
public int updateDepot(String beanJson, Long id) throws Exception{
|
||||||
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
||||||
depot.setId(id);
|
depot.setId(id);
|
||||||
return depotMapper.updateByPrimaryKeySelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= depotMapper.updateByPrimaryKeySelective(depot);
|
||||||
|
}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 deleteDepot(Long id) {
|
public int deleteDepot(Long id)throws Exception {
|
||||||
return depotMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= depotMapper.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 batchDeleteDepot(String ids) {
|
public int batchDeleteDepot(String ids) throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return depotMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= depotMapper.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 {
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Depot> list = depotMapper.selectByExample(example);
|
List<Depot> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list= depotMapper.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 List<Depot> findUserDepot(){
|
public List<Depot> findUserDepot()throws Exception{
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andTypeEqualTo(0).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andTypeEqualTo(0).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<Depot> list = depotMapper.selectByExample(example);
|
List<Depot> list=null;
|
||||||
|
try{
|
||||||
|
list= depotMapper.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<Depot> findGiftByType(Integer type){
|
public List<Depot> findGiftByType(Integer type)throws Exception{
|
||||||
DepotExample example = new DepotExample();
|
DepotExample example = new DepotExample();
|
||||||
example.createCriteria().andTypeEqualTo(type);
|
example.createCriteria().andTypeEqualTo(type);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<Depot> list = depotMapper.selectByExample(example);
|
List<Depot> list=null;
|
||||||
|
try{
|
||||||
|
list= depotMapper.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<DepotEx> getDepotList(Map<String, Object> parameterMap) {
|
public List<DepotEx> getDepotList(Map<String, Object> parameterMap)throws Exception {
|
||||||
return depotMapperEx.getDepotList(parameterMap);
|
List<DepotEx> list=null;
|
||||||
|
try{
|
||||||
|
list= depotMapperEx.getDepotList(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 batchDeleteDepotByIds(String ids) {
|
public int batchDeleteDepotByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= depotMapperEx.batchDeleteDepotByIds(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
|
||||||
@@ -153,7 +276,15 @@ public class DepotService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据主表 jsh_depothead
|
* 校验单据主表 jsh_depothead
|
||||||
* */
|
* */
|
||||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByDepotIds(idArray);
|
List<DepotHead> depotHeadList=null;
|
||||||
|
try{
|
||||||
|
depotHeadList= depotHeadMapperEx.getDepotHeadListByDepotIds(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("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -163,7 +294,15 @@ public class DepotService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据子表 jsh_depotitem
|
* 校验单据子表 jsh_depotitem
|
||||||
* */
|
* */
|
||||||
List<DepotItem> depotItemList=depotItemMapperEx.getDepotItemListListByDepotIds(idArray);
|
List<DepotItem> depotItemList=null;
|
||||||
|
try{
|
||||||
|
depotItemList= depotItemMapperEx.getDepotItemListListByDepotIds(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("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class DepotHeadComponent implements ICommonQuery {
|
|||||||
private DepotHeadService depotHeadService;
|
private DepotHeadService depotHeadService;
|
||||||
|
|
||||||
@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 getDepotHeadList(map);
|
return getDepotHeadList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getDepotHeadList(Map<String, String> map) {
|
private List<?> getDepotHeadList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
String subType = StringUtil.getInfo(search, "subType");
|
String subType = StringUtil.getInfo(search, "subType");
|
||||||
@@ -41,7 +41,7 @@ public class DepotHeadComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
String subType = StringUtil.getInfo(search, "subType");
|
String subType = StringUtil.getInfo(search, "subType");
|
||||||
@@ -53,27 +53,27 @@ public class DepotHeadComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return depotHeadService.insertDepotHead(beanJson, request);
|
return depotHeadService.insertDepotHead(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return depotHeadService.updateDepotHead(beanJson, id);
|
return depotHeadService.updateDepotHead(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return depotHeadService.deleteDepotHead(id);
|
return depotHeadService.deleteDepotHead(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return depotHeadService.batchDeleteDepotHead(ids);
|
return depotHeadService.batchDeleteDepotHead(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return depotHeadService.checkIsNameExist(id, name);
|
return depotHeadService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsh.erp.service.depotHead;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.DepotHead;
|
import com.jsh.erp.datasource.entities.DepotHead;
|
||||||
import com.jsh.erp.datasource.entities.DepotHeadExample;
|
import com.jsh.erp.datasource.entities.DepotHeadExample;
|
||||||
import com.jsh.erp.datasource.entities.DepotItem;
|
import com.jsh.erp.datasource.entities.DepotItem;
|
||||||
@@ -13,6 +14,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
|
|||||||
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
|
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
|
||||||
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
||||||
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||||
@@ -58,19 +60,45 @@ public class DepotHeadService {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
|
|
||||||
public DepotHead getDepotHead(long id) {
|
public DepotHead getDepotHead(long id)throws Exception {
|
||||||
return depotHeadMapper.selectByPrimaryKey(id);
|
DepotHead result=null;
|
||||||
|
try{
|
||||||
|
result=depotHeadMapper.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<DepotHead> getDepotHead() {
|
public List<DepotHead> getDepotHead()throws Exception {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return depotHeadMapper.selectByExample(example);
|
List<DepotHead> list=null;
|
||||||
|
try{
|
||||||
|
list=depotHeadMapper.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<DepotHeadVo4List> select(String type, String subType, String number, String beginTime, String endTime, String dhIds, int offset, int rows) {
|
public List<DepotHeadVo4List> select(String type, String subType, String number, String beginTime, String endTime, String dhIds, int offset, int rows)throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
||||||
List<DepotHeadVo4List> list = depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, dhIds, offset, rows);
|
List<DepotHeadVo4List> list=null;
|
||||||
|
try{
|
||||||
|
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, dhIds, 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 (DepotHeadVo4List dh : list) {
|
for (DepotHeadVo4List dh : list) {
|
||||||
if(dh.getOthermoneylist() != null) {
|
if(dh.getOthermoneylist() != null) {
|
||||||
@@ -97,12 +125,21 @@ public class DepotHeadService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Long countDepotHead(String type, String subType, String number, String beginTime, String endTime, String dhIds) {
|
public Long countDepotHead(String type, String subType, String number, String beginTime, String endTime, String dhIds) throws Exception{
|
||||||
return depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
|
||||||
|
}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 insertDepotHead(String beanJson, HttpServletRequest request) {
|
public int insertDepotHead(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||||
//判断用户是否已经登录过,登录过不再处理
|
//判断用户是否已经登录过,登录过不再处理
|
||||||
Object userInfo = request.getSession().getAttribute("user");
|
Object userInfo = request.getSession().getAttribute("user");
|
||||||
@@ -113,42 +150,94 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
||||||
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
||||||
return depotHeadMapper.insert(depotHead);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=depotHeadMapper.insert(depotHead);
|
||||||
|
}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 updateDepotHead(String beanJson, Long id) {
|
public int updateDepotHead(String beanJson, Long id) throws Exception{
|
||||||
DepotHead dh = depotHeadMapper.selectByPrimaryKey(id);
|
DepotHead dh=null;
|
||||||
|
try{
|
||||||
|
dh = depotHeadMapper.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);
|
||||||
|
}
|
||||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||||
depotHead.setId(id);
|
depotHead.setId(id);
|
||||||
depotHead.setStatus(dh.getStatus());
|
depotHead.setStatus(dh.getStatus());
|
||||||
depotHead.setCreatetime(dh.getCreatetime());
|
depotHead.setCreatetime(dh.getCreatetime());
|
||||||
depotHead.setOperpersonname(dh.getOperpersonname());
|
depotHead.setOperpersonname(dh.getOperpersonname());
|
||||||
return depotHeadMapper.updateByPrimaryKey(depotHead);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapper.updateByPrimaryKey(depotHead);
|
||||||
|
}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 deleteDepotHead(Long id) {
|
public int deleteDepotHead(Long id)throws Exception {
|
||||||
return depotHeadMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapper.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 batchDeleteDepotHead(String ids) {
|
public int batchDeleteDepotHead(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return depotHeadMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapper.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 {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<DepotHead> list = depotHeadMapper.selectByExample(example);
|
List<DepotHead> list = null;
|
||||||
return list.size();
|
try{
|
||||||
|
list = depotHeadMapper.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)
|
||||||
public int batchSetStatus(String status, String depotHeadIDs) {
|
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -157,15 +246,32 @@ public class DepotHeadService {
|
|||||||
depotHead.setStatus(status);
|
depotHead.setStatus(status);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
example.createCriteria().andIdIn(ids);
|
example.createCriteria().andIdIn(ids);
|
||||||
return depotHeadMapper.updateByExampleSelective(depotHead, example);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapper.updateByExampleSelective(depotHead, 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 String buildOnlyNumber(){
|
public String buildOnlyNumber()throws Exception{
|
||||||
Long buildOnlyNumber=null;
|
Long buildOnlyNumber=null;
|
||||||
synchronized (this){
|
synchronized (this){
|
||||||
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
|
try{
|
||||||
|
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
|
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
|
||||||
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
|
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
|
||||||
@@ -179,68 +285,174 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getMaxId() {
|
public Long getMaxId()throws Exception {
|
||||||
return depotHeadMapperEx.getMaxId();
|
Long result = null;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapperEx.getMaxId();
|
||||||
|
}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 findMaterialsListByHeaderId(Long id) {
|
public String findMaterialsListByHeaderId(Long id)throws Exception {
|
||||||
String allReturn = depotHeadMapperEx.findMaterialsListByHeaderId(id);
|
String result = null;
|
||||||
return allReturn;
|
try{
|
||||||
|
result = depotHeadMapperEx.findMaterialsListByHeaderId(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<DepotHead> findByMonth(String monthTime) {
|
public List<DepotHead> findByMonth(String monthTime)throws Exception {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
monthTime = monthTime + "-31 23:59:59";
|
monthTime = monthTime + "-31 23:59:59";
|
||||||
Date month = StringUtil.getDateByString(monthTime, null);
|
Date month = StringUtil.getDateByString(monthTime, null);
|
||||||
example.createCriteria().andOpertimeLessThanOrEqualTo(month).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andOpertimeLessThanOrEqualTo(month).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return depotHeadMapper.selectByExample(example);
|
List<DepotHead> list = null;
|
||||||
|
try{
|
||||||
|
list = depotHeadMapper.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<DepotHead> getDepotHeadGiftOut(String projectId) {
|
public List<DepotHead> getDepotHeadGiftOut(String projectId)throws Exception {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
if (projectId != null) {
|
if (projectId != null) {
|
||||||
example.createCriteria().andProjectidEqualTo(Long.parseLong(projectId));
|
example.createCriteria().andProjectidEqualTo(Long.parseLong(projectId));
|
||||||
}
|
}
|
||||||
return depotHeadMapper.selectByExample(example);
|
List<DepotHead> list = null;
|
||||||
|
try{
|
||||||
|
list =depotHeadMapper.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<DepotHeadVo4InDetail> findByAll(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows) {
|
public List<DepotHeadVo4InDetail> findByAll(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows) throws Exception{
|
||||||
return depotHeadMapperEx.findByAll(beginTime, endTime, type, pid, dids, oId, offset, rows);
|
List<DepotHeadVo4InDetail> list = null;
|
||||||
|
try{
|
||||||
|
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, pid, dids, oId, 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 int findByAllCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) {
|
public int findByAllCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) throws Exception{
|
||||||
return depotHeadMapperEx.findByAllCount(beginTime, endTime, type, pid, dids, oId);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, pid, dids, oId);
|
||||||
|
}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<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows) {
|
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows)throws Exception {
|
||||||
return depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, offset, rows);
|
List<DepotHeadVo4InOutMCount> list = null;
|
||||||
|
try{
|
||||||
|
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, 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 int findInOutMaterialCountTotal(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) {
|
public int findInOutMaterialCountTotal(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId)throws Exception {
|
||||||
return depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
|
||||||
|
}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<DepotHeadVo4StatementAccount> findStatementAccount(String beginTime, String endTime, Integer organId, String supType, Integer offset, Integer rows) {
|
public List<DepotHeadVo4StatementAccount> findStatementAccount(String beginTime, String endTime, Integer organId, String supType, Integer offset, Integer rows)throws Exception {
|
||||||
return depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, offset, rows);
|
List<DepotHeadVo4StatementAccount> list = null;
|
||||||
|
try{
|
||||||
|
list =depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, 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 int findStatementAccountCount(String beginTime, String endTime, Integer organId, String supType) {
|
public int findStatementAccountCount(String beginTime, String endTime, Integer organId, String supType) throws Exception{
|
||||||
return depotHeadMapperEx.findStatementAccountCount(beginTime, endTime, organId, supType);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result =depotHeadMapperEx.findStatementAccountCount(beginTime, endTime, organId, supType);
|
||||||
|
}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 BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime) {
|
public BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime)throws Exception {
|
||||||
String modeName = "";
|
String modeName = "";
|
||||||
if (mode.equals("实际")) {
|
if (mode.equals("实际")) {
|
||||||
modeName = "ChangeAmount";
|
modeName = "ChangeAmount";
|
||||||
} else if (mode.equals("合计")) {
|
} else if (mode.equals("合计")) {
|
||||||
modeName = "DiscountLastMoney";
|
modeName = "DiscountLastMoney";
|
||||||
}
|
}
|
||||||
return depotHeadMapperEx.findAllMoney(supplierId, type, subType, modeName, endTime);
|
BigDecimal result = null;
|
||||||
|
try{
|
||||||
|
result =depotHeadMapperEx.findAllMoney(supplierId, type, subType, modeName, endTime);
|
||||||
|
}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<DepotHeadVo4List> getDetailByNumber(String number) {
|
public List<DepotHeadVo4List> getDetailByNumber(String number)throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
||||||
List<DepotHeadVo4List> list = depotHeadMapperEx.getDetailByNumber(number);
|
List<DepotHeadVo4List> list = null;
|
||||||
|
try{
|
||||||
|
list = depotHeadMapperEx.getDetailByNumber(number);
|
||||||
|
}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 (DepotHeadVo4List dh : list) {
|
for (DepotHeadVo4List dh : list) {
|
||||||
if(dh.getOthermoneylist() != null) {
|
if(dh.getOthermoneylist() != null) {
|
||||||
@@ -288,7 +500,15 @@ public class DepotHeadService {
|
|||||||
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
||||||
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
||||||
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
||||||
depotHeadMapperEx.adddepotHead(depotHead);
|
try{
|
||||||
|
depotHeadMapperEx.adddepotHead(depotHead);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
|
||||||
/**入库和出库处理预付款信息*/
|
/**入库和出库处理预付款信息*/
|
||||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
||||||
if(depotHead.getOrganid()!=null) {
|
if(depotHead.getOrganid()!=null) {
|
||||||
@@ -303,7 +523,14 @@ public class DepotHeadService {
|
|||||||
depotHeadOrders.setStatus(BusinessConstants.BILLS_STATUS_SKIP);
|
depotHeadOrders.setStatus(BusinessConstants.BILLS_STATUS_SKIP);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
example.createCriteria().andNumberEqualTo(depotHead.getLinknumber());
|
example.createCriteria().andNumberEqualTo(depotHead.getLinknumber());
|
||||||
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
try{
|
||||||
|
depotHeadMapper.updateByExampleSelective(depotHeadOrders, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +558,14 @@ public class DepotHeadService {
|
|||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
||||||
depotHead.setOpertime(new Timestamp(System.currentTimeMillis()));
|
depotHead.setOpertime(new Timestamp(System.currentTimeMillis()));
|
||||||
depotHeadMapperEx.updatedepotHead(depotHead);
|
try{
|
||||||
|
depotHeadMapperEx.updatedepotHead(depotHead);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
/**入库和出库处理预付款信息*/
|
/**入库和出库处理预付款信息*/
|
||||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
||||||
if(depotHead.getOrganid()!=null){
|
if(depotHead.getOrganid()!=null){
|
||||||
@@ -362,7 +596,16 @@ public class DepotHeadService {
|
|||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||||
//查询单据子表列表
|
//查询单据子表列表
|
||||||
List<DepotItem> depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
|
List<DepotItem> depotItemList=null;
|
||||||
|
try{
|
||||||
|
depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
|
||||||
|
}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){
|
||||||
for(DepotItem depotItem:depotItemList){
|
for(DepotItem depotItem:depotItemList){
|
||||||
@@ -372,7 +615,15 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**删除单据子表数据*/
|
/**删除单据子表数据*/
|
||||||
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{id});
|
try{
|
||||||
|
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{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);
|
||||||
|
}
|
||||||
|
|
||||||
/**删除单据主表信息*/
|
/**删除单据主表信息*/
|
||||||
batchDeleteDepotHeadByIds(id.toString());
|
batchDeleteDepotHeadByIds(id.toString());
|
||||||
}
|
}
|
||||||
@@ -397,12 +648,21 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteDepotHeadByIds(String ids) {
|
public int batchDeleteDepotHeadByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 depotHeadMapperEx.batchDeleteDepotHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapperEx.batchDeleteDepotHeadByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class DepotItemComponent implements ICommonQuery {
|
|||||||
private DepotItemService depotItemService;
|
private DepotItemService depotItemService;
|
||||||
|
|
||||||
@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 getDepotItemList(map);
|
return getDepotItemList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getDepotItemList(Map<String, String> map) {
|
private List<?> getDepotItemList(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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -38,7 +38,7 @@ public class DepotItemComponent 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");
|
||||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||||
@@ -47,27 +47,27 @@ public class DepotItemComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return depotItemService.insertDepotItem(beanJson, request);
|
return depotItemService.insertDepotItem(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return depotItemService.updateDepotItem(beanJson, id);
|
return depotItemService.updateDepotItem(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return depotItemService.deleteDepotItem(id);
|
return depotItemService.deleteDepotItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return depotItemService.batchDeleteDepotItem(ids);
|
return depotItemService.batchDeleteDepotItem(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return depotItemService.checkIsNameExist(id, name);
|
return depotItemService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,175 +60,394 @@ public class DepotItemService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
public DepotItem getDepotItem(long id) {
|
public DepotItem getDepotItem(long id)throws Exception {
|
||||||
return depotItemMapper.selectByPrimaryKey(id);
|
DepotItem result=null;
|
||||||
|
try{
|
||||||
|
result=depotItemMapper.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<DepotItem> getDepotItem() {
|
public List<DepotItem> getDepotItem()throws Exception {
|
||||||
DepotItemExample example = new DepotItemExample();
|
DepotItemExample example = new DepotItemExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return depotItemMapper.selectByExample(example);
|
List<DepotItem> list=null;
|
||||||
|
try{
|
||||||
|
list=depotItemMapper.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<DepotItem> select(String name, Integer type, String remark, int offset, int rows) {
|
public List<DepotItem> select(String name, Integer type, String remark, int offset, int rows)throws Exception {
|
||||||
return depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
|
List<DepotItem> list=null;
|
||||||
|
try{
|
||||||
|
list=depotItemMapperEx.selectByConditionDepotItem(name, type, remark, 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 countDepotItem(String name, Integer type, String remark) {
|
public Long countDepotItem(String name, Integer type, String remark) throws Exception{
|
||||||
return depotItemMapperEx.countsByDepotItem(name, type, remark);
|
Long result =null;
|
||||||
|
try{
|
||||||
|
result=depotItemMapperEx.countsByDepotItem(name, type, remark);
|
||||||
|
}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 insertDepotItem(String beanJson, HttpServletRequest request) {
|
public int insertDepotItem(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
||||||
return depotItemMapper.insertSelective(depotItem);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result=depotItemMapper.insertSelective(depotItem);
|
||||||
|
}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 updateDepotItem(String beanJson, Long id) {
|
public int updateDepotItem(String beanJson, Long id)throws Exception {
|
||||||
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
||||||
depotItem.setId(id);
|
depotItem.setId(id);
|
||||||
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||||
|
}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 deleteDepotItem(Long id) {
|
public int deleteDepotItem(Long id)throws Exception {
|
||||||
return depotItemMapper.deleteByPrimaryKey(id);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result=depotItemMapper.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 batchDeleteDepotItem(String ids) {
|
public int batchDeleteDepotItem(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
DepotItemExample example = new DepotItemExample();
|
DepotItemExample example = new DepotItemExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return depotItemMapper.deleteByExample(example);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result=depotItemMapper.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 {
|
||||||
DepotItemExample example = new DepotItemExample();
|
DepotItemExample example = new DepotItemExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<DepotItem> list = depotItemMapper.selectByExample(example);
|
List<DepotItem> list =null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=depotItemMapper.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 List<DepotItemVo4HeaderId> getHeaderIdByMaterial(String materialParam, String depotIds) {
|
public List<DepotItemVo4HeaderId> getHeaderIdByMaterial(String materialParam, String depotIds)throws Exception {
|
||||||
return depotItemMapperEx.getHeaderIdByMaterial(materialParam, depotIds);
|
List<DepotItemVo4HeaderId> list =null;
|
||||||
|
try{
|
||||||
|
list = depotItemMapperEx.getHeaderIdByMaterial(materialParam, depotIds);
|
||||||
|
}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<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> map) {
|
public List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> map)throws Exception {
|
||||||
String mIdStr = map.get("mId");
|
String mIdStr = map.get("mId");
|
||||||
Long mId = null;
|
Long mId = null;
|
||||||
if(!StringUtil.isEmpty(mIdStr)) {
|
if(!StringUtil.isEmpty(mIdStr)) {
|
||||||
mId = Long.parseLong(mIdStr);
|
mId = Long.parseLong(mIdStr);
|
||||||
}
|
}
|
||||||
return depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
|
List<DepotItemVo4DetailByTypeAndMId> list =null;
|
||||||
|
try{
|
||||||
|
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||||
|
}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 findDetailByTypeAndMaterialIdCounts(Map<String, String> map) {
|
public Long findDetailByTypeAndMaterialIdCounts(Map<String, String> map)throws Exception {
|
||||||
String mIdStr = map.get("mId");
|
String mIdStr = map.get("mId");
|
||||||
Long mId = null;
|
Long mId = null;
|
||||||
if(!StringUtil.isEmpty(mIdStr)) {
|
if(!StringUtil.isEmpty(mIdStr)) {
|
||||||
mId = Long.parseLong(mIdStr);
|
mId = Long.parseLong(mIdStr);
|
||||||
}
|
}
|
||||||
return depotItemMapperEx.findDetailByTypeAndMaterialIdCounts(mId);
|
Long result =null;
|
||||||
|
try{
|
||||||
|
result = depotItemMapperEx.findDetailByTypeAndMaterialIdCounts(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<DepotItemVo4Material> findStockNumByMaterialIdList(Map<String, String> map) {
|
public List<DepotItemVo4Material> findStockNumByMaterialIdList(Map<String, String> map)throws Exception {
|
||||||
String mIdStr = map.get("mId");
|
String mIdStr = map.get("mId");
|
||||||
Long mId = null;
|
Long mId = null;
|
||||||
if(!StringUtil.isEmpty(mIdStr)) {
|
if(!StringUtil.isEmpty(mIdStr)) {
|
||||||
mId = Long.parseLong(mIdStr);
|
mId = Long.parseLong(mIdStr);
|
||||||
}
|
}
|
||||||
String monthTime = map.get("monthTime");
|
String monthTime = map.get("monthTime");
|
||||||
return depotItemMapperEx.findStockNumByMaterialIdList(mId, monthTime, QueryUtils.offset(map), QueryUtils.rows(map));
|
List<DepotItemVo4Material> list =null;
|
||||||
|
try{
|
||||||
|
list = depotItemMapperEx.findStockNumByMaterialIdList(mId, monthTime, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||||
|
}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 findStockNumByMaterialIdCounts(Map<String, String> map) {
|
public Long findStockNumByMaterialIdCounts(Map<String, String> map)throws Exception {
|
||||||
String mIdStr = map.get("mId");
|
String mIdStr = map.get("mId");
|
||||||
Long mId = null;
|
Long mId = null;
|
||||||
if(!StringUtil.isEmpty(mIdStr)) {
|
if(!StringUtil.isEmpty(mIdStr)) {
|
||||||
mId = Long.parseLong(mIdStr);
|
mId = Long.parseLong(mIdStr);
|
||||||
}
|
}
|
||||||
String monthTime = map.get("monthTime");
|
String monthTime = map.get("monthTime");
|
||||||
return depotItemMapperEx.findStockNumByMaterialIdCounts(mId, monthTime);
|
Long result =null;
|
||||||
|
try{
|
||||||
|
result = depotItemMapperEx.findStockNumByMaterialIdCounts(mId, monthTime);
|
||||||
|
}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 insertDepotItemWithObj(DepotItem depotItem) {
|
public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
|
||||||
return depotItemMapper.insertSelective(depotItem);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result = depotItemMapper.insertSelective(depotItem);
|
||||||
|
}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 updateDepotItemWithObj(DepotItem depotItem) {
|
public int updateDepotItemWithObj(DepotItem depotItem)throws Exception {
|
||||||
|
int result =0;
|
||||||
|
try{
|
||||||
|
result = depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||||
|
}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 depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findByTypeAndMaterialId(String type, Long mId) {
|
public int findByTypeAndMaterialId(String type, Long mId) throws Exception{
|
||||||
if(type.equals(TYPE)) {
|
int result =0;
|
||||||
return depotItemMapperEx.findByTypeAndMaterialIdIn(mId);
|
try{
|
||||||
} else {
|
if(type.equals(TYPE)) {
|
||||||
return depotItemMapperEx.findByTypeAndMaterialIdOut(mId);
|
result= depotItemMapperEx.findByTypeAndMaterialIdIn(mId);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId) {
|
|
||||||
return depotItemMapperEx.getDetailList(headerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DepotItemVo4WithInfoEx> findByAll(String headIds, String materialIds, Integer offset, Integer rows) {
|
|
||||||
return depotItemMapperEx.findByAll(headIds, materialIds, offset, rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int findByAllCount(String headIds, String materialIds) {
|
|
||||||
return depotItemMapperEx.findByAllCount(headIds, materialIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal findByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
|
||||||
if (TYPE.equals(type)) {
|
|
||||||
if (isPrev) {
|
|
||||||
return depotItemMapperEx.findByTypeInIsPrev(ProjectId, MId, MonthTime);
|
|
||||||
} else {
|
} else {
|
||||||
return depotItemMapperEx.findByTypeInIsNotPrev(ProjectId, MId, MonthTime);
|
result= depotItemMapperEx.findByTypeAndMaterialIdOut(mId);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isPrev) {
|
|
||||||
return depotItemMapperEx.findByTypeOutIsPrev(ProjectId, MId, MonthTime);
|
|
||||||
} else {
|
|
||||||
return depotItemMapperEx.findByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
|
|
||||||
}
|
}
|
||||||
|
}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 BigDecimal findPriceByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
|
||||||
if (TYPE.equals(type)) {
|
List<DepotItemVo4WithInfoEx> list =null;
|
||||||
if (isPrev) {
|
try{
|
||||||
return depotItemMapperEx.findPriceByTypeInIsPrev(ProjectId, MId, MonthTime);
|
list = depotItemMapperEx.getDetailList(headerId);
|
||||||
} else {
|
}catch(Exception e){
|
||||||
return depotItemMapperEx.findPriceByTypeInIsNotPrev(ProjectId, MId, MonthTime);
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
}
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
} else {
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
if (isPrev) {
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
return depotItemMapperEx.findPriceByTypeOutIsPrev(ProjectId, MId, MonthTime);
|
|
||||||
} else {
|
|
||||||
return depotItemMapperEx.findPriceByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal findAssembleByType(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
public List<DepotItemVo4WithInfoEx> findByAll(String headIds, String materialIds, Integer offset, Integer rows)throws Exception {
|
||||||
if (isPrev) {
|
List<DepotItemVo4WithInfoEx> list =null;
|
||||||
return depotItemMapperEx.findAssembleIsPrev(subType, mType, ProjectId, MId, MonthTime);
|
try{
|
||||||
} else {
|
list = depotItemMapperEx.findByAll(headIds, materialIds, offset, rows);
|
||||||
return depotItemMapperEx.findAssembleIsNotPrev(subType, mType, ProjectId, MId, MonthTime);
|
}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 BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) {
|
public int findByAllCount(String headIds, String materialIds)throws Exception {
|
||||||
if (SUM_TYPE.equals(sumType)) {
|
int result=0;
|
||||||
return depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
|
try{
|
||||||
} else {
|
result = depotItemMapperEx.findByAllCount(headIds, materialIds);
|
||||||
return depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
|
}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 BigDecimal findByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
|
||||||
|
BigDecimal result=null;
|
||||||
|
try{
|
||||||
|
if (TYPE.equals(type)) {
|
||||||
|
if (isPrev) {
|
||||||
|
result= depotItemMapperEx.findByTypeInIsPrev(ProjectId, MId, MonthTime);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.findByTypeInIsNotPrev(ProjectId, MId, MonthTime);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isPrev) {
|
||||||
|
result= depotItemMapperEx.findByTypeOutIsPrev(ProjectId, MId, MonthTime);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.findByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}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 BigDecimal findPriceByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
|
||||||
|
BigDecimal result=null;
|
||||||
|
try{
|
||||||
|
if (TYPE.equals(type)) {
|
||||||
|
if (isPrev) {
|
||||||
|
result= depotItemMapperEx.findPriceByTypeInIsPrev(ProjectId, MId, MonthTime);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.findPriceByTypeInIsNotPrev(ProjectId, MId, MonthTime);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isPrev) {
|
||||||
|
result= depotItemMapperEx.findPriceByTypeOutIsPrev(ProjectId, MId, MonthTime);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.findPriceByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}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 BigDecimal findAssembleByType(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
|
||||||
|
BigDecimal result=null;
|
||||||
|
try{
|
||||||
|
if (isPrev) {
|
||||||
|
result= depotItemMapperEx.findAssembleIsPrev(subType, mType, ProjectId, MId, MonthTime);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.findAssembleIsNotPrev(subType, mType, ProjectId, MId, MonthTime);
|
||||||
|
}
|
||||||
|
}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 BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) throws Exception{
|
||||||
|
BigDecimal result=null;
|
||||||
|
try{
|
||||||
|
if (SUM_TYPE.equals(sumType)) {
|
||||||
|
result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
|
||||||
|
} else {
|
||||||
|
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
|
||||||
|
}
|
||||||
|
}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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,9 +460,16 @@ public class DepotItemService {
|
|||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
|
||||||
//查询单据主表信息
|
//查询单据主表信息
|
||||||
DepotHead depotHead=depotHeadMapper.selectByPrimaryKey(headerId);
|
DepotHead depotHead=null;
|
||||||
|
try{
|
||||||
|
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
//获得当前操作人
|
//获得当前操作人
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
//转为json
|
//转为json
|
||||||
@@ -275,8 +501,8 @@ public class DepotItemService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
||||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||||
new Date(),userInfo==null?null:userInfo.getId());
|
userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||||
@@ -416,8 +642,8 @@ public class DepotItemService {
|
|||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
* */
|
* */
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||||
new Date(), userInfo == null ? null : userInfo.getId());
|
userInfo);
|
||||||
}
|
}
|
||||||
/**收回序列号的时候释放库存*/
|
/**收回序列号的时候释放库存*/
|
||||||
depotItem.setOpernumber(BigDecimal.ZERO);
|
depotItem.setOpernumber(BigDecimal.ZERO);
|
||||||
@@ -525,7 +751,7 @@ public class DepotItemService {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String findUnitName(Long mId) {
|
public String findUnitName(Long mId) throws Exception{
|
||||||
String unitName = "";
|
String unitName = "";
|
||||||
try {
|
try {
|
||||||
unitName = materialService.findUnitName(mId);
|
unitName = materialService.findUnitName(mId);
|
||||||
@@ -544,7 +770,7 @@ public class DepotItemService {
|
|||||||
* 查询商品当前库存数量是否充足,
|
* 查询商品当前库存数量是否充足,
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
public int getCurrentInStock(Long materialId){
|
public int getCurrentInStock(Long materialId)throws Exception{
|
||||||
//入库数量
|
//入库数量
|
||||||
int inSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId);
|
int inSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId);
|
||||||
//出库数量
|
//出库数量
|
||||||
@@ -552,12 +778,21 @@ public class DepotItemService {
|
|||||||
return (inSum-outSum);
|
return (inSum-outSum);
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteDepotItemByIds(String ids) {
|
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result =depotItemMapperEx.batchDeleteDepotItemByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public class FunctionsComponent implements ICommonQuery {
|
|||||||
private FunctionsService functionsService;
|
private FunctionsService functionsService;
|
||||||
|
|
||||||
@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 getFunctionsList(map);
|
return getFunctionsList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getFunctionsList(Map<String, String> map) {
|
private List<?> getFunctionsList(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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -39,7 +39,7 @@ public class FunctionsComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -47,27 +47,27 @@ public class FunctionsComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return functionsService.insertFunctions(beanJson, request);
|
return functionsService.insertFunctions(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return functionsService.updateFunctions(beanJson, id);
|
return functionsService.updateFunctions(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return functionsService.deleteFunctions(id);
|
return functionsService.deleteFunctions(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return functionsService.batchDeleteFunctions(ids);
|
return functionsService.batchDeleteFunctions(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return functionsService.checkIsNameExist(id, name);
|
return functionsService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package com.jsh.erp.service.functions;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
|
import com.jsh.erp.datasource.entities.DepotItem;
|
||||||
import com.jsh.erp.datasource.entities.Functions;
|
import com.jsh.erp.datasource.entities.Functions;
|
||||||
import com.jsh.erp.datasource.entities.FunctionsExample;
|
import com.jsh.erp.datasource.entities.FunctionsExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.FunctionsMapper;
|
import com.jsh.erp.datasource.mappers.FunctionsMapper;
|
||||||
import com.jsh.erp.datasource.mappers.FunctionsMapperEx;
|
import com.jsh.erp.datasource.mappers.FunctionsMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -36,92 +39,205 @@ public class FunctionsService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
public Functions getFunctions(long id) {
|
public Functions getFunctions(long id)throws Exception {
|
||||||
return functionsMapper.selectByPrimaryKey(id);
|
Functions result=null;
|
||||||
|
try{
|
||||||
|
result=functionsMapper.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<Functions> getFunctions() {
|
public List<Functions> getFunctions()throws Exception {
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return functionsMapper.selectByExample(example);
|
List<Functions> list=null;
|
||||||
|
try{
|
||||||
|
list=functionsMapper.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<Functions> select(String name, String type, int offset, int rows) {
|
public List<Functions> select(String name, String type, int offset, int rows)throws Exception {
|
||||||
return functionsMapperEx.selectByConditionFunctions(name, type, offset, rows);
|
List<Functions> list=null;
|
||||||
|
try{
|
||||||
|
list=functionsMapperEx.selectByConditionFunctions(name, type, 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 countFunctions(String name, String type) {
|
public Long countFunctions(String name, String type)throws Exception {
|
||||||
return functionsMapperEx.countsByFunctions(name, type);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=functionsMapperEx.countsByFunctions(name, type);
|
||||||
|
}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 insertFunctions(String beanJson, HttpServletRequest request) {
|
public int insertFunctions(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
||||||
return functionsMapper.insertSelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=functionsMapper.insertSelective(depot);
|
||||||
|
}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 updateFunctions(String beanJson, Long id) {
|
public int updateFunctions(String beanJson, Long id) throws Exception{
|
||||||
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
||||||
depot.setId(id);
|
depot.setId(id);
|
||||||
return functionsMapper.updateByPrimaryKeySelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=functionsMapper.updateByPrimaryKeySelective(depot);
|
||||||
|
}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 deleteFunctions(Long id) {
|
public int deleteFunctions(Long id)throws Exception {
|
||||||
return functionsMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=functionsMapper.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 batchDeleteFunctions(String ids) {
|
public int batchDeleteFunctions(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return functionsMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=functionsMapper.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 {
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Functions> list = functionsMapper.selectByExample(example);
|
List<Functions> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list = functionsMapper.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 List<Functions> getRoleFunctions(String pNumber) {
|
public List<Functions> getRoleFunctions(String pNumber)throws Exception {
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pNumber)
|
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pNumber)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<Functions> list = functionsMapper.selectByExample(example);
|
List<Functions> list=null;
|
||||||
|
try{
|
||||||
|
list = functionsMapper.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<Functions> findRoleFunctions(String pnumber){
|
public List<Functions> findRoleFunctions(String pnumber)throws Exception{
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pnumber)
|
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pnumber)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort");
|
example.setOrderByClause("Sort");
|
||||||
List<Functions> list = functionsMapper.selectByExample(example);
|
List<Functions> list=null;
|
||||||
|
try{
|
||||||
|
list =functionsMapper.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<Functions> findByIds(String functionsIds){
|
public List<Functions> findByIds(String functionsIds)throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(functionsIds);
|
List<Long> idList = StringUtil.strToLongList(functionsIds);
|
||||||
FunctionsExample example = new FunctionsExample();
|
FunctionsExample example = new FunctionsExample();
|
||||||
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList)
|
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Sort asc");
|
example.setOrderByClause("Sort asc");
|
||||||
List<Functions> list = functionsMapper.selectByExample(example);
|
List<Functions> list=null;
|
||||||
|
try{
|
||||||
|
list =functionsMapper.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteFunctionsByIds(String ids) {
|
public int batchDeleteFunctionsByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 functionsMapperEx.batchDeleteFunctionsByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result =functionsMapperEx.batchDeleteFunctionsByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class InOutItemComponent implements ICommonQuery {
|
|||||||
private InOutItemService inOutItemService;
|
private InOutItemService inOutItemService;
|
||||||
|
|
||||||
@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 getFunctionsList(map);
|
return getFunctionsList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getFunctionsList(Map<String, String> map) {
|
private List<?> getFunctionsList(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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -38,7 +38,7 @@ public class InOutItemComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -47,27 +47,27 @@ public class InOutItemComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return inOutItemService.insertInOutItem(beanJson, request);
|
return inOutItemService.insertInOutItem(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return inOutItemService.updateInOutItem(beanJson, id);
|
return inOutItemService.updateInOutItem(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return inOutItemService.deleteInOutItem(id);
|
return inOutItemService.deleteInOutItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return inOutItemService.batchDeleteInOutItem(ids);
|
return inOutItemService.batchDeleteInOutItem(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return inOutItemService.checkIsNameExist(id, name);
|
return inOutItemService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.AccountItem;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.InOutItem;
|
|
||||||
import com.jsh.erp.datasource.entities.InOutItemExample;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||||
import com.jsh.erp.datasource.mappers.InOutItemMapper;
|
import com.jsh.erp.datasource.mappers.InOutItemMapper;
|
||||||
import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
|
import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
|
||||||
@@ -43,58 +40,139 @@ public class InOutItemService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountItemMapperEx accountItemMapperEx;
|
private AccountItemMapperEx accountItemMapperEx;
|
||||||
|
|
||||||
public InOutItem getInOutItem(long id) {
|
public InOutItem getInOutItem(long id)throws Exception {
|
||||||
return inOutItemMapper.selectByPrimaryKey(id);
|
InOutItem result=null;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapper.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<InOutItem> getInOutItem() {
|
public List<InOutItem> getInOutItem()throws Exception {
|
||||||
InOutItemExample example = new InOutItemExample();
|
InOutItemExample example = new InOutItemExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return inOutItemMapper.selectByExample(example);
|
List<InOutItem> list=null;
|
||||||
|
try{
|
||||||
|
list=inOutItemMapper.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<InOutItem> select(String name, String type, String remark, int offset, int rows) {
|
public List<InOutItem> select(String name, String type, String remark, int offset, int rows)throws Exception {
|
||||||
return inOutItemMapperEx.selectByConditionInOutItem(name, type, remark, offset, rows);
|
List<InOutItem> list=null;
|
||||||
|
try{
|
||||||
|
list=inOutItemMapperEx.selectByConditionInOutItem(name, type, remark, 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 countInOutItem(String name, String type, String remark) {
|
public Long countInOutItem(String name, String type, String remark)throws Exception {
|
||||||
return inOutItemMapperEx.countsByInOutItem(name, type, remark);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapperEx.countsByInOutItem(name, type, remark);
|
||||||
|
}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 insertInOutItem(String beanJson, HttpServletRequest request) {
|
public int insertInOutItem(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
||||||
return inOutItemMapper.insertSelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapper.insertSelective(depot);
|
||||||
|
}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 updateInOutItem(String beanJson, Long id) {
|
public int updateInOutItem(String beanJson, Long id)throws Exception {
|
||||||
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
||||||
depot.setId(id);
|
depot.setId(id);
|
||||||
return inOutItemMapper.updateByPrimaryKeySelective(depot);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapper.updateByPrimaryKeySelective(depot);
|
||||||
|
}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 deleteInOutItem(Long id) {
|
public int deleteInOutItem(Long id)throws Exception {
|
||||||
return inOutItemMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapper.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 batchDeleteInOutItem(String ids) {
|
public int batchDeleteInOutItem(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
InOutItemExample example = new InOutItemExample();
|
InOutItemExample example = new InOutItemExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return inOutItemMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapper.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 {
|
||||||
InOutItemExample example = new InOutItemExample();
|
InOutItemExample example = new InOutItemExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<InOutItem> list = inOutItemMapper.selectByExample(example);
|
List<InOutItem> list = null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=inOutItemMapper.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 List<InOutItem> findBySelect(String type) {
|
public List<InOutItem> findBySelect(String type)throws Exception {
|
||||||
InOutItemExample example = new InOutItemExample();
|
InOutItemExample example = new InOutItemExample();
|
||||||
if (type.equals("in")) {
|
if (type.equals("in")) {
|
||||||
example.createCriteria().andTypeEqualTo("收入").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andTypeEqualTo("收入").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
@@ -102,16 +180,34 @@ public class InOutItemService {
|
|||||||
example.createCriteria().andTypeEqualTo("支出").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andTypeEqualTo("支出").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return inOutItemMapper.selectByExample(example);
|
List<InOutItem> list = null;
|
||||||
|
try{
|
||||||
|
list=inOutItemMapper.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)
|
||||||
public int batchDeleteInOutItemByIds(String ids) {
|
public int batchDeleteInOutItemByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result = 0;
|
||||||
|
try{
|
||||||
|
result=inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),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);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* create by: qiankunpingtai
|
||||||
@@ -137,7 +233,15 @@ public class InOutItemService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务子表 jsh_accountitem
|
* 校验财务子表 jsh_accountitem
|
||||||
* */
|
* */
|
||||||
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByInOutItemIds(idArray);
|
List<AccountItem> accountItemList=null;
|
||||||
|
try{
|
||||||
|
accountItemList=accountItemMapperEx.getAccountItemListByInOutItemIds(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(accountItemList!=null&&accountItemList.size()>0){
|
if(accountItemList!=null&&accountItemList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,InOutItemIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,InOutItemIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class LogComponent implements ICommonQuery {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
@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 getUserList(map);
|
return getUserList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getUserList(Map<String, String> map) {
|
private List<?> getUserList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String operation = StringUtil.getInfo(search, "operation");
|
String operation = StringUtil.getInfo(search, "operation");
|
||||||
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
||||||
@@ -43,7 +43,7 @@ public class LogComponent 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 operation = StringUtil.getInfo(search, "operation");
|
String operation = StringUtil.getInfo(search, "operation");
|
||||||
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
||||||
@@ -56,27 +56,27 @@ public class LogComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return logService.insertLog(beanJson, request);
|
return logService.insertLog(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return logService.updateLog(beanJson, id);
|
return logService.updateLog(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return logService.deleteLog(id);
|
return logService.deleteLog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return logService.batchDeleteLog(ids);
|
return logService.batchDeleteLog(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ package com.jsh.erp.service.log;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Log;
|
import com.jsh.erp.datasource.entities.Log;
|
||||||
import com.jsh.erp.datasource.entities.LogExample;
|
import com.jsh.erp.datasource.entities.LogExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.LogMapper;
|
import com.jsh.erp.datasource.mappers.LogMapper;
|
||||||
import com.jsh.erp.datasource.mappers.LogMapperEx;
|
import com.jsh.erp.datasource.mappers.LogMapperEx;
|
||||||
import com.jsh.erp.datasource.vo.LogVo4List;
|
import com.jsh.erp.datasource.vo.LogVo4List;
|
||||||
import com.jsh.erp.utils.ExceptionCodeConstants;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.utils.JshException;
|
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import com.jsh.erp.utils.Tools;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -19,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -34,50 +32,122 @@ public class LogService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogMapperEx logMapperEx;
|
private LogMapperEx logMapperEx;
|
||||||
|
|
||||||
public Log getLog(long id) {
|
public Log getLog(long id)throws Exception {
|
||||||
return logMapper.selectByPrimaryKey(id);
|
Log result=null;
|
||||||
|
try{
|
||||||
|
result=logMapper.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<Log> getLog() {
|
public List<Log> getLog()throws Exception {
|
||||||
LogExample example = new LogExample();
|
LogExample example = new LogExample();
|
||||||
return logMapper.selectByExample(example);
|
List<Log> list=null;
|
||||||
|
try{
|
||||||
|
list=logMapper.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<LogVo4List> select(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
public List<LogVo4List> select(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
||||||
String contentdetails, int offset, int rows) {
|
String contentdetails, int offset, int rows)throws Exception {
|
||||||
return logMapperEx.selectByConditionLog(operation, usernameID, clientIp, status, beginTime, endTime,
|
List<LogVo4List> list=null;
|
||||||
contentdetails, offset, rows);
|
try{
|
||||||
|
list=logMapperEx.selectByConditionLog(operation, usernameID, clientIp, status, beginTime, endTime,
|
||||||
|
contentdetails, 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 countLog(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
public Long countLog(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
||||||
String contentdetails) {
|
String contentdetails)throws Exception {
|
||||||
return logMapperEx.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=logMapperEx.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
|
||||||
|
}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 insertLog(String beanJson, HttpServletRequest request) {
|
public int insertLog(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
Log log = JSONObject.parseObject(beanJson, Log.class);
|
Log log = JSONObject.parseObject(beanJson, Log.class);
|
||||||
return logMapper.insertSelective(log);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=logMapper.insertSelective(log);
|
||||||
|
}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 updateLog(String beanJson, Long id) {
|
public int updateLog(String beanJson, Long id)throws Exception {
|
||||||
Log log = JSONObject.parseObject(beanJson, Log.class);
|
Log log = JSONObject.parseObject(beanJson, Log.class);
|
||||||
log.setId(id);
|
log.setId(id);
|
||||||
return logMapper.updateByPrimaryKeySelective(log);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=logMapper.updateByPrimaryKeySelective(log);
|
||||||
|
}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 deleteLog(Long id) {
|
public int deleteLog(Long id)throws Exception {
|
||||||
return logMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=logMapper.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 batchDeleteLog(String ids) {
|
public int batchDeleteLog(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
LogExample example = new LogExample();
|
LogExample example = new LogExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return logMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=logMapper.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +155,7 @@ public class LogService {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Long getUserId(HttpServletRequest request) {
|
public Long getUserId(HttpServletRequest request) throws Exception{
|
||||||
Object userInfo = request.getSession().getAttribute("user");
|
Object userInfo = request.getSession().getAttribute("user");
|
||||||
if(userInfo!=null) {
|
if(userInfo!=null) {
|
||||||
User user = (User) userInfo;
|
User user = (User) userInfo;
|
||||||
@@ -95,7 +165,7 @@ public class LogService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModule(String apiName){
|
public String getModule(String apiName)throws Exception{
|
||||||
String moduleName = null;
|
String moduleName = null;
|
||||||
switch (apiName) {
|
switch (apiName) {
|
||||||
case BusinessConstants.LOG_INTERFACE_NAME_USER:
|
case BusinessConstants.LOG_INTERFACE_NAME_USER:
|
||||||
@@ -144,7 +214,7 @@ public class LogService {
|
|||||||
return moduleName;
|
return moduleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertLog(String apiName, String type, HttpServletRequest request){
|
public void insertLog(String apiName, String type, HttpServletRequest request)throws Exception{
|
||||||
Log log = new Log();
|
Log log = new Log();
|
||||||
log.setUserid(getUserId(request));
|
log.setUserid(getUserId(request));
|
||||||
log.setOperation(getModule(apiName));
|
log.setOperation(getModule(apiName));
|
||||||
@@ -154,7 +224,15 @@ public class LogService {
|
|||||||
log.setStatus(status);
|
log.setStatus(status);
|
||||||
log.setContentdetails(type + getModule(apiName));
|
log.setContentdetails(type + getModule(apiName));
|
||||||
log.setRemark(type + getModule(apiName));
|
log.setRemark(type + getModule(apiName));
|
||||||
logMapper.insertSelective(log);
|
try{
|
||||||
|
logMapper.insertSelective(log);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,12 +225,20 @@ 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)
|
||||||
public int batchSetEnable(Boolean enabled, String materialIDs) {
|
public int batchSetEnable(Boolean enabled, String materialIDs)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -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,17 +356,35 @@ 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) {
|
public int batchDeleteMaterialByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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);
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public class MaterialCategoryComponent implements ICommonQuery {
|
|||||||
private MaterialCategoryService materialCategoryService;
|
private MaterialCategoryService materialCategoryService;
|
||||||
|
|
||||||
@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 getMaterialCategoryList(map);
|
return getMaterialCategoryList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getMaterialCategoryList(Map<String, String> map) {
|
private List<?> getMaterialCategoryList(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");
|
||||||
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
||||||
@@ -39,7 +39,7 @@ public class MaterialCategoryComponent 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");
|
||||||
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
||||||
@@ -47,27 +47,27 @@ public class MaterialCategoryComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return materialCategoryService.insertMaterialCategory(beanJson, request);
|
return materialCategoryService.insertMaterialCategory(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return materialCategoryService.updateMaterialCategory(beanJson, id);
|
return materialCategoryService.updateMaterialCategory(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return materialCategoryService.deleteMaterialCategory(id);
|
return materialCategoryService.deleteMaterialCategory(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return materialCategoryService.batchDeleteMaterialCategory(ids);
|
return materialCategoryService.batchDeleteMaterialCategory(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return materialCategoryService.checkIsNameExist(id, name);
|
return materialCategoryService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,64 +40,154 @@ public class MaterialCategoryService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialMapperEx materialMapperEx;
|
private MaterialMapperEx materialMapperEx;
|
||||||
|
|
||||||
public MaterialCategory getMaterialCategory(long id) {
|
public MaterialCategory getMaterialCategory(long id)throws Exception {
|
||||||
return materialCategoryMapper.selectByPrimaryKey(id);
|
MaterialCategory result=null;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapper.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<MaterialCategory> getMaterialCategory() {
|
public List<MaterialCategory> getMaterialCategory()throws Exception {
|
||||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||||
return materialCategoryMapper.selectByExample(example);
|
List<MaterialCategory> list=null;
|
||||||
|
try{
|
||||||
|
list=materialCategoryMapper.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<MaterialCategory> getAllList(Long parentId) {
|
public List<MaterialCategory> getAllList(Long parentId)throws Exception {
|
||||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||||
example.createCriteria().andParentidEqualTo(parentId).andIdNotEqualTo(1l);
|
example.createCriteria().andParentidEqualTo(parentId).andIdNotEqualTo(1l);
|
||||||
example.setOrderByClause("id");
|
example.setOrderByClause("id");
|
||||||
return materialCategoryMapper.selectByExample(example);
|
List<MaterialCategory> list=null;
|
||||||
|
try{
|
||||||
|
list=materialCategoryMapper.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<MaterialCategory> select(String name, Integer parentId, int offset, int rows) {
|
public List<MaterialCategory> select(String name, Integer parentId, int offset, int rows) throws Exception{
|
||||||
return materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows);
|
List<MaterialCategory> list=null;
|
||||||
|
try{
|
||||||
|
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, 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 countMaterialCategory(String name, Integer parentId) {
|
public Long countMaterialCategory(String name, Integer parentId) throws Exception{
|
||||||
return materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
|
||||||
|
}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 insertMaterialCategory(String beanJson, HttpServletRequest request) {
|
public int insertMaterialCategory(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
||||||
return materialCategoryMapper.insertSelective(materialCategory);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapper.insertSelective(materialCategory);
|
||||||
|
}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 updateMaterialCategory(String beanJson, Long id) {
|
public int updateMaterialCategory(String beanJson, Long id) throws Exception{
|
||||||
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
||||||
materialCategory.setId(id);
|
materialCategory.setId(id);
|
||||||
return materialCategoryMapper.updateByPrimaryKeySelective(materialCategory);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory);
|
||||||
|
}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 deleteMaterialCategory(Long id) {
|
public int deleteMaterialCategory(Long id)throws Exception {
|
||||||
return materialCategoryMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapper.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 batchDeleteMaterialCategory(String ids) {
|
public int batchDeleteMaterialCategory(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return materialCategoryMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapper.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 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MaterialCategory> findById(Long id) {
|
public List<MaterialCategory> findById(Long id)throws Exception {
|
||||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||||
example.createCriteria().andIdEqualTo(id);
|
example.createCriteria().andIdEqualTo(id);
|
||||||
return materialCategoryMapper.selectByExample(example);
|
List<MaterialCategory> list=null;
|
||||||
|
try{
|
||||||
|
list=materialCategoryMapper.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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -108,7 +198,16 @@ public class MaterialCategoryService {
|
|||||||
* @return java.util.List<com.jsh.erp.datasource.vo.TreeNode>
|
* @return java.util.List<com.jsh.erp.datasource.vo.TreeNode>
|
||||||
*/
|
*/
|
||||||
public List<TreeNode> getMaterialCategoryTree(Long id) throws Exception{
|
public List<TreeNode> getMaterialCategoryTree(Long id) throws Exception{
|
||||||
return materialCategoryMapperEx.getNodeTree(id);
|
List<TreeNode> list=null;
|
||||||
|
try{
|
||||||
|
list=materialCategoryMapperEx.getNodeTree(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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -144,7 +243,16 @@ public class MaterialCategoryService {
|
|||||||
mc.setUpdateTime(date);
|
mc.setUpdateTime(date);
|
||||||
//更新人
|
//更新人
|
||||||
mc.setUpdater(userInfo==null?null:userInfo.getId());
|
mc.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
return materialCategoryMapperEx.addMaterialCategory(mc);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialCategoryMapperEx.addMaterialCategory(mc);
|
||||||
|
}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 batchDeleteMaterialCategoryByIds(String ids) throws Exception {
|
public int batchDeleteMaterialCategoryByIds(String ids) throws Exception {
|
||||||
@@ -160,11 +268,19 @@ public class MaterialCategoryService {
|
|||||||
if(strArray.length<1){
|
if(strArray.length<1){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int result=0;
|
||||||
return materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
|
try{
|
||||||
|
result=materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
|
||||||
|
}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 editMaterialCategory(MaterialCategory mc) {
|
public int editMaterialCategory(MaterialCategory mc) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -180,12 +296,21 @@ public class MaterialCategoryService {
|
|||||||
//更新人
|
//更新人
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
mc.setUpdater(userInfo==null?null:userInfo.getId());
|
mc.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
return materialCategoryMapperEx.editMaterialCategory(mc);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= materialCategoryMapperEx.editMaterialCategory(mc);
|
||||||
|
}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 void checkMaterialCategorySerialNo(MaterialCategory mc) {
|
public void checkMaterialCategorySerialNo(MaterialCategory mc)throws Exception {
|
||||||
if(mc==null){
|
if(mc==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -193,7 +318,15 @@ public class MaterialCategoryService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//根据商品类别编号查询商品类别
|
//根据商品类别编号查询商品类别
|
||||||
List<MaterialCategory> mList=materialCategoryMapperEx.getMaterialCategoryBySerialNo(mc.getSerialNo());
|
List<MaterialCategory> mList=null;
|
||||||
|
try{
|
||||||
|
mList= materialCategoryMapperEx.getMaterialCategoryBySerialNo(mc.getSerialNo());
|
||||||
|
}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(mList==null||mList.size()<1){
|
if(mList==null||mList.size()<1){
|
||||||
//未查询到对应数据,编号可用
|
//未查询到对应数据,编号可用
|
||||||
return;
|
return;
|
||||||
@@ -243,7 +376,15 @@ public class MaterialCategoryService {
|
|||||||
/**
|
/**
|
||||||
* 校验产品表 jsh_material
|
* 校验产品表 jsh_material
|
||||||
* */
|
* */
|
||||||
List<Material> materialList=materialMapperEx.getMaterialListByCategoryIds(idArray);
|
List<Material> materialList=null;
|
||||||
|
try{
|
||||||
|
materialList= materialMapperEx.getMaterialListByCategoryIds(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(materialList!=null&&materialList.size()>0){
|
if(materialList!=null&&materialList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -253,7 +394,15 @@ public class MaterialCategoryService {
|
|||||||
/**
|
/**
|
||||||
* 校验产品类型表 jsh_materialcategory
|
* 校验产品类型表 jsh_materialcategory
|
||||||
* */
|
* */
|
||||||
List<MaterialCategory> materialCategoryList=materialCategoryMapperEx.getMaterialCategoryListByCategoryIds(idArray);
|
List<MaterialCategory> materialCategoryList=null;
|
||||||
|
try{
|
||||||
|
materialCategoryList= materialCategoryMapperEx.getMaterialCategoryListByCategoryIds(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(materialCategoryList!=null&&materialCategoryList.size()>0){
|
if(materialCategoryList!=null&&materialCategoryList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class MaterialPropertyComponent implements ICommonQuery {
|
|||||||
private MaterialPropertyService materialPropertyService;
|
private MaterialPropertyService materialPropertyService;
|
||||||
|
|
||||||
@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 getMaterialPropertyList(map);
|
return getMaterialPropertyList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getMaterialPropertyList(Map<String, String> map) {
|
private List<?> getMaterialPropertyList(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 order = QueryUtils.order(map);
|
String order = QueryUtils.order(map);
|
||||||
@@ -36,34 +36,34 @@ public class MaterialPropertyComponent 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");
|
||||||
return materialPropertyService.countMaterialProperty(name);
|
return materialPropertyService.countMaterialProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return materialPropertyService.insertMaterialProperty(beanJson, request);
|
return materialPropertyService.insertMaterialProperty(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return materialPropertyService.updateMaterialProperty(beanJson, id);
|
return materialPropertyService.updateMaterialProperty(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return materialPropertyService.deleteMaterialProperty(id);
|
return materialPropertyService.deleteMaterialProperty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return materialPropertyService.batchDeleteMaterialProperty(ids);
|
return materialPropertyService.batchDeleteMaterialProperty(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return materialPropertyService.checkIsNameExist(id, name);
|
return materialPropertyService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package com.jsh.erp.service.materialProperty;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.MaterialProperty;
|
import com.jsh.erp.datasource.entities.MaterialProperty;
|
||||||
import com.jsh.erp.datasource.entities.MaterialPropertyExample;
|
import com.jsh.erp.datasource.entities.MaterialPropertyExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.MaterialPropertyMapper;
|
import com.jsh.erp.datasource.mappers.MaterialPropertyMapper;
|
||||||
import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx;
|
import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -36,61 +38,142 @@ public class MaterialPropertyService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
public MaterialProperty getMaterialProperty(long id) {
|
public MaterialProperty getMaterialProperty(long id)throws Exception {
|
||||||
return materialPropertyMapper.selectByPrimaryKey(id);
|
MaterialProperty result=null;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapper.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<MaterialProperty> getMaterialProperty() {
|
public List<MaterialProperty> getMaterialProperty()throws Exception {
|
||||||
MaterialPropertyExample example = new MaterialPropertyExample();
|
MaterialPropertyExample example = new MaterialPropertyExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return materialPropertyMapper.selectByExample(example);
|
List<MaterialProperty> list=null;
|
||||||
|
try{
|
||||||
|
list=materialPropertyMapper.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<MaterialProperty> select(String name, int offset, int rows) {
|
public List<MaterialProperty> select(String name, int offset, int rows)throws Exception {
|
||||||
return materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
|
List<MaterialProperty> list=null;
|
||||||
|
try{
|
||||||
|
list=materialPropertyMapperEx.selectByConditionMaterialProperty(name, 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 countMaterialProperty(String name) {
|
public Long countMaterialProperty(String name)throws Exception {
|
||||||
return materialPropertyMapperEx.countsByMaterialProperty(name);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapperEx.countsByMaterialProperty(name);
|
||||||
|
}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 insertMaterialProperty(String beanJson, HttpServletRequest request) {
|
public int insertMaterialProperty(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
||||||
return materialPropertyMapper.insertSelective(materialProperty);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapper.insertSelective(materialProperty);
|
||||||
|
}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 updateMaterialProperty(String beanJson, Long id) {
|
public int updateMaterialProperty(String beanJson, Long id)throws Exception {
|
||||||
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
||||||
materialProperty.setId(id);
|
materialProperty.setId(id);
|
||||||
return materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
||||||
|
}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 deleteMaterialProperty(Long id) {
|
public int deleteMaterialProperty(Long id)throws Exception {
|
||||||
return materialPropertyMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapper.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 batchDeleteMaterialProperty(String ids) {
|
public int batchDeleteMaterialProperty(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
MaterialPropertyExample example = new MaterialPropertyExample();
|
MaterialPropertyExample example = new MaterialPropertyExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return materialPropertyMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapper.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 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteMaterialPropertyByIds(String ids) {
|
public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,44 +22,44 @@ public class OrgaUserRelComponent implements ICommonQuery {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrgaUserRelService orgaUserRelService;
|
private OrgaUserRelService orgaUserRelService;
|
||||||
@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> parameterMap) {
|
public List<?> select(Map<String, String> parameterMap)throws Exception {
|
||||||
return getOrgaUserRelList(parameterMap);
|
return getOrgaUserRelList(parameterMap);
|
||||||
}
|
}
|
||||||
private List<?> getOrgaUserRelList(Map<String, String> map) {
|
private List<?> getOrgaUserRelList(Map<String, String> map)throws Exception {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Long counts(Map<String, String> parameterMap) {
|
public Long counts(Map<String, String> parameterMap)throws Exception {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return orgaUserRelService.insertOrgaUserRel(beanJson,request);
|
return orgaUserRelService.insertOrgaUserRel(beanJson,request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return orgaUserRelService.updateOrgaUserRel(beanJson,id);
|
return orgaUserRelService.updateOrgaUserRel(beanJson,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return orgaUserRelService.deleteOrgaUserRel(id);
|
return orgaUserRelService.deleteOrgaUserRel(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return orgaUserRelService.batchDeleteOrgaUserRel(ids);
|
return orgaUserRelService.batchDeleteOrgaUserRel(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ package com.jsh.erp.service.orgaUserRel;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.*;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
|
import com.jsh.erp.datasource.entities.OrgaUserRel;
|
||||||
|
import com.jsh.erp.datasource.entities.OrgaUserRelExample;
|
||||||
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.OrgaUserRelMapper;
|
import com.jsh.erp.datasource.mappers.OrgaUserRelMapper;
|
||||||
import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx;
|
import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.organization.OrganizationService;
|
import com.jsh.erp.service.organization.OrganizationService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
@@ -38,26 +42,62 @@ public class OrgaUserRelService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertOrgaUserRel(String beanJson, HttpServletRequest request) {
|
public int insertOrgaUserRel(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
||||||
return orgaUserRelMapper.insertSelective(orgaUserRel);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=orgaUserRelMapper.insertSelective(orgaUserRel);
|
||||||
|
}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 updateOrgaUserRel(String beanJson, Long id) {
|
public int updateOrgaUserRel(String beanJson, Long id) throws Exception{
|
||||||
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
||||||
orgaUserRel.setId(id);
|
orgaUserRel.setId(id);
|
||||||
return orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel);
|
||||||
|
}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 deleteOrgaUserRel(Long id) {
|
public int deleteOrgaUserRel(Long id)throws Exception {
|
||||||
return orgaUserRelMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=orgaUserRelMapper.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 batchDeleteOrgaUserRel(String ids) {
|
public int batchDeleteOrgaUserRel(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
OrgaUserRelExample example = new OrgaUserRelExample();
|
OrgaUserRelExample example = new OrgaUserRelExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return orgaUserRelMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=orgaUserRelMapper.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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -88,8 +128,16 @@ public class OrgaUserRelService {
|
|||||||
orgaUserRel.setUpdater(userInfo==null?null:userInfo.getId());
|
orgaUserRel.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
}
|
}
|
||||||
orgaUserRel.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
|
orgaUserRel.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
|
||||||
int i=orgaUserRelMapperEx.addOrgaUserRel(orgaUserRel);
|
int result=0;
|
||||||
if(i>0){
|
try{
|
||||||
|
result=orgaUserRelMapperEx.addOrgaUserRel(orgaUserRel);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return orgaUserRel;
|
return orgaUserRel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -103,7 +151,7 @@ public class OrgaUserRelService {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public OrgaUserRel updateOrgaUserRel(OrgaUserRel orgaUserRel) {
|
public OrgaUserRel updateOrgaUserRel(OrgaUserRel orgaUserRel) throws Exception{
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
//更新时间
|
//更新时间
|
||||||
if(orgaUserRel.getUpdateTime()==null){
|
if(orgaUserRel.getUpdateTime()==null){
|
||||||
@@ -113,8 +161,16 @@ public class OrgaUserRelService {
|
|||||||
if(orgaUserRel.getUpdater()==null){
|
if(orgaUserRel.getUpdater()==null){
|
||||||
orgaUserRel.setUpdater(userInfo==null?null:userInfo.getId());
|
orgaUserRel.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
}
|
}
|
||||||
int i= orgaUserRelMapperEx.updateOrgaUserRel(orgaUserRel);
|
int result=0;
|
||||||
if(i>0){
|
try{
|
||||||
|
result=orgaUserRelMapperEx.updateOrgaUserRel(orgaUserRel);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return orgaUserRel;
|
return orgaUserRel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -23,44 +23,44 @@ public class OrganizationComponent implements ICommonQuery {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrganizationService organizationService;
|
private OrganizationService organizationService;
|
||||||
@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> parameterMap) {
|
public List<?> select(Map<String, String> parameterMap)throws Exception {
|
||||||
return getOrganizationList(parameterMap);
|
return getOrganizationList(parameterMap);
|
||||||
}
|
}
|
||||||
private List<?> getOrganizationList(Map<String, String> map) {
|
private List<?> getOrganizationList(Map<String, String> map)throws Exception {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Long counts(Map<String, String> parameterMap) {
|
public Long counts(Map<String, String> parameterMap)throws Exception {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return organizationService.insertOrganization(beanJson,request);
|
return organizationService.insertOrganization(beanJson,request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return organizationService.updateOrganization(beanJson,id);
|
return organizationService.updateOrganization(beanJson,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return organizationService.deleteOrganization(id);
|
return organizationService.deleteOrganization(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return organizationService.batchDeleteOrganization(ids);
|
return organizationService.batchDeleteOrganization(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.jsh.erp.service.organization;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
|
import com.jsh.erp.datasource.entities.MaterialProperty;
|
||||||
import com.jsh.erp.datasource.entities.Organization;
|
import com.jsh.erp.datasource.entities.Organization;
|
||||||
import com.jsh.erp.datasource.entities.OrganizationExample;
|
import com.jsh.erp.datasource.entities.OrganizationExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
@@ -44,26 +45,62 @@ public class OrganizationService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertOrganization(String beanJson, HttpServletRequest request) {
|
public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
||||||
return organizationMapper.insertSelective(organization);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapper.insertSelective(organization);
|
||||||
|
}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 updateOrganization(String beanJson, Long id) {
|
public int updateOrganization(String beanJson, Long id)throws Exception {
|
||||||
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
||||||
organization.setId(id);
|
organization.setId(id);
|
||||||
return organizationMapper.updateByPrimaryKeySelective(organization);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapper.updateByPrimaryKeySelective(organization);
|
||||||
|
}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 deleteOrganization(Long id) {
|
public int deleteOrganization(Long id)throws Exception {
|
||||||
return organizationMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapper.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 batchDeleteOrganization(String ids) {
|
public int batchDeleteOrganization(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
OrganizationExample example = new OrganizationExample();
|
OrganizationExample example = new OrganizationExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return organizationMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapper.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;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int addOrganization(Organization org) throws Exception{
|
public int addOrganization(Organization org) throws Exception{
|
||||||
@@ -92,7 +129,16 @@ public class OrganizationService {
|
|||||||
if(StringUtil.isEmpty(org.getOrgParentNo())){
|
if(StringUtil.isEmpty(org.getOrgParentNo())){
|
||||||
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
|
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
|
||||||
}
|
}
|
||||||
return organizationMapperEx.addOrganization(org);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapperEx.addOrganization(org);
|
||||||
|
}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 editOrganization(Organization org)throws Exception {
|
public int editOrganization(Organization org)throws Exception {
|
||||||
@@ -116,23 +162,59 @@ public class OrganizationService {
|
|||||||
if(StringUtil.isEmpty(org.getOrgParentNo())){
|
if(StringUtil.isEmpty(org.getOrgParentNo())){
|
||||||
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
|
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
|
||||||
}
|
}
|
||||||
return organizationMapperEx.editOrganization(org);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapperEx.editOrganization(org);
|
||||||
|
}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<TreeNode> getOrganizationTree(Long id)throws Exception {
|
public List<TreeNode> getOrganizationTree(Long id)throws Exception {
|
||||||
return organizationMapperEx.getNodeTree(id);
|
List<TreeNode> list=null;
|
||||||
|
try{
|
||||||
|
list=organizationMapperEx.getNodeTree(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<Organization> findById(Long id) throws Exception{
|
public List<Organization> findById(Long id) throws Exception{
|
||||||
OrganizationExample example = new OrganizationExample();
|
OrganizationExample example = new OrganizationExample();
|
||||||
example.createCriteria().andIdEqualTo(id);
|
example.createCriteria().andIdEqualTo(id);
|
||||||
return organizationMapper.selectByExample(example);
|
List<Organization> list=null;
|
||||||
|
try{
|
||||||
|
list=organizationMapper.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<Organization> findByOrgNo(String orgNo)throws Exception {
|
public List<Organization> findByOrgNo(String orgNo)throws Exception {
|
||||||
OrganizationExample example = new OrganizationExample();
|
OrganizationExample example = new OrganizationExample();
|
||||||
example.createCriteria().andOrgNoEqualTo(orgNo).andOrgStcdNotEqualTo(BusinessConstants.ORGANIZATION_STCD_REMOVED);
|
example.createCriteria().andOrgNoEqualTo(orgNo).andOrgStcdNotEqualTo(BusinessConstants.ORGANIZATION_STCD_REMOVED);
|
||||||
return organizationMapper.selectByExample(example);
|
List<Organization> list=null;
|
||||||
|
try{
|
||||||
|
list=organizationMapper.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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -177,6 +259,16 @@ public class OrganizationService {
|
|||||||
((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 organizationMapperEx.batchDeleteOrganizationByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=organizationMapperEx.batchDeleteOrganizationByIds(
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public class PersonComponent implements ICommonQuery {
|
|||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
@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 getPersonList(map);
|
return getPersonList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getPersonList(Map<String, String> map) {
|
private List<?> getPersonList(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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -39,7 +39,7 @@ public class PersonComponent 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 type = StringUtil.getInfo(search, "type");
|
String type = StringUtil.getInfo(search, "type");
|
||||||
@@ -47,27 +47,27 @@ public class PersonComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return personService.insertPerson(beanJson, request);
|
return personService.insertPerson(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return personService.updatePerson(beanJson, id);
|
return personService.updatePerson(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return personService.deletePerson(id);
|
return personService.deletePerson(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return personService.batchDeletePerson(ids);
|
return personService.batchDeletePerson(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return personService.checkIsNameExist(id, name);
|
return personService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,63 +43,151 @@ public class PersonService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DepotHeadMapperEx depotHeadMapperEx;
|
private DepotHeadMapperEx depotHeadMapperEx;
|
||||||
|
|
||||||
public Person getPerson(long id) {
|
public Person getPerson(long id)throws Exception {
|
||||||
return personMapper.selectByPrimaryKey(id);
|
Person result=null;
|
||||||
|
try{
|
||||||
|
result=personMapper.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<Person> getPerson() {
|
public List<Person> getPerson()throws Exception {
|
||||||
PersonExample example = new PersonExample();
|
PersonExample example = new PersonExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return personMapper.selectByExample(example);
|
List<Person> list=null;
|
||||||
|
try{
|
||||||
|
list=personMapper.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<Person> select(String name, String type, int offset, int rows) {
|
public List<Person> select(String name, String type, int offset, int rows)throws Exception {
|
||||||
return personMapperEx.selectByConditionPerson(name, type, offset, rows);
|
List<Person> list=null;
|
||||||
|
try{
|
||||||
|
list=personMapperEx.selectByConditionPerson(name, type, 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 countPerson(String name, String type) {
|
public Long countPerson(String name, String type)throws Exception {
|
||||||
return personMapperEx.countsByPerson(name, type);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=personMapperEx.countsByPerson(name, type);
|
||||||
|
}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 insertPerson(String beanJson, HttpServletRequest request) {
|
public int insertPerson(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||||
return personMapper.insertSelective(person);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=personMapper.insertSelective(person);
|
||||||
|
}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 updatePerson(String beanJson, Long id) {
|
public int updatePerson(String beanJson, Long id)throws Exception {
|
||||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||||
person.setId(id);
|
person.setId(id);
|
||||||
return personMapper.updateByPrimaryKeySelective(person);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=personMapper.updateByPrimaryKeySelective(person);
|
||||||
|
}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 deletePerson(Long id) {
|
public int deletePerson(Long id)throws Exception {
|
||||||
return personMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=personMapper.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 batchDeletePerson(String ids) {
|
public int batchDeletePerson(String ids) throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
PersonExample example = new PersonExample();
|
PersonExample example = new PersonExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return personMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=personMapper.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{
|
||||||
PersonExample example = new PersonExample();
|
PersonExample example = new PersonExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Person> list = personMapper.selectByExample(example);
|
List<Person> list =null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=personMapper.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 String getPersonByIds(String personIDs) {
|
public String getPersonByIds(String personIDs)throws Exception {
|
||||||
List<Long> ids = StringUtil.strToLongList(personIDs);
|
List<Long> ids = StringUtil.strToLongList(personIDs);
|
||||||
PersonExample example = new PersonExample();
|
PersonExample example = new PersonExample();
|
||||||
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Id asc");
|
example.setOrderByClause("Id asc");
|
||||||
List<Person> list = personMapper.selectByExample(example);
|
List<Person> list =null;
|
||||||
|
try{
|
||||||
|
list=personMapper.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);
|
||||||
|
}
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (Person person : list) {
|
for (Person person : list) {
|
||||||
@@ -109,21 +197,39 @@ public class PersonService {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Person> getPersonByType(String type) {
|
public List<Person> getPersonByType(String type)throws Exception {
|
||||||
PersonExample example = new PersonExample();
|
PersonExample example = new PersonExample();
|
||||||
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("Id asc");
|
example.setOrderByClause("Id asc");
|
||||||
return personMapper.selectByExample(example);
|
List<Person> list =null;
|
||||||
|
try{
|
||||||
|
list=personMapper.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)
|
||||||
public int batchDeletePersonByIds(String ids) {
|
public int batchDeletePersonByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_PERSON,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_PERSON,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result =0;
|
||||||
|
try{
|
||||||
|
result=personMapperEx.batchDeletePersonByIds(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
|
||||||
@@ -150,7 +256,15 @@ public class PersonService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务主表 jsh_accounthead
|
* 校验财务主表 jsh_accounthead
|
||||||
* */
|
* */
|
||||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray);
|
List<AccountHead> accountHeadList =null;
|
||||||
|
try{
|
||||||
|
accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(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("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -160,7 +274,15 @@ public class PersonService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据主表 jsh_depothead
|
* 校验单据主表 jsh_depothead
|
||||||
* */
|
* */
|
||||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
|
List<DepotHead> depotHeadList =null;
|
||||||
|
try{
|
||||||
|
depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(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("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class RoleComponent implements ICommonQuery {
|
|||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
@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 getRoleList(map);
|
return getRoleList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getRoleList(Map<String, String> map) {
|
private List<?> getRoleList(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 order = QueryUtils.order(map);
|
String order = QueryUtils.order(map);
|
||||||
@@ -37,34 +37,34 @@ public class RoleComponent 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");
|
||||||
return roleService.countRole(name);
|
return roleService.countRole(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return roleService.insertRole(beanJson, request);
|
return roleService.insertRole(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return roleService.updateRole(beanJson, id);
|
return roleService.updateRole(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return roleService.deleteRole(id);
|
return roleService.deleteRole(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return roleService.batchDeleteRole(ids);
|
return roleService.batchDeleteRole(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,18 @@ package com.jsh.erp.service.role;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Role;
|
import com.jsh.erp.datasource.entities.Role;
|
||||||
import com.jsh.erp.datasource.entities.RoleExample;
|
import com.jsh.erp.datasource.entities.RoleExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.entities.UserExample;
|
|
||||||
import com.jsh.erp.datasource.mappers.RoleMapper;
|
import com.jsh.erp.datasource.mappers.RoleMapper;
|
||||||
import com.jsh.erp.datasource.mappers.RoleMapperEx;
|
import com.jsh.erp.datasource.mappers.RoleMapperEx;
|
||||||
import com.jsh.erp.datasource.mappers.UserMapper;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.QueryUtils;
|
|
||||||
import com.jsh.erp.utils.RegExpTools;
|
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
@@ -23,10 +23,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RoleService {
|
public class RoleService {
|
||||||
|
private Logger logger = LoggerFactory.getLogger(RoleService.class);
|
||||||
@Resource
|
@Resource
|
||||||
private RoleMapper roleMapper;
|
private RoleMapper roleMapper;
|
||||||
|
|
||||||
@@ -37,55 +37,135 @@ public class RoleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
public Role getRole(long id) {
|
public Role getRole(long id)throws Exception {
|
||||||
return roleMapper.selectByPrimaryKey(id);
|
Role result=null;
|
||||||
|
try{
|
||||||
|
result=roleMapper.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<Role> getRole() {
|
public List<Role> getRole()throws Exception {
|
||||||
RoleExample example = new RoleExample();
|
RoleExample example = new RoleExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return roleMapper.selectByExample(example);
|
List<Role> list=null;
|
||||||
|
try{
|
||||||
|
list=roleMapper.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<Role> select(String name, int offset, int rows) {
|
public List<Role> select(String name, int offset, int rows)throws Exception {
|
||||||
return roleMapperEx.selectByConditionRole(name, offset, rows);
|
List<Role> list=null;
|
||||||
|
try{
|
||||||
|
list=roleMapperEx.selectByConditionRole(name, 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 countRole(String name) {
|
public Long countRole(String name)throws Exception {
|
||||||
return roleMapperEx.countsByRole(name);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=roleMapperEx.countsByRole(name);
|
||||||
|
}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 insertRole(String beanJson, HttpServletRequest request) {
|
public int insertRole(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Role role = JSONObject.parseObject(beanJson, Role.class);
|
Role role = JSONObject.parseObject(beanJson, Role.class);
|
||||||
return roleMapper.insertSelective(role);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=roleMapper.insertSelective(role);
|
||||||
|
}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 updateRole(String beanJson, Long id) {
|
public int updateRole(String beanJson, Long id) throws Exception{
|
||||||
Role role = JSONObject.parseObject(beanJson, Role.class);
|
Role role = JSONObject.parseObject(beanJson, Role.class);
|
||||||
role.setId(id);
|
role.setId(id);
|
||||||
return roleMapper.updateByPrimaryKeySelective(role);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=roleMapper.updateByPrimaryKeySelective(role);
|
||||||
|
}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 deleteRole(Long id) {
|
public int deleteRole(Long id)throws Exception {
|
||||||
return roleMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=roleMapper.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 batchDeleteRole(String ids) {
|
public int batchDeleteRole(String ids) throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
RoleExample example = new RoleExample();
|
RoleExample example = new RoleExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return roleMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=roleMapper.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 List<Role> findUserRole(){
|
public List<Role> findUserRole()throws Exception{
|
||||||
RoleExample example = new RoleExample();
|
RoleExample example = new RoleExample();
|
||||||
example.setOrderByClause("Id");
|
example.setOrderByClause("Id");
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Role> list = roleMapper.selectByExample(example);
|
List<Role> list=null;
|
||||||
|
try{
|
||||||
|
list=roleMapper.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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -98,12 +178,21 @@ public class RoleService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteRoleByIds(String ids) {
|
public int batchDeleteRoleByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 roleMapperEx.batchDeleteRoleByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=roleMapperEx.batchDeleteRoleByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,16 +26,16 @@ public class SerialNumberComponent implements ICommonQuery {
|
|||||||
private SerialNumberService serialNumberService;
|
private SerialNumberService serialNumberService;
|
||||||
|
|
||||||
@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 getSerialNumberList(map);
|
return getSerialNumberList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getSerialNumberList(Map<String, String> map) {
|
private List<?> getSerialNumberList(Map<String, String> map) throws Exception{
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String serialNumber = StringUtil.getInfo(search, "serialNumber");
|
String serialNumber = StringUtil.getInfo(search, "serialNumber");
|
||||||
String materialName = StringUtil.getInfo(search, "materialName");
|
String materialName = StringUtil.getInfo(search, "materialName");
|
||||||
@@ -43,7 +43,7 @@ public class SerialNumberComponent 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 serialNumber = StringUtil.getInfo(search, "serialNumber");
|
String serialNumber = StringUtil.getInfo(search, "serialNumber");
|
||||||
String materialName = StringUtil.getInfo(search, "materialName");
|
String materialName = StringUtil.getInfo(search, "materialName");
|
||||||
@@ -51,27 +51,27 @@ public class SerialNumberComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return serialNumberService.insertSerialNumber(beanJson, request);
|
return serialNumberService.insertSerialNumber(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return serialNumberService.updateSerialNumber(beanJson, id);
|
return serialNumberService.updateSerialNumber(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return serialNumberService.deleteSerialNumber(id);
|
return serialNumberService.deleteSerialNumber(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return serialNumberService.batchDeleteSerialNumber(ids);
|
return serialNumberService.batchDeleteSerialNumber(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String serialNumber) {
|
public int checkIsNameExist(Long id, String serialNumber) throws Exception{
|
||||||
return serialNumberService.checkIsNameExist(id, serialNumber);
|
return serialNumberService.checkIsNameExist(id, serialNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SerialNumberService {
|
public class SerialNumberService {
|
||||||
private Logger logger = LoggerFactory.getLogger(MaterialService.class);
|
private Logger logger = LoggerFactory.getLogger(SerialNumberService.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SerialNumberMapper serialNumberMapper;
|
private SerialNumberMapper serialNumberMapper;
|
||||||
@@ -48,84 +48,190 @@ public class SerialNumberService {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
|
|
||||||
public SerialNumber getSerialNumber(long id) {
|
public SerialNumber getSerialNumber(long id)throws Exception {
|
||||||
return serialNumberMapper.selectByPrimaryKey(id);
|
SerialNumber result=null;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapper.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<SerialNumber> getSerialNumber() {
|
public List<SerialNumber> getSerialNumber()throws Exception {
|
||||||
SerialNumberExample example = new SerialNumberExample();
|
SerialNumberExample example = new SerialNumberExample();
|
||||||
return serialNumberMapper.selectByExample(example);
|
List<SerialNumber> list=null;
|
||||||
|
try{
|
||||||
|
list=serialNumberMapper.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<SerialNumberEx> select(String serialNumber, String materialName, Integer offset, Integer rows) {
|
public List<SerialNumberEx> select(String serialNumber, String materialName, Integer offset, Integer rows)throws Exception {
|
||||||
return serialNumberMapperEx.selectByConditionSerialNumber(serialNumber, materialName,offset, rows);
|
List<SerialNumberEx> list=null;
|
||||||
|
try{
|
||||||
|
list=serialNumberMapperEx.selectByConditionSerialNumber(serialNumber, materialName,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 countSerialNumber(String serialNumber,String materialName) {
|
public Long countSerialNumber(String serialNumber,String materialName)throws Exception {
|
||||||
return serialNumberMapperEx.countSerialNumber(serialNumber, materialName);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapperEx.countSerialNumber(serialNumber, materialName);
|
||||||
|
}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 insertSerialNumber(String beanJson, HttpServletRequest request) {
|
public int insertSerialNumber(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
|
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||||
return serialNumberMapper.insertSelective(serialNumber);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapper.insertSelective(serialNumber);
|
||||||
|
}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 updateSerialNumber(String beanJson, Long id) {
|
public int updateSerialNumber(String beanJson, Long id) throws Exception{
|
||||||
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
|
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
|
||||||
serialNumber.setId(id);
|
serialNumber.setId(id);
|
||||||
int res = serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
|
int result=0;
|
||||||
return res;
|
try{
|
||||||
|
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
|
||||||
|
}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 deleteSerialNumber(Long id) {
|
public int deleteSerialNumber(Long id)throws Exception {
|
||||||
return serialNumberMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapper.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 batchDeleteSerialNumber(String ids) {
|
public int batchDeleteSerialNumber(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
SerialNumberExample example = new SerialNumberExample();
|
SerialNumberExample example = new SerialNumberExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return serialNumberMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapper.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 serialNumber) {
|
public int checkIsNameExist(Long id, String serialNumber)throws Exception {
|
||||||
SerialNumberExample example = new SerialNumberExample();
|
SerialNumberExample example = new SerialNumberExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<SerialNumber> list = serialNumberMapper.selectByExample(example);
|
List<SerialNumber> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=serialNumberMapper.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)
|
||||||
public int batchSetEnable(Boolean enabled, String materialIDs) {
|
public int batchSetEnable(Boolean enabled, String materialIDs)throws Exception{
|
||||||
List<Long> ids = StringUtil.strToLongList(materialIDs);
|
List<Long> ids = StringUtil.strToLongList(materialIDs);
|
||||||
SerialNumber serialNumber = new SerialNumber();
|
SerialNumber serialNumber = new SerialNumber();
|
||||||
SerialNumberExample example = new SerialNumberExample();
|
SerialNumberExample example = new SerialNumberExample();
|
||||||
example.createCriteria().andIdIn(ids);
|
example.createCriteria().andIdIn(ids);
|
||||||
return serialNumberMapper.updateByExampleSelective(serialNumber, example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=serialNumberMapper.updateByExampleSelective(serialNumber, 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<SerialNumberEx> findById(Long id){
|
public List<SerialNumberEx> findById(Long id)throws Exception{
|
||||||
return serialNumberMapperEx.findById(id);
|
List<SerialNumberEx> list=null;
|
||||||
|
try{
|
||||||
|
list=serialNumberMapperEx.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 void checkIsExist(Long id, String materialName, String serialNumber) {
|
public void checkIsExist(Long id, String materialName, String serialNumber) throws Exception{
|
||||||
/**
|
/**
|
||||||
* 商品名称不为空时,检查商品名称是否存在
|
* 商品名称不为空时,检查商品名称是否存在
|
||||||
* */
|
* */
|
||||||
if(StringUtil.isNotEmpty(materialName)){
|
if(StringUtil.isNotEmpty(materialName)){
|
||||||
List<Material> mlist = materialMapperEx.findByMaterialName(materialName);
|
List<Material> mlist=null;
|
||||||
|
try{
|
||||||
|
mlist = materialMapperEx.findByMaterialName(materialName);
|
||||||
|
}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(mlist==null||mlist.size()<1){
|
if(mlist==null||mlist.size()<1){
|
||||||
//商品名称不存在
|
//商品名称不存在
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
||||||
@@ -140,7 +246,15 @@ public class SerialNumberService {
|
|||||||
/***
|
/***
|
||||||
* 判断序列号是否已存在
|
* 判断序列号是否已存在
|
||||||
* */
|
* */
|
||||||
List <SerialNumberEx> list = serialNumberMapperEx.findBySerialNumber(serialNumber);
|
List <SerialNumberEx> list=null;
|
||||||
|
try{
|
||||||
|
list = serialNumberMapperEx.findBySerialNumber(serialNumber);
|
||||||
|
}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(list!=null&&list.size()>0){
|
if(list!=null&&list.size()>0){
|
||||||
if(list.size()>1){
|
if(list.size()>1){
|
||||||
//存在多个同名序列号
|
//存在多个同名序列号
|
||||||
@@ -169,7 +283,7 @@ public class SerialNumberService {
|
|||||||
* 新增序列号信息
|
* 新增序列号信息
|
||||||
* */
|
* */
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) {
|
public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
if(serialNumberEx==null){
|
if(serialNumberEx==null){
|
||||||
@@ -187,14 +301,22 @@ public class SerialNumberService {
|
|||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
serialNumberEx.setCreator(userInfo==null?null:userInfo.getId());
|
serialNumberEx.setCreator(userInfo==null?null:userInfo.getId());
|
||||||
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
int result=serialNumberMapperEx.addSerialNumber(serialNumberEx);
|
int result=0;
|
||||||
if(result==1){
|
try{
|
||||||
|
result = serialNumberMapperEx.addSerialNumber(serialNumberEx);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return serialNumberEx;
|
return serialNumberEx;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx) {
|
public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -207,8 +329,16 @@ public class SerialNumberService {
|
|||||||
serialNumberEx.setUpdateTime(date);
|
serialNumberEx.setUpdateTime(date);
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
||||||
int result = serialNumberMapperEx.updateSerialNumber(serialNumberEx);
|
int result=0;
|
||||||
if(result==1){
|
try{
|
||||||
|
result = serialNumberMapperEx.updateSerialNumber(serialNumberEx);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return serialNumberEx;
|
return serialNumberEx;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -221,9 +351,17 @@ public class SerialNumberService {
|
|||||||
* @Param: materialName
|
* @Param: materialName
|
||||||
* @return Long 满足使用条件的商品的id
|
* @return Long 满足使用条件的商品的id
|
||||||
*/
|
*/
|
||||||
public Long checkMaterialName(String materialName){
|
public Long checkMaterialName(String materialName)throws Exception{
|
||||||
if(StringUtil.isNotEmpty(materialName)) {
|
if(StringUtil.isNotEmpty(materialName)) {
|
||||||
List<Material> mlist = materialMapperEx.findByMaterialName(materialName);
|
List<Material> mlist=null;
|
||||||
|
try{
|
||||||
|
mlist = materialMapperEx.findByMaterialName(materialName);
|
||||||
|
}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 (mlist == null || mlist.size() < 1) {
|
if (mlist == null || mlist.size() < 1) {
|
||||||
//商品名称不存在
|
//商品名称不存在
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
||||||
@@ -258,7 +396,7 @@ public class SerialNumberService {
|
|||||||
* @Param: materialName
|
* @Param: materialName
|
||||||
* @return Long 满足使用条件的商品的id
|
* @return Long 满足使用条件的商品的id
|
||||||
*/
|
*/
|
||||||
public Long getSerialNumberMaterialIdByMaterialName(String materialName){
|
public Long getSerialNumberMaterialIdByMaterialName(String materialName)throws Exception{
|
||||||
if(StringUtil.isNotEmpty(materialName)){
|
if(StringUtil.isNotEmpty(materialName)){
|
||||||
//计算商品库存和目前占用的可用序列号数量关系
|
//计算商品库存和目前占用的可用序列号数量关系
|
||||||
//库存=入库-出库
|
//库存=入库-出库
|
||||||
@@ -290,14 +428,22 @@ public class SerialNumberService {
|
|||||||
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
||||||
if(depotItem!=null){
|
if(depotItem!=null){
|
||||||
//查询商品下已分配的可用序列号数量
|
//查询商品下已分配的可用序列号数量
|
||||||
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
try{
|
||||||
//BasicNumber=OperNumber*ratio
|
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||||
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
|
//BasicNumber=OperNumber*ratio
|
||||||
//获取商品名称
|
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
|
||||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
//获取商品名称
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||||
|
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||||
|
}
|
||||||
|
}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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//商品下序列号充足,分配序列号
|
//商品下序列号充足,分配序列号
|
||||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||||
}
|
}
|
||||||
@@ -320,7 +466,16 @@ public class SerialNumberService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int sellSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
|
public int sellSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
|
||||||
return serialNumberMapperEx.sellSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = serialNumberMapperEx.sellSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
|
||||||
|
}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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +491,16 @@ public class SerialNumberService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int cancelSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
|
public int cancelSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
|
||||||
return serialNumberMapperEx.cancelSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = serialNumberMapperEx.cancelSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
|
||||||
|
}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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -351,7 +515,7 @@ public class SerialNumberService {
|
|||||||
* @return java.lang.Object
|
* @return java.lang.Object
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark) {
|
public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -386,6 +550,15 @@ public class SerialNumberService {
|
|||||||
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
||||||
list.add(each);
|
list.add(each);
|
||||||
}
|
}
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = serialNumberMapperEx.batAddSerialNumber(list);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
serialNumberMapperEx.batAddSerialNumber(list);
|
serialNumberMapperEx.batAddSerialNumber(list);
|
||||||
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
||||||
}while(batAddTotal>0);
|
}while(batAddTotal>0);
|
||||||
@@ -401,13 +574,22 @@ public class SerialNumberService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteSerialNumberByIds(String ids) {
|
public int batchDeleteSerialNumberByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = serialNumberMapperEx.batchDeleteSerialNumberByIds(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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,105 +47,236 @@ 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)
|
||||||
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn){
|
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn)throws Exception{
|
||||||
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)
|
||||||
public int batchSetEnable(Boolean enabled, String supplierIDs) {
|
public int batchSetEnable(Boolean enabled, String supplierIDs)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -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());
|
||||||
@@ -191,13 +351,22 @@ public class SupplierService {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteSupplierByIds(String ids) {
|
public int batchDeleteSupplierByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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);
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public class SystemConfigComponent implements ICommonQuery {
|
|||||||
private SystemConfigService systemConfigService;
|
private SystemConfigService systemConfigService;
|
||||||
|
|
||||||
@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 getSystemConfigList(map);
|
return getSystemConfigList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getSystemConfigList(Map<String, String> map) {
|
private List<?> getSystemConfigList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String companyName = StringUtil.getInfo(search, "companyName");
|
String companyName = StringUtil.getInfo(search, "companyName");
|
||||||
String order = QueryUtils.order(map);
|
String order = QueryUtils.order(map);
|
||||||
@@ -38,34 +38,34 @@ public class SystemConfigComponent 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 companyName = StringUtil.getInfo(search, "companyName");
|
String companyName = StringUtil.getInfo(search, "companyName");
|
||||||
return systemConfigService.countSystemConfig(companyName);
|
return systemConfigService.countSystemConfig(companyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return systemConfigService.insertSystemConfig(beanJson, request);
|
return systemConfigService.insertSystemConfig(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return systemConfigService.updateSystemConfig(beanJson, id);
|
return systemConfigService.updateSystemConfig(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return systemConfigService.deleteSystemConfig(id);
|
return systemConfigService.deleteSystemConfig(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return systemConfigService.batchDeleteSystemConfig(ids);
|
return systemConfigService.batchDeleteSystemConfig(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return systemConfigService.checkIsNameExist(id, name);
|
return systemConfigService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package com.jsh.erp.service.systemConfig;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
|
import com.jsh.erp.datasource.entities.Supplier;
|
||||||
import com.jsh.erp.datasource.entities.SystemConfig;
|
import com.jsh.erp.datasource.entities.SystemConfig;
|
||||||
import com.jsh.erp.datasource.entities.SystemConfigExample;
|
import com.jsh.erp.datasource.entities.SystemConfigExample;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.mappers.SystemConfigMapper;
|
import com.jsh.erp.datasource.mappers.SystemConfigMapper;
|
||||||
import com.jsh.erp.datasource.mappers.SystemConfigMapperEx;
|
import com.jsh.erp.datasource.mappers.SystemConfigMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -36,63 +39,152 @@ public class SystemConfigService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
public SystemConfig getSystemConfig(long id) {
|
public SystemConfig getSystemConfig(long id)throws Exception {
|
||||||
return systemConfigMapper.selectByPrimaryKey(id);
|
SystemConfig result=null;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapper.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<SystemConfig> getSystemConfig() {
|
public List<SystemConfig> getSystemConfig()throws Exception {
|
||||||
SystemConfigExample example = new SystemConfigExample();
|
SystemConfigExample example = new SystemConfigExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return systemConfigMapper.selectByExample(example);
|
List<SystemConfig> list=null;
|
||||||
|
try{
|
||||||
|
list=systemConfigMapper.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<SystemConfig> select(String companyName, int offset, int rows) {
|
public List<SystemConfig> select(String companyName, int offset, int rows)throws Exception {
|
||||||
return systemConfigMapperEx.selectByConditionSystemConfig(companyName, offset, rows);
|
List<SystemConfig> list=null;
|
||||||
|
try{
|
||||||
|
list=systemConfigMapperEx.selectByConditionSystemConfig(companyName, 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 countSystemConfig(String companyName) {
|
public Long countSystemConfig(String companyName)throws Exception {
|
||||||
return systemConfigMapperEx.countsBySystemConfig(companyName);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapperEx.countsBySystemConfig(companyName);
|
||||||
|
}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 insertSystemConfig(String beanJson, HttpServletRequest request) {
|
public int insertSystemConfig(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||||
return systemConfigMapper.insertSelective(systemConfig);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapper.insertSelective(systemConfig);
|
||||||
|
}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 updateSystemConfig(String beanJson, Long id) {
|
public int updateSystemConfig(String beanJson, Long id) throws Exception{
|
||||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||||
systemConfig.setId(id);
|
systemConfig.setId(id);
|
||||||
return systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
|
||||||
|
}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 deleteSystemConfig(Long id) {
|
public int deleteSystemConfig(Long id)throws Exception {
|
||||||
return systemConfigMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapper.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 batchDeleteSystemConfig(String ids) {
|
public int batchDeleteSystemConfig(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
SystemConfigExample example = new SystemConfigExample();
|
SystemConfigExample example = new SystemConfigExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return systemConfigMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapper.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{
|
||||||
SystemConfigExample example = new SystemConfigExample();
|
SystemConfigExample example = new SystemConfigExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andCompanyNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andCompanyNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<SystemConfig> list = systemConfigMapper.selectByExample(example);
|
List<SystemConfig> list =null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=systemConfigMapper.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)
|
||||||
public int batchDeleteSystemConfigByIds(String ids) {
|
public int batchDeleteSystemConfigByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=systemConfigMapperEx.batchDeleteSystemConfigByIds(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ public class UnitComponent implements ICommonQuery {
|
|||||||
private UnitService unitService;
|
private UnitService unitService;
|
||||||
|
|
||||||
@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 getUnitList(map);
|
return getUnitList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getUnitList(Map<String, String> map) {
|
private List<?> getUnitList(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 order = QueryUtils.order(map);
|
String order = QueryUtils.order(map);
|
||||||
@@ -37,34 +37,34 @@ public class UnitComponent 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");
|
||||||
return unitService.countUnit(name);
|
return unitService.countUnit(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return unitService.insertUnit(beanJson, request);
|
return unitService.insertUnit(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return unitService.updateUnit(beanJson, id);
|
return unitService.updateUnit(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return unitService.deleteUnit(id);
|
return unitService.deleteUnit(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return unitService.batchDeleteUnit(ids);
|
return unitService.batchDeleteUnit(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return unitService.checkIsNameExist(id, name);
|
return unitService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Material;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.Unit;
|
|
||||||
import com.jsh.erp.datasource.entities.UnitExample;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||||
import com.jsh.erp.datasource.mappers.UnitMapper;
|
import com.jsh.erp.datasource.mappers.UnitMapper;
|
||||||
import com.jsh.erp.datasource.mappers.UnitMapperEx;
|
import com.jsh.erp.datasource.mappers.UnitMapperEx;
|
||||||
@@ -43,64 +40,153 @@ public class UnitService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialMapperEx materialMapperEx;
|
private MaterialMapperEx materialMapperEx;
|
||||||
|
|
||||||
public Unit getUnit(long id) {
|
public Unit getUnit(long id)throws Exception {
|
||||||
return unitMapper.selectByPrimaryKey(id);
|
Unit result=null;
|
||||||
|
try{
|
||||||
|
result=unitMapper.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<Unit> getUnit() {
|
public List<Unit> getUnit()throws Exception {
|
||||||
UnitExample example = new UnitExample();
|
UnitExample example = new UnitExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return unitMapper.selectByExample(example);
|
List<Unit> list=null;
|
||||||
|
try{
|
||||||
|
list=unitMapper.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<Unit> select(String name, int offset, int rows) {
|
public List<Unit> select(String name, int offset, int rows)throws Exception {
|
||||||
return unitMapperEx.selectByConditionUnit(name, offset, rows);
|
List<Unit> list=null;
|
||||||
|
try{
|
||||||
|
list=unitMapperEx.selectByConditionUnit(name, 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 countUnit(String name) {
|
public Long countUnit(String name)throws Exception {
|
||||||
return unitMapperEx.countsByUnit(name);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=unitMapperEx.countsByUnit(name);
|
||||||
|
}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 insertUnit(String beanJson, HttpServletRequest request) {
|
public int insertUnit(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
||||||
return unitMapper.insertSelective(unit);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=unitMapper.insertSelective(unit);
|
||||||
|
}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 updateUnit(String beanJson, Long id) {
|
public int updateUnit(String beanJson, Long id)throws Exception {
|
||||||
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
||||||
unit.setId(id);
|
unit.setId(id);
|
||||||
return unitMapper.updateByPrimaryKeySelective(unit);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=unitMapper.updateByPrimaryKeySelective(unit);
|
||||||
|
}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 deleteUnit(Long id) {
|
public int deleteUnit(Long id)throws Exception {
|
||||||
return unitMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=unitMapper.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 batchDeleteUnit(String ids) {
|
public int batchDeleteUnit(String ids) throws Exception{
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
UnitExample example = new UnitExample();
|
UnitExample example = new UnitExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return unitMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=unitMapper.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 {
|
||||||
UnitExample example = new UnitExample();
|
UnitExample example = new UnitExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Unit> list = unitMapper.selectByExample(example);
|
List<Unit> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list=unitMapper.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)
|
||||||
public int batchDeleteUnitByIds(String ids) {
|
public int batchDeleteUnitByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_UNIT,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_UNIT,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 unitMapperEx.batchDeleteUnitByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=unitMapperEx.batchDeleteUnitByIds(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,7 +213,15 @@ public class UnitService {
|
|||||||
/**
|
/**
|
||||||
* 校验产品表 jsh_material
|
* 校验产品表 jsh_material
|
||||||
* */
|
* */
|
||||||
List<Material> materialList=materialMapperEx.getMaterialListByUnitIds(idArray);
|
List<Material> materialList=null;
|
||||||
|
try{
|
||||||
|
materialList=materialMapperEx.getMaterialListByUnitIds(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(materialList!=null&&materialList.size()>0){
|
if(materialList!=null&&materialList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,UnitIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,UnitIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
@@ -18,16 +18,16 @@ public class UserComponent implements ICommonQuery {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@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 getUserList(map);
|
return getUserList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getUserList(Map<String, String> map) {
|
private List<?> getUserList(Map<String, String> map)throws Exception {
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String userName = StringUtil.getInfo(search, "userName");
|
String userName = StringUtil.getInfo(search, "userName");
|
||||||
String loginName = StringUtil.getInfo(search, "loginName");
|
String loginName = StringUtil.getInfo(search, "loginName");
|
||||||
@@ -37,7 +37,7 @@ public class UserComponent 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 userName = StringUtil.getInfo(search, "userName");
|
String userName = StringUtil.getInfo(search, "userName");
|
||||||
String loginName = StringUtil.getInfo(search, "loginName");
|
String loginName = StringUtil.getInfo(search, "loginName");
|
||||||
@@ -45,27 +45,27 @@ public class UserComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return userService.insertUser(beanJson, request);
|
return userService.insertUser(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return userService.updateUser(beanJson, id);
|
return userService.updateUser(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return userService.deleteUser(id);
|
return userService.deleteUser(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return userService.batchDeleteUser(ids);
|
return userService.batchDeleteUser(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return userService.checkIsNameExist(id, name);
|
return userService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,17 @@ import com.jsh.erp.datasource.entities.UserEx;
|
|||||||
import com.jsh.erp.datasource.entities.UserExample;
|
import com.jsh.erp.datasource.entities.UserExample;
|
||||||
import com.jsh.erp.datasource.mappers.UserMapper;
|
import com.jsh.erp.datasource.mappers.UserMapper;
|
||||||
import com.jsh.erp.datasource.mappers.UserMapperEx;
|
import com.jsh.erp.datasource.mappers.UserMapperEx;
|
||||||
import com.jsh.erp.datasource.vo.TreeNode;
|
|
||||||
import com.jsh.erp.datasource.vo.TreeNodeEx;
|
import com.jsh.erp.datasource.vo.TreeNodeEx;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
||||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.ExceptionCodeConstants;
|
||||||
|
import com.jsh.erp.utils.JshException;
|
||||||
|
import com.jsh.erp.utils.StringUtil;
|
||||||
|
import com.jsh.erp.utils.Tools;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
@@ -28,9 +29,11 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserService {
|
public class UserService {
|
||||||
@@ -51,21 +54,57 @@ public class UserService {
|
|||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
|
|
||||||
public User getUser(long id) {
|
public User getUser(long id)throws Exception {
|
||||||
return userMapper.selectByPrimaryKey(id);
|
User result=null;
|
||||||
|
try{
|
||||||
|
result=userMapper.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<User> getUser() {
|
public List<User> getUser()throws Exception {
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
return userMapper.selectByExample(example);
|
List<User> list=null;
|
||||||
|
try{
|
||||||
|
list=userMapper.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<User> select(String userName, String loginName, int offset, int rows) {
|
public List<User> select(String userName, String loginName, int offset, int rows)throws Exception {
|
||||||
return userMapperEx.selectByConditionUser(userName, loginName, offset, rows);
|
List<User> list=null;
|
||||||
|
try{
|
||||||
|
list=userMapperEx.selectByConditionUser(userName, loginName, 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 countUser(String userName, String loginName) {
|
public Long countUser(String userName, String loginName)throws Exception {
|
||||||
return userMapperEx.countsByUser(userName, loginName);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=userMapperEx.countsByUser(userName, loginName);
|
||||||
|
}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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -77,7 +116,7 @@ public class UserService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertUser(String beanJson, HttpServletRequest request) {
|
public int insertUser(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
User user = JSONObject.parseObject(beanJson, User.class);
|
User user = JSONObject.parseObject(beanJson, User.class);
|
||||||
String password = "123456";
|
String password = "123456";
|
||||||
//因密码用MD5加密,需要对密码进行转化
|
//因密码用MD5加密,需要对密码进行转化
|
||||||
@@ -88,7 +127,16 @@ public class UserService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage());
|
logger.error(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage());
|
||||||
}
|
}
|
||||||
return userMapper.insertSelective(user);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userMapper.insertSelective(user);
|
||||||
|
}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: cjl
|
* create by: cjl
|
||||||
@@ -100,10 +148,19 @@ public class UserService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateUser(String beanJson, Long id) {
|
public int updateUser(String beanJson, Long id) throws Exception{
|
||||||
User user = JSONObject.parseObject(beanJson, User.class);
|
User user = JSONObject.parseObject(beanJson, User.class);
|
||||||
user.setId(id);
|
user.setId(id);
|
||||||
return userMapper.updateByPrimaryKeySelective(user);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}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: cjl
|
* create by: cjl
|
||||||
@@ -114,11 +171,20 @@ public class UserService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateUserByObj(User user) {
|
public int updateUserByObj(User user) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
return userMapper.updateByPrimaryKeySelective(user);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}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: cjl
|
* create by: cjl
|
||||||
@@ -130,27 +196,54 @@ public class UserService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int resetPwd(String md5Pwd, Long id) {
|
public int resetPwd(String md5Pwd, Long id) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setId(id);
|
user.setId(id);
|
||||||
user.setPassword(md5Pwd);
|
user.setPassword(md5Pwd);
|
||||||
return userMapper.updateByPrimaryKeySelective(user);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}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 deleteUser(Long id) {
|
public int deleteUser(Long id)throws Exception {
|
||||||
return userMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= userMapper.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 batchDeleteUser(String ids) {
|
public int batchDeleteUser(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return userMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= userMapper.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 validateUser(String username, String password) throws JshException {
|
public int validateUser(String username, String password) throws JshException {
|
||||||
@@ -162,6 +255,8 @@ public class UserService {
|
|||||||
example.createCriteria().andLoginameEqualTo(username);
|
example.createCriteria().andLoginameEqualTo(username);
|
||||||
list = userMapper.selectByExample(example);
|
list = userMapper.selectByExample(example);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||||
}
|
}
|
||||||
@@ -188,22 +283,41 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUserByUserName(String username) {
|
public User getUserByUserName(String username)throws Exception {
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
example.createCriteria().andLoginameEqualTo(username);
|
example.createCriteria().andLoginameEqualTo(username);
|
||||||
List<User> list = userMapper.selectByExample(example);
|
List<User> list=null;
|
||||||
User user = list.get(0);
|
try{
|
||||||
|
list= userMapper.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);
|
||||||
|
}
|
||||||
|
User user =null;
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
user = list.get(0);
|
||||||
|
}
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
List <Byte> userStatus=new ArrayList<Byte>();
|
List <Byte> userStatus=new ArrayList<Byte>();
|
||||||
userStatus.add(BusinessConstants.USER_STATUS_DELETE);
|
userStatus.add(BusinessConstants.USER_STATUS_DELETE);
|
||||||
userStatus.add(BusinessConstants.USER_STATUS_BANNED);
|
userStatus.add(BusinessConstants.USER_STATUS_BANNED);
|
||||||
example.createCriteria().andIdNotEqualTo(id).andLoginameEqualTo(name).andStatusNotIn(userStatus);
|
example.createCriteria().andIdNotEqualTo(id).andLoginameEqualTo(name).andStatusNotIn(userStatus);
|
||||||
List<User> list = userMapper.selectByExample(example);
|
List<User> list=null;
|
||||||
return list.size();
|
try{
|
||||||
|
list= userMapper.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();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: cjl
|
* create by: cjl
|
||||||
@@ -213,13 +327,22 @@ public class UserService {
|
|||||||
* @Param:
|
* @Param:
|
||||||
* @return com.jsh.erp.datasource.entities.User
|
* @return com.jsh.erp.datasource.entities.User
|
||||||
*/
|
*/
|
||||||
public User getCurrentUser(){
|
public User getCurrentUser()throws Exception{
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||||
return (User)request.getSession().getAttribute("user");
|
return (User)request.getSession().getAttribute("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserEx> getUserList(Map<String, Object> parameterMap) throws Exception{
|
public List<UserEx> getUserList(Map<String, Object> parameterMap) throws Exception{
|
||||||
return userMapperEx.getUserList(parameterMap);
|
List<UserEx> list=null;
|
||||||
|
try{
|
||||||
|
list= userMapperEx.getUserList(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 void addUserAndOrgUserRel(UserEx ue) throws Exception{
|
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
|
||||||
@@ -277,8 +400,16 @@ public class UserService {
|
|||||||
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
||||||
}
|
}
|
||||||
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
|
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
|
||||||
int i=userMapperEx.addUser(ue);
|
int result=0;
|
||||||
if(i>0){
|
try{
|
||||||
|
result= userMapperEx.addUser(ue);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return ue;
|
return ue;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -303,7 +434,15 @@ public class UserService {
|
|||||||
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
||||||
}
|
}
|
||||||
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
|
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
|
||||||
int i = userMapperEx.addUser(ue);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= userMapperEx.addUser(ue);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
//更新租户id
|
//更新租户id
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setId(ue.getId());
|
user.setId(ue.getId());
|
||||||
@@ -317,7 +456,7 @@ public class UserService {
|
|||||||
ubArr.add(manageRoleId);
|
ubArr.add(manageRoleId);
|
||||||
ubObj.put("value", ubArr.toString());
|
ubObj.put("value", ubArr.toString());
|
||||||
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
if (i > 0) {
|
if (result > 0) {
|
||||||
return ue;
|
return ue;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -328,7 +467,14 @@ public class UserService {
|
|||||||
public void updateUserTenant(User user) throws Exception{
|
public void updateUserTenant(User user) throws Exception{
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
example.createCriteria().andIdEqualTo(user.getId());
|
example.createCriteria().andIdEqualTo(user.getId());
|
||||||
userMapper.updateByPrimaryKeySelective(user);
|
try{
|
||||||
|
userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
@@ -380,9 +526,17 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public UserEx updateUser(UserEx ue){
|
public UserEx updateUser(UserEx ue)throws Exception{
|
||||||
int i=userMapperEx.updateUser(ue);
|
int result =0;
|
||||||
if(i>0){
|
try{
|
||||||
|
result=userMapperEx.updateUser(ue);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result>0){
|
||||||
return ue;
|
return ue;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -395,7 +549,7 @@ public class UserService {
|
|||||||
* @Param: userEx
|
* @Param: userEx
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public void checkUserNameAndLoginName(UserEx userEx){
|
public void checkUserNameAndLoginName(UserEx userEx)throws Exception{
|
||||||
List<User> list=null;
|
List<User> list=null;
|
||||||
if(userEx==null){
|
if(userEx==null){
|
||||||
return;
|
return;
|
||||||
@@ -454,26 +608,52 @@ public class UserService {
|
|||||||
/**
|
/**
|
||||||
* 通过用户名获取用户列表
|
* 通过用户名获取用户列表
|
||||||
* */
|
* */
|
||||||
public List<User> getUserListByUserName(String userName){
|
public List<User> getUserListByUserName(String userName)throws Exception{
|
||||||
return userMapperEx.getUserListByUserNameOrLoginName(userName,null);
|
List<User> list =null;
|
||||||
|
try{
|
||||||
|
list=userMapperEx.getUserListByUserNameOrLoginName(userName,null);
|
||||||
|
}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<User> getUserListByloginName(String loginName){
|
public List<User> getUserListByloginName(String loginName){
|
||||||
return userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
|
List<User> list =null;
|
||||||
|
try{
|
||||||
|
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
|
||||||
|
}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 void batDeleteUser(String ids) {
|
public void batDeleteUser(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
String idsArray[]=ids.split(",");
|
String idsArray[]=ids.split(",");
|
||||||
int i= userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE);
|
int result =0;
|
||||||
if(i<1){
|
try{
|
||||||
|
result=userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
if(result<1){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,ids:[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,ids:[{}]",
|
||||||
ExceptionConstants.USER_DELETE_FAILED_CODE,ExceptionConstants.USER_DELETE_FAILED_MSG,ids);
|
ExceptionConstants.USER_DELETE_FAILED_CODE,ExceptionConstants.USER_DELETE_FAILED_MSG,ids);
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.USER_DELETE_FAILED_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.USER_DELETE_FAILED_CODE,
|
||||||
@@ -481,7 +661,16 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TreeNodeEx> getOrganizationUserTree() {
|
public List<TreeNodeEx> getOrganizationUserTree()throws Exception {
|
||||||
return userMapperEx.getNodeTree();
|
List<TreeNodeEx> list =null;
|
||||||
|
try{
|
||||||
|
list=userMapperEx.getNodeTree();
|
||||||
|
}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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,46 +22,46 @@ public class UserBusinessComponent implements ICommonQuery {
|
|||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
@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 getUserBusinessList(map);
|
return getUserBusinessList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getUserBusinessList(Map<String, String> map) {
|
private List<?> getUserBusinessList(Map<String, String> map)throws Exception {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long counts(Map<String, String> map) {
|
public Long counts(Map<String, String> map)throws Exception {
|
||||||
return BusinessConstants.DEFAULT_LIST_NULL_NUMBER;
|
return BusinessConstants.DEFAULT_LIST_NULL_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception {
|
||||||
return userBusinessService.insertUserBusiness(beanJson, request);
|
return userBusinessService.insertUserBusiness(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return userBusinessService.updateUserBusiness(beanJson, id);
|
return userBusinessService.updateUserBusiness(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return userBusinessService.deleteUserBusiness(id);
|
return userBusinessService.deleteUserBusiness(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return userBusinessService.batchDeleteUserBusiness(ids);
|
return userBusinessService.batchDeleteUserBusiness(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return userBusinessService.checkIsNameExist(id, name);
|
return userBusinessService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,14 @@ package com.jsh.erp.service.userBusiness;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.App;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Functions;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
|
||||||
import com.jsh.erp.datasource.entities.UserBusinessExample;
|
|
||||||
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
|
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
|
||||||
|
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.CommonQueryManager;
|
import com.jsh.erp.service.CommonQueryManager;
|
||||||
import com.jsh.erp.service.app.AppService;
|
import com.jsh.erp.service.app.AppService;
|
||||||
import com.jsh.erp.service.functions.FunctionsService;
|
import com.jsh.erp.service.functions.FunctionsService;
|
||||||
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
|
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -25,11 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserBusinessService {
|
public class UserBusinessService {
|
||||||
@@ -53,77 +47,145 @@ public class UserBusinessService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonQueryManager configResourceManager;
|
private CommonQueryManager configResourceManager;
|
||||||
|
|
||||||
public UserBusiness getUserBusiness(long id) {
|
public UserBusiness getUserBusiness(long id)throws Exception {
|
||||||
return userBusinessMapper.selectByPrimaryKey(id);
|
UserBusiness result=null;
|
||||||
|
try{
|
||||||
|
result=userBusinessMapper.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<UserBusiness> getUserBusiness() {
|
public List<UserBusiness> getUserBusiness()throws Exception {
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return userBusinessMapper.selectByExample(example);
|
List<UserBusiness> list=null;
|
||||||
}
|
try{
|
||||||
|
list=userBusinessMapper.selectByExample(example);
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
}catch(Exception e){
|
||||||
public int insertUserBusiness(String beanJson, HttpServletRequest request) {
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
int inserts = userBusinessMapper.insertSelective(userBusiness);
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
// 更新应用权限
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && inserts > 0) {
|
|
||||||
inserts = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
|
|
||||||
}
|
}
|
||||||
return inserts;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public int updateUserBusiness(String beanJson, Long id) {
|
|
||||||
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
|
||||||
userBusiness.setId(id);
|
|
||||||
int updates = userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
|
||||||
// 更新应用权限
|
|
||||||
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && updates > 0) {
|
|
||||||
updates = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
|
|
||||||
}
|
|
||||||
return updates;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public int deleteUserBusiness(Long id) {
|
|
||||||
return userBusinessMapper.deleteByPrimaryKey(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public int batchDeleteUserBusiness(String ids) {
|
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
|
||||||
example.createCriteria().andIdIn(idList);
|
|
||||||
return userBusinessMapper.deleteByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int checkIsNameExist(Long id, String name) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<UserBusiness> getBasicData(String keyId, String type){
|
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
|
||||||
example.createCriteria().andKeyidEqualTo(keyId).andTypeEqualTo(type)
|
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
|
||||||
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long checkIsValueExist(String type, String keyId) {
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public int insertUserBusiness(String beanJson, HttpServletRequest request) throws Exception {
|
||||||
|
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userBusinessMapper.insertSelective(userBusiness);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
// 更新应用权限
|
||||||
|
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
|
||||||
|
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public int updateUserBusiness(String beanJson, Long id) throws Exception {
|
||||||
|
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
||||||
|
userBusiness.setId(id);
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
// 更新应用权限
|
||||||
|
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
|
||||||
|
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public int deleteUserBusiness(Long id)throws Exception {
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userBusinessMapper.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)
|
||||||
|
public int batchDeleteUserBusiness(String ids)throws Exception {
|
||||||
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
|
example.createCriteria().andIdIn(idList);
|
||||||
|
int result=0;
|
||||||
|
try{
|
||||||
|
result=userBusinessMapper.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)throws Exception {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserBusiness> getBasicData(String keyId, String type)throws Exception{
|
||||||
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
|
example.createCriteria().andKeyidEqualTo(keyId).andTypeEqualTo(type)
|
||||||
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
|
List<UserBusiness> list=null;
|
||||||
|
try{
|
||||||
|
list= userBusinessMapper.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 Long checkIsValueExist(String type, String keyId)throws Exception {
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
example.createCriteria().andTypeEqualTo(type).andKeyidEqualTo(keyId)
|
example.createCriteria().andTypeEqualTo(type).andKeyidEqualTo(keyId)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
|
List<UserBusiness> list=null;
|
||||||
|
try{
|
||||||
|
list= userBusinessMapper.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);
|
||||||
|
}
|
||||||
Long id = null;
|
Long id = null;
|
||||||
if(list.size() > 0) {
|
if(list!=null&&list.size() > 0) {
|
||||||
id = list.get(0).getId();
|
id = list.get(0).getId();
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean checkIsUserBusinessExist(String TypeVale, String KeyIdValue, String UBValue) {
|
public Boolean checkIsUserBusinessExist(String TypeVale, String KeyIdValue, String UBValue)throws Exception {
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
String newVaule = "%" + UBValue + "%";
|
String newVaule = "%" + UBValue + "%";
|
||||||
if(TypeVale !=null && KeyIdValue !=null) {
|
if(TypeVale !=null && KeyIdValue !=null) {
|
||||||
@@ -133,8 +195,16 @@ public class UserBusinessService {
|
|||||||
example.createCriteria().andValueLike(newVaule)
|
example.createCriteria().andValueLike(newVaule)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
|
List<UserBusiness> list=null;
|
||||||
if(list.size() > 0) {
|
try{
|
||||||
|
list= userBusinessMapper.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);
|
||||||
|
}
|
||||||
|
if(list!=null&&list.size() > 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -142,7 +212,7 @@ public class UserBusinessService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateBtnStr(Long userBusinessId, String btnStr) {
|
public int updateBtnStr(Long userBusinessId, String btnStr) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -150,34 +220,68 @@ public class UserBusinessService {
|
|||||||
userBusiness.setBtnstr(btnStr);
|
userBusiness.setBtnstr(btnStr);
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
example.createCriteria().andIdEqualTo(userBusinessId);
|
example.createCriteria().andIdEqualTo(userBusinessId);
|
||||||
return userBusinessMapper.updateByExampleSelective(userBusiness, example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= userBusinessMapper.updateByExampleSelective(userBusiness, 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<UserBusiness> findRoleByUserId(String userId){
|
public List<UserBusiness> findRoleByUserId(String userId)throws Exception{
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
example.createCriteria().andKeyidEqualTo(userId).andTypeEqualTo("UserRole")
|
example.createCriteria().andKeyidEqualTo(userId).andTypeEqualTo("UserRole")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
|
List<UserBusiness> list=null;
|
||||||
|
try{
|
||||||
|
list= userBusinessMapper.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<UserBusiness> findAppByRoles(String roles){
|
public List<UserBusiness> findAppByRoles(String roles)throws Exception{
|
||||||
List<String> rolesList = StringUtil.strToStringList(roles);
|
List<String> rolesList = StringUtil.strToStringList(roles);
|
||||||
UserBusinessExample example = new UserBusinessExample();
|
UserBusinessExample example = new UserBusinessExample();
|
||||||
example.createCriteria().andKeyidIn(rolesList).andTypeEqualTo("RoleAPP")
|
example.createCriteria().andKeyidIn(rolesList).andTypeEqualTo("RoleAPP")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
|
List<UserBusiness> list=null;
|
||||||
|
try{
|
||||||
|
list= userBusinessMapper.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteUserBusinessByIds(String ids) {
|
public int batchDeleteUserBusinessByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((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 userBusinessMapperEx.batchDeleteUserBusinessByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result= userBusinessMapperEx.batchDeleteUserBusinessByIds(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,49 +291,46 @@ public class UserBusinessService {
|
|||||||
* @param functionIds
|
* @param functionIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int insertOrUpdateAppValue(String type, String keyId, String functionIds) {
|
public int insertOrUpdateAppValue(String type, String keyId, String functionIds) throws Exception{
|
||||||
|
int result=0;
|
||||||
int updates = 0;
|
|
||||||
|
|
||||||
functionIds = functionIds.replaceAll("\\]\\[", ",").
|
functionIds = functionIds.replaceAll("\\]\\[", ",").
|
||||||
replaceAll("\\[","").replaceAll("\\]","");
|
replaceAll("\\[","").replaceAll("\\]","");
|
||||||
|
|
||||||
List<Functions> functionsList = functionsService.findByIds(functionIds);
|
List<Functions> functionsList = functionsService.findByIds(functionIds);
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(functionsList)) {
|
if (!CollectionUtils.isEmpty(functionsList)) {
|
||||||
|
|
||||||
Set<String> appNumbers = new HashSet<>();
|
Set<String> appNumbers = new HashSet<>();
|
||||||
String appNumber;
|
String appNumber;
|
||||||
for (Functions functions : functionsList) {
|
for (Functions functions : functionsList) {
|
||||||
|
|
||||||
appNumber = functions.getNumber().substring(0, 2);
|
appNumber = functions.getNumber().substring(0, 2);
|
||||||
appNumbers.add(appNumber);
|
appNumbers.add(appNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> appNumberList = new ArrayList<>(appNumbers);
|
List<String> appNumberList = new ArrayList<>(appNumbers);
|
||||||
List<App> appList = appService.findAppByNumber(appNumberList);
|
List<App> appList = appService.findAppByNumber(appNumberList);
|
||||||
|
|
||||||
StringBuilder appIdSb = new StringBuilder();
|
StringBuilder appIdSb = new StringBuilder();
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(appList)) {
|
if (!CollectionUtils.isEmpty(appList)) {
|
||||||
for (App app : appList) {
|
for (App app : appList) {
|
||||||
appIdSb.append("[" + app.getId() + "]");
|
appIdSb.append("[" + app.getId() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserBusiness> userBusinessList = getBasicData(keyId, type);
|
List<UserBusiness> userBusinessList = getBasicData(keyId, type);
|
||||||
if(userBusinessList.size() > 0) {
|
try{
|
||||||
UserBusiness userBusiness = userBusinessList.get(0);
|
if(userBusinessList.size() > 0) {
|
||||||
userBusiness.setValue(appIdSb.toString());
|
UserBusiness userBusiness = userBusinessList.get(0);
|
||||||
updates = userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
userBusiness.setValue(appIdSb.toString());
|
||||||
} else {
|
result = userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
||||||
UserBusiness userBusiness = new UserBusiness();
|
} else {
|
||||||
userBusiness.setType(type);
|
UserBusiness userBusiness = new UserBusiness();
|
||||||
userBusiness.setKeyid(keyId);
|
userBusiness.setType(type);
|
||||||
userBusiness.setValue(appIdSb.toString());
|
userBusiness.setKeyid(keyId);
|
||||||
updates = userBusinessMapper.insertSelective(userBusiness);
|
userBusiness.setValue(appIdSb.toString());
|
||||||
|
result = userBusinessMapper.insertSelective(userBusiness);
|
||||||
|
}
|
||||||
|
}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 updates;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user