Compare commits

..

2 Commits

@ -1,65 +1,51 @@
package com.ruoyi.common.utils.file;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
/**
*
*
*
* @author ruoyi
*/
public class FileUtils
{
public class FileUtils {
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* byte
*
*
* @param filePath
* @param os
* @param os
* @return
*/
public static void writeBytes(String filePath, OutputStream os) throws IOException
{
public static void writeBytes(String filePath, OutputStream os) throws IOException {
FileInputStream fis = null;
try
{
try {
File file = new File(filePath);
if (!file.exists())
{
if (!file.exists()) {
throw new FileNotFoundException(filePath);
}
fis = new FileInputStream(file);
byte[] b = new byte[1024];
int length;
while ((length = fis.read(b)) > 0)
{
while ((length = fis.read(b)) > 0) {
os.write(b, 0, length);
}
}
catch (IOException e)
{
} catch (IOException e) {
throw e;
}
finally
{
} finally {
IOUtils.close(os);
IOUtils.close(fis);
}
@ -72,33 +58,28 @@ public class FileUtils
* @return
* @throws IOException IO
*/
public static String writeImportBytes(byte[] data) throws IOException
{
public static String writeImportBytes(byte[] data) throws IOException {
return writeBytes(data, RuoYiConfig.getImportPath());
}
/**
*
*
* @param data
* @param data
* @param uploadDir
* @return
* @throws IOException IO
*/
public static String writeBytes(byte[] data, String uploadDir) throws IOException
{
public static String writeBytes(byte[] data, String uploadDir) throws IOException {
FileOutputStream fos = null;
String pathName = "";
try
{
try {
String extension = getFileExtendName(data);
pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
fos = new FileOutputStream(file);
fos.write(data);
}
finally
{
} finally {
IOUtils.close(fos);
}
return FileUploadUtils.getPathFileName(uploadDir, pathName);
@ -106,28 +87,25 @@ public class FileUtils
/**
*
*
*
* @param filePath
* @return
*/
public static String stripPrefix(String filePath)
{
public static String stripPrefix(String filePath) {
return StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX);
}
/**
*
*
*
* @param filePath
* @return
*/
public static boolean deleteFile(String filePath)
{
public static boolean deleteFile(String filePath) {
boolean flag = false;
File file = new File(filePath);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists())
{
if (file.isFile() && file.exists()) {
flag = file.delete();
}
return flag;
@ -135,32 +113,28 @@ public class FileUtils
/**
*
*
*
* @param filename
* @return true false
*/
public static boolean isValidFilename(String filename)
{
public static boolean isValidFilename(String filename) {
return filename.matches(FILENAME_PATTERN);
}
/**
*
*
*
* @param resource
* @return true false
*/
public static boolean checkAllowDownload(String resource)
{
public static boolean checkAllowDownload(String resource) {
// 禁止目录上跳级别
if (StringUtils.contains(resource, ".."))
{
if (StringUtils.contains(resource, "..")) {
return false;
}
// 检查允许下载的文件规则
if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
{
if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) {
return true;
}
@ -170,33 +144,25 @@ public class FileUtils
/**
*
*
* @param request
*
* @param request
* @param fileName
* @return
*/
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
{
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
final String agent = request.getHeader("USER-AGENT");
String filename = fileName;
if (agent.contains("MSIE"))
{
if (agent.contains("MSIE")) {
// IE浏览器
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+", " ");
}
else if (agent.contains("Firefox"))
{
} else if (agent.contains("Firefox")) {
// 火狐浏览器
filename = new String(fileName.getBytes(), "ISO8859-1");
}
else if (agent.contains("Chrome"))
{
} else if (agent.contains("Chrome")) {
// google浏览器
filename = URLEncoder.encode(filename, "utf-8");
}
else
{
} else {
// 其它浏览器
filename = URLEncoder.encode(filename, "utf-8");
}
@ -206,12 +172,11 @@ public class FileUtils
/**
*
*
* @param response
* @param response
* @param realFileName
* @return
*/
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException
{
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
String percentEncodedFileName = percentEncode(realFileName);
StringBuilder contentDispositionValue = new StringBuilder();
@ -231,36 +196,27 @@ public class FileUtils
* @param s
* @return
*/
public static String percentEncode(String s) throws UnsupportedEncodingException
{
public static String percentEncode(String s) throws UnsupportedEncodingException {
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20");
}
/**
*
*
*
* @param photoByte
* @return
*/
public static String getFileExtendName(byte[] photoByte)
{
public static String getFileExtendName(byte[] photoByte) {
String strFileExtendName = "jpg";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97))
{
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) {
strFileExtendName = "gif";
}
else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70))
{
} else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) {
strFileExtendName = "jpg";
}
else if ((photoByte[0] == 66) && (photoByte[1] == 77))
{
} else if ((photoByte[0] == 66) && (photoByte[1] == 77)) {
strFileExtendName = "bmp";
}
else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71))
{
} else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) {
strFileExtendName = "png";
}
return strFileExtendName;
@ -268,14 +224,12 @@ public class FileUtils
/**
* /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
*
*
* @param fileName
* @return
*/
public static String getName(String fileName)
{
if (fileName == null)
{
public static String getName(String fileName) {
if (fileName == null) {
return null;
}
int lastUnixPos = fileName.lastIndexOf('/');
@ -286,14 +240,12 @@ public class FileUtils
/**
* /profile/upload/2022/04/16/ruoyi.png -- ruoyi
*
*
* @param fileName
* @return
*/
public static String getNameNotSuffix(String fileName)
{
if (fileName == null)
{
public static String getNameNotSuffix(String fileName) {
if (fileName == null) {
return null;
}
String baseName = FilenameUtils.getBaseName(fileName);

@ -0,0 +1,128 @@
package com.ruoyi.manager.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.manager.domain.RecordAssetScrap;
import com.ruoyi.manager.service.IRecordAssetScrapService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2026-06-02
*/
@Controller
@RequestMapping("/manager/asset_scrap")
public class RecordAssetScrapController extends BaseController
{
private String prefix = "manager/asset_scrap";
@Autowired
private IRecordAssetScrapService recordAssetScrapService;
@RequiresPermissions("manager:asset_scrap:view")
@GetMapping()
public String asset_scrap()
{
return prefix + "/asset_scrap";
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(RecordAssetScrap recordAssetScrap)
{
startPage();
List<RecordAssetScrap> list = recordAssetScrapService.selectRecordAssetScrapList(recordAssetScrap);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:export")
@Log(title = "资产报废提报", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(RecordAssetScrap recordAssetScrap)
{
List<RecordAssetScrap> list = recordAssetScrapService.selectRecordAssetScrapList(recordAssetScrap);
ExcelUtil<RecordAssetScrap> util = new ExcelUtil<RecordAssetScrap>(RecordAssetScrap.class);
return util.exportExcel(list, "资产报废提报数据");
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:add")
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:add")
@Log(title = "资产报废提报", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(RecordAssetScrap recordAssetScrap)
{
return toAjax(recordAssetScrapService.insertRecordAssetScrap(recordAssetScrap));
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
RecordAssetScrap recordAssetScrap = recordAssetScrapService.selectRecordAssetScrapById(id);
mmap.put("recordAssetScrap", recordAssetScrap);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:edit")
@Log(title = "资产报废提报", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(RecordAssetScrap recordAssetScrap)
{
return toAjax(recordAssetScrapService.updateRecordAssetScrap(recordAssetScrap));
}
/**
*
*/
@RequiresPermissions("manager:asset_scrap:remove")
@Log(title = "资产报废提报", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(recordAssetScrapService.deleteRecordAssetScrapByIds(ids));
}
}

@ -0,0 +1,177 @@
package com.ruoyi.manager.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* record_asset_scrap
*
* @author ruoyi
* @date 2026-06-02
*/
public class RecordAssetScrap extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 资产ID */
@Excel(name = "资产ID")
private Long assetId;
/** 报废原因类型 */
@Excel(name = "报废原因类型")
private String scrapReasonType;
/** 报废说明 */
@Excel(name = "报废说明")
private String scrapRemark;
/** GPS坐标纬度,经度) */
@Excel(name = "GPS坐标", readConverterExp = "纬=度,经度")
private String gpsLocation;
/** 状态 */
@Excel(name = "状态")
private Long status;
/** 审批人 */
@Excel(name = "审批人")
private String approveBy;
/** 审批时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveTime;
/** 驳回原因 */
@Excel(name = "驳回原因")
private String rejectReason;
/** 删除标志0=正常 1=删除 */
@Excel(name = "删除标志0=正常 1=删除")
private Long delFlag;
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;
}
public void setScrapReasonType(String scrapReasonType)
{
this.scrapReasonType = scrapReasonType;
}
public String getScrapReasonType()
{
return scrapReasonType;
}
public void setScrapRemark(String scrapRemark)
{
this.scrapRemark = scrapRemark;
}
public String getScrapRemark()
{
return scrapRemark;
}
public void setGpsLocation(String gpsLocation)
{
this.gpsLocation = gpsLocation;
}
public String getGpsLocation()
{
return gpsLocation;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setApproveBy(String approveBy)
{
this.approveBy = approveBy;
}
public String getApproveBy()
{
return approveBy;
}
public void setApproveTime(Date approveTime)
{
this.approveTime = approveTime;
}
public Date getApproveTime()
{
return approveTime;
}
public void setRejectReason(String rejectReason)
{
this.rejectReason = rejectReason;
}
public String getRejectReason()
{
return rejectReason;
}
public void setDelFlag(Long delFlag)
{
this.delFlag = delFlag;
}
public Long getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("assetId", getAssetId())
.append("scrapReasonType", getScrapReasonType())
.append("scrapRemark", getScrapRemark())
.append("gpsLocation", getGpsLocation())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("approveBy", getApproveBy())
.append("approveTime", getApproveTime())
.append("rejectReason", getRejectReason())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.manager.mapper;
import java.util.List;
import com.ruoyi.manager.domain.RecordAssetScrap;
/**
* Mapper
*
* @author ruoyi
* @date 2026-06-02
*/
public interface RecordAssetScrapMapper
{
/**
*
*
* @param id
* @return
*/
public RecordAssetScrap selectRecordAssetScrapById(Long id);
/**
*
*
* @param recordAssetScrap
* @return
*/
public List<RecordAssetScrap> selectRecordAssetScrapList(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param recordAssetScrap
* @return
*/
public int insertRecordAssetScrap(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param recordAssetScrap
* @return
*/
public int updateRecordAssetScrap(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param id
* @return
*/
public int deleteRecordAssetScrapById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteRecordAssetScrapByIds(String[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.manager.service;
import java.util.List;
import com.ruoyi.manager.domain.RecordAssetScrap;
/**
* Service
*
* @author ruoyi
* @date 2026-06-02
*/
public interface IRecordAssetScrapService
{
/**
*
*
* @param id
* @return
*/
public RecordAssetScrap selectRecordAssetScrapById(Long id);
/**
*
*
* @param recordAssetScrap
* @return
*/
public List<RecordAssetScrap> selectRecordAssetScrapList(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param recordAssetScrap
* @return
*/
public int insertRecordAssetScrap(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param recordAssetScrap
* @return
*/
public int updateRecordAssetScrap(RecordAssetScrap recordAssetScrap);
/**
*
*
* @param ids
* @return
*/
public int deleteRecordAssetScrapByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteRecordAssetScrapById(Long id);
}

@ -0,0 +1,96 @@
package com.ruoyi.manager.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manager.mapper.RecordAssetScrapMapper;
import com.ruoyi.manager.domain.RecordAssetScrap;
import com.ruoyi.manager.service.IRecordAssetScrapService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2026-06-02
*/
@Service
public class RecordAssetScrapServiceImpl implements IRecordAssetScrapService
{
@Autowired
private RecordAssetScrapMapper recordAssetScrapMapper;
/**
*
*
* @param id
* @return
*/
@Override
public RecordAssetScrap selectRecordAssetScrapById(Long id)
{
return recordAssetScrapMapper.selectRecordAssetScrapById(id);
}
/**
*
*
* @param recordAssetScrap
* @return
*/
@Override
public List<RecordAssetScrap> selectRecordAssetScrapList(RecordAssetScrap recordAssetScrap)
{
return recordAssetScrapMapper.selectRecordAssetScrapList(recordAssetScrap);
}
/**
*
*
* @param recordAssetScrap
* @return
*/
@Override
public int insertRecordAssetScrap(RecordAssetScrap recordAssetScrap)
{
recordAssetScrap.setCreateTime(DateUtils.getNowDate());
return recordAssetScrapMapper.insertRecordAssetScrap(recordAssetScrap);
}
/**
*
*
* @param recordAssetScrap
* @return
*/
@Override
public int updateRecordAssetScrap(RecordAssetScrap recordAssetScrap)
{
return recordAssetScrapMapper.updateRecordAssetScrap(recordAssetScrap);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteRecordAssetScrapByIds(String ids)
{
return recordAssetScrapMapper.deleteRecordAssetScrapByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteRecordAssetScrapById(Long id)
{
return recordAssetScrapMapper.deleteRecordAssetScrapById(id);
}
}

@ -0,0 +1,101 @@
<?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="com.ruoyi.manager.mapper.RecordAssetScrapMapper">
<resultMap type="RecordAssetScrap" id="RecordAssetScrapResult">
<result property="id" column="id" />
<result property="assetId" column="asset_id" />
<result property="scrapReasonType" column="scrap_reason_type" />
<result property="scrapRemark" column="scrap_remark" />
<result property="gpsLocation" column="gps_location" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="approveBy" column="approve_by" />
<result property="approveTime" column="approve_time" />
<result property="rejectReason" column="reject_reason" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectRecordAssetScrapVo">
select id, asset_id, scrap_reason_type, scrap_remark, gps_location, status, create_by, create_time, approve_by, approve_time, reject_reason, del_flag from record_asset_scrap
</sql>
<select id="selectRecordAssetScrapList" parameterType="RecordAssetScrap" resultMap="RecordAssetScrapResult">
<include refid="selectRecordAssetScrapVo"/>
<where>
<if test="scrapReasonType != null and scrapReasonType != ''"> and scrap_reason_type = #{scrapReasonType}</if>
<if test="status != null "> and status = #{status}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="params.beginApproveTime != null and params.beginApproveTime != '' and params.endApproveTime != null and params.endApproveTime != ''"> and approve_time between #{params.beginApproveTime} and #{params.endApproveTime}</if>
</where>
</select>
<select id="selectRecordAssetScrapById" parameterType="Long" resultMap="RecordAssetScrapResult">
<include refid="selectRecordAssetScrapVo"/>
where id = #{id}
</select>
<insert id="insertRecordAssetScrap" parameterType="RecordAssetScrap" useGeneratedKeys="true" keyProperty="id">
insert into record_asset_scrap
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="assetId != null">asset_id,</if>
<if test="scrapReasonType != null">scrap_reason_type,</if>
<if test="scrapRemark != null">scrap_remark,</if>
<if test="gpsLocation != null">gps_location,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="approveBy != null">approve_by,</if>
<if test="approveTime != null">approve_time,</if>
<if test="rejectReason != null">reject_reason,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="assetId != null">#{assetId},</if>
<if test="scrapReasonType != null">#{scrapReasonType},</if>
<if test="scrapRemark != null">#{scrapRemark},</if>
<if test="gpsLocation != null">#{gpsLocation},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="approveBy != null">#{approveBy},</if>
<if test="approveTime != null">#{approveTime},</if>
<if test="rejectReason != null">#{rejectReason},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateRecordAssetScrap" parameterType="RecordAssetScrap">
update record_asset_scrap
<trim prefix="SET" suffixOverrides=",">
<if test="assetId != null">asset_id = #{assetId},</if>
<if test="scrapReasonType != null">scrap_reason_type = #{scrapReasonType},</if>
<if test="scrapRemark != null">scrap_remark = #{scrapRemark},</if>
<if test="gpsLocation != null">gps_location = #{gpsLocation},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="approveBy != null">approve_by = #{approveBy},</if>
<if test="approveTime != null">approve_time = #{approveTime},</if>
<if test="rejectReason != null">reject_reason = #{rejectReason},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRecordAssetScrapById" parameterType="Long">
delete from record_asset_scrap where id = #{id}
</delete>
<delete id="deleteRecordAssetScrapByIds" parameterType="String">
delete from record_asset_scrap where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报', '2044', '7', '/manager/asset_scrap', 'C', '0', 'manager:asset_scrap:view', '#', 'admin', sysdate(), '', null, '资产报废提报菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报查询', @parentId, '1', '#', 'F', '0', 'manager:asset_scrap:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报新增', @parentId, '2', '#', 'F', '0', 'manager:asset_scrap:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报修改', @parentId, '3', '#', 'F', '0', 'manager:asset_scrap:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报删除', @parentId, '4', '#', 'F', '0', 'manager:asset_scrap:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('资产报废提报导出', @parentId, '5', '#', 'F', '0', 'manager:asset_scrap:export', '#', 'admin', sysdate(), '', null, '');

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增资产报废提报')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-asset_scrap-add">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">资产ID</label>
<div class="col-sm-8">
<input name="assetId" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">报废原因类型:</label>
<div class="col-sm-8">
<select name="scrapReasonType" class="form-control" th:with="type=${@dict.getType('asset_scrap_reason')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">报废说明:</label>
<div class="col-sm-8">
<textarea name="scrapRemark" class="form-control"></textarea>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">GPS坐标</label>
<div class="col-sm-8">
<input name="gpsLocation" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">审批人:</label>
<div class="col-sm-8">
<input name="approveBy" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">审批时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="approveTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">驳回原因:</label>
<div class="col-sm-8">
<input name="rejectReason" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "manager/asset_scrap"
$("#form-asset_scrap-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-asset_scrap-add').serialize());
}
}
$("input[name='approveTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('资产报废提报列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
报废原因类型:
<select name="scrapReasonType" th:with="type=${@dict.getType('asset_scrap_reason')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>提报人:</label>
<input type="text" name="createBy"/>
</li>
<li class="select-time">
<label>提报时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
</li>
<li class="select-time">
<label>审批时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginApproveTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endApproveTime]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manager:asset_scrap:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manager:asset_scrap:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="manager:asset_scrap:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="manager:asset_scrap:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manager:asset_scrap:edit')}]];
var removeFlag = [[${@permission.hasPermi('manager:asset_scrap:remove')}]];
var scrapReasonTypeDatas = [[${@dict.getType('asset_scrap_reason')}]];
var prefix = ctx + "manager/asset_scrap";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "资产报废提报",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'assetId',
title: '资产ID'
},
{
field: 'scrapReasonType',
title: '报废原因类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(scrapReasonTypeDatas, value);
}
},
{
field: 'scrapRemark',
title: '报废说明'
},
{
field: 'gpsLocation',
title: 'GPS坐标'
},
{
field: 'status',
title: '状态'
},
{
field: 'createBy',
title: '提报人'
},
{
field: 'createTime',
title: '提报时间'
},
{
field: 'approveBy',
title: '审批人'
},
{
field: 'approveTime',
title: '审批时间'
},
{
field: 'rejectReason',
title: '驳回原因'
},
{
field: 'delFlag',
title: '删除标志0=正常 1=删除',
visible: false
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改资产报废提报')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-asset_scrap-edit" th:object="${recordAssetScrap}">
<input name="id" th:field="*{id}" type="hidden">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">资产ID</label>
<div class="col-sm-8">
<input name="assetId" th:field="*{assetId}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">报废原因类型:</label>
<div class="col-sm-8">
<select name="scrapReasonType" class="form-control" th:with="type=${@dict.getType('asset_scrap_reason')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{scrapReasonType}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">报废说明:</label>
<div class="col-sm-8">
<textarea name="scrapRemark" class="form-control">[[*{scrapRemark}]]</textarea>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">GPS坐标</label>
<div class="col-sm-8">
<input name="gpsLocation" th:field="*{gpsLocation}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">审批人:</label>
<div class="col-sm-8">
<input name="approveBy" th:field="*{approveBy}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">审批时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="approveTime" th:value="${#dates.format(recordAssetScrap.approveTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">驳回原因:</label>
<div class="col-sm-8">
<input name="rejectReason" th:field="*{rejectReason}" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "manager/asset_scrap";
$("#form-asset_scrap-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-asset_scrap-edit').serialize());
}
}
$("input[name='approveTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -554,14 +554,14 @@ public class ApiController extends BaseController {
// 更换RFID提交记录添加
@PostMapping("/changeBasketEpc")
public AjaxResult changeBasketEpc(@RequestBody BaseBasketInfo baseBasketInfo) {
// int tagCount = baseBasketInfoService.selectCountBasketByEpc(baseBasketInfo.getBasketEpc());
// if (tagCount > 0) {
// return AjaxResult.error("RFID标签1已绑定");
// }
// tagCount = baseBasketInfoService.selectCountBasketByEpc(baseBasketInfo.getBasketEpc2());
// if (tagCount > 0) {
// return AjaxResult.error("RFID标签2已绑定");
// }
int tagCount = baseBasketInfoService.selectCountBasketByEpc(baseBasketInfo.getBasketEpc());
if (tagCount > 0) {
return AjaxResult.error("RFID标签1已绑定");
}
tagCount = baseBasketInfoService.selectCountBasketByEpc(baseBasketInfo.getBasketEpc2());
if (tagCount > 0) {
return AjaxResult.error("RFID标签2已绑定");
}
int i = baseBasketInfoService.updateBaseBasketInfo(baseBasketInfo);

@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
@ -43,16 +44,26 @@ public final class Md5Utils {
return "";
}
FileInputStream in = null;
FileChannel channel = null;
try {
in = new FileInputStream(file);
FileChannel channel = in.getChannel();
channel = in.getChannel();
MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buffer);
// Windows下 MappedByteBuffer 会锁住文件,必须显式释放才能删除
// cleanMappedBuffer(buffer);
return bytes2Hex(md.digest());
} catch (NoSuchAlgorithmException | IOException e) {
e.printStackTrace();
} finally {
// 先关 channel再关 stream
if (channel != null) {
try {
channel.close();
} catch (IOException ignored) {
}
}
if (in != null) {
try {
in.close();
@ -63,6 +74,19 @@ public final class Md5Utils {
return "";
}
/** 释放 MappedByteBuffer 持有的文件句柄Windows 必需) */
private static void cleanMappedBuffer(MappedByteBuffer buffer) {
try {
Method cleanerMethod = buffer.getClass().getMethod("cleaner");
cleanerMethod.setAccessible(true);
Object cleaner = cleanerMethod.invoke(buffer);
Method cleanMethod = cleaner.getClass().getMethod("clean");
cleanMethod.setAccessible(true);
cleanMethod.invoke(cleaner);
} catch (Exception ignored) {
}
}
/**
* MD5
*

@ -30,11 +30,10 @@
<div class="form-group">
<label class="col-sm-3 control-label">位置:</label>
<div class="col-sm-8">
<!-- <input type="hidden" name="downloadUrl">-->
<!-- <div class="file-loading">-->
<!-- <input class="form-control file-upload" id="downloadUrl" name="file" type="file">-->
<input id="filePath" name="filePath" class="form-control" type="file">
<!-- </div>-->
<input type="hidden" id="downloadUrl" name="downloadUrl">
<div class="file-loading">
<input id="apkFile" name="file" type="file">
</div>
</div>
</div>
</form>
@ -49,30 +48,17 @@
});
function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/add", $('#form-pda_version-add').serialize());
// }
var formData = new FormData();
if ($('#filePath')[0].files[0] == null) {
$.modal.alertWarning("请先选择文件路径");
if ($("#downloadUrl").val() === '') {
$.modal.alertWarning("请先上传APK文件");
return false;
}
formData.append('versionCode', $("input[name='versionCode']").val());
formData.append('versionName', $("input[name='versionName']").val());
formData.append('modifyContent', $("input[name='modifyContent']").val());
formData.append('file', $('#filePath')[0].files[0]);
$.ajax({
url: prefix + "/add",
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function(result) {
$.operate.successCallback(result);
}
});
var data = {
versionCode: $("input[name='versionCode']").val(),
versionName: $("input[name='versionName']").val(),
modifyContent: $("input[name='modifyContent']").val(),
downloadUrl: $("#downloadUrl").val()
};
$.operate.save(prefix + "/add", data);
}
// $(".file-upload").fileinput({
@ -86,6 +72,18 @@
// })
$(function() {
// APK文件上传
$("#apkFile").fileinput({
uploadUrl: ctx + 'common/upload',
maxFileCount: 1,
autoReplace: true,
uploadExtraData: { fileType: "apk" }
}).on('fileuploaded', function (event, data) {
// 上传成功,将服务器返回的相对路径写入隐藏字段
$("#downloadUrl").val(data.response.url);
}).on('fileremoved', function () {
$("#downloadUrl").val('');
});
$('.summernote').summernote({
lang: 'zh-CN',
dialogsInBody: true,

Loading…
Cancel
Save