Compare commits

...

2 Commits

Author SHA1 Message Date
wanghao 6ef3caff31 feat:报废连资产表 3 weeks ago
wanghao 3c1f2ca37b feat:版本 3 weeks ago

@ -6,12 +6,12 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://1.13.177.47:3306/bgs_wms_2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Haiwei123456
# url: jdbc:mysql://localhost:3306/bgs_wms_2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://1.13.177.47:3306/bgs_wms_2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: haiwei@123
# password: Haiwei123456
url: jdbc:mysql://localhost:3306/bgs_wms_2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: haiwei@123
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -57,6 +57,17 @@ public class RecordAssetScrap extends BaseEntity
@Excel(name = "删除标志0=正常 1=删除")
private Long delFlag;
/** 关联资产基本信息 */
private BaseBasketInfo baseBasketInfo;
public BaseBasketInfo getBaseBasketInfo() {
return baseBasketInfo;
}
public void setBaseBasketInfo(BaseBasketInfo baseBasketInfo) {
this.baseBasketInfo = baseBasketInfo;
}
public void setId(Long id)
{
this.id = id;

@ -4,7 +4,7 @@ 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">
<resultMap type="com.ruoyi.manager.domain.RecordAssetScrap" id="RecordAssetScrapResult">
<result property="id" column="id" />
<result property="assetId" column="asset_id" />
<result property="scrapReasonType" column="scrap_reason_type" />
@ -17,20 +17,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="approveTime" column="approve_time" />
<result property="rejectReason" column="reject_reason" />
<result property="delFlag" column="del_flag" />
<association property="baseBasketInfo" resultMap="com.ruoyi.manager.mapper.BaseBasketInfoMapper.BaseBasketInfoResult"/>
</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>
<sql id="selectLeft">
select ras.id,
ras.asset_id,
ras.scrap_reason_type,
ras.scrap_remark,
ras.gps_location,
ras.status,
ras.create_by,
ras.create_time,
ras.approve_by,
ras.approve_time,
ras.reject_reason,
ras.del_flag,
bbi.obj_id,
bbi.basket_code,
bbi.basket_spe,
bbi.basket_type,
bbi.steel_grade,
bbi.self_code
from record_asset_scrap ras
left join base_basket_info bbi on ras.asset_id = bbi.obj_id
</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>
<include refid="selectLeft"/>
<where>
and ras.del_flag = 0
<if test="assetId != null "> and ras.asset_id = #{assetId}</if>
<if test="scrapReasonType != null and scrapReasonType != ''"> and ras.scrap_reason_type = #{scrapReasonType}</if>
<if test="status != null "> and ras.status = #{status}</if>
<if test="createBy != null and createBy != ''"> and ras.create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and ras.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 ras.approve_time between #{params.beginApproveTime} and #{params.endApproveTime}</if>
<if test="params.basketCode != null and params.basketCode != ''"> and bbi.basket_code like concat('%', #{params.basketCode}, '%')</if>
<if test="params.steelGrade != null and params.steelGrade != ''"> and bbi.steel_grade like concat('%', #{params.steelGrade}, '%')</if>
<if test="params.selfCode != null and params.selfCode != ''"> and bbi.self_code like concat('%', #{params.selfCode}, '%')</if>
<if test="params.basketType != null and params.basketType != ''"> and bbi.basket_type = #{params.basketType}</if>
</where>
</select>
@ -87,15 +117,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteRecordAssetScrapById" parameterType="Long">
delete from record_asset_scrap where id = #{id}
</delete>
<update id="deleteRecordAssetScrapById" parameterType="Long">
update record_asset_scrap set del_flag = 1 where id = #{id}
</update>
<delete id="deleteRecordAssetScrapByIds" parameterType="String">
delete from record_asset_scrap where id in
<update id="deleteRecordAssetScrapByIds" parameterType="String">
update record_asset_scrap set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>

@ -17,21 +17,41 @@
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>资产编号:</label>
<input type="text" name="params[basketCode]"/>
</li>
<li>
<label>钢号:</label>
<input type="text" name="params[steelGrade]"/>
</li>
<li>
<label>自编号:</label>
<input type="text" name="params[selfCode]"/>
</li>
<li>
<label>资产类型:</label>
<select name="params[basketType]" th:with="type=${@dict.getType('basket_type')}">
<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]"/>
<input type="text" class="time-input" id="startCreateTime" placeholder="开始时间" name="params[beginCreateTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
<input type="text" class="time-input" id="endCreateTime" placeholder="结束时间" name="params[endCreateTime]"/>
</li>
<li class="select-time">
<label>审批时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginApproveTime]"/>
<input type="text" class="time-input" id="startApproveTime" placeholder="开始时间" name="params[beginApproveTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endApproveTime]"/>
<input type="text" class="time-input" id="endApproveTime" 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>
@ -66,6 +86,7 @@
var editFlag = [[${@permission.hasPermi('manager:asset_scrap:edit')}]];
var removeFlag = [[${@permission.hasPermi('manager:asset_scrap:remove')}]];
var scrapReasonTypeDatas = [[${@dict.getType('asset_scrap_reason')}]];
var basketTypeDatas = [[${@dict.getType('basket_type')}]];
var prefix = ctx + "manager/asset_scrap";
$(function() {
@ -86,7 +107,27 @@
},
{
field: 'assetId',
title: '资产ID'
title: '资产ID',
visible: false
},
{
field: 'baseBasketInfo.basketCode',
title: '资产编号'
},
{
field: 'baseBasketInfo.basketType',
title: '资产类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(basketTypeDatas, value);
}
},
{
field: 'baseBasketInfo.steelGrade',
title: '钢号'
},
{
field: 'baseBasketInfo.selfCode',
title: '自编号'
},
{
field: 'scrapReasonType',
@ -101,7 +142,8 @@
},
{
field: 'gpsLocation',
title: 'GPS坐标'
title: 'GPS坐标',
visible:false
},
{
field: 'status',

@ -14,10 +14,7 @@
<label>任务编码:</label>
<input type="text" name="taskCode"/>
</li>
<li>
<label>资产ID</label>
<input type="text" name="basketId"/>
</li>
<li>
<label>盘点状态:</label>
<select name="checkState" th:with="type=${@dict.getType('check_basket_state')}">

@ -1,6 +1,5 @@
package com.ruoyi.webapi.controller;
import com.ruoyi.common.utils.IpUtils;
import com.ruoyi.webapi.doman.PdaApkVersion;
import com.ruoyi.webapi.service.IPdaApkVersionService;
import com.ruoyi.webapi.utils.Md5Utils;
@ -10,17 +9,14 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
@ -78,33 +74,31 @@ public class PdaApkVersionController extends BaseController {
/**
*
* bootstrap-fileinput APK /common/upload
* common/upload url downloadUrl
*/
@RequiresPermissions("pda:pda_version:add")
@Log(title = "手持版本升级", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(MultipartFile file, PdaApkVersion pdaApkVersion) {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath() + "/apk";
// 上传并返回新文件名称
try {
String fileName = FileUploadUtils.upload(filePath, file);
String pathname = filePath + fileName;
System.out.println("地址1" + pathname);
pathname = pathname.replace("/profile/upload/apk", "");
System.out.println("地址2" + pathname);
File file1 = new File(pathname);
System.out.println("文件获取:" + file1.exists());
System.out.println(file1.length() / 1024);
pdaApkVersion.setApkSize(file1.length() / 1024);
pdaApkVersion.setApkMd5(Md5Utils.getFileMD5(file1));
pdaApkVersion.setDownloadUrl( "http://"+"119.45.202.115"+":8091"+fileName);
} catch (IOException e) {
e.printStackTrace();
public AjaxResult addSave(PdaApkVersion pdaApkVersion) {
String downloadUrl = pdaApkVersion.getDownloadUrl();
if (downloadUrl == null || downloadUrl.isEmpty()) {
return AjaxResult.error("请先上传APK文件");
}
return toAjax(pdaApkVersionService.insertPdaApkVersion(pdaApkVersion));
// common/upload 返回的 url 已经是完整地址(含 http://host:port直接存入
// 格式http://host:port/profile/upload/yyyy/MM/dd/xxx.apk
pdaApkVersion.setDownloadUrl(downloadUrl);
// 根据 URL 定位本地文件,计算大小和 MD5
File file = getLocalFile(downloadUrl);
if (file != null && file.exists()) {
pdaApkVersion.setApkSize(file.length() / 1024);
pdaApkVersion.setApkMd5(Md5Utils.getFileMD5(file));
}
return toAjax(pdaApkVersionService.insertPdaApkVersion(pdaApkVersion));
}
/**
@ -115,16 +109,8 @@ public class PdaApkVersionController extends BaseController {
@ResponseBody
public AjaxResult edit(@PathVariable("objid") Long objid) {
PdaApkVersion pdaApkVersion = pdaApkVersionService.selectPdaApkVersionByObjid(objid);
String downloadUrl = pdaApkVersion.getDownloadUrl();
String substring = downloadUrl.substring(downloadUrl.indexOf("/apk"));
try {
FileUtils.deleteFile(RuoYiConfig.getUploadPath() + substring);
}catch (Exception e){
}
deleteApkLocalFile(pdaApkVersion.getDownloadUrl());
return toAjax(pdaApkVersionService.deletePdaApkVersionByObjid(objid));
}
/**
@ -146,13 +132,44 @@ public class PdaApkVersionController extends BaseController {
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
System.out.println(ids);
PdaApkVersion pdaApkVersion = pdaApkVersionService.selectPdaApkVersionByObjid(Long.valueOf(ids));
String downloadUrl = pdaApkVersion.getDownloadUrl();
if (downloadUrl!=null&&!downloadUrl.isEmpty()){
String substring = downloadUrl.substring(downloadUrl.indexOf("/apk"));
FileUtils.deleteFile(RuoYiConfig.getUploadPath() + substring);
}
deleteApkLocalFile(pdaApkVersion.getDownloadUrl());
return toAjax(pdaApkVersionService.deletePdaApkVersionByObjids(ids));
// return AjaxResult.error()
}
/**
* URL
* URLhttp://host:port/profile/upload/yyyy/MM/dd/xxx.apk
* RuoYiConfig.getProfile()/upload/yyyy/MM/dd/xxx.apk
*/
private String getLocalPath(String downloadUrl) {
if (downloadUrl == null || downloadUrl.isEmpty()) return null;
// 取 /profile 之后的部分,如 "/upload/2026/06/02/xxx.apk"
String subPath = FileUtils.stripPrefix(downloadUrl);
if (subPath == null || subPath.isEmpty()) {
System.err.println("[PdaApkVersion] getLocalPath FAIL: 未找到 /profile 前缀, downloadUrl=[" + downloadUrl + "]");
return null;
}
String localPath = RuoYiConfig.getProfile() + subPath;
System.err.println("[PdaApkVersion] getLocalPath: downloadUrl=[" + downloadUrl + "] -> localPath=[" + localPath + "]");
return localPath;
}
/** 删除APK本地文件供 edit/remove 公用 */
private void deleteApkLocalFile(String downloadUrl) {
String localPath = getLocalPath(downloadUrl);
if (localPath == null) {
System.err.println("[PdaApkVersion] deleteApkLocalFile: getLocalPath null, skip");
return;
}
boolean deleted = FileUtils.deleteFile(localPath);
System.err.println("[PdaApkVersion] deleteApkLocalFile: localPath=[" + localPath + "] deleted=" + deleted);
}
private File getLocalFile(String downloadUrl) {
String localPath = getLocalPath(downloadUrl);
return localPath != null ? new File(localPath) : null;
}
}

Loading…
Cancel
Save