订单详情(进度需要考虑是否计入审核中的数量)

This commit is contained in:
磷叶 2024-12-06 17:59:49 +08:00
parent 8f6e296bb2
commit 8516fa0759
20 changed files with 128 additions and 72 deletions

View File

@ -35,7 +35,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLog;
/**
* 操作日志记录处理

View File

@ -11,14 +11,14 @@ import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLog;
import com.ruoyi.system.service.ISysLogininforService;
import com.ruoyi.system.service.ISysOperLogService;
import com.ruoyi.system.operLog.service.ISysOperLogService;
import eu.bitwalker.useragentutils.UserAgent;
/**
* 异步工厂产生任务用
*
*
* @author ruoyi
*/
public class AsyncFactory
@ -27,7 +27,7 @@ public class AsyncFactory
/**
* 记录登录信息
*
*
* @param username 用户名
* @param status 状态
* @param message 消息
@ -82,7 +82,7 @@ public class AsyncFactory
/**
* 操作日志记录
*
*
* @param operLog 操作日志信息
* @return 任务task
*/

View File

@ -1,4 +1,4 @@
package com.ruoyi.system.domain;
package com.ruoyi.system.operLog.domain;
import java.util.Date;
import java.util.List;

View File

@ -0,0 +1,16 @@
package com.ruoyi.system.operLog.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author wjh
* 2024/12/6
*/
@Data
public class SysOperLogQuery extends SysOperLogVO {
@ApiModelProperty("业务ID")
private Long bizId;
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.system.operLog.domain;
import lombok.Data;
/**
* @author wjh
* 2024/12/6
*/
@Data
public class SysOperLogVO extends SysOperLog{
}

View File

@ -1,33 +1,35 @@
package com.ruoyi.system.mapper;
package com.ruoyi.system.operLog.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLogQuery;
import com.ruoyi.system.operLog.domain.SysOperLogVO;
/**
* 操作日志 数据层
*
*
* @author ruoyi
*/
public interface SysOperLogMapper
{
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
*
* @param query 操作日志对象
* @return 操作日志集合
*/
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
public List<SysOperLogVO> selectOperLogList(SysOperLogQuery query);
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -35,11 +37,11 @@ public interface SysOperLogMapper
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
public SysOperLog selectOperLogById(Long operId);
public SysOperLogVO selectOperLogById(Long operId);
/**
* 清空操作日志

View File

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysOperLogMapper">
<mapper namespace="com.ruoyi.system.operLog.mapper.SysOperLogMapper">
<resultMap type="SysOperLog" id="SysOperLogResult" autoMapping="true">
<resultMap type="SysOperLogVO" id="SysOperLogResult" autoMapping="true">
<result column="biz_ids" property="bizIds" typeHandler="com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler"/>
</resultMap>
@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
<select id="selectOperLogList" parameterType="SysOperLogQuery" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="operIp != null and operIp != ''">
@ -99,6 +99,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="bizId != null">
and find_in_set(#{bizId}, biz_ids)
</if>
<if test="bizType != null and bizType != ''">
and biz_type = #{bizType}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
</if>

View File

@ -1,33 +1,35 @@
package com.ruoyi.system.service;
package com.ruoyi.system.operLog.service;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLog;
import com.ruoyi.system.operLog.domain.SysOperLogQuery;
import com.ruoyi.system.operLog.domain.SysOperLogVO;
/**
* 操作日志 服务层
*
*
* @author ruoyi
*/
public interface ISysOperLogService
{
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
*
* @param query 操作日志对象
* @return 操作日志集合
*/
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
public List<SysOperLogVO> selectOperLogList(SysOperLogQuery query);
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -35,11 +37,11 @@ public interface ISysOperLogService
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
public SysOperLog selectOperLogById(Long operId);
public SysOperLogVO selectOperLogById(Long operId);
/**
* 清空操作日志

View File

@ -1,15 +1,18 @@
package com.ruoyi.system.service.impl;
package com.ruoyi.system.operLog.service.impl;
import java.util.List;
import com.ruoyi.system.operLog.domain.SysOperLogQuery;
import com.ruoyi.system.operLog.domain.SysOperLogVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.mapper.SysOperLogMapper;
import com.ruoyi.system.service.ISysOperLogService;
import com.ruoyi.system.operLog.domain.SysOperLog;
import com.ruoyi.system.operLog.mapper.SysOperLogMapper;
import com.ruoyi.system.operLog.service.ISysOperLogService;
/**
* 操作日志 服务层处理
*
*
* @author ruoyi
*/
@Service
@ -20,7 +23,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
@Override
@ -31,19 +34,19 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
*
* @param query 操作日志对象
* @return 操作日志集合
*/
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
public List<SysOperLogVO> selectOperLogList(SysOperLogQuery query)
{
return operLogMapper.selectOperLogList(operLog);
return operLogMapper.selectOperLogList(query);
}
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -55,12 +58,12 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@Override
public SysOperLog selectOperLogById(Long operId)
public SysOperLogVO selectOperLogById(Long operId)
{
return operLogMapper.selectOperLogById(operId);
}

View File

@ -580,7 +580,7 @@ public class SysUserServiceImpl implements ISysUserService
user.setCreateBy(operator.getNickName());
int insert = userMapper.insertUser(user);
ServiceUtil.assertion(insert != 1, "新增用户失败");
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.ADD, user, null);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.ADD, user, null, user.getUserId());
return insert;
}
else if (isUpdateSupport) {
@ -590,19 +590,19 @@ public class SysUserServiceImpl implements ISysUserService
user.setUpdateBy(operator.getNickName());
int update = userMapper.updateUser(user);
ServiceUtil.assertion(update != 1, "修改用户失败");
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.UPDATE, user, null);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.UPDATE, user, null, user.getUserId());
return update;
}
else {
String msg = "用户工号为 " + user.getUserNo() + " 的数据已存在";
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, user, msg);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, user, msg, old.getUserId());
return 0;
}
});
} catch (Exception e) {
String msg = "用户工号为 " + user.getUserNo() + " 的数据导入失败:" + e.getMessage();
log.error(msg, e);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, user, msg);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, user, msg, null);
}
}

