mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
# Conflicts: # cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderGroup/OrderGroupMapper.java
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ public class AliyunSmsClient extends AbstractSmsClient {
|
||||
// 执行请求
|
||||
SendSmsResponse response = client.getAcsResponse(request);
|
||||
return new SmsSendRespDTO().setSuccess(Objects.equals(response.getCode(), API_CODE_SUCCESS)).setSerialNo(response.getBizId())
|
||||
.setApiRequestId(response.getRequestId()).setApiCode(response.getCode()).setApiMsg(response.getMessage()).setChannelCode(properties.getChannel());
|
||||
.setApiRequestId(response.getRequestId()).setApiCode(response.getCode()).setApiMsg(response.getMessage()).setMobile(mobile).setChannelCode(properties.getChannel());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.controller.admin.order;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.framework.web.config.WebProperties;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
|
||||
@@ -304,7 +305,7 @@ public class OrderController {
|
||||
|
||||
System.out.println("orderXmlVO = " + orderXmlVO);
|
||||
}
|
||||
// orderService.importExcelData(orderDO, list, index);
|
||||
orderService.importExcelData(orderDO, list, index);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -411,8 +412,8 @@ public class OrderController {
|
||||
@GetMapping("/getOrderWarn")
|
||||
@Operation(summary = "生产单超期/到期告警 (工作台)")
|
||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||
public CommonResult<Map<String, List<OrderOverdueRespVO>>> getOrderOverdue() {
|
||||
return success(orderService.getOrderWarn());
|
||||
public CommonResult<Map<String, PageResult<OrderOverdueRespVO>>> getOrderOverdue(@Valid PageParam pageParam) {
|
||||
return success(orderService.getOrderWarn(pageParam));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -148,10 +148,10 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
IPage<OrderGoodsResp> selectOrderIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
// 生产单预警统计
|
||||
List<OrderOverdueRespVO> selectOrderNear(@Param("today") LocalDateTime today, @Param("orderDate") LocalDateTime orderDate, @Param("organId") Long organId);
|
||||
IPage<OrderOverdueRespVO> selectOrderNear(@Param("orderDate") LocalDate orderDate, @Param("organId") Long organId, @Param("page") IPage<OrderOverdueRespVO> page);
|
||||
|
||||
// 生产单逾期统计
|
||||
List<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDateTime today, @Param("organId") Long organId);
|
||||
IPage<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDate today, @Param("organId") Long organId, @Param("page") IPage<OrderOverdueRespVO> page);
|
||||
|
||||
/**
|
||||
* 生产单数量统计
|
||||
|
||||
+5
-3
@@ -46,11 +46,12 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
}
|
||||
|
||||
// 单个修改删除状态 by id
|
||||
default int updateDeletedById(Long id, Integer deleted, Long organId) {
|
||||
default int updateDeletedById(Collection<Long> ids, Integer deleted, Long organId, Long orderId) {
|
||||
return update(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
.set(OrderBodyDO::getDeleted, deleted)
|
||||
.eq(OrderBodyDO::getId, id)
|
||||
.eq(OrderBodyDO::getOrganId, organId));
|
||||
.in(OrderBodyDO::getId, ids)
|
||||
.eq(OrderBodyDO::getOrganId, organId)
|
||||
.eq(OrderBodyDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
default int deletedByOrderId(Long orderId, Long organId) {
|
||||
@@ -118,6 +119,7 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
.eq(OrderBodyDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderBodyDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderBodyDO>()
|
||||
|
||||
+18
-5
@@ -36,11 +36,15 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
}
|
||||
|
||||
// 单个修改删除状态 by bodyId
|
||||
default int updateDeletedById(Long id, Integer deleted, Long organId) {
|
||||
return update(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
.set(OrderGroupDO::getDeleted, deleted)
|
||||
.eq(OrderGroupDO::getBodyId, id)
|
||||
.eq(OrderGroupDO::getOrganId, organId));
|
||||
default int updateDeletedById(Collection<Long> bodyIds, Integer deleted, Long organId, Long orderId) {
|
||||
if (bodyIds != null && !bodyIds.isEmpty()) {
|
||||
return update(new LambdaUpdateWrapper<OrderGroupDO>()
|
||||
.set(OrderGroupDO::getDeleted, deleted)
|
||||
.in(OrderGroupDO::getBodyId, bodyIds)
|
||||
.eq(OrderGroupDO::getOrganId, organId)
|
||||
.eq(OrderGroupDO::getOrderId, orderId));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
default int deletedById(Long id, Long organId) {
|
||||
@@ -87,12 +91,21 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
.eq(OrderGroupDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderGroupDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
default int deleteBatch(Collection<?> orderId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderGroupDO>()
|
||||
.in(OrderGroupDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
// 批量查询
|
||||
default List<Long> selectListByBodyId(Collection<Long> bodyIds, Long orderId, Long organId, Integer deleted) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderGroupDO>()
|
||||
.eq(OrderGroupDO::getOrderId, orderId)
|
||||
.eq(OrderGroupDO::getOrganId, organId)
|
||||
.in(OrderGroupDO::getBodyId, bodyIds)).stream().map(OrderGroupDO::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
List<OrderGroupRespVO> selectTestSQL(@Param("filed") String filed, @Param("field2") String field2 ,@Param("groupIds") List<Long> groupIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
|
||||
|
||||
List<PrintOrderPartsRespVO> selectPartList( @Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
List<Long> selectPartsIdListByBodyId(@Param("bodyId") Long bodyId, @Param("organId") Long organId);
|
||||
List<Long> selectPartsIdListByBodyId(@Param("bodyIds") Collection<Long> bodyIds, @Param("organId") Long organId, @Param("orderId") Long orderId);
|
||||
|
||||
int countPartsByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
|
||||
+3
-4
@@ -110,7 +110,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
return update(wrapper);
|
||||
}
|
||||
|
||||
void updateDeletedById(@Param("plateIds") List<Long> plateIds, @Param("deleted") Integer deleted, @Param("organId") Long organId);
|
||||
void updateDeletedById(@Param("plateIds") List<Long> plateIds, @Param("deleted") Integer deleted, @Param("organId") Long organId, @Param("orderId") Long orderId);
|
||||
|
||||
int countPlateByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
@@ -150,9 +150,8 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
}
|
||||
|
||||
// 房间id查小板的开料状态
|
||||
List<Long> selectPlateTypeByRoomId(@Param("orderId") Long orderId, @Param("roomId") Set<Long> roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("organId") Long organId,
|
||||
@Param("deleted") Integer deleted);
|
||||
List<Long> selectPlateTypeByRoomId(@Param("orderId") Long orderId, @Param("bodyIds") Collection<Long> bodyIds,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
// 根据生产单id删除
|
||||
default int deleteByOrderId(Long orderId, Long organId) {
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.*;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
|
||||
@@ -143,7 +144,7 @@ public interface OrderService {
|
||||
/**
|
||||
* 生产单超期告警分析统计
|
||||
*/
|
||||
Map<String,List<OrderOverdueRespVO>> getOrderWarn();
|
||||
Map<String,PageResult<OrderOverdueRespVO>> getOrderWarn(PageParam pageParam);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+63
-54
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
@@ -63,6 +64,7 @@ import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -153,6 +155,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
validateCustomOrderNoExists(updateReqVO.getCustomOrderNo(), updateReqVO.getId());
|
||||
|
||||
// 发货日期校验
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate orderDate = LocalDate.from(updateReqVO.getOrderDate());
|
||||
LocalDate deliveryDate = LocalDate.from(updateReqVO.getDeliveryDate());
|
||||
if (deliveryDate.isBefore(orderDate)) {
|
||||
// 将 deliveryDate 设置为 orderDate 后的第 30 天
|
||||
deliveryDate = orderDate.plusMonths(1);
|
||||
}
|
||||
updateReqVO.setDeliveryDate(deliveryDate.atStartOfDay());
|
||||
// 更新
|
||||
OrderDO updateObj = BeanUtils.toBean(updateReqVO, OrderDO.class);
|
||||
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")) {
|
||||
@@ -233,68 +243,69 @@ public class OrderServiceImpl implements OrderService {
|
||||
public void updateBodyDeletedByOrderId(Long orderId, Set<Long> roomIds, Long bodyId, Integer status) { // 要删除传1,还原传0
|
||||
validateOrderStatus(orderId, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
|
||||
List<Long> plateDOList;
|
||||
List<Long> bodyIds = null;
|
||||
List<Long> bodyIds = new ArrayList<>();
|
||||
Integer index = status == 1 ? 0 : 1;
|
||||
|
||||
if (roomIds != null && roomIds.size() != 0) {
|
||||
// 查询当前房间下的所有板材
|
||||
plateDOList = plateMapper.selectPlateTypeByRoomId(orderId, roomIds, null, getUserOrganId(), index);
|
||||
bodyIds = orderBodyMapper.selectBodyIdByRoomId(orderId, roomIds, getUserOrganId(), index);
|
||||
} else if (bodyId != null && bodyId != 0) {
|
||||
// 校验柜体存在
|
||||
validateOrderBodyExists(orderId, bodyId, getUserOrganId(), index);
|
||||
// 查询当前房间下的所有板材
|
||||
plateDOList = plateMapper.selectPlateTypeByRoomId(orderId, null, bodyId, getUserOrganId(), index);
|
||||
bodyIds = new ArrayList<>();
|
||||
bodyIds.add(bodyId);
|
||||
} else {
|
||||
plateDOList = null;
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(bodyIds)) {
|
||||
bodyIds.forEach(id -> {
|
||||
// 逻辑删除
|
||||
orderBodyMapper.updateDeletedById(id, status, getUserOrganId());// 柜体
|
||||
orderGroupMapper.updateDeletedById(id, status, getUserOrganId());// 加工组
|
||||
if (bodyIds.size() != 0){
|
||||
List<Long> plateDOList = plateMapper.selectPlateTypeByRoomId(orderId, bodyIds, getUserOrganId(), index);
|
||||
// List<Long> groupIds = orderGroupMapper.selectListByBodyId(bodyIds, orderId, getUserOrganId(), index);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(plateDOList) ){
|
||||
// (删除小板) 小板变为删除状态
|
||||
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId());
|
||||
// 删除大板
|
||||
List<PlateDO> goodsIdList = plateMapper.selectPlateNum(orderId, getUserOrganId());
|
||||
Map<Long, List<PlateDO>> goodsIdMap = goodsIdList.stream()
|
||||
.collect(Collectors.groupingBy(PlateDO::getGoodsId));
|
||||
orderBodyMapper.updateDeletedById(bodyIds, status, getUserOrganId(), orderId);// 柜体
|
||||
orderGroupMapper.updateDeletedById(bodyIds, status, getUserOrganId(), orderId);// 加工组
|
||||
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId(), orderId);// 删小板
|
||||
// 删除大板
|
||||
List<PlateDO> goodsIdList = plateMapper.selectPlateNum(orderId, getUserOrganId());
|
||||
Map<Long, List<PlateDO>> goodsIdMap = goodsIdList.stream()
|
||||
.collect(Collectors.groupingBy(PlateDO::getGoodsId));
|
||||
|
||||
List<Long> goodsIdDeleted = new ArrayList<>();
|
||||
List<Long> goodsIdDeleted = new ArrayList<>();
|
||||
|
||||
goodsIdMap.forEach((goodsId, plates) -> {
|
||||
if (plates.isEmpty()) {
|
||||
goodsIdDeleted.add(goodsId);
|
||||
return;
|
||||
}
|
||||
boolean allDeleted = true;
|
||||
for (PlateDO plateDO : plates) {
|
||||
if (status == 1) {
|
||||
goodsIdMap.forEach((k, v) -> {
|
||||
boolean allDeleted = true;
|
||||
for (PlateDO plateDO : v) {
|
||||
if (!plateDO.getDeleted()) {
|
||||
allDeleted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allDeleted) {
|
||||
goodsIdDeleted.add(k);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, status, getUserOrganId());
|
||||
if (!plateDO.getDeleted()) {
|
||||
allDeleted = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (plateDO.getDeleted()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(id, getUserOrganId()); // 配件
|
||||
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
|
||||
if (allDeleted) {
|
||||
goodsIdDeleted.add(goodsId);
|
||||
}
|
||||
});
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, status, getUserOrganId());
|
||||
}
|
||||
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(bodyIds, getUserOrganId(), orderId); // 配件
|
||||
if (partsList != null && partsList.size() != 0){
|
||||
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 生产单柜体数量判断
|
||||
if (orderBodyMapper.selectCountByOrderId(orderId, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus()) == 0) {
|
||||
orderMapper.updateOrderStatus(orderId, OrderStatusEnum.EMPTY.getStatus(), getUserOrganId());
|
||||
}else {
|
||||
orderMapper.updateOrderStatus(orderId, OrderStatusEnum.NEW_ORDER.getStatus(), getUserOrganId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -552,20 +563,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<OrderOverdueRespVO>> getOrderWarn() {
|
||||
Map<String, List<OrderOverdueRespVO>> map = new HashMap<>();
|
||||
|
||||
LocalDateTime yesterdayDay = LocalDateTime.now().minus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59);
|
||||
|
||||
LocalDateTime today = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
||||
LocalDateTime tomorrowDay = LocalDateTime.now().plus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59);
|
||||
public Map<String, PageResult<OrderOverdueRespVO>> getOrderWarn(PageParam pageParam) {
|
||||
Map<String, PageResult<OrderOverdueRespVO>> map = new HashMap<>();
|
||||
|
||||
LocalDate todayDate = LocalDate.now();
|
||||
LocalDate tomorrow = LocalDate.now().plus(1, ChronoUnit.DAYS);
|
||||
PageDTO<OrderOverdueRespVO> page = new PageDTO<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||
// 查询预警单
|
||||
List<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(today, tomorrowDay, OrganContextHolder.getOrganId());
|
||||
map.put("orderNearVOS", orderNearVOS);
|
||||
IPage<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(tomorrow, OrganContextHolder.getOrganId(), page);
|
||||
map.put("orderNearVOS", new PageResult<OrderOverdueRespVO>(orderNearVOS.getRecords(), orderNearVOS.getTotal()));
|
||||
// 查询超时单
|
||||
List<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(yesterdayDay, OrganContextHolder.getOrganId());
|
||||
map.put("orderOverdueVOS", orderOverdueVOS);
|
||||
IPage<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(todayDate, OrganContextHolder.getOrganId(), page);
|
||||
map.put("orderOverdueVOS", new PageResult<OrderOverdueRespVO>(orderOverdueVOS.getRecords(), orderOverdueVOS.getTotal()));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -797,7 +806,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 判断生产单状态是否符合(开料之前状态判断)
|
||||
private void validateOrderStatus(Long orderId, Long organId, Integer status) {
|
||||
// 校验存在
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId, status);
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId);
|
||||
if (orderDO == null)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
// 状态排除
|
||||
|
||||
+2
-1
@@ -2,11 +2,12 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
@FeignClient(url = "https://chenfeng.tech:7779", name = "apiOrderService")
|
||||
@FeignClient(url = "https://chenfeng.tech:7779", name = "apiOrderService", configuration = FeignClientsConfiguration.class )
|
||||
public interface ApiDataProduction {
|
||||
|
||||
// 登陆token
|
||||
|
||||
+2
-2
@@ -741,8 +741,8 @@ public class ApiTypeRealize {
|
||||
Map<Long, PlateDetail> plateDetails = new HashMap<>();
|
||||
if (dataPlates.getJSONObject("value") != null){
|
||||
// 获取 Orders 字段对应的数组
|
||||
JSONArray ordersArray = dataPlates.getJSONArray("Orders");
|
||||
// System.err.println(dataPlates);
|
||||
JSONArray ordersArray = dataPlates.getJSONObject("value").getJSONArray("Orders");
|
||||
System.err.println(dataPlates);
|
||||
if (ordersArray != null && !ordersArray.isEmpty()) {
|
||||
for (int i = 0; i < ordersArray.size(); i++) {
|
||||
JSONObject order = ordersArray.getJSONObject(i);
|
||||
|
||||
+4
-15
@@ -189,18 +189,12 @@
|
||||
o.dealer_phone_number,
|
||||
o.salesman,
|
||||
o.splitter,
|
||||
o.remark,
|
||||
CONCAT(
|
||||
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date ) / (24 * 60 * 60)), 2, '0'), '天 ',
|
||||
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
|
||||
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
|
||||
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
|
||||
) AS becomeDue
|
||||
o.remark
|
||||
from orders o
|
||||
where o.organ_id = #{organId}
|
||||
and o.deleted = 0
|
||||
and o.status != 4
|
||||
and o.delivery_date between #{today} and #{orderDate}
|
||||
and o.delivery_date = #{orderDate}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
||||
@@ -224,17 +218,12 @@
|
||||
o.salesman,
|
||||
o.splitter,
|
||||
o.remark,
|
||||
CONCAT(
|
||||
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}) / (24 * 60 * 60)), 2, '0'), '天 ',
|
||||
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
|
||||
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
|
||||
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, o.delivery_date, #{today}), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
|
||||
) AS beOverdue
|
||||
LPAD(FLOOR(TIMESTAMPDIFF(DAY, o.delivery_date, #{today})), 2, '0') AS beOverdue
|
||||
from orders o
|
||||
where o.organ_id = #{organId}
|
||||
and o.deleted = 0
|
||||
and o.status != 4
|
||||
and #{today} > DATE(o.delivery_date)
|
||||
and #{today} >= DATE(o.delivery_date)
|
||||
</select>
|
||||
|
||||
<select id="selectOrderCountProducePeriod" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO">
|
||||
|
||||
+12
-5
@@ -69,10 +69,13 @@
|
||||
<update id="updateDeletedById">
|
||||
UPDATE order_parts
|
||||
SET deleted = #{deleted}
|
||||
WHERE id IN
|
||||
<foreach collection="partsIds" item="partsId" open="(" separator="," close=")">
|
||||
#{partsId}
|
||||
</foreach>AND organ_id = #{organId}
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="partsIds" item="partsId" open="(" separator="," close=")">
|
||||
#{partsId}
|
||||
</foreach>
|
||||
AND
|
||||
organ_id = #{organId}
|
||||
</update>
|
||||
<delete id="deletedById">
|
||||
DELETE FROM order_parts
|
||||
@@ -112,7 +115,11 @@
|
||||
|
||||
<select id="selectPartsIdListByBodyId" resultType="java.lang.Long">
|
||||
SELECT parts_id FROM order_item
|
||||
WHERE body_id = #{bodyId} AND organ_id = #{organId}
|
||||
WHERE body_id IN
|
||||
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
|
||||
#{bodyId}
|
||||
</foreach>
|
||||
AND organ_id = #{organId} and order_id = #{orderId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+10
-17
@@ -401,10 +401,12 @@
|
||||
UPDATE order_plate
|
||||
SET deleted = #{deleted}
|
||||
WHERE id IN
|
||||
<foreach item="plateId" collection="plateIds" open="(" separator="," close=")">
|
||||
#{plateId}
|
||||
</foreach>
|
||||
AND organ_id = #{organId}
|
||||
<if test="plateIds != null and plateIds.size() > 0">
|
||||
<foreach item="plateId" collection="plateIds" open="(" separator="," close=")">
|
||||
#{plateId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND organ_id = #{organId} and order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
<delete id="deletedById">
|
||||
@@ -685,23 +687,14 @@
|
||||
<select id="selectPlateTypeByRoomId" resultType="java.lang.Long">
|
||||
SELECT p.id
|
||||
FROM order_plate p
|
||||
LEFT JOIN order_item i ON p.id = i.plate_id
|
||||
LEFT JOIN order_item i ON p.id = i.plate_id
|
||||
WHERE i.organ_id = #{organId} AND i.order_id = #{orderId} AND p.deleted = #{deleted}
|
||||
<if test="roomId != null and roomId.size() > 0">
|
||||
AND i.room_id IN
|
||||
<foreach item="roomIdItem" collection="roomId" open="(" separator="," close=")">
|
||||
<if test="bodyIds != null and bodyIds.size() > 0">
|
||||
AND i.body_id IN
|
||||
<foreach item="roomIdItem" collection="bodyIds" open="(" separator="," close=")">
|
||||
#{roomIdItem}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="bodyId != null">
|
||||
AND i.body_id = #{bodyId}
|
||||
</if>
|
||||
GROUP BY
|
||||
g.goods_id
|
||||
HAVING
|
||||
SUM(a.area) > 0
|
||||
ORDER BY
|
||||
orderArea DESC;
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+2
@@ -17,6 +17,8 @@ public final class ErrorCodeConstants {
|
||||
// ========== UREPORT datasource模块 1-003-002-000 ==========
|
||||
public static final ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在");
|
||||
public static final ErrorCode DATASOURCE_CONNECT_FAIL = new ErrorCode(1_003_002_002, "报表数据源连接失败");
|
||||
public static final ErrorCode DATASOURCE_SPRINGBEAN_GET_FAIL = new ErrorCode(1_003_002_003, "无法获取springbean【{}】");
|
||||
public static final ErrorCode DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL = new ErrorCode(1_003_002_004, "获取springbean方法列表失败,请检查】");
|
||||
|
||||
|
||||
// ========== UREPORT dataset模块 1-003-003-000 ==========
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ public class ReportDatasetController {
|
||||
|
||||
@DeleteMapping("/dataset/{id}")
|
||||
@Operation(summary = "删除报表数据集")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Parameter(name = "id", description = "数据集id", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('report:dataset:delete')")
|
||||
public CommonResult<Boolean> deleteDataset(@PathVariable("id") Long id) {
|
||||
datasetService.deleteDataset(id);
|
||||
@@ -61,7 +61,7 @@ public class ReportDatasetController {
|
||||
|
||||
@GetMapping("/dataset/{id}")
|
||||
@Operation(summary = "获得报表数据集")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "数据集id", required = true, example = "1")
|
||||
// @PreAuthorize("@ss.hasPermission('report:dataset:query')")
|
||||
public CommonResult<ReportDatasetRespVO> getDataset(@PathVariable("id") Long id) {
|
||||
ReportDatasetDO dataset = datasetService.getDataset(id);
|
||||
|
||||
+13
-3
@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -69,7 +70,7 @@ public class ReportDatasourceController {
|
||||
|
||||
@DeleteMapping("/datasource/{id}")
|
||||
@Operation(summary = "删除报表数据源")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "数据源id", required = true, example = "1")
|
||||
// @PreAuthorize("@ss.hasPermission('report:datasource:delete')")
|
||||
public CommonResult<Boolean> deleteDatasource(@PathVariable("id") Long id) {
|
||||
datasourceService.deleteDatasource(id);
|
||||
@@ -78,7 +79,7 @@ public class ReportDatasourceController {
|
||||
|
||||
@GetMapping("/datasource/{id}")
|
||||
@Operation(summary = "获取报表数据源")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "数据源id", required = true, example = "1")
|
||||
// @PreAuthorize("@ss.hasPermission('report:datasource:query')")
|
||||
public CommonResult<ReportDatasourceRespVO> getDatasource(@PathVariable("id") Long id) {
|
||||
ReportDatasourceDO datasource = datasourceService.getDatasource(id);
|
||||
@@ -88,6 +89,7 @@ public class ReportDatasourceController {
|
||||
@GetMapping("/{templateId}/datasources")
|
||||
@Operation(summary = "获取报表模板下的报表数据源")
|
||||
// @PreAuthorize("@ss.hasPermission('report:datasource:query')")
|
||||
@Parameter(name = "templateId", description = "模版id", required = true)
|
||||
public CommonResult<List<ReportDatasourceRespVO>> getDatasourcePage(@PathVariable(value = "templateId") Long templateId) {
|
||||
return success(BeanUtils.toBean(datasourceService.getTemplateDatasourceList(ReportDatasourceReqVO.builder().templateId(templateId).build()), ReportDatasourceRespVO.class));
|
||||
}
|
||||
@@ -99,10 +101,18 @@ public class ReportDatasourceController {
|
||||
return success(datasourceService.getBeanDatasourceList());
|
||||
}
|
||||
|
||||
@GetMapping("/springbean/result/clazz")
|
||||
@Operation(summary = "获取springbean数据源返回对象")
|
||||
@Parameter(name = "clazz", description = "返回对象类路径全名不能为空", required = true)
|
||||
public List<Field> springbeanFieldList(@RequestParam(value = "clazz") @NotEmpty(message = "类路径全名不能为空") String clazz) {
|
||||
return datasourceService.getSpringBeanResultFieldList(clazz);
|
||||
}
|
||||
|
||||
@GetMapping("/datasource/bean/methods")
|
||||
@Operation(summary = "获取springbean数据源方法类表")
|
||||
// @PreAuthorize("@ss.hasPermission('report:datasource:query')")
|
||||
public CommonResult<List<String>> getBeanDatasourceList(@RequestParam(value = "beanId") String beanId) {
|
||||
@Parameter(name = "beanId", description = "springbeanId", required = true)
|
||||
public CommonResult<List<String>> getBeanDatasourceList(@RequestParam(value = "beanId") @NotEmpty(message = "beanId不能为空") String beanId) {
|
||||
return success(datasourceService.loadBeanMethods(beanId));
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -39,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -79,7 +80,7 @@ public class ReportTemplateController {
|
||||
|
||||
@DeleteMapping("/template/{id}")
|
||||
@Operation(summary = "删除报表模板信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Parameter(name = "id", description = "模板id", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('report:template:delete')")
|
||||
public CommonResult<Boolean> deleteReportTemplate(@PathVariable("id") Long id) {
|
||||
templateService.deleteReportTemplate(id);
|
||||
@@ -88,7 +89,7 @@ public class ReportTemplateController {
|
||||
|
||||
@GetMapping("/template/{id}")
|
||||
@Operation(summary = "获取报表模板信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "模板id", required = true, example = "1")
|
||||
// @PreAuthorize("@ss.hasPermission('report:template:query')")
|
||||
public CommonResult<ReportDefinitionWrapper> getReportTemplate(@PathVariable("id") Long id) {
|
||||
return success(templateService.getReportTemplateDefinition(id));
|
||||
@@ -141,7 +142,7 @@ public class ReportTemplateController {
|
||||
@GetMapping("/scriptValidation")
|
||||
@Operation(summary = "校验表达式")
|
||||
@Parameter(name = "content", description = "表达式", required = true)
|
||||
public List<ErrorInfo> scriptValidation(@Param("content") String content) {
|
||||
public List<ErrorInfo> scriptValidation(@Param("content") @NotEmpty(message = "表达式不能为空") String content) {
|
||||
content = StringUtils.decode(content);
|
||||
ANTLRInputStream antlrInputStream = new ANTLRInputStream(content);
|
||||
ReportParserLexer lexer = new ReportParserLexer(antlrInputStream);
|
||||
@@ -163,7 +164,7 @@ public class ReportTemplateController {
|
||||
@GetMapping("/parseDataSet")
|
||||
@Operation(summary = "解析表达式中的数据集")
|
||||
@Parameter(name = "expr", description = "表达式", required = true)
|
||||
public Map<String, String> parseDatasetName(@Param("expr") String expr) {
|
||||
public Map<String, String> parseDatasetName(@Param("expr") @NotEmpty(message = "表达式不能为空") String expr) {
|
||||
ANTLRInputStream antlrInputStream = new ANTLRInputStream(expr);
|
||||
ReportParserLexer lexer = new ReportParserLexer(antlrInputStream);
|
||||
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.report.framework.ureport.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/8/30 11:21
|
||||
*/
|
||||
@Component
|
||||
@Data
|
||||
public class MockSpringBeanDatasourceResult {
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
}
|
||||
+7
-1
@@ -78,5 +78,11 @@ public interface ReportDatasourceService {
|
||||
*/
|
||||
List<Field> getTableFields(PreviewParams previewParams);
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据源
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
List<Field> getSpringBeanResultFieldList(String clazz);
|
||||
}
|
||||
|
||||
+58
-21
@@ -1,9 +1,11 @@
|
||||
package com.cf.imes.module.report.service.datasource;
|
||||
|
||||
import cn.hutool.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlInjectionUtils;
|
||||
import com.bstek.common.exception.ReportDesignException;
|
||||
import com.bstek.common.utils.MultipleJdbcTemplate;
|
||||
import com.bstek.datasource.bean.DataSourceInfo;
|
||||
import com.bstek.datasource.bean.PreviewParams;
|
||||
@@ -12,6 +14,7 @@ import com.bstek.ureport.definition.dataset.Parameter;
|
||||
import com.bstek.ureport.definition.dataset.SqlDatasetDefinition;
|
||||
import com.bstek.ureport.utils.ProcedureUtils;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.report.controller.admin.dataset.vo.ReportDatasetReqVO;
|
||||
@@ -27,6 +30,7 @@ import com.cf.imes.module.report.service.dataset.ReportDatasetService;
|
||||
import com.cf.imes.module.report.util.SqlInjectionUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
@@ -37,6 +41,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSetMetaData;
|
||||
@@ -51,6 +56,8 @@ import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_ILL
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_INJECTION_RISK;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_REQUIRED;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_SPRINGBEAN_GET_FAIL;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL;
|
||||
|
||||
/**
|
||||
* 报表数据源 Service 实现类
|
||||
@@ -156,29 +163,39 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
||||
|
||||
@Override
|
||||
public List<String> loadBeanMethods(String beanId) {
|
||||
Object obj = applicationContext.getBean(beanId);
|
||||
Class<?> clazz = obj.getClass();
|
||||
Method[] methods = clazz.getMethods();
|
||||
Object obj;
|
||||
List<String> result = new ArrayList<String>();
|
||||
// ureport的springbean方法必须满足(String dsName, String datasetName, Map<String, Object> parameters)
|
||||
for (Method method : methods) {
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
if (types.length != 3) {
|
||||
continue;
|
||||
try {
|
||||
obj = applicationContext.getBean(beanId);
|
||||
Class<?> clazz = obj.getClass();
|
||||
Method[] methods = clazz.getMethods();
|
||||
|
||||
// ureport的springbean方法必须满足(String dsName, String datasetName, Map<String, Object> parameters)
|
||||
for (Method method : methods) {
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
if (types.length != 3) {
|
||||
continue;
|
||||
}
|
||||
Class<?> typeClass1 = types[0];
|
||||
Class<?> typeClass2 = types[1];
|
||||
Class<?> typeClass3 = types[2];
|
||||
if (!String.class.isAssignableFrom(typeClass1)) {
|
||||
continue;
|
||||
}
|
||||
if (!String.class.isAssignableFrom(typeClass2)) {
|
||||
continue;
|
||||
}
|
||||
if (!Map.class.isAssignableFrom(typeClass3)) {
|
||||
continue;
|
||||
}
|
||||
result.add(method.getName());
|
||||
}
|
||||
Class<?> typeClass1 = types[0];
|
||||
Class<?> typeClass2 = types[1];
|
||||
Class<?> typeClass3 = types[2];
|
||||
if (!String.class.isAssignableFrom(typeClass1)) {
|
||||
continue;
|
||||
}
|
||||
if (!String.class.isAssignableFrom(typeClass2)) {
|
||||
continue;
|
||||
}
|
||||
if (!Map.class.isAssignableFrom(typeClass3)) {
|
||||
continue;
|
||||
}
|
||||
result.add(method.getName());
|
||||
} catch (BeansException e) {
|
||||
log.error("[ReportDatasourceService][loadBeanMethods]获取bean失败", e);
|
||||
throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_GET_FAIL, beanId);
|
||||
} catch (Exception e) {
|
||||
log.error("[ReportDatasourceService][loadBeanMethods]方法列表获取异常", e);
|
||||
throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -241,6 +258,26 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Field> getSpringBeanResultFieldList(String clazz) {
|
||||
List<Field> result = new ArrayList<Field>();
|
||||
try {
|
||||
Class<?> targetClass = Class.forName(clazz);
|
||||
PropertyDescriptor[] propertyDescriptors = BeanUtil.getPropertyDescriptors(targetClass);
|
||||
for (PropertyDescriptor pd : propertyDescriptors) {
|
||||
String name = pd.getName();
|
||||
if ("class".equals(name)) {
|
||||
continue;
|
||||
}
|
||||
result.add(new Field(name));
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new ReportDesignException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据源下的数据集
|
||||
*
|
||||
|
||||
BIN
Binary file not shown.
+3
-6
@@ -46,18 +46,15 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用");
|
||||
ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "创建用户失败,原因:超过组织最大组织配额({})!");
|
||||
ErrorCode USER_ME_ERROR = new ErrorCode(1_002_003_009, "不允许操作用户自身");
|
||||
|
||||
ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_6_CHARACTERS = new ErrorCode(1_002_003_010, "密码长度必须至少为6个字符");
|
||||
|
||||
ErrorCode THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_LETTER = new ErrorCode(1_002_003_011, "密码必须包含至少一个字母");
|
||||
|
||||
ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS = new ErrorCode(1_002_003_010, "密码长度必须至少为8个字符");
|
||||
ErrorCode THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_LOWER_LETTER = new ErrorCode(1_002_003_011, "密码必须包含至少一个小写字母");
|
||||
ErrorCode THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_NUMBER = new ErrorCode(1_002_003_012, "密码必须包含至少一个数字");
|
||||
|
||||
ErrorCode PASSWORDS_CAN_ONLY_CONTAIN_LETTERS_AND_NUMBERS = new ErrorCode(1_002_003_013, "密码只能包含字母和数字");
|
||||
ErrorCode INSUFFICIENT_PERMISSIONS = new ErrorCode(1_002_003_014, "当前用户权限不足,无法修改开料状态");
|
||||
ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_015,"存在【{}】重复用户,请联系系统管理员");
|
||||
ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_016, "不允许操作用户自身状态");
|
||||
|
||||
ErrorCode THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_UPPER_LETTER = new ErrorCode(1_002_003_017, "密码必须包含至少一个大写字母");
|
||||
|
||||
// ========== 部门模块 1-002-004-000 ==========
|
||||
ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门");
|
||||
|
||||
-2
@@ -2,14 +2,12 @@ package com.cf.imes.module.system;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@RefreshScope
|
||||
public class SystemServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
+10
@@ -13,6 +13,7 @@ import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -172,4 +173,13 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
*/
|
||||
@Select("SELECT username FROM system_users WHERE id = #{id} FOR UPDATE")
|
||||
AdminUserDO selectByIdForUpdate(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据id物理删除user
|
||||
*
|
||||
* @param id
|
||||
* @return 改动数量
|
||||
*/
|
||||
@Delete("DELETE FROM system_users WHERE id = #{id}")
|
||||
int physicalDeleteById(@Param("id") Long id);
|
||||
}
|
||||
|
||||
+2
@@ -41,6 +41,7 @@ import com.xingyuv.captcha.service.CaptchaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -58,6 +59,7 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_DATA_CODE
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RefreshScope
|
||||
public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
|
||||
@Resource
|
||||
|
||||
+19
-12
@@ -114,8 +114,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
|
||||
// 定义密码校验的正则表达式
|
||||
private static final String LENGTH_PATTERN = ".{6,}";
|
||||
private static final String LETTER_PATTERN = ".*[A-Za-z].*";
|
||||
private static final String LENGTH_PATTERN = ".{8,}";
|
||||
private static final String UPPER_LETTER_PATTERN = ".*[A-Z].*";
|
||||
private static final String LOWER_LETTER_PATTERN = ".*[a-z].*";
|
||||
private static final String DIGIT_PATTERN = ".*\\d.*";
|
||||
private static final String VALID_CHAR_PATTERN = "^[A-Za-z\\d]+$";
|
||||
|
||||
@@ -320,12 +321,14 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
checkCurrentWhenOperate(id);
|
||||
// 校验用户存在
|
||||
validateUserExists(id);
|
||||
// 删除用户
|
||||
userMapper.deleteById(id);
|
||||
// 删除用户关联数据
|
||||
permissionService.processUserDeleted(id);
|
||||
// 删除用户岗位
|
||||
userPostMapper.deleteByUserId(id);
|
||||
// 物理删除用户
|
||||
int deleteNum = userMapper.physicalDeleteById(id);
|
||||
if (deleteNum > 0) {
|
||||
// 删除用户关联数据
|
||||
permissionService.processUserDeleted(id);
|
||||
// 删除用户岗位
|
||||
userPostMapper.deleteByUserId(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -463,11 +466,15 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
// 检查密码长度
|
||||
if (!Pattern.matches(LENGTH_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_6_CHARACTERS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否包含字母
|
||||
if (!Pattern.matches(LETTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_LETTER);
|
||||
// 检查是否包含大写字母
|
||||
if (!Pattern.matches(UPPER_LETTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_UPPER_LETTER);
|
||||
}
|
||||
// 检查是否包含小写字母
|
||||
if (!Pattern.matches(LOWER_LETTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_MUST_CONTAIN_AT_LEAST_ONE_LOWER_LETTER);
|
||||
}
|
||||
// 检查是否包含数字
|
||||
if (!Pattern.matches(DIGIT_PATTERN, password)) {
|
||||
|
||||
Reference in New Issue
Block a user