|
@@ -4,12 +4,20 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.aspose.words.*;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxPersistentManageDao;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxPersistentManageService;
|
|
|
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodesDo;
|
|
|
import com.rongwei.bsentity.domain.ZhcxPersistentManageDo;
|
|
|
+import com.rongwei.bsentity.dto.ZhcxPersistentManageDto;
|
|
|
import com.rongwei.bsentity.vo.FormDataVO;
|
|
|
import com.rongwei.bsentity.vo.ZhcxPersistentWordVO;
|
|
|
+import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
|
|
|
+import com.rongwei.rwadmincommon.system.service.SysOrganizationService;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommoncomponent.excel.aspose.ExcelExportUtil;
|
|
|
import com.rongwei.rwcommoncomponent.excel.utils.WordHelpUtils;
|
|
@@ -17,9 +25,12 @@ import com.rongwei.rwcommoncomponent.excel.vo.FormData;
|
|
|
import com.rongwei.rwcommoncomponent.file.service.SysFileItemService;
|
|
|
import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.BufferedInputStream;
|
|
@@ -46,6 +57,8 @@ public class ZhcxPersistentManageServiceImpl extends ServiceImpl<ZhcxPersistentM
|
|
|
private ZhcxPersistentManageDao zhcxPersistentManageDao;
|
|
|
@Autowired
|
|
|
private SysFileItemService sysFileItemService;
|
|
|
+ @Autowired
|
|
|
+ private SysOrganizationService sysOrganizationService;
|
|
|
|
|
|
@Value("${wz-provider.syncWzDataUrl}")
|
|
|
private String syncWzDataUrl;
|
|
@@ -291,6 +304,56 @@ public class ZhcxPersistentManageServiceImpl extends ServiceImpl<ZhcxPersistentM
|
|
|
@Override
|
|
|
public void syncWzPlatform(List<String> ids) {
|
|
|
//zhcxPersistentManageDao.syncWzDataUrl
|
|
|
+ LambdaQueryWrapper<ZhcxPersistentManageDo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.in(ZhcxPersistentManageDo::getId,ids);
|
|
|
+ List<ZhcxPersistentManageDo> list = this.list(queryWrapper);
|
|
|
+ List<ZhcxPersistentManageDto> dtoList = new ArrayList<>();
|
|
|
+ if(ObjectUtil.isEmpty(list)) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ List<ZhcxPersistentManageDo> updateList = new ArrayList<>();
|
|
|
+ ZhcxPersistentManageDo manageDo;
|
|
|
+ ZhcxPersistentManageDto manageDto;
|
|
|
+ for(ZhcxPersistentManageDo persistentManageDo : list){
|
|
|
+ manageDo = new ZhcxPersistentManageDo();
|
|
|
+ manageDto = new ZhcxPersistentManageDto();
|
|
|
+ manageDo.setId(persistentManageDo.getId());
|
|
|
+ manageDo.setSyncstate("3");
|
|
|
+ updateList.add(manageDo);
|
|
|
+ BeanUtils.copyProperties(persistentManageDo, manageDto);
|
|
|
+ String rectifystatus = manageDto.getRectifystatus();
|
|
|
+ String period = manageDto.getPeriod();
|
|
|
+ String fill = manageDto.getFill();
|
|
|
+ Date checkdate = manageDto.getCheckdate();
|
|
|
+ SysOrganizationDo curOrgTopParent = sysOrganizationService.getCurOrgTopParent(persistentManageDo.getFirstorgid());
|
|
|
+ manageDto.setBaseorgname(curOrgTopParent.getFullname());
|
|
|
+ manageDto.setFineNo(fill + "("+(checkdate.getYear()+1900)+")" +period);
|
|
|
+ if (rectifystatus.equals("未整改")) {
|
|
|
+ manageDto.setRectifystatus("0");
|
|
|
+ }else if (rectifystatus.equals("已整改")) {
|
|
|
+ manageDto.setRectifystatus("1");
|
|
|
+ }
|
|
|
+ dtoList.add(manageDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ HttpEntity<List<ZhcxPersistentManageDto>> requestEntity = new HttpEntity<>(dtoList, headers);
|
|
|
+ ResponseEntity<String> response = restTemplate.exchange(
|
|
|
+ syncWzDataUrl, HttpMethod.POST, requestEntity, String.class);
|
|
|
+ int statusCodeValue = response.getStatusCodeValue();
|
|
|
+ System.out.println("Response status code: " + statusCodeValue);
|
|
|
+ if(200 != statusCodeValue) {
|
|
|
+ log.error("请求结果:{}", statusCodeValue);
|
|
|
+ throw new CustomException("同步失败,请联系管理员!");
|
|
|
+ }
|
|
|
+ //修改同步状态
|
|
|
+ if(updateList.size()>0){
|
|
|
+ this.updateBatchById(updateList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initWeekWord(Document[] doc, List<ZhcxPersistentManageDo> rewardListData, String tempId) {
|