Commit 257e7848 authored by lanbaoming's avatar lanbaoming

2024-05-13新功能和运维BUG处理

parent d39deb65
......@@ -11,8 +11,12 @@ import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -132,4 +136,32 @@ public class JsonUtils {
}
}
/*
lanbm 2024-04-12 add
保存指定的测试信息
*/
public static void SaveLog(String content) {
FileOutputStream outputStream = null;
try {
File file = new File("D:\\ProjectLog\\TestLog.txt");
outputStream = new FileOutputStream(file, true);
Date day = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sdf.format(day);
content = s+":" + content;
byte[] bytes = content.getBytes();
outputStream.write(bytes);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
......@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import cn.iocoder.yudao.module.delivery.listener.TestEvent;
import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -28,6 +30,10 @@ public class EcwVzController {
@Resource
private EcwVzService ecwVzService;
@Resource
private ApplicationContext applicationContext;
private final String HYPG = "海运拼柜";
private final String ZXKY = "专线空运";
......@@ -114,5 +120,15 @@ public class EcwVzController {
return success(this.ecwVzService.selectPage(PageReq));
}
@GetMapping("/Test")
@Operation(summary = "测试功能")
public CommonResult<Boolean> Test() {
TestEvent even=new TestEvent();
even.setName("测试事件监听");
applicationContext.publishEvent(even);
return success(true);
}
}
package cn.iocoder.yudao.module.delivery.entity.orderdata;
import lombok.Data;
/*
订单业务逻辑的相关判断 lanbm 2024-05-07 add
此参数暂时未使用
*/
@Data
public class OrderExt {
}
......@@ -6,4 +6,11 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode TEST_NOT_EXISTS = new ErrorCode(2004020001, "单号配置不存在");
//ErrorCode ORDER_NOT_EXISTS = new ErrorCode(2004020002, "订单不存在");
//lanbm 2024-05-13 add
ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(2004020003, "客户不存在");
ErrorCode VCONFIG_NOT_EXISTS = new ErrorCode(2004020004, "V值配置参数不存在");
}
......@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import javax.validation.Valid;
......@@ -20,83 +21,81 @@ import javax.validation.Valid;
* @since 2024-04-02 22:38:22
*/
@Service("ecwVzService")
public class EcwVzServiceImpl extends ServiceImpl<EcwVzMapper,EcwVz> implements EcwVzService {
public class EcwVzServiceImpl extends ServiceImpl<EcwVzMapper, EcwVz> implements EcwVzService {
@Autowired
private EcwVzMapper ecwVzMapper;
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
public Long create(@Valid EcwVz createReq)
{
public Long create(@Valid EcwVz createReq) {
ecwVzMapper.insert(createReq);
return createReq.getId();
}
/**
* 更新测试
*
* @param updateReq 更新信息
*/
public void update(@Valid EcwVz updateReq)
{
public void update(@Valid EcwVz updateReq) {
ecwVzMapper.updateById(updateReq);
}
/**
* 删除测试
*
* @param id 编号
*/
public void delete(Long id)
{
public void delete(Long id) {
ecwVzMapper.deleteById2(id);
}
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
public EcwVz getModel(Long id)
{
public EcwVz getModel(Long id) {
return ecwVzMapper.selectById(id);
}
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
public List<EcwVz> getQueryList(Collection<Long> ids)
{
return ecwVzMapper. selectBatchIds(ids);
public List<EcwVz> getQueryList(Collection<Long> ids) {
return ecwVzMapper.selectBatchIds(ids);
}
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 列表
*/
public List<EcwVz> getQueryList(EcwVz query)
{
return ecwVzMapper. selectList(query);
public List<EcwVz> getQueryList(EcwVz query) {
return ecwVzMapper.selectList(query);
}
/**
* 获得测试分页
*
* @param page 分页查询
* @param page 查询
* @return 分页列表
*/
public PageResult<EcwVz> selectPage(EcwVzPageReq page)
{
public PageResult<EcwVz> selectPage(EcwVzPageReq page) {
return ecwVzMapper.selectPage(page);
}
}
......@@ -12,6 +12,7 @@ import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
......@@ -566,10 +567,10 @@ public class OrderDO extends BaseDO {
@TableField(exist = false)
@ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)")
private String prefixStatusZh="";
private String prefixStatusZh = "";
@TableField(exist = false)
@ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)")
private String prefixStatusEn="";
private String prefixStatusEn = "";
@TableField(exist = false)
@ApiModelProperty(value = "是否主拆单")
......@@ -600,4 +601,24 @@ public class OrderDO extends BaseDO {
// @TableField(exist = false)
// @ApiModelProperty(value = "是否重置订单编号")
// private Boolean resetOrderNo;
/*
lanbm 2024-05-13 add
*/
@ApiModelProperty(value = "客户业绩类型:1 新客户业绩 0老客户业绩")
private Integer yejiType;
/*
业绩产生时间 lanbm 2024-05-13 add
*/
private Date yejiCreateDate;
/*
海运根据体积计算出的V值,空运根据重量计算出的V值
lanbm 2024-05-13 add
*/
private BigDecimal calVValue;
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
......@@ -62,6 +63,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -120,6 +122,10 @@ public class OrderController {
@Resource
private RedisHelper redisHelper;
//lanbm 2024-05-13 add
@Resource
private ApplicationContext applicationContext;
/**
* 订单修改操作的防重复提交缓存key
......@@ -144,7 +150,10 @@ public class OrderController {
throw exception(ORDER_EXPRESS_NUMBER_TOO_LONG);
}
}
return success(orderService.createOrder(createReqVO, null).getOrderId());
//lanbm 2024-05-13 添加注释
Long orderId = orderService.createOrder(createReqVO, null).getOrderId();
return success(orderId);
}
......@@ -165,12 +174,13 @@ public class OrderController {
}
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
orderService.updateOrder(updateReqVO, null);
redisHelper.delete(redisKey);
return success(true);
}
......@@ -181,7 +191,7 @@ public class OrderController {
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
......@@ -197,7 +207,7 @@ public class OrderController {
public CommonResult<Boolean> recoveryOrder(@PathVariable("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
......@@ -213,7 +223,7 @@ public class OrderController {
public CommonResult<Boolean> cancelOrder(@PathVariable("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
......@@ -253,7 +263,7 @@ public class OrderController {
}
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
......@@ -352,11 +362,11 @@ public class OrderController {
}
query.setUserType(UserTypeEnum.ADMIN.getValue());
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){
if (Objects.isNull(loginUser)) {
return error(ErrorCodeConstants.USER_NOT_EXISTS);
}
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){
if (Objects.isNull(roleRespDTOS)) {
return error(ROLE_NOT_EXISTS);
}
addDataScopeQuery(query, loginUser, roleRespDTOS);
......@@ -370,7 +380,7 @@ public class OrderController {
boolean isAll = Boolean.FALSE;
for (RoleRespDTO roleRespDTO : roleRespDTOS) {
DataScopeEnum dataScopeEnum = DataScopeEnum.valueOf(roleRespDTO.getDataScope());
switch (dataScopeEnum){
switch (dataScopeEnum) {
case ALL:
// 全部数据权限,不限制
isAll = Boolean.TRUE;
......@@ -393,12 +403,12 @@ public class OrderController {
break;
}
}
if (!isAll){
if (!isAll) {
// 非全部数据权限时查询限制条件
if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0){
if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0) {
// 没有部门限制条件时,只查询当前用户自己的
query.setCreator(String.valueOf(loginUser.getId()));
}else {
} else {
// 查询限定部门的数据
query.setDeptIdList(deptIdList);
}
......@@ -670,8 +680,8 @@ public class OrderController {
@RequestParam(value = "isAllPrice", defaultValue = "false") Boolean isAllPrice,
@RequestParam(value = "isResetPrice") Boolean isResetPrice) {
List<String> list = new ArrayList<>();
if (StringUtils.isBlank(orderNumbers) && (Objects.isNull(isAllPrice) || !isAllPrice)){
return error(new ErrorCode(11110000,"请确认是否全部重置"));
if (StringUtils.isBlank(orderNumbers) && (Objects.isNull(isAllPrice) || !isAllPrice)) {
return error(new ErrorCode(11110000, "请确认是否全部重置"));
}
if (StringUtils.isNotBlank(orderNumbers)) {
list.addAll(Arrays.asList(orderNumbers.split(StrUtil.COMMA)));
......@@ -729,11 +739,11 @@ public class OrderController {
}
query.setUserType(UserTypeEnum.ADMIN.getValue());
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){
if (Objects.isNull(loginUser)) {
return error(ErrorCodeConstants.USER_NOT_EXISTS);
}
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){
if (Objects.isNull(roleRespDTOS)) {
return error(ROLE_NOT_EXISTS);
}
addDataScopeQuery(query, loginUser, roleRespDTOS);
......@@ -790,8 +800,4 @@ public class OrderController {
}
}
......@@ -444,7 +444,11 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
// }
paramMap.put("seaFreight", item.getOneSeaFreight() + currencyMap.get(item.getSeaFreightCurrency()) + "/m³");
if (item.getOneClearanceFreight().compareTo(BigDecimal.ZERO) == 0) {
if (item.getClearanceFreightCurrency() == null) {
if (item.getClearanceFreightCurrency() == null ||
item.getClearanceFreightCurrency() == 0 ||
currencyMap.get(item.getClearanceFreightCurrency()) == null) {
//lanbm 2024-05-07 调整逻辑判断,是币种字段为空则显示0
//item.getClearanceFreightCurrency() 币种项在数据字典中不存在
paramMap.put("clearanceFreight", "0");
} else {
paramMap.put("clearanceFreight",
......
......@@ -214,6 +214,9 @@ public class MakeBillOfLadingController {
return success(true);
}
/*
lanbm 2024-05-07 修改报关价显示单位问题
*/
@GetMapping("/make")
@ApiOperation("制作提货单")
@ApiImplicitParams({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment