|
@@ -1,7 +1,10 @@
|
|
|
package com.tofly.feesapi.cbgl.service.impl;
|
|
|
|
|
|
+import com.tofly.feesapi.bjgl.entity.YhCbkxx;
|
|
|
+import com.tofly.feesapi.bjgl.service.YhCbkxxService;
|
|
|
import com.tofly.feesapi.cbgl.entity.ZnbZlLog;
|
|
|
import com.tofly.feesapi.cbgl.entity.dto.ZnbCbLogFilter;
|
|
|
+import com.tofly.feesapi.cbgl.entity.dto.ZnbFkFilter;
|
|
|
import com.tofly.feesapi.cbgl.entity.dto.ZnbZlLogFilter;
|
|
|
import com.tofly.feesapi.cbgl.entity.vo.ZnbZlLogSelect;
|
|
|
import com.tofly.feesapi.cbgl.mapper.ZnbZlLogMapper;
|
|
@@ -9,9 +12,18 @@ import com.tofly.feesapi.cbgl.service.IZnbZlLogService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.tofly.feesapi.common.entity.dto.PageDto;
|
|
|
import com.tofly.feesapi.common.entity.vo.PageResult;
|
|
|
+import com.tofly.feesapi.common.exception.FeesErrorCode;
|
|
|
+import com.tofly.feesapi.common.exception.FeesException;
|
|
|
+import com.tofly.feesapi.security.model.CzyUserDetails;
|
|
|
+import com.tofly.feesapi.yhgl.entity.YhKhjbxx;
|
|
|
+import com.tofly.feesapi.yhgl.service.YhKhjbxxService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.support.TransactionTemplate;
|
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
|
|
|
* <p>
|
|
@@ -24,8 +36,27 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class ZnbZlLogServiceImpl extends ServiceImpl<ZnbZlLogMapper, ZnbZlLog> implements IZnbZlLogService {
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YhKhjbxxService khjbxxService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YhCbkxxService cbkxxService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TransactionTemplate transactionTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
public PageResult<ZnbZlLogSelect> getPage(PageDto pageDto, ZnbZlLogFilter filter) {
|
|
|
+ if (filter.getZltype().equals("znb_da_log")) {
|
|
|
+ filter.setZltype("0");
|
|
|
+ }
|
|
|
+ if (filter.getZltype().equals("znb_zl_log")) {
|
|
|
+ filter.setZltype("1");
|
|
|
+ }
|
|
|
+ if (filter.getZltype().equals("znb_cz_log")) {
|
|
|
+ filter.setZltype("2");
|
|
|
+ }
|
|
|
PageDto<ZnbZlLogSelect> page = this.baseMapper.getPage(pageDto, filter);
|
|
|
return page.toVo();
|
|
|
}
|
|
@@ -34,4 +65,51 @@ public class ZnbZlLogServiceImpl extends ServiceImpl<ZnbZlLogMapper, ZnbZlLog> i
|
|
|
public List<ZnbZlLogSelect> getList(ZnbCbLogFilter filter) {
|
|
|
return this.baseMapper.getList(filter);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean ZnbFk(ZnbFkFilter filter, CzyUserDetails czyUserDetails) {
|
|
|
+ List<String> yhbhs = filter.getYhbhs();
|
|
|
+
|
|
|
+ if (yhbhs.size() == 0) {
|
|
|
+ throw new FeesException("未查询到相关操作用户", FeesErrorCode.BUSINESS_ERROR);
|
|
|
+ }
|
|
|
+ List<YhKhjbxx> yhList = khjbxxService.lambdaQuery().in(YhKhjbxx::getYhbh, yhbhs).list();
|
|
|
+ if (yhList.isEmpty()) {
|
|
|
+ throw new FeesException("未查询到可操作的用户", FeesErrorCode.BUSINESS_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ return fk(yhList, filter.getZltype(), czyUserDetails.getId()) == 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int fk(List<YhKhjbxx> yhList, String zltype, Long czry) {
|
|
|
+ int rlt = transactionTemplate.execute(status -> {
|
|
|
+ try {
|
|
|
+ String pch = UUID.randomUUID().toString();
|
|
|
+ for (YhKhjbxx khjbxx : yhList) {
|
|
|
+ List<YhCbkxx> cbkList = cbkxxService.lambdaQuery().in(YhCbkxx::getYhbh, khjbxx.getYhbh()).list();
|
|
|
+ for (YhCbkxx cbk : cbkList) {
|
|
|
+ ZnbZlLog log = new ZnbZlLog();
|
|
|
+ log.setYhbh(cbk.getYhbh());
|
|
|
+ log.setCbkh(cbk.getCbkh());
|
|
|
+ log.setCbkid(cbk.getCbkid());
|
|
|
+ log.setPch(pch);
|
|
|
+ log.setSccj(cbk.getSbsccj());
|
|
|
+ log.setSsgs(khjbxx.getSsgs());
|
|
|
+ log.setCzry(czry.toString());
|
|
|
+ log.setCzsj(LocalDateTime.now());
|
|
|
+ log.setClLock("0");
|
|
|
+ log.setClCljg("0");
|
|
|
+ log.setZltype("1");
|
|
|
+ log.setZlvalue(zltype);
|
|
|
+ this.save(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ } catch (Exception e) {
|
|
|
+ status.setRollbackOnly();
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return rlt;
|
|
|
+ }
|
|
|
}
|