| | |
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | import com.google.gson.stream.JsonReader;
|
| | | import com.google.gson.stream.JsonWriter;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.money.UserMoneyDetailHistoryVO;
|
| | | import com.yeshi.fanli.vo.money.UserMoneyStatisticVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | |
|
| | | List<UserMoneyDetailHistoryVO> list = userMoneyDetailService.listUserMoneyDetailForClient(uid, index, date);
|
| | | long count = userMoneyDetailService.countUserMoneyDetailForClient(uid, index, date);
|
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation();
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new TypeAdapter<UserMoneyDetailTypeEnum>() {
|
| | | @Override
|
| | | public UserMoneyDetailTypeEnum read(JsonReader arg0) throws IOException {
|
| | |
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm"));
|
| | | }
|
| | | }
|
| | | }).registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(MoneyBigDecimalUtil.getWithNoZera(value).toString());
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getUserMoneyStatistic")
|
| | | public void getUserMoneyStatistic(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | UserMoneyStatisticVO vo = new UserMoneyStatisticVO();
|
| | | vo.setBalanceMoney(new BigDecimal("0.02"));
|
| | | vo.setLastMonthExtractMoney(new BigDecimal("0.03"));
|
| | | vo.setLastMonthRecievedMoney(new BigDecimal("0.04"));
|
| | | vo.setLatestThreeMonthRecievedMoney(new BigDecimal("0.05"));
|
| | | vo.setMonthExtractMoney(new BigDecimal("0.06"));
|
| | | vo.setMonthRecievedMoney(new BigDecimal("0.07"));
|
| | | vo.setTotalInviteMoney(new BigDecimal("0.08"));
|
| | | vo.setTotalRecievedMoney(new BigDecimal("0.09"));
|
| | | vo.setTotalShareMoney(new BigDecimal("0.10"));
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(vo)));
|
| | | }
|
| | |
|
| | | }
|