Browse Source

资产管理

大数据与最优化研究所 11 months ago
parent
commit
d381a69396
21 changed files with 932 additions and 45 deletions
  1. 20 3
      src/main/java/com/xjrsoft/module/asset/controller/WfAssetManageController.java
  2. 125 0
      src/main/java/com/xjrsoft/module/asset/controller/WfAssetManageInventoryController.java
  3. 58 0
      src/main/java/com/xjrsoft/module/asset/dto/AddWfAssetManageInventoryDto.java
  4. 32 0
      src/main/java/com/xjrsoft/module/asset/dto/UpdateWfAssetManageInventoryDto.java
  5. 26 0
      src/main/java/com/xjrsoft/module/asset/dto/WfAssetManageInventoryPageDto.java
  6. 5 2
      src/main/java/com/xjrsoft/module/asset/entity/WfAssetManage.java
  7. 108 0
      src/main/java/com/xjrsoft/module/asset/entity/WfAssetManageInventory.java
  8. 17 0
      src/main/java/com/xjrsoft/module/asset/mapper/WfAssetManageInventoryMapper.java
  9. 18 0
      src/main/java/com/xjrsoft/module/asset/service/IWfAssetManageInventoryService.java
  10. 138 0
      src/main/java/com/xjrsoft/module/asset/service/impl/WfAssetManageInventoryServiceImpl.java
  11. 89 27
      src/main/java/com/xjrsoft/module/asset/service/impl/WfAssetManageServiceImpl.java
  12. 118 0
      src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageInventoryPageVo.java
  13. 59 0
      src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageInventoryVo.java
  14. 0 1
      src/main/java/com/xjrsoft/module/asset/vo/WfAssetManagePageVo.java
  15. 8 2
      src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageQueryVo.java
  16. 30 3
      src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageVo.java
  17. 31 0
      src/main/java/com/xjrsoft/module/liteflow/node/WfAssetManageInventoryNode.java
  18. 0 4
      src/main/java/com/xjrsoft/module/system/service/impl/FileServiceImpl.java
  19. 3 3
      src/main/resources/mapper/asset/WfAssetManageMapper.xml
  20. 18 0
      src/test/java/com/xjrsoft/module/asset/service/impl/WfAssetManageInventoryServiceImplTest.java
  21. 29 0
      src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

+ 20 - 3
src/main/java/com/xjrsoft/module/asset/controller/WfAssetManageController.java

@@ -22,7 +22,12 @@ import com.xjrsoft.module.base.entity.BaseClassroom;
 import com.xjrsoft.module.base.entity.BaseOfficeBuild;
 import com.xjrsoft.module.base.service.IBaseClassroomService;
 import com.xjrsoft.module.base.service.IBaseOfficeBuildService;
+import com.xjrsoft.module.oa.entity.WfOaPull;
+import com.xjrsoft.module.oa.vo.FileReceivePullPageVo;
+import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.TextbookClaimExportQueryDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -167,11 +172,23 @@ public class WfAssetManageController {
     @ApiOperation(value="根据id查询资产管理信息")
     @SaCheckPermission("wfassetmanage:detail")
     public RT<WfAssetManageVo> info(@RequestParam Long id){
-        WfAssetManage wfAssetManage = wfAssetManageService.getById(id);
-        if (wfAssetManage == null) {
+        MPJLambdaWrapper<WfAssetManage> wfAssetManageMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        wfAssetManageMPJLambdaWrapper
+                .select(WfAssetManage::getId)
+                .select(WfAssetManage.class, x -> VoToColumnUtil.fieldsToColumns(WfAssetManageVo.class).contains(x.getProperty()))
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfAssetManage::getAssetType, ext -> ext.selectAs(DictionaryDetail::getName, WfAssetManageVo::getAssetTypeCn))
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfAssetManage::getAssetCategory, ext -> ext.selectAs(DictionaryDetail::getName, WfAssetManageVo::getAssetCategoryCn))
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfAssetManage::getAssetSpecies, ext -> ext.selectAs(DictionaryDetail::getName, WfAssetManageVo::getAssetSpeciesCn))
+                .leftJoin(XjrUser.class, XjrUser::getId, WfAssetManage::getUserId, ext -> ext.selectAs(XjrUser::getName, WfAssetManageVo::getUserIdCn))
+                .leftJoin(Department.class, Department::getId, WfAssetManage::getDeptId, ext -> ext.selectAs(Department::getName, WfAssetManageVo::getDeptIdCn))
+                .eq(WfAssetManage::getId, id)
+        ;
+
+        WfAssetManageVo wfAssetManageVo = wfAssetManageService.selectJoinOne(WfAssetManageVo.class, wfAssetManageMPJLambdaWrapper);
+        if (wfAssetManageVo == null) {
            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(wfAssetManage, WfAssetManageVo.class));
