Merge pull request 'develop' (#117) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/117
This commit is contained in:
commit
67cb9b7df9
@ -34,6 +34,7 @@ import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
|||||||
|
|
||||||
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
||||||
import com.xdadan.erp.emis.service.IEmisCommissionQuoteService;
|
import com.xdadan.erp.emis.service.IEmisCommissionQuoteService;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工提成方案报价Controller
|
* 员工提成方案报价Controller
|
||||||
@ -126,9 +127,23 @@ public class EmisCommissionQuoteController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('emis:emisCommissionQuote:remove')")
|
@PreAuthorize("@ss.hasPermi('emis:emisCommissionQuote:remove')")
|
||||||
@Log(title = "员工提成方案报价", businessType = BusinessType.DELETE)
|
@Log(title = "员工提成方案报价", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{quoteIds}")
|
@DeleteMapping("/{quoteIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] quoteIds)
|
public AjaxResult remove(@PathVariable Long[] quoteIds) {
|
||||||
{
|
|
||||||
return toAjax(emisCommissionQuoteService.deleteEmisCommissionQuoteByQuoteIds(quoteIds));
|
return toAjax(emisCommissionQuoteService.deleteEmisCommissionQuoteByQuoteIds(quoteIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改员工提成方案报价
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCommissionQuote:batchUpdate')")
|
||||||
|
@Log(title = "员工提成方案报价", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/batchUpdate")
|
||||||
|
public AjaxResult batchUpdate(@RequestBody List<EmisCommissionQuote> emisCommissionQuoteList) {
|
||||||
|
try {
|
||||||
|
int result = emisCommissionQuoteService.batchUpdateEmisCommissionQuote(emisCommissionQuoteList);
|
||||||
|
return toAjax(result);
|
||||||
|
} catch (EmisBizError e) {
|
||||||
|
return AjaxResult.error(e.getMessage(), e.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,4 +87,12 @@ public interface EmisCommissionQuoteMapper extends BaseMapper<EmisCommissionQuot
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisCommissionQuoteByQuoteIds(Long[] quoteIds);
|
public int deleteEmisCommissionQuoteByQuoteIds(Long[] quoteIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查日期交叉重复
|
||||||
|
*
|
||||||
|
* @param emisCommissionQuote 员工提成方案报价
|
||||||
|
* @return 重复的报价列表
|
||||||
|
*/
|
||||||
|
public List<EmisCommissionQuote> checkDateOverlap(EmisCommissionQuote emisCommissionQuote);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisCommissionQuoteService
|
* @ClassName EmisCommissionQuoteService
|
||||||
@ -75,4 +76,20 @@ public interface IEmisCommissionQuoteService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisCommissionQuoteByQuoteId(Long quoteId);
|
public int deleteEmisCommissionQuoteByQuoteId(Long quoteId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改员工提成方案报价
|
||||||
|
*
|
||||||
|
* @param emisCommissionQuoteList 员工提成方案报价列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batchUpdateEmisCommissionQuote(List<EmisCommissionQuote> emisCommissionQuoteList) throws EmisBizError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查日期交叉重复
|
||||||
|
*
|
||||||
|
* @param emisCommissionQuote 员工提成方案报价
|
||||||
|
* @return 重复的报价列表
|
||||||
|
*/
|
||||||
|
public List<EmisCommissionQuote> checkDateOverlap(EmisCommissionQuote emisCommissionQuote);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,14 +14,17 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.xdadan.erp.emis.domain.EmisCommissionExpression;
|
import com.xdadan.erp.emis.domain.EmisCommissionExpression;
|
||||||
import com.xdadan.erp.emis.mapper.EmisCommissionExpressionMapper;
|
import com.xdadan.erp.emis.mapper.EmisCommissionExpressionMapper;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
|
||||||
import com.xdadan.erp.emis.mapper.EmisCommissionQuoteMapper;
|
import com.xdadan.erp.emis.mapper.EmisCommissionQuoteMapper;
|
||||||
import com.xdadan.erp.emis.service.IEmisCommissionQuoteService;
|
import com.xdadan.erp.emis.service.IEmisCommissionQuoteService;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工提成方案报价Service业务层处理
|
* 员工提成方案报价Service业务层处理
|
||||||
*
|
*
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -133,4 +136,134 @@ public class EmisCommissionQuoteServiceImpl implements IEmisCommissionQuoteServi
|
|||||||
return emisCommissionQuoteMapper.deleteEmisCommissionQuoteByQuoteId(quoteId);
|
return emisCommissionQuoteMapper.deleteEmisCommissionQuoteByQuoteId(quoteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改员工提成方案报价
|
||||||
|
*
|
||||||
|
* @param emisCommissionQuoteList 员工提成方案报价列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int batchUpdateEmisCommissionQuote(List<EmisCommissionQuote> emisCommissionQuoteList) throws EmisBizError {
|
||||||
|
int result = 0;
|
||||||
|
for (EmisCommissionQuote emisCommissionQuote : emisCommissionQuoteList) {
|
||||||
|
// 先查询数据库中的完整数据
|
||||||
|
EmisCommissionQuote dbQuote = emisCommissionQuoteMapper
|
||||||
|
.selectEmisCommissionQuoteByQuoteId(emisCommissionQuote.getQuoteId());
|
||||||
|
if (dbQuote == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 补齐前端未传的字段
|
||||||
|
if (emisCommissionQuote.getQuoteCode() == null) {
|
||||||
|
emisCommissionQuote.setQuoteCode(dbQuote.getQuoteCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getQuoteName() == null) {
|
||||||
|
emisCommissionQuote.setQuoteName(dbQuote.getQuoteName());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getTransLineCode() == null) {
|
||||||
|
emisCommissionQuote.setTransLineCode(dbQuote.getTransLineCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getSendSiteCode() == null) {
|
||||||
|
emisCommissionQuote.setSendSiteCode(dbQuote.getSendSiteCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getNextSiteCode() == null) {
|
||||||
|
emisCommissionQuote.setNextSiteCode(dbQuote.getNextSiteCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getProdCode() == null) {
|
||||||
|
emisCommissionQuote.setProdCode(dbQuote.getProdCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getFromCountry() == null) {
|
||||||
|
emisCommissionQuote.setFromCountry(dbQuote.getFromCountry());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getCountry() == null) {
|
||||||
|
emisCommissionQuote.setCountry(dbQuote.getCountry());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getFeeType() == null) {
|
||||||
|
emisCommissionQuote.setFeeType(dbQuote.getFeeType());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getCalcType() == null) {
|
||||||
|
emisCommissionQuote.setCalcType(dbQuote.getCalcType());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getPostType() == null) {
|
||||||
|
emisCommissionQuote.setPostType(dbQuote.getPostType());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getTransType() == null) {
|
||||||
|
emisCommissionQuote.setTransType(dbQuote.getTransType());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getBlOpen() == null) {
|
||||||
|
emisCommissionQuote.setBlOpen(dbQuote.getBlOpen());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getEmpCode() == null) {
|
||||||
|
emisCommissionQuote.setEmpCode(dbQuote.getEmpCode());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getEmpName() == null) {
|
||||||
|
emisCommissionQuote.setEmpName(dbQuote.getEmpName());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getStartDate() == null) {
|
||||||
|
emisCommissionQuote.setStartDate(dbQuote.getStartDate());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getEndDate() == null) {
|
||||||
|
emisCommissionQuote.setEndDate(dbQuote.getEndDate());
|
||||||
|
}
|
||||||
|
if (emisCommissionQuote.getPriorityLevel() == null) {
|
||||||
|
emisCommissionQuote.setPriorityLevel(dbQuote.getPriorityLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查日期交叉重复
|
||||||
|
List<EmisCommissionQuote> overlapList = checkDateOverlap(emisCommissionQuote);
|
||||||
|
if (!overlapList.isEmpty()) {
|
||||||
|
StringBuilder errorMsg = new StringBuilder();
|
||||||
|
errorMsg.append("报价[").append(emisCommissionQuote.getQuoteName()).append("]存在冲突:");
|
||||||
|
|
||||||
|
for (EmisCommissionQuote overlap : overlapList) {
|
||||||
|
// 判断是否为完全重复
|
||||||
|
boolean isDuplicate = isDuplicateQuote(emisCommissionQuote, overlap);
|
||||||
|
if (isDuplicate) {
|
||||||
|
errorMsg.append("\n- 与报价[").append(overlap.getQuoteName()).append("(ID:")
|
||||||
|
.append(overlap.getQuoteId()).append(")]重复");
|
||||||
|
} else {
|
||||||
|
errorMsg.append("\n- 与报价[").append(overlap.getQuoteName()).append("(ID:")
|
||||||
|
.append(overlap.getQuoteId()).append(")]日期交叉");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new EmisBizError(EmisBizErrorType.EXISTS, errorMsg.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
result += emisCommissionQuoteMapper.updateEmisCommissionQuote(emisCommissionQuote);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查日期交叉重复
|
||||||
|
*
|
||||||
|
* @param emisCommissionQuote 员工提成方案报价
|
||||||
|
* @return 重复的报价列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EmisCommissionQuote> checkDateOverlap(EmisCommissionQuote emisCommissionQuote) {
|
||||||
|
return emisCommissionQuoteMapper.checkDateOverlap(emisCommissionQuote);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断两个报价是否完全重复
|
||||||
|
*
|
||||||
|
* @param quote1 报价1
|
||||||
|
* @param quote2 报价2
|
||||||
|
* @return 是否完全重复
|
||||||
|
*/
|
||||||
|
private boolean isDuplicateQuote(EmisCommissionQuote quote1, EmisCommissionQuote quote2) {
|
||||||
|
// 比较关键字段是否完全相同
|
||||||
|
return StringUtils.equals(quote1.getEmpCode(), quote2.getEmpCode()) &&
|
||||||
|
StringUtils.equals(quote1.getEmpName(), quote2.getEmpName()) &&
|
||||||
|
StringUtils.equals(quote1.getFeeType(), quote2.getFeeType()) &&
|
||||||
|
StringUtils.equals(quote1.getCalcType(), quote2.getCalcType()) &&
|
||||||
|
StringUtils.equals(quote1.getPostType(), quote2.getPostType()) &&
|
||||||
|
StringUtils.equals(quote1.getTransType(), quote2.getTransType()) &&
|
||||||
|
StringUtils.equals(quote1.getFromCountry(), quote2.getFromCountry()) &&
|
||||||
|
StringUtils.equals(quote1.getCountry(), quote2.getCountry())&&
|
||||||
|
quote1.getStartDate()==quote2.getStartDate()&&
|
||||||
|
quote1.getEndDate()==quote2.getEndDate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,8 +79,8 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="quoteName != null and quoteName != ''"> and quote_name like concat('%', #{quoteName}, '%')</if>
|
<if test="quoteName != null and quoteName != ''"> and quote_name like concat('%', #{quoteName}, '%')</if>
|
||||||
<if test="fromCountry != null and fromCountry != ''"> and ( FIND_IN_SET(#{fromCountry},from_country) or from_country='-1' or from_country is null or from_country='' or ( #{fromCountry}!='0086' and from_country='-2' ) )</if>
|
<if test="fromCountry != null and fromCountry != ''"> and ( FIND_IN_SET(#{fromCountry},from_country) or from_country='-1' or from_country is null or from_country='' or ( #{fromCountry}!='0086' and from_country='-2' ) or from_country='-3')</if>
|
||||||
<if test="country != null and country != ''"> and ( FIND_IN_SET(#{country},country) or country='-1' or country is null or country='' or ( #{country}!='0086' and country='-2' ) ) </if>
|
<if test="country != null and country != ''"> and ( FIND_IN_SET(#{country},country) or country='-1' or country is null or country='' or ( #{country}!='0086' and country='-2' ) or from_country='-3' ) </if>
|
||||||
|
|
||||||
<if test="sendSiteCode != null and sendSiteCode != ''"> and ( ( FIND_IN_SET(#{sendSiteCode},send_site_code) and send_site_code is not null ) or send_site_code is null ) </if>
|
<if test="sendSiteCode != null and sendSiteCode != ''"> and ( ( FIND_IN_SET(#{sendSiteCode},send_site_code) and send_site_code is not null ) or send_site_code is null ) </if>
|
||||||
<if test="nextSiteCode != null and nextSiteCode != ''"> and ( ( FIND_IN_SET(#{nextSiteCode},next_site_code) and next_site_code is not null ) or next_site_code is null ) </if>
|
<if test="nextSiteCode != null and nextSiteCode != ''"> and ( ( FIND_IN_SET(#{nextSiteCode},next_site_code) and next_site_code is not null ) or next_site_code is null ) </if>
|
||||||
@ -248,4 +248,62 @@
|
|||||||
#{quoteId}
|
#{quoteId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="checkDateOverlap" parameterType="EmisCommissionQuote" resultMap="EmisCommissionQuoteResult">
|
||||||
|
<include refid="selectEmisCommissionQuoteVo"/>
|
||||||
|
<where>
|
||||||
|
del_flag='0'
|
||||||
|
and quote_id != #{quoteId}
|
||||||
|
and (
|
||||||
|
(start_date <![CDATA[ <= ]]> #{startDate} and #{startDate} <![CDATA[ < ]]> end_date)
|
||||||
|
or
|
||||||
|
(start_date <![CDATA[ < ]]> #{endDate} and #{endDate} <![CDATA[ <= ]]> end_date)
|
||||||
|
or
|
||||||
|
(start_date <![CDATA[ >= ]]> #{startDate} and end_date <![CDATA[ <= ]]> #{endDate})
|
||||||
|
)
|
||||||
|
<if test="empCode != null and empCode != ''">
|
||||||
|
and (
|
||||||
|
emp_code = #{empCode}
|
||||||
|
or FIND_IN_SET(#{empCode}, emp_code)
|
||||||
|
or FIND_IN_SET(emp_code, #{empCode})
|
||||||
|
or emp_code='-1'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="empName != null and empName != ''">
|
||||||
|
and (
|
||||||
|
emp_name = #{empName}
|
||||||
|
or FIND_IN_SET(#{empName}, emp_name)
|
||||||
|
or FIND_IN_SET(emp_name, #{empName})
|
||||||
|
or emp_name='全部'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
|
||||||
|
<if test="calcType != null and calcType != ''"> and calc_type=#{calcType}</if>
|
||||||
|
<if test="postType != null and postType != ''"> and post_type=#{postType}</if>
|
||||||
|
<if test="transType != null and transType != ''">
|
||||||
|
and (
|
||||||
|
trans_type = #{transType}
|
||||||
|
or FIND_IN_SET(#{transType}, trans_type)
|
||||||
|
or FIND_IN_SET(trans_type, #{transType})
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="fromCountry != null and fromCountry != ''">
|
||||||
|
and (
|
||||||
|
from_country = #{fromCountry}
|
||||||
|
or FIND_IN_SET(#{fromCountry}, from_country)
|
||||||
|
or FIND_IN_SET(from_country, #{fromCountry})
|
||||||
|
or from_country='-1'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="country != null and country != ''">
|
||||||
|
and (
|
||||||
|
country = #{country}
|
||||||
|
or FIND_IN_SET(#{country}, country)
|
||||||
|
or FIND_IN_SET(country, #{country})
|
||||||
|
or country='-1'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user