Browse Source

解决冲突,资产表格机构树添加

develop
ljlong_2630 12 months ago
parent
commit
cd0515c3bc
  1. 70
      lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java
  2. 4
      lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java
  3. 16
      lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetInfo.java
  4. 14
      lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetInfoMapper.java
  5. 100
      lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetInfoService.java
  6. 4
      lzbi-module/src/main/java/com/lzbi/common/SelectOptionsControl.java
  7. 2
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelMaster.java
  8. 92
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelSub.java

70
lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java

@ -2,8 +2,12 @@ package com.lzbi.asset.controller;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.lzbi.asset.domain.DcBaseAssetInfo; import com.lzbi.asset.domain.DcBaseAssetInfo;
import com.lzbi.asset.service.IDcBaseAssetInfoService; import com.lzbi.asset.service.DcBaseAssetInfoService;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.poi.ExcelUtil; import com.lzbi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -21,6 +25,7 @@ import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.enums.BusinessType; import com.lzbi.common.enums.BusinessType;
import com.lzbi.common.core.page.TableDataInfo; import com.lzbi.common.core.page.TableDataInfo;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -33,7 +38,7 @@ import java.util.List;
@RequestMapping("/lzbi/assetInfo") @RequestMapping("/lzbi/assetInfo")
public class DcBaseAssetInfoController extends BaseController { public class DcBaseAssetInfoController extends BaseController {
@Autowired @Autowired
private IDcBaseAssetInfoService dcBaseAssetInfoService; private DcBaseAssetInfoService dcBaseAssetInfoService;
/** /**
* 查询资产信息列表 * 查询资产信息列表
@ -96,4 +101,65 @@ public class DcBaseAssetInfoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(dcBaseAssetInfoService.deleteDcBaseAssetInfoByIds(ids)); return toAjax(dcBaseAssetInfoService.deleteDcBaseAssetInfoByIds(ids));
} }
/**
* 新增资产信息
*/
@PreAuthorize("@ss.hasPermi('lzbi:assetInfo:add')")
@Log(title = "资产信息", businessType = BusinessType.INSERT)
@PostMapping("/addBatch")
public AjaxResult addBatch(@RequestBody JSONArray jsonArray)
{
if (jsonArray == null) {
throw new IllegalArgumentException("未能接收任何参数!");
}
List<DcBaseAssetInfo> beanList = new ArrayList<>();
try {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject beanObject = jsonArray.getJSONObject(i);
// 移除ID属性
beanObject.remove("id");
DcBaseAssetInfo dcBaseAssetInfo = JSON.toJavaObject(beanObject, DcBaseAssetInfo.class);
dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate());
dcBaseAssetInfo.setDeptId(getDeptId());
dcBaseAssetInfo.setUserId(getUserId());
dcBaseAssetInfo.setCreatedBy(String.valueOf(getUserId()));
dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate());
beanList.add(dcBaseAssetInfo);
}
} catch (Exception e) {
throw new IllegalArgumentException("解析list对象异常!");
}
return toAjax(dcBaseAssetInfoService.saveBatch(beanList));
}
/**
* 修改资产信息
*/
@PreAuthorize("@ss.hasPermi('lzbi:assetInfo:edit')")
@Log(title = "资产信息", businessType = BusinessType.UPDATE)
@PutMapping("/editBatch")
public AjaxResult editBatch(@RequestBody JSONArray jsonArray)
{
if (jsonArray == null) {
throw new IllegalArgumentException("未能接收任何参数!");
}
List<DcBaseAssetInfo> beanList = new ArrayList<>();
try {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject beanObject = jsonArray.getJSONObject(i);
DcBaseAssetInfo dcBaseAssetInfo = JSON.toJavaObject(beanObject, DcBaseAssetInfo.class);
dcBaseAssetInfo.setUpdatedBy(String.valueOf(getUserId()));
dcBaseAssetInfo.setUpdatedTime(DateUtils.getNowDate());
beanList.add(dcBaseAssetInfo);
}
} catch (Exception e) {
throw new IllegalArgumentException("解析list对象异常!");
}
return toAjax(dcBaseAssetInfoService.updateBatchById(beanList));
}
} }

4
lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java

