管道基础大数据平台系统开发-【后端】-Server
13693261870
2022-12-25 1f5416b81f3f9b62cf0f73e715e06340ba53182c
12.25.5
已修改2个文件
38 ■■■■ 文件已修改
src/main/java/com/lf/server/controller/show/ApplyController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/ApplyService.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/ApplyController.java
@@ -195,7 +195,7 @@
            @ApiImplicitParam(name = "flowId", value = "申请流程ID", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/updateForSubmit")
    public ResponseMsg<Object> updateForSubmit(Integer flowId) {
    public ResponseMsg<Object> updateForSubmit(Integer flowId, HttpServletRequest req) {
        try {
            FlowEntity flowEntity = flowService.selectById(flowId);
            if (null == flowEntity) {
@@ -214,9 +214,11 @@
            }
            int rows = applyService.updateForSubmit(applyEntity.getId(), flowEntity.getId());
            applyEntity = applyService.selectById(applyEntity.getId());
            if (StaticData.TEN == applyEntity.getStatus()) {
                // 打包
                UserEntity ue = tokenService.getCurrentUser(req);
                applyService.zipDbData(ue, applyEntity);
            }
            return success(rows);
src/main/java/com/lf/server/service/show/ApplyService.java
@@ -4,14 +4,18 @@
import com.lf.server.entity.show.ApplyEntity;
import com.lf.server.entity.show.FlowEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.AesHelper;
import com.lf.server.helper.Md5Helper;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.show.ApplyMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@@ -25,6 +29,11 @@
    @Autowired
    FlowService flowService;
    @Autowired
    DataLibService dataLibService;
    private final static Log log = LogFactory.getLog(ApplyService.class);
    @Override
    public Integer selectCount(String uname, Integer status, Timestamp start, Timestamp end) {
@@ -118,7 +127,7 @@
    /**
     * 插入数据申请
     */
    public Integer insertApply(UserEntity ue, DownloadReqEntity dr) {
    public Integer insertApply(UserEntity ue, DownloadReqEntity dr) throws Exception {
        ApplyEntity apply = getApplyEntity(ue, dr);
        int rows = applyMapper.insert(apply);
        if (0 == rows) {
@@ -134,8 +143,9 @@
    /**
     * 获取数据申请实体类
     */
    private ApplyEntity getApplyEntity(UserEntity ue, DownloadReqEntity dr) {
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd()));
    private ApplyEntity getApplyEntity(UserEntity ue, DownloadReqEntity dr) throws Exception {
        // String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd()))
        String aesPwd = AesHelper.encrypt(dr.getPwd());
        ApplyEntity apply = new ApplyEntity();
        apply.setUserid(ue.getId());
@@ -143,7 +153,7 @@
        apply.setTabs(StringHelper.join(dr.getTabs(), ","));
        apply.setEntities(StringHelper.join(dr.getEntities(), ","));
        apply.setWkt(dr.getWkt());
        apply.setPwd(dbPwd);
        apply.setPwd(aesPwd);
        apply.setStatus(0);
        apply.setCount(dr.getIds().size());
        apply.setDescr(dr.getDescr());
@@ -176,4 +186,18 @@
        return list;
    }
    /**
     * 打包DB数据
     */
    public void zipDbData(UserEntity ue, ApplyEntity entity) {
        try {
            List<String> entities = Arrays.asList(entity.getEntities().split(","));
            String pwd = AesHelper.decrypt(entity.getPwd());
            dataLibService.createZipFile(ue, entities, entity.getWkt(), pwd);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}