|
@@ -4,7 +4,6 @@ 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.dto.ReplacementInstrumentActivityStatDto;
|
|
|
-import com.ym.mec.biz.dal.dto.StudentInstrumentExportDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
@@ -22,19 +21,16 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
-import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@RequestMapping("replacementInstrumentActivity")
|
|
|
@Api(tags = "乐器置换-调查问卷服务")
|
|
@@ -52,10 +48,6 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
@Autowired
|
|
|
private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
|
|
|
@Autowired
|
|
|
- private QuestionnaireQuestionDao questionnaireQuestionDao;
|
|
|
- @Autowired
|
|
|
- private QuestionnaireUserResultService questionnaireUserResultService;
|
|
|
- @Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
@Autowired
|
|
|
private SysMessageService sysMessageService;
|
|
@@ -132,6 +124,40 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
return succeed(replacementInstrumentActivity);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "开启/关闭缴费")
|
|
|
+ @PostMapping("/updateOpenFlag")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/updateOpenFlag')")
|
|
|
+ public HttpResponseResult<ReplacementInstrumentActivity> updateOpenFlag(Integer Id,Integer openFlag) {
|
|
|
+ ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(Id);
|
|
|
+ if (!replacementInstrumentActivity.getPayStatus().equals(0)) {
|
|
|
+ return failed("支付中、已支付的乐器置换,不能修改");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(replacementInstrumentActivity.getInstrumentsId() == null){
|
|
|
+ return failed("修改失败:用户没有可置换商品");
|
|
|
+ }
|
|
|
+ if (openFlag == 1) {
|
|
|
+ Goods goods = goodsService.get(replacementInstrumentActivity.getInstrumentsId());
|
|
|
+ Map<Integer, String> userMap = new HashMap<>();
|
|
|
+ Map<Integer, String> userPhoneMap = new HashMap<>();
|
|
|
+ Integer userId = replacementInstrumentActivity.getUserId();
|
|
|
+ String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
+ String pushUrl = baseApiUrl + "/#/questionGoodsSale?id=";
|
|
|
+ userMap.put(userId, userId.toString());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
|
|
|
+ userMap, null, 0, "5?" + pushUrl + replacementInstrumentActivity.getId(), "STUDENT", goods.getBrand(), "");
|
|
|
+
|
|
|
+ userPhoneMap.put(userId, replacementInstrumentActivity.getMobileNo());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
|
|
|
+ userPhoneMap, null, 0, null, "STUDENT", goods.getBrand(), HttpUtil.getSortUrl(pushUrl + replacementInstrumentActivity.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ replacementInstrumentActivity.setOpenFlag(openFlag);
|
|
|
+ replacementInstrumentActivity.setUpdateTime(new Date());
|
|
|
+ replacementInstrumentActivityService.update(replacementInstrumentActivity);
|
|
|
+ return succeed(replacementInstrumentActivity);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "导出")
|
|
|
@RequestMapping("/export")
|
|
|
@PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/export')")
|