+        return RT.ok(wfAssetManageVo);
     }
 
 

+ 125 - 0
src/main/java/com/xjrsoft/module/asset/controller/WfAssetManageInventoryController.java

@@ -0,0 +1,125 @@
+package com.xjrsoft.module.asset.controller;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.xjrsoft.common.constant.GlobalConstant;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.asset.dto.AddWfAssetManageInventoryDto;
+import com.xjrsoft.module.asset.dto.UpdateWfAssetManageInventoryDto;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.alibaba.excel.EasyExcel;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import org.springframework.http.ResponseEntity;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+
+import com.xjrsoft.module.asset.dto.WfAssetManageInventoryPageDto;
+import com.xjrsoft.module.asset.entity.WfAssetManageInventory;
+import com.xjrsoft.module.asset.service.IWfAssetManageInventoryService;
+import com.xjrsoft.module.asset.vo.WfAssetManageInventoryPageVo;
+
+import com.xjrsoft.module.asset.vo.WfAssetManageInventoryVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@RestController
+@RequestMapping("/asset" + "/wfAssetManageInventory")
+@Api(value = "/asset"  + "/wfAssetManageInventory",tags = "资产管理盘点代码")
+@AllArgsConstructor
+public class WfAssetManageInventoryController {
+
+
+    private final IWfAssetManageInventoryService wfAssetManageInventoryService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value="资产管理盘点列表(分页)")
+    @SaCheckPermission("wfassetmanageinventory:detail")
+    public RT<PageOutput<WfAssetManageInventoryPageVo>> page(@Valid WfAssetManageInventoryPageDto dto){
+
+        LambdaQueryWrapper<WfAssetManageInventory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper
+                    .orderByDesc(WfAssetManageInventory::getId)
+                .select(WfAssetManageInventory.class,x -> VoToColumnUtil.fieldsToColumns(WfAssetManageInventoryPageVo.class).contains(x.getProperty()));
+        IPage<WfAssetManageInventory> page = wfAssetManageInventoryService.page(ConventPage.getPage(dto), queryWrapper);
+        PageOutput<WfAssetManageInventoryPageVo> pageOutput = ConventPage.getPageOutput(page, WfAssetManageInventoryPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询资产管理盘点信息")
+    @SaCheckPermission("wfassetmanageinventory:detail")
+    public RT<WfAssetManageInventoryVo> info(@RequestParam Long id){
+        WfAssetManageInventory wfAssetManageInventory = wfAssetManageInventoryService.getById(id);
+        if (wfAssetManageInventory == null) {
+           return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(wfAssetManageInventory, WfAssetManageInventoryVo.class));
+    }
+
+
+    @PostMapping
+    @ApiOperation(value = "新增资产管理盘点")
+    @SaCheckPermission("wfassetmanageinventory:add")
+    public RT<Boolean> add(@Valid @RequestBody AddWfAssetManageInventoryDto dto){
+        WfAssetManageInventory wfAssetManageInventory = BeanUtil.toBean(dto, WfAssetManageInventory.class);
+        boolean isSuccess = wfAssetManageInventoryService.save(wfAssetManageInventory);
+    return RT.ok(isSuccess);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改资产管理盘点")
+    @SaCheckPermission("wfassetmanageinventory:edit")
+    public RT<Boolean> update(@Valid @RequestBody UpdateWfAssetManageInventoryDto dto){
+
+        WfAssetManageInventory wfAssetManageInventory = BeanUtil.toBean(dto, WfAssetManageInventory.class);
+        return RT.ok(wfAssetManageInventoryService.updateById(wfAssetManageInventory));
+
+    }
+
+    @DeleteMapping
+    @ApiOperation(value = "删除资产管理盘点")
+    @SaCheckPermission("wfassetmanageinventory:delete")
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        return RT.ok(wfAssetManageInventoryService.removeBatchByIds(ids));
+
+    }
+    @PostMapping("/import")
+    @ApiOperation(value = "导入")
+    public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
+        List<WfAssetManageInventoryPageVo> savedDataList = EasyExcel.read(file.getInputStream()).head(WfAssetManageInventoryPageVo.class).sheet().doReadSync();
+        Boolean result = wfAssetManageInventoryService.saveBatch(BeanUtil.copyToList(savedDataList, WfAssetManageInventory.class));
+        return RT.ok(result);
+    }
+
+    @GetMapping("/export")
+    @ApiOperation(value = "导出")
+    public ResponseEntity<byte[]> exportData(@Valid WfAssetManageInventoryPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
+        List<WfAssetManageInventoryPageVo> customerList = isTemplate != null && isTemplate ? new ArrayList<>() : ((PageOutput<WfAssetManageInventoryPageVo>) page(dto).getData()).getList();
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        EasyExcel.write(bot, WfAssetManageInventoryPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
+
+        return RT.fileStream(bot.toByteArray(), "WfAssetManageInventory" + ExcelTypeEnum.XLSX.getValue());
+    }
+}

+ 58 - 0
src/main/java/com/xjrsoft/module/asset/dto/AddWfAssetManageInventoryDto.java

@@ -0,0 +1,58 @@
+package com.xjrsoft.module.asset.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+public class AddWfAssetManageInventoryDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 状态(0:未结束 1:结束)
+    */
+    @ApiModelProperty("状态(0:未结束 1:结束)")
+    private Short status;
+    /**
+    * 区域类型
+    */
+    @ApiModelProperty("区域类型")
+    private String areaType;
+    /**
+    * 附件id
+    */
+    @ApiModelProperty("附件id")
+    private Long folderId;
+    /**
+    * 楼栋id
+    */
+    @ApiModelProperty("楼栋id")
+    private Long baseOfficeBuildId;
+    /**
+    * 楼层
+    */
+    @ApiModelProperty("楼层")
+    private Integer floorNumber;
+    /**
+    * 门牌号
+    */
+    @ApiModelProperty("门牌号")
+    private String roomNumber;
+
+}

