| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | |
| | | @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) { |
| | |
| | | /** |
| | | * 插入数据申请 |
| | | */ |
| | | 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) { |
| | |
| | | /** |
| | | * 获取数据申请实体类 |
| | | */ |
| | | 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()); |
| | |
| | | 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()); |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | } |