package com.steerinfo.ems.trmindexvalue.controller;

import com.steerinfo.framework.controller.BaseRESTfulController;
import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.auth.utils.JwtUtil;
import com.steerinfo.ems.formula.service.IFormulaService;
import com.steerinfo.ems.trmactvalue.controller.TRmActValueController;
import com.steerinfo.ems.trmactvalue.model.TRmActValue;
import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
import com.steerinfo.ems.trmindexitem.mapper.TRmIndexItemMapper;
import com.steerinfo.ems.trmindexitem.model.TRmIndexItem;
import com.steerinfo.ems.trmindexvalue.model.TRmIndexValue;
import com.steerinfo.ems.trmindexvalue.service.ITRmIndexValueService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * TRmIndexValue RESTful接口：
 * @author generator
 * @version 1.0-SNAPSHORT 2019-11-15 11:24
 * 类描述
 * 修订历史：
 * 日期：2019-11-15
 * 作者：generator
 * 参考：
 * 描述：TRmIndexValue RESTful接口
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@RestController
@RequestMapping("/${api.version}/trmindexvalues")
public class TRmIndexValueController extends BaseRESTfulController {
	private static final Logger logger = LoggerFactory.getLogger(TRmActValueController.class);

    @Autowired
    ITRmIndexValueService tRmIndexValueService;
    
    @Autowired
    private TRmIndexItemMapper tRmIndexItemMapper;
    
    @Autowired
    IFormulaService formulaService;

    @ApiOperation(value="获取列表", notes="分页查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("trmindexvalue:view")
    @GetMapping(value = "/")
    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<TRmIndexValue> list = tRmIndexValueService.queryForPage(parmas, pageNum, pageSize);
        return success(list);
    }

    @ApiOperation(value="获取列表", notes="分页模糊查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("trmindexvalue:view")
    @GetMapping(value = "/like/")
    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<TRmIndexValue> list = tRmIndexValueService.queryLikeForPage(parmas, pageNum, pageSize);
        return success(list);
    }
    
    @ApiOperation(value="创建", notes="根据TRmIndexValue对象创建")
    @ApiImplicitParam(name = "tRmIndexValue", value = "详细实体tRmIndexValue", required = true, dataType = "TRmIndexValue")
    //@RequiresPermissions("trmindexvalue:create")
    @PostMapping(value = "/")
    public RESTfulResult add(@ModelAttribute TRmIndexValue model){
        TRmIndexValue tRmIndexValue = tRmIndexValueService.add(model);
        return success(tRmIndexValue);
    }

    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
    @ApiImplicitParam(name = "tRmIndexValue", value = "详细实体tRmIndexValue", required = true, dataType = "TRmIndexValue")
    //@RequiresPermissions("trmindexvalue:view")
    @PostMapping(value = "/info", produces  = "application/json;charset=UTF-8")
    public RESTfulResult get(@RequestBody TRmIndexValue model){
    	if(model.getClock() == null || model.getClock().isEmpty()){
    		return failed(null, "请传入时间");
    	}
    	if(model.getTimegranid() == null || model.getTimegranid().isEmpty()){
    		return failed(null, "请传入时间粒度");
    	}
    	if(model.getItemid() == null || model.getItemid().isEmpty()){
    		return failed(null, "请传入计量点编号");
    	}
    	HashMap<String, Object> m = new HashMap<String, Object>();
    	m.put("clock", model.getClock());
    	m.put("timegranid", model.getTimegranid());
    	m.put("itemid", model.getItemid());
        model.setId(m);
        TRmIndexValue tRmIndexValue = tRmIndexValueService.getById(m);
        return success(tRmIndexValue);
    }