View File

@ -36,4 +36,7 @@ public class LogImportDetail extends BaseEntity
@ApiModelProperty("导入结果信息")
private String message;
@Excel(name = "业务数据ID")
@ApiModelProperty("业务数据ID")
private Long bstId;
}

View File

@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
blid.type,
blid.content,
blid.message,
blid.bst_id,
bli.biz_type as log_biz_type
from bst_log_import_detail blid
left join bst_log_import bli on bli.log_id = blid.log_id
@ -22,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.detailId != null "> and blid.detail_id = #{query.detailId}</if>
<if test="query.logId != null "> and blid.log_id = #{query.logId}</if>
<if test="query.type != null and query.type != ''"> and blid.type = #{query.type}</if>
<if test="query.bstId != null "> and blid.bst_id = #{query.bstId}</if>
<if test="query.logBizType != null and query.logBizType != ''">and bli.biz_type = #{query.logBizType}</if>
${query.params.dataScope}
</sql>
@ -63,12 +66,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''">type,</if>
<if test="content != null and content != ''">content,</if>
<if test="message != null">message,</if>
<if test="bstId != null">bst_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="logId != null">#{logId},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="message != null">#{message},</if>
<if test="bstId != null">#{bstId},</if>
</trim>
</insert>
@ -85,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.type != null and data.type != ''">type = #{data.type},</if>
<if test="data.content != null and data.content != ''">content = #{data.content},</if>
<if test="data.message != null">message = #{data.message},</if>
<if test="data.bstId != null">bst_id = #{data.bstId},</if>
</sql>
<delete id="deleteLogImportDetailByDetailId" parameterType="Long">

View File

