|
@@ -0,0 +1,98 @@
|
|
|
+package com.shkpr.service.aimodelpower.dbdao.services;
|
|
|
+
|
|
|
+import com.global.base.log.LogLevelFlag;
|
|
|
+import com.global.base.log.LogPrintMgr;
|
|
|
+import com.global.base.tools.FastJsonUtil;
|
|
|
+import com.shkpr.service.aimodelpower.commtools.CommTool;
|
|
|
+import com.shkpr.service.aimodelpower.constants.LogFlagBusiType;
|
|
|
+import com.shkpr.service.aimodelpower.dbdao.mapper.WODispatchCmdPatchDisposalMapper;
|
|
|
+import com.shkpr.service.aimodelpower.dbdao.mapper.WODispatchCmdPatchItemMapper;
|
|
|
+import com.shkpr.service.aimodelpower.dbdao.services.intef.WODispatchCmdBatchItemDBService;
|
|
|
+import com.shkpr.service.aimodelpower.dbdao.tables.WODispatchCmdPatchItemTable;
|
|
|
+import com.shkpr.service.aimodelpower.dto.woDispatchPlanModel.DispatchCmdBatchDispoalModel;
|
|
|
+import com.shkpr.service.aimodelpower.dto.woDispatchPlanModel.DispatchCmdBatchItemModel;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName WODispatchCmdBatchItemDBServiceImpl
|
|
|
+ * @Description: TODO
|
|
|
+ * @Author LX
|
|
|
+ * @Date 2024/7/9
|
|
|
+ * @Version V1.0
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+public class WODispatchCmdBatchItemDBServiceImpl implements WODispatchCmdBatchItemDBService,WODispatchCmdPatchItemTable {
|
|
|
+
|
|
|
+ private String mStrClassName = "";
|
|
|
+ private String mBusinessType = "";
|
|
|
+ private String logTag = "";
|
|
|
+ public WODispatchCmdBatchItemDBServiceImpl() {
|
|
|
+ mStrClassName = this.getClass().getSimpleName();
|
|
|
+ mBusinessType = LogFlagBusiType.BUSI_DB_WO_DISPATCH_PLAN.toStrValue();
|
|
|
+ logTag = "WO Dispatch Cmd Batch Item";
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ WODispatchCmdPatchItemMapper woDispatchCmdPatchItemMapper;
|
|
|
+
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ WODispatchCmdPatchDisposalMapper woDispatchCmdPatchDisposalMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DispatchCmdBatchItemModel> listAllWithsExByDispoal(String table, String filed, int limit, int offset, Map<String, Object> andWheres, Map<String, Object> orWheres, String orderBy, String extend) {
|
|
|
+ int nCode = 0;
|
|
|
+ String strMsg = "Success";
|
|
|
+ List<Map<String, Object>> arrRes = null;
|
|
|
+ List<DispatchCmdBatchItemModel> newArrRes = null;
|
|
|
+ try {
|
|
|
+ arrRes = woDispatchCmdPatchItemMapper.listAllWiths(table, filed, limit, offset, andWheres, orWheres, orderBy, extend);
|
|
|
+
|
|
|
+ if(!CollectionUtils.isEmpty(arrRes)){
|
|
|
+ newArrRes = new ArrayList<>();
|
|
|
+ for (int i = 0; i < arrRes.size(); i++) {
|
|
|
+ DispatchCmdBatchItemModel dispatchCmdBatchItemModel = FastJsonUtil.map2Obj(arrRes.get(0),DispatchCmdBatchItemModel.class,true);
|
|
|
+
|
|
|
+ //查询相关联的处置建议
|
|
|
+ Map<String,Object> queryMap = new HashMap<>();
|
|
|
+ queryMap.put(R_INFO.PRIMARY_KEY,arrRes.get(i).get(R_INFO.PRIMARY_KEY));
|
|
|
+ List<Map<String,Object>> disposalMapList = woDispatchCmdPatchDisposalMapper.listAllWiths("","",1,0,queryMap,new HashMap<>(),"","");
|
|
|
+ List<DispatchCmdBatchDispoalModel> dispoalModels = new ArrayList<>();
|
|
|
+ if(!CollectionUtils.isEmpty(disposalMapList)){
|
|
|
+ dispoalModels = FastJsonUtil.batchMap2Obj(disposalMapList,DispatchCmdBatchDispoalModel.class,true);
|
|
|
+ }
|
|
|
+ dispatchCmdBatchItemModel.setDispoalModels(dispoalModels);
|
|
|
+ newArrRes.add(dispatchCmdBatchItemModel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newArrRes;
|
|
|
+ }catch (Exception e){
|
|
|
+ nCode = LogLevelFlag.LOG_ERROR.ordinal();
|
|
|
+ strMsg = e.getLocalizedMessage();
|
|
|
+ }finally {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.valueFromInt(nCode)
|
|
|
+ , mBusinessType
|
|
|
+ , mStrClassName
|
|
|
+ , String.format("List All %s lines(limit=%d, offset=%d, orderBy=%s, back.size=%d) from database, code:{%d} msg:{%s} ..."
|
|
|
+ , logTag
|
|
|
+ , limit, offset
|
|
|
+ , orderBy
|
|
|
+ , CommTool.listSize(arrRes)
|
|
|
+ , nCode, strMsg));
|
|
|
+ }
|
|
|
+ return newArrRes;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int totalCountsEx(String table, Map<String, Object> andWheres, Map<String, Object> orWheres, String extend) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|