+ 32 - 0
src/main/java/com/xjrsoft/module/asset/dto/UpdateWfAssetManageInventoryDto.java

@@ -0,0 +1,32 @@
+package com.xjrsoft.module.asset.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+public class UpdateWfAssetManageInventoryDto extends AddWfAssetManageInventoryDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+}

+ 26 - 0
src/main/java/com/xjrsoft/module/asset/dto/WfAssetManageInventoryPageDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.asset.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* @title: 资产管理盘点分页查询入参
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class WfAssetManageInventoryPageDto extends PageInput {
+
+
+}

+ 5 - 2
src/main/java/com/xjrsoft/module/asset/entity/WfAssetManage.java

@@ -113,6 +113,9 @@ public class WfAssetManage implements Serializable {
     */
     @ApiModelProperty("状态(0:未结束 1:结束)")
     private Short status;
-
-
+    /**
+     * 其他信息
+     */
+    @ApiModelProperty("其他信息")
+    private String extendJson;
 }

+ 108 - 0
src/main/java/com/xjrsoft/module/asset/entity/WfAssetManageInventory.java

@@ -0,0 +1,108 @@
+package com.xjrsoft.module.asset.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+@TableName("wf_asset_manage_inventory")
+@ApiModel(value = "wf_asset_manage_inventory", description = "资产管理盘点")
+public class WfAssetManageInventory implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableId
+    private Long id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 状态(0:未结束 1:结束)
+    */
+    @ApiModelProperty("状态(0:未结束 1:结束)")
+    private Short status;
+    /**
+    * 区域类型
+    */
+    @ApiModelProperty("区域类型")
+    private String areaType;
+    /**
+    * 附件id
+    */
+    @ApiModelProperty("附件id")
+    private Long folderId;
+    /**
+    * 楼栋id
+    */
+    @ApiModelProperty("楼栋id")
+    private Long baseOfficeBuildId;
+    /**
+    * 楼层
+    */
+    @ApiModelProperty("楼层")
+    private Integer floorNumber;
+    /**
+    * 门牌号
+    */
+    @ApiModelProperty("门牌号")
+    private String roomNumber;
+
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/asset/mapper/WfAssetManageInventoryMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.asset.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.asset.entity.WfAssetManageInventory;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Mapper
+public interface WfAssetManageInventoryMapper extends MPJBaseMapper<WfAssetManageInventory> {
+
+}

+ 18 - 0
src/main/java/com/xjrsoft/module/asset/service/IWfAssetManageInventoryService.java

@@ -0,0 +1,18 @@
+package com.xjrsoft.module.asset.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.asset.entity.WfAssetManageInventory;
+import lombok.Data;
+import java.util.List;
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+
+public interface IWfAssetManageInventoryService extends MPJBaseService<WfAssetManageInventory> {
+    void dataCache(Long formId);
+}

+ 138 - 0
src/main/java/com/xjrsoft/module/asset/service/impl/WfAssetManageInventoryServiceImpl.java

@@ -0,0 +1,138 @@
+package com.xjrsoft.module.asset.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.asset.entity.WfAssetManage;
+import com.xjrsoft.module.asset.entity.WfAssetManageInventory;
+import com.xjrsoft.module.asset.mapper.WfAssetManageInventoryMapper;
+import com.xjrsoft.module.asset.service.IWfAssetManageInventoryService;
+import com.xjrsoft.module.asset.service.IWfAssetManageService;
+import com.xjrsoft.module.asset.vo.BaseOfficeBuildVo;
+import com.xjrsoft.module.base.entity.BaseOfficeBuild;
+import com.xjrsoft.module.concat.service.IXjrUserService;
+import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.entity.Role;
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
+import com.xjrsoft.module.organization.service.IDepartmentService;
+import com.xjrsoft.module.system.entity.File;
+import com.xjrsoft.module.system.service.IFileService;
+import com.xjrsoft.module.teacher.entity.XjrUser;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+* @title: 资产管理盘点
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class WfAssetManageInventoryServiceImpl extends MPJBaseServiceImpl<WfAssetManageInventoryMapper, WfAssetManageInventory> implements IWfAssetManageInventoryService {
+
+    private final IFileService fileService;
+
+    private final IWfAssetManageService wfAssetManageService;
+
+    private final IXjrUserService xjrUserService;
+
+    private final IDepartmentService departmentService;
+
+    @Override
+    public void dataCache(Long formId) {
+        WfAssetManageInventory wfAssetManageInventory = this.getById(formId);
+
+        if(wfAssetManageInventory != null){
+            List<File> fileList = fileService.list(Wrappers.<File>query().lambda().eq(File::getFolderId, wfAssetManageInventory.getFolderId()));
+            List<WfAssetManage> wfAssetManageList = new ArrayList<>();
+
+            //部门信息
+            List<Department> departmentList = departmentService.list();
+            Map<String, Department> departmentListMap = departmentList.stream().collect(Collectors.toMap(Department::getName, a -> a, (k1, k2) -> k1));
+
+            //教职工信息
+            List<XjrUser> xjrUserList = xjrUserService.list(new MPJLambdaWrapper<XjrUser>()
+                    .disableSubLogicDel()
+                    .select(XjrUser::getId)
+                    .select(XjrUser.class, x -> VoToColumnUtil.fieldsToColumns(XjrUser.class).contains(x.getProperty()))
+                    .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
+                    .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
+                    .eq(Role::getId, 2)
+            );
+            Map<String, XjrUser> xjrUsersMap = xjrUserList.stream().collect(Collectors.toMap(XjrUser::getName, a -> a, (k1, k2) -> k1));
+
+            ObjectMapper objectMapper = new ObjectMapper();
+
+            for (int i = 0; i < fileList.size(); i++) {
+                InputStream inputStream = null;
+                try {
+                    URL url = new URL(fileList.get(i).getFileUrl());
+                    URLConnection conn = url.openConnection();
+                    inputStream = conn.getInputStream();
+
+                    List<Map<Integer, Object>> dataList = EasyExcel.read(inputStream).sheet().headRowNumber(0).doReadSync();
+                    if(!dataList.isEmpty()){
+                        Map<Integer, Object> head = dataList.get(0);
+                        for (int j = 1; j < dataList.size(); j++){
+                            Map<Integer, Object> eachRecord = dataList.get(j);
+
+                            WfAssetManage wfAssetManage = new WfAssetManage();
+                            wfAssetManage.setAssetType((String) eachRecord.get(0));
+                            wfAssetManage.setAssetCategory((String) eachRecord.get(1));
+                            wfAssetManage.setAssetSpecies((String) eachRecord.get(2));
+                            wfAssetManage.setName((String) eachRecord.get(3));
+                            if(eachRecord.get(4) != null){
+                                XjrUser xjrUser = xjrUsersMap.get((String) eachRecord.get(4));
+                                if(xjrUser != null){
+                                    wfAssetManage.setUserId(xjrUser.getId());
+                                }
+                            }
+                            if(eachRecord.get(5) != null){
+                                Department department = departmentListMap.get((String) eachRecord.get(5));
+                                if(department != null){
+                                    wfAssetManage.setDeptId(department.getId());
+                                }
+                            }
+                            wfAssetManage.setAmount(new BigDecimal((String) eachRecord.get(6)));
+
+                            Map<String, Object> extendJsonMap = new HashMap<>();
+                            for (int k = 7; k < head.size(); k++) {
+                                extendJsonMap.put((String) head.get(k), eachRecord.get(k));
+                            }
+
+                            String extendJson = objectMapper.writeValueAsString(extendJsonMap);
+                            wfAssetManage.setExtendJson(extendJson);
+                            wfAssetManageList.add(wfAssetManage);
+                        }
+                        wfAssetManageService.saveBatch(wfAssetManageList);
+                    }
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }finally {
+                    try {
+                        if(inputStream != null){
+                            inputStream.close();
+                        }
+                    }catch (IOException ignored){
+
+                    }
+                }
+            }
+        }
+    }
+}

+ 89 - 27
src/main/java/com/xjrsoft/module/asset/service/impl/WfAssetManageServiceImpl.java

@@ -1,22 +1,14 @@
 package com.xjrsoft.module.asset.service.impl;
 
 import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.support.ExcelTypeEnum;
-import com.alibaba.excel.write.metadata.WriteSheet;
-import com.alibaba.excel.write.metadata.WriteTable;
-import com.alibaba.excel.write.metadata.style.WriteCellStyle;
-import com.alibaba.excel.write.metadata.style.WriteFont;
-import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.alibaba.excel.util.ListUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.page.ConventPage;
-import com.xjrsoft.common.utils.VoToColumnUtil;
-import com.xjrsoft.common.utils.excel.ExcelFillCellMergePrevColUtil;
-import com.xjrsoft.common.utils.excel.ExcelMergeUtil;
 import com.xjrsoft.module.asset.dto.WfAssetManageConditionalSearchQueryDto;
 import com.xjrsoft.module.asset.dto.WfAssetManagePageDto;
 import com.xjrsoft.module.asset.dto.WfAssetManageSelectRecordQueryDto;
@@ -25,21 +17,16 @@ import com.xjrsoft.module.asset.mapper.WfAssetManageMapper;
 import com.xjrsoft.module.asset.service.IWfAssetManageService;
 import com.xjrsoft.module.asset.vo.WfAssetManagePageVo;
 import com.xjrsoft.module.asset.vo.WfAssetManageQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookClaimExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionExportQueryVo;
-import com.xjrsoft.module.weekly.vo.WeeklyDutyScheduleListVo;
 import lombok.AllArgsConstructor;
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.VerticalAlignment;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
 * @title: 资产管理
@@ -60,21 +47,96 @@ public class WfAssetManageServiceImpl extends MPJBaseServiceImpl<WfAssetManageMa
 
     @Override
     public ByteArrayOutputStream listWfAssetManageSelectRecordQuery(WfAssetManageSelectRecordQueryDto dto) {
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
         List<WfAssetManageQueryVo> result = wfAssetManageMapper.listWfAssetManageSelectRecordQuery(dto);
+        if(!result.isEmpty()){
+            //以第一条数据中的其他信息的key作为整个excel的表头,后面的数据根据填充
+            List<List<String>> headList = head(result.get(0));
+            List<List<Object>> dataList = dataList(headList, result);
 
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, WfAssetManageQueryVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(result);
+            EasyExcel.write(bot).head(headList).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
 
+            return bot;
+        }
         return bot;
+
     }
 
     @Override
     public ByteArrayOutputStream listWfAssetManageConditionalSearchQuery(WfAssetManageConditionalSearchQueryDto dto) {
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
         List<WfAssetManageQueryVo> result = wfAssetManageMapper.listWfAssetManageConditionalSearchQuery(dto);
+        if(!result.isEmpty()){
+            //以第一条数据中的其他信息的key作为整个excel的表头,后面的数据根据填充
+            List<List<String>> headList = head(result.get(0));
+            List<List<Object>> dataList = dataList(headList, result);
 
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, WfAssetManageQueryVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(result);
+            EasyExcel.write(bot).head(headList).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
 
+            return bot;
+        }
         return bot;
     }