    @ApiOperation(value="更新详细信息，自动重新计算", notes="更新tRmIndexValue，自动重新计算")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "tRmIndexValue", value = "详细实体tRmIndexValue", required = true, dataType = "TRmIndexValue")
    })
    //@RequiresPermissions("trmindexvalue:update")
    @PutMapping(value = "/update", produces  = "application/json;charset=UTF-8")
    public RESTfulResult update(@RequestBody TRmIndexValue model){
    	if(model.getClock() == null || model.getClock().isEmpty()){
    		return failed(null, "请传入时间");
    	}
    	if(model.getTimegranid() == null || model.getTimegranid().isEmpty()){
    		return failed(null, "请传入时间粒度");
    	}
    	if(model.getItemid() == null || model.getItemid().isEmpty()){
    		return failed(null, "请传入计量点编号");
    	}
    	if(model.getApportvalue() == null){
    		return failed(null, "请传入最终值");
    	}
    	if(model.getActualvalue() == null){
    		return failed(null, "请传入计算值");
    	}
    	if(model.getCorrectvalue() == null){
    		return failed(null, "请传入修正值");
    	}
    	if(model.getActualvalue().add(model.getCorrectvalue()).compareTo(model.getApportvalue()) != 0){
    		return failed(null, "数值错误，最终值 = 计算值 + 修正值");
    	}
    	HashMap<String, Object> m = new HashMap<String, Object>();
    	m.put("clock", model.getClock());
    	m.put("timegranid", model.getTimegranid());
    	m.put("itemid", model.getItemid());
        model.setId(m);
        // 修改后重新计算
        TRmIndexValue tRmIndexValue = tRmIndexValueService.modifyAndCompute(model);
        return success(tRmIndexValue);
    }

    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
    @ApiImplicitParam(name = "tRmIndexValue", value = "详细实体tRmIndexValue", required = true, dataType = "TRmIndexValue")
    //@RequiresPermissions("trmindexvalue:delete")
    @DeleteMapping(value = "/delete", produces  = "application/json;charset=UTF-8")
    public RESTfulResult delete(@RequestBody TRmIndexValue model){
    	if(model.getClock() == null || model.getClock().isEmpty()){
    		return failed(null, "请传入开始时间");
    	}
    	if(model.getTimegranid() == null || model.getTimegranid().isEmpty()){
    		return failed(null, "请传入时间粒度");
    	}
    	if(model.getItemid() == null || model.getItemid().isEmpty()){
    		return failed(null, "请传入计量点编号");
    	}
    	HashMap<String, Object> id = new HashMap<String, Object>();
    	id.put("clock", model.getClock());
    	id.put("timegranid", model.getTimegranid());
    	id.put("itemid", model.getItemid());
        model.setId(id);
        tRmIndexValueService.delete(id);
        return success();
    }

    @ApiOperation(value="获取列表", notes="分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    @GetMapping("/getTRmIndexValues")
    public RESTfulResult getTRmIndexValues(@RequestParam HashMap<String, Object> parmas,Integer pageNum, Integer pageSize){
    	if(parmas.get("itemtype")!=null && !parmas.get("itemtype").toString().isEmpty()){
			String itemtype = parmas.get("itemtype").toString();
			if(!itemtype.startsWith("'")){
				itemtype = "'" + itemtype.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("itemtype", itemtype);
		}
    	if(parmas.get("energyid")!=null && !parmas.get("energyid").toString().isEmpty()){
			String energyid = parmas.get("energyid").toString();
			if(!energyid.startsWith("'")){
				energyid = "'" + energyid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("energyid", energyid);
		}
    	if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
			String workprocid = parmas.get("workprocid").toString();
			if(!workprocid.startsWith("'")){
				workprocid = "'" + workprocid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("workprocid", workprocid);
		}
    	if(parmas.get("factoryid")!=null && !parmas.get("factoryid").toString().isEmpty()){
			String factoryid = parmas.get("factoryid").toString();
			if(!factoryid.startsWith("'")){
				factoryid = "'" + factoryid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("factoryid", factoryid);
		}
    	if(parmas.get("propertyid")!=null && !parmas.get("propertyid").toString().isEmpty()){
			String propertyid = parmas.get("propertyid").toString();
			if(!propertyid.startsWith("'")){
				propertyid = "'" + propertyid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("propertyid", propertyid);
		}
        PageList<Map<String,Object>>  tRmIndexValues = tRmIndexValueService.getTRmIndexValues(parmas, pageNum, pageSize);
        return success(tRmIndexValues);
    }
    
    @ApiOperation(value="批量更新详细信息", notes="根据url的id来指定更新对象，并根据传过来的TRmIndexItem信息来更新详细信息")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "TRmIndexItem", value = "详细实体TRmIndexItem", required = true, dataType = "TRmIndexItem")
    })
    //@RequiresPermissions("emscalpointvalue:update")
    @PutMapping(value = "/batchupdate", produces  = "application/json;charset=UTF-8")
    public RESTfulResult update(@RequestBody TRmIndexValue[] model){
    	String failmsg = "";
    	int failnum = 0;
    	for (int i = 0; i< model.length; i++) {
    		BigDecimal ctualvalue =  model[i].getActualvalue(); // 计算值
    		BigDecimal correctvalue = model[i].getCorrectvalue()==null? BigDecimal.ZERO : model[i].getCorrectvalue(); // 修正值
    		BigDecimal apportvalue = model[i].getApportvalue(); // 最终值
    		model[i].setCorrectvalue(correctvalue);
    		if(ctualvalue == null || correctvalue == null || apportvalue == null){
    			failnum++;
    			failmsg += "[itemid:" + model[i].getItemid() + ",clock:" + model[i].getClock() + ",timegranid:" + model[i].getTimegranid()+"]数据不完整;";
    			continue;
    		}
    		if(ctualvalue.add(correctvalue).doubleValue() != apportvalue.doubleValue()){
    			failnum++;
    			failmsg += "[itemid:" + model[i].getItemid() + ",clock:" + model[i].getClock() + ",timegranid:" + model[i].getTimegranid()+"]数据错误;";
    			continue;
    		}
    		tRmIndexValueService.modify(model[i]);
    	}
    	if(!failmsg.isEmpty()){
    		return success("51","本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条:" + failmsg);
    	}
        return success();
    }
    
    @ApiOperation(value="批量重新计算", notes="根据url的id来指定更新对象，并根据传过来的TRmActValue信息来更新详细信息")
    @ApiImplicitParam(name = "TRmActValue", value = "详细实体TRmActValue", required = true, dataType = "TRmActValue")
    //@RequiresPermissions("trmcalpointvalue:update")
    @PutMapping(value = "/batchCompute", produces  = "application/json;charset=UTF-8")
    public RESTfulResult batchCompute(@RequestBody TRmIndexValue[] model){
    	if(model.length<1){
    		return failed(null, "请传入数据");
    	}
    	for (int i = 0; i< model.length; i++) {
    		TRmIndexValue tv = model[i];
    		tRmIndexValueService.restatData(tv.getItemid(), tv.getClock(), tv.getTimegranid(), JwtUtil.getUseridByToken());
    	}
    	return success();
    }
    
    @ApiOperation(value="指标数据查询", notes="分页查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("trmindexvalue:view")
    @GetMapping(value = "/getIndexData")
    public RESTfulResult getIndexVal(@RequestParam HashMap<String, Object> parmas,Integer pageNum, Integer pageSize){
    	if(!parmas.containsKey("clock") || parmas.get("clock").toString().isEmpty()){
    		return failed(null, "请传入时间");
        }
    	String clock = parmas.get("clock").toString();
    	// 除实绩，其他类型日粒度按照月数据计算
    	String clock2 = clock.length()>7 ? clock.substring(0,7) : clock;
    	parmas.put("clock2", clock2);
    	if(parmas.get("energyid")!=null && !parmas.get("energyid").toString().isEmpty()){
			String energyid = parmas.get("energyid").toString();
			if(!energyid.startsWith("'")){
				energyid = "'" + energyid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("energyid", energyid);
		}
    	if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
			String workprocid = parmas.get("workprocid").toString();
			if(!workprocid.startsWith("'")){
				workprocid = "'" + workprocid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("workprocid", workprocid);
		}
    	if(parmas.get("indextype")!=null && !parmas.get("indextype").toString().isEmpty()){
			String indextype = parmas.get("indextype").toString();
			if(!indextype.startsWith("'")){
				indextype = "'" + indextype.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("indextype", indextype);
		}
        PageList<Map<String,Object>> list = tRmIndexValueService.getIndexData(parmas, pageNum, pageSize);
        return success(list);
    }

    @ApiOperation(value = "获取视图节点数据",notes = "能源综合分析 - 经济指标分析 -重要指标展示-企业吨产品水耗趋势图")
    @GetMapping("/chtResult5")
    public RESTfulResult chtResult5(@RequestParam HashMap<String,Object> parmas){
    	if(parmas==null || !parmas.containsKey("clock") || parmas.get("clock").toString().isEmpty()){
    		return failed(null, "请选择年度");
        }
        List<Map<String, Object>> maps = tRmIndexValueService.chtResult5(parmas);
        return success(maps);
    }

    @ApiOperation(value = "获取视图节点数据",notes = "能源综合分析 - 经济指标分析 -重要指标展示-企业吨产品电耗趋势图")
    @GetMapping("/chtResult6")
    public RESTfulResult chtResult6(@RequestParam HashMap<String,Object> parmas){
    	if(parmas==null || !parmas.containsKey("clock") || parmas.get("clock").toString().isEmpty()){
    		return failed(null, "请选择年度");
        }
        List<Map<String, Object>> maps = tRmIndexValueService.chtResult6(parmas);
        return  success(maps);
    }
    
    @ApiOperation(value = "获取视图节点数据",notes = "能源综合分析 - 经济指标分析 -重要指标展示-企业能源消耗耗趋势图")
    @GetMapping("/chtResult7")
    public RESTfulResult chtResult7(@RequestParam HashMap<String,Object> parmas){
    	if(parmas==null || !parmas.containsKey("clock") || parmas.get("clock").toString().isEmpty()){
    		return failed(null, "请选择年度");
        }
        List<Map<String, Object>> maps = tRmIndexValueService.chtResult7(parmas);
        return  success(maps);
    }

    @ApiOperation(value = "获取视图节点数据",notes = "能源综合分析 - 经济指标分析 -重要指标展示-企业能源消耗耗结构图")
    @GetMapping("/chtResult10")
    public RESTfulResult chtResult10(@RequestParam HashMap<String,Object> parmas){
    	if(parmas==null || !parmas.containsKey("clock") || parmas.get("clock").toString().isEmpty()){
    		return failed(null, "请选择年度");
        }
        List<Map<String, Object>> maps = tRmIndexValueService.chtResult10(parmas);
        return success(maps);
    }
    
    @ApiOperation(value="重新生成数据", notes="")
    //@RequiresPermissions("trmcalpointvalue:view")
    @GetMapping(value = "/reData")
    public RESTfulResult reData(@RequestParam HashMap<String, Object> parmas, String clock, String clocke, String timegranid){
    	if (clock==null || clock.isEmpty()) {
    		return failed(null, "请传入起始时间");
    	}
    	if (clocke==null || clocke.isEmpty()) {
    		return failed(null, "请传入结束时间");
    	}
		if (timegranid==null || timegranid.isEmpty()) {
			return failed(null, "请传入时间粒度");
    	}
		if(parmas.get("itemtype")!=null && !parmas.get("itemtype").toString().isEmpty()){
			String itemtype = parmas.get("itemtype").toString();
			if(!itemtype.startsWith("'")){
				itemtype = "'" + itemtype.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("itemtype", itemtype);
		}
    	if(parmas.get("energyid")!=null && !parmas.get("energyid").toString().isEmpty()){
			String energyid = parmas.get("energyid").toString();
			if(!energyid.startsWith("'")){
				energyid = "'" + energyid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("energyid", energyid);
		}
    	if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
			String workprocid = parmas.get("workprocid").toString();
			if(!workprocid.startsWith("'")){
				workprocid = "'" + workprocid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("workprocid", workprocid);
		}
		String res = "";
		parmas.put("useflag", "1");
		parmas.put("itemflag", "3");
		List<TRmIndexItem> l = tRmIndexItemMapper.selectLikeByParameters(parmas);
		int size = l.size();
		for(int i = 0; i<l.size(); i++){
			if(res.isEmpty()){
				res = formulaService.reItemVal(l.get(i).getItemid(),clock,timegranid,clocke);
			}else{
				formulaService.reItemVal(l.get(i).getItemid(),clock,timegranid,clocke);
			}
			logger.info("剩下要处理的项目数：" + (size-1-i) + "(" + size + ")");
		}
		if(!res.isEmpty()){
			return success(null, res);
		}
        return success(null, res);
    }
    
    @ApiOperation(value="财务数据批量重新计算", notes="根据url的id来指定更新对象，并根据传过来的TRmActValue信息来更新详细信息")
    @ApiImplicitParam(name = "TRmActValue", value = "详细实体TRmActValue", required = true, dataType = "TRmActValue")
    //@RequiresPermissions("trmcalpointvalue:update")
    @PutMapping(value = "/batchComputeF", produces  = "application/json;charset=UTF-8")
    public RESTfulResult batchComputeF(@RequestBody TRmIndexValue[] model){
    	if(model.length<1){
    		return failed(null, "请传入数据");
    	}
    	for (int i = 0; i< model.length; i++) {
    		TRmIndexValue tv = model[i];
    		tRmIndexValueService.restatDataF(tv.getItemid(), tv.getClock(), tv.getTimegranid(), JwtUtil.getUseridByToken());
    	}
    	return success();
    }
    
    @ApiOperation(value="重新生成财务数据", notes="")
    //@RequiresPermissions("trmcalpointvalue:view")
    @GetMapping(value = "/reDataF")
    public RESTfulResult reDataF(@RequestParam HashMap<String, Object> parmas, String clock, String clocke, String timegranid){
    	if (clock==null || clock.isEmpty()) {
    		return failed(null, "请传入起始时间");
    	}
    	if (clocke==null || clocke.isEmpty()) {
    		return failed(null, "请传入结束时间");
    	}
		if (timegranid==null || timegranid.isEmpty()) {
			return failed(null, "请传入时间粒度");
    	}
		if(parmas.get("itemtype")!=null && !parmas.get("itemtype").toString().isEmpty()){
			String itemtype = parmas.get("itemtype").toString();
			if(!itemtype.startsWith("'")){
				itemtype = "'" + itemtype.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("itemtype", itemtype);
		}
    	if(parmas.get("energyid")!=null && !parmas.get("energyid").toString().isEmpty()){
			String energyid = parmas.get("energyid").toString();
			if(!energyid.startsWith("'")){
				energyid = "'" + energyid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("energyid", energyid);
		}
    	if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
			String workprocid = parmas.get("workprocid").toString();
			if(!workprocid.startsWith("'")){
				workprocid = "'" + workprocid.replaceAll(",", "','").replaceAll("，", "','") + "'";
			}
			parmas.put("workprocid", workprocid);
		}
		String res = "";
		parmas.put("useflag", "1");
		parmas.put("itemflag", "3");
		List<TRmIndexItem> l = tRmIndexItemMapper.selectLikeByParameters(parmas);
		int size = l.size();
		for(int i = 0; i<l.size(); i++){
			if(res.isEmpty()){
				res = formulaService.reItemVal(l.get(i).getItemid(),clock,timegranid,clocke);
			}else{
				formulaService.reItemVal(l.get(i).getItemid(),clock,timegranid,clocke);
			}
			logger.info("剩下要处理的项目数：" + (size-1-i) + "(" + size + ")");
		}
		if(!res.isEmpty()){
			return success(null, res);
		}
        return success(null, res);
    }
    
    @ApiOperation(value="批量更新详细信息-联动计算", notes="")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "TRmIndexValue", value = "TRmIndexValue", required = true, dataType = "TRmIndexValue")
    })
    //@RequiresPermissions("emscalpointvalue:update")
    @PutMapping(value = "/batchupdate2", produces  = "application/json;charset=UTF-8")
    public RESTfulResult update2(@RequestBody TRmIndexValue[] model){
    	String failmsg = "";
    	int failnum = 0;
    	for (int i = 0; i< model.length; i++) {
    		BigDecimal ctualvalue =  model[i].getActualvalue(); // 计算值
    		BigDecimal correctvalue = model[i].getCorrectvalue()==null? BigDecimal.ZERO : model[i].getCorrectvalue(); // 修正值
    		BigDecimal apportvalue = model[i].getApportvalue(); // 最终值
    		model[i].setCorrectvalue(correctvalue);
    		if(ctualvalue == null || correctvalue == null || apportvalue == null){
    			failnum++;
    			failmsg += "[itemid:" + model[i].getItemid() + ",clock:" + model[i].getClock() + ",timegranid:" + model[i].getTimegranid()+"]数据不完整;";
    			continue;
    		}
    		if(ctualvalue.add(correctvalue).doubleValue() != apportvalue.doubleValue()){
    			failnum++;
    			failmsg += "[itemid:" + model[i].getItemid() + ",clock:" + model[i].getClock() + ",timegranid:" + model[i].getTimegranid()+"]数据错误;";
    			continue;
    		}
    		tRmIndexValueService.modify(model[i]);
    		formulaService.reCalculate(model[i].getItemid(), model[i].getClock(), model[i].getTimegranid(), model[i].getClock());
    	}
    	if(!failmsg.isEmpty()){
    		return success("51","本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条:" + failmsg);
    	}
        return success();
    }
}
