Browse Source

[feat]售后管理:

售后客诉通知
新增客诉通知单号根据编码规则自增
dev
liuxiaoxu 7 months ago
parent
commit
8eb67efed5
  1. 9
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AftersalesComplaintNoticeMapper.java
  2. 21
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java
  3. 16
      ruoyi-admin/src/main/resources/mapper/aftersales/AftersalesComplaintNoticeMapper.xml
  4. 36
      ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html

9
ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AftersalesComplaintNoticeMapper.java

@ -2,6 +2,7 @@ package com.ruoyi.aftersales.mapper;
import java.util.List;
import com.ruoyi.aftersales.domain.AftersalesComplaintNotice;
import io.lettuce.core.dynamic.annotation.Param;
/**
* 售后客诉通知单Mapper接口
@ -83,4 +84,12 @@ public interface AftersalesComplaintNoticeMapper
* @return 结果
*/
public int restoreAftersalesComplaintNoticeById(Long complaintNoticeId);
/**
* 获取今天已经生成的最大序号
* @param dateStr 日期字符串格式为yyyyMMdd
* @return 最大序号
*/
int getMaxSequenceForToday(@Param("dateStr") String dateStr);
}

21
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java

@ -1,5 +1,7 @@
package com.ruoyi.aftersales.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
@ -13,6 +15,7 @@ import com.ruoyi.aftersales.mapper.AftersalesComplaintNoticeMapper;
import com.ruoyi.aftersales.domain.AftersalesComplaintNotice;
import com.ruoyi.aftersales.service.IAftersalesComplaintNoticeService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* 售后客诉通知单Service业务层处理
@ -60,9 +63,14 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain
* @param aftersalesComplaintNotice 售后客诉通知单
* @return 结果
*/
@Transactional
@Override
public int insertAftersalesComplaintNotice(AftersalesComplaintNotice aftersalesComplaintNotice)
{
// 生成complaintNoticeCode
String complaintNoticeCode = generateComplainNoticeCode();
aftersalesComplaintNotice.setComplaintNoticeCode(complaintNoticeCode);
String loginName = ShiroUtils.getLoginName();
aftersalesComplaintNotice.setCreateBy(loginName);
aftersalesComplaintNotice.setCreateTime(DateUtils.getNowDate());
@ -144,4 +152,17 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain
}
return sysMakeOrders;
}
/**
* 按照特定编码生成complaintNoticeCode
* */
private String generateComplainNoticeCode(){
LocalDate currentDate = LocalDate.now();
String formatDate = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
//查询今天已经生成的最大序号
int maxSequenceForToday = aftersalesComplaintNoticeMapper.getMaxSequenceForToday(formatDate);
//序号自增如果是当天第一条,则序号为001
String sequence =String.format("%03d",maxSequenceForToday+1);
return "KS"+formatDate+sequence;
}
}

16
ruoyi-admin/src/main/resources/mapper/aftersales/AftersalesComplaintNoticeMapper.xml

@ -137,4 +137,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update aftersales_complaint_notice set del_flag = '0' where complaint_notice_id = #{complaintNoticeId}
</update>
<!-- <select id="getMaxSequenceForToday" resultType="int">-->
<!-- SELECT IFNULL(MAX(SUBSTRING(complaint_notice_code, 10, 3)), 0) AS max_sequence-->
<!-- FROM aftersales_complaint_notice-->
<!-- WHERE DATE_FORMAT(create_time, '%Y%m%d') = #{dateStr}-->
<!-- </select>-->
<select id="getMaxSequenceForToday" resultType="int">
SELECT
IFNULL(MAX(SUBSTRING(complaint_notice_code, 10, 3)), 0) AS max_sequence
FROM
aftersales_complaint_notice
WHERE
DATE_FORMAT(create_time, '%Y%m%d') = DATE_FORMAT(#{dateStr}, '%Y%m%d');
</select>
</mapper>

36
ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html

@ -44,24 +44,24 @@
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择报价信息</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-danger multiple disabled" onclick="insertNRow()">
<i class="fa fa-remove"></i> 添加无料号物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-quoteChild"></table>
</div>
</div>
</div>
<!-- <div class="container">-->
<!-- <div class="form-row">-->
<!-- <div class="btn-group-sm" id="toolbar" role="group">-->
<!-- <span>选择报价信息</span>-->
<!-- <a class="btn btn-success" onclick="insertRow()">-->
<!-- <i class="fa fa-plus"></i> 添加物料-->
<!-- </a>-->
<!-- <a class="btn btn-danger multiple disabled" onclick="insertNRow()">-->
<!-- <i class="fa fa-remove"></i> 添加无料号物料-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="row">-->
<!-- <div class="col-sm-12 select-table table-striped">-->
<!-- <table id="bootstrap-sub-table-quoteChild"></table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">

Loading…
Cancel
Save