+
+    private List<List<String>> head(WfAssetManageQueryVo firstRecord) {
+        List<List<String>> list = ListUtils.newArrayList();
+
+        ObjectMapper objectMapper = new ObjectMapper();
+        Map<String, Object> extendJsonMap = new HashMap<>();
+        try {
+            extendJsonMap = objectMapper.readValue(firstRecord.getExtendJson(), new TypeReference<Map<String, Object>>(){});
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        // 获取对象的所有属性
+        String[] fields = {"资产类型", "资产类别", "资产种类", "名称", "所属部门", "使用人", "金额"};
+        for (String field : fields) {
+            list.add(new ArrayList<String>(){{
+                add(field);
+            }});
+        }
+
+        for (Map.Entry<String, Object> entry : extendJsonMap.entrySet()){
+            String key = entry.getKey();
+            list.add(new ArrayList<String>(){{
+                add(key);
+            }});
+        }
+
+        return list;
+    }
+
+    private List<List<Object>> dataList(List<List<String>> headList, List<WfAssetManageQueryVo> result) {
+        List<List<Object>> list = ListUtils.newArrayList();
+        ObjectMapper objectMapper = new ObjectMapper();
+        for (WfAssetManageQueryVo wfAssetManageQueryVo : result) {
+            List<Object> oneRecord = ListUtils.newArrayList();
+
+            //先处理固定字段
+            oneRecord.add(wfAssetManageQueryVo.getAssetTypeCn());
+            oneRecord.add(wfAssetManageQueryVo.getAssetCategoryCn());
+            oneRecord.add(wfAssetManageQueryVo.getAssetSpeciesCn());
+            oneRecord.add(wfAssetManageQueryVo.getName());
+            oneRecord.add(wfAssetManageQueryVo.getDeptIdCn());
+            oneRecord.add(wfAssetManageQueryVo.getUserIdCn());
+            oneRecord.add(wfAssetManageQueryVo.getAmount());
+
+            String extendJson = wfAssetManageQueryVo.getExtendJson();
+            if(!extendJson.isEmpty()){
+                try {
+                    Map<String, Object> data = objectMapper.readValue(extendJson, new TypeReference<Map<String, Object>>(){});
+                    for (List<String> head : headList){
+                        if(data.get(head.get(0)) != null){
+                            oneRecord.add(data.get(head.get(0)));
+                        }
+                    }
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            list.add(oneRecord);
+        }
+        return list;
+    }
 }

+ 118 - 0
src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageInventoryPageVo.java

@@ -0,0 +1,118 @@
+package com.xjrsoft.module.asset.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import com.xjrsoft.common.annotation.Trans;
+import com.xjrsoft.common.enums.TransType;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+* @title: 资产管理盘点分页列表出参
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+public class WfAssetManageInventoryPageVo {
+
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private String id;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Long createUserId;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Date createDate;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Long modifyUserId;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Date modifyDate;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Integer deleteMark;
+    /**
+    * 
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("")
+    @ApiModelProperty("")
+    private Integer enabledMark;
+    /**
+    * 状态(0:未结束 1:结束)
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("状态(0:未结束 1:结束)")
+    @ApiModelProperty("状态(0:未结束 1:结束)")
+    private Short status;
+    /**
+    * 区域类型
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("区域类型")
+    @ApiModelProperty("区域类型")
+    private String areaType;
+    /**
+    * 附件id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("附件id")
+    @ApiModelProperty("附件id")
+    private Long folderId;
+    /**
+    * 楼栋id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("楼栋id")
+    @ApiModelProperty("楼栋id")
+    private Long baseOfficeBuildId;
+    /**
+    * 楼层
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("楼层")
+    @ApiModelProperty("楼层")
+    private Integer floorNumber;
+    /**
+    * 门牌号
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("门牌号")
+    @ApiModelProperty("门牌号")
+    private String roomNumber;
+
+}

+ 59 - 0
src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageInventoryVo.java

@@ -0,0 +1,59 @@
+package com.xjrsoft.module.asset.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+/**
+* @title: 资产管理盘点表单出参
+* @Author szs
+* @Date: 2024-04-07
+* @Version 1.0
+*/
+@Data
+public class WfAssetManageInventoryVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+    /**
+    * 状态(0:未结束 1:结束)
+    */
+    @ApiModelProperty("状态(0:未结束 1:结束)")
+    private Short status;
+    /**
+    * 区域类型
+    */
+    @ApiModelProperty("区域类型")
+    private String areaType;
+    /**
+    * 附件id
+    */
+    @ApiModelProperty("附件id")
+    private Long folderId;
+    /**
+    * 楼栋id
+    */
+    @ApiModelProperty("楼栋id")
+    private Long baseOfficeBuildId;
+    /**
+    * 楼层
+    */
+    @ApiModelProperty("楼层")
+    private Integer floorNumber;
+    /**
+    * 门牌号
+    */
+    @ApiModelProperty("门牌号")
+    private String roomNumber;
+
+
+
+}

+ 0 - 1
src/main/java/com/xjrsoft/module/asset/vo/WfAssetManagePageVo.java

@@ -91,5 +91,4 @@ public class WfAssetManagePageVo {
     */
     @ApiModelProperty("状态(0:未结束 1:结束)")
     private Short status;
-
 }

+ 8 - 2
src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageQueryVo.java

@@ -56,7 +56,7 @@ public class WfAssetManageQueryVo {
      * 使用人id[xjr_user]
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用人id")
+    @ExcelProperty("使用人")
     @ApiModelProperty("使用人id[xjr_user]")
     private String userIdCn;
     /**
@@ -66,5 +66,11 @@ public class WfAssetManageQueryVo {
     @ExcelProperty("金额")
     @ApiModelProperty("金额")
     private BigDecimal amount;
-
+    /**
+     * 其他信息
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore()
+    @ApiModelProperty("其他信息")
+    private String extendJson;
 }

+ 30 - 3
src/main/java/com/xjrsoft/module/asset/vo/WfAssetManageVo.java

@@ -28,16 +28,31 @@ public class WfAssetManageVo {
     */
     @ApiModelProperty("资产类型")
     private String assetType;
+    /**
+     * 资产类型
+     */
+    @ApiModelProperty("资产类型")
+    private String assetTypeCn;
     /**
     * 资产类别
     */
     @ApiModelProperty("资产类别")
     private String assetCategory;
+    /**
+     * 资产类别
+     */
+    @ApiModelProperty("资产类别")
+    private String assetCategoryCn;
     /**
     * 资产种类
     */
     @ApiModelProperty("资产种类")
     private String assetSpecies;
+    /**
+     * 资产种类
+     */
+    @ApiModelProperty("资产种类")
+    private String assetSpeciesCn;
     /**
     * 名称
     */
@@ -48,11 +63,21 @@ public class WfAssetManageVo {
     */
     @ApiModelProperty("所属部门[xjr_department]")
     private Long deptId;
+    /**
+     * 所属部门[xjr_department]
+     */
+    @ApiModelProperty("所属部门[xjr_department]")
+    private Long deptIdCn;
     /**
     * 使用人id[xjr_user]
     */
     @ApiModelProperty("使用人id[xjr_user]")
     private Long userId;
+    /**
+     * 使用人id[xjr_user]
+     */
+    @ApiModelProperty("使用人id[xjr_user]")
+    private Long userIdCn;
     /**
     * 金额
     */
@@ -63,7 +88,9 @@ public class WfAssetManageVo {
     */
     @ApiModelProperty("状态(0:未结束 1:结束)")
     private Short status;
-
-
-
+    /**
+     * 其他信息
+     */
+    @ApiModelProperty("其他信息")
+    private String extendJson;
 }

+ 31 - 0
src/main/java/com/xjrsoft/module/liteflow/node/WfAssetManageInventoryNode.java

@@ -0,0 +1,31 @@
+package com.xjrsoft.module.liteflow.node;
+
+import cn.hutool.core.convert.Convert;
+import com.xjrsoft.module.asset.service.IWfAssetManageInventoryService;
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 资产盘点规则
+ */
+@Component("wf_asset_manage_inventory_node")
+public class WfAssetManageInventoryNode extends NodeComponent {
+
+    @Autowired
+    private IWfAssetManageInventoryService wfAssetManageInventoryService;
+
+    @Override
+    public void process() throws Exception {
+        // 获取表单中数据编号
+        Map<String, Object> params = this.getFirstContextBean();
+        Object value = util.getFormDatKey(params,"id");
+        Long formId = Convert.toLong(value);
+        if (formId != null) {
+            // 数据处理
+            wfAssetManageInventoryService.dataCache(formId);
+        }
+    }
+}

+ 0 - 4
src/main/java/com/xjrsoft/module/system/service/impl/FileServiceImpl.java

@@ -70,10 +70,6 @@ public class FileServiceImpl extends MPJBaseServiceImpl<FileMapper, File> implem
 //                System.out.println("File downloaded successfully.");
                 in.close();
                 outputStream.close();
-            } catch (MalformedURLException e) {
-                throw new RuntimeException(e);
-            } catch (FileNotFoundException e) {
-                throw new RuntimeException(e);
             } catch (IOException e) {
                 throw new RuntimeException(e);
             }

+ 3 - 3
src/main/resources/mapper/asset/WfAssetManageMapper.xml

@@ -18,7 +18,7 @@
                  left join xjr_dictionary_detail t3 on t3.code = t.asset_species and t3.item_id = '1773620783726202882'
                  left join xjr_department t4 on t4.id = t.dept_id
                  left join xjr_user t5 on t5.id = t.user_id
-        where t.status = 1
+        where t.delete_mark = 0
         <if test="dto.assetType != null and dto.assetType != ''">
             and t.asset_type = #{dto.assetType}
         </if>
@@ -54,7 +54,7 @@
         left join xjr_dictionary_detail t3 on t3.code = t.asset_species and t3.item_id = '1773620783726202882'
         left join xjr_department t4 on t4.id = t.dept_id
         left join xjr_user t5 on t5.id = t.user_id
-        where t.status = 1
+        where t.delete_mark = 0
         <if test="dto.ids != null and !dto.ids.isEmpty()">
             and t.id in
             <foreach item="id" index="index" collection="dto.ids" open="(" close=")"
@@ -79,7 +79,7 @@
         left join xjr_dictionary_detail t3 on t3.code = t.asset_species and t3.item_id = '1773620783726202882'
         left join xjr_department t4 on t4.id = t.dept_id
         left join xjr_user t5 on t5.id = t.user_id
-        where t.status = 1
+        where t.delete_mark = 0
         <if test="dto.assetType != null and dto.assetType != ''">
             and t.asset_type = #{dto.assetType}
         </if>

+ 18 - 0
src/test/java/com/xjrsoft/module/asset/service/impl/WfAssetManageInventoryServiceImplTest.java

@@ -0,0 +1,18 @@
+package com.xjrsoft.module.asset.service.impl;
+
+import com.xjrsoft.module.asset.service.IWfAssetManageInventoryService;
+import com.xjrsoft.module.ledger.service.IWfSubscriptionService;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static org.junit.jupiter.api.Assertions.*;
+@SpringBootTest
+class WfAssetManageInventoryServiceImplTest {
+    @Autowired
+    private IWfAssetManageInventoryService wfAssetManageInventoryService;
+    @Test
+    void dataCache() {
+        wfAssetManageInventoryService.dataCache(1776852039081443328L);
+    }
+}

+ 29 - 0
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -2691,4 +2691,33 @@ public class FreeMarkerGeneratorTest {
         apiGeneratorService.generateCodes(params);
 
     }
+    /**
+     * 资产管理盘点
+     *
+     * @throws IOException
+     */
+    @Test
+    public void gcWfAssetManageInventory() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("wf_asset_manage_inventory");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("szs");//作者名称
+        params.setPackageName("asset");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);//是否生成分页接口
+        params.setImport(true);//是否生成导入接口
+        params.setExport(true);//是否生成导出接口
+        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
 }