| | |
| | | package com.nq.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.nq.common.ResponseCode; |
| | | import com.nq.common.ServerResponse; |
| | | |
| | | import com.nq.dao.MoneyLogMapper; |
| | | import com.nq.dao.StockConfigMapper; |
| | | import com.nq.enums.EConfigKey; |
| | | import com.nq.pojo.MoneyLog; |
| | | import com.nq.pojo.SiteSpread; |
| | | import com.nq.pojo.StockConfig; |
| | | import com.nq.pojo.User; |
| | | import com.nq.service.IMoneyLogServces; |
| | | import com.nq.service.ISiteSpreadService; |
| | | import com.nq.service.IUserService; |
| | | |
| | |
| | | |
| | | import com.nq.utils.redis.RedisShardedPoolUtils; |
| | | |
| | | import com.nq.utils.translate.GoogleTranslateUtil; |
| | | import com.nq.vo.user.UserLoginResultVO; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.http.util.TextUtils; |
| | | import org.slf4j.Logger; |
| | | |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Controller |
| | |
| | | |
| | | @Autowired |
| | | ISiteSpreadService iSiteSpreadService; |
| | | |
| | | @Autowired |
| | | StockConfigMapper stockConfigMapper; |
| | | |
| | | @Autowired |
| | | MoneyLogMapper moneyLogMapper; |
| | | |
| | | //注册 |
| | | @RequestMapping(value = {"reg.do"}, method = {RequestMethod.POST}) |
| | | @ResponseBody |
| | |
| | | return ServerResponse.createBySuccess("Success", siteSpread); |
| | | } |
| | | |
| | | @RequestMapping({"queryStockConfig.do"}) |
| | | @ResponseBody |
| | | public ServerResponse updateConfig(){ |
| | | StockConfig stockConfig = stockConfigMapper.selectOne(new LambdaQueryWrapper<StockConfig>().eq(StockConfig::getCKey, EConfigKey.BUY_HANDLING_CHARGE.getCode())); |
| | | return ServerResponse.createBySuccess(stockConfig); |
| | | } |
| | | |
| | | @RequestMapping({"queryStockConfigTwo.do"}) |
| | | @ResponseBody |
| | | public ServerResponse queryStockConfigTwo(){ |
| | | StockConfig stockConfig = stockConfigMapper.selectOne(new LambdaQueryWrapper<StockConfig>().eq(StockConfig::getCKey, EConfigKey.EXCHANGE_HANDLING_CHARGE.getCode())); |
| | | return ServerResponse.createBySuccess(stockConfig); |
| | | } |
| | | |
| | | @RequestMapping({"moneylogAll.do"}) |
| | | @ResponseBody |
| | | public ServerResponse taskList(@RequestParam(value = "userId", required = false) String userId, |
| | | @RequestParam(value = "type", required = false) String type, |
| | | @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "50") int pageSize, |
| | | HttpServletRequest request) { |
| | | Page<MoneyLog> page1 = new Page<>(pageNum, pageSize); |
| | | QueryWrapper<MoneyLog> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | if(!TextUtils.isEmpty(userId)){ |
| | | queryWrapper.eq("user_id", userId); |
| | | } else { |
| | | User user = iUserService.getCurrentUser(request); |
| | | if (user == null ){ |
| | | return ServerResponse.createByErrorCodeMsg(ResponseCode.NEED_LOGIN.getCode(),"请先登录", request); |
| | | } |
| | | queryWrapper.eq("user_id", user.getId()); |
| | | } |
| | | if(StringUtils.isNotEmpty(type)){ |
| | | queryWrapper.eq("type",type); |
| | | } |
| | | queryWrapper.orderByDesc("create_time"); |
| | | Page<MoneyLog> moneyLogPage = moneyLogMapper.selectPage(page1, queryWrapper); |
| | | List<MoneyLog> records = moneyLogPage.getRecords(); |
| | | records.forEach(f->{ |
| | | f.setDescs( new GoogleTranslateUtil().translate(f.getDescs(), request.getHeader("lang"))); |
| | | }); |
| | | moneyLogPage.setRecords(records); |
| | | return ServerResponse.createBySuccess(moneyLogPage); |
| | | } |
| | | } |
| | | |