Commit 905dfd13 authored by zhkwei's avatar zhkwei

CIT固定资产-配置、导入、资产清单

parent efa8a3e2
package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo;
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.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.AssetDetailGroupDto;
import pwc.taxtech.atms.dto.AssetDetailGroupStringDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.AssetGroup;
import pwc.taxtech.atms.entity.CitAssetGroupResult;
import pwc.taxtech.atms.service.impl.AssetGroupServiceImpl;
import pwc.taxtech.atms.service.impl.AssetListServiceImpl;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description 资产相关Controller
* @Author zhikai.z.wei
*/
@RestController
@RequestMapping("/api/v1/asset/")
public class AssetListController {
private static Logger logger = LoggerFactory.getLogger(AssetListController.class);
@Autowired
private AssetListServiceImpl assetListService;
/**
*
* @return
*/
@RequestMapping(value = "/getAssetListData", method = RequestMethod.GET)
public @ResponseBody
ApiResultDto getAssetListData(){
logger.info("获取所有资产清单");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData("");
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
apiResultDto.setData("");
return apiResultDto;
}
}
/**
* 根据资产类别(固定资产、长期待摊、无形资产)查询出结果
* @param assetType
* @return
*/
@RequestMapping(value = "/getAssetResultList", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetResultList(Integer assetType){
logger.info("根据资产类别获取资产清单");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetResultList(assetType));
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
*
* @return
*/
@RequestMapping(value = "/getAssetGroupResultData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetGroupResultData(@RequestParam String projectId){
logger.info("获取资产类别");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetGroupResultData(projectId));
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取资产一级分类
* @return
*/
@RequestMapping(value = "/getAssetGroupListData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetGroupListData(){
logger.info("获取资产一级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetGroupListData());
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取资产二级分类
* @return
*/
@RequestMapping(value = "/getAssetDetailGroupListData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetDetailGroupListData(){
logger.info("根据资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetDetailGroupListData());
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
@RequestMapping(value="saveAssetGroupInfo",method = RequestMethod.POST)
public ApiResultDto saveAssetGroupInfo(@RequestBody List<CitAssetGroupResult> assetGroupResults,
@RequestParam Integer saveGroupType,
@RequestParam String projectId){
assetListService.saveAssetGroupInfo(assetGroupResults, saveGroupType, projectId);
return null;
}
/**
* CIT资产文件导入
* @return
*/
@RequestMapping(value = "/assetsImport", method = RequestMethod.POST)
public @ResponseBody
ApiResultDto assetsImport(@RequestParam MultipartFile file,
@RequestParam String filename,
@RequestParam String tempFileName,
@RequestParam String projectId){
logger.info("CIT资产导入");
ApiResultDto apiResultDto = new ApiResultDto();
try{
if (file == null || file.getSize() <= 0) {
apiResultDto.setCode(-1);
apiResultDto.setMessage("没有获取到文件");
logger.warn("没有获取到文件");
return apiResultDto;
}
logger.debug("file name: " + file.getOriginalFilename());
InputStream input = null;
try {
input = file.getInputStream();
//调用资产导入业务逻辑
OperationResultDto assetsImportResult = assetListService.assetsImport(input, file.getOriginalFilename(), projectId);
//判断是否导入成功,若成功获取资产类别并返回页面
if(assetsImportResult.getResult() != null && !assetsImportResult.getResult()){
apiResultDto.setData(assetListService.getAssetGroupResultData(projectId));
}
} catch (IOException e) {
apiResultDto.setCode(-2);
apiResultDto.setMessage("获取文件流失败");
logger.warn("获取文件流失败");
return apiResultDto;
}
apiResultDto.setCode(1);
apiResultDto.setMessage("资产导入成功");
return apiResultDto;
}catch (Exception e){
logger.error("资产导入失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("资产导入失败");
return apiResultDto;
}
}
}
package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo;
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.*;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.AssetDetailGroupDto;
import pwc.taxtech.atms.dto.AssetDetailGroupStringDto;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.AssetGroup;
import pwc.taxtech.atms.service.impl.AssetGroupServiceImpl;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description 资产相关Controller
* @Author zhikai.z.wei
*/
@RestController
@RequestMapping("/api/v1/asset/")
public class AssetMappingController {
private static Logger logger = LoggerFactory.getLogger(AssetMappingController.class);
@Autowired
private AssetGroupServiceImpl assetGroupService;
/**
* 获取各种资产(固定资产、长期待摊、无形资产)二级分类
* @return ApiResultDto
*/
@RequestMapping(value="getAllAssetDetailGroup",method= RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ApiResultDto getAllAssetDetailGroup(){
ApiResultDto apiResultDto = new ApiResultDto();
try{
Map<String, List> assetsMap = new HashMap<String, List>();
logger.info("获取各种类型资产二级分类");
//获取资产一级分类相关数据
List<AssetGroup> allAssetGroup = assetGroupService.getAllAssetGroup();
//获取固定资产
// List<AssetDetailGroup> fixedAssetDetailGroups = assetGroupService.getAllFixedAssetDetailGroup();
//获取长期待摊
List<AssetDetailGroup> longTermPendingDetailGroups = assetGroupService.getAllLongTermPendingDetailGroup();
//获取无形资产
List<AssetDetailGroup> intangibleAssetDetailGroups = assetGroupService.getAllIntangibleAssetsDetailGroup();
assetsMap.put("allAssetGroup",allAssetGroup);
// assetsMap.put("1",fixedAssetDetailGroups);
assetsMap.put("2",longTermPendingDetailGroups);
assetsMap.put("3",intangibleAssetDetailGroups);
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetsMap);
logger.info("获取资产二级分类成功");
return apiResultDto;
}catch(Exception e){
logger.error("获取资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取固定资产二级分类
* @return ApiResultDtoaddAssetDetailGroup
*/
@RequestMapping(value="getFixedAssetDetailGroup",method= RequestMethod.POST)
public @ResponseBody
ApiResultDto getAllFixedAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("获取固定资产二级分类,参数:"+assetDetailGroupDto);
ApiResultDto apiResultDto = new ApiResultDto();
try{
PageInfo<AssetDetailGroupStringDto> detailGroups = assetGroupService.getAllFixedAssetDetailGroup(assetDetailGroupDto);
Long countAssetByType = assetGroupService.countAssetByType(assetDetailGroupDto.getAssetGroupType());
Map map = new HashMap();
map.put("detailGroup",detailGroups);
map.put("totalItem",countAssetByType);
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(map);
logger.info("获取固定资产二级分类成功");
return apiResultDto;
}catch(Exception e){
logger.error("获取固定资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 新增资产二级分类
* @return
*/
@RequestMapping(value="addAssetDetailGroup",method = RequestMethod.POST)
public ApiResultDto addAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("新增资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
if(assetDetailGroupDto ==null ){
apiResultDto.setCode(0);
apiResultDto.setMessage("传参为空!");
return apiResultDto;
}
try{
assetDetailGroupDto.setAssetGroupId(assetGroupService.getAssetGroupByType(assetDetailGroupDto.getAssetGroupType()).get(0).getId());
int i = assetGroupService.addFixedAssetDetailGroup(assetDetailGroupDto);
apiResultDto.setCode(1);
apiResultDto.setMessage("新增成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("新增固定资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("新增失败");
return apiResultDto;
}
}
/**
* 编辑固定资产二级分类
* @return
*/
@RequestMapping(value="editAssetDetailGroup",method= RequestMethod.POST)
public ApiResultDto editAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("编辑资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
int i = assetGroupService.editFixedAssetDetailGroup(assetDetailGroupDto);
apiResultDto.setCode(1);
apiResultDto.setMessage("编辑成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("编辑资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("编辑失败");
return apiResultDto;
}
}
/**
* 删除固定资产二级分类
* @return
*/
@RequestMapping(value="deleteAssetDetailGroup",method= RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ApiResultDto deleteAssetDetailGroup(Long id){
logger.info("删除资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
int i = assetGroupService.deleteFixedAssetDetailGroup(id);
apiResultDto.setCode(1);
apiResultDto.setMessage("删除成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("删除资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("删除失败");
return apiResultDto;
}
}
}
package pwc.taxtech.atms.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import java.io.Serializable;
import java.util.Date;
/**
* AssetDetailGroupDto AssetDetailGroup页面Dto
*
* @author zhikai.z.wei
* @date 2019/1/25
*/
public class AssetDetailGroupDto implements Serializable{
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
@JsonSerialize(using = PwCIdSerialize.class)
private Long assetGroupId;
private String detailGroupName;
private Integer assetGroupType;
private Integer groupYear;
private Date createTime;
private Date updateTime;
private Integer detailGroupType;
private String keyValues;
/**
*
* 扩展属性,当前页码
*
*/
private Integer pageIndex;
/**
*
* 扩展属性,当前页所展示的数量
*
*/
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
@JsonSerialize(using = PwCIdSerialize.class)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAssetGroupId() {
return assetGroupId;
}
public void setAssetGroupId(Long assetGroupId) {
this.assetGroupId = assetGroupId;
}
public String getDetailGroupName() {
return detailGroupName;
}
public void setDetailGroupName(String detailGroupName) {
this.detailGroupName = detailGroupName == null ? null : detailGroupName.trim();
}
public Integer getAssetGroupType() {
return assetGroupType;
}
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
public Integer getGroupYear() {
return groupYear;
}
public void setGroupYear(Integer groupYear) {
this.groupYear = groupYear;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDetailGroupType() {
return detailGroupType;
}
public void setDetailGroupType(Integer detailGroupType) {
this.detailGroupType = detailGroupType;
}
public String getKeyValues() {
return keyValues;
}
public void setKeyValues(String keyValues) {
this.keyValues = keyValues == null ? null : keyValues.trim();
}
@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(", assetGroupId=").append(assetGroupId);
sb.append(", detailGroupName=").append(detailGroupName);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append(", groupYear=").append(groupYear);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", detailGroupType=").append(detailGroupType);
sb.append(", keyValues=").append(keyValues);
sb.append("]");
return sb.toString();
}
}
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import java.io.Serializable;
import java.util.Date;
/**
* AssetDetailGroupDto AssetDetailGroup页面Dto
*
* @author zhikai.z.wei
* @date 2019/1/25
*/
public class AssetDetailGroupStringDto implements Serializable{
private String id;
private String assetGroupId;
private String detailGroupName;
private Integer assetGroupType;
private Integer groupYear;
private Date createTime;
private Date updateTime;
private Integer detailGroupType;
private String keyValues;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAssetGroupId() {
return assetGroupId;
}
public void setAssetGroupId(String assetGroupId) {
this.assetGroupId = assetGroupId;
}
/**
*
* 扩展属性,当前页码
*
*/
private Integer pageIndex;
/**
*
* 扩展属性,当前页所展示的数量
*
*/
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getDetailGroupName() {
return detailGroupName;
}
public void setDetailGroupName(String detailGroupName) {
this.detailGroupName = detailGroupName == null ? null : detailGroupName.trim();
}
public Integer getAssetGroupType() {
return assetGroupType;
}
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
public Integer getGroupYear() {
return groupYear;
}
public void setGroupYear(Integer groupYear) {
this.groupYear = groupYear;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDetailGroupType() {
return detailGroupType;
}
public void setDetailGroupType(Integer detailGroupType) {
this.detailGroupType = detailGroupType;
}
public String getKeyValues() {
return keyValues;
}
public void setKeyValues(String keyValues) {
this.keyValues = keyValues == null ? null : keyValues.trim();
}
@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(", assetGroupId=").append(assetGroupId);
sb.append(", detailGroupName=").append(detailGroupName);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append(", groupYear=").append(groupYear);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", detailGroupType=").append(detailGroupType);
sb.append(", keyValues=").append(keyValues);
sb.append("]");
return sb.toString();
}
}
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table asset_group
*
* @mbg.generated do_not_delete_during_merge
*/
public class AssetGroupDto implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.id
*
* @mbg.generated
*/
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
/**
* Database Column Remarks:
* 资产分类一级分类名称
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.asset_group_name
*
* @mbg.generated
*/
private String assetGroupName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* Database Column Remarks:
* 资产一级分类的类型代码
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.asset_group_type
*
* @mbg.generated
*/
private Integer assetGroupType;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table asset_group
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.id
*
* @return the value of asset_group.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.id
*
* @param id the value for asset_group.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.asset_group_name
*
* @return the value of asset_group.asset_group_name
*
* @mbg.generated
*/
public String getAssetGroupName() {
return assetGroupName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.asset_group_name
*
* @param assetGroupName the value for asset_group.asset_group_name
*
* @mbg.generated
*/
public void setAssetGroupName(String assetGroupName) {
this.assetGroupName = assetGroupName == null ? null : assetGroupName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.create_time
*
* @return the value of asset_group.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.create_time
*
* @param createTime the value for asset_group.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.update_time
*
* @return the value of asset_group.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.update_time
*
* @param updateTime the value for asset_group.update_time
*
* @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 asset_group.asset_group_type
*
* @return the value of asset_group.asset_group_type
*
* @mbg.generated
*/
public Integer getAssetGroupType() {
return assetGroupType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.asset_group_type
*
* @param assetGroupType the value for asset_group.asset_group_type
*
* @mbg.generated
*/
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group
*
* @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(", assetGroupName=").append(assetGroupName);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.AssetDetailGroupMapper;
import pwc.taxtech.atms.dao.AssetGroupMapper;
import pwc.taxtech.atms.dto.AssetDetailGroupDto;
import pwc.taxtech.atms.dto.AssetDetailGroupStringDto;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.AssetDetailGroupExample;
import pwc.taxtech.atms.entity.AssetGroup;
import pwc.taxtech.atms.entity.AssetGroupExample;
import java.util.*;
/**
* @Author zhikai.z.wei
* 资产分类service
*/
@Service
public class AssetGroupServiceImpl extends BaseService {
private static Logger logger = LoggerFactory.getLogger(AssetGroupServiceImpl.class);
@Autowired
private AssetDetailGroupMapper assetDetailGroupMapper;
@Autowired
private AssetGroupMapper assetGroupMapper;
@Autowired
private FileService fileService;
/**
获取资产一级分类相关数据
*/
public List<AssetGroup> getAllAssetGroup() throws Exception {
logger.debug("获取资产一级分类相关数据");
AssetGroupExample assetGroupExample = new AssetGroupExample();
return assetGroupMapper.selectByExample(assetGroupExample);
}
/**
获取固定资产全部二级分类
*/
public PageInfo<AssetDetailGroupStringDto> getAllFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("获取固定资产全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 1:固定资产
criteria.andAssetGroupTypeEqualTo(assetDetailGroupDto.getAssetGroupType());
assetDetailGroupExample.setOrderByClause("id asc");
PageHelper.startPage(assetDetailGroupDto.getPageIndex(), assetDetailGroupDto.getPageSize());
List<AssetDetailGroup> assetDetailGroups = assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
//当时用分页包装数据后,不能对Long类型的字段进行序列化,仍会导致到前台精度缺失,
// 创建一个全为String的实体,并进行复制
List<AssetDetailGroupStringDto> assetDetailGroupDtos = new ArrayList<>();
for (AssetDetailGroup assetDetailGroup:assetDetailGroups){
AssetDetailGroupStringDto stringDto = new AssetDetailGroupStringDto();
//相同类型及字段进行copy
BeanUtils.copyProperties(assetDetailGroup,stringDto);
//把Long类型数据转为String并赋给新的实体
stringDto.setId(assetDetailGroup.getId().toString());
stringDto.setAssetGroupId(assetDetailGroup.getAssetGroupId().toString());
assetDetailGroupDtos.add(stringDto);
}
// assetDetailGroups.stream().forEach(assetDetailGroup -> {
// AssetDetailGroupStringDto stringDto = new AssetDetailGroupStringDto();
// //相同类型及字段进行copy
// BeanUtils.copyProperties(assetDetailGroup,stringDto);
// //把Long类型数据转为String并赋给新的实体
// stringDto.setId(assetDetailGroup.getId().toString());
// stringDto.setAssetGroupId(assetDetailGroup.getAssetGroupId().toString());
// assetDetailGroupDtos.add(stringDto);
// });
// BeanUtils.copyProperties(assetDetailGroups,assetDetailGroupDtos);
// PageInfo<AssetDetailGroup> pageInfo = new PageInfo<>(assetDetailGroups);
PageInfo<AssetDetailGroupStringDto> pageInfoStringDto = new PageInfo<AssetDetailGroupStringDto>(assetDetailGroupDtos);
// BeanUtils.copyProperties(pageInfo,pageInfoStringDto);
return pageInfoStringDto;
}
/**
获取长期待摊全部二级分类
*/
public List<AssetDetailGroup> getAllLongTermPendingDetailGroup() throws Exception {
logger.debug("获取长期待摊全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 2:长期待摊
criteria.andAssetGroupTypeEqualTo(2);
return assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
}
/**
获取无形资产全部二级分类
*/
public List<AssetDetailGroup> getAllIntangibleAssetsDetailGroup() throws Exception {
logger.debug("获取无形资产全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 3:无形资产
criteria.andAssetGroupTypeEqualTo(3);
return assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
}
/**
根据资产类型得到其总数
*/
public Long countAssetByType(Integer assetGroupType) throws Exception {
return assetDetailGroupMapper.countAssetByType(assetGroupType);
}
/**
通过一级分类的类型获取一级分类的ID
*/
public List<AssetGroup> getAssetGroupByType(Integer type) throws Exception {
logger.debug("通过一级分类的类型获取一级分类的ID");
AssetGroupExample assetGroupExample = new AssetGroupExample();
AssetGroupExample.Criteria criteria = assetGroupExample.createCriteria();
criteria.andAssetGroupTypeEqualTo(type);
List<AssetGroup> assetGroups = assetGroupMapper.selectByExample(assetGroupExample);
//判断查询出的List是否为null或者为空,
// 若为其中一种,则创建对象并add进入list中,一面controller取用报空指针异常
if(assetGroups == null || assetGroups.size()==0){
AssetGroup assetGroup = new AssetGroup();
assetGroups = new ArrayList<>();
assetGroups.add(assetGroup);
}
return assetGroups;
}
/**
新增固定资产二级分类
*/
public int addFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("新增固定资产二级分类");
AssetDetailGroup assetDetailGroup = new AssetDetailGroup();
//把页面Dto的值赋给entity
BeanUtils.copyProperties(assetDetailGroupDto,assetDetailGroup);
assetDetailGroup.setId(idService.nextId());
assetDetailGroup.setCreateTime(new Date());
assetDetailGroup.setUpdateTime(new Date());
return assetDetailGroupMapper.insertSelective(assetDetailGroup);
}
/**
编辑固定资产二级分类
*/
public int editFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("编辑固定资产二级分类");
AssetDetailGroup assetDetailGroup = new AssetDetailGroup();
//把页面Dto的值赋给entity
BeanUtils.copyProperties(assetDetailGroupDto,assetDetailGroup);
//81407534426099710 81407534426099710
assetDetailGroup.setUpdateTime(new Date());
return assetDetailGroupMapper.updateByPrimaryKeySelective(assetDetailGroup);
}
/**
新增固定资产二级分类
*/
public int deleteFixedAssetDetailGroup(Long id) throws Exception {
logger.debug("删除固定资产二级分类");
return assetDetailGroupMapper.deleteByPrimaryKey(id);
}
}
......@@ -105,4 +105,6 @@ public interface AssetDetailGroupMapper extends MyMapper {
* @mbg.generated
*/
int updateByPrimaryKey(AssetDetailGroup record);
Long countAssetByType(Integer assetGroupType);
}
\ 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;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.CitAssetGroupResult;
import pwc.taxtech.atms.entity.CitAssetGroupResultExample;
@Mapper
public interface CitAssetGroupResultMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
long countByExample(CitAssetGroupResultExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int deleteByExample(CitAssetGroupResultExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int insert(CitAssetGroupResult record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int insertSelective(CitAssetGroupResult record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
List<CitAssetGroupResult> selectByExampleWithRowbounds(CitAssetGroupResultExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
List<CitAssetGroupResult> selectByExample(CitAssetGroupResultExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
CitAssetGroupResult selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") CitAssetGroupResult record, @Param("example") CitAssetGroupResultExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int updateByExample(@Param("record") CitAssetGroupResult record, @Param("example") CitAssetGroupResultExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(CitAssetGroupResult record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group_result
*
* @mbg.generated
*/
int updateByPrimaryKey(CitAssetGroupResult record);
}
\ 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;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.CitAssetsList;
import pwc.taxtech.atms.entity.CitAssetsListExample;
@Mapper
public interface CitAssetsListMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
long countByExample(CitAssetsListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int deleteByExample(CitAssetsListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int insert(CitAssetsList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int insertSelective(CitAssetsList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
List<CitAssetsList> selectByExampleWithRowbounds(CitAssetsListExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
List<CitAssetsList> selectByExample(CitAssetsListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
CitAssetsList selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") CitAssetsList record, @Param("example") CitAssetsListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int updateByExample(@Param("record") CitAssetsList record, @Param("example") CitAssetsListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(CitAssetsList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table assets_list
*
* @mbg.generated
*/
int updateByPrimaryKey(CitAssetsList record);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.dao.AssetDetailGroupMapper">
<select id="countAssetByType" resultType="java.lang.Long">
select
count(1)
from asset_detail_group
where asset_group_type = #{assetGroupType}
</select>
</mapper>
\ No newline at end of file
......@@ -145,6 +145,28 @@
"NoSelectSheet": "未选择报表",
"SameCodeTemplateRepeat": "报表代码已经存在",
"SameNameTemplateRepeat": "报表名称已经存在",
"FixedAssetsClassify": "固定资产分类",
"StandardFixedAssetsAdd": "标准固定资产-新增",
"StandardFixedAssetsEdit": "标准固定资产-编辑",
"FixedAssetsCode": "标准固定资产代码",
"FixedAssetsName": "标准固定资产名称",
"FixedAssetsAgeLimit": "折旧年限",
"StandardFixedAssetsCorrespondingResult": "固定资产标准对应结果",
"CompanyFixedAssetKeyValue": "企业固定资产名称关键字",
"LongTermPendingClassify": "长期待摊分类",
"LongTermPendingAdd": "长期待摊-新增",
"LongTermPendingEdit": "长期待摊-编辑",
"LongTermPendingCode": "长期待摊代码",
"LongTermPendingName": "长期待摊名称",
"LongTermPendingAgeLimit": "折旧年限",
"IntangibleAssetsClassify": "无形资产分类",
"IntangibleAssetsAdd": "无形资产-新增",
"IntangibleAssetsEdit": "无形资产-编辑",
"IntangibleAssetsCode": "无形资产代码",
"IntangibleAssetsName": "无形资产名称",
"IntangibleAssetsAgeLimit": "折旧年限",
"InvoiceRuleSetting": "发票管理",
"VATRuleSettings": "增值税",
......@@ -173,4 +195,5 @@
"OrganizationUsedTemplateGroup": "有机构在使用,不能删除",
"Industry": "行业:",
"SearchHintText": "搜索"
}
\ No newline at end of file
......@@ -149,6 +149,38 @@
"PlzInputLimit": "请输入上限...",
"PreviewResult": "预览结果",
"Ratepayer": "纳税人类型",
"AssetsClassify": "固定资产分类",
"AssetsAdd": "资产-新增",
"AssetsEdit": "资产-编辑",
"AssetsCode": "资产代码",
"AssetsName": "资产名称",
"AssetsAgeLimit": "折旧年限",
"FixedAssetsClassify": "固定资产分类",
"StandardFixedAssetsAdd": "标准固定资产-新增",
"StandardFixedAssetsEdit": "标准固定资产-编辑",
"FixedAssetsCode": "标准固定资产代码",
"FixedAssetsName": "标准固定资产名称",
"FixedAssetsAgeLimit": "折旧年限",
"CorrespondenceMaintain": "对应关系维护",
"StandardFixedAssetsCorrespondingResult": "固定资产标准对应结果",
"CompanyFixedAssetKeyValue": "企业固定资产名称关键字",
"LongTermPendingClassify": "长期待摊分类",
"LongTermPendingAdd": "长期待摊-新增",
"LongTermPendingEdit": "长期待摊-编辑",
"LongTermPendingCode": "长期待摊代码",
"LongTermPendingName": "长期待摊名称",
"LongTermPendingAgeLimit": "折旧年限",
"IntangibleAssetsClassify": "无形资产分类",
"IntangibleAssetsAdd": "无形资产-新增",
"IntangibleAssetsEdit": "无形资产-编辑",
"IntangibleAssetsCode": "无形资产代码",
"IntangibleAssetsName": "无形资产名称",
"IntangibleAssetsAgeLimit": "折旧年限",
"ReferenceFinancialReport": "关联财务报表",
"ReferenceTaxReport": "关联纳税申报表",
"ReportCellUpdateWarning": "此类单元格为税局禁止编辑单元格,是否确定继续配置逻辑?",
......@@ -218,4 +250,5 @@
"VoucherNotSelectValidator": "请选择凭证筛选配置项",
"VoucherTip": "凭证:科目代码",
"~MustBeEndOneApp": "I Must be the End One, please!"
}
\ No newline at end of file
......@@ -23,7 +23,7 @@
<div ui-view="business-unit" ng-show="state.includes('basicData.businessUnit')"></div>
<div ui-view="region" ng-show="state.includes('basicData.regionManage')"></div>-->
<div ui-view="vat-rule" ng-show="state.includes('ruleEngineConfiguration.vatRuleEnginee')"></div>
<div ui-view="fixed-assets" ng-show="state.includes('ruleEngineConfiguration.fixedAssets')"></div>
<div ui-view="fixed-assets" style="overflow-y: auto" ng-show="state.includes('ruleEngineConfiguration.fixedAssets')"></div>
<!--<div ui-view="word-library" ng-show="state.includes('basicData.wordLibraryManage')"></div>-->
<!--<div ui-view="key-value" ng-show="state.includes('basicData.keyvalueManage')"></div>-->
<!--<div ui-view="customer-list" ng-show="state.includes('financialData.customerListManage')"></div>-->
......
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