|
@@ -1,5 +1,6 @@
|
|
|
package com.ssj.api.controller;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -7,6 +8,10 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import com.ssj.api.domain.vo.train.*;
|
|
|
+import com.ssj.bean.sys.fx.domain.Merchant;
|
|
|
+import com.ssj.service.sys.fx.service.MerchantMealService;
|
|
|
+import com.ssj.service.sys.fx.service.MerchantService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -17,11 +22,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.ssj.api.domain.model.RoleTypeModel;
|
|
|
-import com.ssj.api.domain.vo.train.TrainExamUserSaveVo;
|
|
|
-import com.ssj.api.domain.vo.train.TrainExamVo;
|
|
|
-import com.ssj.api.domain.vo.train.TrainLoginVo;
|
|
|
-import com.ssj.api.domain.vo.train.TrainVideoFileVo;
|
|
|
-import com.ssj.api.domain.vo.train.TrainVideoVo;
|
|
|
import com.ssj.api.security.annotation.IgnoreSecurity;
|
|
|
import com.ssj.bean.sys.train.bean.ExamInfo;
|
|
|
import com.ssj.bean.sys.train.bean.TrainUser;
|
|
@@ -64,6 +64,12 @@ public class ApiTrainController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private TrainUserService trainUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MerchantService merchantService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MerchantMealService merchantMealService;
|
|
|
|
|
|
|
|
|
private static List<RoleTypeModel> defaultRoleTypeModels=new ArrayList<RoleTypeModel>();
|
|
@@ -498,6 +504,45 @@ public class ApiTrainController extends BaseController {
|
|
|
}
|
|
|
return responseEntity;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ @IgnoreSecurity
|
|
|
+ @RequestMapping(value = "/changeMerchant", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "处理塾币商户转新模式", httpMethod = "POST", notes = "账号密码登录接口")
|
|
|
+ public ResponseEntity changeMerchant(@RequestParam(name = "accessToken") String accessToken,
|
|
|
+ @RequestBody List<MerchantVo> list) {
|
|
|
+ ResponseEntity responseEntity = new ResponseEntity();
|
|
|
+ Map<String, Object> data=new HashMap<String, Object>();
|
|
|
+ try {
|
|
|
+ list.forEach(o->{
|
|
|
+ Merchant libMerchant=merchantService.getById(o.getMerchantId());
|
|
|
+ String libId = libMerchant.getLibId();
|
|
|
+ //冻结
|
|
|
+ libMerchant.setStatus(1);
|
|
|
+ //清空
|
|
|
+ libMerchant.setLibId(null);
|
|
|
+ merchantService.save(libMerchant);
|
|
|
+ //创建新用户
|
|
|
+ Merchant newMerchant = new Merchant();
|
|
|
+ newMerchant.setLibId(libId);
|
|
|
+ //优选套餐
|
|
|
+ newMerchant.setMealType(1);
|
|
|
+ newMerchant.setPosCode(libMerchant.getPosCode());
|
|
|
+ newMerchant.setParentPosCode(libMerchant.getParentPosCode());
|
|
|
+ newMerchant.setUnitName(libMerchant.getUnitName());
|
|
|
+ newMerchant.setPosType(2);
|
|
|
+ newMerchant.setType(5);
|
|
|
+ newMerchant.setLocation(libMerchant.getLocation());
|
|
|
+ merchantService.saveMerchantByNewTemp(newMerchant,o.getBeginTime(),o.getBeginTime(),libMerchant.getId());
|
|
|
+
|
|
|
+ //给新商户创建服务订单
|
|
|
+ int buyMouth = o.getMaxCount()%o.getCostCount()>0?(o.getMaxCount()/o.getCostCount())+1:o.getMaxCount()/o.getCostCount();
|
|
|
+ merchantMealService.saveMerchantMeal(newMerchant.getId(), 5, o.getCostCount(),buyMouth , 0, BigDecimal.ZERO.doubleValue(), BigDecimal.ZERO.doubleValue(), o.getBeginTime(), o.getBeginTime());
|
|
|
+ });
|
|
|
+ responseEntity.success("转换成功!");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
+ }
|
|
|
+ return responseEntity;
|
|
|
+ }
|
|
|
}
|