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 java.util.List;
import com.ruoyi.aftersales.domain.AftersalesComplaintNotice; import com.ruoyi.aftersales.domain.AftersalesComplaintNotice;
import io.lettuce.core.dynamic.annotation.Param;
/** /**
* 售后客诉通知单Mapper接口 * 售后客诉通知单Mapper接口
@ -83,4 +84,12 @@ public interface AftersalesComplaintNoticeMapper
* @return 结果 * @return 结果
*/ */
public int restoreAftersalesComplaintNoticeById(Long complaintNoticeId); 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; package com.ruoyi.aftersales.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; 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.domain.AftersalesComplaintNotice;
import com.ruoyi.aftersales.service.IAftersalesComplaintNoticeService; import com.ruoyi.aftersales.service.IAftersalesComplaintNoticeService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 售后客诉通知单Service业务层处理 * 售后客诉通知单Service业务层处理
@ -60,9 +63,14 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain
* @param aftersalesComplaintNotice 售后客诉通知单 * @param aftersalesComplaintNotice 售后客诉通知单
* @return 结果 * @return 结果
*/ */
@Transactional
@Override @Override
public int insertAftersalesComplaintNotice(AftersalesComplaintNotice aftersalesComplaintNotice) public int insertAftersalesComplaintNotice(AftersalesComplaintNotice aftersalesComplaintNotice)
{ {
// 生成complaintNoticeCode
String complaintNoticeCode = generateComplainNoticeCode();
aftersalesComplaintNotice.setComplaintNoticeCode(complaintNoticeCode);
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
aftersalesComplaintNotice.setCreateBy(loginName); aftersalesComplaintNotice.setCreateBy(loginName);
aftersalesComplaintNotice.setCreateTime(DateUtils.getNowDate()); aftersalesComplaintNotice.setCreateTime(DateUtils.getNowDate());
@ -144,4 +152,17 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain
} }
return sysMakeOrders; 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 aftersales_complaint_notice set del_flag = '0' where complaint_notice_id = #{complaintNoticeId}
</update> </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> </mapper>

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

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

Loading…
Cancel
Save