|
|
@@ -1,126 +1,181 @@
|
|
|
-package org.jeecg.modules.hlgpayment.service.impl;
|
|
|
-
|
|
|
-import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-import org.jeecg.modules.hlgpayment.entity.HlgPayment;
|
|
|
-import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
|
|
|
-import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
|
|
|
-import org.jeecg.modules.hlgpayment.mapper.HlgPaymentDetailMapper;
|
|
|
-import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.cglib.beans.BeanMap;
|
|
|
-import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description: 付款明细表
|
|
|
- * @Author: jeecg-boot
|
|
|
- * @Date: 2020-02-27
|
|
|
- * @Version: V1.0
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class HlgPaymentDetailServiceImpl extends ServiceImpl<HlgPaymentDetailMapper, HlgPaymentDetail> implements IHlgPaymentDetailService {
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<HlgPaymentDetail> pageList(Page<HlgPaymentDetail> pageList, HlgPaymentDetail hlgPaymentDetail, QueryWrapper<HlgPaymentDetail> queryWrapper) {
|
|
|
- return pageList.setRecords(baseMapper.findList(pageList, hlgPaymentDetail, queryWrapper));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<HlgPaymentDetail> findMonthListByUserId(HlgPaymentDetail hlgPaymentDetail) {
|
|
|
- return baseMapper.findMonthListByUserId(hlgPaymentDetail);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取该paymentId下所有明细数量
|
|
|
- *
|
|
|
- * @param paymentId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public int getCountAll(String paymentId) {
|
|
|
- return baseMapper.getCountAll(paymentId);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取该paymnetId下所有付款成功的明细数量
|
|
|
- *
|
|
|
- * @param paymentId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public int getCountSuccess(String paymentId) {
|
|
|
- return baseMapper.getCountSuccess(paymentId);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<HlgPaymentDetailStatistics> pageOutList( HlgPaymentDetailStatistics hlgPaymentDetailStatistics, QueryWrapper<HlgPaymentDetailStatistics> queryWrapper) {
|
|
|
- List<HlgPaymentDetailStatistics> list = baseMapper.findHlgPaymentDetailStatisticsList(hlgPaymentDetailStatistics, queryWrapper);
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @DS("multi-datasource1")
|
|
|
- public List<HlgPaymentDetailStatistics> getPaymentDetailStatisticsList(HlgPaymentDetailStatistics hlgPaymentDetailStatistics,QueryWrapper<HlgPaymentDetailStatistics> queryWrapper) {
|
|
|
- List<HlgPaymentDetailStatistics> list = baseMapper.getPaymentDetailStatisticsList(hlgPaymentDetailStatistics, queryWrapper);
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 将List<Map<String,Object>>转换为List<T>
|
|
|
- * @param maps
|
|
|
- * @param clazz
|
|
|
- * @return
|
|
|
- * @throws InstantiationException
|
|
|
- * @throws IllegalAccessException
|
|
|
- */
|
|
|
- public static <T> List<T> mapsToObjects(List<Map<String, Object>> maps,Class<T> clazz) throws InstantiationException, IllegalAccessException {
|
|
|
- List<T> list = Lists.newArrayList();
|
|
|
- if (maps != null && maps.size() > 0) {
|
|
|
- Map<String, Object> map = null;
|
|
|
- T bean = null;
|
|
|
- for (int i = 0,size = maps.size(); i < size; i++) {
|
|
|
- map = maps.get(i);
|
|
|
- bean = clazz.newInstance();
|
|
|
- mapToBean(map, bean);
|
|
|
- list.add(bean);
|
|
|
- }
|
|
|
- }
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 将map装换为javabean对象
|
|
|
- * @param map
|
|
|
- * @param bean
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static <T> T mapToBean(Map<String, Object> map,T bean) {
|
|
|
- BeanMap beanMap = BeanMap.create(bean);
|
|
|
- beanMap.putAll(map);
|
|
|
- return bean;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<HlgPaymentDetail> findHlgPaymentDetailListByPaymentId(Integer id) {
|
|
|
- return baseMapper.findHlgPaymentDetailListByPaymentId(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 逻辑删除付款单下的所有明细
|
|
|
- * @param hlgPayment
|
|
|
- */
|
|
|
- @Override
|
|
|
- public void deleteByLogic(HlgPayment hlgPayment) {
|
|
|
- baseMapper.deleteByLogic(hlgPayment);
|
|
|
- }
|
|
|
-}
|
|
|
+package org.jeecg.modules.hlgpayment.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.utils.CryptTool;
|
|
|
+import org.jeecg.common.utils.HttpsContants;
|
|
|
+import org.jeecg.common.utils.OauthApi;
|
|
|
+import org.jeecg.common.utils.OauthTokenUtils;
|
|
|
+import org.jeecg.modules.hlgpayment.entity.HlgPayment;
|
|
|
+import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
|
|
|
+import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
|
|
|
+import org.jeecg.modules.hlgpayment.mapper.HlgPaymentDetailMapper;
|
|
|
+import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cglib.beans.BeanMap;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 付款明细表
|
|
|
+ * @Author: jeecg-boot
|
|
|
+ * @Date: 2020-02-27
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class HlgPaymentDetailServiceImpl extends ServiceImpl<HlgPaymentDetailMapper, HlgPaymentDetail> implements IHlgPaymentDetailService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<HlgPaymentDetail> pageList(Page<HlgPaymentDetail> pageList, HlgPaymentDetail hlgPaymentDetail, QueryWrapper<HlgPaymentDetail> queryWrapper) {
|
|
|
+ return pageList.setRecords(baseMapper.findList(pageList, hlgPaymentDetail, queryWrapper));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<HlgPaymentDetail> findMonthListByUserId(HlgPaymentDetail hlgPaymentDetail) {
|
|
|
+ return baseMapper.findMonthListByUserId(hlgPaymentDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取该paymentId下所有明细数量
|
|
|
+ *
|
|
|
+ * @param paymentId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int getCountAll(String paymentId) {
|
|
|
+ return baseMapper.getCountAll(paymentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取该paymnetId下所有付款成功的明细数量
|
|
|
+ *
|
|
|
+ * @param paymentId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int getCountSuccess(String paymentId) {
|
|
|
+ return baseMapper.getCountSuccess(paymentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<HlgPaymentDetailStatistics> pageOutList(HlgPaymentDetailStatistics hlgPaymentDetailStatistics, QueryWrapper<HlgPaymentDetailStatistics> queryWrapper) {
|
|
|
+ List<HlgPaymentDetailStatistics> list = baseMapper.findHlgPaymentDetailStatisticsList(hlgPaymentDetailStatistics, queryWrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @DS("multi-datasource1")
|
|
|
+ public List<HlgPaymentDetailStatistics> getPaymentDetailStatisticsList(HlgPaymentDetailStatistics hlgPaymentDetailStatistics, QueryWrapper<HlgPaymentDetailStatistics> queryWrapper) {
|
|
|
+ List<HlgPaymentDetailStatistics> list = baseMapper.getPaymentDetailStatisticsList(hlgPaymentDetailStatistics, queryWrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将List<Map<String,Object>>转换为List<T>
|
|
|
+ *
|
|
|
+ * @param maps
|
|
|
+ * @param clazz
|
|
|
+ * @return
|
|
|
+ * @throws InstantiationException
|
|
|
+ * @throws IllegalAccessException
|
|
|
+ */
|
|
|
+ public static <T> List<T> mapsToObjects(List<Map<String, Object>> maps, Class<T> clazz) throws InstantiationException, IllegalAccessException {
|
|
|
+ List<T> list = Lists.newArrayList();
|
|
|
+ if (maps != null && maps.size() > 0) {
|
|
|
+ Map<String, Object> map = null;
|
|
|
+ T bean = null;
|
|
|
+ for (int i = 0, size = maps.size(); i < size; i++) {
|
|
|
+ map = maps.get(i);
|
|
|
+ bean = clazz.newInstance();
|
|
|
+ mapToBean(map, bean);
|
|
|
+ list.add(bean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将map装换为javabean对象
|
|
|
+ *
|
|
|
+ * @param map
|
|
|
+ * @param bean
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static <T> T mapToBean(Map<String, Object> map, T bean) {
|
|
|
+ BeanMap beanMap = BeanMap.create(bean);
|
|
|
+ beanMap.putAll(map);
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<HlgPaymentDetail> findHlgPaymentDetailListByPaymentId(Integer id) {
|
|
|
+ return baseMapper.findHlgPaymentDetailListByPaymentId(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 逻辑删除付款单下的所有明细
|
|
|
+ *
|
|
|
+ * @param hlgPayment
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void deleteByLogic(HlgPayment hlgPayment) {
|
|
|
+ baseMapper.deleteByLogic(hlgPayment);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 慧灵工-慧盈
|
|
|
+ * 付款申请详情列表
|
|
|
+ *
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param hlgPaymentDetail
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<HlgPaymentDetail> pageListApi(Integer pageNo, Integer pageSize, HlgPaymentDetail hlgPaymentDetail, HttpServletRequest req) {
|
|
|
+ Page<HlgPaymentDetail> page = new Page<>();
|
|
|
+ //付款申请详情列表信息
|
|
|
+ String accessToken = OauthTokenUtils.getDayAccessToken();
|
|
|
+ String requestUrl = OauthApi.paymentDetailList;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ parameters.put("paymentId", hlgPaymentDetail.getPaymentId());
|
|
|
+ parameters.put("status", hlgPaymentDetail.getStatus());
|
|
|
+ //数据加密
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
|
|
|
+ log.info("付款申请详情列表===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean(HttpsContants.SUCCESS_FLAG)) {
|
|
|
+ log.info("付款申请详情列表成功===={}", jsonObject);
|
|
|
+ JSONObject jsonObject1 = jsonObject.getJSONObject("result");
|
|
|
+ List<HlgPaymentDetail> list = (List<HlgPaymentDetail>) jsonObject1.get("records");
|
|
|
+ log.info("付款申请详情列表数组==={}", list);
|
|
|
+ page.setRecords(list);
|
|
|
+ page.setTotal(jsonObject1.getLong("total"));
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询数据异常");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询数据异常");
|
|
|
+ }
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+}
|