首页设备列表
This commit is contained in:
@@ -1,228 +1,225 @@
|
||||
package com.ckkj.water.plate.mvp;
|
||||
|
||||
import com.ckkj.water.base.BasePresenter;
|
||||
import com.ckkj.water.chat.mvp.IndexContract;
|
||||
import com.ckkj.water.chat.mvp.IndexImpl;
|
||||
import com.ckkj.water.fate.entity.CityDataEntity;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.plate.entity.BaziResultBean;
|
||||
import com.ckkj.water.plate.entity.BaziSaveSuccessEntity;
|
||||
import com.ckkj.water.plate.entity.PaipanHistoryEntity;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author fengxiaoyang
|
||||
* @date 2025/7/30
|
||||
* @description TODO: 描述该类的作用
|
||||
*/
|
||||
|
||||
public class PlatePresenter extends BasePresenter<PlateContract.PlateView> {
|
||||
private PlateImpl impl;
|
||||
|
||||
public PlatePresenter(PlateImpl impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排盘,直接调用缘份居 Api
|
||||
* @param map
|
||||
*/
|
||||
public void startPaiPan(Map<String, Object> map) {
|
||||
impl.startPaiPanByYfjApi(map, new PlateContract.CallBack<BaziResultBean>() {
|
||||
@Override
|
||||
public void success(BaziResultBean entity) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().getPaipanResult(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String msg) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().showError(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传八字结果
|
||||
*
|
||||
* @param result
|
||||
* @param cityData
|
||||
* @param timeType
|
||||
*/
|
||||
public void uploadBaziResult(BaziResultBean result, CityDataEntity cityData, int timeType) {
|
||||
try {
|
||||
BaziResultBean.BaseInfoDTO baseInfoDTO = result.getBaseInfo();
|
||||
BaziResultBean.DetailInfoDTO.SizhuInfoDTO sizhuInfoDTO = result.getDetailInfo().getSizhuInfo();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name",baseInfoDTO.getName());
|
||||
json.put("gender",baseInfoDTO.getSex().equals("乾造")? "0" : "1");
|
||||
json.put("birthType",timeType == 2001 ? "1":"0");
|
||||
json.put("yangLiBirthTime",baseInfoDTO.getGongli());
|
||||
json.put("yinLiBirthTime",baseInfoDTO.getNongli());
|
||||
json.put("birthPlace",cityData == null ? "北京市": cityData.getCityName());
|
||||
json.put("province",cityData == null ? "北京市": cityData.getProvinceName());
|
||||
json.put("city",cityData == null ? "北京": cityData.getCityName());
|
||||
json.put("openSolarTime","2");
|
||||
json.put("nianZhu",sizhuInfoDTO.getYear().getTg() + "," + sizhuInfoDTO.getYear().getDz());
|
||||
json.put("yueZhu",sizhuInfoDTO.getMonth().getTg() + "," + sizhuInfoDTO.getMonth().getDz());
|
||||
json.put("riZhu",sizhuInfoDTO.getDay().getTg() + "," + sizhuInfoDTO.getDay().getDz());
|
||||
json.put("shiZhu",sizhuInfoDTO.getHour().getTg() + "," + sizhuInfoDTO.getHour().getDz());
|
||||
impl.saveUserBirthInfo(json, new PlateContract.CallBack<BaziSaveSuccessEntity>() {
|
||||
@Override
|
||||
public void success(BaziSaveSuccessEntity bean) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().saveBaziResultSuccess(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String msg) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().showError(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取历史运势
|
||||
* @param page
|
||||
*/
|
||||
public void getHistoryDatas(int page) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageNum", page);
|
||||
map.put("pageSize", 10);
|
||||
impl.getPaipanHistoryList(map, new PlateContract.CallBack<PaipanHistoryEntity>() {
|
||||
|
||||
@Override
|
||||
public void success(PaipanHistoryEntity entity) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().getHistorySuccess(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String msg) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().showError(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
* @param id
|
||||
*/
|
||||
public void deleteRecordByID(String id,int pos) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("recordId", id);
|
||||
impl.deleteRecordByID(map, new PlateContract.CallBack<BaseBean>() {
|
||||
@Override
|
||||
public void success(BaseBean bean) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().deletePaipanHistorySuccess(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String msg) {
|
||||
if(PlatePresenter.this.getView() != null){
|
||||
PlatePresenter.this.getView().showError(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ai 分析八字
|
||||
* @param mSaveEntity
|
||||
*/
|
||||
public void AiParseBaziResult(BaziSaveSuccessEntity mSaveEntity) {
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("resultId", mSaveEntity.getRecordId());
|
||||
impl.sendMsgToAi(json, new PlateContract.AiStreamCallback() {
|
||||
@Override
|
||||
public void onMessage(String messageChunk) {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
PlatePresenter.this.getView().onStreamMessageReceived(messageChunk);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
PlatePresenter.this.getView().showError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(String complateContent) {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
PlatePresenter.this.getView().onStreamComplete(complateContent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionReceived(String sessionId) {
|
||||
// 这个回调在当前场景下可能不需要,但保留接口一致性
|
||||
// Log.d("PlatePresenter", "Session received: " + sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginLost() {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
// 处理登录失效的情况
|
||||
// 这里可以根据需要跳转到登录页面
|
||||
// Log.w("PlatePresenter", "Login lost");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 举报
|
||||
* @param reason
|
||||
*/
|
||||
public void commitReport(String reason) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("content", reason);
|
||||
new IndexImpl().commitReport(map, new IndexContract.CallBack<BaseBean>() {
|
||||
@Override
|
||||
public void success(BaseBean bean) {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
PlatePresenter.this.getView().commitReportSuccess(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String msg) {
|
||||
if (PlatePresenter.this.getView() != null) {
|
||||
PlatePresenter.this.getView().showError(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//package com.ckkj.water.plate.mvp;
|
||||
//
|
||||
//import com.ckkj.water.base.BasePresenter;
|
||||
//import com.ckkj.water.network.BaseBean;
|
||||
//import com.ckkj.water.plate.entity.BaziResultBean;
|
||||
//import com.ckkj.water.plate.entity.BaziSaveSuccessEntity;
|
||||
//import com.ckkj.water.plate.entity.PaipanHistoryEntity;
|
||||
//
|
||||
//import org.json.JSONException;
|
||||
//import org.json.JSONObject;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @author fengxiaoyang
|
||||
// * @date 2025/7/30
|
||||
// * @description TODO: 描述该类的作用
|
||||
// */
|
||||
//
|
||||
//public class PlatePresenter extends BasePresenter<PlateContract.PlateView> {
|
||||
// private PlateImpl impl;
|
||||
//
|
||||
// public PlatePresenter(PlateImpl impl) {
|
||||
// this.impl = impl;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 排盘,直接调用缘份居 Api
|
||||
// * @param map
|
||||
// */
|
||||
// public void startPaiPan(Map<String, Object> map) {
|
||||
// impl.startPaiPanByYfjApi(map, new PlateContract.CallBack<BaziResultBean>() {
|
||||
// @Override
|
||||
// public void success(BaziResultBean entity) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().getPaipanResult(entity);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fail(String msg) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().showError(msg);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 上传八字结果
|
||||
// *
|
||||
// * @param result
|
||||
// * @param cityData
|
||||
// * @param timeType
|
||||
// */
|
||||
// public void uploadBaziResult(BaziResultBean result, CityDataEntity cityData, int timeType) {
|
||||
// try {
|
||||
// BaziResultBean.BaseInfoDTO baseInfoDTO = result.getBaseInfo();
|
||||
// BaziResultBean.DetailInfoDTO.SizhuInfoDTO sizhuInfoDTO = result.getDetailInfo().getSizhuInfo();
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("name",baseInfoDTO.getName());
|
||||
// json.put("gender",baseInfoDTO.getSex().equals("乾造")? "0" : "1");
|
||||
// json.put("birthType",timeType == 2001 ? "1":"0");
|
||||
// json.put("yangLiBirthTime",baseInfoDTO.getGongli());
|
||||
// json.put("yinLiBirthTime",baseInfoDTO.getNongli());
|
||||
// json.put("birthPlace",cityData == null ? "北京市": cityData.getCityName());
|
||||
// json.put("province",cityData == null ? "北京市": cityData.getProvinceName());
|
||||
// json.put("city",cityData == null ? "北京": cityData.getCityName());
|
||||
// json.put("openSolarTime","2");
|
||||
// json.put("nianZhu",sizhuInfoDTO.getYear().getTg() + "," + sizhuInfoDTO.getYear().getDz());
|
||||
// json.put("yueZhu",sizhuInfoDTO.getMonth().getTg() + "," + sizhuInfoDTO.getMonth().getDz());
|
||||
// json.put("riZhu",sizhuInfoDTO.getDay().getTg() + "," + sizhuInfoDTO.getDay().getDz());
|
||||
// json.put("shiZhu",sizhuInfoDTO.getHour().getTg() + "," + sizhuInfoDTO.getHour().getDz());
|
||||
// impl.saveUserBirthInfo(json, new PlateContract.CallBack<BaziSaveSuccessEntity>() {
|
||||
// @Override
|
||||
// public void success(BaziSaveSuccessEntity bean) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().saveBaziResultSuccess(bean);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fail(String msg) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().showError(msg);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } catch (JSONException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取历史运势
|
||||
// * @param page
|
||||
// */
|
||||
// public void getHistoryDatas(int page) {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("pageNum", page);
|
||||
// map.put("pageSize", 10);
|
||||
// impl.getPaipanHistoryList(map, new PlateContract.CallBack<PaipanHistoryEntity>() {
|
||||
//
|
||||
// @Override
|
||||
// public void success(PaipanHistoryEntity entity) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().getHistorySuccess(entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fail(String msg) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().showError(msg);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除记录
|
||||
// * @param id
|
||||
// */
|
||||
// public void deleteRecordByID(String id,int pos) {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("recordId", id);
|
||||
// impl.deleteRecordByID(map, new PlateContract.CallBack<BaseBean>() {
|
||||
// @Override
|
||||
// public void success(BaseBean bean) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().deletePaipanHistorySuccess(pos);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fail(String msg) {
|
||||
// if(PlatePresenter.this.getView() != null){
|
||||
// PlatePresenter.this.getView().showError(msg);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * ai 分析八字
|
||||
// * @param mSaveEntity
|
||||
// */
|
||||
// public void AiParseBaziResult(BaziSaveSuccessEntity mSaveEntity) {
|
||||
// try {
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("resultId", mSaveEntity.getRecordId());
|
||||
// impl.sendMsgToAi(json, new PlateContract.AiStreamCallback() {
|
||||
// @Override
|
||||
// public void onMessage(String messageChunk) {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// PlatePresenter.this.getView().onStreamMessageReceived(messageChunk);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(String error) {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// PlatePresenter.this.getView().showError(error);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete(String complateContent) {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// PlatePresenter.this.getView().onStreamComplete(complateContent);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSessionReceived(String sessionId) {
|
||||
// // 这个回调在当前场景下可能不需要,但保留接口一致性
|
||||
// // Log.d("PlatePresenter", "Session received: " + sessionId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loginLost() {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// // 处理登录失效的情况
|
||||
// // 这里可以根据需要跳转到登录页面
|
||||
// // Log.w("PlatePresenter", "Login lost");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } catch (JSONException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 举报
|
||||
// * @param reason
|
||||
// */
|
||||
// public void commitReport(String reason) {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("content", reason);
|
||||
// new IndexImpl().commitReport(map, new IndexContract.CallBack<BaseBean>() {
|
||||
// @Override
|
||||
// public void success(BaseBean bean) {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// PlatePresenter.this.getView().commitReportSuccess(bean);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fail(String msg) {
|
||||
// if (PlatePresenter.this.getView() != null) {
|
||||
// PlatePresenter.this.getView().showError(msg);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user