优化单据的代码结构

This commit is contained in:
季圣华
2020-09-26 18:56:09 +08:00
parent 079fa47690
commit ce3fbfb557
16 changed files with 281 additions and 1568 deletions

View File

@@ -505,7 +505,7 @@ public class DepotItemService {
depotItem.setMaterialExtendId(tempUpdatedJson.getLong("MaterialExtendId"));
}
depotItem.setMaterialUnit(tempUpdatedJson.getString("Unit"));
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("OperNumber"))) {
depotItem.setOperNumber(tempUpdatedJson.getBigDecimal("OperNumber"));
try {
String Unit = tempUpdatedJson.get("Unit").toString();
@@ -530,29 +530,29 @@ public class DepotItemService {
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("UnitPrice"))) {
depotItem.setUnitPrice(tempUpdatedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("TaxUnitPrice"))) {
depotItem.setTaxUnitPrice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("AllPrice"))) {
depotItem.setAllPrice(tempUpdatedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
if (tempUpdatedJson.get("DepotId") != null && StringUtil.isExist(tempUpdatedJson.get("DepotId"))) {
depotItem.setDepotId(tempUpdatedJson.getLong("DepotId"));
}
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
if (tempUpdatedJson.get("AnotherDepotId") != null && StringUtil.isExist(tempUpdatedJson.get("AnotherDepotId"))) {
depotItem.setAnotherDepotId(tempUpdatedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("TaxRate"))) {
depotItem.setTaxRate(tempUpdatedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("TaxMoney"))) {
depotItem.setTaxMoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
if (StringUtil.isExist(tempUpdatedJson.get("TaxLastMoney"))) {
depotItem.setTaxLastMoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
}
depotItem.setOtherField1(tempUpdatedJson.getString("OtherField1"));

View File

@@ -207,7 +207,11 @@ public class OrgaUserRelService {
List<Long> orgIdList = organizationService.getOrgIdByParentId(orgId);
List<Long> userIdList = new ArrayList<Long>();
OrgaUserRelExample example = new OrgaUserRelExample();
example.createCriteria().andOrgaIdIn(orgIdList).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
if(orgIdList!=null && orgIdList.size()>0) {
example.createCriteria().andOrgaIdIn(orgIdList).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else {
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<OrgaUserRel> list = orgaUserRelMapper.selectByExample(example);
if(list!=null && list.size()>0) {
for(OrgaUserRel our: list) {

View File

@@ -217,17 +217,23 @@ public class UserService {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int resetPwd(String md5Pwd, Long id) throws Exception{
int result=0;
logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User user = new User();
user.setId(id);
user.setPassword(md5Pwd);
int result=0;
try{
result=userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
JshException.writeFail(logger, e);
User u = getUser(id);
String loginName = u.getLoginName();
if("admin".equals(loginName)){
logger.info("禁止重置超管密码");
} else {
User user = new User();
user.setId(id);
user.setPassword(md5Pwd);
try{
result=userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
JshException.writeFail(logger, e);
}
}
return result;
}