|
@@ -5,14 +5,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
|
|
|
+import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
|
|
|
import com.ym.mec.biz.dal.dto.Mapper;
|
|
|
import com.ym.mec.biz.dal.dto.SimpleUserDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
|
|
|
import com.ym.mec.biz.dal.enums.ReturnFeeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
|
|
|
import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
|
|
@@ -38,7 +38,6 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import static com.ym.mec.biz.dal.enums.GroupType.GOODS_SELL;
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.MEMBER;
|
|
|
import static com.ym.mec.biz.dal.enums.PeriodEnum.*;
|
|
|
|
|
@@ -179,6 +178,63 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<CloudTeacherStudent> exportCloudTeacherOrderInActive(CloudTeacherOrderQueryInfo queryInfo){
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ List<CloudTeacherStudent> dataList = cloudTeacherOrderDao.queryInactive(params);
|
|
|
+ if (dataList == null || dataList.isEmpty()) {
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ List<Integer> organIds = dataList.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
|
|
|
+ Map<Integer, String> organNameMap = this.getMap("organization", "id_", "name_", organIds, queryInfo.getTenantId(), Integer.class, String.class);
|
|
|
+
|
|
|
+ Map<Integer, SimpleUserDto> empMapById = new HashMap<>();
|
|
|
+ List<Integer> operatorIdList = dataList.stream().map(CloudTeacherStudent::getOperator)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ if (!operatorIdList.isEmpty()) {
|
|
|
+ List<SimpleUserDto> byIds = employeeDao.findByIds(operatorIdList);
|
|
|
+ byIds.forEach(next -> empMapById.put(next.getUserId(), next));
|
|
|
+ }
|
|
|
+ TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>().eq("tenant_id_", queryInfo.getTenantId()));
|
|
|
+ for (CloudTeacherStudent cst : dataList) {
|
|
|
+ cst.setOrganName(organNameMap.get(cst.getOrganId()));
|
|
|
+ if (cst.getOperator() != null) {
|
|
|
+ cst.setOperatorName(empMapById.getOrDefault(cst.getOperator(), new SimpleUserDto()).getUserName());
|
|
|
+ }
|
|
|
+ if (tenantConfig != null) {
|
|
|
+ JSONObject cfg = JSON.parseObject(tenantConfig.getConfig());
|
|
|
+ JSONObject memberConfig = (JSONObject) cfg.get("member_config");
|
|
|
+ Double divide;
|
|
|
+ switch (cst.getType()) {
|
|
|
+ case DAY:
|
|
|
+ divide = memberConfig.getDouble("day_divide");
|
|
|
+ break;
|
|
|
+ case MONTH:
|
|
|
+ divide = memberConfig.getDouble("month_divide");
|
|
|
+ break;
|
|
|
+ case QUARTERLY:
|
|
|
+ divide = memberConfig.getDouble("quarter_divide");
|
|
|
+ break;
|
|
|
+ case YEAR_HALF:
|
|
|
+ divide = memberConfig.getDouble("half_year_divide");
|
|
|
+ break;
|
|
|
+ case YEAR:
|
|
|
+ divide = memberConfig.getDouble("year_divide");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ divide = null;
|
|
|
+ }
|
|
|
+ if (divide == null) {
|
|
|
+ cst.setAmount(null);
|
|
|
+ } else {
|
|
|
+ cst.setAmount(new BigDecimal(divide * cst.getTime()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, Object> pay(List<CloudTeacherStudent> cloudTeacherStudents) throws Exception {
|
|
|
|