Commit 7cabc39a authored by qiankunpingtai's avatar qiankunpingtai
Browse files

切换到jsh的版本

parent 9182e734
......@@ -49,14 +49,6 @@ public class MaterialProperty {
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialproperty.id
......@@ -200,28 +192,4 @@ public class MaterialProperty {
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialproperty.tenant_id
*
* @return the value of jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialproperty.tenant_id
*
* @param tenantId the value for jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
}
\ No newline at end of file
......@@ -593,66 +593,6 @@ public class MaterialPropertyExample {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
}
/**
......
......@@ -49,14 +49,6 @@ public class UserBusiness {
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_userbusiness.Id
......@@ -200,28 +192,4 @@ public class UserBusiness {
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_userbusiness.tenant_id
*
* @return the value of jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_userbusiness.tenant_id
*
* @param tenantId the value for jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
}
\ No newline at end of file
......@@ -603,66 +603,6 @@ public class UserBusinessExample {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
}
/**
......
......@@ -25,6 +25,7 @@ public interface AccountHeadMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
Long getMaxId();
BigDecimal findAllMoney(
@Param("supplierId") Integer supplierId,
......@@ -42,7 +43,4 @@ public interface AccountHeadMapperEx {
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
int addAccountHead(AccountHead accountHead);
int updateAccountHead(AccountHead accountHead);
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ public interface DepotHeadMapperEx {
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds);
Long getMaxId();
String findMaterialsListByHeaderId(
@Param("id") Long id);
......@@ -110,6 +111,7 @@ public interface DepotHeadMapperEx {
* */
void updatedepotHead(DepotHead depotHead);
void updateBuildOnlyNumber();
/**
* 获得一个全局唯一的数作为订单号的追加
* */
......
......@@ -36,15 +36,6 @@ public interface DepotItemMapperEx {
Long findDetailByTypeAndMaterialIdCounts(
@Param("mId") Long mId);
int findByTypeAndDepotIdAndMaterialIdIn(
@Param("depotId") Long depotId,
@Param("mId") Long mId);
int findByTypeAndDepotIdAndMaterialIdOut(
@Param("depotId") Long depotId,
@Param("mId") Long mId);
List<DepotItemVo4WithInfoEx> getDetailList(
@Param("headerId") Long headerId);
......@@ -115,6 +106,4 @@ public interface DepotItemMapperEx {
int findStockWarningCountTotal( @Param("pid") Integer pid);
BigDecimal getFinishNumber(@Param("mid") Long mid, @Param("linkNumber") String linkNumber);
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId") Long materialId, @Param("depotId") Long depotId,@Param("tenantId")Long tenantId);
}
......@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface RoleMapperEx {
......@@ -19,5 +18,4 @@ public interface RoleMapperEx {
@Param("name") String name);
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<Role> getRoleList(Map<String, String> parameterMap);
}
\ No newline at end of file
package com.jsh.erp.datasource.mappers;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample;
......@@ -29,18 +28,12 @@ public interface UserMapperEx {
int addUser(UserEx ue);
int updateUser(UserEx ue);
/**
* 这个查询不添加租户id,保证登录名全局唯一
* */
List<User> getUserListByLoginName(@Param("loginame") String loginame);
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
@Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
List<TreeNodeEx> getNodeTree();
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId);
String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId);
List<User> getUserListByloginNameAndPassword(@Param("loginame")String loginame, @Param("password")String password);
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper;
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.accountItem.AccountItemService;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
......@@ -24,7 +23,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -44,8 +42,6 @@ public class AccountHeadService {
private LogService logService;
@Resource
private AccountItemMapperEx accountItemMapperEx;
@Resource
private AccountItemService accountItemService;
public AccountHead getAccountHead(long id) throws Exception {
AccountHead result=null;
......@@ -162,6 +158,16 @@ public class AccountHeadService {
return list==null?0:list.size();
}
public Long getMaxId()throws Exception {
Long result = null;
try{
result = accountHeadMapperEx.getMaxId();
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
String modeName = "";
if (mode.equals("实际")) {
......@@ -306,49 +312,4 @@ public class AccountHeadService {
deleteTotal= batchDeleteAccountHeadByIds(ids);
return deleteTotal;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addAccountHeadAndDetail(String beanJson, String inserted, String deleted, String updated, String listType) throws Exception {
/**处理财务信息*/
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
try{
accountHeadMapperEx.addAccountHead(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);
}
/**
* create by: qiankunpingtai
* create time: 2019/5/22 10:30
* website:https://qiankunpingtai.cn
* description:
* 处理财务明细信息
*
*/
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateAccountHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, String listType)throws Exception {
/**更新财务信息*/
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
accountHead.setId(id);
try{
accountHeadMapperEx.updateAccountHead(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);
}
/**
* create by: qiankunpingtai
* create time: 2019/5/22 10:30
* website:https://qiankunpingtai.cn
* description:
* 更新财务明细信息
*/
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
}
}
......@@ -228,15 +228,16 @@ public class DepotHeadService {
/**
* 创建一个唯一的序列号
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String buildOnlyNumber()throws Exception{
Long buildOnlyNumber=null;
synchronized (this){
try{
depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
}catch(Exception e){
JshException.writeFail(logger, e);
}
}
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
......@@ -250,7 +251,15 @@ public class DepotHeadService {
}
}
public Long getMaxId()throws Exception {
Long result = null;
try{
result = depotHeadMapperEx.getMaxId();
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public String findMaterialsListByHeaderId(Long id)throws Exception {
String result = null;
......@@ -460,7 +469,7 @@ public class DepotHeadService {
* @return java.lang.String
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
......@@ -485,7 +494,7 @@ public class DepotHeadService {
}
}
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
/**如果关联单据号非空则更新订单的状态为2 */
if(depotHead.getLinknumber()!=null) {
DepotHead depotHeadOrders = new DepotHead();
......@@ -537,7 +546,7 @@ public class DepotHeadService {
}
}
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
}
/**
......
......@@ -32,7 +32,6 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class DepotItemService {
......@@ -65,10 +64,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return result;
}
......@@ -80,10 +76,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return list;
}
......@@ -93,10 +86,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return list;
}
......@@ -106,10 +96,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return result;
}
......@@ -121,10 +108,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return result;
}
......@@ -137,10 +121,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return result;
}
......@@ -151,10 +132,7 @@ public class DepotItemService {
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);
JshException.writeFail(logger, e);
}
return result;
}
......@@ -168,10 +146,7 @@ public class DepotItemService {
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);
JshException.writeFail(logger, e);
}
return result;
}
......@@ -183,10 +158,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
......@@ -201,10 +173,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return list;
}
......@@ -245,13 +214,6 @@ public class DepotItemService {
}
return result;
}
public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) {
if(type.equals(TYPE)) {
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId);
} else {
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdOut(depotId, mId);
}
}
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
List<DepotItemVo4WithInfoEx> list =null;
......@@ -292,13 +254,12 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
return result;
}
/**
* 统计采购或销售的总金额
* @param type
......@@ -317,14 +278,13 @@ public class DepotItemService {
return result;
}
/**
* 2019-02-02修改
* 我之前对操作数量的理解有偏差
* 这里重点重申一下:BasicNumber=OperNumber*ratio
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
......@@ -333,10 +293,7 @@ public class DepotItemService {
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);
JshException.readFail(logger, e);
}
//获得当前操作人
User userInfo=userService.getCurrentUser();
......@@ -388,9 +345,9 @@ public class DepotItemService {
depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
depotItem.setMunit(tempInsertedJson.getString("Unit"));
Material material= materialService.getMaterial(depotItem.getMaterialid());
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
try {
String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
......@@ -398,7 +355,7 @@ public class DepotItemService {
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
......@@ -410,14 +367,13 @@ public class DepotItemService {
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
}
}
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
......@@ -469,10 +425,13 @@ public class DepotItemService {
if(depotItem==null){
continue;
}
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
if(stock.compareTo(thisBasicNumber)<0){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
......@@ -504,14 +463,13 @@ public class DepotItemService {
continue;
}
//首先回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
/**收回序列号的时候释放库存*/
......@@ -519,20 +477,17 @@ public class DepotItemService {
depotItem.setBasicnumber(BigDecimal.ZERO);
this.updateDepotItemWithObj(depotItem);
}
}
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
try {
String Unit = tempUpdatedJson.get("Unit").toString();
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
......@@ -544,14 +499,13 @@ public class DepotItemService {
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
......@@ -593,14 +547,16 @@ public class DepotItemService {
* 这里需要重新获取页面传递的商品信息
*/
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
}
/**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
if(stock.compareTo(thisBasicNumber)<0){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
......@@ -639,17 +595,7 @@ public class DepotItemService {
}
return unitName;
}
/**
* 查询商品当前库存数量是否充足,
*
* */
public int getCurrentInStock(Long materialId, Long depotId){
//入库数量
int inSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId, depotId);
//出库数量
int outSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId ,depotId);
return (inSum-outSum);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItemByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
......@@ -661,10 +607,7 @@ public class DepotItemService {
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);
JshException.writeFail(logger, e);
}
return result;
}
......@@ -690,35 +633,6 @@ public class DepotItemService {
}
return result;
}
/**
* create by: qiankunpingtai
* create time: 2019/5/16 18:15
* website:https://qiankunpingtai.cn
* description:
* 查询指定仓库指定材料的当前库存
*/
public BigDecimal getCurrentRepByMaterialIdAndDepotId(Long materialId,Long depotId) {
BigDecimal result = BigDecimal.ZERO;
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
Long tenantId=null;
Object tenantIdO = request.getSession().getAttribute("tenantId");
if(tenantIdO!=null){
//多租户模式,租户id从当前用户获取
tenantId=Long.valueOf(tenantIdO.toString());
} else {
//无租户模式,租户id为-1
tenantId=Long.valueOf(-1);
}
try{
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId,tenantId);
}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;
}
/**
* 统计该商品已分批出库的总数量-用于订单
......
......@@ -24,7 +24,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class RoleService {
......@@ -49,10 +48,12 @@ public class RoleService {
return result;
}
public List<Role> getRoleList(Map<String, String> parameterMap)throws Exception {
public List<Role> getRole()throws Exception {
RoleExample example = new RoleExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Role> list=null;
try{
list=roleMapperEx.getRoleList(parameterMap);
list=roleMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
......
......@@ -381,27 +381,17 @@ public class SerialNumberService {
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
if(depotItem!=null){
//查询商品下已分配的可用序列号数量
int serialNumberSum=0;
try{
serialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
//BasicNumber=OperNumber*ratio
}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((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>serialNumberSum){
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,
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
//商品下序列号充足,分配序列号
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
}
}
/**
*
......@@ -483,7 +473,6 @@ public class SerialNumberService {
int insertNum=0;
StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
do{
list=new ArrayList<SerialNumberEx>();
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
for(int i=0;i<forNum;i++){
......@@ -498,15 +487,11 @@ public class SerialNumberService {
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
list.add(each);
}
int result=0;
try{
result = serialNumberMapperEx.batAddSerialNumber(list);
serialNumberMapperEx.batAddSerialNumber(list);
}catch(Exception e){
JshException.writeFail(logger, e);
}
serialNumberMapperEx.batAddSerialNumber(list);
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
}while(batAddTotal>0);
}
}
/**
......
......@@ -209,7 +209,7 @@ public class SupplierService {
int result=0;
try{
if(supplier!=null){
supplier.setAdvancein((supplier.getAdvancein()==null?BigDecimal.ZERO:supplier.getAdvancein()).add(advanceIn)); //增加预收款的金额,可能增加的是负值
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
result=supplierMapper.updateByPrimaryKeySelective(supplier);
}
}catch(Exception e){
......
......@@ -45,7 +45,7 @@ public class TenantComponent implements ICommonQuery {
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return tenantService.insertTenant(beanJson);
return tenantService.insertTenant(beanJson, request);
}
@Override
......
......@@ -68,7 +68,7 @@ public class TenantService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertTenant(String beanJson)throws Exception {
public int insertTenant(String beanJson, HttpServletRequest request)throws Exception {
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
int result=0;
try{
......
......@@ -21,7 +21,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.ExceptionCodeConstants;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.apache.ibatis.annotations.DeleteProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
......@@ -219,14 +218,14 @@ public class UserService {
return result;
}
public int validateUser(String username, String password){
public int validateUser(String username, String password) throws Exception {
/**默认是可以登录的*/
List<User> list = null;
try {
list=this.getUserListByloginName(username);
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username);
list = userMapper.selectByExample(example);
} catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
......@@ -234,15 +233,17 @@ public class UserService {
if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
}
User user=null;
try {
user = this.getUserListByloginNameAndPassword(username,password);
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password);
list = userMapper.selectByExample(example);
} catch (Exception e) {
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
if (null == user ) {
if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
}
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
......@@ -310,8 +311,7 @@ public class UserService {
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkLoginName(ue);
checkUserName(ue);
checkUserNameAndLoginName(ue);
//新增用户信息
ue= this.addUser(ue);
if(ue==null){
......@@ -351,11 +351,7 @@ public class UserService {
* 3是否管理者默认为员工
* 4默认用户状态为正常
* */
//用户没有设置密码时,使用默认密码
if(StringUtil.isEmpty(ue.getPassword())){
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
}
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if(ue.getIsmanager()==null){
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
......@@ -374,7 +370,7 @@ public class UserService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public UserEx registerUser(UserEx ue, Long manageRoleId) throws Exception{
public UserEx registerUser(UserEx ue, Integer manageRoleId, HttpServletRequest request) throws Exception{
/**
* create by: qiankunpingtai
* create time: 2019/4/9 18:00
......@@ -386,47 +382,43 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
/**
* create by: qiankunpingtai
* create time: 2019/4/24 10:57
* website:https://qiankunpingtai.cn
* description:
* 检查登录名是否已存在
*
*/
checkLoginName(ue);
/**
* create by: qiankunpingtai
* create time: 2019/4/24 14:47
* website:https://qiankunpingtai.cn
* description:
* 注册一个新用户需要做如下操作
* 1、分配应用
* 2、分配功能模块
* 3、分配产品扩展字段
* 4、分配角色(默认添加超级管理员角色,不可修改)
* 5、写入用户信息
* 6、写入用户角色应用功能关系
*/
ue=this.addUser(ue);
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if (ue.getIsmanager() == null) {
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
}
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int result=0;
try{
result= userMapperEx.addUser(ue);
}catch(Exception e){
JshException.writeFail(logger, e);
}
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
addRegisterUserNotInclueUser(user.getId(),user.getTenantId(),manageRoleId);
// //新增用户与角色的关系
// JSONObject ubObj = new JSONObject();
// ubObj.put("type", "UserRole");
// ubObj.put("keyid", ue.getId());
// JSONArray ubArr = new JSONArray();
// ubArr.add(manageRoleId);
// ubObj.put("value", ubArr.toString());
// userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//创建租户信息
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginame());
String param = tenantObj.toJSONString();
tenantService.insertTenant(param, request);
logger.info("===============创建租户信息完成===============");
if (result > 0) {
return ue;
}
return null;
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
......@@ -450,8 +442,7 @@ public class UserService {
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkLoginName(ue);
checkUserName(ue);
checkUserNameAndLoginName(ue);
//更新用户信息
ue = this.updateUser(ue);
if (ue == null) {
......@@ -503,13 +494,14 @@ public class UserService {
return null;
}
/**
* create by: qiankunpingtai
* create time: 2019/4/24 11:02
* website:https://qiankunpingtai.cn
* create by: cjl
* description:
* 检查登录名全局唯一
* 检查用户名称和登录名不能重复
* create time: 2019/3/12 11:36
* @Param: userEx
* @return void
*/
public void checkLoginName(UserEx userEx)throws Exception{
public void checkUserNameAndLoginName(UserEx userEx)throws Exception{
List<User> list=null;
if(userEx==null){
return;
......@@ -539,25 +531,10 @@ public class UserService {
}
}
}
/**
* create by: qiankunpingtai
* create time: 2019/4/24 11:02
* website:https://qiankunpingtai.cn
* description:
* 检查用户名同一个租户范围内内唯一
*
*/
public void checkUserName(UserEx userEx)throws Exception{
List<User> list=null;
if(userEx==null){
return;
}
Long userId=userEx.getId();
//检查用户名
if(!StringUtils.isEmpty(userEx.getUsername())){
String userName=userEx.getUsername();
list=this.getUserListByUserNameAndTenantId(userName,userEx.getTenantId());
list=this.getUserListByUserName(userName);
if(list!=null&&list.size()>0){
if(list.size()>1){
//超过一条数据存在,该用户名已存在
......@@ -578,58 +555,32 @@ public class UserService {
}
}
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 通过用户名和租户id获取用户信息
* create time: 2019/4/24 11:18
* @Param: userName
 * @Param: tenantId
* @return java.util.List<com.jsh.erp.datasource.entities.User>
*/
private List<User> getUserListByUserNameAndTenantId(String userName, Long tenantId) {
* 通过用户名获取用户列表
* */
public List<User> getUserListByUserName(String userName)throws Exception{
List<User> list =null;
try{
list=userMapperEx.getUserListByUserNameAndTenantId(userName,tenantId);
list=userMapperEx.getUserListByUserNameOrLoginName(userName,null);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* 通过登录名获取用户列表
* */
public List<User> getUserListByloginName(String loginName){
List<User> list =null;
try{
list=userMapperEx.getUserListByLoginName(loginName);
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* 通过登录名和密码获取用户列表
* */
public User getUserListByloginNameAndPassword(String loginName,String password){
List<User> list =null;
try{
list=userMapperEx.getUserListByloginNameAndPassword(loginName,password);
}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 list.get(0);
}
return null;
}
/**
* 批量删除用户
* */
......@@ -662,34 +613,4 @@ public class UserService {
}
return list;
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 1、分配应用
* 2、分配功能模块
* 3、分配产品扩展字段
* 4、分配角色(默认添加超级管理员角色,不可修改)
* 5、写入用户角色应用功能关系
* create time: 2019/4/26 9:37
* @Param: userId 用户id
 * @Param: tenantId 租户id
 * @Param: roleId 模板角色id
* @return java.lang.String
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String addRegisterUserNotInclueUser(Long userId,Long tenantId,Long roleId)throws Exception {
String result =null;
try{
result=userMapperEx.addRegisterUserNotInclueUser(userId,tenantId,roleId);
}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;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment