|
@@ -11,8 +11,10 @@ import javax.jws.WebService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import com.jtgh.yjpt.client.common.accessory.AccessoryWebService;
|
|
|
import com.jtgh.yjpt.client.zcdc.zc.ZcWebService;
|
|
|
import com.jtgh.yjpt.client.zcdc.zcyh.ZcyhWebService;
|
|
|
import com.jtgh.yjpt.common.Constants;
|
|
@@ -25,11 +27,14 @@ import com.jtgh.yjpt.common.Utils;
|
|
|
import com.jtgh.yjpt.controller.BaseController;
|
|
|
import com.jtgh.yjpt.controller.check.ZcController;
|
|
|
import com.jtgh.yjpt.controller.common.AccessoryController;
|
|
|
+import com.jtgh.yjpt.dao.common.BlobDao;
|
|
|
import com.jtgh.yjpt.entity.BaseEntity;
|
|
|
import com.jtgh.yjpt.entity.auth.UserEntity;
|
|
|
import com.jtgh.yjpt.entity.check.ZcEntity;
|
|
|
import com.jtgh.yjpt.entity.check.ZcyhEntity;
|
|
|
import com.jtgh.yjpt.entity.common.AccessoryEntity;
|
|
|
+import com.jtgh.yjpt.entity.common.BlobEntity;
|
|
|
+import com.jtgh.yjpt.entity.common.CodeEntity;
|
|
|
import com.jtgh.yjpt.service.check.ZcService;
|
|
|
import com.jtgh.yjpt.service.check.ZcyhService;
|
|
|
import com.jtgh.yjpt.service.common.AccessoryService;
|
|
@@ -55,7 +60,10 @@ public class ZczbWebService extends BaseController {
|
|
|
private ZcController zcController;
|
|
|
@Autowired
|
|
|
private AccessoryController accessoryController;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private BlobDao blobDao;
|
|
|
+ @Autowired
|
|
|
+ private ThreadPoolTaskExecutor threadPool;
|
|
|
/**
|
|
|
* 保存
|
|
|
*
|
|
@@ -69,11 +77,68 @@ public class ZczbWebService extends BaseController {
|
|
|
// 行政人员
|
|
|
entity.setRecordCode("90");
|
|
|
} else {
|
|
|
+ ZcEntity vo = zcService.findOne(entity.getId());
|
|
|
+ entity.setAddDate(vo.getAddDate());
|
|
|
+ entity.setAddUser(vo.getAddUser());
|
|
|
+ entity.setRecordCode(vo.getRecordCode());
|
|
|
+ entity.setRecordStatus(vo.getRecordStatus());
|
|
|
+ entity.setSftb(vo.getSftb());
|
|
|
+ entity.setTbzt(vo.getTbzt());
|
|
|
+ entity.setQylb(vo.getQylb());
|
|
|
+ entity.setTbdyid(vo.getTbdyid());
|
|
|
entity.setUpdateDate(new Date());
|
|
|
entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
- }
|
|
|
+ }
|
|
|
entity.setTbzt(Constants.NO);
|
|
|
entity = zcService.save(entity);
|
|
|
+ final Long tempid=entity.getId();
|
|
|
+ Thread thread = new Thread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ // 同步
|
|
|
+ ZcEntity tbEntity = zcService.findOne(tempid);
|
|
|
+ if (Constants.YES.equals(GlobalData.JAXWS_SYNC)
|
|
|
+ && GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY)) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ ZcWebService webService = zcService.getWebService();
|
|
|
+ if (webService != null) {
|
|
|
+ webService.save(tbEntity);
|
|
|
+ tbEntity.setTbzt(Constants.YES);
|
|
|
+ zcService.save(tbEntity);
|
|
|
+ } else {
|
|
|
+ tbEntity.setTbzt(Constants.NO);
|
|
|
+ zcService.save(tbEntity);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ tbEntity.setTbzt(Constants.NO);
|
|
|
+ zcService.save(tbEntity);
|
|
|
+ }
|
|
|
+ List<ZcyhEntity> yhList = zcyhService.findBySszc(tbEntity);
|
|
|
+ ZcyhWebService zcyhWebService = zcyhService.getWebService();
|
|
|
+ if (null != zcyhWebService) {
|
|
|
+ for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
+ try {
|
|
|
+ zcyhWebService.save(zcyhEntity);
|
|
|
+ zcyhEntity.setTbzt(Constants.YES);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ zcyhEntity.setTbzt(Constants.NO);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
+ zcyhEntity.setTbzt(Constants.NO);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ threadPool.execute(thread);
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
@@ -85,98 +150,205 @@ public class ZczbWebService extends BaseController {
|
|
|
* @param delList
|
|
|
* @return
|
|
|
*/
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public ZcEntity saveEntity(ZcEntity entity, List<ZcyhEntity> addList,
|
|
|
- List<ZcyhEntity> delList) {
|
|
|
- boolean first = false;
|
|
|
+ final List<ZcyhEntity> delList) {
|
|
|
if (null == entity.getId() || entity.getId().equals(0l)) {
|
|
|
entity.setAddDate(new Date());
|
|
|
entity.setAddUser(Utils.getWebServiceUser());
|
|
|
// 行政人员
|
|
|
entity.setRecordCode("90");
|
|
|
- first = true;
|
|
|
} else {
|
|
|
+ ZcEntity vo = zcService.findOne(entity.getId());
|
|
|
+ entity.setAddDate(vo.getAddDate());
|
|
|
+ entity.setAddUser(vo.getAddUser());
|
|
|
+ entity.setRecordCode(vo.getRecordCode());
|
|
|
+ entity.setRecordStatus(vo.getRecordStatus());
|
|
|
+ entity.setSftb(vo.getSftb());
|
|
|
+ entity.setTbzt(vo.getTbzt());
|
|
|
+ entity.setQylb(vo.getQylb());
|
|
|
+ entity.setTbdyid(vo.getTbdyid());
|
|
|
entity.setUpdateUser(Utils.getCurrentUser());
|
|
|
entity.setUpdateDate(new Date());
|
|
|
}
|
|
|
+ entity.setTbzt(Constants.NO);
|
|
|
ZcEntity zcEntity = zcService.save(entity);// 先保存实体
|
|
|
List<ZcyhEntity> tbAddList = new ArrayList<ZcyhEntity>();// 临时存放
|
|
|
for (ZcyhEntity zcyhEntity : addList) {// for循环需要添加的自查隐患子表
|
|
|
zcyhEntity.setSszc(zcEntity);// 设置自查隐患属于的主表记录
|
|
|
+ List<byte[]> yhzpList = zcyhEntity.getYhzp();
|
|
|
+ List<byte[]> zghzpList = zcyhEntity.getZghzp();
|
|
|
zcyhEntity = zcyhService.save(zcyhEntity);
|
|
|
+ if (yhzpList != null) {
|
|
|
+ for (byte[] yhzp : yhzpList) {
|
|
|
+ AccessoryEntity accEntity1 = new AccessoryEntity();
|
|
|
+ BlobEntity blobEntity1 = new BlobEntity();
|
|
|
+ blobEntity1.setValue(yhzp);
|
|
|
+ blobEntity1.setAddDate(new Date());
|
|
|
+ blobEntity1.setAddUser(Utils.getCurrentUser());
|
|
|
+ blobEntity1 = blobDao.save(blobEntity1);
|
|
|
+ accEntity1.setAddDate(new Date());
|
|
|
+ accEntity1.setAddUser(Utils.getCurrentUser());
|
|
|
+ accEntity1.setName("隐患整改照片");
|
|
|
+ accEntity1.setSuffix("jpg");
|
|
|
+ accEntity1.setContent(blobEntity1);
|
|
|
+ accEntity1.setLength(yhzp.length);
|
|
|
+ accEntity1.setEntityId(zcyhEntity.getId());
|
|
|
+ CodeEntity sslxEntity = new CodeEntity();
|
|
|
+ sslxEntity.setId(Long.parseLong(Constants.FJSSLX_YHZP));
|
|
|
+ accEntity1.setEntityType(sslxEntity);
|
|
|
+ accEntity1.setTbzt(Constants.NO);
|
|
|
+ accessoryService.save(accEntity1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (zghzpList != null) {
|
|
|
+ for (byte[] zghzp : zghzpList) {
|
|
|
+ AccessoryEntity accEntity2 = new AccessoryEntity();
|
|
|
+ BlobEntity blobEntity2 = new BlobEntity();
|
|
|
+ blobEntity2.setValue(zghzp);
|
|
|
+ blobEntity2.setAddDate(new Date());
|
|
|
+ blobEntity2.setAddUser(Utils.getCurrentUser());
|
|
|
+ blobEntity2 = blobDao.save(blobEntity2);
|
|
|
+ accEntity2.setAddDate(new Date());
|
|
|
+ accEntity2.setAddUser(Utils.getCurrentUser());
|
|
|
+ accEntity2.setName("隐患整改后照片");
|
|
|
+ accEntity2.setSuffix("jpg");
|
|
|
+ accEntity2.setContent(blobEntity2);
|
|
|
+ accEntity2.setLength(zghzp.length);
|
|
|
+ accEntity2.setEntityId(zcyhEntity.getId());
|
|
|
+ CodeEntity sslxEntity = new CodeEntity();
|
|
|
+ sslxEntity.setId(Long.parseLong(Constants.FJSSLX_ZGHZP));
|
|
|
+ accEntity2.setEntityType(sslxEntity);
|
|
|
+ accEntity2.setTbzt(Constants.NO);
|
|
|
+ accessoryService.save(accEntity2);
|
|
|
+ }
|
|
|
+ }
|
|
|
tbAddList.add(zcyhEntity);
|
|
|
- if (first == true) {// 如果是第一次新增
|
|
|
- if (null != zcyhEntity.getZgcs()) {// 但是整改措施不为空
|
|
|
- for (AccessoryEntity zcyhEntity2 : zcyhEntity.getZgcs()) {
|
|
|
- AccessoryEntity zgcs = accessoryService
|
|
|
- .findOne(zcyhEntity2.getId());
|
|
|
- if (null != zgcs) {
|
|
|
- zgcs.setEntityId(zcyhEntity.getId());
|
|
|
- accessoryService.save(zgcs);
|
|
|
- }
|
|
|
+ if (null != zcyhEntity.getZgcs()) {// 但是整改措施不为空
|
|
|
+ for (AccessoryEntity zcyhEntity2 : zcyhEntity.getZgcs()) {
|
|
|
+ AccessoryEntity zgcs=null;
|
|
|
+ if(zcyhEntity2.getId()!=null|| !zcyhEntity2.getId().equals(0l)){
|
|
|
+ zgcs = accessoryService.findOne(zcyhEntity2
|
|
|
+ .getId());
|
|
|
+ }
|
|
|
+ if (null != zgcs) {
|
|
|
+ zgcs.setEntityId(zcyhEntity.getId());
|
|
|
+ zgcs.setTbzt(Constants.NO);
|
|
|
+ accessoryService.save(zgcs);
|
|
|
}
|
|
|
}
|
|
|
- if (null != zcyhEntity.getZgjg()) {
|
|
|
- AccessoryEntity zgjg = accessoryService.findOne(zcyhEntity
|
|
|
+ }
|
|
|
+ if (null != zcyhEntity.getZgjg()) {
|
|
|
+ AccessoryEntity zgjg=null;
|
|
|
+ if(zcyhEntity.getZgjg().getId()!=null|| !zcyhEntity.getZgjg().getId().equals(0l)){
|
|
|
+ zgjg = accessoryService.findOne(zcyhEntity
|
|
|
.getZgjg().getId());
|
|
|
- if (null != zgjg) {
|
|
|
- zgjg.setEntityId(zcyhEntity.getId());
|
|
|
- accessoryService.save(zgjg);
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (null != zgjg) {
|
|
|
+ zgjg.setEntityId(zcyhEntity.getId());
|
|
|
+ zgjg.setTbzt(Constants.NO);
|
|
|
+ accessoryService.save(zgjg);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
zcyhService.logicDelete(delList);
|
|
|
- // 同步
|
|
|
- if (Constants.YES.equals(GlobalData.JAXWS_SYNC)
|
|
|
- && GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY)) {
|
|
|
- try {
|
|
|
- ZcWebService webService = zcService.getWebService();
|
|
|
- if (webService != null) {
|
|
|
- webService.save(zcEntity);
|
|
|
- zcEntity.setTbzt(Constants.YES);
|
|
|
- zcService.save(zcEntity);
|
|
|
- } else {
|
|
|
- zcEntity.setTbzt(Constants.NO);
|
|
|
- zcService.save(zcEntity);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- zcEntity.setTbzt(Constants.NO);
|
|
|
- zcService.save(zcEntity);
|
|
|
- }
|
|
|
- List<ZcyhEntity> yhList = zcyhService.findBySszc(zcEntity);
|
|
|
-
|
|
|
- ZcyhWebService zcyhWebService = zcyhService.getWebService();
|
|
|
- if (null != zcyhWebService) {
|
|
|
- for (ZcyhEntity delEntity : delList) {
|
|
|
+ final Long tempid = zcEntity.getId();
|
|
|
+ Thread thread = new Thread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ ZcEntity tbEntity = zcService.findOne(tempid);
|
|
|
+ // 同步
|
|
|
+ if (Constants.YES.equals(GlobalData.JAXWS_SYNC)
|
|
|
+ && GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY)) {
|
|
|
try {
|
|
|
- zcyhWebService.delete(delEntity);
|
|
|
- delEntity.setTbzt(Constants.YES);
|
|
|
- delEntity
|
|
|
- .setRecordStatus(BaseEntity.RECORD_STATE_DELETE);
|
|
|
- zcyhService.save(delEntity);
|
|
|
+ ZcWebService webService = zcService.getWebService();
|
|
|
+ if (webService != null) {
|
|
|
+ webService.save(tbEntity);
|
|
|
+ tbEntity.setTbzt(Constants.YES);
|
|
|
+ zcService.save(tbEntity);
|
|
|
+ } else {
|
|
|
+ tbEntity.setTbzt(Constants.NO);
|
|
|
+ zcService.save(tbEntity);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ tbEntity.setTbzt(Constants.NO);
|
|
|
+ zcService.save(tbEntity);
|
|
|
}
|
|
|
- }
|
|
|
- for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
- try {
|
|
|
- zcyhWebService.save(zcyhEntity);
|
|
|
- zcyhEntity.setTbzt(Constants.YES);
|
|
|
- zcyhService.save(zcyhEntity);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- zcyhEntity.setTbzt(Constants.NO);
|
|
|
- zcyhService.save(zcyhEntity);
|
|
|
+ List<ZcyhEntity> yhList = zcyhService.findBySszc(tbEntity);
|
|
|
+
|
|
|
+ ZcyhWebService zcyhWebService = zcyhService.getWebService();
|
|
|
+ if (null != zcyhWebService) {
|
|
|
+ for (ZcyhEntity delEntity : delList) {
|
|
|
+ try {
|
|
|
+ zcyhWebService.delete(delEntity);
|
|
|
+ delEntity.setTbzt(Constants.YES);
|
|
|
+ delEntity
|
|
|
+ .setRecordStatus(BaseEntity.RECORD_STATE_DELETE);
|
|
|
+ zcyhService.save(delEntity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
+ try {
|
|
|
+ zcyhWebService.save(zcyhEntity);
|
|
|
+ zcyhEntity.setTbzt(Constants.YES);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ zcyhEntity.setTbzt(Constants.NO);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
+ zcyhEntity.setTbzt(Constants.NO);
|
|
|
+ zcyhService.save(zcyhEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ AccessoryWebService accessoryWebService = accessoryService
|
|
|
+ .getAccessoryWebService(tbEntity.getSzd().getId());
|
|
|
+ if (null != accessoryWebService) {
|
|
|
+ List<AccessoryEntity> accList = new ArrayList<AccessoryEntity>();
|
|
|
+ for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
+ accList.addAll((List<AccessoryEntity>) accessoryController
|
|
|
+ .listById(zcyhEntity.getId(),
|
|
|
+ Long.parseLong(Constants.FJSSLX_YHZP))
|
|
|
+ .getAttribute("records"));
|
|
|
+ accList.addAll((List<AccessoryEntity>) accessoryController
|
|
|
+ .listById(zcyhEntity.getId(),
|
|
|
+ Long.parseLong(Constants.FJSSLX_ZGHZP))
|
|
|
+ .getAttribute("records"));
|
|
|
+ accList.addAll((List<AccessoryEntity>) accessoryController
|
|
|
+ .listById(zcyhEntity.getId(),
|
|
|
+ Long.parseLong(Constants.FJSSLX_ZGCSFJ))
|
|
|
+ .getAttribute("records"));
|
|
|
+ accList.addAll((List<AccessoryEntity>) accessoryController
|
|
|
+ .listById(zcyhEntity.getId(),
|
|
|
+ Long.parseLong(Constants.FJSSLX_ZGJGFJ))
|
|
|
+ .getAttribute("records"));
|
|
|
+ }
|
|
|
+ if(accList!=null){
|
|
|
+ for(AccessoryEntity acc:accList){
|
|
|
+ if(acc.getTbzt().equals(Constants.NO)){
|
|
|
+ try {
|
|
|
+ accessoryWebService.save(acc);
|
|
|
+ acc.setTbzt(Constants.YES);
|
|
|
+ accessoryService.save(acc);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ acc.setTbzt(Constants.NO);
|
|
|
+ accessoryService.save(acc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (ZcyhEntity zcyhEntity : yhList) {
|
|
|
- zcyhEntity.setTbzt(Constants.NO);
|
|
|
- zcyhService.save(zcyhEntity);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ threadPool.execute(thread);
|
|
|
return zcEntity;
|
|
|
}
|
|
|
|
|
@@ -223,8 +395,7 @@ public class ZczbWebService extends BaseController {
|
|
|
final Long szgq, final Long qymc, final String aqfzr, Date jcsjK,
|
|
|
Date jcsjZ, int n, int pageCount) {
|
|
|
List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
- addNotEmptyModel(filterList, "szd.id", szd, Operator.LIKE_R);
|
|
|
- jcsjK = Utils.getDateLastTime(jcsjK);
|
|
|
+ jcsjK = Utils.getDateFirstTime(jcsjK);
|
|
|
jcsjZ = Utils.getDateLastTime(jcsjZ);
|
|
|
if (null != szd) {
|
|
|
addNotEmptyModel(filterList, "szd.id", szd, Operator.LIKE_R);
|