|
@@ -20,6 +20,7 @@ import com.zhongzheng.common.type.EncryptHandler;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
+import com.zhongzheng.common.utils.http.HttpUtils;
|
|
|
import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
|
|
|
import com.zhongzheng.modules.activity.domain.ActivityOrder;
|
|
|
import com.zhongzheng.modules.activity.service.IActivityGoodsPriceService;
|
|
@@ -46,10 +47,7 @@ import com.zhongzheng.modules.goods.service.IGoodsQuestionRelService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.service.IQuestionMerchantService;
|
|
|
import com.zhongzheng.modules.goods.vo.QuestionOpenImportVo;
|
|
|
-import com.zhongzheng.modules.grade.bo.ClassGradeListBo;
|
|
|
-import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
|
|
|
-import com.zhongzheng.modules.grade.bo.ClassGradeSortBo;
|
|
|
-import com.zhongzheng.modules.grade.bo.ClassGradeUserTempQueryBo;
|
|
|
+import com.zhongzheng.modules.grade.bo.*;
|
|
|
import com.zhongzheng.modules.grade.domain.*;
|
|
|
import com.zhongzheng.modules.grade.service.*;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeUserTempVo;
|
|
@@ -91,6 +89,7 @@ import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -213,6 +212,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
private ITopOldOrderService topOldOrderService;
|
|
|
@Autowired
|
|
|
private ISysOldOrgService iSysOldOrgService;
|
|
|
+ @Autowired
|
|
|
+ private ISysTenantService iSysTenantService;
|
|
|
+ @Value("${oldStudySys.createExamPath}")
|
|
|
+ private String CREATE_EXAM_PATH;
|
|
|
|
|
|
@Override
|
|
|
public OrderVo queryById(Long orderId) {
|
|
@@ -686,9 +689,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
orderGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
orderGoods.setGoodsReceived(g.getGoodsReceived());
|
|
|
- if (ObjectUtils.isNotNull(bo.getSubOrderGoodsId())){
|
|
|
+ if (ObjectUtils.isNotNull(g.getSubOrderGoodsId())){
|
|
|
//补充考试次数订单商品ID
|
|
|
- orderGoods.setSubOrderGoodsId(bo.getSubOrderGoodsId());
|
|
|
+ orderGoods.setSubOrderGoodsId(g.getSubOrderGoodsId());
|
|
|
+ orderGoods.setOpenQuestionSign(bo.getOpenQuestionSign());
|
|
|
}
|
|
|
//订单标准价格不计算优惠
|
|
|
totalPrice = totalPrice.add(goods.getStandPrice());
|
|
@@ -855,7 +859,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
iWxPayService.joinLockGrade(order.getOrderSn(), orderGoods.getGoodsId(), orderGoods.getOrderGoodsId());
|
|
|
//商品是否关联第三方题库商品
|
|
|
Goods goods = iGoodsService.getById(orderGoods.getGoodsId());
|
|
|
- if (ObjectUtils.isNotNull(goods.getQuestionGoodsId())){
|
|
|
+ if (ObjectUtils.isNotNull(orderGoods.getOpenQuestionSign()) && orderGoods.getOpenQuestionSign() == 1){
|
|
|
+ //开通题库
|
|
|
+ questionHandleTwo(orderGoods,goods);
|
|
|
+ }else if (ObjectUtils.isNotNull(goods.getQuestionGoodsId())){
|
|
|
questionGoodsHandle(orderGoods,goods);
|
|
|
}
|
|
|
// //商品是否有活动模考
|
|
@@ -903,6 +910,58 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
iGoodsQuestionRelService.save(rel);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private void questionHandleTwo(OrderGoods orderGoods,Goods goods) {
|
|
|
+ //第三方题库商品
|
|
|
+ Goods questionGoods = iGoodsService.getById(goods.getGoodsId());
|
|
|
+ if (ObjectUtils.isNull(questionGoods) || questionGoods.getGoodsType() != 9){
|
|
|
+ //商品类型不符合
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //添加第三方关联记录
|
|
|
+ QuestionMerchant merchant = iQuestionMerchantService.getById(questionGoods.getQuestionMerchantId());
|
|
|
+ if (ObjectUtils.isNull(merchant)){
|
|
|
+ //商家不存在
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //服务有效期
|
|
|
+ OrderGoods orderGoodsTwo = setQuestionServiceTimeTwo(orderGoods, orderGoods.getSubOrderGoodsId());
|
|
|
+ iOrderGoodsService.updateById(orderGoodsTwo);
|
|
|
+
|
|
|
+ GoodsQuestionRel rel = new GoodsQuestionRel();
|
|
|
+ rel.setOrderGoodsId(orderGoodsTwo.getOrderGoodsId());
|
|
|
+ rel.setQuestionGoodsId(orderGoods.getGoodsId());
|
|
|
+ rel.setQsOrderGoodsId(orderGoods.getOrderGoodsId());
|
|
|
+ rel.setStatus(1);
|
|
|
+ rel.setQuestionDoNum(merchant.getDoNum());
|
|
|
+ rel.setCreateTime(DateUtils.getNowTime());
|
|
|
+ rel.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iGoodsQuestionRelService.save(rel);
|
|
|
+ }
|
|
|
+
|
|
|
+ private OrderGoods setQuestionServiceTimeTwo(OrderGoods add,Long subOrderGoodsId) {
|
|
|
+ Order one = getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, add.getOrderSn()));
|
|
|
+ if (Objects.isNull(one)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ UserSubscribe subscribe = iUserSubscribeService.getOne(new LambdaQueryWrapper<UserSubscribe>()
|
|
|
+ .eq(UserSubscribe::getUserId, one.getUserId())
|
|
|
+ .eq(UserSubscribe::getOrderGoodsId, subOrderGoodsId)
|
|
|
+ .eq(UserSubscribe::getSubscribeStatus, 1)
|
|
|
+ .eq(UserSubscribe::getExamStatus,0)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNull(subscribe)){
|
|
|
+ return add;
|
|
|
+ }
|
|
|
+ //考试日期
|
|
|
+ Long examTime = subscribe.getApplySiteExamTime();
|
|
|
+ //前推8天
|
|
|
+ Long dayBefore = DateUtils.getDayBefore(examTime, 8);
|
|
|
+ add.setServiceStartTime(dayBefore);
|
|
|
+ add.setServiceEndTime(examTime);
|
|
|
+ return add;
|
|
|
+ }
|
|
|
+
|
|
|
private OrderGoods setQuestionServiceTime(OrderGoods add,OrderGoods orderGoods) {
|
|
|
Order one = getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, orderGoods.getOrderSn()));
|
|
|
if (Objects.isNull(one)){
|
|
@@ -2273,6 +2332,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
|
|
|
String businessFull = iGoodsService.getGoodsBusinessName(goodsId);
|
|
|
Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysTenant sysTenant = iSysTenantService.getById(Long.valueOf(tenantId));
|
|
|
//指定班级
|
|
|
if (gradeId != null && gradeId > 0) {
|
|
|
ClassGradeVo classGradeVo = iClassGradeService.queryById(gradeId);
|
|
@@ -2291,7 +2352,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
int locakStudentNum = 0;
|
|
|
Boolean sevenFlag = false;
|
|
|
if (businessFull.contains("继续教育") && businessFull.contains("施工现场专业人员")){
|
|
|
- locakStudentNum = baseMapper.getStudeCountByCode(classGradeVo.getSevenCode());
|
|
|
+ if (ObjectUtils.isNotNull(sysTenant.getSevenClass()) && sysTenant.getSevenClass() == 1){
|
|
|
+ //七大员继教班级共享
|
|
|
+ locakStudentNum = baseMapper.getStudeCountByCodeNoTenant(classGradeVo.getSevenCode());
|
|
|
+ }else {
|
|
|
+ locakStudentNum = baseMapper.getStudeCountByCode(classGradeVo.getSevenCode());
|
|
|
+ }
|
|
|
sevenFlag = true;
|
|
|
}else {
|
|
|
LambdaQueryWrapper<ClassGradeUser> lqw = new LambdaQueryWrapper<>();
|
|
@@ -2334,7 +2400,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Boolean sevenFlag = false;
|
|
|
if (businessFull.contains("继续教育") && businessFull.contains("施工现场专业人员")
|
|
|
&& StringUtils.isNotBlank(goods.getSevenYear()) && !Arrays.asList("2021","2022").contains(goods.getSevenYear())){
|
|
|
- locakStudentNum = baseMapper.getStudeCountByCode(classGradeVo.getSevenCode());
|
|
|
+ if (ObjectUtils.isNotNull(sysTenant.getSevenClass()) && sysTenant.getSevenClass() == 1){
|
|
|
+ //七大员继教班级共享
|
|
|
+ locakStudentNum = baseMapper.getStudeCountByCodeNoTenant(classGradeVo.getSevenCode());
|
|
|
+ }else {
|
|
|
+ locakStudentNum = baseMapper.getStudeCountByCode(classGradeVo.getSevenCode());
|
|
|
+ }
|
|
|
sevenFlag = true;
|
|
|
}else {
|
|
|
//临时锁定的班级学员数量
|
|
@@ -2380,7 +2451,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//七大员继教
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER3); //上限1000
|
|
|
String sevenYear = goods.getSevenYear();
|
|
|
- if (!Arrays.asList("2021,2022").contains(sevenYear)){
|
|
|
+ if (!Arrays.asList("2021","2022").contains(sevenYear)){
|
|
|
//班级绑定学员资料推送和学时推送
|
|
|
List<ClassGradeInterface> list = iClassGradeInterfaceService.list(new LambdaQueryWrapper<ClassGradeInterface>()
|
|
|
.eq(ClassGradeInterface::getStatus, 1)
|
|
@@ -2394,8 +2465,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- String sevenCode = getSevenCode(goodsId);
|
|
|
- classGrade.setSevenCode(sevenCode);
|
|
|
+ if (ObjectUtils.isNotNull(sysTenant.getSevenClass()) && sysTenant.getSevenClass() == 1){
|
|
|
+ //七大员继教班级共享
|
|
|
+ classGrade.setSevenCode(getSevenCodeNoTenant(goodsId));
|
|
|
+ }else {
|
|
|
+ classGrade.setSevenCode(getSevenCode(goodsId));
|
|
|
+ }
|
|
|
}
|
|
|
}else {
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
@@ -2412,6 +2487,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && org.getShareClass() == 1) {
|
|
|
//生成预开班编号
|
|
|
classGrade.setOfficialName(createGradeCode(goodsId, businessVo));
|
|
|
+// classGrade.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -2427,7 +2503,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Boolean classFlag = true;
|
|
|
if (businessFull.contains("继续教育") && businessFull.contains("施工现场专业人员")
|
|
|
&& StringUtils.isNotBlank(goods.getSevenYear()) && !Arrays.asList("2021","2022").contains(goods.getSevenYear())){
|
|
|
- List<ClassGrade> gradeName = baseMapper.getClassNameByGoods(goods.getEducationTypeId(),goods.getProjectId().longValue(),goods.getBusinessId(),goods.getMajorId());
|
|
|
+ List<ClassGrade> gradeName = new ArrayList<>();
|
|
|
+ if (ObjectUtils.isNotNull(sysTenant.getSevenClass()) && sysTenant.getSevenClass() == 1){
|
|
|
+ //七大员继教班级共享
|
|
|
+ gradeName = baseMapper.getClassNameByGoodsNotTenant(goods.getEducationTypeId(),goods.getProjectId().longValue(),goods.getBusinessId(),goods.getMajorId());
|
|
|
+ }else {
|
|
|
+ gradeName = baseMapper.getClassNameByGoods(goods.getEducationTypeId(),goods.getProjectId().longValue(),goods.getBusinessId(),goods.getMajorId());
|
|
|
+ }
|
|
|
if (CollectionUtils.isNotEmpty(gradeName)){
|
|
|
ClassGrade grade = gradeName.stream().filter(x -> ObjectUtils.isNotNull(x.getClassStatus()) && x.getClassStatus() == 1).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(grade)){
|
|
@@ -2490,7 +2572,83 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
iClassGradeGoodsService.save(classGradeGoods);
|
|
|
//锁定班级
|
|
|
lockGrade(orderGoodsId, classGrade.getGradeId(), userId, goodsId, orderSn,orderGoods.getSevenYear());
|
|
|
- return true;
|
|
|
+// if ((("继续教育二级建造师".equals(businessFull)) || ("继续教育二级造价师".equals(businessFull))) && sysTenant.getShareClass() == 1) {
|
|
|
+// //二建继教班级创建,所有共享班级机构同步创建
|
|
|
+// synchronousCreation(classGrade,sysTenant,goodsId);
|
|
|
+// //通知旧系统
|
|
|
+// CreateSameClassBo classBo = new CreateSameClassBo();
|
|
|
+// if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
|
|
|
+// classBo.setClassNo(classGrade.getOfficialName());
|
|
|
+// classBo.setOpenclassState(1);
|
|
|
+// classBo.setBeginTime(DateUtils.timestampToDateFormat(classGrade.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+// classBo.setEndTime(DateUtils.timestampToDateFormat(classGrade.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+// }else {
|
|
|
+// classBo.setClassNo(classGrade.getOfficialName());
|
|
|
+// classBo.setOpenclassState(0);
|
|
|
+// }
|
|
|
+// classBo.setCategoryName(classGrade.getClassName());
|
|
|
+// classBo.setPlatformId("继续教育二级造价师".equals(businessFull)?8:5);
|
|
|
+// Major major = iMajorService.getById(goods.getMajorId());
|
|
|
+// if (ObjectUtils.isNotNull(major)){
|
|
|
+// classBo.setMajorName(major.getCategoryName());
|
|
|
+// }
|
|
|
+//
|
|
|
+// Long nowTime = DateUtils.getNowTime();
|
|
|
+// String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
|
|
|
+// classBo.setSign(sign);
|
|
|
+// classBo.setStamp(nowTime);
|
|
|
+// JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
|
|
|
+// String respone = "";
|
|
|
+// try {
|
|
|
+// respone = HttpUtils.sendPost(CREATE_EXAM_PATH, param);
|
|
|
+// if (!respone.contains("\"Status\":true")) {
|
|
|
+// log.error("旧系统创建班级错误" + respone);
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// log.error("旧系统创建班级错误" + respone);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void synchronousCreation(ClassGrade classGrade, SysTenant sysTenant,Long goodsId) {
|
|
|
+ List<SysTenant> tenantList = iSysTenantService.getListNoTenant(sysTenant.getTenantId());
|
|
|
+ if (CollectionUtils.isEmpty(tenantList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ String businessName = iGoodsService.getGoodsBusinessName(goodsId);
|
|
|
+ Major major = iMajorService.getById(goods.getMajorId());
|
|
|
+ tenantList.forEach(tenant -> {
|
|
|
+ //是否存在对应课程商品
|
|
|
+ List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(businessName,major.getCategoryName(),tenant.getTenantId());
|
|
|
+ if (CollectionUtils.isEmpty(relGoods)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //班级是否存在
|
|
|
+ ClassGrade grade = iClassGradeService.getCodeNoTenant(classGrade.getOfficialName(),tenant.getTenantId());
|
|
|
+ if (ObjectUtils.isNotNull(grade)){
|
|
|
+ //已经存在 不创建
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步班级
|
|
|
+ classGrade.setGradeId(null);
|
|
|
+ classGrade.setTenantId(tenant.getTenantId());
|
|
|
+ iClassGradeService.save(classGrade);
|
|
|
+
|
|
|
+ List<ClassGradeGoods> gradeGoods = relGoods.stream().map(item -> {
|
|
|
+ ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
|
+ classGradeGoods.setGradeId(classGrade.getGradeId());
|
|
|
+ classGradeGoods.setGoodsId(item.getGoodsId());
|
|
|
+ classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setTenantId(tenant.getTenantId());
|
|
|
+ return classGradeGoods;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iClassGradeGoodsService.saveBatch(gradeGoods);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private String getSevenCode(Long goodsId) {
|
|
@@ -2518,6 +2676,24 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return ServletUtils.getEncoded("SEV");
|
|
|
}
|
|
|
|
|
|
+ private String getSevenCodeNoTenant(Long goodsId) {
|
|
|
+ Goods g = iGoodsService.getById(goodsId);
|
|
|
+ String businessName = iGoodsService.getGoodsBusinessName(g.getGoodsId());
|
|
|
+ Major major = iMajorService.getById(g.getMajorId());
|
|
|
+ List<Goods> list = iGoodsService.getRelevanceGoodsNoTenant(businessName,major.getCategoryName(),g.getGoodsId());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ List<ClassGradeGoods> classGradeList = iClassGradeGoodsService
|
|
|
+ .getClassNoTenant(list.stream().map(Goods::getGoodsId).collect(Collectors.toList()));
|
|
|
+ if (CollectionUtils.isNotEmpty(classGradeList)){
|
|
|
+ ClassGrade classGrade = baseMapper.getSevenGradeNoTenant(classGradeList.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
|
|
|
+ if (ObjectUtils.isNotNull(classGrade)){
|
|
|
+ return classGrade.getSevenCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ServletUtils.getEncoded("SEV");
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, String> getActivityGoods(OrderAddBo bo) {
|
|
|
String key = "ORDER-" + "-" + bo.getUserId();
|