| | |
| | | import com.moon.server.helper.PathHelper; |
| | | import com.moon.server.helper.RestHelper; |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.helper.WebHelper; |
| | | import com.moon.server.mapper.data.PublishMapper; |
| | | import com.moon.server.service.sys.TokenService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @Value("${sys.exportServer}") |
| | | private String exportServer; |
| | | |
| | | @Value("${sys.iisHost}") |
| | | private String iisHost; |
| | | |
| | | @Resource |
| | | PublishMapper publishMapper; |
| | | |
| | | @Resource |
| | | PathHelper pathHelper; |
| | | ShuJianService shuJianService; |
| | | |
| | | private final static Log log = LogFactory.getLog(PublishService.class); |
| | | |
| | |
| | | return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset); |
| | | } |
| | | |
| | | public List<Integer> selectLasCs(PubEntity entity, String method, HttpServletRequest req) { |
| | | Map<String, Object> map = getMapData(entity); |
| | | |
| | | String str = RestHelper.postForRest(exportServer + method, map); |
| | | if (StringHelper.isEmpty(str)) { |
| | | return null; |
| | | } |
| | | |
| | | ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); |
| | | if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { |
| | | return null; |
| | | } |
| | | |
| | | String rs = msg.getResult(); |
| | | if (StringHelper.isEmpty(rs)) { |
| | | return null; |
| | | } |
| | | |
| | | return StringHelper.strToIntegers(rs); |
| | | } |
| | | |
| | | /** |
| | | * 发送发布请求 |
| | | */ |
| | |
| | | public Integer deletes(List<Integer> idList, HttpServletRequest req) { |
| | | String ids = StringHelper.join(idList, ","); |
| | | |
| | | return deletes(ids); |
| | | } |
| | | |
| | | /** |
| | | * 删除发布文件 |
| | | */ |
| | | public void deleteFiles(List<PublishEntity> list) { |
| | | String lfData = pathHelper.getConfig().getLfData(); |
| | | for (PublishEntity pub : list) { |
| | | if (null != pub.getUrl() && pub.getUrl().contains("/SG/")) { |
| | | continue; |
| | | } |
| | | |
| | | String path = lfData + pub.getPath().replace("\\tileset.json", ""); |
| | | File file = new File(path); |
| | | if (!file.exists() || !file.isDirectory()) { |
| | | continue; |
| | | } |
| | | |
| | | String cmd = String.format("cmd /c rd \"%s\" /s /q", path); |
| | | WebHelper.exec(cmd); |
| | | List<PublishEntity> list = selectByIds(ids); |
| | | for (PublishEntity entity : list) { |
| | | shuJianService.deleteServe(entity); |
| | | } |
| | | |
| | | return deletes(ids); |
| | | } |
| | | |
| | | /** |