@ -65,12 +65,14 @@ public interface ILogImportDetailService
/**
* 插入一条结果
* @param logId 日志ID
* @param type 类型
*
* @param logId 日志ID
* @param type 类型
* @param content 内容
* @param message 信息
* @param bstId
*/
int addResult(Long logId, LogImportDetailType type, Object content, String message);
int addResult(Long logId, LogImportDetailType type, Object content, String message, Long bstId);
/**
* 查询日志统计,并以日志ID分组

View File

@ -1,11 +1,8 @@
package com.ruoyi.yh.logImportDetail.service.impl;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.yh.logImportDetail.domain.enums.LogImportDetailType;
import com.ruoyi.yh.logImportDetail.domain.vo.LogImportDetailStatisticsByLogIdVO;
import org.springframework.beans.factory.annotation.Autowired;
@ -102,7 +99,7 @@ public class LogImportDetailServiceImpl implements ILogImportDetailService
@Override
public int addResult(Long logId, LogImportDetailType type, Object content, String message) {
public int addResult(Long logId, LogImportDetailType type, Object content, String message, Long bstId) {
if (logId == null || type == null || content == null) {
return 0;
}
@ -111,6 +108,7 @@ public class LogImportDetailServiceImpl implements ILogImportDetailService
data.setType(type.getType());
data.setContent(JSON.toJSONString(content));
data.setMessage(message);
data.setBstId(bstId);
return logImportDetailMapper.insertLogImportDetail(data);
}

View File

@ -91,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertPrice" parameterType="Price" useGeneratedKeys="true" keyProperty="priceId">
insert into bst_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="priceId != null">price_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="status != null and status != ''">`status`,</if>
<if test="category != null">category,</if>
@ -118,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quantityDenominator != null">quantity_denominator,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="priceId != null">#{priceId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="category != null">#{category},</if>

View File

@ -349,15 +349,16 @@ public class PriceServiceImpl implements PriceService
// 新增
int insert = this.insertPrice(price);
ServiceUtil.assertion(insert != 1, "新增失败");
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.ADD, price, null);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.ADD, price, null, price.getPriceId());
return insert;
} else {
// 校验
BeanValidators.validateWithException(validator, price, ValidGroup.Update.class);
// 修改
price.setPriceId(old.getPriceId());
int update = this.updatePrice(price);
ServiceUtil.assertion(update != 1, "新增失败");
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.UPDATE, price, null);
ServiceUtil.assertion(update != 1, "修改失败");
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.UPDATE, price, null, price.getPriceId());
return update;
}
});
@ -365,12 +366,12 @@ public class PriceServiceImpl implements PriceService
// 不覆盖
else {
String msg = "单价ID为 " + price.getPriceId() + " 的数据已存在";
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, price, msg);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, price, msg, price.getPriceId());
}
} catch (Exception e) {
String msg = "单价ID为 " + price.getPriceId() + " 的数据导入失败:" + e.getMessage();
log.error(msg, e);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, price, msg);
logImportDetailService.addResult(importLog.getLogId(), LogImportDetailType.FAIL, price, msg, price.getPriceId());
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.yh.prodOrder.domain.dto;
import com.ruoyi.common.core.interfaces.LogBizParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -16,7 +17,6 @@ public class ProdOrderSyncQuery {
@ApiModelProperty("业务状态列表")
private List<String> statusList;
@ApiModelProperty("生产订单ID")
@ApiModelProperty("ERP生产订单ID")
private String id;
}

View File

@ -292,17 +292,17 @@ public class ProdOrderServiceImpl implements ProdOrderService
if (old == null) {
int insert = this.insertProdOrder(prodOrder);
ServiceUtil.assertion(insert != 1, "新增失败");
logImportDetailService.addResult(logId, LogImportDetailType.ADD, prodOrder, null);
logImportDetailService.addResult(logId, LogImportDetailType.ADD, prodOrder, null, prodOrder.getId());
return insert;
} else {
prodOrder.setId(old.getId());
int update = this.updateProdOrder(prodOrder);
ServiceUtil.assertion(update != 1, "修改失败");
logImportDetailService.addResult(logId, LogImportDetailType.UPDATE, prodOrder, null);
logImportDetailService.addResult(logId, LogImportDetailType.UPDATE, prodOrder, null, prodOrder.getId());
return update;
}
} catch (Exception e) {
logImportDetailService.addResult(logId, LogImportDetailType.FAIL, prodOrder, e.getMessage());
logImportDetailService.addResult(logId, LogImportDetailType.FAIL, prodOrder, e.getMessage(), null);
return 0;
} finally {
redisLock.unlock(RedisLockKey.SYNC_PROD_BILL, lockKey);

View File

@ -2,6 +2,9 @@ package com.ruoyi.web.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.operLog.domain.SysOperLogQuery;
import com.ruoyi.system.operLog.domain.SysOperLogVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
@ -16,8 +19,8 @@ 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.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
import com.ruoyi.system.operLog.domain.SysOperLog;
import com.ruoyi.system.operLog.service.ISysOperLogService;
/**
* 操作日志记录
@ -33,20 +36,20 @@ public class SysOperlogController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
public TableDataInfo list(SysOperLogQuery query)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
List<SysOperLogVO> list = operLogService.selectOperLogList(query);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
public void export(HttpServletResponse response, SysOperLogQuery query)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
List<SysOperLogVO> list = operLogService.selectOperLogList(query);
ExcelUtil<SysOperLogVO> util = new ExcelUtil<SysOperLogVO>(SysOperLogVO.class);
util.exportExcel(response, list, "操作日志");
}

View File

@ -86,7 +86,8 @@ public class ProdOrderController extends BaseController
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(prodOrderService.selectProdOrderById(id));
ProdOrderVO detail = prodOrderService.selectProdOrderById(id);
return success(detail);
}
/**