|
@@ -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,21 @@ 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 net.sf.jsqlparser.expression.DateTimeLiteralExpression;
|
|
|
+import org.apache.commons.math3.analysis.function.Log;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+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>
|
|
@@ -23,7 +38,14 @@ 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) {
|
|
|
PageDto<ZnbZlLogSelect> page = this.baseMapper.getPage(pageDto, filter);
|
|
@@ -34,4 +56,48 @@ 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("fk");
|
|
|
+ log.setZlvalue(zltype);
|
|
|
+ this.save(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }catch (Exception e) {
|
|
|
+ status.setRollbackOnly();
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return rlt;
|
|
|
+ }
|
|
|
+
|
|
|
}
|