| | |
| | | package com.ruoyi.project.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.project.domain.BaseOnlyvalue; |
| | | import com.ruoyi.project.domain.BaseOrganization; |
| | | import com.ruoyi.project.domain.ServiceDonationwitness; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.domain.vo.countByRecordStateVO; |
| | | import com.ruoyi.project.mapper.*; |
| | | import com.ruoyi.project.service.IBaseOnlyvalueService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Map; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.domain.ServiceDonatebaseinfo; |
| | |
| | | |
| | | @Autowired |
| | | ServiceDonationwitnessMapper serviceDonationwitnessMapper; |
| | | |
| | | @Autowired |
| | | private IBaseOnlyvalueService baseOnlyvalueService; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | String number = ""; |
| | | |
| | | if (completeDonation < 10) { |
| | | number = "000" + completeDonation; |
| | | } else if (completeDonation >= 10 && completeDonation < 100) { |
| | | number = "00" + completeDonation; |
| | | } else if (completeDonation >= 100 && completeDonation < 1000) { |
| | | number = "0" + completeDonation; |
| | | } else { |
| | | number = "" + completeDonation; |
| | | // if (completeDonation < 10) { |
| | | // number = "000" + completeDonation; |
| | | // } else if (completeDonation >= 10 && completeDonation < 100) { |
| | | // number = "00" + completeDonation; |
| | | // } else if (completeDonation >= 100 && completeDonation < 1000) { |
| | | // number = "0" + completeDonation; |
| | | // } else { |
| | | // number = "" + completeDonation; |
| | | // } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | BaseOnlyvalue baseOnlyvalue = new BaseOnlyvalue(); |
| | | baseOnlyvalue.setAppentvalue(String.valueOf(year)); |
| | | baseOnlyvalue.setBusinesstype("donationwitness"); |
| | | List<BaseOnlyvalue> baseOnlyvalues = baseOnlyvalueService.queryList(baseOnlyvalue); |
| | | Long currentvalue = baseOnlyvalues.get(0).getCurrentvalue(); |
| | | if (currentvalue == null) { |
| | | log.error("唯一值为空了!"); |
| | | return null; |
| | | } |
| | | //如果currentvalue不满足4位,则在前面补0 |
| | | String formattedNumber = String.format("%04d", currentvalue); |
| | | |
| | | int last = oldDonateNumber.lastIndexOf("*"); |
| | | if (last == -1) { |
| | | return oldDonateNumber; |
| | | } else { |
| | | StringBuilder newDonateNumber = new StringBuilder(oldDonateNumber); |
| | | newDonateNumber.replace(last - 3, last + 1, number); |
| | | // newDonateNumber.replace(last - 3, last + 1, number); |
| | | newDonateNumber.replace(last - 3, last + 1, formattedNumber); |
| | | |
| | | String updateNumber = newDonateNumber.toString(); |
| | | int result = serviceDonatebaseinfoMapper.updateDonateNumber(id, updateNumber); |