| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Resource |
| | | private JedisPool jedisPool; |
| | | |
| | | @Resource |
| | | private GoldCornTaskTypeInfoService goldCornTaskTypeInfoService; |
| | |
| | | List<GoldCornExchangeRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornConsumeRecord record : recordList) { |
| | | GoldCornExchangeRecordVO vo = new GoldCornExchangeRecordVO(); |
| | | if (record.getEventTime() == null) { |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | } else { |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getEventTime().getTime(), "yyyy.MM.dd")); |
| | | } |
| | | vo.setNum(record.getCornNum()); |
| | | vo.setMoney(record.getMoney().setScale(2).toString()); |
| | | vo.setMoney(new BigDecimal(record.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR).toString()); |
| | | voList.add(vo); |
| | | } |
| | | |
| | |
| | | return JsonUtil.loadFalseResult("参数不完整"); |
| | | } |
| | | |
| | | |
| | | String key = "dotask-" + acceptData.getSign(); |
| | | Jedis jedis = jedisPool.getResource(); |
| | | try { |
| | | if (!StringUtil.isNullOrEmpty(jedis.get(key))) { |
| | | return JsonUtil.loadFalseResult("重复的请求"); |
| | | } |
| | | jedis.set(key, "1"); |
| | | //30分钟有效期 |
| | | jedis.expire(key, 60 * 30); |
| | | |
| | | try { |
| | | JSONObject data = new JSONObject(); |
| | | GoldCornMakeResultDTO result = null; |
| | |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } finally { |
| | | jedis.close(); |
| | | } |
| | | } |
| | | |
| | | |