mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
package com.cf.imes.framework.common.core;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Key Value 的键值对
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class KeyValue<K, V> implements Serializable {
|
||||
|
||||
private K key;
|
||||
private V value;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.cf.imes.framework.common.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum OrderItemTypeEnum {
|
||||
|
||||
PLATE(1, "板材"),
|
||||
PARTS(2, "五金/配件"),
|
||||
OTHER(3, "其他"),
|
||||
QUOTATIONACCESSORIES(4, "报价配件");
|
||||
|
||||
private final Integer type;
|
||||
private String description;
|
||||
|
||||
public boolean equals(Integer status) {
|
||||
return this.type .equals(status) ;
|
||||
}
|
||||
|
||||
public boolean equals(OrderItemTypeEnum enableStatusEnum) {
|
||||
return enableStatusEnum != null && enableStatusEnum.type .equals(this.getType()) ;
|
||||
}
|
||||
|
||||
}
|
||||
+5
-2
@@ -33,8 +33,11 @@ public interface GlobalErrorCodeConstants {
|
||||
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常,请联系客服处理");
|
||||
ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
|
||||
ErrorCode ERROR_CONFIGURATION = new ErrorCode(502, "错误的配置项");
|
||||
ErrorCode ES_ERROR_UPDATE = new ErrorCode(503, "ES文档更新失败");
|
||||
ErrorCode ES_ERROR_DELETE = new ErrorCode(504, "ES文档删除失败");
|
||||
|
||||
// ES文档更新失败
|
||||
ErrorCode ES_ERROR_UPDATE = new ErrorCode(503, "数据异常,请勿点击过快,请稍等再试");
|
||||
// ES文档删除失败
|
||||
ErrorCode ES_ERROR_DELETE = new ErrorCode(504, "数据异常,请勿点击过快,请稍等再试");
|
||||
ErrorCode DATA_EXCEPTION_ERROR = new ErrorCode(505, "数据异常,请联系客服处理");
|
||||
|
||||
// ========== 自定义错误段 ==========
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.common.util.collection;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MapUtils {
|
||||
consumer.accept(value);
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, V> convertMap(List<KeyValue<K, V>> keyValues) {
|
||||
public static <K, V> Map<K, V> convertMap(List<Pair<K, V>> keyValues) {
|
||||
Map<K, V> map = Maps.newLinkedHashMapWithExpectedSize(keyValues.size());
|
||||
keyValues.forEach(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
|
||||
return map;
|
||||
|
||||
+16
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.framework.common.util.date;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
@@ -132,4 +133,19 @@ public class LocalDateTimeUtils {
|
||||
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成起时间0点和止时间12点的区间
|
||||
*
|
||||
* @param dateSection
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime[] generateTimeSection(LocalDateTime[] dateSection) {
|
||||
if (ObjectUtil.isNotNull(dateSection) && dateSection.length == 2) {
|
||||
LocalDateTime[] result = new LocalDateTime[2];
|
||||
result[0] = dateSection[0].withHour(0).withMinute(0).withSecond(0);
|
||||
result[1] = dateSection[1].withHour(23).withMinute(59).withSecond(59);
|
||||
return result;
|
||||
}
|
||||
return dateSection;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.dict.core.util;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import com.cf.imes.framework.common.util.cache.CacheUtils;
|
||||
import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||
import com.cf.imes.module.system.api.dict.dto.DictDataRespDTO;
|
||||
@@ -27,12 +27,12 @@ public class DictFrameworkUtils {
|
||||
/**
|
||||
* 针对 {@link #getDictDataLabel(String, String)} 的缓存
|
||||
*/
|
||||
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> GET_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||
private static final LoadingCache<Pair<String, String>, DictDataRespDTO> GET_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
||||
new CacheLoader<>() {
|
||||
|
||||
@Override
|
||||
public DictDataRespDTO load(KeyValue<String, String> key) {
|
||||
public DictDataRespDTO load(Pair<String, String> key) {
|
||||
return ObjectUtil.defaultIfNull(dictDataApi.getDictData(key.getKey(), key.getValue()).getCheckedData(),
|
||||
DICT_DATA_NULL);
|
||||
}
|
||||
@@ -42,12 +42,12 @@ public class DictFrameworkUtils {
|
||||
/**
|
||||
* 针对 {@link #parseDictDataValue(String, String)} 的缓存
|
||||
*/
|
||||
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> PARSE_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||
private static final LoadingCache<Pair<String, String>, DictDataRespDTO> PARSE_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
||||
new CacheLoader<>() {
|
||||
|
||||
@Override
|
||||
public DictDataRespDTO load(KeyValue<String, String> key) {
|
||||
public DictDataRespDTO load(Pair<String, String> key) {
|
||||
return ObjectUtil.defaultIfNull(dictDataApi.parseDictData(key.getKey(), key.getValue()).getCheckedData(),
|
||||
DICT_DATA_NULL);
|
||||
}
|
||||
@@ -61,17 +61,17 @@ public class DictFrameworkUtils {
|
||||
|
||||
@SneakyThrows
|
||||
public static String getDictDataLabel(String dictType, Integer value) {
|
||||
return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, String.valueOf(value))).getLabel();
|
||||
return GET_DICT_DATA_CACHE.get(new Pair<>(dictType, String.valueOf(value))).getLabel();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static String getDictDataLabel(String dictType, String value) {
|
||||
return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, value)).getLabel();
|
||||
return GET_DICT_DATA_CACHE.get(new Pair<>(dictType, value)).getLabel();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static String parseDictDataValue(String dictType, String label) {
|
||||
return PARSE_DICT_DATA_CACHE.get(new KeyValue<>(dictType, label)).getValue();
|
||||
return PARSE_DICT_DATA_CACHE.get(new Pair<>(dictType, label)).getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -16,6 +16,8 @@ import org.junit.jupiter.api.Test;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
/**
|
||||
* {@link PayClientFactoryImpl} 的集成测试
|
||||
*
|
||||
@@ -43,6 +45,7 @@ public class PayClientFactoryImplIntegrationTest {
|
||||
Long channelId = RandomUtil.randomLong();
|
||||
payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config);
|
||||
PayClient client = payClientFactory.getPayClient(channelId);
|
||||
assertNotNull(client);
|
||||
// 发起支付
|
||||
PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
|
||||
// CommonResult<?> result = client.unifiedOrder(reqDTO);
|
||||
@@ -66,6 +69,7 @@ public class PayClientFactoryImplIntegrationTest {
|
||||
Long channelId = RandomUtil.randomLong();
|
||||
payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config);
|
||||
PayClient client = payClientFactory.getPayClient(channelId);
|
||||
assertNotNull(client);
|
||||
// 发起支付
|
||||
PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
|
||||
// CommonResult<?> result = client.unifiedOrder(reqDTO);
|
||||
@@ -89,6 +93,7 @@ public class PayClientFactoryImplIntegrationTest {
|
||||
Long channelId = RandomUtil.randomLong();
|
||||
payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config);
|
||||
PayClient client = payClientFactory.getPayClient(channelId);
|
||||
assertNotNull(client);
|
||||
// 发起支付
|
||||
PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
|
||||
reqDTO.setNotifyUrl("http://yunai.natapp1.cc/admin-api/pay/notify/callback/18"); // TODO @tina: 这里改成你的 natapp 回调地址
|
||||
@@ -113,6 +118,7 @@ public class PayClientFactoryImplIntegrationTest {
|
||||
Long channelId = RandomUtil.randomLong();
|
||||
payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config);
|
||||
PayClient client = payClientFactory.getPayClient(channelId);
|
||||
assertNotNull(client);
|
||||
// 发起支付
|
||||
PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
|
||||
// CommonResult<?> result = client.unifiedOrder(reqDTO);
|
||||
|
||||
+7
@@ -18,6 +18,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
/**
|
||||
* {@link WxBarPayClient} 的集成测试,用于快速调试微信条码支付
|
||||
*
|
||||
@@ -48,6 +50,8 @@ public class WxBarPayClientIntegrationTest {
|
||||
System.out.println(JsonUtils.toJsonPrettyString(request));
|
||||
WxPayMicropayResult response = client.micropay(request);
|
||||
System.out.println("========= response ==========");
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getTransactionId());
|
||||
System.out.println(JsonUtils.toJsonPrettyString(response));
|
||||
}
|
||||
|
||||
@@ -62,6 +66,7 @@ public class WxBarPayClientIntegrationTest {
|
||||
// 执行解析
|
||||
String xml = "<xml><return_code>SUCCESS</return_code><appid><![CDATA[wx62056c0d5e8db250]]></appid><mch_id><![CDATA[1545083881]]></mch_id><nonce_str><![CDATA[ed8f02c21d15635cede114a42d0525a0]]></nonce_str><req_info><![CDATA[bGp+wB9DAHjoOO9Nw1iSmmIFdN2zZDhsoRWZBYdf/8bcpjowr4T8i2qjLsbMtvKQeVC5kBZOL/Agal3be6UPwnoantil+L+ojZgvLch7dXFKs/AcoxIYcVYyGka+wmnRJfUmuFRBgzt++8HOFsmJz6e2brYv1EAz+93fP2AsJtRuw1FEzodcg8eXm52hbE0KhLNqC2OyNVkn8AbOOrwIxSYobg2jVbuJ4JllYbEGIQ/6kWzNbVmMKhGJGYBy/NbUGKoQsoe4QeTQqcqQqVp08muxaOfJGThaN3B9EEMFSrog/3yT7ykVV6WQ5+Ygt89LplOf5ucWa4Ird7VJhHWtzI92ZePj4Omy1XkT1TRlwtDegA0S5MeQpM4WZ1taMrhxgmNkTUJ0JXFncx5e2KLQvbvD/HOcccx48Xv1c16JBz6G3501k8E++LWXgZ2TeNXwGsk6FyRZb0ApLyQHIx5ZtPo/UET9z3AmJCPXkrUsZ4WK46fDtbzxVPU2r8nTOcGCPbO0LUsGT6wpsuQVC4CisXDJwoZmL6kKwHfKs6mmUL2YZYzNfgoB/KgpJYSpC96kcpQyFvw+xuwqK2SXGZbAl9lADT+a83z04feQHSSIG3PCrX4QEWzpCZZ4+ySEz1Y34aoU20X9GtX+1LSwUjmQgwHrMBSvFm3/B7+IFM8OUqDB+Uvkr9Uvy7P2/KDvfy3Ih7GFcGd0C5NXpSvVTTfu1IlK/T3/t6MR/8iq78pp/2ZTYvO6eNDRJWaXYU+x6sl2dTs9n+2Z4W4AfYTvEyuxlx+aI19SqCJh7WmaFcAxidFl/9iqDjWiplb9+C6ijZv2hJtVjSCuoptIWpGDYItH7RAqlKHrx6flJD+M/5BceMHBv2w4OWCD9vPRLo8gl9o06ip0iflzO1dixhOAgLFjsQmQHNGFtR3EvCID+iS4FUlilwK+hcKNxrr0wp9Btkl9W1R9aTo289CUiIxx45skfCYzHwb+7Hqj3uTiXnep6zhCKZBAnPsDOvISXfBgXKufcFsTNtts09jX8H5/uMc9wyJ179H1cp+At1mIK2duwfo4Q9asfEoffl6Zn1olGdtEruxHGeVU0NwJ8V7RflC/Cx5RXtJ3sPJ/sHmVnBlVyR0=]]></req_info></xml>";
|
||||
WxPayRefundNotifyResult response = client.parseRefundNotifyResult(xml);
|
||||
assertNotNull(response.getReqInfo().getTransactionId());
|
||||
System.out.println(response.getReqInfo());
|
||||
}
|
||||
|
||||
@@ -84,6 +89,7 @@ public class WxBarPayClientIntegrationTest {
|
||||
System.out.println(JsonUtils.toJsonPrettyString(request));
|
||||
WxPayRefundResult response = client.refund(request);
|
||||
System.out.println("========= response ==========");
|
||||
assertNotNull(response.getTransactionId());
|
||||
System.out.println(JsonUtils.toJsonPrettyString(response));
|
||||
}
|
||||
|
||||
@@ -105,6 +111,7 @@ public class WxBarPayClientIntegrationTest {
|
||||
System.out.println(JsonUtils.toJsonPrettyString(request));
|
||||
WxPayRefundV3Result response = client.refundV3(request);
|
||||
System.out.println("========= response ==========");
|
||||
assertNotNull(response.getTransactionId());
|
||||
System.out.println(JsonUtils.toJsonPrettyString(response));
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -15,6 +15,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
/**
|
||||
* {@link WxNativePayClient} 的集成测试,用于快速调试微信扫码支付
|
||||
*
|
||||
@@ -43,6 +45,7 @@ public class WxNativePayClientIntegrationTest {
|
||||
System.out.println(JsonUtils.toJsonPrettyString(request));
|
||||
String response = client.createOrderV3(TradeTypeEnum.NATIVE, request);
|
||||
System.out.println("========= response ==========");
|
||||
assertNotNull(response);
|
||||
System.out.println(JsonUtils.toJsonPrettyString(response));
|
||||
}
|
||||
|
||||
@@ -64,6 +67,7 @@ public class WxNativePayClientIntegrationTest {
|
||||
System.out.println(JsonUtils.toJsonPrettyString(request));
|
||||
WxPayRefundV3Result response = client.refundV3(request);
|
||||
System.out.println("========= response ==========");
|
||||
assertNotNull(response.getTransactionId());
|
||||
System.out.println(JsonUtils.toJsonPrettyString(response));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.framework.sms.core.client;
|
||||
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
@@ -24,7 +24,7 @@ public interface SmsClient {
|
||||
* @return 短信发送结果
|
||||
*/
|
||||
SmsSendRespDTO sendSms(Long logId, String mobile, String apiTemplateId,
|
||||
List<KeyValue<String, Object>> templateParams) throws Throwable;
|
||||
List<Pair<String, Object>> templateParams) throws Throwable;
|
||||
|
||||
/**
|
||||
* 解析接收短信的接收结果
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.aliyun;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.aliyuncs.auth.Credential;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
@@ -89,7 +89,7 @@ public class AliyunSmsClient extends AbstractSmsClient {
|
||||
|
||||
@Override
|
||||
public SmsSendRespDTO sendSms(Long sendLogId, String mobile, String apiTemplateId,
|
||||
List<KeyValue<String, Object>> templateParams) throws Throwable {
|
||||
List<Pair<String, Object>> templateParams) throws Throwable {
|
||||
// 构建请求
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
request.setPhoneNumbers(mobile);
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ package com.cf.imes.framework.sms.core.client.impl.debug;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
@@ -50,7 +50,7 @@ public class DebugDingTalkSmsClient extends AbstractSmsClient {
|
||||
|
||||
@Override
|
||||
public SmsSendRespDTO sendSms(Long sendLogId, String mobile,
|
||||
String apiTemplateId, List<KeyValue<String, Object>> templateParams) throws Throwable {
|
||||
String apiTemplateId, List<Pair<String, Object>> templateParams) throws Throwable {
|
||||
// 构建请求
|
||||
String url = buildUrl("robot/send");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@@ -64,7 +64,7 @@ public class DebugDingTalkSmsClient extends AbstractSmsClient {
|
||||
Map<?, ?> responseObj = JsonUtils.parseObject(responseText, Map.class);
|
||||
String errorCode = MapUtil.getStr(responseObj, "errcode");
|
||||
return new SmsSendRespDTO().setSuccess(Objects.equals(errorCode, "0")).setSerialNo(StrUtil.uuid())
|
||||
.setApiCode(errorCode).setApiMsg(MapUtil.getStr(responseObj, "errorMsg")).setMobile(mobile).setChannelCode(properties.getChannel());
|
||||
.setApiCode(errorCode).setApiMsg(MapUtil.getStr(responseObj, "errmsg")).setMobile(mobile).setChannelCode(properties.getChannel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.tencent;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.framework.common.util.collection.ArrayUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
@@ -91,16 +91,16 @@ public class TencentSmsClient extends AbstractSmsClient {
|
||||
}
|
||||
|
||||
private String getSdkAppId() {
|
||||
return StrUtil.subAfter(properties.getApiKey(), " ", true);
|
||||
return CharSequenceUtil.subAfter(properties.getApiKey(), " ", true);
|
||||
}
|
||||
|
||||
private String getApiKey() {
|
||||
return StrUtil.subBefore(properties.getApiKey(), " ", true);
|
||||
return CharSequenceUtil.subBefore(properties.getApiKey(), " ", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsSendRespDTO sendSms(Long sendLogId, String mobile,
|
||||
String apiTemplateId, List<KeyValue<String, Object>> templateParams) throws Throwable {
|
||||
String apiTemplateId, List<Pair<String, Object>> templateParams) throws Throwable {
|
||||
// 构建请求
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
request.setSmsSdkAppId(getSdkAppId());
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.aliyun;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
@@ -65,8 +65,8 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest {
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<KeyValue<String, Object>> templateParams = Lists.newArrayList(
|
||||
new KeyValue<>("code", 1234), new KeyValue<>("op", "login"));
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("code", 1234), new Pair<>("op", "login"));
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> o.setCode("OK"));
|
||||
when(client.getAcsResponse(argThat((ArgumentMatcher<SendSmsRequest>) acsRequest -> {
|
||||
@@ -95,8 +95,8 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest {
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<KeyValue<String, Object>> templateParams = Lists.newArrayList(
|
||||
new KeyValue<>("code", 1234), new KeyValue<>("op", "login"));
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("code", 1234), new Pair<>("op", "login"));
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> o.setCode("ERROR"));
|
||||
when(client.getAcsResponse(argThat((ArgumentMatcher<SendSmsRequest>) acsRequest -> {
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.tencent;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import com.cf.imes.framework.common.util.collection.ArrayUtils;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
@@ -80,8 +80,8 @@ public class TencentSmsClientTest extends BaseMockitoUnitTest {
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<KeyValue<String, Object>> templateParams = Lists.newArrayList(
|
||||
new KeyValue<>("1", 1234), new KeyValue<>("2", "login"));
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("1", 1234), new Pair<>("2", "login"));
|
||||
String requestId = randomString();
|
||||
String serialNo = randomString();
|
||||
// mock 方法
|
||||
@@ -121,8 +121,8 @@ public class TencentSmsClientTest extends BaseMockitoUnitTest {
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<KeyValue<String, Object>> templateParams = Lists.newArrayList(
|
||||
new KeyValue<>("1", 1234), new KeyValue<>("2", "login"));
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("1", 1234), new Pair<>("2", "login"));
|
||||
String requestId = randomString();
|
||||
String serialNo = randomString();
|
||||
// mock 方法
|
||||
|
||||
+4
@@ -6,6 +6,8 @@ import cn.hutool.extra.ftp.FtpMode;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class FtpFileClientTest {
|
||||
|
||||
@Test
|
||||
@@ -21,11 +23,13 @@ public class FtpFileClientTest {
|
||||
config.setPassword("");
|
||||
config.setMode(FtpMode.Passive.name());
|
||||
FtpFileClient client = new FtpFileClient(0L, config);
|
||||
assertNotNull(client);
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
assertNotNull(fullPath);
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
if (false) {
|
||||
byte[] bytes = client.getContent(path);
|
||||
|
||||
+4
@@ -5,6 +5,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class LocalFileClientTest {
|
||||
|
||||
@Test
|
||||
@@ -15,11 +17,13 @@ public class LocalFileClientTest {
|
||||
config.setDomain("http://127.0.0.1:48080");
|
||||
config.setBasePath("/Users/yunai/file_test");
|
||||
LocalFileClient client = new LocalFileClient(0L, config);
|
||||
assertNotNull(client);
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
assertNotNull(fullPath);
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
client.delete(path);
|
||||
}
|
||||
|
||||
+4
@@ -5,6 +5,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class SftpFileClientTest {
|
||||
|
||||
@Test
|
||||
@@ -19,11 +21,13 @@ public class SftpFileClientTest {
|
||||
config.setUsername("");
|
||||
config.setPassword("");
|
||||
SftpFileClient client = new SftpFileClient(0L, config);
|
||||
assertNotNull(client);
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
assertNotNull(fullPath);
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
if (false) {
|
||||
byte[] bytes = client.getContent(path);
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.security.core.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.core.KeyValue;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.common.util.cache.CacheUtils;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
@@ -28,12 +28,12 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
|
||||
/**
|
||||
* 针对 {@link #hasAnyRoles(String...)} 的缓存
|
||||
*/
|
||||
private final LoadingCache<KeyValue<Long, List<String>>, Boolean> hasAnyRolesCache = CacheUtils.buildCache(
|
||||
private final LoadingCache<Pair<Long, List<String>>, Boolean> hasAnyRolesCache = CacheUtils.buildCache(
|
||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||
new CacheLoader<KeyValue<Long, List<String>>, Boolean>() {
|
||||
new CacheLoader<>() {
|
||||
|
||||
@Override
|
||||
public Boolean load(KeyValue<Long, List<String>> key) {
|
||||
public Boolean load(Pair<Long, List<String>> key) {
|
||||
return permissionApi.hasAnyRoles(key.getKey(), key.getValue().toArray(new String[0])).getCheckedData();
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
|
||||
/**
|
||||
* 针对 {@link #hasAnyPermissions(String...)} 的缓存
|
||||
*/
|
||||
private final LoadingCache<KeyValue<Long, List<String>>, Boolean> hasAnyPermissionsCache = CacheUtils.buildCache(
|
||||
private final LoadingCache<Pair<Long, List<String>>, Boolean> hasAnyPermissionsCache = CacheUtils.buildCache(
|
||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||
new CacheLoader<KeyValue<Long, List<String>>, Boolean>() {
|
||||
new CacheLoader<>() {
|
||||
|
||||
@Override
|
||||
public Boolean load(KeyValue<Long, List<String>> key) {
|
||||
public Boolean load(Pair<Long, List<String>> key) {
|
||||
Boolean checkedData = permissionApi.hasAnyPermissions(key.getKey(), key.getValue().toArray(new String[0])).getCheckedData();
|
||||
return checkedData;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public boolean hasAnyPermissions(String... permissions) {
|
||||
return hasAnyPermissionsCache.get(new KeyValue<>(SecurityFrameworkUtils.getLoginUserId(), Arrays.asList(permissions)));
|
||||
return hasAnyPermissionsCache.get(new Pair<>(SecurityFrameworkUtils.getLoginUserId(), Arrays.asList(permissions)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,13 +78,13 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public boolean hasAnyRoles(String... roles) {
|
||||
return hasAnyRolesCache.get(new KeyValue<>(SecurityFrameworkUtils.getLoginUserId(), Arrays.asList(roles)));
|
||||
return hasAnyRolesCache.get(new Pair<>(SecurityFrameworkUtils.getLoginUserId(), Arrays.asList(roles)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public boolean hasAnyRoles(Long userId, String... roles) {
|
||||
return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles)));
|
||||
return hasAnyRolesCache.get(new Pair<>(userId, Arrays.asList(roles)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@ package com.cf.imes.framework.jackson.config;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.jackson.core.databind.CustomNumberSerializer;
|
||||
import com.cf.imes.framework.jackson.core.databind.LocalDateTimeDeserializer;
|
||||
import com.cf.imes.framework.jackson.core.databind.LocalDateTimeSerializer;
|
||||
import com.cf.imes.framework.jackson.core.databind.NumberSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
@@ -31,8 +31,8 @@ public class ChenfengJacksonAutoConfiguration {
|
||||
SimpleModule simpleModule = new SimpleModule();
|
||||
simpleModule
|
||||
// 新增 Long 类型序列化规则,数值超过 2^53-1,在 JS 会出现精度丢失问题,因此 Long 自动序列化为字符串类型
|
||||
.addSerializer(Long.class, NumberSerializer.INSTANCE)
|
||||
.addSerializer(Long.TYPE, NumberSerializer.INSTANCE)
|
||||
.addSerializer(Long.class, CustomNumberSerializer.CUSTOM_INSTANCE)
|
||||
.addSerializer(Long.TYPE, CustomNumberSerializer.CUSTOM_INSTANCE)
|
||||
.addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE)
|
||||
.addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE)
|
||||
.addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE)
|
||||
|
||||
+3
-3
@@ -14,14 +14,14 @@ import java.io.IOException;
|
||||
* @author 星语
|
||||
*/
|
||||
@JacksonStdImpl
|
||||
public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer {
|
||||
public class CustomNumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer {
|
||||
|
||||
private static final long MAX_SAFE_INTEGER = 9007199254740991L;
|
||||
private static final long MIN_SAFE_INTEGER = -9007199254740991L;
|
||||
|
||||
public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class);
|
||||
public static final CustomNumberSerializer CUSTOM_INSTANCE = new CustomNumberSerializer(Number.class);
|
||||
|
||||
public NumberSerializer(Class<? extends Number> rawType) {
|
||||
public CustomNumberSerializer(Class<? extends Number> rawType) {
|
||||
super(rawType);
|
||||
}
|
||||
|
||||
+7
-3
@@ -236,9 +236,13 @@ public class GlobalExceptionHandler {
|
||||
return tableNotExistsResult;
|
||||
}
|
||||
|
||||
// if(ex instanceof NullPointerException){
|
||||
// return CommonResult.error(DATA_EXCEPTION_ERROR.getCode(), DATA_EXCEPTION_ERROR.getMsg());
|
||||
// }
|
||||
if(ex instanceof NullPointerException){
|
||||
// 处理异常
|
||||
log.error("[defaultExceptionHandler]", ex);
|
||||
// 插入异常日志
|
||||
this.createExceptionLog(req, ex);
|
||||
return CommonResult.error(DATA_EXCEPTION_ERROR.getCode(), DATA_EXCEPTION_ERROR.getMsg());
|
||||
}
|
||||
|
||||
// 情况二:部分特殊的库的处理
|
||||
if (Objects.equals("io.github.resilience4j.ratelimiter.RequestNotPermitted", ex.getClass().getName())) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cf.imes.gateway.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 网关配置
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "chenfeng.gateway")
|
||||
@Data
|
||||
public class CfGatewayProperties {
|
||||
|
||||
|
||||
/**
|
||||
* 需要忽略打印requestBody和responseBody的请求地址列表
|
||||
*/
|
||||
private Set<String> accessLogIgnoreUrls = Collections.emptySet();
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.cf.imes.gateway.filter.logging;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.gateway.config.CfGatewayProperties;
|
||||
import com.cf.imes.gateway.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.gateway.util.WebFrameworkUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
@@ -60,6 +62,22 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
||||
@Resource
|
||||
private CodecConfigurer codecConfigurer;
|
||||
|
||||
@Resource
|
||||
private CfGatewayProperties cfGatewayProperties;
|
||||
|
||||
/**
|
||||
* 是否需要打印请求体和响应体
|
||||
*
|
||||
* @param requestUrl 请求路径
|
||||
* @return
|
||||
*/
|
||||
protected boolean shouldLogParamAndBody(String requestUrl) {
|
||||
if (CollUtil.isEmpty(cfGatewayProperties.getAccessLogIgnoreUrls())) {
|
||||
return true;
|
||||
}
|
||||
return !cfGatewayProperties.getAccessLogIgnoreUrls().stream().anyMatch(excludeUrl -> requestUrl.contains(excludeUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印日志
|
||||
*
|
||||
@@ -78,14 +96,20 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
||||
values.put("userType", gatewayLog.getUserType());
|
||||
values.put("routeId", gatewayLog.getRoute() != null ? gatewayLog.getRoute().getId() : null);
|
||||
values.put("schema", gatewayLog.getSchema());
|
||||
values.put("requestUrl", gatewayLog.getRequestUrl());
|
||||
String requestUrl = gatewayLog.getRequestUrl();
|
||||
values.put("requestUrl", requestUrl);
|
||||
values.put("queryParams", gatewayLog.getQueryParams().toSingleValueMap());
|
||||
values.put("requestBody", JsonUtils.isJson(gatewayLog.getRequestBody()) ? // 保证 body 的展示好看
|
||||
JSONUtil.parse(gatewayLog.getRequestBody()) : gatewayLog.getRequestBody());
|
||||
|
||||
values.put("requestHeaders", JsonUtils.toJsonString(gatewayLog.getRequestHeaders().toSingleValueMap()));
|
||||
values.put("userIp", gatewayLog.getUserIp());
|
||||
values.put("responseBody", JsonUtils.isJson(gatewayLog.getResponseBody()) ? // 保证 body 的展示好看
|
||||
JSONUtil.parse(gatewayLog.getResponseBody()) : gatewayLog.getResponseBody());
|
||||
// 过滤特定大请求不打印日志
|
||||
if (shouldLogParamAndBody(requestUrl)) {
|
||||
values.put("requestBody", JsonUtils.isJson(gatewayLog.getRequestBody()) ? // 保证 body 的展示好看
|
||||
JSONUtil.parse(gatewayLog.getRequestBody()) : gatewayLog.getRequestBody());
|
||||
|
||||
values.put("responseBody", JsonUtils.isJson(gatewayLog.getResponseBody()) ? // 保证 body 的展示好看
|
||||
JSONUtil.parse(gatewayLog.getResponseBody()) : gatewayLog.getResponseBody());
|
||||
}
|
||||
values.put("responseHeaders", gatewayLog.getResponseHeaders() != null ?
|
||||
JsonUtils.toJsonString(gatewayLog.getResponseHeaders().toSingleValueMap()) : null);
|
||||
values.put("httpStatus", gatewayLog.getHttpStatus());
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
codec:
|
||||
# getway请求大小限制10M:1024 * 1024 * 10
|
||||
max-in-memory-size: 10485760
|
||||
|
||||
cloud:
|
||||
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
|
||||
@@ -99,3 +102,9 @@ knife4j:
|
||||
- name: report-server
|
||||
service-name: report-server
|
||||
url: /admin-api/report/v3/api-docs
|
||||
|
||||
chenfeng:
|
||||
gateway:
|
||||
access-log-ignore-urls:
|
||||
- /report/template
|
||||
- /system/captcha/get
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo01;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactRespVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
|
||||
import com.cf.imes.module.infra.service.demo.demo01.Demo01ContactService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 示例联系人")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo01-contact")
|
||||
@Validated
|
||||
public class Demo01ContactController {
|
||||
|
||||
@Resource
|
||||
private Demo01ContactService demo01ContactService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建示例联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:create')")
|
||||
public CommonResult<Long> createDemo01Contact(@Valid @RequestBody Demo01ContactSaveReqVO createReqVO) {
|
||||
return success(demo01ContactService.createDemo01Contact(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新示例联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:update')")
|
||||
public CommonResult<Boolean> updateDemo01Contact(@Valid @RequestBody Demo01ContactSaveReqVO updateReqVO) {
|
||||
demo01ContactService.updateDemo01Contact(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除示例联系人")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:delete')")
|
||||
public CommonResult<Boolean> deleteDemo01Contact(@RequestParam("id") Long id) {
|
||||
demo01ContactService.deleteDemo01Contact(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得示例联系人")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:query')")
|
||||
public CommonResult<Demo01ContactRespVO> getDemo01Contact(@RequestParam("id") Long id) {
|
||||
Demo01ContactDO demo01Contact = demo01ContactService.getDemo01Contact(id);
|
||||
return success(BeanUtils.toBean(demo01Contact, Demo01ContactRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得示例联系人分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:query')")
|
||||
public CommonResult<PageResult<Demo01ContactRespVO>> getDemo01ContactPage(@Valid Demo01ContactPageReqVO pageReqVO) {
|
||||
PageResult<Demo01ContactDO> pageResult = demo01ContactService.getDemo01ContactPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, Demo01ContactRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出示例联系人 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo01ContactExcel(@Valid Demo01ContactPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<Demo01ContactDO> list = demo01ContactService.getDemo01ContactPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "示例联系人.xls", "数据", Demo01ContactRespVO.class,
|
||||
BeanUtils.toBean(list, Demo01ContactRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo01.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 示例联系人分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class Demo01ContactPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo01.vo;
|
||||
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 示例联系人 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class Demo01ContactRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21555")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "性别", converter = DictConvert.class)
|
||||
@DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "出生年", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("出生年")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("简介")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "头像")
|
||||
@ExcelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 示例联系人新增/修改 Request VO")
|
||||
@Data
|
||||
public class Demo01ContactSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21555")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "出生年", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出生年不能为空")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "简介不能为空")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo02;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryRespVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
|
||||
import com.cf.imes.module.infra.service.demo.demo02.Demo02CategoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 示例分类")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo02-category")
|
||||
@Validated
|
||||
public class Demo02CategoryController {
|
||||
|
||||
@Resource
|
||||
private Demo02CategoryService demo02CategoryService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建示例分类")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:create')")
|
||||
public CommonResult<Long> createDemo02Category(@Valid @RequestBody Demo02CategorySaveReqVO createReqVO) {
|
||||
return success(demo02CategoryService.createDemo02Category(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新示例分类")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:update')")
|
||||
public CommonResult<Boolean> updateDemo02Category(@Valid @RequestBody Demo02CategorySaveReqVO updateReqVO) {
|
||||
demo02CategoryService.updateDemo02Category(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除示例分类")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:delete')")
|
||||
public CommonResult<Boolean> deleteDemo02Category(@RequestParam("id") Long id) {
|
||||
demo02CategoryService.deleteDemo02Category(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得示例分类")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:query')")
|
||||
public CommonResult<Demo02CategoryRespVO> getDemo02Category(@RequestParam("id") Long id) {
|
||||
Demo02CategoryDO demo02Category = demo02CategoryService.getDemo02Category(id);
|
||||
return success(BeanUtils.toBean(demo02Category, Demo02CategoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得示例分类列表")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:query')")
|
||||
public CommonResult<List<Demo02CategoryRespVO>> getDemo02CategoryList(@Valid Demo02CategoryListReqVO listReqVO) {
|
||||
List<Demo02CategoryDO> list = demo02CategoryService.getDemo02CategoryList(listReqVO);
|
||||
return success(BeanUtils.toBean(list, Demo02CategoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出示例分类 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo02-category:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo02CategoryExcel(@Valid Demo02CategoryListReqVO listReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<Demo02CategoryDO> list = demo02CategoryService.getDemo02CategoryList(listReqVO);
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "示例分类.xls", "数据", Demo02CategoryRespVO.class,
|
||||
BeanUtils.toBean(list, Demo02CategoryRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 示例分类列表 Request VO")
|
||||
@Data
|
||||
public class Demo02CategoryListReqVO {
|
||||
|
||||
@Schema(description = "名字", example = "晨丰")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "父级编号", example = "6080")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo02.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 示例分类 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class Demo02CategoryRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10304")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "父级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6080")
|
||||
@ExcelProperty("父级编号")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 示例分类新增/修改 Request VO")
|
||||
@Data
|
||||
public class Demo02CategorySaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10304")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "父级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6080")
|
||||
@NotNull(message = "父级编号不能为空")
|
||||
private Long parentId;
|
||||
|
||||
}
|
||||
-197
@@ -1,197 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentRespVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
|
||||
import com.cf.imes.module.infra.service.demo.demo03.Demo03StudentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo03-student")
|
||||
@Validated
|
||||
public class Demo03StudentController {
|
||||
|
||||
@Resource
|
||||
private Demo03StudentService demo03StudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
|
||||
public CommonResult<Long> createDemo03Student(@Valid @RequestBody Demo03StudentSaveReqVO createReqVO) {
|
||||
return success(demo03StudentService.createDemo03Student(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
|
||||
public CommonResult<Boolean> updateDemo03Student(@Valid @RequestBody Demo03StudentSaveReqVO updateReqVO) {
|
||||
demo03StudentService.updateDemo03Student(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除学生")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03Student(@RequestParam("id") Long id) {
|
||||
demo03StudentService.deleteDemo03Student(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得学生")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<Demo03StudentRespVO> getDemo03Student(@RequestParam("id") Long id) {
|
||||
Demo03StudentDO demo03Student = demo03StudentService.getDemo03Student(id);
|
||||
return success(BeanUtils.toBean(demo03Student, Demo03StudentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得学生分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<PageResult<Demo03StudentRespVO>> getDemo03StudentPage(@Valid Demo03StudentPageReqVO pageReqVO) {
|
||||
PageResult<Demo03StudentDO> pageResult = demo03StudentService.getDemo03StudentPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, Demo03StudentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出学生 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo03StudentExcel(@Valid Demo03StudentPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<Demo03StudentDO> list = demo03StudentService.getDemo03StudentPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentRespVO.class,
|
||||
BeanUtils.toBean(list, Demo03StudentRespVO.class));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
@GetMapping("/demo03-course/page")
|
||||
@Operation(summary = "获得学生课程分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<PageResult<Demo03CourseDO>> getDemo03CoursePage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo03StudentService.getDemo03CoursePage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo03-course/create")
|
||||
@Operation(summary = "创建学生课程")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
|
||||
public CommonResult<Long> createDemo03Course(@Valid @RequestBody Demo03CourseDO demo03Course) {
|
||||
return success(demo03StudentService.createDemo03Course(demo03Course));
|
||||
}
|
||||
|
||||
@PutMapping("/demo03-course/update")
|
||||
@Operation(summary = "更新学生课程")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
|
||||
public CommonResult<Boolean> updateDemo03Course(@Valid @RequestBody Demo03CourseDO demo03Course) {
|
||||
demo03StudentService.updateDemo03Course(demo03Course);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo03-course/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生课程")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03Course(@RequestParam("id") Long id) {
|
||||
demo03StudentService.deleteDemo03Course(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo03-course/get")
|
||||
@Operation(summary = "获得学生课程")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<Demo03CourseDO> getDemo03Course(@RequestParam("id") Long id) {
|
||||
return success(demo03StudentService.getDemo03Course(id));
|
||||
}
|
||||
|
||||
@GetMapping("/demo03-course/list-by-student-id")
|
||||
@Operation(summary = "获得学生课程列表")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<List<Demo03CourseDO>> getDemo03CourseListByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo03StudentService.getDemo03CourseListByStudentId(studentId));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
@GetMapping("/demo03-grade/page")
|
||||
@Operation(summary = "获得学生班级分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<PageResult<Demo03GradeDO>> getDemo03GradePage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo03StudentService.getDemo03GradePage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo03-grade/create")
|
||||
@Operation(summary = "创建学生班级")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
|
||||
public CommonResult<Long> createDemo03Grade(@Valid @RequestBody Demo03GradeDO demo03Grade) {
|
||||
return success(demo03StudentService.createDemo03Grade(demo03Grade));
|
||||
}
|
||||
|
||||
@PutMapping("/demo03-grade/update")
|
||||
@Operation(summary = "更新学生班级")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
|
||||
public CommonResult<Boolean> updateDemo03Grade(@Valid @RequestBody Demo03GradeDO demo03Grade) {
|
||||
demo03StudentService.updateDemo03Grade(demo03Grade);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo03-grade/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生班级")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03Grade(@RequestParam("id") Long id) {
|
||||
demo03StudentService.deleteDemo03Grade(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo03-grade/get")
|
||||
@Operation(summary = "获得学生班级")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<Demo03GradeDO> getDemo03Grade(@RequestParam("id") Long id) {
|
||||
return success(demo03StudentService.getDemo03Grade(id));
|
||||
}
|
||||
|
||||
@GetMapping("/demo03-grade/get-by-student-id")
|
||||
@Operation(summary = "获得学生班级")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
|
||||
public CommonResult<Demo03GradeDO> getDemo03GradeByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo03StudentService.getDemo03GradeByStudentId(studentId));
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo03;
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo03.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class Demo03StudentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "晨丰")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "简介", example = "随便")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo03.vo;
|
||||
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class Demo03StudentRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "性别", converter = DictConvert.class)
|
||||
@DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
|
||||
@ExcelProperty("简介")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.cf.imes.module.infra.controller.admin.demo.demo03.vo;
|
||||
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 学生新增/修改 Request VO")
|
||||
@Data
|
||||
public class Demo03StudentSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出生日期不能为空")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
|
||||
@NotEmpty(message = "简介不能为空")
|
||||
private String description;
|
||||
|
||||
|
||||
private List<Demo03CourseDO> demo03Courses;
|
||||
|
||||
private Demo03GradeDO demo03Grade;
|
||||
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* 代码生成示例
|
||||
*
|
||||
* 1. demo01:单表(增删改查)
|
||||
* 2. demo02:单表(树形结构)
|
||||
* 3. demo03:主子表(标准模式)+ 主子表(ERP 模式)+ 主子表(内嵌模式)
|
||||
*/
|
||||
package com.cf.imes.module.infra.controller.admin.demo;
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.dataobject.demo.demo01;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 示例联系人 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("infra_demo01_contact")
|
||||
@KeySequence("infra_demo01_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Demo01ContactDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
* 枚举 {@link TODO system_user_sex 对应的类}
|
||||
*/
|
||||
private Integer sex;
|
||||
/**
|
||||
* 出生年
|
||||
*/
|
||||
private LocalDateTime birthday;
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.dataobject.demo.demo02;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 示例分类 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("infra_demo02_category")
|
||||
@KeySequence("infra_demo02_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Demo02CategoryDO extends BaseDO {
|
||||
|
||||
public static final Long PARENT_ID_ROOT = 0L;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 父级编号
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.dataobject.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 学生课程 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("infra_demo03_course")
|
||||
@KeySequence("infra_demo03_course_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Demo03CourseDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 学生编号
|
||||
*/
|
||||
private Long studentId;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.dataobject.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 学生班级 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("infra_demo03_grade")
|
||||
@KeySequence("infra_demo03_grade_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Demo03GradeDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 学生编号
|
||||
*/
|
||||
private Long studentId;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 班主任
|
||||
*/
|
||||
private String teacher;
|
||||
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.dataobject.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 学生 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("infra_demo03_student")
|
||||
@KeySequence("infra_demo03_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Demo03StudentDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
* 枚举 {@link TODO system_user_sex 对应的类}
|
||||
*/
|
||||
private Integer sex;
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private LocalDateTime birthday;
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.mysql.demo.demo01;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 示例联系人 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface Demo01ContactMapper extends BaseMapperX<Demo01ContactDO> {
|
||||
|
||||
default PageResult<Demo01ContactDO> selectPage(Demo01ContactPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<Demo01ContactDO>()
|
||||
.likeIfPresent(Demo01ContactDO::getName, reqVO.getName())
|
||||
.eqIfPresent(Demo01ContactDO::getSex, reqVO.getSex())
|
||||
.betweenIfPresent(Demo01ContactDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(Demo01ContactDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.mysql.demo.demo02;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 示例分类 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface Demo02CategoryMapper extends BaseMapperX<Demo02CategoryDO> {
|
||||
|
||||
default List<Demo02CategoryDO> selectList(Demo02CategoryListReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<Demo02CategoryDO>()
|
||||
.likeIfPresent(Demo02CategoryDO::getName, reqVO.getName())
|
||||
.eqIfPresent(Demo02CategoryDO::getParentId, reqVO.getParentId())
|
||||
.betweenIfPresent(Demo02CategoryDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(Demo02CategoryDO::getId));
|
||||
}
|
||||
|
||||
default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
|
||||
return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
|
||||
}
|
||||
|
||||
default Long selectCountByParentId(Long parentId) {
|
||||
return selectCount(Demo02CategoryDO::getParentId, parentId);
|
||||
}
|
||||
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.mysql.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生课程 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface Demo03CourseMapper extends BaseMapperX<Demo03CourseDO> {
|
||||
|
||||
default PageResult<Demo03CourseDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<Demo03CourseDO>()
|
||||
.eq(Demo03CourseDO::getStudentId, studentId)
|
||||
.orderByDesc(Demo03CourseDO::getId));
|
||||
}
|
||||
|
||||
default List<Demo03CourseDO> selectListByStudentId(Long studentId) {
|
||||
return selectList(Demo03CourseDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(Demo03CourseDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.mysql.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生班级 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface Demo03GradeMapper extends BaseMapperX<Demo03GradeDO> {
|
||||
|
||||
default PageResult<Demo03GradeDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<Demo03GradeDO>()
|
||||
.eq(Demo03GradeDO::getStudentId, studentId)
|
||||
.orderByDesc(Demo03GradeDO::getId));
|
||||
}
|
||||
|
||||
default Demo03GradeDO selectByStudentId(Long studentId) {
|
||||
return selectOne(Demo03GradeDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(Demo03GradeDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.cf.imes.module.infra.dal.mysql.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface Demo03StudentMapper extends BaseMapperX<Demo03StudentDO> {
|
||||
|
||||
default PageResult<Demo03StudentDO> selectPage(Demo03StudentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<Demo03StudentDO>()
|
||||
.likeIfPresent(Demo03StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(Demo03StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(Demo03StudentDO::getDescription, reqVO.getDescription())
|
||||
.betweenIfPresent(Demo03StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(Demo03StudentDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo01;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 示例联系人 Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface Demo01ContactService {
|
||||
|
||||
/**
|
||||
* 创建示例联系人
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo01Contact(@Valid Demo01ContactSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新示例联系人
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo01Contact(@Valid Demo01ContactSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除示例联系人
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo01Contact(Long id);
|
||||
|
||||
/**
|
||||
* 获得示例联系人
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 示例联系人
|
||||
*/
|
||||
Demo01ContactDO getDemo01Contact(Long id);
|
||||
|
||||
/**
|
||||
* 获得示例联系人分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 示例联系人分页
|
||||
*/
|
||||
PageResult<Demo01ContactDO> getDemo01ContactPage(Demo01ContactPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo01;
|
||||
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
|
||||
import com.cf.imes.module.infra.dal.mysql.demo.demo01.Demo01ContactMapper;
|
||||
import com.cf.imes.module.infra.enums.ErrorCodeConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 示例联系人 Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class Demo01ContactServiceImpl implements Demo01ContactService {
|
||||
|
||||
@Resource
|
||||
private Demo01ContactMapper demo01ContactMapper;
|
||||
|
||||
@Override
|
||||
public Long createDemo01Contact(Demo01ContactSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
Demo01ContactDO demo01Contact = BeanUtils.toBean(createReqVO, Demo01ContactDO.class);
|
||||
demo01ContactMapper.insert(demo01Contact);
|
||||
// 返回
|
||||
return demo01Contact.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo01Contact(Demo01ContactSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo01ContactExists(updateReqVO.getId());
|
||||
// 更新
|
||||
Demo01ContactDO updateObj = BeanUtils.toBean(updateReqVO, Demo01ContactDO.class);
|
||||
demo01ContactMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo01Contact(Long id) {
|
||||
// 校验存在
|
||||
validateDemo01ContactExists(id);
|
||||
// 删除
|
||||
demo01ContactMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDemo01ContactExists(Long id) {
|
||||
if (demo01ContactMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEMO01_CONTACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Demo01ContactDO getDemo01Contact(Long id) {
|
||||
return demo01ContactMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<Demo01ContactDO> getDemo01ContactPage(Demo01ContactPageReqVO pageReqVO) {
|
||||
return demo01ContactMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo02;
|
||||
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 示例分类 Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface Demo02CategoryService {
|
||||
|
||||
/**
|
||||
* 创建示例分类
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo02Category(@Valid Demo02CategorySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新示例分类
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo02Category(@Valid Demo02CategorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除示例分类
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo02Category(Long id);
|
||||
|
||||
/**
|
||||
* 获得示例分类
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 示例分类
|
||||
*/
|
||||
Demo02CategoryDO getDemo02Category(Long id);
|
||||
|
||||
/**
|
||||
* 获得示例分类列表
|
||||
*
|
||||
* @param listReqVO 查询条件
|
||||
* @return 示例分类列表
|
||||
*/
|
||||
List<Demo02CategoryDO> getDemo02CategoryList(Demo02CategoryListReqVO listReqVO);
|
||||
|
||||
}
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo02;
|
||||
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
|
||||
import com.cf.imes.module.infra.dal.mysql.demo.demo02.Demo02CategoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 示例分类 Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class Demo02CategoryServiceImpl implements Demo02CategoryService {
|
||||
|
||||
@Resource
|
||||
private Demo02CategoryMapper demo02CategoryMapper;
|
||||
|
||||
@Override
|
||||
public Long createDemo02Category(Demo02CategorySaveReqVO createReqVO) {
|
||||
// 校验父级编号的有效性
|
||||
validateParentDemo02Category(null, createReqVO.getParentId());
|
||||
// 校验名字的唯一性
|
||||
validateDemo02CategoryNameUnique(null, createReqVO.getParentId(), createReqVO.getName());
|
||||
|
||||
// 插入
|
||||
Demo02CategoryDO demo02Category = BeanUtils.toBean(createReqVO, Demo02CategoryDO.class);
|
||||
demo02CategoryMapper.insert(demo02Category);
|
||||
// 返回
|
||||
return demo02Category.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo02Category(Demo02CategorySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo02CategoryExists(updateReqVO.getId());
|
||||
// 校验父级编号的有效性
|
||||
validateParentDemo02Category(updateReqVO.getId(), updateReqVO.getParentId());
|
||||
// 校验名字的唯一性
|
||||
validateDemo02CategoryNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName());
|
||||
|
||||
// 更新
|
||||
Demo02CategoryDO updateObj = BeanUtils.toBean(updateReqVO, Demo02CategoryDO.class);
|
||||
demo02CategoryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo02Category(Long id) {
|
||||
// 校验存在
|
||||
validateDemo02CategoryExists(id);
|
||||
// 校验是否有子示例分类
|
||||
if (demo02CategoryMapper.selectCountByParentId(id) > 0) {
|
||||
throw exception(DEMO02_CATEGORY_EXITS_CHILDREN);
|
||||
}
|
||||
// 删除
|
||||
demo02CategoryMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDemo02CategoryExists(Long id) {
|
||||
if (demo02CategoryMapper.selectById(id) == null) {
|
||||
throw exception(DEMO02_CATEGORY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateParentDemo02Category(Long id, Long parentId) {
|
||||
if (parentId == null || Demo02CategoryDO.PARENT_ID_ROOT.equals(parentId)) {
|
||||
return;
|
||||
}
|
||||
// 1. 不能设置自己为父示例分类
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw exception(DEMO02_CATEGORY_PARENT_ERROR);
|
||||
}
|
||||
// 2. 父示例分类不存在
|
||||
Demo02CategoryDO parentDemo02Category = demo02CategoryMapper.selectById(parentId);
|
||||
if (parentDemo02Category == null) {
|
||||
throw exception(DEMO02_CATEGORY_PARENT_NOT_EXITS);
|
||||
}
|
||||
// 3. 递归校验父示例分类,如果父示例分类是自己的子示例分类,则报错,避免形成环路
|
||||
if (id == null) { // id 为空,说明新增,不需要考虑环路
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < Short.MAX_VALUE; i++) {
|
||||
// 3.1 校验环路
|
||||
parentId = parentDemo02Category.getParentId();
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw exception(DEMO02_CATEGORY_PARENT_IS_CHILD);
|
||||
}
|
||||
// 3.2 继续递归下一级父示例分类
|
||||
if (parentId == null || Demo02CategoryDO.PARENT_ID_ROOT.equals(parentId)) {
|
||||
break;
|
||||
}
|
||||
parentDemo02Category = demo02CategoryMapper.selectById(parentId);
|
||||
if (parentDemo02Category == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDemo02CategoryNameUnique(Long id, Long parentId, String name) {
|
||||
Demo02CategoryDO demo02Category = demo02CategoryMapper.selectByParentIdAndName(parentId, name);
|
||||
if (demo02Category == null) {
|
||||
return;
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的示例分类
|
||||
if (id == null) {
|
||||
throw exception(DEMO02_CATEGORY_NAME_DUPLICATE);
|
||||
}
|
||||
if (!Objects.equals(demo02Category.getId(), id)) {
|
||||
throw exception(DEMO02_CATEGORY_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Demo02CategoryDO getDemo02Category(Long id) {
|
||||
return demo02CategoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Demo02CategoryDO> getDemo02CategoryList(Demo02CategoryListReqVO listReqVO) {
|
||||
return demo02CategoryMapper.selectList(listReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface Demo03StudentService {
|
||||
|
||||
/**
|
||||
* 创建学生
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo03Student(@Valid Demo03StudentSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo03Student(@Valid Demo03StudentSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo03Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生
|
||||
*/
|
||||
Demo03StudentDO getDemo03Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 学生分页
|
||||
*/
|
||||
PageResult<Demo03StudentDO> getDemo03StudentPage(Demo03StudentPageReqVO pageReqVO);
|
||||
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
/**
|
||||
* 获得学生课程列表
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生课程列表
|
||||
*/
|
||||
List<Demo03CourseDO> getDemo03CourseListByStudentId(Long studentId);
|
||||
|
||||
/**
|
||||
* 获得学生课程分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生课程分页
|
||||
*/
|
||||
PageResult<Demo03CourseDO> getDemo03CoursePage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生课程
|
||||
*
|
||||
* @param demo03Course 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo03Course(@Valid Demo03CourseDO demo03Course);
|
||||
|
||||
/**
|
||||
* 更新学生课程
|
||||
*
|
||||
* @param demo03Course 更新信息
|
||||
*/
|
||||
void updateDemo03Course(@Valid Demo03CourseDO demo03Course);
|
||||
|
||||
/**
|
||||
* 删除学生课程
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo03Course(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生课程
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生课程
|
||||
*/
|
||||
Demo03CourseDO getDemo03Course(Long id);
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
/**
|
||||
* 获得学生班级
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生班级
|
||||
*/
|
||||
Demo03GradeDO getDemo03GradeByStudentId(Long studentId);
|
||||
|
||||
/**
|
||||
* 获得学生班级分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生班级分页
|
||||
*/
|
||||
PageResult<Demo03GradeDO> getDemo03GradePage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生班级
|
||||
*
|
||||
* @param demo03Grade 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo03Grade(@Valid Demo03GradeDO demo03Grade);
|
||||
|
||||
/**
|
||||
* 更新学生班级
|
||||
*
|
||||
* @param demo03Grade 更新信息
|
||||
*/
|
||||
void updateDemo03Grade(@Valid Demo03GradeDO demo03Grade);
|
||||
|
||||
/**
|
||||
* 删除学生班级
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo03Grade(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生班级
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生班级
|
||||
*/
|
||||
Demo03GradeDO getDemo03Grade(Long id);
|
||||
|
||||
}
|
||||
-217
@@ -1,217 +0,0 @@
|
||||
package com.cf.imes.module.infra.service.demo.demo03;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
|
||||
import com.cf.imes.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
|
||||
import com.cf.imes.module.infra.dal.mysql.demo.demo03.Demo03CourseMapper;
|
||||
import com.cf.imes.module.infra.dal.mysql.demo.demo03.Demo03GradeMapper;
|
||||
import com.cf.imes.module.infra.dal.mysql.demo.demo03.Demo03StudentMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 学生 Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class Demo03StudentServiceImpl implements Demo03StudentService {
|
||||
|
||||
@Resource
|
||||
private Demo03StudentMapper demo03StudentMapper;
|
||||
@Resource
|
||||
private Demo03CourseMapper demo03CourseMapper;
|
||||
@Resource
|
||||
private Demo03GradeMapper demo03GradeMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createDemo03Student(Demo03StudentSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
Demo03StudentDO demo03Student = BeanUtils.toBean(createReqVO, Demo03StudentDO.class);
|
||||
demo03StudentMapper.insert(demo03Student);
|
||||
|
||||
// 插入子表
|
||||
createDemo03CourseList(demo03Student.getId(), createReqVO.getDemo03Courses());
|
||||
createDemo03Grade(demo03Student.getId(), createReqVO.getDemo03Grade());
|
||||
// 返回
|
||||
return demo03Student.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDemo03Student(Demo03StudentSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo03StudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
Demo03StudentDO updateObj = BeanUtils.toBean(updateReqVO, Demo03StudentDO.class);
|
||||
demo03StudentMapper.updateById(updateObj);
|
||||
|
||||
// 更新子表
|
||||
updateDemo03CourseList(updateReqVO.getId(), updateReqVO.getDemo03Courses());
|
||||
updateDemo03Grade(updateReqVO.getId(), updateReqVO.getDemo03Grade());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo03Student(Long id) {
|
||||
// 校验存在
|
||||
validateDemo03StudentExists(id);
|
||||
// 删除
|
||||
demo03StudentMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteDemo03CourseByStudentId(id);
|
||||
deleteDemo03GradeByStudentId(id);
|
||||
}
|
||||
|
||||
private void validateDemo03StudentExists(Long id) {
|
||||
if (demo03StudentMapper.selectById(id) == null) {
|
||||
throw exception(DEMO03_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Demo03StudentDO getDemo03Student(Long id) {
|
||||
return demo03StudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<Demo03StudentDO> getDemo03StudentPage(Demo03StudentPageReqVO pageReqVO) {
|
||||
return demo03StudentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
@Override
|
||||
public List<Demo03CourseDO> getDemo03CourseListByStudentId(Long studentId) {
|
||||
return demo03CourseMapper.selectListByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemo03CourseList(Long studentId, List<Demo03CourseDO> list) {
|
||||
if (list != null) {
|
||||
list.forEach(o -> o.setStudentId(studentId));
|
||||
}
|
||||
demo03CourseMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
private void updateDemo03CourseList(Long studentId, List<Demo03CourseDO> list) {
|
||||
deleteDemo03CourseByStudentId(studentId);
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
createDemo03CourseList(studentId, list);
|
||||
}
|
||||
|
||||
private void deleteDemo03CourseByStudentId(Long studentId) {
|
||||
demo03CourseMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<Demo03CourseDO> getDemo03CoursePage(PageParam pageReqVO, Long studentId) {
|
||||
return demo03CourseMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createDemo03Course(Demo03CourseDO demo03Course) {
|
||||
demo03CourseMapper.insert(demo03Course);
|
||||
return demo03Course.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo03Course(Demo03CourseDO demo03Course) {
|
||||
demo03CourseMapper.updateById(demo03Course);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo03Course(Long id) {
|
||||
demo03CourseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Demo03CourseDO getDemo03Course(Long id) {
|
||||
return demo03CourseMapper.selectById(id);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
@Override
|
||||
public Demo03GradeDO getDemo03GradeByStudentId(Long studentId) {
|
||||
return demo03GradeMapper.selectByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
|
||||
if (demo03Grade == null) {
|
||||
return;
|
||||
}
|
||||
demo03Grade.setStudentId(studentId);
|
||||
demo03GradeMapper.insert(demo03Grade);
|
||||
}
|
||||
|
||||
private void updateDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
|
||||
if (demo03Grade == null) {
|
||||
return;
|
||||
}
|
||||
demo03Grade.setStudentId(studentId);
|
||||
demo03Grade.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
|
||||
demo03GradeMapper.insertOrUpdate(demo03Grade);
|
||||
}
|
||||
|
||||
private void deleteDemo03GradeByStudentId(Long studentId) {
|
||||
demo03GradeMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<Demo03GradeDO> getDemo03GradePage(PageParam pageReqVO, Long studentId) {
|
||||
return demo03GradeMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createDemo03Grade(Demo03GradeDO demo03Grade) {
|
||||
// 校验是否已经存在
|
||||
if (demo03GradeMapper.selectByStudentId(demo03Grade.getStudentId()) != null) {
|
||||
throw exception(DEMO03_GRADE_EXISTS);
|
||||
}
|
||||
demo03GradeMapper.insert(demo03Grade);
|
||||
return demo03Grade.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo03Grade(Demo03GradeDO demo03Grade) {
|
||||
// 校验存在
|
||||
validateDemo03GradeExists(demo03Grade.getId());
|
||||
// 更新
|
||||
demo03GradeMapper.updateById(demo03Grade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo03Grade(Long id) {
|
||||
// 校验存在
|
||||
validateDemo03GradeExists(id);
|
||||
// 删除
|
||||
demo03GradeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Demo03GradeDO getDemo03Grade(Long id) {
|
||||
return demo03GradeMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void validateDemo03GradeExists(Long id) {
|
||||
if (demo03GradeMapper.selectById(id) == null) {
|
||||
throw exception(DEMO03_GRADE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
public class DefaultDatabaseQueryTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -23,6 +25,7 @@ public class DefaultDatabaseQueryTest {
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
List<TableInfo> tableInfos = query.queryTables();
|
||||
assertNotEquals(0, tableInfos.size());
|
||||
for (TableInfo tableInfo : tableInfos) {
|
||||
if (StrUtil.startWithAny(tableInfo.getName().toLowerCase(), "act_", "flw_", "qrtz_")) {
|
||||
continue;
|
||||
@@ -30,6 +33,7 @@ public class DefaultDatabaseQueryTest {
|
||||
System.out.println(String.format("CREATE SEQUENCE %s_seq MINVALUE 1;", tableInfo.getName()));
|
||||
// System.out.println(String.format("DELETE FROM %s WHERE deleted = '1';", tableInfo.getName()));
|
||||
}
|
||||
|
||||
System.out.println(tableInfos.size());
|
||||
System.out.println(System.currentTimeMillis() - time);
|
||||
}
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_NOT_CANCEL = new ErrorCode(1_001_109_000, "生产单已排单,小板操作无效");
|
||||
ErrorCode ORDER_CANCEL = new ErrorCode(1_001_109_000, "生产单未作废,还原无效");
|
||||
ErrorCode ORDER_PLAN_ERROR = new ErrorCode(1_001_109_001, "选中删除对象有已开料板件,请联系管理员修改开料状态后再删除!");
|
||||
ErrorCode ORDER_ERROR = new ErrorCode(1_001_109_002, "当前生产单柜体,房间已全部删除!");
|
||||
|
||||
// ========== 生产单 TODO 补充编号 ==========
|
||||
ErrorCode MODULE_NOT_EXISTS = new ErrorCode(1_001_110_000, "模块不存在");
|
||||
|
||||
+6
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.bo;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.OptimizeRemainPlate;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPackReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO;
|
||||
@@ -16,8 +17,6 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -61,6 +60,11 @@ public class OrderSource {
|
||||
private List<PrintOrderPartsRespVO> orderPartsRespVOS;
|
||||
|
||||
|
||||
@Schema(description = "生产单配件的备注信息")
|
||||
private List<OrderPartsRemark> orderPartsRemarks;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "生产单包裹信息")
|
||||
private List<PrintOrderPackReqVO> orderPackReqVOS;
|
||||
|
||||
|
||||
+19
-2
@@ -1,25 +1,37 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 标签对应的生产单配件信息")
|
||||
@Data
|
||||
public class PrintOrderPartsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "房间ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long roomId;
|
||||
|
||||
|
||||
@Schema(description = "房间名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String roomName;
|
||||
|
||||
|
||||
@Schema(description = "柜体ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long bodyId;
|
||||
|
||||
|
||||
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bodyName;
|
||||
|
||||
|
||||
@Schema(description = "加工组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<Long> groupId;
|
||||
|
||||
|
||||
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29347")
|
||||
@ExcelProperty("配件 ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -27,6 +39,7 @@ public class PrintOrderPartsRespVO {
|
||||
private Long orderId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "配件数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long partsNum;
|
||||
|
||||
@@ -51,4 +64,8 @@ public class PrintOrderPartsRespVO {
|
||||
private String factory;
|
||||
|
||||
|
||||
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+14
-1
@@ -45,7 +45,7 @@ public class RemainBoardList {
|
||||
|
||||
|
||||
@Schema(description = "纹路 纹路(0正纹1可翻转2反纹)")
|
||||
private Integer texture;
|
||||
private Boolean texture;
|
||||
|
||||
|
||||
|
||||
@@ -53,4 +53,17 @@ public class RemainBoardList {
|
||||
private Boolean isHandAdd;
|
||||
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String brand;
|
||||
|
||||
|
||||
@Schema(description = "仓库", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String store;
|
||||
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -42,6 +42,8 @@ public class OrderGoodsResp {
|
||||
@Schema(description = "板件数量")
|
||||
private int num;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "生产单信息")
|
||||
private List<OrderRespVOCopy> orderList;
|
||||
|
||||
+3
-7
@@ -1,14 +1,10 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.plan;
|
||||
|
||||
import com.cf.imes.framework.organ.core.db.OrganBaseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 生产单开料排单 DO
|
||||
|
||||
+1
-5
@@ -1,12 +1,8 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.rawgoods;
|
||||
|
||||
import com.cf.imes.framework.organ.core.db.OrganBaseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 生产单设计商品表 order_raw_goods_{N} DO
|
||||
|
||||
+5
-19
@@ -75,7 +75,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
}
|
||||
|
||||
// 删板材,批量
|
||||
void updateDeletedById(@Param("ids") List<Long> ids, @Param("deleted") Integer deleted, @Param("organId") Long organId);
|
||||
void updateDeletedById(@Param("orderId") Long orderId,@Param("ids") List<Long> ids, @Param("deleted") Integer deleted, @Param("organId") Long organId);
|
||||
|
||||
void deletedById(@Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
@@ -108,15 +108,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
|
||||
default List<GoodsDO> selectListByGoodsIdList(List<String> goodsIds,List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.in(GoodsDO::getGoodsId, goodsIds)
|
||||
.in(GoodsDO::getOrderId, orderIds));
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<GoodsDO> selectPlanGoodsDataSource(@Param("filed") String filed,@Param("planId") Long planId ,@Param("organId") Long organId);
|
||||
|
||||
@@ -133,9 +124,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectOrderGoodsList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
|
||||
|
||||
List<PlateInfoVO> selectOrderGoodsPlateList(@Param("planIds") List<Long> planIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
@@ -160,7 +148,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
}
|
||||
|
||||
|
||||
List<OrderGoodsResp> selectGoodsListByGoodsId(@Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
|
||||
|
||||
IPage<PlateResList> selectPlanGoodsListByPlanId(@Param("page") IPage<PlateResList> page, @Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
@@ -168,23 +155,23 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
List<GoodsReqVO> selectGoodsAndRemainPlate(@Param("ids") List<Long> ids,@Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderRespVOCopy> selectNoPlanOrderList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
|
||||
|
||||
|
||||
default int deletePlanGoods(List<Long> ids, Long organId) {
|
||||
default int deletePlanGoods(List<Long> orderIds,List<Long> ids, Long organId) {
|
||||
return update(new LambdaUpdateWrapper<GoodsDO>()
|
||||
.set(GoodsDO::getPlanId, 0)
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.in(GoodsDO::getOrderId, orderIds)
|
||||
.in(GoodsDO::getPlanId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
default List<GoodsDO> selectPlanGoodsListByPlanIdList(List<Long> planIds, Long organId) {
|
||||
default List<GoodsDO> selectPlanGoodsListByPlanIdList(List<Long> orderIds,List<Long> planIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.inIfPresent(GoodsDO::getOrderId,orderIds)
|
||||
.in(GoodsDO::getPlanId,planIds)
|
||||
.select(GoodsDO::getGoodsId,GoodsDO::getId,GoodsDO::getOrderId));
|
||||
|
||||
@@ -196,7 +183,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
List<OrderRoomBodyList> selectNoPlanRoomBody(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderPlate(@Param("page") IPage page,@Param("organId") Long organId);
|
||||
|
||||
List<Long> selectPlanOrderList(@Param("orderId") Long orderId,@Param("roomIds") Set<Long> roomIds, @Param("bodyId") Long bodyId,@Param("organId") Long organId);
|
||||
|
||||
|
||||
+2
-15
@@ -5,7 +5,6 @@ import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
@@ -79,17 +78,6 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
|
||||
|
||||
|
||||
default List<OrderItemDO> selectPlateIdList(List<Long> plateIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId,organId)
|
||||
.inIfPresent(OrderItemDO::getPlateId, plateIds)
|
||||
.select(OrderItemDO::getBodyId,OrderItemDO::getRoomId,OrderItemDO::getGroupId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default List<OrderItemDO> selectPartsList(List<Long> partIds,List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
@@ -100,12 +88,11 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
|
||||
}
|
||||
|
||||
IPage<OrderRespVOCopy> selectTestNum(@Param("page") IPage page,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<OrderItemDO> selectPackId(List<Long> bodyIds, Long organId) {
|
||||
default List<OrderItemDO> selectPackId(Long orderId,List<Long> bodyIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId,organId)
|
||||
.eq(OrderItemDO::getOrderId,orderId)
|
||||
.inIfPresent(OrderItemDO::getBodyId,bodyIds)
|
||||
.select(OrderItemDO::getPackageId));
|
||||
|
||||
|
||||
+2
-3
@@ -74,9 +74,6 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
||||
|
||||
List<PlateOptimize> selectPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
OptimizeParamRespVO getOptimizePlanParam(Long planId);
|
||||
|
||||
PlanDO selectPlanByOrderIds(@Param("ids") List<Long> ids);
|
||||
|
||||
|
||||
|
||||
@@ -116,6 +113,8 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
||||
|
||||
List<PlanDO> selectPlanStatus(@Param("planIds") List<Long> planIds,@Param("organId") Long organId);
|
||||
|
||||
void updatePlanStatus(@Param("planId") Long planId,@Param("status") Integer status,@Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
// List<PlanDO> seleTestSQL(@Param("sql") String sql);
|
||||
|
||||
+10
-37
@@ -8,8 +8,6 @@ import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPackReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO;
|
||||
@@ -75,11 +73,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
}
|
||||
|
||||
// IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||
List<PlatePage> selectPlatePage( @Param("orderId") Long orderId,@Param("organId") Long organId/*, @Param("goodsId") String goodsId*/);
|
||||
|
||||
IPage<PlateResList> selectPlateByPlanId(@Param("page") IPage<PlateResList> page, @Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
|
||||
|
||||
List<PlateParam> selectPlateList(Long planId);
|
||||
|
||||
|
||||
IPage<PlateRespVO> selectProductList(@Param("page") IPage<PlateRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId,@Param("organId") Long organId);
|
||||
@@ -92,9 +86,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<PlateDetialRespVO> selectPlateDetialList(@Param("orderId") Long orderId,@Param("organId") Long organId);
|
||||
|
||||
|
||||
List<PlateDetialRespVO> selectPlateDetialListByIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 明细
|
||||
|
||||
List<PlateGoodsRespVO> selectPlateGoodsListSummary(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 汇总
|
||||
@@ -131,15 +122,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<NotPlanOrderPlateRespVO> selectGoodsPage( @Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectGoodsList(@Param("page") IPage<OrderGoodsResp> page,@Param("goodsIds") List<Long> goodsIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
List<OrderIds> selectOrderIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
void deletedById(@Param("plateIds") List<Long> plateIds, @Param("organId") Long organId);
|
||||
|
||||
List<GoodsNum> selectGoodsNum(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
default List<PlateDO> selectPlateNum(Long orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
@@ -173,18 +158,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectGoodsPlateList(List<Long> goodIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.inIfPresent(PlateDO::getGoodsId, goodIds));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<PlateDetialRespVO> selectPlateListByGoodIds(@Param("goodIds") List<Long> goodIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
// List<PlateInfoVO> selectPlateArea(@Param("orderIdsList") List<OrderIds> orderIdsList,@Param("organId") Long organId);
|
||||
|
||||
|
||||
@@ -227,16 +200,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateIds(OrderPageReqVOCopy pageReqVO, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.eqIfPresent(PlateDO::getIsSpecialShaped,pageReqVO.getSpecialShaped())
|
||||
.eqIfPresent(PlateDO::getIsDoor,pageReqVO.getIsDoor())
|
||||
.select(PlateDO::getGoodsId));
|
||||
|
||||
}
|
||||
|
||||
List<PlatePage> selectNoPlanPlateList(@Param(Constants.WRAPPER) Wrapper<PlateDO> queryWrapperX2);
|
||||
|
||||
|
||||
@@ -264,6 +227,16 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateIsOptimized(Long orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.eqIfPresent(PlateDO::getOrderId,orderId)
|
||||
.eq(PlateDO::getIsOptimized,true));
|
||||
|
||||
}
|
||||
|
||||
// List<PlateDO> selectTestSQL(@Param("sql") String sql);
|
||||
|
||||
|
||||
|
||||
+4
@@ -19,6 +19,10 @@ public interface OptimizePlanService {
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
|
||||
String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
Boolean addRemain(AddRemainReqVO vo);
|
||||
|
||||
+104
-64
@@ -8,14 +8,13 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessGroupList;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessStepAreaIds;
|
||||
@@ -29,7 +28,6 @@ import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
@@ -47,7 +45,6 @@ import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.cf.imes.module.system.api.process.ProcessApi;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessDTO;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -60,10 +57,10 @@ import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||
@@ -173,6 +170,13 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
if(!optimizeBoardModelDO.getIsOptimized()){
|
||||
|
||||
throw exception(ORDER_PLAN_NO_OPTIMIZE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<Long> plateNo = new ArrayList<>();
|
||||
|
||||
// 创建一个列表存储 BlockPlaceInfo 对象,将优化的小板信息拿出,获取到小板编号,查询生产单,修改生产单的状态
|
||||
@@ -220,16 +224,18 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
long cutedBoardNumber = cutedBoardInfo.getCutedBoardNumber() == null ? 0 : cutedBoardInfo.getCutedBoardNumber();
|
||||
|
||||
|
||||
cutedBoardNumber += goodsNo.size();
|
||||
|
||||
|
||||
// 获取原排单的已开料的大板编号
|
||||
List<Long> cutedBoardList = cutedBoardInfo.getCutedBoardList() == null ? new ArrayList<>() : cutedBoardInfo.getCutedBoardList();
|
||||
|
||||
goodsNo.addAll(cutedBoardList);
|
||||
|
||||
// 将新开料的大板编号添加到已开料的大板编号中
|
||||
cutedBoardList.addAll(goodsNo);
|
||||
cutedBoardList.addAll(Stream.concat(
|
||||
cutedBoardList.stream().filter(str -> !goodsNo.contains(str)),
|
||||
goodsNo.stream().filter(str -> !cutedBoardList.contains(str)))
|
||||
.toList());
|
||||
|
||||
cutedBoardNumber = cutedBoardList.size();
|
||||
|
||||
// 将需要更新更新的数据更新到原数据中
|
||||
cutedBoardInfo.setCutedBoardNumber(cutedBoardNumber);
|
||||
@@ -289,6 +295,13 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
if(!optimizeBoardModelDO.getIsOptimized()){
|
||||
|
||||
throw exception(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
CutedBoardInfo cutedBoardInfo = optimizeBoardModelDO.getCutedBoardInfo() == null ? new CutedBoardInfo() : optimizeBoardModelDO.getCutedBoardInfo();
|
||||
|
||||
|
||||
@@ -324,16 +337,16 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
if(cutedBoardInfo.getCutedBoardNumber() == 0){
|
||||
|
||||
planDO.setStatus(PlanStatusEnum.NOCUTTING.getStatus());
|
||||
planDO.setProduceTime(null);
|
||||
planMapper.updateById(planDO);
|
||||
// planDO.setStatus(PlanStatusEnum.NOCUTTING.getStatus());
|
||||
// planDO.setProduceTime(null);
|
||||
planMapper.updatePlanStatus(planId,PlanStatusEnum.NOCUTTING.getStatus(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) && cutedBoardInfo.getCutedBoardNumber() > 0 && cutedBoardInfo.getCutedBoardNumber() < optimizeBoardModelDO.getBoardCount() ){
|
||||
planDO.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
planDO.setProduceTime(null);
|
||||
planMapper.updateById(planDO);
|
||||
// planDO.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
// planDO.setProduceTime(null);
|
||||
planMapper.updatePlanStatus(planId,PlanStatusEnum.OPENING.getStatus(),getUserOrganId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -349,46 +362,48 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean endCutting(Long planId) {
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
if (Objects.isNull(planDO)) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
planMapper.updateById(PlanDO.builder()
|
||||
.id(planId)
|
||||
.status(PlanStatusEnum.OPENED.getStatus())
|
||||
.produceTime(LocalDateTime.now())
|
||||
.build());
|
||||
|
||||
LoginUser loginUser = getLoginUser();
|
||||
List<ProcessDTO> userProcess = processApi.getUserProcess(loginUser.getId());
|
||||
|
||||
if(!userProcess.isEmpty()) {
|
||||
|
||||
List<Long> processStepIds = new ArrayList<>();
|
||||
|
||||
List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||
|
||||
List<ProcessStepDO> processStepDOS = processStepMapper.selectOrderList(orderIds, getUserOrganId());
|
||||
|
||||
|
||||
for (ProcessDTO process : userProcess) {
|
||||
processStepIds.addAll(processStepDOS.stream().filter(f -> Objects.equals(f.getProcessinfoId(), process.getId()))
|
||||
.map(ProcessStepDO::getId).toList());
|
||||
}
|
||||
|
||||
|
||||
if(!processStepIds.isEmpty()) {
|
||||
|
||||
List<ProcessStepSalaryIds> processStepSalaryIds = calculateSalary(processStepIds);
|
||||
|
||||
// 修改生产明细表和步骤表的工序状态
|
||||
processStepMapper.updateStatus(processStepSalaryIds, loginUser.getNickname());
|
||||
|
||||
processStepItemMapper.updateStatus(processStepIds);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 目前结束开料已去掉,所以这些代码先注释,后面如果加再修改逻辑
|
||||
//
|
||||
// PlanDO planDO = planMapper.selectById(planId);
|
||||
// if (Objects.isNull(planDO)) {
|
||||
// throw exception(PLAN_NOT_EXISTS);
|
||||
// }
|
||||
// planMapper.updateById(PlanDO.builder()
|
||||
// .id(planId)
|
||||
// .status(PlanStatusEnum.OPENED.getStatus())
|
||||
// .produceTime(LocalDateTime.now())
|
||||
// .build());
|
||||
//
|
||||
// LoginUser loginUser = getLoginUser();
|
||||
// List<ProcessDTO> userProcess = processApi.getUserProcess(loginUser.getId());
|
||||
//
|
||||
// if(!userProcess.isEmpty()) {
|
||||
//
|
||||
// List<Long> processStepIds = new ArrayList<>();
|
||||
//
|
||||
// List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||
//
|
||||
// List<ProcessStepDO> processStepDOS = processStepMapper.selectOrderList(orderIds, getUserOrganId());
|
||||
//
|
||||
//
|
||||
// for (ProcessDTO process : userProcess) {
|
||||
// processStepIds.addAll(processStepDOS.stream().filter(f -> Objects.equals(f.getProcessinfoId(), process.getId()))
|
||||
// .map(ProcessStepDO::getId).toList());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if(!processStepIds.isEmpty()) {
|
||||
//
|
||||
// List<ProcessStepSalaryIds> processStepSalaryIds = calculateSalary(processStepIds);
|
||||
//
|
||||
// // 修改生产明细表和步骤表的工序状态
|
||||
// processStepMapper.updateStatus(processStepSalaryIds, loginUser.getNickname());
|
||||
//
|
||||
// processStepItemMapper.updateStatus(processStepIds);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -503,6 +518,10 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<PrintOrderPartsRespVO> printOrderPartsRespVOS = orderPartsMapper.selectPartList(Collections.singletonList(orderId), getUserOrganId());
|
||||
|
||||
|
||||
// 查询生产单对应的配件的ES信息
|
||||
List<OrderPartsRemark> orderPartsRemarks = buildOrderPartsByOrderId(Collections.singletonList(orderId), ORDER_PARTS_REMARK_MODEL, printOrderPartsRespVOS.size());
|
||||
|
||||
|
||||
// 查询生产单对应的包裹信息
|
||||
List<PrintOrderPackReqVO> printOrderPackReqVOS = plateMapper.selectOrderPackList(orderId,getUserOrganId());
|
||||
|
||||
@@ -514,14 +533,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.forEach(f->f.setPackNum(printOrderPackReqVOS.stream().filter(e -> e.getOrderId().equals(orderId)).map(PrintOrderPackReqVO::getPackId).toList().size()));
|
||||
|
||||
|
||||
// orderSource.setOrderList(Collections.singletonList(orderDO));
|
||||
// orderSource.setPlateList(plateDOS);
|
||||
// orderSource.setGoodsList(goodsDOS);
|
||||
// orderSource.setPlateModels(orderModelDOS);
|
||||
// orderSource.setOptimizeBoardModelDOS(optimizeBoardModelDOS);
|
||||
// orderSource.setOrderPartsRespVOS(printOrderPartsRespVOS);
|
||||
// orderSource.setOrderPackReqVOS(printOrderPackReqVOS);
|
||||
|
||||
return OrderSource.builder()
|
||||
.orderList(Collections.singletonList(orderDO))
|
||||
.goodsList(goodsDOS)
|
||||
@@ -529,6 +540,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.plateModels(orderModelDOS)
|
||||
.optimizeBoardModelDOS(optimizeBoardModelDOS)
|
||||
.orderPartsRespVOS(printOrderPartsRespVOS)
|
||||
.orderPartsRemarks(orderPartsRemarks)
|
||||
.orderPackReqVOS(printOrderPackReqVOS)
|
||||
.build();
|
||||
|
||||
@@ -607,6 +619,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 查询生产单对应的配件信息
|
||||
List<PrintOrderPartsRespVO> printOrderPartsRespVOS = orderPartsMapper.selectPartList(orderIds, getUserOrganId());
|
||||
|
||||
// 查询生产单对应的配件的ES信息
|
||||
List<OrderPartsRemark> orderPartsRemarks = buildOrderPartsByOrderId(orderIds, ORDER_PARTS_REMARK_MODEL, printOrderPartsRespVOS.size());
|
||||
|
||||
// 查询生产单对应的包裹信息
|
||||
List<PrintOrderPackReqVO> printOrderPackReqVOS = plateMapper.selectPlanPackList(ids,getUserOrganId());
|
||||
|
||||
@@ -631,6 +646,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.optimizeBoardModelDOS(optimizeBoardModelDOS)
|
||||
.optimizeRemainPlates(optimizeRemainPlates)
|
||||
.orderPartsRespVOS(printOrderPartsRespVOS)
|
||||
.orderPartsRemarks(orderPartsRemarks)
|
||||
.orderPackReqVOS(printOrderPackReqVOS)
|
||||
.build();
|
||||
}
|
||||
@@ -707,7 +723,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 保存优化后的大板数据
|
||||
batchSaveBoardModel(req.getOptimizeBoardModelDOS());
|
||||
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectPlanGoodsListByPlanIdList(planIds, getUserOrganId());
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectPlanGoodsListByPlanIdList(null,planIds, getUserOrganId());
|
||||
|
||||
List<Long> ids = goodsDOS.stream().map(GoodsDO::getId).distinct().toList();
|
||||
|
||||
@@ -943,6 +959,30 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
public List<OrderPartsRemark> buildOrderPartsByOrderId(List<Long> orderIds, String index, Integer size) {
|
||||
List<FieldValue> fieldValues = orderIds.stream().map(FieldValue::of).toList();
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.terms(b -> b.field("orderId").terms(e -> e.value(fieldValues))));
|
||||
try {
|
||||
SearchResponse<OrderPartsRemark> search = elasticsearchClient.search(builder.build(), OrderPartsRemark.class);
|
||||
List<Hit<OrderPartsRemark>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void deleteByPlanId(List<Long> planIds, String index) {
|
||||
List<FieldValue> fieldValues = planIds.stream().map(FieldValue::of).toList();
|
||||
|
||||
|
||||
+106
-97
@@ -58,8 +58,10 @@ import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.ExcelTy
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO.OrderXmlVO;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.xml.XmlTypeRealize;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -259,7 +261,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeleteBody(Long orderId, Set<Long> roomIds, Long bodyId, Integer status) { // 要删除传1,还原传0
|
||||
// 判断生产单的状态和生产单柜体对应的板擦是否已开料
|
||||
List<Long> planIds = validateOrderStatus(orderId, roomIds, bodyId, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
List<Long> planIds = validateOrderStatus(orderId, roomIds, bodyId, getUserOrganId());
|
||||
|
||||
List<Long> bodyIds = new ArrayList<>();
|
||||
Integer index = status == 1 ? 0 : 1;
|
||||
@@ -274,6 +276,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (bodyIds.size() != 0){
|
||||
|
||||
List<PlateDO> plateDOList = plateMapper.selectPlateTypeByRoomId(orderId, bodyIds, getUserOrganId(), index);
|
||||
|
||||
|
||||
List<Long> plateIds = plateDOList.stream().map(PlateDO::getId).toList();
|
||||
|
||||
List<Long> goodsIds = plateDOList.stream().map(PlateDO::getGoodsId).distinct().toList();
|
||||
@@ -284,63 +288,60 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
if (!plateDOList.isEmpty()) {
|
||||
plateMapper.updateDeletedById(plateIds, status, getUserOrganId(), orderId);// 删小板
|
||||
}
|
||||
|
||||
// 删除包裹,只需删除,无需还原
|
||||
List<Long> packIds = orderItemMapper.selectPackId(orderId,bodyIds, getUserOrganId()).stream().map(OrderItemDO::getPackageId).distinct().toList();
|
||||
|
||||
// 删除包裹,只需删除,无需还原
|
||||
List<Long> packIds = orderItemMapper.selectPackId(bodyIds, getUserOrganId()).stream().map(OrderItemDO::getPackageId).distinct().toList();
|
||||
orderPackageMapper.updatePackList(orderId, packIds, getUserOrganId());
|
||||
|
||||
orderPackageMapper.updatePackList(orderId, packIds, getUserOrganId());
|
||||
orderItemMapper.deletePackList(orderId, packIds, getUserOrganId());
|
||||
|
||||
orderItemMapper.deletePackList(orderId, packIds, getUserOrganId());
|
||||
orderPrepackagedMapper.deletePacked(orderId, getUserOrganId());
|
||||
|
||||
orderPrepackagedMapper.deletePacked(orderId,getUserOrganId());
|
||||
List<OrderPackageDO> orderPackageDOS = orderPackageMapper.selectPackStatusList(orderId, getUserOrganId());
|
||||
|
||||
List<OrderPackageDO> orderPackageDOS = orderPackageMapper.selectPackStatusList(orderId, getUserOrganId());
|
||||
if (orderPackageDOS.isEmpty()) {
|
||||
|
||||
if(orderPackageDOS.isEmpty()){
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
orderMapper.updateById(orderDO);
|
||||
|
||||
orderMapper.updateById(orderDO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 删除大板
|
||||
List<PlateDO> goodsList = plateMapper.selectPlateDeletedStatus(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
List<Long> goodsIdList = goodsList.stream().map(PlateDO::getGoodsId).distinct().toList();
|
||||
|
||||
List<Long> goodsIdDeleted = Stream.concat(
|
||||
goodsIds.stream().filter(str -> !goodsIdList.contains(str)),
|
||||
goodsIdList.stream().filter(str -> !goodsIds.contains(str)))
|
||||
.toList();
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, status, getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!planIds.isEmpty()) {
|
||||
// 判断删除的柜体对应的板材是否和排单板材一样
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectPlanGoodsListByPlanIdList(planIds, getUserOrganId());
|
||||
|
||||
// 一样,同时删除排单的信息
|
||||
if(goodsDOS.isEmpty() && status.equals(1)){
|
||||
planService.deletePlan(planIds);
|
||||
}
|
||||
|
||||
// 只要有排单,不管删除的柜体的板材数和排单数一样,都要删除排单对应的优化数据(不用这种写法进行删除时,有时会报错,原因目前还没找到)
|
||||
planService.deleteByPlanId(planIds, ORDER_REMAIN_PLATE_MODEL);
|
||||
|
||||
// 删除大板
|
||||
List<PlateDO> goodsList = plateMapper.selectPlateDeletedStatus(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
List<Long> goodsIdList = goodsList.stream().map(PlateDO::getGoodsId).distinct().toList();
|
||||
|
||||
List<Long> goodsIdDeleted = Stream.concat(
|
||||
goodsIds.stream().filter(str -> !goodsIdList.contains(str)),
|
||||
goodsIdList.stream().filter(str -> !goodsIds.contains(str)))
|
||||
.toList();
|
||||
|
||||
if (goodsIdDeleted.size() > 0) {
|
||||
|
||||
goodsMapper.updateDeletedById(orderId,goodsIdDeleted, status, getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!planIds.isEmpty()) {
|
||||
// 判断删除的柜体对应的板材是否和排单板材一样
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectPlanGoodsListByPlanIdList(null,planIds, getUserOrganId());
|
||||
|
||||
// 一样,同时删除排单的信息
|
||||
if (goodsDOS.isEmpty()) {
|
||||
planService.deletePlan(planIds);
|
||||
} else {
|
||||
// 只要有排单,不管删除的柜体的板材数和排单数一样,都要删除排单对应的优化数据(不用这种写法进行删除时,有时会报错,原因目前还没找到)
|
||||
planService.deleteByPlanId(planIds, ORDER_REMAIN_PLATE_MODEL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(bodyIds, getUserOrganId(), orderId); // 配件
|
||||
if (partsList != null && partsList.size() != 0){
|
||||
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
|
||||
@@ -349,7 +350,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
|
||||
// 生产单柜体数量判断
|
||||
if (orderBodyMapper.selectCountByOrderId(orderId, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus()) == 0) {
|
||||
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());
|
||||
@@ -391,67 +392,67 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 小板还原
|
||||
if (!plateDOList.isEmpty()) {
|
||||
plateMapper.updateDeletedById(plateIds, status, getUserOrganId(), orderId);
|
||||
}
|
||||
|
||||
// 还原大板
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectGoodsListByStatus(orderId, goodsIds, getUserOrganId());
|
||||
if(!goodsDOS.isEmpty()){
|
||||
goodsMapper.updateBatch(goodsDOS.stream().map(m -> m.setDeleted(false)).toList());
|
||||
}
|
||||
|
||||
|
||||
// 当大板对应的小板已经排单时,新建相同类型的大板,并将其他未排单的小板对应的大板ID修改为新的大板ID
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectNoPlanGoodsList(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
List<GoodsDO> goodsList = BeanUtils.toBean(goodsDOList, GoodsDO.class);
|
||||
|
||||
if(!goodsDOList.isEmpty()){
|
||||
|
||||
// 新增的大板信息
|
||||
List<GoodsDO> list = goodsDOList.stream()
|
||||
.peek(m -> {
|
||||
m.setId(null);
|
||||
m.setPlanId(0L);
|
||||
m.setCreateTime(LocalDateTime.now());
|
||||
m.setUpdateTime(LocalDateTime.now());
|
||||
})
|
||||
.toList();
|
||||
|
||||
goodsMapper.insertBatch(list);
|
||||
|
||||
// 构建新的数据集,保存新的大板ID和旧的大板ID,大板的实际ID关联这两个信息
|
||||
List<OrderGoodsIds> orderGoodsIds = BeanUtils.toBean(list, OrderGoodsIds.class);
|
||||
|
||||
List<OrderGoodsIds> orderGoodsIdsList = new ArrayList<>();
|
||||
|
||||
for (GoodsDO goodsDO : goodsList) {
|
||||
orderGoodsIdsList.addAll(orderGoodsIds.stream()
|
||||
.filter(f -> f.getGoodsId().equals(goodsDO.getGoodsId()))
|
||||
// .filter(a -> a.getOldId() == null)
|
||||
.map(m -> m.setOldId(goodsDO.getId())).toList());
|
||||
|
||||
// 还原大板
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectGoodsListByStatus(orderId, goodsIds, getUserOrganId());
|
||||
if (!goodsDOS.isEmpty()) {
|
||||
goodsMapper.updateBatch(goodsDOS.stream().map(m -> m.setDeleted(false)).toList());
|
||||
}
|
||||
|
||||
// 需要修改的小板为未排单的部分,无论其是否删除,都需要修改,但只需修改大板ID即可,其他信息无需修改
|
||||
List<PlateDO> plateDOS = plateMapper.selectNoPlanPlate(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
List<PlateDO> plateList = new ArrayList<>();
|
||||
// 当大板对应的小板已经排单时,新建相同类型的大板,并将其他未排单的小板对应的大板ID修改为新的大板ID
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectNoPlanGoodsList(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
for (OrderGoodsIds ids : orderGoodsIdsList) {
|
||||
List<GoodsDO> goodsList = BeanUtils.toBean(goodsDOList, GoodsDO.class);
|
||||
|
||||
plateList.addAll(plateDOS.stream()
|
||||
.filter(f->f.getGoodsId().equals(ids.getOldId()))
|
||||
.peek(m->{
|
||||
m.setGoodsId(ids.getId());
|
||||
if (!goodsDOList.isEmpty()) {
|
||||
|
||||
// 新增的大板信息
|
||||
List<GoodsDO> list = goodsDOList.stream()
|
||||
.peek(m -> {
|
||||
m.setId(null);
|
||||
m.setPlanId(0L);
|
||||
m.setCreateTime(LocalDateTime.now());
|
||||
m.setUpdateTime(LocalDateTime.now());
|
||||
})
|
||||
.toList());
|
||||
.toList();
|
||||
|
||||
goodsMapper.insertBatch(list);
|
||||
|
||||
// 构建新的数据集,保存新的大板ID和旧的大板ID,大板的实际ID关联这两个信息
|
||||
List<OrderGoodsIds> orderGoodsIds = BeanUtils.toBean(list, OrderGoodsIds.class);
|
||||
|
||||
List<OrderGoodsIds> orderGoodsIdsList = new ArrayList<>();
|
||||
|
||||
for (GoodsDO goodsDO : goodsList) {
|
||||
orderGoodsIdsList.addAll(orderGoodsIds.stream()
|
||||
.filter(f -> f.getGoodsId().equals(goodsDO.getGoodsId()))
|
||||
// .filter(a -> a.getOldId() == null)
|
||||
.map(m -> m.setOldId(goodsDO.getId())).toList());
|
||||
|
||||
}
|
||||
|
||||
// 需要修改的小板为未排单的部分,无论其是否删除,都需要修改,但只需修改大板ID即可,其他信息无需修改
|
||||
List<PlateDO> plateDOS = plateMapper.selectNoPlanPlate(orderId, goodsIds, getUserOrganId());
|
||||
|
||||
List<PlateDO> plateList = new ArrayList<>();
|
||||
|
||||
for (OrderGoodsIds ids : orderGoodsIdsList) {
|
||||
|
||||
plateList.addAll(plateDOS.stream()
|
||||
.filter(f -> f.getGoodsId().equals(ids.getOldId()))
|
||||
.peek(m -> {
|
||||
m.setGoodsId(ids.getId());
|
||||
})
|
||||
.toList());
|
||||
}
|
||||
|
||||
plateMapper.updateBatch(plateList);
|
||||
|
||||
}
|
||||
|
||||
plateMapper.updateBatch(plateList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(bodyIds, getUserOrganId(), orderId); // 配件
|
||||
if (partsList != null && partsList.size() != 0){
|
||||
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
|
||||
@@ -586,6 +587,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public void exportTemplate(HttpServletResponse response, String value) {
|
||||
// 根据type获取文件名称
|
||||
InputStream fis = null;
|
||||
try {
|
||||
// path是指想要下载的文件的路径
|
||||
File file = new File(getSavePath() + File.separator + value);
|
||||
@@ -596,7 +598,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
// 将文件写入输入流
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
InputStream fis = new BufferedInputStream(fileInputStream);
|
||||
fis = new BufferedInputStream(fileInputStream);
|
||||
byte[] buffer = new byte[fis.available()];
|
||||
fis.read(buffer);
|
||||
fis.close();
|
||||
@@ -611,6 +613,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
outputStream.flush();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,15 +921,20 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
// 判断生产单状态是否符合(如果已开料,不允许删除)
|
||||
private List<Long> validateOrderStatus(Long orderId,Set<Long> roomIds, Long bodyId, Long organId, Integer status) {
|
||||
private List<Long> validateOrderStatus(Long orderId,Set<Long> roomIds, Long bodyId, Long organId) {
|
||||
// 校验存在
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId);
|
||||
if (orderDO == null)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
|
||||
|
||||
if (ObjectUtils.isEmpty(roomIds) && ObjectUtils.isEmpty(bodyId)) {
|
||||
throw exception(ORDER_ERROR);
|
||||
}
|
||||
|
||||
// 判断小板是否已开料,已开料不允许删除
|
||||
List<Long> planIds = goodsMapper.selectPlanOrderList(orderId, roomIds, bodyId, organId);
|
||||
if(!planIds.isEmpty() && status.equals(1)) {
|
||||
if(!planIds.isEmpty()) {
|
||||
|
||||
List<PlanDO> planDOS = planMapper.selectPlanStatus(planIds, organId);
|
||||
|
||||
|
||||
+36
-25
@@ -11,7 +11,6 @@ import co.elastic.clients.elasticsearch._types.aggregations.CalendarInterval;
|
||||
import co.elastic.clients.elasticsearch._types.aggregations.DateHistogramAggregation;
|
||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.json.JsonData;
|
||||
import co.elastic.clients.util.NamedValue;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -86,6 +85,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME = "createTime";
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL_GOODS_GROUP_NAME = "goods_group";
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME = "goods_count";
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL_DATE_GROUP_NAME = "date_group";
|
||||
private static final String DATE_TIME_FORMATTER_PATTERN_YEAR_MONTH = "yyyy-M";
|
||||
private static final String DATE_TIME_FORMATTER_PATTERN_YEAR_MONTH_DAY = "yyyy-M-d";
|
||||
private static final String ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME = "goodsId";
|
||||
@@ -427,10 +427,12 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
SearchRequest searchRequest = new SearchRequest.Builder()
|
||||
.size(0)
|
||||
.index(OptimizePlanService.ORDER_REMAIN_PLATE_MODEL)
|
||||
.query(q -> q.range(r -> r.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
.gte(JsonData.of(reqVO.getCreateTime()[0].format(dateTimeFormatter)))
|
||||
.lte(JsonData.of(reqVO.getCreateTime()[1].format(dateTimeFormatter))))
|
||||
)
|
||||
.query(q ->
|
||||
q.bool(b -> b
|
||||
.must(m -> m.range(m1 -> m1.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
.from(reqVO.getCreateTime()[0].format(dateTimeFormatter))
|
||||
.to(reqVO.getCreateTime()[1].format(dateTimeFormatter))))
|
||||
.must(m -> m.match(m2 -> m2.field("organId").query(SecurityFrameworkUtils.getUserOrganId())))))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_GROUP_NAME,
|
||||
agg -> agg.terms(terms -> terms.field(ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME).size(10).order(new NamedValue<>(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME, SortOrder.Desc)))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME, sumAgg -> sumAgg.sum(sum -> sum.field("boardCount")))
|
||||
@@ -456,16 +458,20 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
SearchRequest dateGroupRequest = new SearchRequest.Builder()
|
||||
.size(0)
|
||||
.index(OptimizePlanService.ORDER_REMAIN_PLATE_MODEL)
|
||||
.query(q -> q.range(r -> r.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
.gte(JsonData.of(reqVO.getCreateTime()[0].format(dateTimeFormatter)))
|
||||
.lte(JsonData.of(reqVO.getCreateTime()[1].format(dateTimeFormatter))))
|
||||
.query(q ->
|
||||
q.bool(b -> b
|
||||
.must(m -> m.range(m1 -> m1.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)
|
||||
.from(reqVO.getCreateTime()[0].format(dateTimeFormatter))
|
||||
.to(reqVO.getCreateTime()[1].format(dateTimeFormatter))))
|
||||
.must(m -> m.match(m2 -> m2.field("organId").query(SecurityFrameworkUtils.getUserOrganId())))
|
||||
.must(m -> m.bool(m3 -> m3.must(t -> t.terms(gi -> gi.field(ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME).terms(tv -> tv.value(goodsIdFieldValueList))))))
|
||||
)
|
||||
)
|
||||
.query(q -> q.bool(b -> b.must(m -> m.terms(t -> t.field(ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME).terms(tv -> tv.value(goodsIdFieldValueList))))))
|
||||
.query(q -> q.match(m -> m.field("organId").query(SecurityFrameworkUtils.getUserOrganId())))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_GROUP_NAME,
|
||||
agg -> agg.terms(terms -> terms.field(ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME).order(new NamedValue<>(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME, SortOrder.Desc)))
|
||||
.aggregations("date_group", dateAgg -> dateAgg.dateHistogram(date -> getDateHistogram(unit, date.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME))))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME, sumAgg -> sumAgg.sum(sum -> sum.field("boardCount")))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_GROUP_NAME, agg ->
|
||||
agg.terms(terms -> terms.field(ORDER_REMAIN_PLATE_MODEL_GOODS_ID_NAME))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_DATE_GROUP_NAME, dateAgg -> dateAgg.dateHistogram(date -> getDateHistogram(unit, date.field(ORDER_REMAIN_PLATE_MODEL_CREATE_TIME_FIELDNAME)))
|
||||
.aggregations(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME, sumAgg -> sumAgg.sum(sum -> sum.field("boardCount")))
|
||||
)
|
||||
)
|
||||
.build();
|
||||
response = client.search(dateGroupRequest, Map.class);
|
||||
@@ -475,17 +481,22 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
|
||||
goodsDateAgg.sterms().buckets().array().forEach(goodsDateAggBucket -> {
|
||||
// todo 目前没有发现好的es统计月周的方式,先把年月日查出来转周,后续优化
|
||||
String dateStr = dateToWeekMonth(goodsDateAggBucket.aggregations().get("date_group").dateHistogram().buckets().array().get(0).keyAsString(), unit);
|
||||
double goodsCount = goodsDateAggBucket.aggregations().get(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME).sum().value();
|
||||
OrderGoodsPlateRespVO vo = OrderGoodsPlateRespVO.builder().goodsId(goodsDateAggBucket.key().stringValue()).orderDate(dateStr).orderCount((int) goodsCount).build();
|
||||
List<OrderGoodsPlateRespVO> orderGoodsPlateRespVOS = goodsDateGroupMap.get(dateStr);
|
||||
if (ObjectUtil.isNotNull(orderGoodsPlateRespVOS)) {
|
||||
orderGoodsPlateRespVOS.add(vo);
|
||||
} else {
|
||||
ArrayList<OrderGoodsPlateRespVO> goodsPlateRespVOS = new ArrayList<>();
|
||||
goodsPlateRespVOS.add(vo);
|
||||
goodsDateGroupMap.put(dateStr, goodsPlateRespVOS);
|
||||
}
|
||||
goodsDateAggBucket.aggregations().get(ORDER_REMAIN_PLATE_MODEL_DATE_GROUP_NAME).dateHistogram().buckets().array().forEach(dateHistogramBucket -> {
|
||||
// 时间轴
|
||||
String dateStr = dateToWeekMonth(dateHistogramBucket.keyAsString(), unit);
|
||||
// 时间轴下的boardCount
|
||||
double goodsCount = dateHistogramBucket.aggregations().get(ORDER_REMAIN_PLATE_MODEL_GOODS_COUNT_NAME).sum().value();
|
||||
// goodsid+数量存入map,key:时间轴
|
||||
List<OrderGoodsPlateRespVO> orderGoodsPlateRespVOS = goodsDateGroupMap.get(dateStr);
|
||||
OrderGoodsPlateRespVO vo = OrderGoodsPlateRespVO.builder().goodsId(goodsDateAggBucket.key().stringValue()).orderDate(dateStr).orderCount((int) goodsCount).build();
|
||||
if (ObjectUtil.isNotNull(orderGoodsPlateRespVOS)) {
|
||||
orderGoodsPlateRespVOS.add(vo);
|
||||
} else {
|
||||
ArrayList<OrderGoodsPlateRespVO> goodsPlateRespVOS = new ArrayList<>();
|
||||
goodsPlateRespVOS.add(vo);
|
||||
goodsDateGroupMap.put(dateStr, goodsPlateRespVOS);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -61,7 +61,6 @@ public interface PlanService {
|
||||
|
||||
PageResult<OrderGoodsResp> getOrderGoodsPage(OrderPageReqVOCopy pageReqVO);
|
||||
|
||||
List<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO);
|
||||
|
||||
Boolean addPlate(AddPlateReq req);
|
||||
|
||||
|
||||
+31
-36
@@ -151,7 +151,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
orderIdList.addAll(orderIds);
|
||||
|
||||
// 创建计划
|
||||
// 创建排单
|
||||
PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class);
|
||||
plan.setId(identifierGenerator.nextId(plan).longValue());
|
||||
plan.setSort(0L);
|
||||
@@ -191,7 +191,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
public void updatePlan(PlanSaveReqVO updateReqVO) {
|
||||
|
||||
// 校验排单是否存在,是否开料
|
||||
validatePlanExists(updateReqVO.getId());
|
||||
Long machineId = validatePlanExists(updateReqVO.getId());
|
||||
|
||||
// 更新
|
||||
PlanDO plan = BeanUtils.toBean(updateReqVO, PlanDO.class);
|
||||
@@ -243,6 +243,12 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
if(!machineId.equals(plan.getMachineId())){
|
||||
|
||||
deleteByPlanId(Collections.singletonList(plan.getId()),ORDER_REMAIN_PLATE_MODEL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
planMapper.updateById(plan);
|
||||
@@ -322,7 +328,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<Long> orderIds = new ArrayList<>();
|
||||
for (PlanDO planDO : planDOS) {
|
||||
|
||||
orderIds.addAll(JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class));
|
||||
orderIds.addAll(JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class).stream().distinct().toList());
|
||||
|
||||
}
|
||||
|
||||
@@ -331,44 +337,45 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
remainPlateMapper.deletePlanRemainPlate(ids,getUserOrganId());
|
||||
|
||||
List<Long> goodsIdList = goodsMapper.selectPlanGoodsListByPlanIdList(orderIds,ids, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
// 排单对应的自增板的删除 todo 目前值解决了非混单的情况
|
||||
List<OptimizeBoardModelDO> boardModelDOS = buildBoardByPlanIds(ids, ORDER_REMAIN_PLATE_MODEL, ids.size());
|
||||
if(!boardModelDOS.isEmpty()) {
|
||||
if(!goodsIdList.isEmpty()) {
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIds, goodsIdList, getUserOrganId());
|
||||
|
||||
|
||||
List<Long> goodsIdList = goodsMapper.selectPlanGoodsListByPlanIdList(ids, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
if(!goodsIdList.isEmpty()) {
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIds, goodsIdList, getUserOrganId());
|
||||
}
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(orderIds,goodsIdList, getUserOrganId());
|
||||
if(!plateDOS.isEmpty()) {
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(orderIds, goodsIdList, getUserOrganId());
|
||||
if (!plateDOS.isEmpty()) {
|
||||
List<Long> plateIds = plateDOS.stream().map(PlateDO::getId).toList();
|
||||
|
||||
plateMapper.deleteBatchIds(plateIds);
|
||||
|
||||
orderItemMapper.delete(new LambdaQueryWrapperX<OrderItemDO>().in(OrderItemDO::getPlateId, plateIds));
|
||||
orderItemMapper.delete(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId, getUserOrganId())
|
||||
.in(OrderItemDO::getOrderId, orderIds)
|
||||
.in(OrderItemDO::getPlateId, plateIds));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 排单对应的自增板的删除 todo 目前值解决了非混单的情况
|
||||
List<OptimizeBoardModelDO> boardModelDOS = buildBoardByPlanIds(ids, ORDER_REMAIN_PLATE_MODEL, ids.size());
|
||||
if(!boardModelDOS.isEmpty()) {
|
||||
// 删除排单对应的优化生产数据
|
||||
deleteByPlanId(ids, ORDER_REMAIN_PLATE_MODEL);
|
||||
|
||||
}
|
||||
|
||||
// 删除商品表里的 planId
|
||||
goodsMapper.deletePlanGoods(ids,getUserOrganId());
|
||||
goodsMapper.deletePlanGoods(orderIds,ids,getUserOrganId());
|
||||
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
|
||||
List<Long> diff;
|
||||
|
||||
// 根据生产单ID查询ES的优化数据
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = optimizePlanService.buildBoardByOrderIds(orderIds, ORDER_REMAIN_PLATE_MODEL, 999);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = optimizePlanService.buildBoardByOrderIds(orderIds, ORDER_REMAIN_PLATE_MODEL, 100);
|
||||
|
||||
if(optimizeBoardModelDOS.isEmpty()){
|
||||
|
||||
@@ -594,9 +601,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("op.is_door", pageReqVO.getIsDoor())
|
||||
.betweenIfPresent("op.height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
|
||||
.betweenIfPresent("op.width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()})
|
||||
// .groupBy("o.id", " o.order_date", "o.delivery_date", "o.customer", "o.address", "o.custom_order_no","o.status")
|
||||
// .having("count(op.id) != 0")
|
||||
.orderByDesc("o.order_date");
|
||||
.orderByDesc("o.id");
|
||||
|
||||
String filterTypes = "";
|
||||
if (Objects.nonNull(pageReqVO.getHoleThrough()) && pageReqVO.getHoleThrough()) {
|
||||
@@ -631,7 +636,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.in("order_id",orderIds)
|
||||
.eq("is_optimized",false)
|
||||
.inIfPresent("goods_id",goodsIds)
|
||||
.inIfPresent("id",pageReqVO.getIds())
|
||||
.inIfPresent("goods_id",pageReqVO.getIds())
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getRectangle() != null ? false: null)
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getSpecialShaped())
|
||||
.eqIfPresent("is_sculpt", pageReqVO.getSculpt())
|
||||
@@ -872,15 +877,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO) {
|
||||
|
||||
List<PlatePage> pageRes = plateMapper.selectPlatePage(/*page, */pageVO.getOrderId(),getUserOrganId()/*, pageVO.getGoodsId()*/);
|
||||
return pageRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addPlate(AddPlateReq req) {
|
||||
@@ -1123,17 +1119,16 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
|
||||
private void validatePlanExists(Long id) {
|
||||
private Long validatePlanExists(Long id) {
|
||||
PlanDO planDO = planMapper.selectById(id);
|
||||
// if ( planDO== null) {
|
||||
// throw exception(PLAN_NOT_EXISTS);
|
||||
// }
|
||||
|
||||
AssertUtils.notEmpty(planDO,PLAN_NOT_EXISTS);
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(LIST_CHANGES_ARE_PROHIBITED);
|
||||
}
|
||||
|
||||
return planDO.getMachineId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-69
@@ -42,11 +42,12 @@
|
||||
<update id="updateDeletedById">
|
||||
UPDATE order_goods
|
||||
SET deleted = #{deleted},plan_id = 0
|
||||
WHERE id IN
|
||||
WHERE organ_id = #{organId}
|
||||
and order_id = #{orderId}
|
||||
and id IN
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND organ_id = #{organId}
|
||||
</update>
|
||||
<delete id="deletedById">
|
||||
DELETE FROM order_goods
|
||||
@@ -87,29 +88,6 @@
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderGoodsList" resultMap="OrderGoodsMap">
|
||||
|
||||
select distinct
|
||||
og.goods_name as goodsName,
|
||||
og.material as material,
|
||||
og.color as color,
|
||||
og.width as width,
|
||||
og.height as height,
|
||||
og.thickness as thickness,
|
||||
og.texture as texture,
|
||||
og.goods_id as goodsId
|
||||
-- og.order_id as orderId,
|
||||
-- og.id as id
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="GoodsListMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlateInfoVO">
|
||||
@@ -187,23 +165,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectGoodsListByGoodsId" resultMap="OrderGoodsMap">
|
||||
|
||||
|
||||
select distinct
|
||||
og.goods_id as goodsId,
|
||||
og.order_id as orderId,
|
||||
og.id as id
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlanGoodsListByPlanId"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
||||
|
||||
@@ -256,18 +217,6 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectNoPlanOrderList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
|
||||
|
||||
select distinct og.order_id as orderId,og.create_time as updateTime
|
||||
|
||||
from order_goods og
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.order_id = op.order_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlateListByPlanId"
|
||||
@@ -361,21 +310,6 @@
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectOrderPlate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
|
||||
|
||||
|
||||
select distinct order_id,
|
||||
create_time as updateTime
|
||||
from order_goods
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and plan_id = 0
|
||||
order by create_time;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -45,7 +45,7 @@
|
||||
|
||||
from orders o
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.is_optimized = false
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.is_optimized = false and og.id = op.goods_id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
<result property="texture" column="texture"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="goodsId" column="goodsId"/>
|
||||
|
||||
<collection property="orderIds" ofType="com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds" resultMap="OrderIdMap"/>
|
||||
@@ -239,8 +240,6 @@
|
||||
|
||||
select distinct
|
||||
|
||||
-- og.order_id as orderId,
|
||||
-- og.id as id,
|
||||
og.goods_id as goodsId,
|
||||
|
||||
og.goods_name,
|
||||
@@ -251,13 +250,14 @@
|
||||
og.width,
|
||||
og.height,
|
||||
og.brand,
|
||||
og.remark,
|
||||
og.spec
|
||||
|
||||
from orders o
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.is_optimized = false
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.is_optimized = false and og.id = op.goods_id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
-12
@@ -186,18 +186,6 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectTestNum"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
|
||||
select distinct
|
||||
|
||||
oi.order_id as orderId
|
||||
|
||||
from order_item oi
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
|
||||
where oi.organ_id = #{organId} and opi.item_id is null and oi.plate_id !=0;
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+38
-10
@@ -87,19 +87,47 @@
|
||||
AND organ_id = #{organId}
|
||||
</delete>
|
||||
|
||||
<select id="selectPartList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO">
|
||||
<resultMap id="OrderPartsMap" type="com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO">
|
||||
|
||||
select distinct oi.num as partsNum,
|
||||
<result property="partsNum" column="partsNum"/>
|
||||
<result property="bodyId" column="bodyId"/>
|
||||
<result property="roomId" column="roomId"/>
|
||||
<result property="bodyName" column="bodyName"/>
|
||||
<result property="roomName" column="roomName"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="factory" column="factory"/>
|
||||
<result property="model" column="model"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="orderId" column="orderId"/>
|
||||
<result property="type" column="type"/>
|
||||
|
||||
<collection property="groupId" ofType="java.lang.Long" column="groupId"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectPartList"
|
||||
parameterType="java.lang.Long"
|
||||
resultMap="OrderPartsMap">
|
||||
|
||||
select distinct oi.group_id as groupId,
|
||||
oi.num as partsNum,
|
||||
oi.body_id as bodyId,
|
||||
oi.room_id as roomId,
|
||||
ob.name as bodyName,
|
||||
ob.room_name as roomName,
|
||||
op.id,
|
||||
op.spec,
|
||||
op.brand,
|
||||
op.factory,
|
||||
op.model,
|
||||
op.name,
|
||||
op.order_id
|
||||
op.id as id,
|
||||
op.spec as spec,
|
||||
op.brand as brand,
|
||||
op.factory as factory,
|
||||
op.model as model ,
|
||||
op.name as name,
|
||||
op.order_id as orderId,
|
||||
op.type as type
|
||||
from order_parts op
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.parts_id
|
||||
left join order_body ob on oi.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
+15
-99
@@ -9,103 +9,6 @@
|
||||
文档可见:https://www.cf.com/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<resultMap id="map" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
|
||||
<result column="goods_name" property="goodsName"/>
|
||||
<result column="material" property="material"/>
|
||||
<result column="color" property="color"/>
|
||||
<result column="width" property="width"/>
|
||||
<result column="height" property="height"/>
|
||||
<result column="plateNum" property="plateNum"/>
|
||||
<collection property="plateDOList" javaType="java.util.List" ofType="com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="optimizeMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO">
|
||||
<result column="plan_id" property="planId"/>
|
||||
<result column="plan_no" property="planNo"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="op_type" property="type"/>
|
||||
<result column="op_status" property="status"/>
|
||||
<result column="machine_id" property="machineId"/>
|
||||
<result column="plan_time" property="planTime"/>
|
||||
<result column="op_remark" property="remark"/>
|
||||
<result column="produce_time" property="produceTime" />
|
||||
<result column="operator" property="operator"/>
|
||||
<collection property="plateList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO" >
|
||||
<result column="plateId" property="id"/>
|
||||
<result column="plan_no" property="plateNo"/>
|
||||
<result column="opl_order_id" property="orderId"/>
|
||||
<result column="opl_type" property="type"/>
|
||||
<result column="opl_name" property="name"/>
|
||||
<result column="opl_goods_id" property="goodsId"/>
|
||||
<result column="opl_width" property="width"/>
|
||||
<result column="opl_height" property="height"/>
|
||||
<result column="opl_thickness" property="thickness"/>
|
||||
<result column="split_width" property="splitWidth"/>
|
||||
<result column="split_height" property="splitHeight"/>
|
||||
<result column="split_thickness" property="splitThickness"/>
|
||||
<result property="sealLeft" column="seal_left"/>
|
||||
<result property="sealRight" column="seal_right"/>
|
||||
<result property="sealUp" column="seal_up"/>
|
||||
<result property="sealDown" column="seal_down"/>
|
||||
<result property="area" column="area"/>
|
||||
<result property="texture" column="texture"/>
|
||||
<result property="holeFace" column="hole_face"/>
|
||||
<result property="holeArrange" column="hole_arrange"/>
|
||||
<result property="unregularPointCount" column="unregular_point_count"/>
|
||||
<result property="frontHoleCount" column="front_hole_count"/>
|
||||
<result property="backHoleCount" column="back_hole_count"/>
|
||||
<result property="sideHoleCount" column="side_hole_count"/>
|
||||
<result property="frontModelCount" column="front_model_count"/>
|
||||
<result property="backModelCount" column="back_model_count"/>
|
||||
<result property="isDoor" column="is_door"/>
|
||||
<result property="openDoorType" column="open_door_type"/>
|
||||
<result property="offsetX" column="offset_x"/>
|
||||
<result property="offsetY" column="offset_y"/>
|
||||
<result property="isArcAcross" column="is_arc_across"/>
|
||||
<result property="moduleTypeId" column="module_type_id"/>
|
||||
<result property="filterType" column="filter_type"/>
|
||||
<result property="isCancel" column="is_cancel"/>
|
||||
<result property="remark" column="opl_remark"/>
|
||||
<result property="createTime" column="opl_create_time"/>
|
||||
</collection>
|
||||
<collection property="orderList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderResp">
|
||||
<result property="orderId" column="o_id"/>
|
||||
<result property="type" column="o_type"/>
|
||||
<result property="status" column="o_status"/>
|
||||
<result property="dataType" column="data_type"/>
|
||||
<result property="customOrderNo" column="custom_order_no"/>
|
||||
<result column="customer" property="customer"/>
|
||||
<result column="address" property="address"/>
|
||||
<result column="phone_number" property="phoneNumber"/>
|
||||
<result column="dealer" property="dealer"/>
|
||||
<result column="dealer_phone_number" property="dealerPhoneNumber"/>
|
||||
<result column="salesman" property="salesman"/>
|
||||
<result column="splitter" property="splitter"/>
|
||||
<result column="o_status" property="status"/>
|
||||
<result column="delivery_date" property="deliveryDate"/>
|
||||
<result column="o_remark" property="remark"/>
|
||||
</collection>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getOptimizePlanParam" resultMap="optimizeMap">
|
||||
select distinct op.id as plan_id, op.plan_no, op.type as op_type, op.status as op_status, op.machine_id, op.plan_time, op.produce_time, op.remark as op_remark, op.operator,
|
||||
oi.order_id, opl.id as plateId, opl.order_id opl_order_id, opl.name opl_name, opl.plate_no, opl.type as opl_type, opl.goods_id as opl_goods_id, opl.width opl_width,
|
||||
opl.height opl_height, opl.thickness as opl_thickness, opl.split_width, opl.split_height, opl.split_thickness, opl.seal_left, opl.seal_right,
|
||||
opl.seal_up, opl.seal_down, opl.area, opl.texture, opl.hole_face, opl.hole_arrange, opl.unregular_point_count, opl.front_hole_count,
|
||||
opl.back_hole_count, opl.side_hole_count, opl.front_model_count, opl.back_model_count, opl.is_door, opl.open_door_type, opl.offset_x, opl.offset_y,
|
||||
opl.is_arc_across, opl.module_type_id, opl.filter_type, opl.remark opl_remark, opl.is_cancel, opl.create_time as opl_create_time,
|
||||
o.id as o_id, o.type as o_type, o.data_type, o.status o_status, o.custom_order_no, o.customer,
|
||||
o.address, o.phone_number, o.dealer, o.dealer_phone_number, o.salesman, o.splitter, o.remark as o_remark, o.delivery_date
|
||||
from order_plan op
|
||||
left JOIN order_plan_item opi on op.id = opi.plan_id
|
||||
left join order_item oi on opi.item_id = oi.id
|
||||
left join order_plate opl on oi.plate_id = opl.id
|
||||
left join `orders` o on oi.order_id = o.id
|
||||
where op.id = #{planId}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateListByPlanId"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize"
|
||||
@@ -121,8 +24,6 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlanByOrderIds" resultType="com.cf.imes.module.executor.dal.dataobject.plan.PlanDO"></select>
|
||||
|
||||
<select id="selectPlanCountGroupByCreateTime"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsCountRespVO">
|
||||
select
|
||||
@@ -224,4 +125,19 @@
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updatePlanStatus">
|
||||
|
||||
UPDATE order_plan
|
||||
|
||||
SET status = #{status}, produce_time = null
|
||||
|
||||
WHERE organ_id = #{organId}
|
||||
and deleted = false
|
||||
and id = #{planId}
|
||||
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
+1
-1
@@ -60,7 +60,7 @@
|
||||
where g.deleted = 0
|
||||
and o.order_date between #{req.createTime[0]} and #{req.createTime[1]}
|
||||
group by g.goods_id
|
||||
order by orderArea
|
||||
order by orderArea desc
|
||||
limit 10;
|
||||
</select>
|
||||
|
||||
|
||||
+6
-347
@@ -3,57 +3,6 @@
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.plate.PlateMapper">
|
||||
|
||||
|
||||
<select id="selectPlatePage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
|
||||
select distinct a.id as plateId, a.name, a.width, a.height, a.thickness, a.area,
|
||||
b.custom_order_no, b.customer, b.address, b.remark, b.id as orderId,
|
||||
c.goods_name, c.material, c.color, a.goods_id,oi.num,a.is_special_shaped as specialShaped,a.is_sculpt as profiling
|
||||
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
<where>
|
||||
a.organ_id = #{organId}
|
||||
and a.is_cancel = 0
|
||||
and opi.item_id is null
|
||||
<if test="orderId !=null">
|
||||
and a.order_id = #{orderId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateByPlanId"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
||||
select distinct a.id as plateId,a.order_id, a.plate_no , a.name as plateName,a.is_special_shaped,a.is_sculpt,a.area,a.seal_left,a.seal_right,a.seal_up,a.seal_down, e.material, e.color, a.width, a.height, a.thickness, b.room_id, b.body_id
|
||||
from order_plate a
|
||||
LEFT JOIN order_item b ON a.id = b.plate_id AND a.order_id = b.order_id and a.organ_id = b.organ_id
|
||||
LEFT JOIN order_goods e ON e.id = a.goods_id AND e.order_id = a.order_id and e.organ_id = a.organ_id
|
||||
LEFT JOIN order_plan_item p ON b.id = p.item_id and b.organ_id = p.organ_id
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectPlateList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateParam">
|
||||
select distinct a.id,
|
||||
a.plate_no,
|
||||
a.height length,
|
||||
a.width,
|
||||
a.texture,
|
||||
a.hole_arrange,
|
||||
a.hole_face,
|
||||
if((count(a.unregular_point_count) = 0), 1, 0) as isRect
|
||||
from order_plate a
|
||||
left join order_item b on a.id = b.plate_id
|
||||
where b.plan_id = #{planId}
|
||||
group by a.id
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectProductList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
|
||||
@@ -241,74 +190,6 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlateDetialListByIds"
|
||||
resultMap="PlateDetialMap"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
select distinct
|
||||
oi.group_id as groupId,
|
||||
og.name as groupName,
|
||||
op.id as plateId,
|
||||
op.order_id as orderId,
|
||||
op.name as name,
|
||||
op.plate_no as plateNo,
|
||||
op.type as type,
|
||||
op.goods_id as goodsId,
|
||||
ogs.goods_id as plateGoodsId,
|
||||
op.width as width,
|
||||
op.height as height,
|
||||
op.thickness as thickness,
|
||||
op.split_width as splitWidth,
|
||||
op.split_height as splitHeight,
|
||||
op.split_thickness as splitThickness,
|
||||
op.seal_left as sealLeft,
|
||||
op.seal_right as sealRight,
|
||||
op.seal_up as sealUp,
|
||||
op.seal_down as sealDown,
|
||||
op.area as area,
|
||||
op.texture as texture,
|
||||
op.hole_face as holeFace,
|
||||
op.hole_arrange as holeArrange,
|
||||
op.unregular_point_count as unregularPointCount,
|
||||
op.front_hole_count as frontHoleCount,
|
||||
op.back_hole_count as backHoleCount,
|
||||
op.side_hole_count as sideHoleCount,
|
||||
op.front_model_count as frontModelCount,
|
||||
op.back_model_count as backModelCount,
|
||||
op.is_door as isDoor,
|
||||
op.open_door_type as openDoorType,
|
||||
op.offset_x as offsetX,
|
||||
op.offset_y as offsetY,
|
||||
op.is_arc_across as isArcAcross,
|
||||
op.module_type_id as moduleTypeId,
|
||||
op.is_special_shaped as isSpecialShaped,
|
||||
op.is_sculpt as isSculpt,
|
||||
op.is_row_hole as hasHole,
|
||||
op.remark as remark,
|
||||
op.filter_type as filterType,
|
||||
op.is_cancel as isCancel,
|
||||
ogs.goods_name as goodsName,
|
||||
ob.id as bodyId,
|
||||
ob.room_id as roomId,
|
||||
ob.name as bodyName,
|
||||
ob.room_name as roomName,
|
||||
op.is_row_hole as hasHole
|
||||
from order_plate op
|
||||
join order_goods ogs on op.goods_id = ogs.id and op.organ_id = ogs.organ_id
|
||||
join order_item oi on op.id = oi.plate_id and op.organ_id = oi.organ_id
|
||||
join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id
|
||||
left join order_group og on oi.group_id = og.id and oi.organ_id = og.organ_id
|
||||
|
||||
where op.organ_id = #{organId} and op.deleted = false and op.id in
|
||||
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
|
||||
#{orderIds}
|
||||
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlateGoodsList" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
|
||||
|
||||
@@ -401,13 +282,12 @@
|
||||
<update id="updateDeletedById">
|
||||
UPDATE order_plate
|
||||
SET deleted = #{deleted},is_optimized = false
|
||||
WHERE id IN
|
||||
<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}
|
||||
WHERE organ_id = #{organId}
|
||||
and order_id = #{orderId}
|
||||
and id IN
|
||||
<foreach item="plateId" collection="plateIds" open="(" separator="," close=")">
|
||||
#{plateId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
@@ -540,130 +420,6 @@
|
||||
|
||||
|
||||
|
||||
<resultMap id="GoodsList" type="com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp">
|
||||
|
||||
<result property="goodsId" column="goodsId"/>
|
||||
<result property="goodsName" column="goodsName"/>
|
||||
<result property="width" column="width"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="thickness" column="thickness"/>
|
||||
<result property="material" column="material"/>
|
||||
<result property="color" column="color"/>
|
||||
<result property="num" column="num"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectGoodsList"
|
||||
resultMap="GoodsList"
|
||||
parameterType="map">
|
||||
|
||||
|
||||
|
||||
select distinct
|
||||
c.goods_id as goodsId,
|
||||
c.width as width,
|
||||
c.height as height,
|
||||
c.thickness as thickness,
|
||||
c.goods_name as goodsName,
|
||||
c.material as material,
|
||||
c.color as color,
|
||||
count(distinct a.id)
|
||||
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
-- LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
where
|
||||
c.organ_id = #{organId}
|
||||
and a.is_cancel = 0
|
||||
and b.status = 2
|
||||
and a.deleted = false
|
||||
and opi.item_id is null
|
||||
and c.goods_id in
|
||||
<foreach item="goodsIds" collection="goodsIds" open="(" separator="," close=")">
|
||||
#{goodsIds}
|
||||
</foreach>
|
||||
|
||||
group by c.goods_id,c.id,b.id ,c.goods_name,c.width,c.height,c.thickness, c.material, c.color;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderIds" resultType="com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds" parameterType="map">
|
||||
select distinct
|
||||
a.order_id as orderId,
|
||||
c.id as id,
|
||||
c.goods_id as goodsId
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
where
|
||||
c.organ_id = #{organId}
|
||||
and a.deleted = false
|
||||
and opi.item_id is null
|
||||
and c.order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
order by a.order_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- select distinct
|
||||
a.order_id as orderId,
|
||||
c.id as id,
|
||||
c.goods_id as goodsId
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
where
|
||||
c.organ_id = #{organId}
|
||||
and a.is_cancel = 0
|
||||
and b.status = 2
|
||||
and a.deleted = false
|
||||
and opi.item_id is null
|
||||
and c.order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
order by a.order_id-->
|
||||
|
||||
<select id="selectGoodsNum" resultType="com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum">
|
||||
|
||||
|
||||
select distinct
|
||||
a.order_id as orderId,
|
||||
count(distinct c.id) as goodsNum
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
where
|
||||
c.organ_id = #{organId}
|
||||
and a.is_cancel = 0
|
||||
and b.status = 2
|
||||
and a.deleted = false
|
||||
and opi.item_id is null
|
||||
and c.order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
|
||||
group by orderId
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateTypeByRoomId"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.plate.PlateDO" parameterType="java.lang.Long">
|
||||
@@ -681,103 +437,6 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlateListByGoodIds"
|
||||
resultMap="PlateDetialMap"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
|
||||
select distinct
|
||||
oi.group_id as groupId,
|
||||
og.name as groupName,
|
||||
op.id as plateId,
|
||||
op.order_id as orderId,
|
||||
op.name as name,
|
||||
op.plate_no as plateNo,
|
||||
op.type as type,
|
||||
op.goods_id as goodsId,
|
||||
op.width as width,
|
||||
op.height as height,
|
||||
op.thickness as thickness,
|
||||
op.split_width as splitWidth,
|
||||
op.split_height as splitHeight,
|
||||
op.split_thickness as splitThickness,
|
||||
op.seal_left as sealLeft,
|
||||
op.seal_right as sealRight,
|
||||
op.seal_up as sealUp,
|
||||
op.seal_down as sealDown,
|
||||
op.area as area,
|
||||
op.texture as texture,
|
||||
op.hole_face as holeFace,
|
||||
op.hole_arrange as holeArrange,
|
||||
op.unregular_point_count as unregularPointCount,
|
||||
op.front_hole_count as frontHoleCount,
|
||||
op.back_hole_count as backHoleCount,
|
||||
op.side_hole_count as sideHoleCount,
|
||||
op.front_model_count as frontModelCount,
|
||||
op.back_model_count as backModelCount,
|
||||
op.is_door as isDoor,
|
||||
op.open_door_type as openDoorType,
|
||||
op.offset_x as offsetX,
|
||||
op.offset_y as offsetY,
|
||||
op.is_arc_across as isArcAcross,
|
||||
op.module_type_id as moduleTypeId,
|
||||
op.is_special_shaped as isSpecialShaped,
|
||||
op.is_sculpt as isSculpt,
|
||||
op.is_row_hole as hasHole,
|
||||
op.remark as remark,
|
||||
op.filter_type as filterType,
|
||||
op.is_cancel as isCancel,
|
||||
ob.id as bodyId,
|
||||
ob.room_id as roomId,
|
||||
ob.name as bodyName,
|
||||
ob.room_name as roomName,
|
||||
op.is_row_hole as hasHole
|
||||
|
||||
from order_plate op
|
||||
left join order_item oi on op.id = oi.plate_id and op.organ_id = oi.organ_id
|
||||
left join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id
|
||||
left join order_group og on oi.group_id = og.id and oi.organ_id = og.organ_id
|
||||
|
||||
where op.organ_id = #{organId} and op.deleted = false and op.goods_id in
|
||||
|
||||
<foreach collection="goodIds" item="goodIds" open="(" close=")" separator=",">
|
||||
|
||||
#{goodIds}
|
||||
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<!-- <select id="selectPlateArea"-->
|
||||
<!-- resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateInfoVO">-->
|
||||
|
||||
<!-- select-->
|
||||
<!-- og.goods_id as goodsId,-->
|
||||
<!---- count(distinct og.id) as optimizeGoodsCount,-->
|
||||
<!-- sum(op.area) as area-->
|
||||
|
||||
<!-- from order_plate op-->
|
||||
<!-- left join order_goods og on op.goods_id = og.id-->
|
||||
|
||||
<!-- where og.organ_id = #{organId} and og.goods_id in-->
|
||||
|
||||
<!-- <foreach collection="orderIdsList" item="orderIdsList" open="(" close=")" separator=",">-->
|
||||
<!-- (#{orderIdsList.goodsId})-->
|
||||
<!-- </foreach>-->
|
||||
|
||||
<!-- and og.order_id in-->
|
||||
|
||||
<!-- <foreach collection="orderIdsList" item="orderIdsList" open="(" close=")" separator=",">-->
|
||||
<!-- (#{orderIdsList.orderId})-->
|
||||
<!-- </foreach>-->
|
||||
|
||||
<!-- group by goodsId;-->
|
||||
|
||||
|
||||
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectPlanPlateListDataSource" resultType="java.util.Map">
|
||||
|
||||
|
||||
-84
@@ -42,20 +42,6 @@ public class GoodsServiceImplTest extends BaseDbUnitTest {
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateGoods_success() {
|
||||
// // 准备参数
|
||||
// GoodsSaveReqVO createReqVO = randomPojo(GoodsSaveReqVO.class).setId(null);
|
||||
//
|
||||
// // 调用
|
||||
// Long goodsId = goodsService.createCorrespondsGoods(createReqVO);
|
||||
// // 断言
|
||||
// assertNotNull(goodsId);
|
||||
// // 校验记录的属性是否正确
|
||||
// GoodsDO goods = goodsMapper.selectById(goodsId);
|
||||
// assertPojoEquals(createReqVO, goods, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateGoods_success() {
|
||||
// mock 数据
|
||||
@@ -105,74 +91,4 @@ public class GoodsServiceImplTest extends BaseDbUnitTest {
|
||||
assertServiceException(() -> goodsService.deleteGoods(id), GOODS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetGoodsPage() {
|
||||
/* // mock 数据
|
||||
GoodsDO dbGoods = randomPojo(GoodsDO.class, o -> { // 等会查询到
|
||||
o.setOrderId(null);
|
||||
o.setGoodsId(null);
|
||||
o.setGoodsName(null);
|
||||
o.setMaterial(null);
|
||||
o.setColor(null);
|
||||
o.setWidth(null);
|
||||
o.setHeight(null);
|
||||
o.setThickness(null);
|
||||
o.setPrice(null);
|
||||
o.setBrand(null);
|
||||
o.setSpec(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
goodsMapper.insert(dbGoods);
|
||||
// 测试 orderNo 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setOrderId(null)));
|
||||
// 测试 goodsId 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setGoodsId(null)));
|
||||
// 测试 goodsName 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setGoodsName(null)));
|
||||
// 测试 material 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setMaterial(null)));
|
||||
// 测试 color 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setColor(null)));
|
||||
// 测试 width 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setWidth(null)));
|
||||
// 测试 height 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setHeight(null)));
|
||||
// 测试 thickness 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setThickness(null)));
|
||||
// 测试 price 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setPrice(null)));
|
||||
// 测试 brand 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setBrand(null)));
|
||||
// 测试 spec 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setSpec(null)));
|
||||
// 测试 remark 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
goodsMapper.insert(cloneIgnoreId(dbGoods, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
GoodsPageReqVO reqVO = new GoodsPageReqVO();
|
||||
reqVO.setOrderId(null);
|
||||
reqVO.setGoodsId(null);
|
||||
reqVO.setGoodsName(null);
|
||||
reqVO.setMaterial(null);
|
||||
reqVO.setColor(null);
|
||||
reqVO.setWidth(null);
|
||||
reqVO.setHeight(null);
|
||||
reqVO.setThickness(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setBrand(null);
|
||||
reqVO.setSpec(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<GoodsDO> pageResult = goodsService.getGoodsPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbGoods, pageResult.getList().get(0));*/
|
||||
}
|
||||
|
||||
}
|
||||
-116
@@ -1,8 +1,6 @@
|
||||
package com.cf.imes.module.executor.service.plan;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -11,23 +9,12 @@ import com.cf.imes.framework.test.core.ut.BaseDbUnitTest;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.test.core.util.AssertUtils.*;
|
||||
import static com.cf.imes.framework.test.core.util.RandomUtils.*;
|
||||
import static com.cf.imes.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static com.cf.imes.framework.common.util.object.ObjectUtils.*;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link PlanServiceImpl} 的单元测试类
|
||||
*
|
||||
@@ -42,20 +29,6 @@ public class PlanServiceImplTest extends BaseDbUnitTest {
|
||||
@Resource
|
||||
private PlanMapper planMapper;
|
||||
|
||||
// @Test
|
||||
// public void testCreatePlan_success() {
|
||||
// // 准备参数
|
||||
// PlanSaveReqVO createReqVO = randomPojo(PlanSaveReqVO.class).setId(null);
|
||||
//
|
||||
// // 调用
|
||||
// Long planId = planService.createPlan(createReqVO);
|
||||
// // 断言
|
||||
// assertNotNull(planId);
|
||||
// // 校验记录的属性是否正确
|
||||
// PlanDO plan = planMapper.selectById(planId);
|
||||
// assertPojoEquals(createReqVO, plan, "id");
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testUpdatePlan_success() {
|
||||
// mock 数据
|
||||
@@ -82,93 +55,4 @@ public class PlanServiceImplTest extends BaseDbUnitTest {
|
||||
assertServiceException(() -> planService.updatePlan(updateReqVO), PLAN_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testDeletePlan_success() {
|
||||
// // mock 数据
|
||||
// PlanDO dbPlan = randomPojo(PlanDO.class);
|
||||
// planMapper.insert(dbPlan);// @Sql: 先插入出一条存在的数据
|
||||
// // 准备参数
|
||||
// Long id = dbPlan.getId();
|
||||
//
|
||||
// // 调用
|
||||
// planService.deletePlan(id);
|
||||
// // 校验数据不存在了
|
||||
// assertNull(planMapper.selectById(id));
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void testDeletePlan_notExists() {
|
||||
// // 准备参数
|
||||
// Long id = randomLongId();
|
||||
//
|
||||
// // 调用, 并断言异常
|
||||
// assertServiceException(() -> planService.deletePlan(id), PLAN_NOT_EXISTS);
|
||||
// }
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetPlanPage() {
|
||||
// // mock 数据
|
||||
// PlanDO dbPlan = randomPojo(PlanDO.class, o -> { // 等会查询到
|
||||
// o.setPlanNo(null);
|
||||
// o.setSort(null);
|
||||
// o.setType(null);
|
||||
// o.setStatus(null);
|
||||
// o.setIsPay(null);
|
||||
// o.setMachineId(null);
|
||||
// o.setPlanTime(null);
|
||||
// o.setOrderNos(null);
|
||||
// o.setRemark(null);
|
||||
// o.setCreateTime(null);
|
||||
// o.setOperator(null);
|
||||
// o.setProduceTime(null);
|
||||
// });
|
||||
// planMapper.insert(dbPlan);
|
||||
// // 测试 planNo 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setPlanNo(null)));
|
||||
// // 测试 sort 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setSort(null)));
|
||||
// // 测试 type 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setType(null)));
|
||||
// // 测试 status 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setStatus(null)));
|
||||
// // 测试 isPay 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setIsPay(null)));
|
||||
// // 测试 machineId 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setMachineId(null)));
|
||||
// // 测试 planTime 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setPlanTime(null)));
|
||||
// // 测试 orderNos 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setOrderNos(null)));
|
||||
// // 测试 remark 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setRemark(null)));
|
||||
// // 测试 createTime 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setCreateTime(null)));
|
||||
// // 测试 operator 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setOperator(null)));
|
||||
// // 测试 produceTime 不匹配
|
||||
// planMapper.insert(cloneIgnoreId(dbPlan, o -> o.setProduceTime(null)));
|
||||
// // 准备参数
|
||||
// PlanPageReqVO reqVO = new PlanPageReqVO();
|
||||
// reqVO.setPlanNo(null);
|
||||
// reqVO.setSort(null);
|
||||
// reqVO.setType(null);
|
||||
// reqVO.setStatus(null);
|
||||
// reqVO.setIsPay(null);
|
||||
// reqVO.setMachineId(null);
|
||||
// reqVO.setPlanTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
// reqVO.setOrderNos(null);
|
||||
// reqVO.setRemark(null);
|
||||
// reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
// reqVO.setOperator(null);
|
||||
// reqVO.setProduceTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// // 调用
|
||||
// PageResult<PlanRespVO> pageResult = planService.getPlanPage(reqVO);
|
||||
// // 断言
|
||||
// assertEquals(1, pageResult.getTotal());
|
||||
// assertEquals(1, pageResult.getList().size());
|
||||
// assertPojoEquals(dbPlan, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
package com.cf.imes.module.executor.service.zlib;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.handler.codec.compression.JdkZlibDecoder;
|
||||
import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.handler.codec.compression.ZlibDecoder;
|
||||
import com.cf.imes.module.executor.util.CompressTest;
|
||||
import com.cf.imes.module.executor.util.ZLibUtils;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class ZlibTest {
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||
druidDataSource.setUrl("jdbc:mysql://192.168.1.245:3306/cferp_test_1");
|
||||
druidDataSource.setUsername("mes_visitor");
|
||||
druidDataSource.setPassword("cf123456");
|
||||
//创建jdbc模板对象
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate();
|
||||
jdbcTemplate.setDataSource(druidDataSource);
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOrderBoxBlock() throws IOException {
|
||||
List<OrderBoxBlock> list = jdbcTemplate.query("select * from order_box_block limit 10", new BeanPropertyRowMapper<OrderBoxBlock>(OrderBoxBlock.class));
|
||||
for (OrderBoxBlock bean : list) {
|
||||
if (!Objects.isNull(bean.Data)) {
|
||||
byte[] bytes = Arrays.copyOfRange(bean.Data, 2, bean.Data.length - 1);
|
||||
System.out.println( new String(bean.Data));
|
||||
System.out.println( CompressTest.uncompress(new String(bytes)));
|
||||
//System.out.println(new String(ZLibUtils.decompress(bean.Data)));
|
||||
System.err.println("------------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOrderBlockPlanResult() throws UnsupportedEncodingException {
|
||||
List<OrderBlockPlanResult> list = jdbcTemplate.query("select * from order_block_plan_result limit 1", new BeanPropertyRowMapper<OrderBlockPlanResult>(OrderBlockPlanResult.class));
|
||||
for (OrderBlockPlanResult bean : list) {
|
||||
if (!Objects.isNull(bean.PlaceData)) {
|
||||
System.out.println(new String(ZLibUtils.decompress(bean.PlaceData)));
|
||||
System.err.println("------------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
String source = "xxxxxxxxxxaassad";
|
||||
//压缩
|
||||
byte[] compress = ZLibUtils.compress(source.getBytes());
|
||||
String str = new String(compress);
|
||||
System.out.println(str);
|
||||
//解压
|
||||
System.out.println(new String(ZLibUtils.decompress(new ByteArrayInputStream(compress))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void insertByteArray(String tableName, byte[] data, String columnName) {
|
||||
final String sql = "INSERT INTO " + tableName + " (" + columnName + ") VALUES (?)";
|
||||
jdbcTemplate.update(
|
||||
conn -> {
|
||||
PreparedStatement ps = conn.prepareStatement(sql);
|
||||
ps.setBinaryStream(1, new ByteArrayInputStream(data), data.length);
|
||||
return ps;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static String uncompress(byte[] input) throws IOException {
|
||||
Inflater inflater = new Inflater();
|
||||
inflater.setInput(input);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(input.length);
|
||||
try {
|
||||
byte[] buff = new byte[1024];
|
||||
while (!inflater.finished()) {
|
||||
int count = inflater.inflate(buff);
|
||||
baos.write(buff, 0, count);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
baos.close();
|
||||
}
|
||||
inflater.end();
|
||||
byte[] output = baos.toByteArray();
|
||||
return new String(output, "UTF-8");
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class OrderBoxBlock {
|
||||
long BoxID;
|
||||
long ShardKey;
|
||||
long OrderNo;
|
||||
byte[] Data;
|
||||
long CompanyID;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class OrderBlockPlanResult {
|
||||
long ID;
|
||||
LocalDateTime SaveTime;
|
||||
byte[] PlaceData;
|
||||
long CompanyID;
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRes() throws IOException {
|
||||
//创建url路径
|
||||
String url = "https://chenfeng.tech:777/api/v1/OrderBlockPlan/GetPlanOrderData";
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
||||
//接口参数
|
||||
map.add("id",1306667105);
|
||||
//头部类型
|
||||
headers.set("Cookie", ".AspNetCore.Cookies=CfDJ8CGzP7BhamtAnTFO8HhkPcxGBkdd4sCOIjQMV-nb37GAFKr4y6C0JA0B3JzRsDAckabiUgBXQaWyDNjCqVTvBNYwbHwVbI5b-eKdXwkIFqsJZObZA-RoLdsu1d9yy1LwBLQwJxDGKTSQzFtrs_eHDeDEuG8CWEF1Iq96X0goR_cFMn0EHWVeRnOlThmDzLkmTMhysVSludR6qV0HrD54GOv5MQvBzzcE-WlsrKTo5Uf0hT8z1fGMY8Hofa6UDh8yyJsz2LFTQTy4NpmklvyXIkwv0fw9bOynHLllUh5ToF0wgrxYFU3Rzgf863uAdtfRP1DY2Rqvf-51uvQHip-SIT_b5p7TaSRiG-M7pZTlI0oOVPZRhng7k-NeIJRdYQmj0h3G3WJHCTH7g1-YQjAGbYQkJFcZdAsZpR-kjOlp3sHpNCDUe0NucYrLNp4tTXesCL_-t8X5GsXMYGlX-oKU10I");
|
||||
//构造实体对象
|
||||
HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
|
||||
//发起请求,服务地址,请求参数,返回消息体的数据类型
|
||||
ResponseEntity<Resource> response = restTemplate.postForEntity(url, param, Resource.class);
|
||||
//body
|
||||
InputStream inputStream = response.getBody().getInputStream();
|
||||
BufferedOutputStream out = FileUtil.getOutputStream("C:\\Users\\Beal\\Desktop\\新建文件夹\\xx.txt");
|
||||
long copySize = IoUtil.copy(inputStream, out, IoUtil.DEFAULT_BUFFER_SIZE);
|
||||
IoUtil.close(inputStream);
|
||||
IoUtil.close(out);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
-3637
File diff suppressed because it is too large
Load Diff
+4
@@ -38,6 +38,10 @@ public class OrderDO extends BaseDO {
|
||||
// 客户地址
|
||||
private String address;
|
||||
|
||||
// 生产单日期
|
||||
private LocalDateTime orderDate;
|
||||
|
||||
|
||||
// 客户电话
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
+3
-2
@@ -7,8 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@TableName("order_item")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@@ -24,6 +22,9 @@ public class OrderItemDO {
|
||||
// 生产单号
|
||||
private Long orderId;
|
||||
|
||||
// 明细类型,1 板材 2 五金/配件 3 其他 4 报价配件
|
||||
private Integer type;
|
||||
|
||||
// 房间 ID
|
||||
private Long roomId;
|
||||
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.remainplaten;
|
||||
|
||||
import com.cf.imes.framework.organ.core.db.OrganBaseDO;
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
+2
-13
@@ -11,7 +11,6 @@ import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.vo.PackRespVO;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.vo.PlateAndPartIdList;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.vo.PlateDetailsRespVO;
|
||||
import com.cf.imes.module.manage.controller.admin.query.vo.pack.OrderPackageVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.query.OrderPackageDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -24,12 +23,6 @@ public interface OrderPackageMapper extends BaseMapperX<OrderPackageDO> {
|
||||
|
||||
|
||||
|
||||
// default List<OrderPackageDO> selectByOrderNo(PackageDetailsReqVO reqVO) {
|
||||
// return selectList(new LambdaQueryWrapperX<OrderPackageDO>()
|
||||
// .eqIfPresent(OrderPackageDO::getOrderNo, orderNo)
|
||||
// .orderByDesc(OrderPackageDO::getId));
|
||||
// }
|
||||
|
||||
|
||||
// IPage<OrderPackageVO> selectByOrderNo(@Param("page") IPage page, @Param("reqVO") PackageDetailsReqVO reqVO,@Param("packId") List<Long> packId, @Param("organId") Long organId);
|
||||
|
||||
@@ -46,10 +39,6 @@ public interface OrderPackageMapper extends BaseMapperX<OrderPackageDO> {
|
||||
List<PackRespVO> selectPackPage(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<PlateDetailsRespVO> selectMissingBoard( @Param("page") IPage page, @Param("orderNo") Long orderNo, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
|
||||
default OrderPackageDO selectByPackId(Long packId,Long orderId,Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<OrderPackageDO>()
|
||||
@@ -105,8 +94,8 @@ public interface OrderPackageMapper extends BaseMapperX<OrderPackageDO> {
|
||||
return selectList(new LambdaQueryWrapperX<OrderPackageDO>()
|
||||
.eq(OrderPackageDO::getOrganId,organId)
|
||||
.eq(OrderPackageDO::getDeleted,false)
|
||||
.eq(OrderPackageDO::getStatus,OrderPackageStatusEnum.PACKAGED.getStatus())
|
||||
.eqIfPresent(OrderPackageDO::getOrderId, orderId));
|
||||
.eqIfPresent(OrderPackageDO::getOrderId, orderId)
|
||||
.eq(OrderPackageDO::getStatus,OrderPackageStatusEnum.PACKAGED.getStatus()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-9
@@ -6,20 +6,11 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.manage.dal.dataobject.pack.OrderPrepackagedDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPrepackagedMapper extends BaseMapperX<OrderPrepackagedDO> {
|
||||
|
||||
|
||||
|
||||
default List<OrderPrepackagedDO> selectOrderList(Long orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderPrepackagedDO>()
|
||||
.eq(OrderPrepackagedDO::getOrganId, organId)
|
||||
.eqIfPresent(OrderPrepackagedDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
default OrderPrepackagedDO selectOrder(Long orderId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<OrderPrepackagedDO>()
|
||||
|
||||
+1
-4
@@ -40,13 +40,10 @@ public interface OrdersMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
|
||||
|
||||
List<PackRespVO> selectOrderIdsFalse( @Param("createTime") String createTime,@Param("organId") Long organId, @Param("orderId") Long orderId);
|
||||
List<PackRespVO> selectOrderIdsFalse(@Param("createTime") String createTime,@Param("organId") Long organId, @Param("orderId") Long orderId);
|
||||
|
||||
|
||||
|
||||
IPage<PackRespVO> selectOrderPlate(@Param("page") IPage page, @Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
PrintOrderPackRespVO selectOrderPack(@Param("orderNo")Long orderNo, @Param("packageNo") Long packageNo, @Param("organId") Long organId);
|
||||
|
||||
|
||||
+12
@@ -4,6 +4,7 @@ package com.cf.imes.module.manage.service.pack;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.OrderItemTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
@@ -454,12 +455,22 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
// 拆包
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public OrderPackRespVO unpacking(Long packageID) {
|
||||
|
||||
OrderPackageDO packageDO = orderPackageMapper.selectById(packageID);
|
||||
|
||||
AssertUtils.notEmpty(packageDO,ORDER_PACK_DATA_ERROR );
|
||||
|
||||
Long orderId = packageDO.getOrderId();
|
||||
|
||||
OrderDO orderDO = ordersMapper.selectById(orderId);
|
||||
|
||||
AssertUtils.notEmpty(orderDO,ORDER_NO_DATA_ERROR);
|
||||
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
ordersMapper.updateById(orderDO);
|
||||
|
||||
packageDO.setStatus(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
orderPackageMapper.updateById(packageDO);
|
||||
return typeConversion(packageDO);
|
||||
@@ -693,6 +704,7 @@ public class PackServiceImpl implements PackService {
|
||||
// 在生产单明细表中添加数据(生产单号,配件ID,包裹ID,部件数量)
|
||||
OrderItemDO orderItemDO = new OrderItemDO();
|
||||
orderItemDO.setOrderId(reqVO.getOrderId());
|
||||
orderItemDO.setType(OrderItemTypeEnum.QUOTATIONACCESSORIES.getType());
|
||||
orderItemDO.setPartsId(orderParts.getId());
|
||||
orderItemDO.setPackageId(orderPackageDO.getId());
|
||||
orderItemDO.setNum(reqVO.getNum());
|
||||
|
||||
+14
-30
@@ -6,6 +6,7 @@ import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.Dispatch;
|
||||
import com.jacob.com.Variant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -16,35 +17,20 @@ import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.Dispatch;
|
||||
import com.jacob.com.Variant;
|
||||
import javax.sql.rowset.serial.SerialBlob;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Blob;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.http.WebSocket;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class VoiceServiceImpl implements VoiceService{
|
||||
@@ -68,7 +54,7 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
String path = vocieParameters.getPath();
|
||||
|
||||
// 设置音频的质量( 越大越好,目前最大好像 22,最小为 4 )
|
||||
Long quality = vocieParameters.getQuality();;
|
||||
Long quality = vocieParameters.getQuality();
|
||||
|
||||
// 朗读声音大小
|
||||
Long soundSize = vocieParameters.getSoundSize();
|
||||
@@ -108,7 +94,7 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
|
||||
Dispatch.call(spVoice, "Speak", new Variant(data));
|
||||
|
||||
System.out.println("输出语音文件成功!");
|
||||
log.info("输出语音文件成功!");
|
||||
|
||||
return filePath;
|
||||
|
||||
@@ -151,7 +137,6 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
}
|
||||
|
||||
byte[] audioBytes = byteArrayOutputStream.toByteArray();
|
||||
ByteArrayResource byteArrayResource = new ByteArrayResource(audioBytes);
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.parseMediaType("audio/mpeg"));
|
||||
@@ -179,15 +164,14 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
**/
|
||||
@Override
|
||||
public void zipFiles(String fileNames, String zipOutName) throws IOException {
|
||||
ZipOutputStream zipOutputStream = null;
|
||||
WritableByteChannel writableByteChannel = null;
|
||||
ByteBuffer buffer = ByteBuffer.allocate(2048);
|
||||
try {
|
||||
zipOutputStream = new ZipOutputStream(new FileOutputStream(zipOutName));
|
||||
FileChannel fileChannel = null;
|
||||
try (ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(zipOutName))) {
|
||||
writableByteChannel = Channels.newChannel(zipOutputStream);
|
||||
File source = new File(fileNames);
|
||||
zipOutputStream.putNextEntry(new ZipEntry(source.getName()));
|
||||
FileChannel fileChannel = new FileInputStream(fileNames).getChannel();
|
||||
fileChannel = new FileInputStream(fileNames).getChannel();
|
||||
while (fileChannel.read(buffer) != -1) {
|
||||
//更新缓存区位置
|
||||
buffer.flip();
|
||||
@@ -198,14 +182,14 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
}
|
||||
fileChannel.close();
|
||||
|
||||
System.out.println("文件压缩成功");
|
||||
log.info("文件压缩成功");
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("batchZipFiles error fileNames:");
|
||||
} finally {
|
||||
zipOutputStream.close();
|
||||
writableByteChannel.close();
|
||||
IOUtils.closeQuietly(writableByteChannel);
|
||||
IOUtils.closeQuietly(fileChannel);
|
||||
buffer.clear();
|
||||
}
|
||||
}
|
||||
@@ -217,26 +201,26 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
|
||||
// 检查文件路径是否为空
|
||||
if (sourceFile == null || sourceFile.isEmpty()) {
|
||||
System.out.println("文件路径为空");
|
||||
log.error("文件路径为空");
|
||||
}
|
||||
|
||||
File file = new File(sourceFile);
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!file.exists()) {
|
||||
System.out.println("文件不存在:" + sourceFile);
|
||||
log.error("文件不存在:" + sourceFile);
|
||||
}
|
||||
|
||||
// 检查是否是文件
|
||||
if (!file.isFile()) {
|
||||
System.out.println("路径指向的不是文件:" + sourceFile);
|
||||
log.error("路径指向的不是文件:" + sourceFile);
|
||||
}
|
||||
|
||||
// 尝试删除文件
|
||||
if (file.delete()) {
|
||||
System.out.println("文件删除成功:" + sourceFile);
|
||||
log.error("文件删除成功:" + sourceFile);
|
||||
} else {
|
||||
System.out.println("文件删除失败:" + sourceFile);
|
||||
log.error("文件删除失败:" + sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-63
@@ -5,9 +5,6 @@
|
||||
<resultMap id="PackMap" type="com.cf.imes.module.manage.controller.admin.pack.vo.PackRespVO">
|
||||
|
||||
<result property="id" column="orderId"/>
|
||||
<!-- <result property="packCount" column="packCount"/>-->
|
||||
<!-- <result property="packPieceCount" column="packPieceCount"/>-->
|
||||
|
||||
<collection property="plateIdList" ofType="java.lang.Long" column="plateId"/>
|
||||
|
||||
<collection property="packIdList" ofType="java.lang.Long" column="packId"/>
|
||||
@@ -62,6 +59,7 @@
|
||||
</foreach>
|
||||
|
||||
and op.type = 0
|
||||
and op.status in (1,2,3)
|
||||
and oi.package_id != 0
|
||||
and oi.plate_id != 0;
|
||||
|
||||
@@ -72,66 +70,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlateDetailsMap" type="com.cf.imes.module.manage.controller.admin.pack.vo.PlateDetailsRespVO">
|
||||
<result property="roomName" column="roomName"/>
|
||||
<result property="cabinetName" column="bodyName"/>
|
||||
<result property="plateNo" column="palteId"/>
|
||||
<result property="plateName" column="plateName"/>
|
||||
<result property="material" column="plateMaterial"/>
|
||||
<result property="color" column="palteColor"/>
|
||||
<result property="width" column="plateWidth"/>
|
||||
<result property="height" column="plateHeight"/>
|
||||
<result property="thickness" column="plateThickness"/>
|
||||
<result property="area" column="plateArea"/>
|
||||
<result property="texture" column="texture"/>
|
||||
<result property="specialShaped" column="specialShaped"/>
|
||||
<result property="profiling" column="profiling"/>
|
||||
<result property="rowHole" column="rowHole"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="processGroup" column="name"/>
|
||||
</resultMap>
|
||||
<select id="selectMissingBoard"
|
||||
parameterType="java.lang.Long"
|
||||
resultMap="PlateDetailsMap">
|
||||
|
||||
select DISTINCT
|
||||
ob.room_name as roomName,
|
||||
ob.name as bodyName,
|
||||
op.id as palteId,
|
||||
op.name as plateName,
|
||||
ogs.material as plateMaterial,
|
||||
ogs.color as palteColor,
|
||||
op.height as plateHeight,
|
||||
op.width as plateWidth,
|
||||
op.thickness as plateThickness,
|
||||
op.area as plateArea,
|
||||
op.texture as texture,
|
||||
op.remark as remark,
|
||||
op.is_special_shaped as specialShaped,
|
||||
op.is_sculpt as profiling,
|
||||
op.is_row_hole AS rowHole
|
||||
|
||||
from order_plate op
|
||||
join order_goods ogs on op.goods_id = ogs.id and op.organ_id = ogs.organ_id
|
||||
join order_item oi on op.id = oi.plate_id and op.organ_id = oi.organ_id
|
||||
join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id
|
||||
|
||||
where
|
||||
oi.order_id = #{orderNo}
|
||||
and
|
||||
oi.organ_id = #{organId}
|
||||
and oi.plate_id != 0
|
||||
and
|
||||
op.id not in (
|
||||
select DISTINCT oi2.plate_id
|
||||
from order_item oi2
|
||||
where oi2.order_id = #{orderNo} and oi2.package_id <> '');
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateParts"
|
||||
parameterType="java.lang.Long">
|
||||
|
||||
|
||||
+3
-40
@@ -22,7 +22,7 @@
|
||||
splitter as splitter,
|
||||
packaged as packaged
|
||||
FROM orders
|
||||
WHERE organ_id = #{organId} and deleted = false and status != 0 and create_time >= #{createTime} and id != #{orderId}
|
||||
WHERE organ_id = #{organId} and deleted = false and status in (1,2,3,4) and create_time >= #{createTime} and id != #{orderId}
|
||||
ORDER BY create_time
|
||||
LIMIT 1 ;
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
splitter as splitter,
|
||||
packaged as packaged
|
||||
FROM orders
|
||||
WHERE organ_id = #{organId} and deleted = false and status != 0 and create_time <= #{createTime} and id != #{orderId}
|
||||
WHERE organ_id = #{organId} and deleted = false and status != 0 and create_time <= #{createTime} and id != #{orderId}
|
||||
ORDER BY create_time desc
|
||||
LIMIT 1 ;
|
||||
|
||||
@@ -81,43 +81,6 @@
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOrderPlate"
|
||||
parameterType="java.lang.Long"
|
||||
resultMap="PackMap">
|
||||
|
||||
|
||||
SELECT distinct
|
||||
o.id as orderNo,
|
||||
o.custom_order_no as customOrderNo,
|
||||
o.dealer as dealer,
|
||||
o.dealer_phone_number as dealerPhoneNumber,
|
||||
o.order_date as orderDate,
|
||||
o.create_time as createTime,
|
||||
o.delivery_date as deliveryDate,
|
||||
o.customer as customer,
|
||||
o.phone_number as phoneNumber,
|
||||
o.address as address,
|
||||
o.salesman as salesman,
|
||||
o.splitter as splitter,
|
||||
o.packaged as packaged,
|
||||
(count(distinct oi.plate_id )-1) as totalPieceCount
|
||||
|
||||
FROM `orders` o
|
||||
join order_item oi on o.id = oi.order_id and o.organ_id = oi.organ_id
|
||||
|
||||
WHERE
|
||||
o.organ_id = #{organId} and
|
||||
o.id in
|
||||
<foreach item="id" collection="orderIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
group by orderNo,customOrderNo,dealer,deliveryDate,customer,phoneNumber,address,salesman,splitter,packaged,dealerPhoneNumber,orderDate,o.create_time
|
||||
|
||||
order by o.create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<resultMap id="PrintMap" type="com.cf.imes.module.manage.controller.admin.pack.vo.PrintOrderPackRespVO">
|
||||
@@ -200,7 +163,7 @@
|
||||
|
||||
</where>
|
||||
|
||||
order by order_date desc
|
||||
order by create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.report.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 报表配置
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/9/26 16:41
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "chenfeng.report")
|
||||
@Data
|
||||
public class CfReportProperties {
|
||||
/**
|
||||
* 多租户表名称列表
|
||||
*/
|
||||
private Set<String> tenantTableNames;
|
||||
}
|
||||
+5
@@ -5,7 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@@ -29,6 +31,8 @@ public class ReportDatasetSaveReqVO implements Serializable {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据集名称", example = "测试数据集")
|
||||
@NotBlank
|
||||
@Length(min = 1, max = 64, message = "数据集名称长度不能超过64个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "数据源id", example = "1")
|
||||
@@ -39,6 +43,7 @@ public class ReportDatasetSaveReqVO implements Serializable {
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "bean数据源方法名")
|
||||
@Length(min = 1, max = 64, message = "bean数据源方法名长度不能超过64个字符")
|
||||
private String method;
|
||||
|
||||
@Schema(description = "参数列表")
|
||||
|
||||
+9
-3
@@ -1,18 +1,17 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import com.cf.imes.module.report.controller.admin.dataset.vo.ReportDatasetSaveReqVO;
|
||||
import com.cf.imes.module.report.validation.datasource.ReportDatasourceTypeInEnum;
|
||||
import com.cf.imes.module.report.validation.template.ReportTemplateTypeInEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -33,6 +32,8 @@ public class ReportDatasourceSaveReqVO implements Serializable {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据源名称", example = "测试库")
|
||||
@NotBlank
|
||||
@Length(min = 1, max = 64, message = "数据源名称长度不能超过64个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "数据源类型,jdbc、spring、api", example = "1")
|
||||
@@ -44,18 +45,23 @@ public class ReportDatasourceSaveReqVO implements Serializable {
|
||||
private Integer buildinType;
|
||||
|
||||
@Schema(description = "spring型数据源id")
|
||||
@Length(max = 64, message = "spring型数据源id长度不能超过64个字符")
|
||||
private String beanId;
|
||||
|
||||
@Schema(description = "数据源驱动类",example = "com.mysql.cj.jdbc.Driver")
|
||||
@Length(max = 64, message = "数据源驱动类长度不能超过64个字符")
|
||||
private String driver;
|
||||
|
||||
@Schema(description = "数据源地址", example = "https://www.cf.com")
|
||||
@Length(max = 255, message = "数据源地址长度不能超过255个字符")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "数据源用户名", example = "晨丰")
|
||||
@Length(max = 64, message = "数据源用户名长度不能超过64个字符")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "数据源密码", example = "晨丰")
|
||||
@Length(max = 64, message = "数据源密码长度不能超过64个字符")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "备注", example = "该模板仅供生产使用")
|
||||
|
||||
+4
-1
@@ -5,8 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,8 @@ public class ReportTemplateSaveReqVO {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板名称", example = "生产单模板")
|
||||
@NotBlank
|
||||
@Length(min = 1, max = 30, message = "模板名称长度不能超过30个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "报表模板")
|
||||
|
||||
+1
-14
@@ -22,12 +22,6 @@ public interface ReportDatasetService {
|
||||
*/
|
||||
Long createDataset(@Valid ReportDatasetSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 批量创建报表数据集
|
||||
* @param createReqVOList
|
||||
*/
|
||||
void batchCreateDataset(@Valid List<ReportDatasetSaveReqVO> createReqVOList);
|
||||
|
||||
/**
|
||||
* 更新报表数据集
|
||||
*
|
||||
@@ -35,13 +29,6 @@ public interface ReportDatasetService {
|
||||
*/
|
||||
void updateDataset(@Valid ReportDatasetSaveReqVO updateReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新报表数据集
|
||||
* @param createReqVOList
|
||||
*/
|
||||
void batchUpdateDataset(@Valid List<ReportDatasetSaveReqVO> createReqVOList);
|
||||
|
||||
/**
|
||||
* 删除报表数据集
|
||||
*
|
||||
@@ -60,7 +47,7 @@ public interface ReportDatasetService {
|
||||
/**
|
||||
* 获得报表数据集分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param reqVO 分页查询
|
||||
* @return 报表数据集分页
|
||||
*/
|
||||
List<ReportDatasetDO> getDatasetList(ReportDatasetReqVO reqVO);
|
||||
|
||||
+17
-22
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.report.service.dataset;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -41,41 +40,29 @@ public class ReportDatasetServiceImpl implements ReportDatasetService {
|
||||
@Override
|
||||
public Long createDataset(ReportDatasetSaveReqVO createReqVO) {
|
||||
// 校验内置模板操作权限
|
||||
validateSystemDataset(createReqVO.getDatasourceId());
|
||||
ReportDatasourceDO reportDatasourceDO = validateSystemDataset(createReqVO.getDatasourceId());
|
||||
// 插入
|
||||
ReportDatasetDO dataset = BeanUtils.toBean(createReqVO, ReportDatasetDO.class);
|
||||
// 数据集机构id和数据源统一
|
||||
dataset.setOrganId(reportDatasourceDO.getOrganId());
|
||||
datasetMapper.insert(dataset);
|
||||
// 返回
|
||||
return dataset.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreateDataset(List<ReportDatasetSaveReqVO> createReqVOList) {
|
||||
List<ReportDatasetDO> reportDatasetDOS = BeanUtils.toBean(createReqVOList, ReportDatasetDO.class);
|
||||
if (CollUtil.isNotEmpty(reportDatasetDOS)) {
|
||||
datasetMapper.insertBatch(reportDatasetDOS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataset(ReportDatasetSaveReqVO updateReqVO) {
|
||||
// 校验内置模板操作权限
|
||||
validateSystemDataset(updateReqVO.getDatasourceId());
|
||||
ReportDatasourceDO reportDatasourceDO = validateSystemDataset(updateReqVO.getDatasourceId());
|
||||
// 校验存在
|
||||
validateDatasetExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ReportDatasetDO updateObj = BeanUtils.toBean(updateReqVO, ReportDatasetDO.class);
|
||||
// 数据集机构id和数据源统一
|
||||
updateObj.setOrganId(reportDatasourceDO.getOrganId());
|
||||
datasetMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdateDataset(List<ReportDatasetSaveReqVO> createReqVOList) {
|
||||
List<ReportDatasetDO> reportDatasetDOS = BeanUtils.toBean(createReqVOList, ReportDatasetDO.class);
|
||||
if (CollUtil.isNotEmpty(reportDatasetDOS)) {
|
||||
datasetMapper.updateBatch(reportDatasetDOS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataset(Long id) {
|
||||
// 校验存在
|
||||
@@ -100,15 +87,23 @@ public class ReportDatasetServiceImpl implements ReportDatasetService {
|
||||
*
|
||||
* @param datasourceId 数据源id
|
||||
*/
|
||||
private void validateSystemDataset(Long datasourceId) {
|
||||
ReportDatasourceDO reportDatasourceDO = reportDatasourceMapper.selectNormalDatasourceById(datasourceId, SecurityFrameworkUtils.getUserOrganId());
|
||||
private ReportDatasourceDO validateSystemDataset(Long datasourceId) {
|
||||
ReportDatasourceDO reportDatasourceDO = null;
|
||||
boolean superAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
||||
// 超管查所有,其他人查机构下
|
||||
if (superAdmin) {
|
||||
reportDatasourceDO = reportDatasourceMapper.selectById(datasourceId);
|
||||
} else {
|
||||
reportDatasourceDO = reportDatasourceMapper.selectNormalDatasourceById(datasourceId, SecurityFrameworkUtils.getUserOrganId());
|
||||
}
|
||||
if (ObjectUtil.isNull(reportDatasourceDO)) {
|
||||
throw exception(DATASOURCE_NOT_EXISTS);
|
||||
}
|
||||
// 非超管不能操作内置模板
|
||||
if (ReportTemplateTypeEnum.SYSTEM.equals(reportDatasourceDO.getBuildinType()) && Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin())) {
|
||||
if (ReportTemplateTypeEnum.SYSTEM.equals(reportDatasourceDO.getBuildinType()) && Boolean.FALSE.equals(superAdmin)) {
|
||||
throw exception(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
||||
}
|
||||
return reportDatasourceDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user