添加事务控制
This commit is contained in:
parent
5df1748c79
commit
85d96bb226
@ -7,7 +7,7 @@
|
||||
<link href="/js/HoorayOS_mini/img/ui/index.css" rel="stylesheet"/>
|
||||
<style>
|
||||
#user-name-span{
|
||||
text-align:left;
|
||||
text-align:center;
|
||||
color:white;
|
||||
position:absolute;
|
||||
top:435px;
|
||||
|
||||
@ -96,7 +96,7 @@ public class AccountHeadController {
|
||||
|
||||
/**
|
||||
* 根据编号查询单据信息
|
||||
* @param number
|
||||
* @param billNo
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ -124,8 +124,8 @@ public class AccountHeadController {
|
||||
* 统计总金额
|
||||
* @param getS
|
||||
* @param type
|
||||
* @param subType
|
||||
* @param mode 合计或者金额
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public Double allMoney(String getS, String type, String mode, String endTime) {
|
||||
|
||||
@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -31,7 +32,19 @@ public class AccountItemController {
|
||||
|
||||
@Resource
|
||||
private AccountItemService accountItemService;
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 业务逻辑操作放在service层,controller只做参数解析和视图封装
|
||||
* create time: 2019/1/11 15:08
|
||||
* @Param: inserted
|
||||
* @Param: deleted
|
||||
* @Param: updated
|
||||
* @Param: headerId
|
||||
* @Param: listType
|
||||
* @Param: request
|
||||
* @return java.lang.String
|
||||
*/
|
||||
@PostMapping(value = "/saveDetials")
|
||||
public String saveDetials(@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@ -39,67 +52,10 @@ public class AccountItemController {
|
||||
@RequestParam("headerId") Long headerId,
|
||||
@RequestParam("listType") String listType,
|
||||
HttpServletRequest request) {
|
||||
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
try {
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
AccountItem accountItem = new AccountItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
accountItem.setHeaderid(headerId);
|
||||
if (tempInsertedJson.get("AccountId") != null && !tempInsertedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempInsertedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempInsertedJson.get("InOutItemId") != null && !tempInsertedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempInsertedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempInsertedJson.get("EachAmount") != null && !tempInsertedJson.get("EachAmount").equals("")) {
|
||||
Double eachAmount = tempInsertedJson.getDouble("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = 0 - eachAmount;
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(0.0);
|
||||
}
|
||||
accountItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
accountItemService.insertAccountItemWithObj(accountItem);
|
||||
}
|
||||
}
|
||||
if (null != deletedJson) {
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
accountItemService.deleteAccountItem(tempDeletedJson.getLong("Id"));
|
||||
}
|
||||
}
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
AccountItem accountItem = accountItemService.getAccountItem(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setHeaderid(headerId);
|
||||
if (tempUpdatedJson.get("AccountId") != null && !tempUpdatedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempUpdatedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("InOutItemId") != null && !tempUpdatedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempUpdatedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("EachAmount") != null && !tempUpdatedJson.get("EachAmount").equals("")) {
|
||||
Double eachAmount = tempUpdatedJson.getDouble("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = 0 - eachAmount;
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(0.0);
|
||||
}
|
||||
accountItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
accountItemService.updateAccountItemWithObj(accountItem);
|
||||
}
|
||||
}
|
||||
accountItemService.saveDetials(inserted,deleted,updated,headerId,listType);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} catch (DataAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -31,8 +32,7 @@ public class DepotItemController {
|
||||
@Resource
|
||||
private DepotItemService depotItemService;
|
||||
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据材料信息获取
|
||||
@ -258,163 +258,7 @@ public class DepotItemController {
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
try {
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getDouble("OperNumber"));
|
||||
try {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
Double oNumber = tempInsertedJson.getDouble("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber * ratio); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempInsertedJson.getDouble("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempInsertedJson.getDouble("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempInsertedJson.getDouble("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempInsertedJson.getDouble("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempInsertedJson.getDouble("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempInsertedJson.getDouble("TaxLastMoney"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField1") != null) {
|
||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField2") != null) {
|
||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField3") != null) {
|
||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField4") != null) {
|
||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField5") != null) {
|
||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||
}
|
||||
if (tempInsertedJson.get("MType") != null) {
|
||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||
}
|
||||
depotItemService.insertDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
if (null != deletedJson) {
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
depotItemService.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||
}
|
||||
}
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
DepotItem depotItem = depotItemService.getDepotItem(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getDouble("OperNumber"));
|
||||
try {
|
||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||
Double oNumber = tempUpdatedJson.getDouble("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber * ratio); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempUpdatedJson.getDouble("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempUpdatedJson.getDouble("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempUpdatedJson.getDouble("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempUpdatedJson.getDouble("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempUpdatedJson.getDouble("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempUpdatedJson.getDouble("TaxLastMoney"));
|
||||
}
|
||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
depotItemService.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
|
||||
depotItemService.saveDetials(inserted,deleted,updated,headerId);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} catch (DataAccessException e) {
|
||||
e.printStackTrace();
|
||||
@ -423,26 +267,7 @@ public class DepotItemController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计量单位信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String findUnitName(Long mId) {
|
||||
String unitName = "";
|
||||
try {
|
||||
unitName = materialService.findUnitName(mId);
|
||||
if (unitName != null) {
|
||||
unitName = unitName.substring(1, unitName.length() - 1);
|
||||
if (unitName.equals("null")) {
|
||||
unitName = "";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return unitName;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getDetailList")
|
||||
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
||||
|
||||
@ -2,6 +2,7 @@ package com.jsh.erp.service;
|
||||
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -63,6 +64,7 @@ public class CommonQueryManager {
|
||||
* @param beanJson
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insert(String apiName, String beanJson, HttpServletRequest request) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).insert(beanJson, request);
|
||||
@ -77,6 +79,7 @@ public class CommonQueryManager {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int update(String apiName, String beanJson, Long id) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).update(beanJson, id);
|
||||
@ -90,6 +93,7 @@ public class CommonQueryManager {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int delete(String apiName, Long id) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).delete(id);
|
||||
@ -103,6 +107,7 @@ public class CommonQueryManager {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDelete(String apiName, String ids) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).batchDelete(ids);
|
||||
|
||||
@ -15,6 +15,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -73,6 +74,7 @@ public class AccountService {
|
||||
return accountMapper.countsByAccount(name, serialNo, remark);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccount(String beanJson, HttpServletRequest request) {
|
||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||
if(account.getInitialamount() == null) {
|
||||
@ -82,16 +84,19 @@ public class AccountService {
|
||||
return accountMapper.insertSelective(account);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAccount(String beanJson, Long id) {
|
||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||
account.setId(id);
|
||||
return accountMapper.updateByPrimaryKeySelective(account);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteAccount(Long id) {
|
||||
return accountMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccount(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
AccountExample example = new AccountExample();
|
||||
@ -296,6 +301,7 @@ public class AccountService {
|
||||
return accountMapper.findAccountInOutListCount(accountId);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAmountIsDefault(Boolean isDefault, Long accountId) {
|
||||
Account account = new Account();
|
||||
account.setIsdefault(isDefault);
|
||||
|
||||
@ -10,6 +10,7 @@ import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -53,21 +54,25 @@ public class AccountHeadService {
|
||||
return accountHeadMapper.countsByAccountHead(type, billNo, beginTime, endTime);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccountHead(String beanJson, HttpServletRequest request) {
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
return accountHeadMapper.insertSelective(accountHead);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAccountHead(String beanJson, Long id) {
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
accountHead.setId(id);
|
||||
return accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteAccountHead(Long id) {
|
||||
return accountHeadMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccountHead(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
AccountHeadExample example = new AccountHeadExample();
|
||||
|
||||
@ -1,19 +1,25 @@
|
||||
package com.jsh.erp.service.accountItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.AccountItem;
|
||||
import com.jsh.erp.datasource.entities.AccountItemExample;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapper;
|
||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
@Service
|
||||
public class AccountItemService {
|
||||
private Logger logger = LoggerFactory.getLogger(AccountItemService.class);
|
||||
@ -38,21 +44,25 @@ public class AccountItemService {
|
||||
return accountItemMapper.countsByAccountItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccountItem(String beanJson, HttpServletRequest request) {
|
||||
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
||||
return accountItemMapper.insertSelective(accountItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAccountItem(String beanJson, Long id) {
|
||||
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
|
||||
accountItem.setId(id);
|
||||
return accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteAccountItem(Long id) {
|
||||
return accountItemMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccountItem(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
AccountItemExample example = new AccountItemExample();
|
||||
@ -67,10 +77,12 @@ public class AccountItemService {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccountItemWithObj(AccountItem accountItem) {
|
||||
return accountItemMapper.insertSelective(accountItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAccountItemWithObj(AccountItem accountItem) {
|
||||
return accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
||||
}
|
||||
@ -78,4 +90,69 @@ public class AccountItemService {
|
||||
public List<AccountItemVo4List> getDetailList(Long headerId) {
|
||||
return accountItemMapper.getDetailList(headerId);
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws DataAccessException {
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
AccountItem accountItem = new AccountItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
accountItem.setHeaderid(headerId);
|
||||
if (tempInsertedJson.get("AccountId") != null && !tempInsertedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempInsertedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempInsertedJson.get("InOutItemId") != null && !tempInsertedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempInsertedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempInsertedJson.get("EachAmount") != null && !tempInsertedJson.get("EachAmount").equals("")) {
|
||||
Double eachAmount = tempInsertedJson.getDouble("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = 0 - eachAmount;
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(0.0);
|
||||
}
|
||||
accountItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
this.insertAccountItemWithObj(accountItem);
|
||||
}
|
||||
}
|
||||
if (null != deletedJson) {
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
this.deleteAccountItem(tempDeletedJson.getLong("Id"));
|
||||
}
|
||||
}
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
AccountItem accountItem = this.getAccountItem(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setHeaderid(headerId);
|
||||
if (tempUpdatedJson.get("AccountId") != null && !tempUpdatedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempUpdatedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("InOutItemId") != null && !tempUpdatedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempUpdatedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("EachAmount") != null && !tempUpdatedJson.get("EachAmount").equals("")) {
|
||||
Double eachAmount = tempUpdatedJson.getDouble("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = 0 - eachAmount;
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(0.0);
|
||||
}
|
||||
accountItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
this.updateAccountItemWithObj(accountItem);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -53,21 +54,25 @@ public class AppService {
|
||||
return appMapper.countsByApp(name, type);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertApp(String beanJson, HttpServletRequest request) {
|
||||
App app = JSONObject.parseObject(beanJson, App.class);
|
||||
return appMapper.insertSelective(app);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateApp(String beanJson, Long id) {
|
||||
App app = JSONObject.parseObject(beanJson, App.class);
|
||||
app.setId(id);
|
||||
return appMapper.updateByPrimaryKeySelective(app);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteApp(Long id) {
|
||||
return appMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteApp(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
AppExample example = new AppExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -43,21 +44,25 @@ public class DepotService {
|
||||
return depotMapper.countsByDepot(name, type, remark);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertDepot(String beanJson, HttpServletRequest request) {
|
||||
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
||||
return depotMapper.insertSelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateDepot(String beanJson, Long id) {
|
||||
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
|
||||
depot.setId(id);
|
||||
return depotMapper.updateByPrimaryKeySelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteDepot(Long id) {
|
||||
return depotMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteDepot(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
DepotExample example = new DepotExample();
|
||||
|
||||
@ -15,6 +15,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -71,6 +72,7 @@ public class DepotHeadService {
|
||||
return depotHeadMapper.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertDepotHead(String beanJson, HttpServletRequest request) {
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
@ -85,16 +87,19 @@ public class DepotHeadService {
|
||||
return depotHeadMapper.insertSelective(depotHead);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateDepotHead(String beanJson, Long id) {
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
depotHead.setId(id);
|
||||
return depotHeadMapper.updateByPrimaryKeySelective(depotHead);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteDepotHead(Long id) {
|
||||
return depotHeadMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteDepotHead(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
@ -109,6 +114,7 @@ public class DepotHeadService {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String depotHeadIDs) {
|
||||
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
|
||||
DepotHead depotHead = new DepotHead();
|
||||
|
||||
@ -1,19 +1,26 @@
|
||||
package com.jsh.erp.service.depotItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.DepotItemMapper;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
@Service
|
||||
public class DepotItemService {
|
||||
private Logger logger = LoggerFactory.getLogger(DepotItemService.class);
|
||||
@ -25,6 +32,8 @@ public class DepotItemService {
|
||||
|
||||
@Resource
|
||||
private DepotItemMapper depotItemMapper;
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
public DepotItem getDepotItem(long id) {
|
||||
return depotItemMapper.selectByPrimaryKey(id);
|
||||
@ -43,21 +52,25 @@ public class DepotItemService {
|
||||
return depotItemMapper.countsByDepotItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertDepotItem(String beanJson, HttpServletRequest request) {
|
||||
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
||||
return depotItemMapper.insertSelective(depotItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateDepotItem(String beanJson, Long id) {
|
||||
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
|
||||
depotItem.setId(id);
|
||||
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteDepotItem(Long id) {
|
||||
return depotItemMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteDepotItem(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
DepotItemExample example = new DepotItemExample();
|
||||
@ -114,10 +127,12 @@ public class DepotItemService {
|
||||
return depotItemMapper.findStockNumByMaterialIdCounts(mId, monthTime);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertDepotItemWithObj(DepotItem depotItem) {
|
||||
return depotItemMapper.insertSelective(depotItem);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateDepotItemWithObj(DepotItem depotItem) {
|
||||
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||
}
|
||||
@ -190,5 +205,184 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws DataAccessException{
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getDouble("OperNumber"));
|
||||
try {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
Double oNumber = tempInsertedJson.getDouble("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber * ratio); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempInsertedJson.getDouble("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempInsertedJson.getDouble("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempInsertedJson.getDouble("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempInsertedJson.getDouble("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempInsertedJson.getDouble("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempInsertedJson.getDouble("TaxLastMoney"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField1") != null) {
|
||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField2") != null) {
|
||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField3") != null) {
|
||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField4") != null) {
|
||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField5") != null) {
|
||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||
}
|
||||
if (tempInsertedJson.get("MType") != null) {
|
||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||
}
|
||||
this.insertDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
if (null != deletedJson) {
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||
}
|
||||
}
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getDouble("OperNumber"));
|
||||
try {
|
||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||
Double oNumber = tempUpdatedJson.getDouble("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber * ratio); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempUpdatedJson.getDouble("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempUpdatedJson.getDouble("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempUpdatedJson.getDouble("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempUpdatedJson.getDouble("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempUpdatedJson.getDouble("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempUpdatedJson.getDouble("TaxLastMoney"));
|
||||
}
|
||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 查询计量单位信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String findUnitName(Long mId) {
|
||||
String unitName = "";
|
||||
try {
|
||||
unitName = materialService.findUnitName(mId);
|
||||
if (unitName != null) {
|
||||
unitName = unitName.substring(1, unitName.length() - 1);
|
||||
if (unitName.equals("null")) {
|
||||
unitName = "";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return unitName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -37,21 +38,25 @@ public class FunctionsService {
|
||||
return functionsMapper.countsByFunctions(name, type);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertFunctions(String beanJson, HttpServletRequest request) {
|
||||
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
||||
return functionsMapper.insertSelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateFunctions(String beanJson, Long id) {
|
||||
Functions depot = JSONObject.parseObject(beanJson, Functions.class);
|
||||
depot.setId(id);
|
||||
return functionsMapper.updateByPrimaryKeySelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteFunctions(Long id) {
|
||||
return functionsMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteFunctions(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -37,21 +38,25 @@ public class InOutItemService {
|
||||
return inOutItemMapper.countsByInOutItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertInOutItem(String beanJson, HttpServletRequest request) {
|
||||
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
||||
return inOutItemMapper.insertSelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateInOutItem(String beanJson, Long id) {
|
||||
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
|
||||
depot.setId(id);
|
||||
return inOutItemMapper.updateByPrimaryKeySelective(depot);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteInOutItem(Long id) {
|
||||
return inOutItemMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteInOutItem(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
InOutItemExample example = new InOutItemExample();
|
||||
|
||||
@ -11,6 +11,7 @@ import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -43,21 +44,25 @@ public class LogService {
|
||||
return logMapper.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertLog(String beanJson, HttpServletRequest request) {
|
||||
Log log = JSONObject.parseObject(beanJson, Log.class);
|
||||
return logMapper.insertSelective(log);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateLog(String beanJson, Long id) {
|
||||
Log log = JSONObject.parseObject(beanJson, Log.class);
|
||||
log.setId(id);
|
||||
return logMapper.updateByPrimaryKeySelective(log);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteLog(Long id) {
|
||||
return logMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteLog(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
LogExample example = new LogExample();
|
||||
|
||||
@ -9,6 +9,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -70,12 +71,14 @@ public class MaterialService {
|
||||
return materialMapper.countsByMaterial(name, model,categoryId,categoryIds,mpList);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterial(String beanJson, HttpServletRequest request) {
|
||||
Material material = JSONObject.parseObject(beanJson, Material.class);
|
||||
material.setEnabled(true);
|
||||
return materialMapper.insertSelective(material);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateMaterial(String beanJson, Long id) {
|
||||
Material material = JSONObject.parseObject(beanJson, Material.class);
|
||||
material.setId(id);
|
||||
@ -89,10 +92,12 @@ public class MaterialService {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteMaterial(Long id) {
|
||||
return materialMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterial(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
MaterialExample example = new MaterialExample();
|
||||
@ -127,6 +132,7 @@ public class MaterialService {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetEnable(Boolean enabled, String materialIDs) {
|
||||
List<Long> ids = StringUtil.strToLongList(materialIDs);
|
||||
Material material = new Material();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -44,21 +45,25 @@ public class MaterialCategoryService {
|
||||
return materialCategoryMapper.countsByMaterialCategory(name, parentId);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialCategory(String beanJson, HttpServletRequest request) {
|
||||
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
||||
return materialCategoryMapper.insertSelective(materialCategory);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateMaterialCategory(String beanJson, Long id) {
|
||||
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
|
||||
materialCategory.setId(id);
|
||||
return materialCategoryMapper.updateByPrimaryKeySelective(materialCategory);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteMaterialCategory(Long id) {
|
||||
return materialCategoryMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialCategory(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -36,21 +37,25 @@ public class MaterialPropertyService {
|
||||
return materialPropertyMapper.countsByMaterialProperty(name);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialProperty(String beanJson, HttpServletRequest request) {
|
||||
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
||||
return materialPropertyMapper.insertSelective(materialProperty);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateMaterialProperty(String beanJson, Long id) {
|
||||
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
|
||||
materialProperty.setId(id);
|
||||
return materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteMaterialProperty(Long id) {
|
||||
return materialPropertyMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialProperty(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
MaterialPropertyExample example = new MaterialPropertyExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -37,21 +38,25 @@ public class PersonService {
|
||||
return personMapper.countsByPerson(name, type);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertPerson(String beanJson, HttpServletRequest request) {
|
||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||
return personMapper.insertSelective(person);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updatePerson(String beanJson, Long id) {
|
||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||
person.setId(id);
|
||||
return personMapper.updateByPrimaryKeySelective(person);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deletePerson(Long id) {
|
||||
return personMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeletePerson(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
PersonExample example = new PersonExample();
|
||||
|
||||
@ -40,21 +40,25 @@ public class RoleService {
|
||||
return roleMapper.countsByRole(name);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertRole(String beanJson, HttpServletRequest request) {
|
||||
Role role = JSONObject.parseObject(beanJson, Role.class);
|
||||
return roleMapper.insertSelective(role);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateRole(String beanJson, Long id) {
|
||||
Role role = JSONObject.parseObject(beanJson, Role.class);
|
||||
role.setId(id);
|
||||
return roleMapper.updateByPrimaryKeySelective(role);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteRole(Long id) {
|
||||
return roleMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteRole(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
RoleExample example = new RoleExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -37,21 +38,25 @@ public class SupplierService {
|
||||
return supplierMapper.countsBySupplier(supplier, type, phonenum, telephone, description);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertSupplier(String beanJson, HttpServletRequest request) {
|
||||
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
||||
return supplierMapper.insertSelective(supplier);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateSupplier(String beanJson, Long id) {
|
||||
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
||||
supplier.setId(id);
|
||||
return supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteSupplier(Long id) {
|
||||
return supplierMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSupplier(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
SupplierExample example = new SupplierExample();
|
||||
@ -66,6 +71,7 @@ public class SupplierService {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAdvanceIn(Long supplierId, Double advanceIn){
|
||||
Supplier supplier = supplierMapper.selectByPrimaryKey(supplierId);
|
||||
supplier.setAdvancein(supplier.getAdvancein() + advanceIn); //增加预收款的金额,可能增加的是负值
|
||||
@ -100,6 +106,7 @@ public class SupplierService {
|
||||
return supplierMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetEnable(Boolean enabled, String supplierIDs) {
|
||||
List<Long> ids = StringUtil.strToLongList(supplierIDs);
|
||||
Supplier supplier = new Supplier();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -36,21 +37,25 @@ public class SystemConfigService {
|
||||
return systemConfigMapper.countsBySystemConfig();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertSystemConfig(String beanJson, HttpServletRequest request) {
|
||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||
return systemConfigMapper.insertSelective(systemConfig);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateSystemConfig(String beanJson, Long id) {
|
||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||
systemConfig.setId(id);
|
||||
return systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteSystemConfig(Long id) {
|
||||
return systemConfigMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSystemConfig(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
SystemConfigExample example = new SystemConfigExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -37,21 +38,25 @@ public class UnitService {
|
||||
return unitMapper.countsByUnit(name);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUnit(String beanJson, HttpServletRequest request) {
|
||||
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
||||
return unitMapper.insertSelective(unit);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUnit(String beanJson, Long id) {
|
||||
Unit unit = JSONObject.parseObject(beanJson, Unit.class);
|
||||
unit.setId(id);
|
||||
return unitMapper.updateByPrimaryKeySelective(unit);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteUnit(Long id) {
|
||||
return unitMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteUnit(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
UnitExample example = new UnitExample();
|
||||
|
||||
@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -38,7 +39,16 @@ public class UserService {
|
||||
public int countUser(String userName, String loginName) {
|
||||
return userMapper.countsByUser(userName, loginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:30
|
||||
* @Param: beanJson
|
||||
* @Param: request
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUser(String beanJson, HttpServletRequest request) {
|
||||
User user = JSONObject.parseObject(beanJson, User.class);
|
||||
String password = "123456";
|
||||
@ -52,17 +62,43 @@ public class UserService {
|
||||
}
|
||||
return userMapper.insertSelective(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:31
|
||||
* @Param: beanJson
|
||||
* @Param: id
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUser(String beanJson, Long id) {
|
||||
User user = JSONObject.parseObject(beanJson, User.class);
|
||||
user.setId(id);
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:32
|
||||
* @Param: user
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUserByObj(User user) {
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:33
|
||||
* @Param: md5Pwd
|
||||
* @Param: id
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int resetPwd(String md5Pwd, Long id) {
|
||||
User user = new User();
|
||||
user.setId(id);
|
||||
@ -70,10 +106,12 @@ public class UserService {
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteUser(Long id) {
|
||||
return userMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteUser(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
UserExample example = new UserExample();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -29,21 +30,25 @@ public class UserBusinessService {
|
||||
return userBusinessMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUserBusiness(String beanJson, HttpServletRequest request) {
|
||||
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
||||
return userBusinessMapper.insertSelective(userBusiness);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUserBusiness(String beanJson, Long id) {
|
||||
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
|
||||
userBusiness.setId(id);
|
||||
return userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
||||
}
|
||||
|
||||
@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();
|
||||
@ -89,6 +94,7 @@ public class UserBusinessService {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateBtnStr(Long userBusinessId, String btnStr) {
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setBtnstr(btnStr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user