|
|
@ -23,6 +23,11 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|
|
|
import com.epmet.constant.ParameterKeyConstant; |
|
|
|
import com.epmet.dao.CustomerProjectParameterDao; |
|
|
|
import com.epmet.dto.CustomerProjectParameterDTO; |
|
|
|
import com.epmet.dto.form.ParameterFormDTO; |
|
|
@ -30,11 +35,15 @@ import com.epmet.dto.result.ParameterResultDTO; |
|
|
|
import com.epmet.entity.CustomerProjectParameterEntity; |
|
|
|
import com.epmet.redis.CustomerProjectParameterRedis; |
|
|
|
import com.epmet.service.CustomerProjectParameterService; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
@ -169,7 +178,36 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public ParameterResultDTO remindInit(ParameterFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
ParameterResultDTO result = new ParameterResultDTO(); |
|
|
|
List<CustomerProjectParameterDTO> list = getParameterByCustomer(formDTO.getCustomerId()); |
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
list = getParameterByCustomer("default"); |
|
|
|
} |
|
|
|
list.forEach(dto -> { |
|
|
|
switch (dto.getParameterKey()) { |
|
|
|
case ParameterKeyConstant.DETENTION_DAYS: |
|
|
|
result.setDetentionDays(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
case ParameterKeyConstant.CALCULATION: |
|
|
|
result.setCalculation(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
case ParameterKeyConstant.REMIND_TIME: |
|
|
|
result.setRemindTime(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
case ParameterKeyConstant.PUSH_TIME: |
|
|
|
result.setPushTime(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
case ParameterKeyConstant.START_TIME: |
|
|
|
result.setStartTime(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
case ParameterKeyConstant.END_TIME: |
|
|
|
result.setEndTime(dto.getParameterValue()); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
}); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -181,7 +219,54 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome |
|
|
|
* @date 2020/11/18 15:33 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void remindSave(ParameterFormDTO formDTO) { |
|
|
|
List<CustomerProjectParameterEntity> list = new ArrayList<>(); |
|
|
|
//删除旧数据
|
|
|
|
baseDao.deleteByCustomer(formDTO.getCustomerId()); |
|
|
|
//可滞留天数
|
|
|
|
CustomerProjectParameterEntity detentionDays = new CustomerProjectParameterEntity(); |
|
|
|
detentionDays.setCustomerId(formDTO.getCustomerId()); |
|
|
|
detentionDays.setParameterKey(ParameterKeyConstant.DETENTION_DAYS); |
|
|
|
detentionDays.setParameterValue(formDTO.getDetentionDays()); |
|
|
|
detentionDays.setParameterName(ParameterKeyConstant.DETENTION_DAYS_NAME); |
|
|
|
list.add(detentionDays); |
|
|
|
//计算方式 工作日work 日历天calendar
|
|
|
|
CustomerProjectParameterEntity calculation = new CustomerProjectParameterEntity(); |
|
|
|
calculation.setCustomerId(formDTO.getCustomerId()); |
|
|
|
calculation.setParameterKey(ParameterKeyConstant.CALCULATION); |
|
|
|
calculation.setParameterValue(formDTO.getCalculation()); |
|
|
|
calculation.setParameterName(ParameterKeyConstant.CALCULATION_NAME); |
|
|
|
list.add(calculation); |
|
|
|
//即将超期提醒时间
|
|
|
|
CustomerProjectParameterEntity remindTime = new CustomerProjectParameterEntity(); |
|
|
|
remindTime.setCustomerId(formDTO.getCustomerId()); |
|
|
|
remindTime.setParameterKey(ParameterKeyConstant.REMIND_TIME); |
|
|
|
remindTime.setParameterValue(formDTO.getRemindTime()); |
|
|
|
remindTime.setParameterName(ParameterKeyConstant.REMIND_TIME_NAME); |
|
|
|
list.add(remindTime); |
|
|
|
//推送时间
|
|
|
|
CustomerProjectParameterEntity pushTime = new CustomerProjectParameterEntity(); |
|
|
|
pushTime.setCustomerId(formDTO.getCustomerId()); |
|
|
|
pushTime.setParameterKey(ParameterKeyConstant.PUSH_TIME); |
|
|
|
pushTime.setParameterValue(formDTO.getPushTime()); |
|
|
|
pushTime.setParameterName(ParameterKeyConstant.PUSH_TIME_NAME); |
|
|
|
list.add(pushTime); |
|
|
|
//设定核算单位天开始时间
|
|
|
|
CustomerProjectParameterEntity startTime = new CustomerProjectParameterEntity(); |
|
|
|
startTime.setCustomerId(formDTO.getCustomerId()); |
|
|
|
startTime.setParameterKey(ParameterKeyConstant.START_TIME); |
|
|
|
startTime.setParameterValue(formDTO.getStartTime()); |
|
|
|
startTime.setParameterName(ParameterKeyConstant.START_TIME_NAME); |
|
|
|
list.add(startTime); |
|
|
|
//设定核算单位天结束时间
|
|
|
|
CustomerProjectParameterEntity endTime = new CustomerProjectParameterEntity(); |
|
|
|
endTime.setCustomerId(formDTO.getCustomerId()); |
|
|
|
endTime.setParameterKey(ParameterKeyConstant.END_TIME); |
|
|
|
endTime.setParameterValue(formDTO.getEndTime()); |
|
|
|
endTime.setParameterName(ParameterKeyConstant.END_TIME_NAME); |
|
|
|
list.add(endTime); |
|
|
|
insertBatch(list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -195,7 +280,8 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void remindDefault(ParameterFormDTO formDTO) { |
|
|
|
|
|
|
|
//删除配置
|
|
|
|
baseDao.deleteByCustomer(formDTO.getCustomerId()); |
|
|
|
} |
|
|
|
|
|
|
|
} |