@ -5,8 +5,8 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.lzbi.asset.domain.DcBusiWorkReadConfig; import com.lzbi.asset.domain.DcBusiWorkReadConfig;
import com.lzbi.asset.service.DcBaseAssetInfoService;
import com.lzbi.asset.service.DcBusiWorkReadConfigService; import com.lzbi.asset.service.DcBusiWorkReadConfigService;
import com.lzbi.asset.service.IDcBaseAssetInfoService;
import com.lzbi.common.AssetQueryParams; import com.lzbi.common.AssetQueryParams;
import com.lzbi.common.annotation.Log; import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.controller.BaseController;
@ -41,7 +41,7 @@ public class DcBusiWorkReadConfigController extends BaseController {
@Autowired @Autowired
private DcBaseWorkSpecialService specialService; private DcBaseWorkSpecialService specialService;
@Autowired @Autowired
private IDcBaseAssetInfoService assetInfoService; private DcBaseAssetInfoService assetInfoService;
/** /**
* 查询互联参数读取数据对照列表 * 查询互联参数读取数据对照列表

16
lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetInfo.java

@ -1,16 +1,10 @@
package com.lzbi.asset.domain; package com.lzbi.asset.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType; import com.lzbi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lzbi.module.base.BaseModuleEntity; import com.lzbi.module.base.BaseModuleEntity;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.lzbi.common.annotation.Excel;
import com.lzbi.common.core.domain.BaseEntity;
/** /**
* 资产信息对象 dc_base_asset_info * 资产信息对象 dc_base_asset_info
@ -20,13 +14,9 @@ import com.lzbi.common.core.domain.BaseEntity;
*/ */
@Data @Data
//@TableName("dc_base_work_special") //@TableName("dc_base_work_special")
@Accessors(chain = true)
public class DcBaseAssetInfo extends BaseModuleEntity { public class DcBaseAssetInfo extends BaseModuleEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
/**
* 资产ID
*/
private Long id;
/** /**
* 资产名称 * 资产名称

14
lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetInfoMapper.java

@ -1,18 +1,22 @@
package com.lzbi.asset.mapper; package com.lzbi.asset.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.asset.domain.DcBaseAssetInfo; import com.lzbi.asset.domain.DcBaseAssetInfo;
import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* 资产信息Mapper接口 * 资产信息Mapper接口
* *
* @author Lu.JL * @author Lu.JL
* @date 2023-11-27 * @date 2023-12-10
*/ */
public interface DcBaseAssetInfoMapper {
@Service
public interface DcBaseAssetInfoMapper extends BaseMapper<DcBaseAssetInfo>
{
/** /**
* 查询资产信息 * 查询资产信息
* *
@ -62,4 +66,8 @@ public interface DcBaseAssetInfoMapper {
* @return 结果 * @return 结果
*/ */
public int deleteDcBaseAssetInfoByIds(Long[] ids); public int deleteDcBaseAssetInfoByIds(Long[] ids);
} }

100
lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetInfoService.java

@ -0,0 +1,100 @@
package com.lzbi.asset.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.asset.domain.DcBaseAssetInfo;
import com.lzbi.asset.mapper.DcBaseAssetInfoMapper;
import com.lzbi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 资产信息Service业务层处理
*
* @author Lu.JL
* @date 2023-12-10
*/
@Service
public class DcBaseAssetInfoService extends ServiceImpl<DcBaseAssetInfoMapper, DcBaseAssetInfo> implements IService<DcBaseAssetInfo>
{
/**
* 查询资产信息
*
* @param id 资产信息主键
* @return 资产信息
*/
public DcBaseAssetInfo selectDcBaseAssetInfoById(Long id)
{
return baseMapper.selectDcBaseAssetInfoById(id);
}
/**
* 查询资产信息列表
*
* @param dcBaseAssetInfo 资产信息
* @return 资产信息
*/
public List<DcBaseAssetInfo> selectDcBaseAssetInfoList(DcBaseAssetInfo dcBaseAssetInfo)
{
return baseMapper.selectDcBaseAssetInfoList(dcBaseAssetInfo);
}
/**
* 新增资产信息
*
* @param dcBaseAssetInfo 资产信息
* @return 结果
*/
public int insertDcBaseAssetInfo(DcBaseAssetInfo dcBaseAssetInfo)
{
dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate());
return baseMapper.insertDcBaseAssetInfo(dcBaseAssetInfo);
}
/**
* 修改资产信息
*
* @param dcBaseAssetInfo 资产信息
* @return 结果
*/
public int updateDcBaseAssetInfo(DcBaseAssetInfo dcBaseAssetInfo)
{
dcBaseAssetInfo.setUpdatedTime(DateUtils.getNowDate());
return baseMapper.updateDcBaseAssetInfo(dcBaseAssetInfo);
}
/**
* 批量删除资产信息
*
* @param ids 需要删除的资产信息主键
* @return 结果
*/
public int deleteDcBaseAssetInfoByIds(Long[] ids)
{
return baseMapper.deleteDcBaseAssetInfoByIds(ids);
}
/**
* 删除资产信息信息
*
* @param id 资产信息主键
* @return 结果
*/
public int deleteDcBaseAssetInfoById(Long id)
{
return baseMapper.deleteDcBaseAssetInfoById(id);
}
public DcBaseAssetInfo selectDcBaseAssetInfoByCode(String assetCode) {
return baseMapper.selectDcBaseAssetInfoByCode(assetCode);
}
}

4
lzbi-module/src/main/java/com/lzbi/common/SelectOptionsControl.java

@ -2,8 +2,8 @@ package com.lzbi.common;
import com.lzbi.asset.domain.DcBaseAssetInfo; import com.lzbi.asset.domain.DcBaseAssetInfo;
import com.lzbi.asset.domain.DcBusiParamSource; import com.lzbi.asset.domain.DcBusiParamSource;
import com.lzbi.asset.service.DcBaseAssetInfoService;
import com.lzbi.asset.service.DcBusiParamSourceService; import com.lzbi.asset.service.DcBusiParamSourceService;
import com.lzbi.asset.service.IDcBaseAssetInfoService;
import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.domain.TreeSelect; import com.lzbi.common.core.domain.TreeSelect;
@ -35,7 +35,7 @@ public class SelectOptionsControl extends BaseController {
@Autowired @Autowired
DcBaseWorkSpecialService dcBaseWorkSpecialService; DcBaseWorkSpecialService dcBaseWorkSpecialService;
@Autowired @Autowired
IDcBaseAssetInfoService dcBaseAssetInfoService; DcBaseAssetInfoService dcBaseAssetInfoService;
@Autowired @Autowired
DcBusiParamSourceService dcBusiParamSourceService; DcBusiParamSourceService dcBusiParamSourceService;
@Autowired @Autowired

2
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelMaster.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data; import lombok.Data;
@ -20,6 +21,7 @@ import com.lzbi.module.base.BaseModuleEntity;
* @date 2023-12-11 * @date 2023-12-11
*/ */
@Data @Data
@Accessors(chain = true)
public class DcBusiBillModelMaster extends BaseModuleEntity public class DcBusiBillModelMaster extends BaseModuleEntity
{ {
/** 主键 */ /** 主键 */

92
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelSub.java

@ -1,5 +1,7 @@
package com.lzbi.draft.domain; package com.lzbi.draft.domain;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.lzbi.common.annotation.Excel; import com.lzbi.common.annotation.Excel;
@ -11,6 +13,9 @@ import com.lzbi.module.base.BaseModuleEntity;
* @author zhousq * @author zhousq
* @date 2023-12-11 * @date 2023-12-11
*/ */
@Data
@Accessors(chain = true)
public class DcBusiBillModelSub extends BaseModuleEntity public class DcBusiBillModelSub extends BaseModuleEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -45,91 +50,4 @@ public class DcBusiBillModelSub extends BaseModuleEntity
/** 统计单元ID */ /** 统计单元ID */
@Excel(name = "统计单元ID") @Excel(name = "统计单元ID")
private Long assetId; private Long assetId;
public void setBillModelNo(String billModelNo)
{
this.billModelNo = billModelNo;
}
public String getBillModelNo()
{
return billModelNo;
}
public void setAssetCode(String assetCode)
{
this.assetCode = assetCode;
}
public String getAssetCode()
{
return assetCode;
}
public void setAssetName(String assetName)
{
this.assetName = assetName;
}
public String getAssetName()
{
return assetName;
}
public void setAssetUnitCode(String assetUnitCode)
{
this.assetUnitCode = assetUnitCode;
}
public String getAssetUnitCode()
{
return assetUnitCode;
}
public void setAssetUnitName(String assetUnitName)
{
this.assetUnitName = assetUnitName;
}
public String getAssetUnitName()
{
return assetUnitName;
}
public void setAssetUnitType(String assetUnitType)
{
this.assetUnitType = assetUnitType;
}
public String getAssetUnitType()
{
return assetUnitType;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAssetId(Long assetId)
{
this.assetId = assetId;
}
public Long getAssetId()
{
return assetId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("billModelNo", getBillModelNo())
.append("assetCode", getAssetCode())
.append("assetName", getAssetName())
.append("assetUnitCode", getAssetUnitCode())
.append("assetUnitName", getAssetUnitName())
.append("assetUnitType", getAssetUnitType())
.append("id", getId())
.append("assetId", getAssetId())
.toString();
}
} }

Loading…
Cancel
Save