| | |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.GeoUtils; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.utils.redis.RedisUtil; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.dto.*; |
| | |
| | | |
| | | @Autowired |
| | | private WxMiniUtilService wxMiniUtilService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | |
| | | |
| | | |
| | | public synchronized String getNextCode(Integer type){ |
| | | String prefix = "YG"; |
| | | if(!Constants.equalsInteger(type,Constants.ZERO)){ |
| | | prefix = (Constants.equalsInteger(type,Constants.ONE)?"YC-":"SC-"); |
| | | } |
| | | prefix = DateUtil.getDate(new Date(),"yyyyMMdd") +"-"; |
| | | Integer countNum = RedisUtil.getObject(redisTemplate, Constants.RedisKeys.ORDER_CODE, Integer.class); |
| | | countNum = Constants.formatIntegerNum(countNum)+1; |
| | | //更新缓存 |
| | | RedisUtil.addObject(redisTemplate,Constants.RedisKeys.ORDER_CODE,countNum); |
| | | String nextIndex =Integer.toString( countNum ); |
| | | return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,3,"0"); |
| | | // String prefix = "YG"; |
| | | // if(!Constants.equalsInteger(type,Constants.ZERO)){ |
| | | // prefix = (Constants.equalsInteger(type,Constants.ONE)?"YC-":"SC-"); |
| | | // } |
| | | // prefix = DateUtil.getDate(new Date(),"yyyyMMdd") +"-"; |
| | | // Integer countNum = RedisUtil.getObject(redisTemplate, Constants.RedisKeys.ORDER_CODE, Integer.class); |
| | | // countNum = Constants.formatIntegerNum(countNum)+1; |
| | | // //更新缓存 |
| | | // RedisUtil.addObject(redisTemplate,Constants.RedisKeys.ORDER_CODE,countNum); |
| | | // String nextIndex =Integer.toString( countNum ); |
| | | // return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,3,"0"); |
| | | return null; |
| | | } |
| | | |
| | | |