package cn.com.countrygarden.bi.main.service.ck.impl;

import cn.com.countrygarden.bi.main.core.Response;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.dao.ShareConfigMapper;
import cn.com.countrygarden.bi.main.dao.ck.satisfaction.SatisfiedDissatisfiedNationwideMapper;
import cn.com.countrygarden.bi.main.dao.sys.UserRolesMapper;
import cn.com.countrygarden.bi.main.dao.twerp.hm.TbSysUserMapper;
import cn.com.countrygarden.bi.main.dto.ck.SatisfactionDisplayDTO;
import cn.com.countrygarden.bi.main.dto.ck.SatisfiedDissatisfiedNationwideDTO;
import cn.com.countrygarden.bi.main.exception.ServiceException;
import cn.com.countrygarden.bi.main.model.AccessToken;
import cn.com.countrygarden.bi.main.model.PageData;
import cn.com.countrygarden.bi.main.model.ShareConfig;
import cn.com.countrygarden.bi.main.model.ck.satisfaction.SatisfiedDissatisfiedNationwide;
import cn.com.countrygarden.bi.main.model.sys.UserRoles;
import cn.com.countrygarden.bi.main.model.twerp.hm.TbSysUser;
import cn.com.countrygarden.bi.main.service.ck.SatisfiedDissatisfiedNationwideService;
import cn.com.countrygarden.bi.main.service.erp.impl.ExcelArrearageServiceImpl;
import cn.com.countrygarden.bi.main.util.MD5;
import cn.com.countrygarden.bi.main.util.erp.StringUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * <p>
 *   不满意因素-全国业务处理
 * </p>
 *
 * @author
 * @date 2021-08-06
 * @version V1.0
 */
@Service
@Transactional(rollbackFor = RuntimeException.class)
public class SatisfiedDissatisfiedNationwideServiceImpl implements SatisfiedDissatisfiedNationwideService {

    @Autowired
    private SatisfiedDissatisfiedNationwideMapper satisfiedDissatisfiedNationwideMapper;

    @Autowired
    private UserRolesMapper userRolesMapper;

    @Autowired
    private ShareConfigMapper shareConfigMapper;

    @Autowired
    private TbSysUserMapper tbSysUserMapper;

    private final org.slf4j.Logger logger = LoggerFactory.getLogger(ExcelArrearageServiceImpl.class);

