parent
59b536aac9
commit
41445b32cd
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
<a th:href="@{/index}">
|
||||
<li class="logo hidden-xs">
|
||||
<span class="logo-lg">RuoYi</span>
|
||||
<span class="logo-lg">SIP</span>
|
||||
</li>
|
||||
</a>
|
||||
<div class="sidebar-collapse">
|
||||
|
|
|
@ -388,20 +388,19 @@
|
|||
|
||||
function downloadTem() {
|
||||
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
|
||||
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL
|
||||
// 当请求完成时执行的回调函数
|
||||
$.modal.loading("正在下载,请稍候...");
|
||||
xhr.onload = function (data) {
|
||||
const url = window.URL.createObjectURL(data.currentTarget.response)
|
||||
const a=document.createElement('a')
|
||||
a.href= url
|
||||
a.download='合同清单模板.xlsx'
|
||||
document.append(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
$.modal.closeLoading();
|
||||
}
|
||||
xhr.send();
|
||||
window.location.href =prefix + "/list/export"
|
||||
$.modal.closeLoading();
|
||||
// $.post(prefix + "/list/export", {}, function (result) {
|
||||
// if (result.code == web_status.SUCCESS) {
|
||||
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
||||
// } else if (result.code == web_status.WARNING) {
|
||||
// $.modal.alertWarning(result.msg)
|
||||
// } else {
|
||||
// $.modal.alertError(result.msg);
|
||||
// }
|
||||
// $.modal.closeLoading();
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
document.getElementById('uploadInput').addEventListener('change', function (event) {
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">客户编码:</label>
|
||||
<label class="col-sm-4 control-label is-required">客户名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input name="customerName" th:field="*{customerName}" class="form-control" type="text"
|
||||
|
@ -117,7 +117,7 @@
|
|||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">客户名称:</label>
|
||||
<label class="col-sm-4 control-label is-required">客户编码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input readonly name="customerCode" th:field="*{customerCode}" class="form-control" type="text"
|
||||
required >
|
||||
|
@ -234,7 +234,7 @@
|
|||
width: "680",
|
||||
url: url,
|
||||
height:'600',
|
||||
|
||||
|
||||
callBack: doSubmitPartner
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
@ -324,21 +324,19 @@
|
|||
});
|
||||
|
||||
function downloadTem() {
|
||||
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
|
||||
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL
|
||||
// 当请求完成时执行的回调函数
|
||||
$.modal.loading("正在下载,请稍候...");
|
||||
xhr.onload = function (data) {
|
||||
const url = window.URL.createObjectURL(data.currentTarget.response)
|
||||
const a=document.createElement('a')
|
||||
a.href= url
|
||||
a.download='合同清单模板.xlsx'
|
||||
document.append(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
$.modal.closeLoading();
|
||||
}
|
||||
xhr.send();
|
||||
window.location.href=prefix + "/list/export"
|
||||
$.modal.closeLoading();
|
||||
// $.post(prefix + "/list/export", {}, function (result) {
|
||||
// if (result.code == web_status.SUCCESS) {
|
||||
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
||||
// } else if (result.code == web_status.WARNING) {
|
||||
// $.modal.alertWarning(result.msg)
|
||||
// } else {
|
||||
// $.modal.alertError(result.msg);
|
||||
// }
|
||||
// $.modal.closeLoading();
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public class OrderInfoController extends BaseController
|
|||
}
|
||||
@RequiresPermissions("sip:list:export")
|
||||
@Log(title = "发货清单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/list/export")
|
||||
@GetMapping("/list/export")
|
||||
public void listExport(HttpServletRequest request, HttpServletResponse response) {
|
||||
try
|
||||
{
|
||||
|
|
|
@ -75,5 +75,6 @@ public class OrderDelivery extends BaseEntity
|
|||
/** 删除时间 */
|
||||
private Date deletedAt;
|
||||
private String total;
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.sip.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.sip.domain.OrderDelivery;
|
||||
|
||||
|
@ -58,4 +59,6 @@ public interface OrderDeliveryMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderDeliveryByIds(String[] ids);
|
||||
|
||||
int count(OrderDelivery orderDelivery);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.sip.utils.CodeGeneratorUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.sip.mapper.OrderDeliveryMapper;
|
||||
|
@ -53,6 +56,10 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService
|
|||
@Override
|
||||
public int insertOrderDelivery(OrderDelivery orderDelivery)
|
||||
{
|
||||
OrderDelivery queryCountParam = new OrderDelivery();
|
||||
queryCountParam.setCreatedAt(DateUtils.getNowDate());
|
||||
String deliveryCode = CodeGeneratorUtil.generateUniqueCode("OD", () -> orderDeliveryMapper.count(queryCountParam));
|
||||
orderDelivery.setDeliveryCode(deliveryCode);
|
||||
return orderDeliveryMapper.insertOrderDelivery(orderDelivery);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.ruoyi.sip.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : CodeGeneratorUtil
|
||||
* @Description :
|
||||
* @DATE : Created in 9:55 2025/5/21
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/05/21 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
public class CodeGeneratorUtil {
|
||||
|
||||
private static final String DELIMITER = "-";
|
||||
private static final Map<String, AtomicLong> SEQUENCE_MAP = new ConcurrentHashMap<>();
|
||||
private static final Map<String, String> DATE_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 生成唯一编码
|
||||
*
|
||||
* @param prefix 编码前缀
|
||||
* @param defaultValueSupplier 函数式接口,返回默认值
|
||||
* @return 唯一编码
|
||||
*/
|
||||
public static String generateUniqueCode(String prefix, IntSupplier defaultValueSupplier) {
|
||||
// 获取当前日期(yyyyMMdd格式)
|
||||
String currentDate = DateUtils.dateTime();
|
||||
if (!DATE_MAP.containsKey(currentDate)) {
|
||||
DATE_MAP.clear();
|
||||
SEQUENCE_MAP.clear();
|
||||
DATE_MAP.put(currentDate, currentDate);
|
||||
}
|
||||
// 获取当前流水号并递增
|
||||
AtomicLong sequence = SEQUENCE_MAP.computeIfAbsent(prefix, k -> {
|
||||
if (CollUtil.isEmpty(SEQUENCE_MAP)) {
|
||||
return new AtomicLong(defaultValueSupplier.getAsInt());
|
||||
} else {
|
||||
return new AtomicLong(0);
|
||||
}
|
||||
});
|
||||
long currentSequence = sequence.incrementAndGet();
|
||||
// 生成编码
|
||||
return prefix + DELIMITER + currentDate + DELIMITER + String.format("%04d", currentSequence);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectOrderDeliveryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
select count(1) from order_delivery
|
||||
<where>
|
||||
<if test="status != null "> and tatus = #{status}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="deliveryCode != null and deliveryCode != ''"> and delivery_code like concat('%', #{deliveryCode}, '%')</if>
|
||||
<if test="deliveryDate != null "> and delivery_date = #{deliveryDate}</if>
|
||||
<if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if>
|
||||
<if test="logisticsCompany != null and logisticsCompany != ''"> and logistics_company = #{logisticsCompany}</if>
|
||||
<if test="deliveryStatus != null and deliveryStatus != ''"> and delivery_status = #{deliveryStatus}</if>
|
||||
<if test="createdAt != null "> and created_at between date_format(#{createdAt}, '%Y-%m-%d 00:00:00') and date_format(#{createdAt}, '%Y-%m-%d 23:59:59')</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertOrderDelivery" parameterType="OrderDelivery" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into order_delivery
|
||||
|
|
Loading…
Reference in New Issue