tangxiaobao
2021-08-16 5b926275cdff23c1fd995afad74be6159ec7476f
Merge branch 'txb'
2个文件已修改
65 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComSwPatrolRecordApi.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComSwPatrolRecordApi.java
@@ -20,6 +20,9 @@
import com.panzhihua.common.service.partybuilding.PartyBuildingService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.Version;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +34,10 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -468,6 +475,41 @@
        }
    }
    @ApiOperation(value = "导出图片测试")
    @PostMapping("/export/picture")
    public void test(@RequestParam(value = "id") Long id){
        Long communityId = this.getLoginUserInfo().getCommunityId();
        Map<String,Object> dataMap = new HashMap<String, Object>();
        try {
            ComSwSafetyWorkRecordVO comSwSafetyWorkRecordVO = JSONObject.parseObject(JSONObject.toJSONString(communityService.detailSafetyWorkRecord(id, communityId).getData()),ComSwSafetyWorkRecordVO.class);
            //日期
            dataMap.put("date", new SimpleDateFormat("yyyy-MM-dd").format(comSwSafetyWorkRecordVO.getPatrolTime()));
            Configuration configuration = new Configuration(new Version("2.3.0"));
            configuration.setDefaultEncoding("utf-8");
            /**
             * 以下是两种指定ftl文件所在目录路径的方式,注意这两种方式都是
             * 指定ftl文件所在目录的路径,而不是ftl文件的路径
             */
            //指定路径的第一种方式(根据某个类的相对路径指定)
//                configuration.setClassForTemplateLoading(this.getClass(), "");
            //指定路径的第二种方式,我的路径是C:/a.ftl
            configuration.setDirectoryForTemplateLoading(new File("c:/"));
            //输出文档路径及名称
            File outFile = new File("D:/报销信息导出.doc");
            //以utf-8的编码读取ftl文件
            Template template = configuration.getTemplate("报告.ftl", "utf-8");
            Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"), 10240);
            template.process(dataMap, out);
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private List<List<String>> headDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
@@ -477,9 +519,9 @@
        List<String> head2 = new ArrayList<String>();
        head2.add("值班人员联系电话(多个用\"、\"隔开,请安姓名顺序)");
        List<String> head3 = new ArrayList<String>();
        head3.add("值班领导(多个用\"、\"隔开)");
        head3.add("值班领导");
        List<String> head4 = new ArrayList<String>();
        head4.add("值班领导联系电话(多个用\"、\"隔开,请安姓名顺序)");
        head4.add("值班领导联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("");
        list.add(head0);
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java
@@ -355,16 +355,17 @@
            comMngUserTagDO.setTagName(comMngTagVO.getTagName());
            comMngUserTagDAO.updateById(comMngUserTagDO);
        }else{
            int count = comMngUserTagDAO.selectCount(new QueryWrapper<ComMngUserTagDO>().lambda().eq(ComMngUserTagDO::getCommunityId,comMngTagVO.getCommunityId()).eq(ComMngUserTagDO::getTagName,comMngTagVO.getTagName()));
            if(count>0){
               return R.fail("标签重复");
            ComMngUserTagDO comMngUserTagDO = comMngUserTagDAO.selectOne(new QueryWrapper<ComMngUserTagDO>().lambda().eq(ComMngUserTagDO::getCommunityId,comMngTagVO.getCommunityId()).eq(ComMngUserTagDO::getTagName,comMngTagVO.getTagName()));
            if(comMngUserTagDO != null){
                if (comMngUserTagDO.getCommunityId().equals(comMngTagVO.getCommunityId()))
                return R.fail("标签重复");
            }
            ComMngUserTagDO comMngUserTagDO = new ComMngUserTagDO();
            comMngUserTagDO.setTagName(comMngTagVO.getTagName());
            comMngUserTagDO.setCommunityId(comMngTagVO.getCommunityId());
            comMngUserTagDO.setSysFlag(0);
            comMngUserTagDO.setCreateAt(new Date());
            comMngUserTagDAO.insert(comMngUserTagDO);
            ComMngUserTagDO comMngUserTagDO1 = new ComMngUserTagDO();
            comMngUserTagDO1.setTagName(comMngTagVO.getTagName());
            comMngUserTagDO1.setCommunityId(comMngTagVO.getCommunityId());
            comMngUserTagDO1.setSysFlag(0);
            comMngUserTagDO1.setCreateAt(new Date());
            comMngUserTagDAO.insert(comMngUserTagDO1);
        }
        return R.ok();
    }