    @Override
    public Result queryPageList(SatisfiedDissatisfiedNationwide satisfiedDissatisfiedNationwide, int page, int size, AccessToken accessToken) {
        List<String> rolesList = queryRoleCodes(null, accessToken.getUserCode());

        if (rolesList.contains("satisfaction_admin")) {

            if(StringUtil.isBlank(satisfiedDissatisfiedNationwide.getYearNian())){
                if(StringUtil.isNotBlank(satisfiedDissatisfiedNationwide.getNouchYue())){
                    String[] yuesr=satisfiedDissatisfiedNationwide.getNouchYue().split(",");
                    satisfiedDissatisfiedNationwide.setYueList(Arrays.asList(yuesr));
                    satisfiedDissatisfiedNationwide.setMonthStr(null);
                    List<String> niancha=satisfiedDissatisfiedNationwideMapper.niancha();
                    List<String> nianxin=new ArrayList<>();
                    for (int i = 0; i <satisfiedDissatisfiedNationwide.getYueList().size() ; i++) {
                        for (int j = 0; j <niancha.size() ; j++) {
                            String yuehie=niancha.get(j)+"-"+satisfiedDissatisfiedNationwide.getYueList().get(i);
                            nianxin.add(yuehie);
                        }
                    }
                    satisfiedDissatisfiedNationwide.setYueList(nianxin);
                }
            }

            if(StringUtil.isNotBlank(satisfiedDissatisfiedNationwide.getMonthStr())){
                String[] yuesr=satisfiedDissatisfiedNationwide.getMonthStr().split(",");
                satisfiedDissatisfiedNationwide.setYueList(Arrays.asList(yuesr));
                satisfiedDissatisfiedNationwide.setYearNian(null);
            }
            Long toble=satisfiedDissatisfiedNationwideMapper.selectListDataToble(satisfiedDissatisfiedNationwide);

            Page<Object> pageList = PageHelper.startPage(page,size);
            List<SatisfiedDissatisfiedNationwide> list=satisfiedDissatisfiedNationwideMapper.queryPageList(satisfiedDissatisfiedNationwide);

            if (CollectionUtils.isNotEmpty(list)){
                NumberFormat df = NumberFormat.getNumberInstance();
                df.setMaximumFractionDigits(2);
                for (int i = 0; i <list.size() ; i++) {
                      if(StringUtil.isNotBlank(list.get(i).getSeVpapr())){
                          list.get(i).setSeVpapr(String.valueOf(df.format(Double.valueOf(list.get(i).getSeVpapr())*100))+"%");
                      }else {
                          list.get(i).setSeVpapr("/");
                      }
                    if(StringUtil.isNotBlank(list.get(i).getSeLlegal())){
                        list.get(i).setSeLlegal(String.valueOf(df.format(Double.valueOf(list.get(i).getSeLlegal())*100))+"%");
                    }else {
                        list.get(i).setSeLlegal("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSePet())){
                        list.get(i).setSePet(String.valueOf(df.format(Double.valueOf(list.get(i).getSePet())*100))+"%");
                    }else {
                        list.get(i).setSePet("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeNoise())){
                        list.get(i).setSeNoise(String.valueOf(df.format(Double.valueOf(list.get(i).getSeNoise())*100))+"%");
                    }else {
                        list.get(i).setSeNoise("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeNonresid())){
                        list.get(i).setSeNonresid(String.valueOf(df.format(Double.valueOf(list.get(i).getSeNonresid())*100))+"%");
                    }else {
                        list.get(i).setSeNonresid("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeOtheroise())){
                        list.get(i).setSeOtheroise(String.valueOf(df.format(Double.valueOf(list.get(i).getSeOtheroise())*100))+"%");
                    }else {
                        list.get(i).setSeOtheroise("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeCardchecking())){
                        list.get(i).setSeCardchecking(String.valueOf(df.format(Double.valueOf(list.get(i).getSeCardchecking())*100))+"%");
                    }else {
                        list.get(i).setSeCardchecking("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeLaxcarking())){
                        list.get(i).setSeLaxcarking(String.valueOf(df.format(Double.valueOf(list.get(i).getSeLaxcarking())*100))+"%");
                    }else {
                        list.get(i).setSeLaxcarking("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeFireman())){
                        list.get(i).setSeFireman(String.valueOf(df.format(Double.valueOf(list.get(i).getSeFireman())*100))+"%");
                    }else {
                        list.get(i).setSeFireman("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeLlechaing())){
                        list.get(i).setSeLlechaing(String.valueOf(df.format(Double.valueOf(list.get(i).getSeLlechaing())*100))+"%");
                    }else {
                        list.get(i).setSeLlechaing("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeSense())){
                        list.get(i).setSeSense(String.valueOf(df.format(Double.valueOf(list.get(i).getSeSense())*100))+"%");
                    }else {
                        list.get(i).setSeSense("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSePostwork())){
                        list.get(i).setSePostwork(String.valueOf(df.format(Double.valueOf(list.get(i).getSePostwork())*100))+"%");
                    }else {
                        list.get(i).setSePostwork("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSePooratitude())){
                        list.get(i).setSePooratitude(String.valueOf(df.format(Double.valueOf(list.get(i).getSePooratitude())*100))+"%");
                    }else {
                        list.get(i).setSePooratitude("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getSeConsciousness())){
                        list.get(i).setSeConsciousness(String.valueOf(df.format(Double.valueOf(list.get(i).getSeConsciousness())*100))+"%");
                    }else {
                        list.get(i).setSeConsciousness("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuStafhad())){
                        list.get(i).setCuStafhad(String.valueOf(df.format(Double.valueOf(list.get(i).getCuStafhad())*100))+"%");
                    }else {
                        list.get(i).setCuStafhad("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuFrontdesk())){
                        list.get(i).setCuFrontdesk(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrontdesk())*100))+"%");
                    }else {
                        list.get(i).setCuFrontdesk("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuHousekeeper())){
                        list.get(i).setCuHousekeeper(String.valueOf(df.format(Double.valueOf(list.get(i).getCuHousekeeper())*100))+"%");
                    }else {
                        list.get(i).setCuHousekeeper("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuConhouse())){
                        list.get(i).setCuConhouse(String.valueOf(df.format(Double.valueOf(list.get(i).getCuConhouse())*100))+"%");
                    }else {
                        list.get(i).setCuConhouse("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuProblemfollow())){
                        list.get(i).setCuProblemfollow(String.valueOf(df.format(Double.valueOf(list.get(i).getCuProblemfollow())*100))+"%");
                    }else {
                        list.get(i).setCuProblemfollow("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuFrequently())){
                        list.get(i).setCuFrequently(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrequently())*100))+"%");
                    }else {
                        list.get(i).setCuFrequently("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuFrbujidesk())){
                        list.get(i).setCuFrbujidesk(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrbujidesk())*100))+"%");
                    }else {
                        list.get(i).setCuFrbujidesk("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrMaintenance())){
                        list.get(i).setGrMaintenance(String.valueOf(df.format(Double.valueOf(list.get(i).getGrMaintenance())*100))+"%");
                    }else {
                        list.get(i).setGrMaintenance("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrDowntrees())){
                        list.get(i).setGrDowntrees(String.valueOf(df.format(Double.valueOf(list.get(i).getGrDowntrees())*100))+"%");
                    }else {
                        list.get(i).setGrDowntrees("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrPlantruning())){
                        list.get(i).setGrPlantruning(String.valueOf(df.format(Double.valueOf(list.get(i).getGrPlantruning())*100))+"%");
                    }else {
                        list.get(i).setGrPlantruning("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrWitheeds())){
                        list.get(i).setGrWitheeds(String.valueOf(df.format(Double.valueOf(list.get(i).getGrWitheeds())*100))+"%");
                    }else {
                        list.get(i).setGrWitheeds("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrPlantdeath())){
                        list.get(i).setGrPlantdeath(String.valueOf(df.format(Double.valueOf(list.get(i).getGrPlantdeath())*100))+"%");
                    }else {
                        list.get(i).setGrPlantdeath("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrLoess())){
                        list.get(i).setGrLoess(String.valueOf(df.format(Double.valueOf(list.get(i).getGrLoess())*100))+"%");
                    }else {
                        list.get(i).setGrLoess("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrSeedlingloss())){
                        list.get(i).setGrSeedlingloss(String.valueOf(df.format(Double.valueOf(list.get(i).getGrSeedlingloss())*100))+"%");
                    }else {
                        list.get(i).setGrSeedlingloss("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrFewplant())){
                        list.get(i).setGrFewplant(String.valueOf(df.format(Double.valueOf(list.get(i).getGrFewplant())*100))+"%");
                    }else {
                        list.get(i).setGrFewplant("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrUnreasonable())){
                        list.get(i).setGrUnreasonable(String.valueOf(df.format(Double.valueOf(list.get(i).getGrUnreasonable())*100))+"%");
                    }else {
                        list.get(i).setGrUnreasonable("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrServiceimage())){
                        list.get(i).setGrServiceimage(String.valueOf(df.format(Double.valueOf(list.get(i).getGrServiceimage())*100))+"%");
                    }else {
                        list.get(i).setGrServiceimage("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClUnrplagacans())){
                        list.get(i).setClUnrplagacans(String.valueOf(df.format(Double.valueOf(list.get(i).getClUnrplagacans())*100))+"%");
                    }else {
                        list.get(i).setClUnrplagacans("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClRemovaon())){
                        list.get(i).setClRemovaon(String.valueOf(df.format(Double.valueOf(list.get(i).getClRemovaon())*100))+"%");
                    }else {
                        list.get(i).setClRemovaon("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClOutdoorpublic())){
                        list.get(i).setClOutdoorpublic(String.valueOf(df.format(Double.valueOf(list.get(i).getClOutdoorpublic())*100))+"%");
                    }else {
                        list.get(i).setClOutdoorpublic("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClBuilinterior())){
                        list.get(i).setClBuilinterior(String.valueOf(df.format(Double.valueOf(list.get(i).getClBuilinterior())*100))+"%");
                    }else {
                        list.get(i).setClBuilinterior("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClGarcleang())){
                        list.get(i).setClGarcleang(String.valueOf(df.format(Double.valueOf(list.get(i).getClGarcleang())*100))+"%");
                    }else {
                        list.get(i).setClGarcleang("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClWaterscape())){
                        list.get(i).setClWaterscape(String.valueOf(df.format(Double.valueOf(list.get(i).getClWaterscape())*100))+"%");
                    }else {
                        list.get(i).setClWaterscape("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClFpelimination())){
                        list.get(i).setClFpelimination(String.valueOf(df.format(Double.valueOf(list.get(i).getClFpelimination())*100))+"%");
                    }else {
                        list.get(i).setClFpelimination("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClCleanupaccu())){
                        list.get(i).setClCleanupaccu(String.valueOf(df.format(Double.valueOf(list.get(i).getClCleanupaccu())*100))+"%");
                    }else {
                        list.get(i).setClCleanupaccu("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getClServiceimage())){
                        list.get(i).setClServiceimage(String.valueOf(df.format(Double.valueOf(list.get(i).getClServiceimage())*100))+"%");
                    }else {
                        list.get(i).setClServiceimage("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnPuicliting())){
                        list.get(i).setEnPuicliting(String.valueOf(df.format(Double.valueOf(list.get(i).getEnPuicliting())*100))+"%");
                    }else {
                        list.get(i).setEnPuicliting("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnAmusement())){
                        list.get(i).setEnAmusement(String.valueOf(df.format(Double.valueOf(list.get(i).getEnAmusement())*100))+"%");
                    }else {
                        list.get(i).setEnAmusement("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnElevator())){
                        list.get(i).setEnElevator(String.valueOf(df.format(Double.valueOf(list.get(i).getEnElevator())*100))+"%");
                    }else {
                        list.get(i).setEnElevator("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnWaterupply())){
                        list.get(i).setEnWaterupply(String.valueOf(df.format(Double.valueOf(list.get(i).getEnWaterupply())*100))+"%");
                    }else {
                        list.get(i).setEnWaterupply("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnFireighting())){
                        list.get(i).setEnFireighting(String.valueOf(df.format(Double.valueOf(list.get(i).getEnFireighting())*100))+"%");
                    }else {
                        list.get(i).setEnFireighting("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnMonitoring())){
                        list.get(i).setEnMonitoring(String.valueOf(df.format(Double.valueOf(list.get(i).getEnMonitoring())*100))+"%");
                    }else {
                        list.get(i).setEnMonitoring("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnAccessconol())){
                        list.get(i).setEnAccessconol(String.valueOf(df.format(Double.valueOf(list.get(i).getEnAccessconol())*100))+"%");
                    }else {
                        list.get(i).setEnAccessconol("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnRoadgate())){
                        list.get(i).setEnRoadgate(String.valueOf(df.format(Double.valueOf(list.get(i).getEnRoadgate())*100))+"%");
                    }else {
                        list.get(i).setEnRoadgate("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnPublicarea())){
                        list.get(i).setEnPublicarea(String.valueOf(df.format(Double.valueOf(list.get(i).getEnPublicarea())*100))+"%");
                    }else {
                        list.get(i).setEnPublicarea("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnDrainage())){
                        list.get(i).setEnDrainage(String.valueOf(df.format(Double.valueOf(list.get(i).getEnDrainage())*100))+"%");
                    }else {
                        list.get(i).setEnDrainage("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnImageatude())){
                        list.get(i).setEnImageatude(String.valueOf(df.format(Double.valueOf(list.get(i).getEnImageatude())*100))+"%");
                    }else {
                        list.get(i).setEnImageatude("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnHomemainte())){
                        list.get(i).setEnHomemainte(String.valueOf(df.format(Double.valueOf(list.get(i).getEnHomemainte())*100))+"%");
                    }else {
                        list.get(i).setEnHomemainte("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getEnEquipment())){
                        list.get(i).setEnEquipment(String.valueOf(df.format(Double.valueOf(list.get(i).getEnEquipment())*100))+"%");
                    }else {
                        list.get(i).setEnEquipment("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getGrGreenwaste())){
                        list.get(i).setGrGreenwaste(String.valueOf(df.format(Double.valueOf(list.get(i).getGrGreenwaste())*100))+"%");
                    }else {
                        list.get(i).setGrGreenwaste("/");
                    }
                    if(StringUtil.isNotBlank(list.get(i).getCuPoorachatide())){
                        list.get(i).setCuPoorachatide(String.valueOf(df.format(Double.valueOf(list.get(i).getCuPoorachatide())*100))+"%");
                    }else {
                        list.get(i).setCuPoorachatide("/");
                    }

                }
            }



            PageData data = new PageData(pageList);
            data.setData(list);
            data.setTotal(toble);
            return Response.response(data);
        }else {
            throw new ServiceException("此账号无权限查看");
        }
    }

    @Override
    public Result getrevenue(AccessToken accessToken, HttpServletRequest request) throws IOException {

        BufferedReader bufferReader = new BufferedReader(request.getReader());
        StringBuffer sbder = new StringBuffer();
        String line = null;
        while ((line = bufferReader.readLine()) != null) {
            sbder.append(line);
        }
        if(sbder==null || sbder.length()==0){
            return Response.responseFail("请输入参数");
        }

        JSONObject json = JSONObject.fromObject(sbder.toString());
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("clientId",json.getString("clientId"));
        map.put("timeString",json.getString("timeString"));
        map.put("sign",json.getString("sign"));
        Result result = checkIdentity(json.getString("clientId"), json.getString("timeString"), json.getString("sign"));
        int code = result.getResultCode();
        if(500 == code){
            logger.error("认证失败-----------");
            System.err.println("认证失败-----------");
            return result;
        }

      /*  SimpleDateFormat sb=new SimpleDateFormat("yyyy-MM-dd HH:mm");
        try {
            if(json.containsKey("startTime")){
                Date parse = sb.parse(json.getString("startTime"));
            }
            if(json.containsKey("endTime")){
                Date parse = sb.parse(json.getString("endTime"));
            }
        }catch (Exception e){
            logger.error("参数错误:startTime 或者 endTime 时间格式有误");
            System.err.println("参数错误:startTime 或者 endTime 时间格式有误");
            return Response.responseFail("参数错误:startTime 或者 endTime 时间格式有误");
        }*/

        String startTime=null;
        String endTime=null;

        if(json.containsKey("startTime")){
            startTime = json.getString("startTime")+" 00:00:00";
        }
        if(json.containsKey("endTime")){
            endTime = json.getString("endTime")+" 23:59:59";
        }

        SatisfiedDissatisfiedNationwideDTO satiseDTO=new SatisfiedDissatisfiedNationwideDTO();
        List<Map<String,String>> lima=new ArrayList<>();

        List<SatisfiedDissatisfiedNationwide> listBiao=satisfiedDissatisfiedNationwideMapper.listBiao();

        List<SatisfiedDissatisfiedNationwide> list=satisfiedDissatisfiedNationwideMapper.getrevenue(startTime,endTime);
        if(CollectionUtils.isNotEmpty(list)){
            for (int i = 0; i <list.size() ; i++) {
                if(StringUtil.isBlank(list.get(i).getSeVpapr())){
                    list.get(i).setSeVpapr("");
                }
                if(StringUtil.isBlank(list.get(i).getSeLlegal())){
                    list.get(i).setSeLlegal("");
                }
                if(StringUtil.isBlank(list.get(i).getSePet())){
                    list.get(i).setSePet("");
                }
                if(StringUtil.isBlank(list.get(i).getSeNoise())){
                    list.get(i).setSeNoise("");
                }
                if(StringUtil.isBlank(list.get(i).getSeNonresid())){
                    list.get(i).setSeNonresid("");
                }
                if(StringUtil.isBlank(list.get(i).getSeOtheroise())){
                    list.get(i).setSeOtheroise("");
                }
                if(StringUtil.isBlank(list.get(i).getSeCardchecking())){
                    list.get(i).setSeCardchecking("");
                }
                if(StringUtil.isBlank(list.get(i).getSeFireman())){
                    list.get(i).setSeFireman("");
                }
                if(StringUtil.isBlank(list.get(i).getSeLlechaing())){
                    list.get(i).setSeLlechaing("");
                }
                if(StringUtil.isBlank(list.get(i).getSeSense())){
                    list.get(i).setSeSense("");
                }
                if(StringUtil.isBlank(list.get(i).getSePostwork())){
                    list.get(i).setSePostwork("");
                }
                if(StringUtil.isBlank(list.get(i).getSePooratitude())){
                    list.get(i).setSePooratitude("");
                }
                if(StringUtil.isBlank(list.get(i).getSeConsciousness())){
                    list.get(i).setSeConsciousness("");
                }
                if(StringUtil.isBlank(list.get(i).getCuStafhad())){
                    list.get(i).setCuStafhad("");
                }
                if(StringUtil.isBlank(list.get(i).getCuFrontdesk())){
                    list.get(i).setCuFrontdesk("");
                }
                if(StringUtil.isBlank(list.get(i).getCuHousekeeper())){
                    list.get(i).setCuHousekeeper("");
                }
                if(StringUtil.isBlank(list.get(i).getCuConhouse())){
                    list.get(i).setCuConhouse("");
                }
                if(StringUtil.isBlank(list.get(i).getCuProblemfollow())){
                    list.get(i).setCuProblemfollow("");
                }
                if(StringUtil.isBlank(list.get(i).getCuFrequently())){
                    list.get(i).setCuFrequently("");
                }
                if(StringUtil.isBlank(list.get(i).getCuFrbujidesk())){
                    list.get(i).setCuFrbujidesk("");
                }
                if(StringUtil.isBlank(list.get(i).getGrMaintenance())){
                    list.get(i).setGrMaintenance("");
                }
                if(StringUtil.isBlank(list.get(i).getGrDowntrees())){
                    list.get(i).setGrDowntrees("");
                }
                if(StringUtil.isBlank(list.get(i).getGrPlantruning())){
                    list.get(i).setGrPlantruning("");
                }
                if(StringUtil.isBlank(list.get(i).getGrWitheeds())){
                    list.get(i).setGrWitheeds("");
                }
                if(StringUtil.isBlank(list.get(i).getGrPlantdeath())){
                    list.get(i).setGrPlantdeath("");
                }
                if(StringUtil.isBlank(list.get(i).getGrLoess())){
                    list.get(i).setGrLoess("");
                }
                if(StringUtil.isBlank(list.get(i).getGrSeedlingloss())){
                    list.get(i).setGrSeedlingloss("");
                }
                if(StringUtil.isBlank(list.get(i).getGrFewplant())){
                    list.get(i).setGrFewplant("");
                }
                if(StringUtil.isBlank(list.get(i).getGrUnreasonable())){
                    list.get(i).setGrUnreasonable("");
                }
                if(StringUtil.isBlank(list.get(i).getGrServiceimage())){
                    list.get(i).setGrServiceimage("");
                }
                if(StringUtil.isBlank(list.get(i).getClUnrplagacans())){
                    list.get(i).setClUnrplagacans("");
                }
                if(StringUtil.isBlank(list.get(i).getClRemovaon())){
                    list.get(i).setClRemovaon("");
                }
                if(StringUtil.isBlank(list.get(i).getClOutdoorpublic())){
                    list.get(i).setClOutdoorpublic("");
                }
                if(StringUtil.isBlank(list.get(i).getClBuilinterior())){
                    list.get(i).setClBuilinterior("");
                }
                if(StringUtil.isBlank(list.get(i).getClGarcleang())){
                    list.get(i).setClGarcleang("");
                }
                if(StringUtil.isBlank(list.get(i).getClWaterscape())){
                    list.get(i).setClWaterscape("");
                }
                if(StringUtil.isBlank(list.get(i).getClFpelimination())){
                    list.get(i).setClFpelimination("");
                }
                if(StringUtil.isBlank(list.get(i).getClCleanupaccu())){
                    list.get(i).setClCleanupaccu("");
                }
                if(StringUtil.isBlank(list.get(i).getClServiceimage())){
                    list.get(i).setClServiceimage("");
                }
                if(StringUtil.isBlank(list.get(i).getEnPuicliting())){
                    list.get(i).setEnPuicliting("");
                }
                if(StringUtil.isBlank(list.get(i).getEnAmusement())){
                    list.get(i).setEnAmusement("");
                }
                if(StringUtil.isBlank(list.get(i).getEnElevator())){
                    list.get(i).setEnElevator("");
                }
                if(StringUtil.isBlank(list.get(i).getEnWaterupply())){
                    list.get(i).setEnWaterupply("");
                }
                if(StringUtil.isBlank(list.get(i).getEnFireighting())){
                    list.get(i).setEnFireighting("");
                }
                if(StringUtil.isBlank(list.get(i).getEnMonitoring())){
                    list.get(i).setEnMonitoring("");
                }
                if(StringUtil.isBlank(list.get(i).getEnAccessconol())){
                    list.get(i).setEnAccessconol("");
                }
                if(StringUtil.isBlank(list.get(i).getEnRoadgate())){
                    list.get(i).setEnRoadgate("");
                }
                if(StringUtil.isBlank(list.get(i).getEnPublicarea())){
                    list.get(i).setEnPublicarea("");
                }
                if(StringUtil.isBlank(list.get(i).getEnDrainage())){
                    list.get(i).setEnDrainage("");
                }
                if(StringUtil.isBlank(list.get(i).getEnImageatude())){
                    list.get(i).setEnImageatude("");
                }
                if(StringUtil.isBlank(list.get(i).getEnHomemainte())){
                    list.get(i).setEnHomemainte("");
                }
            }
            /*NumberFormat df = NumberFormat.getNumberInstance();
            df.setMaximumFractionDigits(2);
            for (int i = 0; i <list.size() ; i++) {
                if(StringUtil.isNotBlank(list.get(i).getSeVpapr())){
                    list.get(i).setSeVpapr(String.valueOf(df.format(Double.valueOf(list.get(i).getSeVpapr())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeLlegal())){
                    list.get(i).setSeLlegal(String.valueOf(df.format(Double.valueOf(list.get(i).getSeLlegal())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSePet())){
                    list.get(i).setSePet(String.valueOf(df.format(Double.valueOf(list.get(i).getSePet())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeNoise())){
                    list.get(i).setSeNoise(String.valueOf(df.format(Double.valueOf(list.get(i).getSeNoise())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeNonresid())){
                    list.get(i).setSeNonresid(String.valueOf(df.format(Double.valueOf(list.get(i).getSeNonresid())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeOtheroise())){
                    list.get(i).setSeOtheroise(String.valueOf(df.format(Double.valueOf(list.get(i).getSeOtheroise())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeCardchecking())){
                    list.get(i).setSeCardchecking(String.valueOf(df.format(Double.valueOf(list.get(i).getSeCardchecking())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeFireman())){
                    list.get(i).setSeFireman(String.valueOf(df.format(Double.valueOf(list.get(i).getSeFireman())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeLlechaing())){
                    list.get(i).setSeLlechaing(String.valueOf(df.format(Double.valueOf(list.get(i).getSeLlechaing())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeSense())){
                    list.get(i).setSeSense(String.valueOf(df.format(Double.valueOf(list.get(i).getSeSense())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSePostwork())){
                    list.get(i).setSePostwork(String.valueOf(df.format(Double.valueOf(list.get(i).getSePostwork())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSePooratitude())){
                    list.get(i).setSePooratitude(String.valueOf(df.format(Double.valueOf(list.get(i).getSePooratitude())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getSeConsciousness())){
                    list.get(i).setSeConsciousness(String.valueOf(df.format(Double.valueOf(list.get(i).getSeConsciousness())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuStafhad())){
                    list.get(i).setCuStafhad(String.valueOf(df.format(Double.valueOf(list.get(i).getCuStafhad())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuFrontdesk())){
                    list.get(i).setCuFrontdesk(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrontdesk())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuHousekeeper())){
                    list.get(i).setCuHousekeeper(String.valueOf(df.format(Double.valueOf(list.get(i).getCuHousekeeper())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuConhouse())){
                    list.get(i).setCuConhouse(String.valueOf(df.format(Double.valueOf(list.get(i).getCuConhouse())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuProblemfollow())){
                    list.get(i).setCuProblemfollow(String.valueOf(df.format(Double.valueOf(list.get(i).getCuProblemfollow())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuFrequently())){
                    list.get(i).setCuFrequently(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrequently())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getCuFrbujidesk())){
                    list.get(i).setCuFrbujidesk(String.valueOf(df.format(Double.valueOf(list.get(i).getCuFrbujidesk())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrMaintenance())){
                    list.get(i).setGrMaintenance(String.valueOf(df.format(Double.valueOf(list.get(i).getGrMaintenance())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrDowntrees())){
                    list.get(i).setGrDowntrees(String.valueOf(df.format(Double.valueOf(list.get(i).getGrDowntrees())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrPlantruning())){
                    list.get(i).setGrPlantruning(String.valueOf(df.format(Double.valueOf(list.get(i).getGrPlantruning())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrWitheeds())){
                    list.get(i).setGrWitheeds(String.valueOf(df.format(Double.valueOf(list.get(i).getGrWitheeds())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrPlantdeath())){
                    list.get(i).setGrPlantdeath(String.valueOf(df.format(Double.valueOf(list.get(i).getGrPlantdeath())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrLoess())){
                    list.get(i).setGrLoess(String.valueOf(df.format(Double.valueOf(list.get(i).getGrLoess())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrSeedlingloss())){
                    list.get(i).setGrSeedlingloss(String.valueOf(df.format(Double.valueOf(list.get(i).getGrSeedlingloss())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrFewplant())){
                    list.get(i).setGrFewplant(String.valueOf(df.format(Double.valueOf(list.get(i).getGrFewplant())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrUnreasonable())){
                    list.get(i).setGrUnreasonable(String.valueOf(df.format(Double.valueOf(list.get(i).getGrUnreasonable())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getGrServiceimage())){
                    list.get(i).setGrServiceimage(String.valueOf(df.format(Double.valueOf(list.get(i).getGrServiceimage())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClUnrplagacans())){
                    list.get(i).setClUnrplagacans(String.valueOf(df.format(Double.valueOf(list.get(i).getClUnrplagacans())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClRemovaon())){
                    list.get(i).setClRemovaon(String.valueOf(df.format(Double.valueOf(list.get(i).getClRemovaon())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClOutdoorpublic())){
                    list.get(i).setClOutdoorpublic(String.valueOf(df.format(Double.valueOf(list.get(i).getClOutdoorpublic())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClBuilinterior())){
                    list.get(i).setClBuilinterior(String.valueOf(df.format(Double.valueOf(list.get(i).getClBuilinterior())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClGarcleang())){
                    list.get(i).setClGarcleang(String.valueOf(df.format(Double.valueOf(list.get(i).getClGarcleang())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClWaterscape())){
                    list.get(i).setClWaterscape(String.valueOf(df.format(Double.valueOf(list.get(i).getClWaterscape())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClFpelimination())){
                    list.get(i).setClFpelimination(String.valueOf(df.format(Double.valueOf(list.get(i).getClFpelimination())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClCleanupaccu())){
                    list.get(i).setClCleanupaccu(String.valueOf(df.format(Double.valueOf(list.get(i).getClCleanupaccu())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getClServiceimage())){
                    list.get(i).setClServiceimage(String.valueOf(df.format(Double.valueOf(list.get(i).getClServiceimage())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnPuicliting())){
                    list.get(i).setEnPuicliting(String.valueOf(df.format(Double.valueOf(list.get(i).getEnPuicliting())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnAmusement())){
                    list.get(i).setEnAmusement(String.valueOf(df.format(Double.valueOf(list.get(i).getEnAmusement())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnElevator())){
                    list.get(i).setEnElevator(String.valueOf(df.format(Double.valueOf(list.get(i).getEnElevator())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnWaterupply())){
                    list.get(i).setEnWaterupply(String.valueOf(df.format(Double.valueOf(list.get(i).getEnWaterupply())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnFireighting())){
                    list.get(i).setEnFireighting(String.valueOf(df.format(Double.valueOf(list.get(i).getEnFireighting())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnMonitoring())){
                    list.get(i).setEnMonitoring(String.valueOf(df.format(Double.valueOf(list.get(i).getEnMonitoring())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnAccessconol())){
                    list.get(i).setEnAccessconol(String.valueOf(df.format(Double.valueOf(list.get(i).getEnAccessconol())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnRoadgate())){
                    list.get(i).setEnRoadgate(String.valueOf(df.format(Double.valueOf(list.get(i).getEnRoadgate())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnPublicarea())){
                    list.get(i).setEnPublicarea(String.valueOf(df.format(Double.valueOf(list.get(i).getEnPublicarea())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnDrainage())){
                    list.get(i).setEnDrainage(String.valueOf(df.format(Double.valueOf(list.get(i).getEnDrainage())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnImageatude())){
                    list.get(i).setEnImageatude(String.valueOf(df.format(Double.valueOf(list.get(i).getEnImageatude())*100)));
                }
                if(StringUtil.isNotBlank(list.get(i).getEnHomemainte())){
                    list.get(i).setEnHomemainte(String.valueOf(df.format(Double.valueOf(list.get(i).getEnHomemainte())*100)));
                }
            }*/

            satiseDTO.setList(list);

            for (int i = 0; i < listBiao.size(); i++) {
                Map<String,String> mapSt=new HashMap<>();
                mapSt.put(listBiao.get(i).getKey(),listBiao.get(i).getValue());
                lima.add(mapSt);
            }
            satiseDTO.setName(lima);
        }

        return Response.response(satiseDTO);
    }

    @Override
    public Result detailed(Long id, String line, AccessToken accessToken) {

        List<SatisfiedDissatisfiedNationwide> list=new ArrayList<>();
        Condition condition = new Condition(SatisfiedDissatisfiedNationwide.class);
        Example.Criteria criteria = condition.createCriteria();
        criteria.andEqualTo("id",id);

        List<SatisfiedDissatisfiedNationwide> listBiao=satisfiedDissatisfiedNationwideMapper.listBiao();

        List<SatisfactionDisplayDTO> liser=new ArrayList<>();
        SatisfactionDisplayDTO displayDTO=null;
        if(line.equals("全部")){
             list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }else if(line.equals("安防")){
            condition.setDistinct(true);
            condition.selectProperties("seVpapr","seLlegal","sePet","seNoise","seNonresid","seOtheroise","seCardchecking","seLaxcarking","seFireman","seLlechaing",
                    "seSense","sePostwork","sePooratitude","seConsciousness","yearMonth");
            list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }else if(line.equals("保洁")){
            condition.setDistinct(true);
            condition.selectProperties("clUnrplagacans","clRemovaon","clOutdoorpublic","clBuilinterior","clGarcleang","clWaterscape","clFpelimination",
                    "clCleanupaccu","clServiceimage","yearMonth");
            list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }else if(line.equals("绿化")){
            condition.setDistinct(true);
            condition.selectProperties("grGreenwaste","grMaintenance","grDowntrees","grPlantruning","grWitheeds","grPlantdeath","grLoess","grSeedlingloss"
            ,"grFewplant","grUnreasonable","grServiceimage","yearMonth");
            list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }else if(line.equals("客服")){
            condition.setDistinct(true);
            condition.selectProperties("cuStafhad","cuFrontdesk","cuHousekeeper","cuConhouse","cuProblemfollow","cuPoorachatide","cuFrequently","cuFrbujidesk","yearMonth");
            list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }else if(line.equals("工程")){
            condition.setDistinct(true);
            condition.selectProperties("enPuicliting","enAmusement","enElevator","enWaterupply","enFireighting","enMonitoring","enAccessconol","enRoadgate",
                    "enPublicarea","enDrainage","enEquipment","enImageatude","enHomemainte","yearMonth");
            list=satisfiedDissatisfiedNationwideMapper.selectByCondition(condition);
        }
        NumberFormat df = NumberFormat.getNumberInstance();
        df.setMaximumFractionDigits(2);
        JSONArray jsonArray=JSONArray.fromObject(list);
        Iterator i1 = jsonArray.iterator();
        for (int i = 0; i <listBiao.size() ; i++) {
            for (int j = 0; j < jsonArray.size(); j++) {
                JSONObject job = jsonArray.getJSONObject(j);
                Iterator keys = job.keys();
                while(keys.hasNext()){
                    String key=keys.next().toString();
                    if(listBiao.get(i).getKey().equals(key)){
                        if(listBiao.get(i).getKey().equals("id") || listBiao.get(i).getKey().equals("status") || listBiao.get(i).getKey().equals("yearMonth")){
                            continue;
                        }
                        displayDTO=new SatisfactionDisplayDTO();
                        displayDTO.setName(listBiao.get(i).getValue());
                        if(StringUtil.isNotBlank(job.getString(key))){
                            displayDTO.setRecord(df.format(Double.valueOf(job.getString(key))*100)+"%");
                        }else {
                            displayDTO.setRecord(job.getString(key));

                        }
                        if(StringUtil.isNotBlank(job.getString(key))){
                            liser.add(displayDTO);
                        }
                    }
                }
            }
        }
        return Response.response(liser);
    }

    @Override
    public Result edit(SatisfiedDissatisfiedNationwide satisfiedDissatisfiedNationwide, AccessToken accessToken) {

        String s=null;
        Double sd=null;

        NumberFormat df = NumberFormat.getNumberInstance();
        df.setMaximumFractionDigits(5);

        if(satisfiedDissatisfiedNationwide.getSeVpapr().equals("/")){
            satisfiedDissatisfiedNationwide.setSeVpapr("");
        }else if(satisfiedDissatisfiedNationwide.getSeVpapr().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeVpapr();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeVpapr(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeLlegal().equals("/")){
            satisfiedDissatisfiedNationwide.setSeLlegal("");
        }else if(satisfiedDissatisfiedNationwide.getSeLlegal().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeLlegal();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeLlegal(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSePet().equals("/")){
            satisfiedDissatisfiedNationwide.setSePet("");
        }else if(satisfiedDissatisfiedNationwide.getSePet().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSePet();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSePet(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeNoise().equals("/")){
            satisfiedDissatisfiedNationwide.setSeNoise("");
        }else if(satisfiedDissatisfiedNationwide.getSeNoise().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeNoise();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeNoise(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeNonresid().equals("/")){
            satisfiedDissatisfiedNationwide.setSeNonresid("");
        }else if(satisfiedDissatisfiedNationwide.getSeNonresid().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeNonresid();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeNonresid(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeOtheroise().equals("/")){
            satisfiedDissatisfiedNationwide.setSeOtheroise("");
        }else if(satisfiedDissatisfiedNationwide.getSeOtheroise().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeOtheroise();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeOtheroise(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeCardchecking().equals("/")){
            satisfiedDissatisfiedNationwide.setSeCardchecking("");
        }else if(satisfiedDissatisfiedNationwide.getSeCardchecking().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeCardchecking();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeCardchecking(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeLaxcarking().equals("/")){
            satisfiedDissatisfiedNationwide.setSeLaxcarking("");
        }else if(satisfiedDissatisfiedNationwide.getSeLaxcarking().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeLaxcarking();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeLaxcarking(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeFireman().equals("/")){
            satisfiedDissatisfiedNationwide.setSeFireman("");
        }else if(satisfiedDissatisfiedNationwide.getSeFireman().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeFireman();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeFireman(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeLlechaing().equals("/")){
            satisfiedDissatisfiedNationwide.setSeLlechaing("");
        }else if(satisfiedDissatisfiedNationwide.getSeLlechaing().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeLlechaing();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeLlechaing(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeSense().equals("/")){
            satisfiedDissatisfiedNationwide.setSeSense("");
        }else if(satisfiedDissatisfiedNationwide.getSeSense().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeSense();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeSense(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSePostwork().equals("/")){
            satisfiedDissatisfiedNationwide.setSePostwork("");
        }else if(satisfiedDissatisfiedNationwide.getSePostwork().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSePostwork();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSePostwork(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSePooratitude().equals("/")){
            satisfiedDissatisfiedNationwide.setSePooratitude("");
        }else if(satisfiedDissatisfiedNationwide.getSePooratitude().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSePooratitude();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSePooratitude(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getSeConsciousness().equals("/")){
            satisfiedDissatisfiedNationwide.setSeConsciousness("");
        }else if(satisfiedDissatisfiedNationwide.getSeConsciousness().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getSeConsciousness();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setSeConsciousness(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuStafhad().equals("/")){
            satisfiedDissatisfiedNationwide.setCuStafhad("");
        }else if(satisfiedDissatisfiedNationwide.getCuStafhad().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuStafhad();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuStafhad(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuFrontdesk().equals("/")){
            satisfiedDissatisfiedNationwide.setCuFrontdesk("");
        }else if(satisfiedDissatisfiedNationwide.getCuFrontdesk().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuFrontdesk();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuFrontdesk(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuHousekeeper().equals("/")){
            satisfiedDissatisfiedNationwide.setCuHousekeeper("");
        }else if(satisfiedDissatisfiedNationwide.getCuHousekeeper().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuHousekeeper();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuHousekeeper(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuConhouse().equals("/")){
            satisfiedDissatisfiedNationwide.setCuConhouse("");
        }else if(satisfiedDissatisfiedNationwide.getCuConhouse().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuConhouse();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuConhouse(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuProblemfollow().equals("/")){
            satisfiedDissatisfiedNationwide.setCuProblemfollow("");
        }else if(satisfiedDissatisfiedNationwide.getCuProblemfollow().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuProblemfollow();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuProblemfollow(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuPoorachatide().equals("/")){
            satisfiedDissatisfiedNationwide.setCuPoorachatide("");
        }else if(satisfiedDissatisfiedNationwide.getCuPoorachatide().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuPoorachatide();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuPoorachatide(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuFrequently().equals("/")){
            satisfiedDissatisfiedNationwide.setCuFrequently("");
        }else if(satisfiedDissatisfiedNationwide.getCuFrequently().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuFrequently();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuFrequently(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getCuFrbujidesk().equals("/")){
            satisfiedDissatisfiedNationwide.setCuFrbujidesk("");
        }else if(satisfiedDissatisfiedNationwide.getCuFrbujidesk().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getCuFrbujidesk();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setCuFrbujidesk(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrGreenwaste().equals("/")){
            satisfiedDissatisfiedNationwide.setGrGreenwaste("");
        }else if(satisfiedDissatisfiedNationwide.getGrGreenwaste().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrGreenwaste();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrGreenwaste(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrMaintenance().equals("/")){
            satisfiedDissatisfiedNationwide.setGrMaintenance("");
        }else if(satisfiedDissatisfiedNationwide.getGrMaintenance().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrMaintenance();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrMaintenance(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrDowntrees().equals("/")){
            satisfiedDissatisfiedNationwide.setGrDowntrees("");
        }else if(satisfiedDissatisfiedNationwide.getGrDowntrees().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrDowntrees();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrDowntrees(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrPlantruning().equals("/")){
            satisfiedDissatisfiedNationwide.setGrPlantruning("");
        }else if(satisfiedDissatisfiedNationwide.getGrPlantruning().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrPlantruning();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrPlantruning(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrWitheeds().equals("/")){
            satisfiedDissatisfiedNationwide.setGrWitheeds("");
        }else if(satisfiedDissatisfiedNationwide.getGrWitheeds().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrWitheeds();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrWitheeds(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrPlantdeath().equals("/")){
            satisfiedDissatisfiedNationwide.setGrPlantdeath("");
        }else if(satisfiedDissatisfiedNationwide.getGrPlantdeath().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrPlantdeath();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrPlantdeath(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrLoess().equals("/")){
            satisfiedDissatisfiedNationwide.setGrLoess("");
        }else if(satisfiedDissatisfiedNationwide.getGrLoess().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrLoess();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrLoess(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrSeedlingloss().equals("/")){
            satisfiedDissatisfiedNationwide.setGrSeedlingloss("");
        }else if(satisfiedDissatisfiedNationwide.getGrSeedlingloss().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrSeedlingloss();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrSeedlingloss(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrFewplant().equals("/")){
            satisfiedDissatisfiedNationwide.setGrFewplant("");
        }else if(satisfiedDissatisfiedNationwide.getGrFewplant().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrFewplant();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrFewplant(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrUnreasonable().equals("/")){
            satisfiedDissatisfiedNationwide.setGrUnreasonable("");
        }else if(satisfiedDissatisfiedNationwide.getGrUnreasonable().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrUnreasonable();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrUnreasonable(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getGrServiceimage().equals("/")){
            satisfiedDissatisfiedNationwide.setGrServiceimage("");
        }else if(satisfiedDissatisfiedNationwide.getGrServiceimage().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getGrServiceimage();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setGrServiceimage(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClUnrplagacans().equals("/")){
            satisfiedDissatisfiedNationwide.setClUnrplagacans("");
        }else if(satisfiedDissatisfiedNationwide.getClUnrplagacans().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClUnrplagacans();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClUnrplagacans(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClRemovaon().equals("/")){
            satisfiedDissatisfiedNationwide.setClRemovaon("");
        }else if(satisfiedDissatisfiedNationwide.getClRemovaon().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClRemovaon();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClRemovaon(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClOutdoorpublic().equals("/")){
            satisfiedDissatisfiedNationwide.setClOutdoorpublic("");
        }else if(satisfiedDissatisfiedNationwide.getClOutdoorpublic().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClOutdoorpublic();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClOutdoorpublic(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClBuilinterior().equals("/")){
            satisfiedDissatisfiedNationwide.setClBuilinterior("");
        }else if(satisfiedDissatisfiedNationwide.getClBuilinterior().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClBuilinterior();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClBuilinterior(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClGarcleang().equals("/")){
            satisfiedDissatisfiedNationwide.setClGarcleang("");
        }else if(satisfiedDissatisfiedNationwide.getClGarcleang().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClGarcleang();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClGarcleang(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClWaterscape().equals("/")){
            satisfiedDissatisfiedNationwide.setClWaterscape("");
        }else if(satisfiedDissatisfiedNationwide.getClWaterscape().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClWaterscape();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClWaterscape(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClFpelimination().equals("/")){
            satisfiedDissatisfiedNationwide.setClFpelimination("");
        }else if(satisfiedDissatisfiedNationwide.getClFpelimination().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClFpelimination();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClFpelimination(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClCleanupaccu().equals("/")){
            satisfiedDissatisfiedNationwide.setClCleanupaccu("");
        }else if(satisfiedDissatisfiedNationwide.getClCleanupaccu().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClCleanupaccu();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClCleanupaccu(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getClServiceimage().equals("/")){
            satisfiedDissatisfiedNationwide.setClServiceimage("");
        }else if(satisfiedDissatisfiedNationwide.getClServiceimage().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getClServiceimage();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setClServiceimage(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnPuicliting().equals("/")){
            satisfiedDissatisfiedNationwide.setEnPuicliting("");
        }else if(satisfiedDissatisfiedNationwide.getEnPuicliting().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnPuicliting();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnPuicliting(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnAmusement().equals("/")){
            satisfiedDissatisfiedNationwide.setEnAmusement("");
        }else if(satisfiedDissatisfiedNationwide.getEnAmusement().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnAmusement();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnAmusement(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnElevator().equals("/")){
            satisfiedDissatisfiedNationwide.setEnElevator("");
        }else if(satisfiedDissatisfiedNationwide.getEnElevator().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnElevator();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnElevator(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnWaterupply().equals("/")){
            satisfiedDissatisfiedNationwide.setEnWaterupply("");
        }else if(satisfiedDissatisfiedNationwide.getEnWaterupply().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnWaterupply();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnWaterupply(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnFireighting().equals("/")){
            satisfiedDissatisfiedNationwide.setEnFireighting("");
        }else if(satisfiedDissatisfiedNationwide.getEnFireighting().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnFireighting();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnFireighting(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnMonitoring().equals("/")){
            satisfiedDissatisfiedNationwide.setGrWitheeds("");
        }else if(satisfiedDissatisfiedNationwide.getEnMonitoring().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnMonitoring();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnMonitoring(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnAccessconol().equals("/")){
            satisfiedDissatisfiedNationwide.setEnAccessconol("");
        }else if(satisfiedDissatisfiedNationwide.getEnAccessconol().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnAccessconol();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnAccessconol(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnRoadgate().equals("/")){
            satisfiedDissatisfiedNationwide.setEnRoadgate("");
        }else if(satisfiedDissatisfiedNationwide.getEnRoadgate().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnRoadgate();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnRoadgate(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnPublicarea().equals("/")){
            satisfiedDissatisfiedNationwide.setEnPublicarea("");
        }else if(satisfiedDissatisfiedNationwide.getEnPublicarea().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnPublicarea();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnPublicarea(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnDrainage().equals("/")){
            satisfiedDissatisfiedNationwide.setEnDrainage("");
        }else if(satisfiedDissatisfiedNationwide.getEnDrainage().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnDrainage();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnDrainage(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnEquipment().equals("/")){
            satisfiedDissatisfiedNationwide.setEnEquipment("");
        }else if(satisfiedDissatisfiedNationwide.getEnEquipment().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnEquipment();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnEquipment(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnImageatude().equals("/")){
            satisfiedDissatisfiedNationwide.setEnImageatude("");
        }else if(satisfiedDissatisfiedNationwide.getEnImageatude().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnImageatude();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnImageatude(df.format(sd));
        }

        if(satisfiedDissatisfiedNationwide.getEnHomemainte().equals("/")){
            satisfiedDissatisfiedNationwide.setEnHomemainte("");
        }else if(satisfiedDissatisfiedNationwide.getEnHomemainte().indexOf("%")!=-1){
            s = satisfiedDissatisfiedNationwide.getEnHomemainte();
            s = s.substring(0, s.length() - 1);
            sd=Double.valueOf(s);
            sd=sd/100;
            satisfiedDissatisfiedNationwide.setEnHomemainte(df.format(sd));
        }
        TbSysUser tbSysUser = tbSysUserMapper.findByUserCodeNew(accessToken.getUserCode());
        satisfiedDissatisfiedNationwide.setUpdateTime(new Date());
        satisfiedDissatisfiedNationwide.setUpdateBy(tbSysUser.getUserName());
        satisfiedDissatisfiedNationwide.setIsEditor(1);
        satisfiedDissatisfiedNationwideMapper.updateByPrimaryKeySelective(satisfiedDissatisfiedNationwide);
        return Response.response();
    }

    @Override
    public Result del(String id, AccessToken accessToken) {
        TbSysUser tbSysUser = tbSysUserMapper.findByUserCodeNew(accessToken.getUserCode());
        SatisfiedDissatisfiedNationwide satisfiedDissatisfiedNationwide=new SatisfiedDissatisfiedNationwide();
        satisfiedDissatisfiedNationwide.setId(Long.valueOf(id));
        satisfiedDissatisfiedNationwide.setStatus(0);
        satisfiedDissatisfiedNationwide.setUpdateTime(new Date());
        satisfiedDissatisfiedNationwide.setUpdateBy(tbSysUser.getUserName());
        satisfiedDissatisfiedNationwideMapper.updateByPrimaryKeySelective(satisfiedDissatisfiedNationwide);
        return Response.response();

    }

    //身份认证
    public Result checkIdentity(String clientId, String timeString, String sign){
        ShareConfig share=new ShareConfig();
        share.setClientId(clientId);
        ShareConfig shareConfig = shareConfigMapper.selectOne(share);
        if(shareConfig ==null){
            return Response.responseFail("认证失败:客户端编码有误");
        }
        String clientSecret = shareConfig.getClientSecret();
        SimpleDateFormat sb=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            String sd = sb.format(new Date(Long.valueOf(timeString+"000")));
            Date parse = sb.parse(sd);
            Date date=new Date();
            long l = date.getTime() - parse.getTime();
            if(l>5*60*1000){
                return Response.responseFail("参数错误:调用时间与参数时间不能超过5分钟");
            }
        }catch (Exception e){
            return Response.responseFail("参数错误:timeString格式有误");
        }

        String md5String =clientId+clientSecret+timeString;
        String s = MD5.GetMD5Code(md5String);
        if(!s.equals(sign)){
            return Response.responseFail("认证失败:签名错误");
        }
        return Response.response("认证成功");
    }

    public List<String> queryRoleCodes(String[] roles, String userCode) {
        //保洁模块的权限问题：admin=ck_admin>区域>项目>其他
        Condition condition = new Condition(UserRoles.class);
        condition.selectProperties("roleCode");
        Example.Criteria criteria = condition.createCriteria();
        criteria.andEqualTo("userCode", userCode);
        if (roles != null && roles.length > 0) {
            criteria.andIn("roleCode", Arrays.asList(roles));
        }

        List<UserRoles> rolesList = userRolesMapper.selectByCondition(condition);
        if (CollectionUtils.isNotEmpty(rolesList)) {
            return rolesList.stream().map(e -> e.getRoleCode()).collect(Collectors.toList());
        }
        // 权限不足
        throw new ServiceException("权限不足");
    }
}
