Commit 3b90b175 authored by frank.xa.zhang's avatar frank.xa.zhang

Merge branch 'dev' into dev_frank

parents a1d92952 f5390c49
This diff is collapsed.
......@@ -301,6 +301,11 @@
<scope>system</scope>
<systemPath>${basedir}/lib/java-axp-1.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>24.0-jre</version>
</dependency>
</dependencies>
<profiles>
......
package pwc.taxtech.atms.common;
public class ServiceException extends Exception {
public ServiceException() {
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(Throwable cause) {
super(cause);
}
}
package pwc.taxtech.atms.common.message;
public class EnterpriseAccountSetOrgMsg {
public static final String EnterpriseAccountSetOrgExists = "EnterpriseAccountSetOrgExists";
public static final String NoOrgSetOrOrgExist = "NoOrgSetOrOrgExist";
public static final String EnterpriseAccountSetOrgDateTimeOverlap = "EnterpriseAccountSetOrgDateTimeOverlap";
public static final String RelevantOranization = "RelevantOranization";
public static final String EffectiveDateAreaProblem = "EffectiveDateAreaProblem";
public static final String EnterpriseAccountSetOrgOnlyOncePerYear = "EnterpriseAccountSetOrgOnlyOncePerYear";
}
package pwc.taxtech.atms.constant;
public class AccountMappingConstant {
public enum Status {
UNMAPPED(1, "未对应"),
MAPPED(2, "已对应"),
DIRECTION_DIFFERENT(3, "借贷方向不一致"),
ACCOUNT_TYPE_DIFFERENT(4, "科目类型不一致");
private Integer code;
private String name;
Status(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
}
......@@ -44,6 +44,24 @@ public class EnterpriseAccountConstant {
public static final int MaxAcctPropValue = 6;
public static final int SpecialAcctPropValue = -1;
public static final String EnterpriceAccountRepeat = "EnterpriceAccountRepeat";
public static final String EnterpriceAccountParentDisable = "EnterpriceAccountParentDisable";
public static final String StdCodeIsNotExist = "StdCodeIsNotExist";
public static final String NoParentCode = "NoParentCode";
public static final String OrgNotExist = "OrgNotExist";
public static final String SystemError = "SystemError";
public static final String NoAccountNeedClear = "NoAccountNeedClear";
public static final String InputParamInComplete = "InputParamInComplete";
public static final String AccountSetNotExist = "AccountSetNotExist";
public static final String ExistMappedOrg = "ExistMappedOrg";
public static final String SubjectCorresponding = "SubjectCorresponding";
public static final String DirectionFormatError = "DirectionFormatError";
public static final String AcctPropFormatError = "AcctPropFormatError";
public static final String AcctPropNullError = "AcctPropNullError";
public static final List<String> IgnoreFieldList = Arrays.asList(IsLeafField, AcctLevelField, FullNameField);
public static final Map<String, String> DirectionMap = ImmutableMap.<String, String>builder()
......@@ -73,4 +91,9 @@ public class EnterpriseAccountConstant {
public static final List<String> acctPropLogList = Arrays.asList("", "资产", "负债", "共同", "权益", "成本", "损益", "其他");
public class StdCode{
public static final String NULL_STD_CODE = "00";
public static final String EMPTY_STD_CODE = "0000";
}
}
package pwc.taxtech.atms.constant.enums;
public enum AccountRuleEnum {
Rule2001("企业会计制度(2001年实施)", 1),
Rule2007("企业会计准则(2007年实施)", 2);
private String name;
private Integer value;
AccountRuleEnum(String name, Integer value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public Integer getValue() {
return value;
}
}
package pwc.taxtech.atms.constant.enums;
import java.util.HashMap;
import java.util.Map;
public class StdAccountEnum {
public enum RuleType {
TWO(2);
private Integer code;
RuleType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
public enum AcctProp {
Asset("1", "资产"),
Debt("2", "负债"),
Joint("3", "共同"),
Equity("4", "权益"),
Cost("5", "成本"),
Loss("6", "损益");
private String code;
private String name;
public static final Map<String, String> MAPPING = new HashMap<>();
AcctProp(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (AcctProp acctProp : AcctProp.values()) {
MAPPING.put(acctProp.getCode(), acctProp.getName());
}
}
}
}
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
}
......@@ -6,6 +6,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......@@ -33,12 +34,7 @@ import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.epaccount.AccountMappingDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountAndValidateInfo;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetOrgDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountUploadDto;
import pwc.taxtech.atms.dto.epaccount.*;
import pwc.taxtech.atms.service.EnterpriseAccountService;
import pwc.taxtech.atms.service.EnterpriseAccountSetService;
import pwc.taxtech.atms.service.impl.FileService;
......@@ -253,4 +249,56 @@ public class EnterpriseAccountManagerController {
public @ResponseBody List<AccountMappingDto> getAccountMappingOrg(@RequestParam String organizationID) {
return enterpriseAccountService.getAccountMappingOrg(organizationID);
}
@ResponseBody
@ApiOperation(value = "按组织机构查找")
@RequestMapping(value = "getEnterpriseAccountSetListByOrgID", method = RequestMethod.GET)
public List<EnterpriseAccountSetDto> getEnterpriseAccountSetListByOrgID(@RequestParam String orgID) {
return enterpriseAccountService.getEnterpriseAccountSetListByOrgID(orgID);
}
@ResponseBody
@ApiOperation(value = "科目对应列表")
@RequestMapping(value = "getEnterpriseAccountList", method = RequestMethod.GET)
public List<EnterpriseAccountDto> getEnterpriseAccountList(@RequestParam String espID,
@RequestParam String orgID,
@RequestParam String filterType) {
return enterpriseAccountService.getList(espID, orgID, filterType);
}
@ResponseBody
@ApiOperation(value = "科目自动对应")
@RequestMapping(value = "autoMap", method = RequestMethod.GET)
public OperationResultDto autoMap(@RequestParam String orgID, @RequestParam String accountSetID) {
try {
return enterpriseAccountService.autoMap(orgID, accountSetID);
} catch (Exception e) {
logger.error("autoMap error.", e);
}
return OperationResultDto.error("自动对应失败");
}
@ResponseBody
@ApiOperation(value = "手动对应")
@RequestMapping(value = "mapAccount", method = RequestMethod.POST)
public OperationResultDto mapAccount(@RequestBody AccountMapDto dto) {
try {
return enterpriseAccountService.mapAccount(dto);
} catch (Exception e) {
logger.error("mapAccount error.", e);
}
return OperationResultDto.error("自动对应失败");
}
@ResponseBody
@ApiOperation(value = "取消对应")
@RequestMapping(value = "clearMap", method = RequestMethod.POST)
public OperationResultDto clearMap(@RequestBody String[] epAccountIDs, @RequestParam String orgId) {
try {
return enterpriseAccountService.clearMap(epAccountIDs, orgId);
} catch (Exception e) {
logger.error("clearMap error.", e);
}
return OperationResultDto.error("取消对应失败");
}
}
......@@ -6,15 +6,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.dto.MenuDisplayDto;
import pwc.taxtech.atms.dto.MenuDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.Menu;
import pwc.taxtech.atms.service.MenuService;
/** @see PwC.Tax.Tech.Atms.WebApi\Controllers\MenuController.cs */
......@@ -40,4 +38,17 @@ public class MenuController {
logger.info("come into menu");
return menuService.getMenus(serviceId);
}
@ResponseBody
@ApiOperation(value = "更新菜单项", notes = "更新菜单项")
@RequestMapping(method = RequestMethod.PUT)
public OperationResultDto updateMenu(@RequestBody Menu menu) {
try {
menuService.update(menu);
return OperationResultDto.success();
} catch (Exception e) {
logger.error("更新菜单项失败", e);
}
return OperationResultDto.error();
}
}
package pwc.taxtech.atms.controller;
import java.util.List;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ServiceTypeDto;
import pwc.taxtech.atms.entitiy.ServiceType;
import pwc.taxtech.atms.service.ProjectService;
import pwc.taxtech.atms.service.ServiceTypeService;
import java.util.List;
@RestController
@RequestMapping("api/v1/servicetype")
@RequestMapping("/api/v1/servicetype/")
public class ServiceTypeController {
@Autowired
private ServiceTypeService serviceTypeService;
@RequestMapping(value="getlist",method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<ServiceType> GetServiceTypes(){
return serviceTypeService.GetServiceTypes();
}
@Autowired
private ProjectService projectService;
@Autowired
private ServiceTypeService serviceTypeService;
@ResponseBody
@ApiOperation(value = "获取ServiceType列表")
@RequestMapping(value = "getlist", method = RequestMethod.GET)
public List<ServiceTypeDto> getList() {
return projectService.getServiceList();
}
@ResponseBody
@RequestMapping(value = "getlist", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<ServiceType> GetServiceTypes() {
return serviceTypeService.GetServiceTypes();
}
}
package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.stdaccount.StandardAccountDto;
import pwc.taxtech.atms.dto.stdaccount.StdAccountFancyTreeDto;
import pwc.taxtech.atms.service.StdAccountService;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/api/v1/stdAccount")
public class StdAccountController extends BaseController {
@Autowired
private StdAccountService stdAccountService;
@ResponseBody
@ApiOperation(value = "获取科目层级")
@RequestMapping(value = "stdAccountHierarchy", method = RequestMethod.GET)
public List<StdAccountFancyTreeDto> getStdAccountHierarchy(@RequestParam String orgID) {
if (StringUtils.isBlank(orgID)) {
return Collections.emptyList();
}
try {
return stdAccountService.getStdAccountHierarchy(orgID);
} catch (Exception e) {
logger.error("getStdAccountHierarchy error.", e);
}
return Collections.emptyList();
}
@ResponseBody
@ApiOperation(value = "查看对应关系")
@RequestMapping(value = "getStdAccountLinkEtsAccount", method = RequestMethod.GET)
public List<StandardAccountDto> getStdAccountLinkEtsAccount(@RequestParam String orgID,
@RequestParam String accountSetID) {
if (StringUtils.isAnyBlank(orgID, accountSetID)) {
return Collections.emptyList();
}
try {
return stdAccountService.GetStdAccountLinkEtsAccount(orgID, accountSetID);
} catch (Exception e) {
logger.error("getStdAccountLinkEtsAccount error.", e);
}
return Collections.emptyList();
}
}
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.AccountMappingManual;
import pwc.taxtech.atms.entitiy.AccountMappingManualExample;
@Mapper
public interface AccountMappingManualMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
long countByExample(AccountMappingManualExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int deleteByExample(AccountMappingManualExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int deleteByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int insert(AccountMappingManual record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int insertSelective(AccountMappingManual record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
List<AccountMappingManual> selectByExampleWithRowbounds(AccountMappingManualExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
List<AccountMappingManual> selectByExample(AccountMappingManualExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
AccountMappingManual selectByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") AccountMappingManual record, @Param("example") AccountMappingManualExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int updateByExample(@Param("record") AccountMappingManual record, @Param("example") AccountMappingManualExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(AccountMappingManual record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
int updateByPrimaryKey(AccountMappingManual record);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto;
import pwc.taxtech.atms.entitiy.EnterpriseAccount;
import pwc.taxtech.atms.entitiy.EnterpriseAccountExample;
......@@ -105,4 +106,7 @@ public interface EnterpriseAccountMapper extends MyMapper {
* @mbg.generated
*/
int updateByPrimaryKey(EnterpriseAccount record);
List<EnterpriseAccountDto> getDto(@Param("epAccountSetID") String epAccountSetID,
@Param("orgId") String orgId, @Param("industryId") String industryId);
}
\ No newline at end of file
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
......@@ -8,6 +7,8 @@ import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.EnterpriseAccountSet;
import pwc.taxtech.atms.entitiy.EnterpriseAccountSetExample;
import java.util.List;
@Mapper
public interface EnterpriseAccountSetMapper extends MyMapper {
/**
......@@ -105,4 +106,6 @@ public interface EnterpriseAccountSetMapper extends MyMapper {
* @mbg.generated
*/
int updateByPrimaryKey(EnterpriseAccountSet record);
List<EnterpriseAccountSet> getAccountDtoByOrgId(@Param("orgId") String orgId);
}
\ No newline at end of file
......@@ -29,7 +29,7 @@ public interface MyUserMapper extends MyMapper {
List<Map<String, Object>> selectUserOrganizationMapByUserID(@Param(value = "userID") String userID);
@Select("select urd.ID, urd.DimensionValueID, urd.DimensionID, urd.UserID, urd.IsAccessible, urd.HasOriginalRole, u.UserName "
+ "from UserDimensionValue as urd " + "join \"USER\" as u on urd.UserID = u.ID " + "where u.Status = 1")
+ "from UserDimensionValue as urd " + "join User as u on urd.UserID = u.ID " + "where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "DimensionValueID", property = "dimensionValueID", javaType = String.class),
@Result(column = "DimensionID", property = "dimensionID", javaType = String.class),
......@@ -45,7 +45,7 @@ public interface MyUserMapper extends MyMapper {
@Result(column = "RoleName", property = "roleName", javaType = String.class) })
List<Map<String, String>> selectUserRoleListByUserID(@Param(value = "userId") String userId);
@Select("select q.ID, q.OrganizationID, q.UserID, q.IsAccessible, q.HasOriginalRole from UserOrganization as q join \"USER\" as u on q.UserID = u.ID "
@Select("select q.ID, q.OrganizationID, q.UserID, q.IsAccessible, q.HasOriginalRole from UserOrganization as q join User as u on q.UserID = u.ID "
+ "where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "OrganizationID", property = "organizationID"),
......@@ -67,7 +67,7 @@ public interface MyUserMapper extends MyMapper {
@Param(value = "dimensionID") String dimensionID);
@Select("select urd.ID, urd.OrganizationID as OrgID, urd.UserID, urd.IsAccessible, urd.HasOriginalRole, u.UserName as UserName "
+ "from UserOrganization as urd join \"USER\" as u on urd.UserID = u.ID where u.Status = 1")
+ "from UserOrganization as urd join User as u on urd.UserID = u.ID where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "OrgID", property = "orgID", javaType = String.class),
@Result(column = "UserID", property = "userID", javaType = String.class),
......
......@@ -138,7 +138,7 @@ public interface UserMapper extends MyMapper {
@Select("select u.UserName as UserName, o.ID as OrganizationID, o.Name as OrganizationName, "
+ "u.Email as Email, u.Status as Status, u.AttemptTimes as AttemptTimes, u.CreateTime as CreateTime, "
+ "u.ExpirationDate as ExpirationDate, u.IsAdmin as IsAdmin, u.ID as ID, u.LockedTime as LockedTime, "
+ "u.LoginType as LoginType, u.Password as Password, u.PasswordUpdateTime as PasswordUpdateTime, u.UpdateTime as UpdateTime from \"USER\" as u "
+ "u.LoginType as LoginType, u.Password as Password, u.PasswordUpdateTime as PasswordUpdateTime, u.UpdateTime as UpdateTime from User as u "
+ "left join Organization as o on u.OrganizationID = o.ID "
+ "where u.ID = #{userId}")
@Results({
......
package pwc.taxtech.atms.dao.dao;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.dao.AccountMappingMapper;
import pwc.taxtech.atms.entitiy.AccountMapping;
import pwc.taxtech.atms.entitiy.AccountMappingExample;
import pwc.taxtech.atms.entitiy.EnterpriseAccount;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class AccountMappingDao {
@Autowired
AccountMappingMapper mapper;
@Autowired
EnterpriseAccountDao epAccountDao;
@Autowired
AccountMappingManualDao mappingManualDao;
public void delByEpAccountCodeList(List<String> codeList) {
if (CollectionUtils.isNotEmpty(codeList)) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountCodeIn(codeList);
mapper.deleteByExample(example);
}
}
public boolean isStdExists(String accountSetID, String enterpirseAccountCode, String industryID, String orgID) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountCodeEqualTo(enterpirseAccountCode);
criteria.andEnterpriseAccountSetIDEqualTo(accountSetID);
criteria.andOrganizationIDEqualTo(orgID);
criteria.andIndustryIDEqualTo(industryID);
criteria.andStandardAccountCodeNotEqualTo(CommonConstants.EmptyStdCode);
return mapper.countByExample(example) > 0;
}
private void updateToTable(String accountCode, String accountSetId, String stdAccountCode,
String industryID, String enterpriseAccountID, String orgID) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountCodeEqualTo(accountCode);
criteria.andEnterpriseAccountSetIDEqualTo(accountSetId);
criteria.andOrganizationIDEqualTo(orgID);
criteria.andIndustryIDEqualTo(industryID);
mapper.deleteByExample(example);
AccountMapping mapping = new AccountMapping();
mapping.setID(CommonUtils.getUUID());
mapping.setEnterpriseAccountCode(accountCode);
mapping.setEnterpriseAccountSetID(accountSetId);
mapping.setOrganizationID(orgID);
mapping.setStandardAccountCode(stdAccountCode);
mapping.setIndustryID(industryID);
mapper.insertSelective(mapping);
}
public void mapStdAccountByCode(String accountSetId, String stdAccountCode, String accountCode,
String industryID, String orgId, boolean bOverwrite, int acctLevel) {
String enterpriseAccountID = epAccountDao.getEpAccountID(accountCode, accountSetId);
if (StringUtils.isBlank(stdAccountCode))
stdAccountCode = CommonConstants.NullStdCode;
//region 新逻辑
if (!bOverwrite) {
if (!isStdExists(accountSetId, accountCode, industryID, orgId)) {
updateToTable(accountCode, accountSetId, stdAccountCode, industryID, enterpriseAccountID, orgId);
}
} else {
updateToTable(accountCode, accountSetId, stdAccountCode, industryID, enterpriseAccountID, orgId);
}
//endregion
}
public List<AccountMapping> getAccountMapping(String epAccountCode, String epAccountSetID, String orgID) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountCodeEqualTo(epAccountCode);
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetID);
criteria.andOrganizationIDEqualTo(orgID);
return mapper.selectByExample(example);
}
public void delMapping(String epAccountCode, String epAccountSetID, String orgID, String industryID) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountCodeEqualTo(epAccountCode);
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetID);
criteria.andOrganizationIDEqualTo(orgID);
criteria.andIndustryIDEqualTo(industryID);
mapper.deleteByExample(example);
}
public void delMapping(String epAccountSetID, String orgID, String industryID) {
AccountMappingExample example = new AccountMappingExample();
AccountMappingExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetID);
criteria.andOrganizationIDEqualTo(orgID);
criteria.andIndustryIDEqualTo(industryID);
mapper.deleteByExample(example);
}
public void clearMapping(List<EnterpriseAccount> eaList, String industryID,
String orgID, Boolean isToClearAllMapping) {
if (CollectionUtils.isEmpty(eaList)) {
return;
}
List<String> codeList = eaList.stream().map(EnterpriseAccount::getCode).collect(Collectors.toList());
if (!isToClearAllMapping) {
for (EnterpriseAccount ea : eaList) {
delMapping(ea.getCode(), ea.getEnterpriseAccountSetID(), industryID, orgID);
//同时删除手动对应表的对应关系
mappingManualDao.delMapping(ea.getFullName(), ea.getEnterpriseAccountSetID(), industryID, orgID);
clearChildMapping(ea.getCode(), ea.getEnterpriseAccountSetID(), industryID, orgID, codeList);
}
} else {
delMapping(eaList.get(0).getEnterpriseAccountSetID(), industryID, orgID);
}
}
private void clearChildMapping(String eaCode, String setId, String industryID, String orgID, List<String> codeList) {
List<EnterpriseAccount> list = epAccountDao.getEpAccountBy(eaCode, setId);
for (EnterpriseAccount row : list) {
String code = row.getCode();
//如果在本身的id里面包含了,说明第一次遍历的时候已经更新过数据库了,不需要再一次更新
if (codeList.contains(code)) continue;
//string updatesql = "UPDATE EnterpriseAccount SET StdCode=NULL WHERE ID=@ID";
delMapping(code, setId, orgID, industryID);
clearChildMapping(row.getCode(), row.getEnterpriseAccountSetID(), industryID, orgID, codeList);
}
}
}
package pwc.taxtech.atms.dao.dao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.AccountMappingManualMapper;
import pwc.taxtech.atms.entitiy.AccountMappingManual;
import pwc.taxtech.atms.entitiy.AccountMappingManualExample;
import java.util.List;
import java.util.Optional;
@Service
public class AccountMappingManualDao {
@Autowired
AccountMappingManualMapper mapper;
public Optional<List<AccountMappingManual>> getAll() {
AccountMappingManualExample example = new AccountMappingManualExample();
return Optional.ofNullable(mapper.selectByExample(example));
}
public void delMapping(String fullName,String epAccountSetID,String orgID,String industryID){
AccountMappingManualExample example = new AccountMappingManualExample();
AccountMappingManualExample.Criteria criteria = example.createCriteria();
criteria.andFullNameEqualTo(fullName);
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetID);
criteria.andOrganizationIDEqualTo(StringUtils.defaultString(orgID));
criteria.andIndustryIDEqualTo(StringUtils.defaultString(industryID));
mapper.deleteByExample(example);
}
}
package pwc.taxtech.atms.dao.dao;
import com.google.common.collect.Lists;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.AccountMappingConstant;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.dao.EnterpriseAccountMapper;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto;
import pwc.taxtech.atms.entitiy.EnterpriseAccount;
import pwc.taxtech.atms.entitiy.EnterpriseAccountExample;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Service
public class EnterpriseAccountDao {
@Autowired
private EnterpriseAccountMapper enterpriseAccountMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
public List<EnterpriseAccount> getAll() {
EnterpriseAccountExample example = new EnterpriseAccountExample();
return enterpriseAccountMapper.selectByExample(example);
}
public List<EnterpriseAccount> getByEpAccountSetId(String epAccountSetId) {
EnterpriseAccountExample example = new EnterpriseAccountExample();
EnterpriseAccountExample.Criteria criteria = example.createCriteria();
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetId);
return enterpriseAccountMapper.selectByExample(example);
}
public List<EnterpriseAccount> getEpAccountBy(String parentCode, String epAccountSetId) {
EnterpriseAccountExample example = new EnterpriseAccountExample();
EnterpriseAccountExample.Criteria criteria = example.createCriteria();
criteria.andParentCodeEqualTo(parentCode);
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetId);
return enterpriseAccountMapper.selectByExample(example);
}
public Optional<EnterpriseAccount> getEpAccount(String epAccountCode, String epAccountSetId) {
EnterpriseAccountExample example = new EnterpriseAccountExample();
EnterpriseAccountExample.Criteria criteria = example.createCriteria();
criteria.andCodeEqualTo(epAccountCode);
criteria.andEnterpriseAccountSetIDEqualTo(epAccountSetId);
return enterpriseAccountMapper.selectByExample(example).stream().findFirst();
}
public String getEpAccountID(String epAccountCode, String epAccountSetId) {
Optional<EnterpriseAccount> optional = getEpAccount(epAccountCode, epAccountSetId);
return optional.isPresent() ? optional.get().getID() : StringUtils.EMPTY;
}
public List<EnterpriseAccountDto> getAccountMappingResult(String accountSetId, int ruleId, String industryId) {
//amk.IndustryId倒序排列可以保证在结果集中,同一个COA,本行业的匹配结果在通用关键字匹配结果之前出现
String sql = "SELECT a.Code, a.IsLeaf, sa.Code StdCode,a.FullName as AccountFullName, amk.FullName as MappingFullName,amk.IndustryId"
+ " FROM (select * from AccountMappingKeyword where IndustryId=?) amk "
+ " INNER JOIN (select * from StandardAccount where IndustryId=?) sa ON amk.StandardCode = sa.Code"
+ " INNER JOIN EnterpriseAccount a on a.FullName like amk.FullName"
+ " WHERE amk.RuleType = ? AND sa.IsLeaf = 1 AND a.EnterpriseAccountSetID=?"
+ " ORDER BY a.Code,amk.IndustryId DESC";
List<Map<String, Object>> queryList = jdbcTemplate.queryForList(sql, industryId, industryId, ruleId, accountSetId);
List<EnterpriseAccountDto> list = Lists.newArrayList();
for (Map<String, Object> obj : queryList) {
EnterpriseAccountDto account = new EnterpriseAccountDto();
account.setCode(MapUtils.getString(obj, "Code"));
account.setIsLeaf(StringUtils.equals(MapUtils.getString(obj, "isLeaf"), "1"));
account.setStdCode(MapUtils.getString(obj, "StdCode"));
account.setFullName(MapUtils.getString(obj, "AccountFullName"));
account.setMappingFullName(MapUtils.getString(obj, "MappingFullName"));
list.add(account);
}
return list;
}
public List<Map<String, Object>> selectAccounts(String industryId, String accountSetId, String organizationID, int iAcctProp,
int iIsMapped, int iLevel, Boolean bIsActive) {
//In admin module, enterprise account has IsInVoucher to identify vouchers
//However web admin is not requried voucher, so the field is not available in web admin,
//so set acctVoucherHasNull=true at this moment
//But in the web admin, balance is not required at this stage, so set balanceIsNull=true
//string sql = "select count(1) from EnterpriseAccount where IsInVoucher is null";
//bool balanceIsNull = true;
//bool acctVoucherHasNull = true;
List<String> whereList = Lists.newArrayList();
String sql = "SELECT * FROM ( " +
"SELECT CASE IsLeaf WHEN 0 THEN '+' ELSE '' END IsEx,Code, Name, FullName, " +
"CASE Direction WHEN 1 THEN N'借方' WHEN -1 THEN N'贷方' END Direction, " +
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdAccountCode END StdCode," +
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdName END StdName, " +
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdAccountCode + '/' + StdFullName END StdCodeName, " +
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE CASE StdDirection WHEN 1 THEN N'借方' WHEN -1 THEN N'贷方' END END StdDirection, " +
"CASE WHEN AcctProp<>StdAcctProp THEN 1 ELSE 0 END IsAcctPropDiff," +
"CASE WHEN StdAccountCode IS NULL THEN 0 ELSE 1 END MappingStatus, " +
"CASE WHEN StdAccountCode IS NULL THEN AcctProp ELSE StdAcctProp END AcctProp, ParentCode, AcctLevel, StdAccountCode AcctStdCode, IsLeaf " +
" FROM (SELECT ID,Code,Name,FullName,Direction,AcctProp,ParentCode,AcctLevel,IsLeaf FROM EnterpriseAccount WHERE EnterpriseAccountSetID=?) ea " +
"LEFT JOIN (SELECT EnterpriseAccountCode ,StandardAccountCode FROM AccountMapping WHERE OrganizationID=? AND IndustryID=?) am ON ea.Code=am.EnterpriseAccountCode " +
"LEFT JOIN (SELECT ID StdID, Code StdAccountCode, Name StdName, FullName StdFullName,Direction StdDirection,AcctProp StdAcctProp FROM StandardAccount WHERE IndustryID=?) sa ON am.StandardAccountCode=sa.StdAccountCode ) T";
List<Object> params = Lists.newArrayList(accountSetId, organizationID, industryId, industryId);
if (iAcctProp != EnterpriseAccountConstant.InvalidId) {
sql += "AcctProp = ?";
params.add(iAcctProp);
}
if (iIsMapped == AccountMappingConstant.Status.UNMAPPED.getCode()) {
sql += "StdCode IS NULL";
} else if (iIsMapped == AccountMappingConstant.Status.MAPPED.getCode()) {
sql += "StdCode IS NOT NULL";
} else if (iIsMapped == AccountMappingConstant.Status.DIRECTION_DIFFERENT.getCode()) {
sql += "StdCode IS NOT NULL AND Direction<>StdDirection";
} else if (iIsMapped == AccountMappingConstant.Status.ACCOUNT_TYPE_DIFFERENT.getCode()) {
sql += "StdCode IS NOT NULL AND IsAcctPropDiff=1";
}
if (iLevel != EnterpriseAccountConstant.InvalidId) {
sql += "AcctLevel = ?";
params.add(iLevel);
}
sql += " ORDER BY Code";
return jdbcTemplate.queryForList(sql, params.toArray());
}
}
package pwc.taxtech.atms.dao.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper;
import pwc.taxtech.atms.entitiy.EnterpriseAccountSetOrg;
import pwc.taxtech.atms.entitiy.EnterpriseAccountSetOrgExample;
import java.util.List;
@Service
public class EnterpriseAccountSetOrgDao {
@Autowired
private EnterpriseAccountSetOrgMapper mapper;
public List<EnterpriseAccountSetOrg> getByOrgIdAndAccountSetId(String orgId, String accountSetId) {
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
EnterpriseAccountSetOrgExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIDEqualTo(orgId);
criteria.andEnterpriseAccountSetIDEqualTo(accountSetId);
return mapper.selectByExample(example);
}
}
package pwc.taxtech.atms.dao.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.entitiy.Organization;
@Service
public class OrganizationDao {
@Autowired
private OrganizationMapper organizationMapper;
}
package pwc.taxtech.atms.dao.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.StdAccountEnum;
import pwc.taxtech.atms.dao.StandardAccountMapper;
import pwc.taxtech.atms.entitiy.StandardAccount;
import pwc.taxtech.atms.entitiy.StandardAccountExample;
import java.util.List;
import java.util.Optional;
@Service
public class StandardAccountDao {
@Autowired
private StandardAccountMapper standardAccountMapper;
public Optional<List<StandardAccount>> getByIndustryId(String industryId) {
StandardAccountExample example = new StandardAccountExample();
StandardAccountExample.Criteria criteria = example.createCriteria();
criteria.andIndustryIDEqualTo(industryId);
return Optional.ofNullable(standardAccountMapper.selectByExample(example));
}
public List<StandardAccount> getByCodeAndIndustryId(String code, String industryId) {
StandardAccountExample example = new StandardAccountExample();
StandardAccountExample.Criteria criteria = example.createCriteria();
criteria.andCodeEqualTo(code);
criteria.andIndustryIDEqualTo(industryId);
return standardAccountMapper.selectByExample(example);
}
public List<StandardAccount> getStdAccount(StdAccountEnum.RuleType ruleType, String industryId,Boolean isActive,Boolean isLeaf) {
StandardAccountExample example = new StandardAccountExample();
StandardAccountExample.Criteria criteria = example.createCriteria();
criteria.andRuleTypeEqualTo(ruleType.getCode());
criteria.andIndustryIDEqualTo(industryId);
criteria.andIsActiveEqualTo(isActive);
criteria.andIsLeafEqualTo(isLeaf);
return standardAccountMapper.selectByExample(example);
}
}
......@@ -34,8 +34,19 @@ public class OperationResultDto<T> extends OperationResultBase {
return new OperationResultDto<>(true);
}
public static OperationResultDto<?> success(Object data) {
OperationResultDto dto = new OperationResultDto();
dto.setData(data);
dto.setResult(true);
return dto;
}
public static OperationResultDto<?> error() {
return new OperationResultDto<>(false, null);
return OperationResultDto.error(null);
}
public static OperationResultDto<?> error(String msg) {
return new OperationResultDto<>(false, msg);
}
public Map<String, String> getErrors() {
......
package pwc.taxtech.atms.dto.accountmapping;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.Date;
public class AccountMappingManualDto {
@JSONField(name = "id")
public String ID;
public String standardCode;
public String fullName;
public String enterpriseAccountSetID;
public String organizationID;
public String industryID;
public int priority;
public Date updateTime;
public String updateBy;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getStandardCode() {
return standardCode;
}
public void setStandardCode(String standardCode) {
this.standardCode = standardCode;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getEnterpriseAccountSetID() {
return enterpriseAccountSetID;
}
public void setEnterpriseAccountSetID(String enterpriseAccountSetID) {
this.enterpriseAccountSetID = enterpriseAccountSetID;
}
public String getOrganizationID() {
return organizationID;
}
public void setOrganizationID(String organizationID) {
this.organizationID = organizationID;
}
public String getIndustryID() {
return industryID;
}
public void setIndustryID(String industryID) {
this.industryID = industryID;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
}
package pwc.taxtech.atms.dto.epaccount;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
import java.util.Map;
public class AccountMapDto {
public String orgID;
@JSONField(name = "EnterpriseAccountCodes")
public String[] enterpriseAccountCodes;
@JSONField(name = "StandardAccountCode")
public String standardAccountCode;
@JSONField(name = "ParentAccountMappingResult")
public Map<String, List<String>> parentAccountMappingResult;
@JSONField(name = "AccountSetID")
public String accountSetID;
public String getOrgID() {
return orgID;
}
public void setOrgID(String orgID) {
this.orgID = orgID;
}
public String[] getEnterpriseAccountCodes() {
return enterpriseAccountCodes;
}
public void setEnterpriseAccountCodes(String[] enterpriseAccountCodes) {
this.enterpriseAccountCodes = enterpriseAccountCodes;
}
public String getStandardAccountCode() {
return standardAccountCode;
}
public void setStandardAccountCode(String standardAccountCode) {
this.standardAccountCode = standardAccountCode;
}
public Map<String, List<String>> getParentAccountMappingResult() {
return parentAccountMappingResult;
}
public void setParentAccountMappingResult(Map<String, List<String>> parentAccountMappingResult) {
this.parentAccountMappingResult = parentAccountMappingResult;
}
public String getAccountSetID() {
return accountSetID;
}
public void setAccountSetID(String accountSetID) {
this.accountSetID = accountSetID;
}
}
package pwc.taxtech.atms.dto.stdaccount;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
public class StandardAccountDto {
@JSONField(name = "id")
public String ID;
public String code;
public String name;
public String parentCode;
public String fullName;
public int number;
public Boolean expanded;
public Integer acctProp;
public Integer subProp;
public Integer acctLevel;
public int direction;
public Boolean isLeaf;
public int ruleType;
public Boolean isActive;
public String englishName;
public String industryID;
public String title;
public String etsName;
public String etsCode;
public List<StandardAccountDto> children;
public String treeLevel;
/// <summary>
/// 父级科目名称
/// </summary>
/// <value>
/// The name of the parent.
/// </value>
public String parentName;
/// <summary>
/// 父级科目全名
/// </summary>
/// <value>
/// The full name of the parent.
/// </value>
public String parentFullName;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public Boolean getExpanded() {
return expanded;
}
public void setExpanded(Boolean expanded) {
this.expanded = expanded;
}
public Integer getAcctProp() {
return acctProp;
}
public void setAcctProp(Integer acctProp) {
this.acctProp = acctProp;
}
public Integer getSubProp() {
return subProp;
}
public void setSubProp(Integer subProp) {
this.subProp = subProp;
}
public Integer getAcctLevel() {
return acctLevel;
}
public void setAcctLevel(Integer acctLevel) {
this.acctLevel = acctLevel;
}
public int getDirection() {
return direction;
}
public void setDirection(int direction) {
this.direction = direction;
}
public Boolean getLeaf() {
return isLeaf;
}
public void setLeaf(Boolean leaf) {
isLeaf = leaf;
}
public int getRuleType() {
return ruleType;
}
public void setRuleType(int ruleType) {
this.ruleType = ruleType;
}
public Boolean getActive() {
return isActive;
}
public void setActive(Boolean active) {
isActive = active;
}
public String getEnglishName() {
return englishName;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
public String getIndustryID() {
return industryID;
}
public void setIndustryID(String industryID) {
this.industryID = industryID;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getEtsName() {
return etsName;
}
public void setEtsName(String etsName) {
this.etsName = etsName;
}
public String getEtsCode() {
return etsCode;
}
public void setEtsCode(String etsCode) {
this.etsCode = etsCode;
}
public List<StandardAccountDto> getChildren() {
return children;
}
public void setChildren(List<StandardAccountDto> children) {
this.children = children;
}
public String getTreeLevel() {
return treeLevel;
}
public void setTreeLevel(String treeLevel) {
this.treeLevel = treeLevel;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public String getParentFullName() {
return parentFullName;
}
public void setParentFullName(String parentFullName) {
this.parentFullName = parentFullName;
}
}
package pwc.taxtech.atms.dto.stdaccount;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
public class StdAccountFancyTreeDto {
private String title;
private Boolean expanded;
private Boolean hasChildren;
@JSONField(name = "id")
private String ID;
private String acctProp;
private String direction;
private String code;
private String name;
private String fullName;
private List<StdAccountFancyTreeDto> children;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Boolean getExpanded() {
return expanded;
}
public void setExpanded(Boolean expanded) {
this.expanded = expanded;
}
public Boolean getHasChildren() {
return hasChildren;
}
public void setHasChildren(Boolean hasChildren) {
this.hasChildren = hasChildren;
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getAcctProp() {
return acctProp;
}
public void setAcctProp(String acctProp) {
this.acctProp = acctProp;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public List<StdAccountFancyTreeDto> getChildren() {
return children;
}
public void setChildren(List<StdAccountFancyTreeDto> children) {
this.children = children;
}
}
package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table AccountMappingManual
*
* @mbg.generated do_not_delete_during_merge
*/
public class AccountMappingManual implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.ID
*
* @mbg.generated
*/
private String ID;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.StandardCode
*
* @mbg.generated
*/
private String standardCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.FullName
*
* @mbg.generated
*/
private String fullName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.EnterpriseAccountSetID
*
* @mbg.generated
*/
private String enterpriseAccountSetID;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.OrganizationID
*
* @mbg.generated
*/
private String organizationID;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.IndustryID
*
* @mbg.generated
*/
private String industryID;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.UpdateTime
*
* @mbg.generated
*/
private Date updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column AccountMappingManual.UpdateBy
*
* @mbg.generated
*/
private String updateBy;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.ID
*
* @return the value of AccountMappingManual.ID
*
* @mbg.generated
*/
public String getID() {
return ID;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.ID
*
* @param ID the value for AccountMappingManual.ID
*
* @mbg.generated
*/
public void setID(String ID) {
this.ID = ID == null ? null : ID.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.StandardCode
*
* @return the value of AccountMappingManual.StandardCode
*
* @mbg.generated
*/
public String getStandardCode() {
return standardCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.StandardCode
*
* @param standardCode the value for AccountMappingManual.StandardCode
*
* @mbg.generated
*/
public void setStandardCode(String standardCode) {
this.standardCode = standardCode == null ? null : standardCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.FullName
*
* @return the value of AccountMappingManual.FullName
*
* @mbg.generated
*/
public String getFullName() {
return fullName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.FullName
*
* @param fullName the value for AccountMappingManual.FullName
*
* @mbg.generated
*/
public void setFullName(String fullName) {
this.fullName = fullName == null ? null : fullName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.EnterpriseAccountSetID
*
* @return the value of AccountMappingManual.EnterpriseAccountSetID
*
* @mbg.generated
*/
public String getEnterpriseAccountSetID() {
return enterpriseAccountSetID;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.EnterpriseAccountSetID
*
* @param enterpriseAccountSetID the value for AccountMappingManual.EnterpriseAccountSetID
*
* @mbg.generated
*/
public void setEnterpriseAccountSetID(String enterpriseAccountSetID) {
this.enterpriseAccountSetID = enterpriseAccountSetID == null ? null : enterpriseAccountSetID.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.OrganizationID
*
* @return the value of AccountMappingManual.OrganizationID
*
* @mbg.generated
*/
public String getOrganizationID() {
return organizationID;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.OrganizationID
*
* @param organizationID the value for AccountMappingManual.OrganizationID
*
* @mbg.generated
*/
public void setOrganizationID(String organizationID) {
this.organizationID = organizationID == null ? null : organizationID.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.IndustryID
*
* @return the value of AccountMappingManual.IndustryID
*
* @mbg.generated
*/
public String getIndustryID() {
return industryID;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.IndustryID
*
* @param industryID the value for AccountMappingManual.IndustryID
*
* @mbg.generated
*/
public void setIndustryID(String industryID) {
this.industryID = industryID == null ? null : industryID.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.UpdateTime
*
* @return the value of AccountMappingManual.UpdateTime
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.UpdateTime
*
* @param updateTime the value for AccountMappingManual.UpdateTime
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column AccountMappingManual.UpdateBy
*
* @return the value of AccountMappingManual.UpdateBy
*
* @mbg.generated
*/
public String getUpdateBy() {
return updateBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column AccountMappingManual.UpdateBy
*
* @param updateBy the value for AccountMappingManual.UpdateBy
*
* @mbg.generated
*/
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AccountMappingManual
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", ID=").append(ID);
sb.append(", standardCode=").append(standardCode);
sb.append(", fullName=").append(fullName);
sb.append(", enterpriseAccountSetID=").append(enterpriseAccountSetID);
sb.append(", organizationID=").append(organizationID);
sb.append(", industryID=").append(industryID);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateBy=").append(updateBy);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package pwc.taxtech.atms.entitiy;
import com.alibaba.fastjson.annotation.JSONField;
import java.io.Serializable;
import java.util.Date;
......@@ -18,6 +20,7 @@ public class Menu implements Serializable {
*
* @mbg.generated
*/
@JSONField(name = "id")
private String ID;
/**
......
......@@ -87,7 +87,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
private Integer zipCode;
private String zipCode;
/**
*
......@@ -309,7 +309,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
public Integer getZipCode() {
public String getZipCode() {
return zipCode;
}
......@@ -321,7 +321,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
public void setZipCode(Integer zipCode) {
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
......
......@@ -3,10 +3,7 @@ package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.epaccount.AccountMappingDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountAndValidateInfo;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto;
import pwc.taxtech.atms.dto.epaccount.*;
import pwc.taxtech.atms.entitiy.EnterpriseAccount;
public interface EnterpriseAccountService {
......@@ -97,6 +94,16 @@ public interface EnterpriseAccountService {
OperationResultDto clearRepeatEnterpriseAccountList(EnterpriseAccountSetDto enterpriseAccountSetDto);
List<AccountMappingDto> getAccountMappingOrg(String organizationID);
List<EnterpriseAccountSetDto> getEnterpriseAccountSetListByOrgID(String orgId);
List<EnterpriseAccountDto> getList(String epAccountSetID, String orgId, String filterType);
OperationResultDto autoMap(String orgId, String accountSetId);
OperationResultDto mapAccount(AccountMapDto accountMapDto);
OperationResultDto clearMap(String[] epAccountIDs, String orgId);
}
......@@ -14,4 +14,6 @@ public interface MenuService {
List<Menu> findByIsActive(Boolean isActive);
void update(Menu menu);
}
......@@ -9,6 +9,7 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.OrganizationValidateDto;
import pwc.taxtech.atms.dto.dimension.DimensionOrgDtoDashboard;
import pwc.taxtech.atms.dto.dimension.OrgDashboardParams;
import pwc.taxtech.atms.dto.navtree.DevTreeDto;
import pwc.taxtech.atms.dto.navtree.NavTreeDto;
import pwc.taxtech.atms.dto.organization.OrgBasicDto;
import pwc.taxtech.atms.dto.organization.OrgCustomDto;
......@@ -83,4 +84,6 @@ public interface OrganizationService {
OrgGeneralInfoDto getGeneralInfo(String orgID);
List<DevTreeDto> getOrgIvhTreeList(Integer useType,String orgSetId);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.dto.stdaccount.StandardAccountDto;
import pwc.taxtech.atms.dto.stdaccount.StdAccountFancyTreeDto;
import java.util.List;
public interface StdAccountService {
List<StdAccountFancyTreeDto> getStdAccountHierarchy(String orgId) throws ServiceException;
List<StandardAccountDto> GetStdAccountLinkEtsAccount(String orgID, String accountSetID);
}
......@@ -5,6 +5,8 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -56,7 +58,8 @@ public class AreaServiceImpl implements AreaService {
AreaExample areaExample = new AreaExample();
Criteria criteria = areaExample.createCriteria();
criteria.andParentIDIsNull();
// criteria.andParentIDIsNull();
criteria.andParentIDEqualTo(StringUtils.EMPTY);
return areaMapper.selectByExample(areaExample);
......@@ -226,7 +229,7 @@ public class AreaServiceImpl implements AreaService {
List<AreaDto> areaList = getAreaList(type);
// Top Node
List<AreaDto> topNode = areaList.stream().filter(sa -> sa.getParentID() == null).collect(Collectors.toList());
List<AreaDto> topNode = areaList.stream().filter(sa -> StringUtils.isBlank(sa.getParentID())).collect(Collectors.toList());
if (topNode == null) {
throw new ApplicationException(AreaMessage.NoAreaRootData);
}
......
package pwc.taxtech.atms.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.service.OperationLogService;
public class BaseService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
protected AuthUserHelper authUserHelper;
@Autowired
protected AtmsApiSettings atmsApiSettings;
@Autowired
protected OperationLogService operationLogService;
}
......@@ -120,4 +120,9 @@ public class MenuServiceImpl implements MenuService {
return menuMapper.selectByExample(menuExample);
}
@Override
public void update(Menu menu) {
menuMapper.updateByPrimaryKeySelective(menu);
}
}
......@@ -25,6 +25,8 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.format.DateTimeFormat;
......@@ -95,6 +97,8 @@ import pwc.taxtech.atms.dto.dimension.DimensionValueDisplayDto;
import pwc.taxtech.atms.dto.dimension.DimensionValueJoinDimensionDto;
import pwc.taxtech.atms.dto.dimension.OrgDashboardParams;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetOrgDto;
import pwc.taxtech.atms.dto.navtree.DevTreeDto;
import pwc.taxtech.atms.dto.navtree.IvhTreeDto;
import pwc.taxtech.atms.dto.navtree.NavTreeDto;
import pwc.taxtech.atms.dto.organization.OrgBasicDto;
import pwc.taxtech.atms.dto.organization.OrgCountDto;
......@@ -2848,6 +2852,103 @@ public class OrganizationServiceImpl implements OrganizationService {
return getOrgGeneralInfo(orgID);
}
@Override
public List<DevTreeDto> getOrgIvhTreeList(Integer useType, String orgSetId) {
//todo
List<DevTreeDto> result = Lists.newArrayList();
List<IvhTreeDto> orgDtoList = Lists.newArrayList();
List<Organization> orgList;
OrganizationExample orgExample = new OrganizationExample();
if (useType < 2)
{
orgList = organizationMapper.selectByExample(orgExample);
}
else
{
EnterpriseAccountSetOrgExample tmpExample = new EnterpriseAccountSetOrgExample();
EnterpriseAccountSetOrgExample.Criteria criteria = tmpExample.createCriteria();
criteria.andEnterpriseAccountSetIDEqualTo(orgSetId);
List<EnterpriseAccountSetOrg> enAccountSetOrgList = enterpriseAccountSetOrgMapper.selectByExample(tmpExample);
if (CollectionUtils.isNotEmpty(enAccountSetOrgList)){
List<String> orgIdList = enAccountSetOrgList.stream().map(EnterpriseAccountSetOrg::getOrganizationID)
.collect(toList());
OrganizationExample.Criteria orgCriteria = orgExample.createCriteria();
orgCriteria.andIDIn(orgIdList);
orgList = organizationMapper.selectByExample(orgExample);
}else {
orgList = Lists.newArrayList();
}
}
if (CollectionUtils.isNotEmpty(orgList)) {
//find rootOrg
List<Organization> rootOrgList;
if (useType == 1) {
rootOrgList = orgList.stream().filter(x -> StringUtils.isBlank(x.getParentID())).collect(toList());
} else {
rootOrgList = orgList.stream().filter(x -> StringUtils.isBlank(x.getParentID()) && x.getIsActive())
.collect(toList());
}
List<ServiceType> serviceList = Lists.newArrayList();
for (Organization org: rootOrgList){
IvhTreeDto root = new IvhTreeDto();
root.setChildren(Lists.newArrayList());
root.setLabel(org.getName());
root.setValue(org);
orgDtoList.add(generateIvhTreeDto(org,orgList,serviceList,useType));
}
}
return orgDtoList.stream().map(this::devTreeDtoMapper).collect(toList());
}
private DevTreeDto devTreeDtoMapper(IvhTreeDto ivhTreeDto) {
DevTreeDto dto = new DevTreeDto();
dto.setText(ivhTreeDto.getLabel());
List<IvhTreeDto> childList = ivhTreeDto.getChildren();
if (CollectionUtils.isNotEmpty(childList)) {
dto.setItems(Lists.newArrayList());
for (IvhTreeDto ivh : childList) {
dto.getItems().add(devTreeDtoMapper(ivh));
}
}
dto.setId(ivhTreeDto.getId());
dto.setData(ivhTreeDto);
return dto;
}
private IvhTreeDto generateIvhTreeDto(Organization parentOrg, List<Organization> orgList,
List<ServiceType> serviceList, int useType) {
IvhTreeDto result = new IvhTreeDto();
OrganizationDto parentOrgDto = new OrganizationDto();
CommonUtils.copyProperties(parentOrg, parentOrgDto);
if (null != parentOrg && StringUtils.isNotBlank(parentOrg.getID())) {
parentOrgDto.setParentName(orgList.stream().filter(x -> StringUtils.equals(x.getID(), parentOrg.getParentID()))
.findFirst().map(x -> x.getName()).orElse(StringUtils.EMPTY));
}
List<Organization> subOrgList;
if (useType == 1) {
subOrgList = orgList.stream().filter(x -> StringUtils.equals(x.getParentID(), parentOrg.getID())).collect(toList());
} else {
subOrgList = orgList.stream().filter(x -> StringUtils.equals(x.getParentID(), parentOrg.getID()) && x.getIsActive())
.collect(toList());
}
parentOrgDto.setSubOrgs(Lists.newArrayList());
List<IvhTreeDto> children = Lists.newArrayList();
//create and add subtrees to the current node
for (Organization subOrg : subOrgList) {
children.add(generateIvhTreeDto(subOrg, orgList, serviceList, useType));
}
result.setLabel(parentOrgDto.getName());
result.setValue(parentOrgDto);
result.setChildren(children);
return result;
}
private OrgGeneralInfoDto getOrgGeneralInfo(String orgID) {
List<OrgGeneralInfoMiddleDto> query = organizationMapper.selectJoinToOrgGeneralInfo();
List<OrgGeneralInfoMiddleDto> filter = query.stream().filter(x -> Strings.equals(x.getID(), orgID))
......
package pwc.taxtech.atms.service.impl;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.constant.enums.StdAccountEnum;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.StandardAccountMapper;
import pwc.taxtech.atms.dao.dao.StandardAccountDao;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.stdaccount.StandardAccountDto;
import pwc.taxtech.atms.dto.stdaccount.StdAccountFancyTreeDto;
import pwc.taxtech.atms.entitiy.Organization;
import pwc.taxtech.atms.entitiy.StandardAccount;
import pwc.taxtech.atms.entitiy.StandardAccountExample;
import pwc.taxtech.atms.service.StdAccountService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class StdAccountServiceImpl extends BaseService implements StdAccountService {
@Autowired
private StandardAccountMapper standardAccountMapper;
@Autowired
private OrganizationMapper organizationMapper;
@Autowired
private StandardAccountDao standardAccountDao;
@Override
public List<StdAccountFancyTreeDto> getStdAccountHierarchy(String orgId) throws ServiceException {
List<StdAccountFancyTreeDto> resultList;
try {
if (StringUtils.isBlank(orgId)) {
return Collections.emptyList();
}
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
if (null == organization) {
return Collections.emptyList();
}
String industryId = organization.getIndustryID();
resultList = new ArrayList<>();
if (StringUtils.isNotBlank(industryId)) {
List<StdAccountFancyTreeDto> dtoList = Lists.newArrayList();
StandardAccountExample example = new StandardAccountExample();
StandardAccountExample.Criteria criteria = example.createCriteria();
criteria.andIndustryIDEqualTo(industryId).andRuleTypeEqualTo(2).andIsActiveEqualTo(true);
List<StandardAccount> standardAccountList = standardAccountMapper.selectByExample(example);
List<StandardAccount> topList = standardAccountList.stream().filter(x -> StringUtils.isBlank(x.getParentCode()))
.collect(Collectors.toList());
for (StandardAccount topNode : topList) {
StdAccountFancyTreeDto dto = rotateToDto(topNode);
getSubStdAccount(dto, standardAccountList);
dtoList.add(dto);
}
Map<String, List<StdAccountFancyTreeDto>> map = dtoList.stream().collect(Collectors.groupingBy(x -> x.getAcctProp()));
for (Map.Entry<String, List<StdAccountFancyTreeDto>> entry : map.entrySet()) {
StdAccountFancyTreeDto root = new StdAccountFancyTreeDto();
root.setExpanded(false);
root.setHasChildren(CollectionUtils.isNotEmpty(entry.getValue()));
root.setTitle(StdAccountEnum.AcctProp.MAPPING.get(entry.getKey()));
root.setChildren(entry.getValue());
resultList.add(root);
}
}
} catch (Exception e) {
throw new ServiceException("getStdAccountHierarchy error.", e);
}
return resultList;
}
@Override
public List<StandardAccountDto> GetStdAccountLinkEtsAccount(String orgID, String accountSetID) {
if (StringUtils.isBlank(orgID)) {
return Collections.emptyList();
}
//todo
Organization organization = organizationMapper.selectByPrimaryKey(orgID);
if (organization == null) {
return Collections.emptyList();
}
String industryID = organization.getIndustryID();
List<StandardAccount> stdAccounts = standardAccountDao.getStdAccount(StdAccountEnum.RuleType.TWO, industryID, true, true);
if (CollectionUtils.isEmpty(stdAccounts)) {
stdAccounts = standardAccountDao.getStdAccount(StdAccountEnum.RuleType.TWO, "0", true, true);
}
return Collections.emptyList();
}
private void getSubStdAccount(StdAccountFancyTreeDto node, List<StandardAccount> allList) {
List<StdAccountFancyTreeDto> childList = allList.stream().filter(x -> StringUtils.equals(node.getCode(), x.getParentCode()))
.map(this::rotateToDto).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(childList)) {
node.setChildren(childList);
node.setHasChildren(true);
for (StdAccountFancyTreeDto tmp : childList) {
getSubStdAccount(tmp, allList);
}
}
}
private StdAccountFancyTreeDto rotateToDto(StandardAccount account) {
StdAccountFancyTreeDto dto = new StdAccountFancyTreeDto();
dto.setExpanded(false);
dto.setHasChildren(false);
CommonUtils.copyProperties(account, dto);
dto.setTitle(dto.getCode() + "-" + (StringUtils.equals(dto.getDirection(), "1") ? "借" : "贷") + "-" + dto.getName());
return dto;
}
}
......@@ -269,23 +269,24 @@ public class UserAccountServiceImpl extends AbstractService implements UserAccou
@Override
public OperationResultDto<User> addNewUser(UserAndUserRoleSaveDto userAndUserRoleSaveDto) {
OperationResultDto<User> user = addUser(userAndUserRoleSaveDto);
if (BooleanUtils.isTrue(user.getResult())) {
MailMto mailMto = new MailMto();
String path = MAIL_TEMPLATE_PATH + "WebAdminWelcomeLetter.html";
String content = CommonUtils.readClasspathFileToString(path);
content = content.replaceAll("\\{Password\\}", user.getResultMsg());
content = content.replaceAll("\\{\\[Env\\]link\\}", atmsApiSettings.getWebUrl());
content = content.replaceAll("\\{UserName\\}", user.getData().getUserName());
mailMto.setContent(content);
// Get Subject Avoid Multi-language
String beginTag = "<title>";
int beginIndex = content.indexOf(beginTag);
int endIndex = content.indexOf("</title>");
String subject = content.substring(beginIndex + beginTag.length(), endIndex);
mailMto.setSubject(subject);
mailMto.setTo(user.getData().getEmail());
commonService.sendMail(mailMto);
}
//todo send mail
// if (BooleanUtils.isTrue(user.getResult())) {
// MailMto mailMto = new MailMto();
// String path = MAIL_TEMPLATE_PATH + "WebAdminWelcomeLetter.html";
// String content = CommonUtils.readClasspathFileToString(path);
// content = content.replaceAll("\\{Password\\}", user.getResultMsg());
// content = content.replaceAll("\\{\\[Env\\]link\\}", atmsApiSettings.getWebUrl());
// content = content.replaceAll("\\{UserName\\}", user.getData().getUserName());
// mailMto.setContent(content);
// // Get Subject Avoid Multi-language
// String beginTag = "<title>";
// int beginIndex = content.indexOf(beginTag);
// int endIndex = content.indexOf("</title>");
// String subject = content.substring(beginIndex + beginTag.length(), endIndex);
// mailMto.setSubject(subject);
// mailMto.setTo(user.getData().getEmail());
// commonService.sendMail(mailMto);
// }
return user;
}
......@@ -343,7 +344,7 @@ public class UserAccountServiceImpl extends AbstractService implements UserAccou
.orElse(new Role()).getServiceTypeID());
userRoleList.add(userRole);
logger.debug("Start to insert user role [ {} ]", userRole.getID());
userRoleMapper.insert(userRole);
userRoleMapper.insertSelective(userRole);
}
}
// 默认添加机构可访问权限
......
......@@ -758,7 +758,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
userRole.setServiceTypeID(r != null ? r.getServiceTypeID() : "");
userRoleList.add(userRole);
logger.debug("Start to insert user role [ {} ] with roleID [ {} ]", userRole.getID(), role);
userRoleMapper.insert(userRole);
userRoleMapper.insertSelective(userRole);
}
// 添加所属机构的访问权限
UserOrganization userOrganization = findUserOrganizationByUserIDAndOrganizationID(user.getID(),
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- DruidDataSource数据源配置) -->
<!-- See: https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_DruidDataSource%E5%8F%82%E8%80%83%E9%85%8D%E7%BD%AE -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
......@@ -42,4 +44,23 @@
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor">
</bean>
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
<property name="patterns">
<list>
<value>pwc.taxtech.atms.dao.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut"/>
</aop:config>
</beans>
\ No newline at end of file
......@@ -267,32 +267,32 @@
<select id="selectUnionDimensionValueOrgByDimension" parameterType="pwc.taxtech.atms.dto.DimensionParamDto" resultMap="UnionDimensionValueOrg">
select * from
(select #{organizationStructureID} as "ID", StructureID as DimensionValueID, "ID" as
OrganizationID from "Organization"
(select #{organizationStructureID} as ID, StructureID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{businessUnitID} as "ID", BusinessUnitID as DimensionValueID, "ID" as
OrganizationID from "Organization"
select #{businessUnitID} as ID, BusinessUnitID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{areaID} as "ID", AreaID as DimensionValueID, "ID" as OrganizationID
from "Organization"
select #{areaID} as ID, AreaID as DimensionValueID, ID as OrganizationID
from Organization
union
select ID, DimensionValueID, OrganizationID from DimensionValueOrg) as q
join
(select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{organizationStructureID} as "DimensionID", CreateTime, UpdateTime from
"OrganizationStructure" where "IsActive"=1
(select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{organizationStructureID} as DimensionID, CreateTime, UpdateTime from
OrganizationStructure where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{businessUnitID} as "DimensionID", CreateTime, UpdateTime from
"BusinessUnit" where "IsActive"=1
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{businessUnitID} as DimensionID, CreateTime, UpdateTime from
BusinessUnit where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{areaID} as "DimensionID", GETDATE() as CreateTime,
GETDATE() as UpdateTime from "Area" where "IsActive"=1
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{areaID} as DimensionID, now() as CreateTime,
now() as UpdateTime from Area where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", DimensionID, CreateTime, UpdateTime from "DimensionValue"
where "IsActive"=1) as p
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, DimensionID, CreateTime, UpdateTime from DimensionValue
where IsActive=1) as p
on p.DimensionValueID = q.DimensionValueID
join
Dimension as r on r.IsActive = 1 and p.DimensionID = r.ID
......
......@@ -318,4 +318,12 @@
order by ${orderByClause}
</if>
</select>
<select id="getAccountDtoByOrgId" resultMap="BaseResultMap">
select ta.ID, ta.Code, ta.Name, ta.IsActive, ta.CreatorID, ta.CreateTime, ta.UpdateTime
from EnterpriseAccountSet ta
left outer join EnterpriseAccountSetOrg tb
on ta.ID = tb.EnterpriseAccountSetID
where tb.OrganizationID=#{orgId}
</select>
</mapper>
\ No newline at end of file
......@@ -282,7 +282,7 @@
select
m.ID as ID,
m.ServiceTypeID as ServiceTypeID,
M.OrganizationID as OrganizationID,
m.OrganizationID as OrganizationID,
m.TemplateGroupID as TemplateGroupID,
t.Name as TemplateGroupName
from OrganizationServiceTemplateGroup as m
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
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