记得上下班打卡 | git大法好,push需谨慎

Commit 7f2f34f1 authored by Administrator's avatar Administrator 🎨

Merge branch 'pre' into 'master'

Pre

See merge request !192
parents 70915414 c8cb55e9
......@@ -12,6 +12,7 @@ public class KylinRedisConst {
public static final String PERFORMANCES_ROADLIST = "kylin:performances:roadShowId:";
public static final String PERFORMANCES_AGENT_INFO = "kylin:agent:hash:id:";
public static final String PERFORMANCES_INVENTORY = "kylin:performances_inventory:ticket:id:";
public static final String TICKET_PAY_TXT = "kylin:payTxt:ticket:id:";
public static final String SURPLUS_GENERAL = "surplusGeneral";
public static final String SURPLUS_EXCHANGE = "surplusExchange";
public static final String TICKET = "kylin:ticket:id:";
......
package com.liquidnet.service.kylin.dto.vo.admin;
import com.liquidnet.service.kylin.dao.TicketAgentDao;
import com.liquidnet.service.kylin.dao.TicketPayTxtDao;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
@ApiModel
@Data
public class KylinPerformancePayTxtVo {
private String performancesId;
private String title;
private List<TicketPayTxtDao> tickets;
}
......@@ -6,10 +6,7 @@ import com.liquidnet.service.kylin.dao.*;
import com.liquidnet.service.kylin.dto.param.PerformanceAdminListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceMemberAuditParam;
import com.liquidnet.service.kylin.dto.param.SysDamaiParam;
import com.liquidnet.service.kylin.dto.vo.admin.KylinPerformanceAgentVo;
import com.liquidnet.service.kylin.dto.vo.admin.KylinPerformanceDamaiVo;
import com.liquidnet.service.kylin.dto.vo.admin.PerformanceRefundConfigVo;
import com.liquidnet.service.kylin.dto.vo.admin.PerformanceTransferConfigVo;
import com.liquidnet.service.kylin.dto.vo.admin.*;
import com.liquidnet.service.kylin.dto.vo.partner.KylinPerformanceMisVo;
import com.liquidnet.service.kylin.entity.KylinOrderImport;
import com.liquidnet.service.kylin.entity.KylinPerformances;
......@@ -188,6 +185,14 @@ public interface IKylinPerformancesAdminService {
*/
boolean changeTicketAgent(String performancesId,String ticketId, Integer status);
/**
* 修改 当前票种支付文案
* @param ticketId 票务id
* @param payTxt 支付文案
* @return
*/
boolean changeTicketPayTxt(String performancesId,String ticketId, String payTxt);
/**
* 修改 演出&票种&是否同步到大麦
* @return
......@@ -240,6 +245,8 @@ public interface IKylinPerformancesAdminService {
KylinPerformanceAgentVo getPerformanceAgent(String performancesId);
KylinPerformancePayTxtVo getPerformancePayTxt(String performancesId);
KylinPerformanceDamaiVo getPerformanceDamai(String performancesId);
List<PerformanceOrderStatisticalDao> getPerformanceOrderStatisticalList(String performancesId);
......
......@@ -16,10 +16,7 @@ import com.liquidnet.service.kylin.dao.PerformanceOrderStatisticalDao;
import com.liquidnet.service.kylin.dto.param.PerformanceAdminListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceMemberAuditParam;
import com.liquidnet.service.kylin.dto.param.SysDamaiParam;
import com.liquidnet.service.kylin.dto.vo.admin.KylinPerformanceAgentVo;
import com.liquidnet.service.kylin.dto.vo.admin.KylinPerformanceDamaiVo;
import com.liquidnet.service.kylin.dto.vo.admin.PerformanceRefundConfigVo;
import com.liquidnet.service.kylin.dto.vo.admin.PerformanceTransferConfigVo;
import com.liquidnet.service.kylin.dto.vo.admin.*;
import com.liquidnet.service.kylin.dto.vo.partner.KylinPerformanceMisVo;
import com.liquidnet.service.kylin.entity.KylinOrderImport;
import com.liquidnet.service.kylin.service.admin.IKylinPerformancesAdminService;
......@@ -165,6 +162,13 @@ public class KylinPerformancesController extends BaseController {
return prefix + "/agent";
}
@GetMapping(value = "/payTxt/{performancesId}")
public String payTxt(@PathVariable("performancesId") String performancesId, ModelMap mmap) {
KylinPerformancePayTxtVo result = kylinPerformancesService.getPerformancePayTxt(performancesId);
mmap.put("kylinPerformancePayTxtVo", result);
return prefix + "/payTxt";
}
//@RequiresPermissions("kylin:performances:view")
@PostMapping(value = "/agent/change")
@ResponseBody
......@@ -173,6 +177,13 @@ public class KylinPerformancesController extends BaseController {
return toAjax(result);
}
@PostMapping(value = "/payTxt/change")
@ResponseBody
public AjaxResult changeTicketPayTxt(@RequestParam("performancesId") String performancesId, @RequestParam("ticketsId") String ticketsId, @RequestParam("payTxt") String payTxt) {
boolean result = kylinPerformancesService.changeTicketPayTxt(performancesId, ticketsId, payTxt);
return toAjax(result);
}
//@RequiresPermissions("kylin:performances:view")
@PostMapping(value = "/damai/change")
@ResponseBody
......
......@@ -36,7 +36,9 @@
</li>
<li id="li-tab-5"><a data-toggle="tab" href="#tab-5" aria-expanded="false" onclick="damaiInfo()">大麦配置</a>
</li>
<li id="li-tab-8"><a data-toggle="tab" href="#tab-8" aria-expanded="false" onclick="importInfo()">订单导入</a>
<!-- <li id="li-tab-8"><a data-toggle="tab" href="#tab-8" aria-expanded="false" onclick="importInfo()">订单导入</a>-->
<!-- </li>-->
<li id="li-tab-9"><a data-toggle="tab" href="#tab-9" aria-expanded="false" onclick="payTxtInfo()">支付文案</a>
</li>
</ul>
<div class="tab-content">
......@@ -69,7 +71,7 @@
th:object="${kylinPerformanceMisVo}">
<div>
<h4>场地核进度:</h4>
<span th:if="*{fieldAuditStatus==0}" >通过</span>
<span th:if="*{fieldAuditStatus==0}">通过</span>
<span th:if="*{fieldAuditStatus==1}" style="color: red">待审核</span>
<span th:if="*{fieldAuditStatus==2}" style="color: red">拒绝</span>
</div>
......@@ -298,6 +300,16 @@
height=800px frameborder=0></iframe>
</div>
</div>
<div id="tab-9" class="tab-pane">
<div class="panel-body">
<form class="form-horizontal m" th:object="${kylinPerformanceMisVo}">
<input name="title" th:field="*{title}" class="form-control" type="text" readonly>
</form>
<iframe id="pay_txt_iframe" name="order_import_iframe" marginwidth=0 marginheight=0
width=100%
height=800px frameborder=0></iframe>
</div>
</div>
</div>
</div>
</div>
......@@ -351,7 +363,12 @@
document.getElementById("li-tab-8").style.display = "none";
}
if (auditStatus == 1 || fieldStatus == 1 || fieldStatus == 2 ||auditStatus == 2) {
var payTxt = [[${@permission.hasPermi('kylin:performances:payTxt')}]];
if (payTxt == "hidden") {
document.getElementById("li-tab-9").style.display = "none";
}
if (auditStatus == 1 || fieldStatus == 1 || fieldStatus == 2 || auditStatus == 2) {
document.getElementsByName("auditBtn")[0].style.display = "none";
}
......@@ -433,6 +450,11 @@
document.getElementById("order_import_iframe").src = "../orderImport/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
}
//支付文案
function payTxtInfo() {
document.getElementById("pay_txt_iframe").src = "../payTxt/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
}
$("#tab-nav-1").bind("click", function () {
$("#tab_iframe_1").attr("src", prefix + "/performanceStatic/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", ""));
});
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('支付文案')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-agent-edit" th:object="${kylinPerformancePayTxtVo}">
<div class="form-group">
<label class="col-sm-3 control-label is-required">performances_id:</label>
<div class="col-sm-8">
<input name="performancesId" th:field="*{performancesId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">演出名称:</label>
<div class="col-sm-8">
<input name="title" th:value="*{title}" class="form-control" type="text" readonly>
</div>
</div>
<div th:each="ticket : ${kylinPerformancePayTxtVo.tickets}">
<div class="form-group">
<label class="col-sm-3 control-label is-required">票种名称:</label>
<div class="col-sm-8">
<input name="title" th:value="${ticket.title}" class="form-control" type="text" readonly>
<input name="ticketsId" th:value="${ticket.ticketsId}" class="form-control" type="hidden" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">支付文案:</label>
<div class="col-sm-8">
<input name="payTxt" th:value="${ticket.payTxt}" class="form-control" type="text" maxlength="16">
</div>
<button type="button" class="btn btn-w-m btn-success" onclick="submitHandler(this)">
保存
</button>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var prefix = ctx + "kylin/performances";
$("#form-performances-edit").validate({
focusCleanup: true
});
function submitHandler(res) {
var param = {
"performancesId": '[[${kylinPerformancePayTxtVo.performancesId}]]'.replaceAll("\"", ""),
"ticketsId": $(res).parent().parent().find("input[name^='ticketsId']").val(),
"payTxt": $(res).parent().parent().find("input[name^='payTxt']").val()
}
$.operate.post(prefix + "/payTxt/change", param, function (res) {
location.reload();
});
}
</script>
</body>
</html>
......@@ -590,6 +590,12 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
}
}
@Override
public boolean changeTicketPayTxt(String performancesId, String ticketId, String payTxt) {
dataUtils.setTicketPayTxt(ticketId, payTxt);
return true;
}
@Override
public boolean changeSysDamai(List<SysDamaiParam> params) {
try {
......@@ -735,6 +741,25 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
return vo;
}
@Override
public KylinPerformancePayTxtVo getPerformancePayTxt(String performancesId) {
KylinPerformances performanceData = performancesMapper.selectOne(new UpdateWrapper<KylinPerformances>().eq("performances_id", performancesId));
List<TicketAgentDao> ticketData = ticketsMapper.ticketAgent(performancesId);
KylinPerformancePayTxtVo vo = new KylinPerformancePayTxtVo();
vo.setPerformancesId(performanceData.getPerformancesId());
vo.setTitle(performanceData.getTitle());
List<TicketPayTxtDao> payTxtDaoList = new ArrayList();
for (TicketAgentDao item : ticketData) {
TicketPayTxtDao payTxtDao = new TicketPayTxtDao();
payTxtDao.setTicketsId(item.getTicketsId());
payTxtDao.setTitle(item.getTitle());
payTxtDao.setPayTxt(dataUtils.getTicketPayTxt(item.getTicketsId()));
payTxtDaoList.add(payTxtDao);
}
vo.setTickets(payTxtDaoList);
return vo;
}
public KylinPerformanceDamaiVo getPerformanceDamai(String performancesId) {
KylinPerformances performanceData = performancesMapper.selectOne(new UpdateWrapper<KylinPerformances>().eq("performances_id", performancesId));
KylinPerformanceStatus performanceStatusData = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
......
......@@ -373,17 +373,17 @@ public class DataUtils {
}
// 获取 快递地址
public OrderRefundAddress getRefundAddress(){
public OrderRefundAddress getRefundAddress() {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.ORDER_REFUND_ADDRESS);
if(obj==null){
if (obj == null) {
OrderRefundAddress vo = OrderRefundAddress.getNew();
vo.setName("张三");
vo.setPhone("010 124412");
vo.setAddress("北京 北京市朝阳区广渠路3-12");
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER_REFUND_ADDRESS,vo);
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER_REFUND_ADDRESS, vo);
return vo;
}else{
return (OrderRefundAddress)obj;
} else {
return (OrderRefundAddress) obj;
}
}
......@@ -444,12 +444,12 @@ public class DataUtils {
}
//订单信息存redis
public void orderSetRedis(String orderCode){
public void orderSetRedis(String orderCode) {
KylinOrderTicketVo orderTicketVo = mongoTemplate.findOne(Query.query(Criteria.where("orderCode").is(orderCode)), KylinOrderTicketVo.class, KylinOrderTicketVo.class.getSimpleName());
String orderTicketsId = orderTicketVo.getOrderTicketsId();
List<KylinOrderTicketEntitiesVo> kylinOrderTicketEntitiesVoList = mongoTemplate.find(Query.query(Criteria.where("orderId").is(orderTicketsId)), KylinOrderTicketEntitiesVo.class, KylinOrderTicketEntitiesVo.class.getSimpleName());
orderTicketVo.setEntitiesVoList(kylinOrderTicketEntitiesVoList);
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER +orderTicketsId, orderTicketVo);
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER + orderTicketsId, orderTicketVo);
}
public void setkylinExpressModules(List<KylinExpressModuleVo> voList) {
......@@ -469,7 +469,7 @@ public class DataUtils {
if (obj != null) {
return (KylinTicketExpressModuleVo) obj;
} else {
return KylinTicketExpressModuleVo.getNew() ;
return KylinTicketExpressModuleVo.getNew();
}
}
......@@ -497,4 +497,18 @@ public class DataUtils {
return KylinTicketExpressModuleVo.getNew();
}
}
public void setTicketPayTxt(String ticketId, String payTxt) {
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.TICKET_PAY_TXT + ticketId, payTxt);
}
public String getTicketPayTxt(String ticketId) {
String rdsKey = KylinRedisConst.TICKET_PAY_TXT.concat(ticketId);
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(rdsKey);
if(obj==null){
return "";
}else{
return (String) obj;
}
}
}
......@@ -27,14 +27,11 @@ public class FilesUtils {
*/
public static File multipartFileToFile(MultipartFile file) {
try {
File toFile = null;
if (!file.equals("") && file.getSize() > 0) {
InputStream ins = null;
ins = file.getInputStream();
toFile = new File(file.getOriginalFilename());
File toFile = new File(file.getOriginalFilename());
inputStreamToFile(ins, toFile);
ins.close();
}
return toFile;
} catch (Exception e) {
log.error("multipartFileToFileError", e);
......
package com.liquidnet.service.kylin.dao;
import lombok.Data;
@Data
public class TicketPayTxtDao {
private String ticketsId;
private String title;
private String payTxt;
}
......@@ -95,10 +95,10 @@ public class PayController {
dragonPayBaseReqDto.setType(type);
dragonPayBaseReqDto.setPrice(price);
dragonPayBaseReqDto.setAuthCode(authCode);
// if(StringUtil.isNotNull(name)&&name.length()>=32){
// name = name.substring(0,32);
// }
dragonPayBaseReqDto.setName("正在现场");
if(StringUtil.isNotNull(name)&&name.length()>=32){
name = name.substring(0,32);
}
dragonPayBaseReqDto.setName(name);
// if(StringUtil.isNotNull(detail)&&detail.length()>=64){
// detail = detail.substring(0,64);
// }
......
......@@ -344,7 +344,7 @@ public class KylinOrderTicketsRefundServiceImpl {
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(2).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
chargesRatio = BigDecimal.valueOf(Long.parseLong("1"));
// return ResponseDto.failure("当前日期不支持退票");
}
}
......
......@@ -67,8 +67,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
@Autowired
private RedisUtil redisUtil;
@Autowired
private InnerService innerService;
@Autowired
private OrderUtils orderUtils;
@Autowired
private MongoTemplate mongoTemplate;
......@@ -237,7 +235,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if (isOldMember) {
} else {
if (memberType == 1) {
if (DateUtil.compareStrDay(DateUtil.getNowTime(), memberTimeStart) == 1 && DateUtil.compareStrDay(DateUtil.getNowTime(), timeStart) == -1) {
advanceMap = orderUtils.useCoupon(payOrderParam.getAdvanceCode(), "购买 " + performanceData.getTitle(), BigDecimal.ZERO, payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId());
if (advanceMap == null) {
return ResponseDto.failure("优先券不可用");
......@@ -250,7 +248,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
if (isMember || advanceMap != null) {
if ((isOldMember && memberType == 1) || advanceMap != null) {
if (DateUtil.compareStrDay(DateUtil.getNowTime(), memberTimeStart) == -1) {
orderUtils.backAdvanceCoupon(payOrderParam.getAdvanceCode(), uid);
return ResponseDto.failure(ErrorMapping.get("20011"));//未开始
......@@ -324,16 +322,24 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
//限购判断 如果实名 则身份证维度限购 如果不实名则数量限购
if (entersVoList.size() > 0) {
for (int i = 0; i < entersVoList.size(); i++) {
//todo 修改限购
dataUtils.changeBuyInfo(uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), 1);
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, entersVoList.get(i).getIdCard(), payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, 1, 1, memberType, isTrueName);
if (!res1.equals("")) {
//todo 修改限购
dataUtils.changeBuyInfo(uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), -1);
orderUtils.changeSurplus(isPay, payOrderParam.getTicketId(), payOrderParam.getNumber());
orderUtils.backAdvanceCoupon(payOrderParam.getAdvanceCode(), uid);
return ResponseDto.failure(res1);//乱七八糟异常
}
}
} else {
//todo 修改限购
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), payOrderParam.getNumber());
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, "", payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, payOrderParam.getNumber(), payOrderParam.getNumber(), memberType, isTrueName);
if (!res1.equals("")) {
//todo 修改限购
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), -payOrderParam.getNumber());
orderUtils.changeSurplus(isPay, payOrderParam.getTicketId(), payOrderParam.getNumber());
orderUtils.backAdvanceCoupon(payOrderParam.getAdvanceCode(), uid);
return ResponseDto.failure(res1);//乱七八糟异常
......@@ -561,7 +567,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketEntitiesVo.setUpdatedAt(null);
orderTicketEntitiesVo.setChangeDate(orderTicketEntities.getCreatedAt());
mongoTemplate.insert(orderTicketEntitiesVo, KylinOrderTicketEntitiesVo.class.getSimpleName());
dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
// dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
}
} else {
for (int i = 0; i < payOrderParam.getNumber(); i++) {
......@@ -595,7 +601,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketEntitiesVo.setUpdatedAt(null);
orderTicketEntitiesVo.setChangeDate(orderTicketEntities.getCreatedAt());
mongoTemplate.insert(orderTicketEntitiesVo, KylinOrderTicketEntitiesVo.class.getSimpleName());
dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
// dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
}
}
......@@ -604,11 +610,15 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
PayResultVo payResultVo;
if (orderTickets.getPriceActual().compareTo(BigDecimal.valueOf(0)) > 0) {
String name = dataUtils.getTicketPayTxt(ticketData.getTicketsId());
if (name.equals("")) {
name = "正在现场";
}
// 调用支付
LinkedMultiValueMap<String, String> httpData = ObjectUtil.cloneLinkedMultiValueMapStringAndString();
httpData.add("type", "TICKET");
httpData.add("price", orderTickets.getPriceActual().toString());
httpData.add("name", useTime + ticketData.getTitle() + "-" + performanceData.getTitle());
httpData.add("name", name);
httpData.add("detail", content);
httpData.add("orderCode", orderTickets.getOrderCode());
httpData.add("clientIp", CurrentUtil.getCliIpAddr());
......@@ -728,10 +738,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
KylinOrderTicketEntitiesVo entitiesData = orderTicketData.getEntitiesVoList().get(0);
String name = dataUtils.getTicketPayTxt(orderTicketData.getTicketId());
if (name.equals("")) {
name = "正在现场";
}
LinkedMultiValueMap<String, String> httpData = ObjectUtil.cloneLinkedMultiValueMapStringAndString();
httpData.add("type", "TICKET");
httpData.add("price", orderTicketData.getPriceActual().toString());
httpData.add("name", entitiesData.getUseStart() + "" + entitiesData.getPerformanceTitle());
httpData.add("name", name);
httpData.add("detail", entitiesData.getPerformanceTitle() + "-" + entitiesData.getTicketTitle() + "-" + entitiesData.getUseStart());
httpData.add("orderCode", orderTicketData.getOrderCode());
httpData.add("clientIp", CurrentUtil.getCliIpAddr());
......
......@@ -316,4 +316,14 @@ public class DataUtils {
}
return price;
}
public String getTicketPayTxt(String ticketId) {
String rdsKey = KylinRedisConst.TICKET_PAY_TXT.concat(ticketId);
Object obj = redisUtil.get(rdsKey);
if(obj==null){
return "";
}else{
return (String) obj;
}
}
}
......@@ -75,11 +75,11 @@ public class OrderUtils {
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCount = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount = dataUtils.getIdCardTBuyCount(idCard, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
performanceBuyCount = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = ObjectUtil.cloneInteger2Array();
array[0] = performanceBuyCount;
......@@ -97,11 +97,11 @@ public class OrderUtils {
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCount = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount = dataUtils.getIdCardTBuyCount(idCard, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
performanceBuyCount = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = ObjectUtil.cloneInteger2Array();
......
......@@ -115,6 +115,11 @@
<artifactId>liquidnet-api-feign-stone</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-third-shumei</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......
package com.liquidnet.service.platform.controller.basicServices;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.oss.model.GenericResult;
import com.aliyun.oss.model.ProcessObjectRequest;
import com.aliyun.oss.model.PutObjectRequest;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.common.third.shumei.util.ShumeiUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.FilesUtils;
import com.liquidnet.commons.lang.util.IDGenerator;
......@@ -19,6 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -29,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDateTime;
......@@ -45,6 +50,7 @@ import java.util.UUID;
* @since 2021-07-09
*/
@Api(tags = "basicServices")
@Slf4j
@RestController
@RequestMapping("basicServices/alOss")
public class AlOssController {
......@@ -61,6 +67,9 @@ public class AlOssController {
@Autowired
private PlatformOssFilesMapper platformOssFilesMapper;
@Autowired
private ShumeiUtil shumeiUtil;
@PostMapping("/upload")
@ApiOperation("阿里云上传")
@ApiImplicitParams({
......@@ -77,25 +86,35 @@ public class AlOssController {
@RequestParam(defaultValue = "0", required = false) int resize,
@RequestParam(defaultValue = "0", required = false) int isCutFrame
) {
if (file.equals("") || file.getSize() <= 0) {
return ResponseDto.failure("不能上传大小为0的文件");
}
File fileNew = FilesUtils.multipartFileToFile(file);
if (null == fileNew) {
return ResponseDto.failure("上传失败");
return ResponseDto.failure("multipartFileToFile Error");
}
// 是否上传过 有直接返回
PlatformOssFiles ossFile = this.getOldOssFile(fileNew);
UploadVo uploadVo = new UploadVo();
if (null == ossFile) {
try {
if (null == ossFile || (isCutFrame > 0 && ossFile.getVideoImg().isEmpty())) { //保证上传过的文件也能截帧
// 上传
ossFile = this.uploadOssFile(file, pathName, buckType, resize, fileNew, isCutFrame);
}
BeanUtils.copyProperties(ossFile, uploadVo);
} finally {
// 删除临时文件 因为老文件也生成了所以也要删除
FilesUtils.deleteTempFile(fileNew);
}
if (null == ossFile) {
return ResponseDto.failure("上传失败,该文件不合规,请勿上传带有联系方式、色情、涉政、广告等敏感文件");
} else {
BeanUtils.copyProperties(ossFile, uploadVo);
return ResponseDto.success(uploadVo);
}
}
/**
* 获取老的上传文件
......@@ -108,6 +127,7 @@ public class AlOssController {
List<PlatformOssFiles> platformOssFiles = platformOssFilesMapper.selectList(
Wrappers.lambdaQuery(PlatformOssFiles.class)
.eq(PlatformOssFiles::getMd5str, fileMD5)
.orderByDesc(PlatformOssFiles::getMid)
);
if (CollectionUtils.isEmpty(platformOssFiles)) {
return null;
......@@ -128,38 +148,49 @@ public class AlOssController {
*/
private PlatformOssFiles uploadOssFile(MultipartFile file, String pathName, int buckType, int resize, File fileNew, int isCutFrame) {
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
String filename = "";
String contentType = "";
int size = 0;
String filename, contentType, uploadPath = "";
PlatformOssFiles ossFileVideoImg = null;
try {
if (null == file) {
filename = fileNew.getName();
Path fileNewPath = new File(fileNew.getPath()).toPath();
try {
contentType = Files.probeContentType(fileNewPath);
} catch (Exception e) {
}
size = (int) fileNew.length();
} else {
filename = file.getResource().getFilename();
contentType = file.getContentType();
size = (int) file.getSize();
}
String uploadPath = FilesUtils.getUploadPath(pathName, filename);
uploadPath = FilesUtils.getUploadPath(pathName, filename);
String bucketName = FilesUtils.getBucketName(buckType);
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, uploadPath, fileNew);
ossClient.putObject(putObjectRequest);
if (contentType.contains("image") && !contentType.equals("image/vnd.adobe.photoshop")) {
if (!shumeiUtil.checkImage(IDGenerator.nextSnowId(), imgUrl.concat(uploadPath))) {
ossClient.deleteObject(bucketName, uploadPath);
return null;
}
}
if (resize > 0) { // 裁切
this.ossFileResize(resize, uploadPath, bucketName, ossClient);
}
PlatformOssFiles ossFileVideoImg = null;
if (isCutFrame > 0) { // 截取帧数
if (isCutFrame > 0 && contentType.contains("video")) { // 截取帧数
ossFileVideoImg = this.ossFileCutFrame(uploadPath, pathName, buckType);
}
ossClient.shutdown();
} catch (OSSException | ClientException | IOException e) {
log.error("alOssUploadEx [e:{}]", e);
return null;
} finally {
if (ossClient != null) {
ossClient.shutdown();
}
}
// 入库
PlatformOssFiles platformOssFilesDate = new PlatformOssFiles();
......
......@@ -420,7 +420,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
ticketData.setTimeEndExpress(ticketItem.getTimeEndExpress());
ticketData.setPrice(ticketItem.getPrice());
ticketData.setMemberPrice(ticketItem.getPrice());
ticketData.setMemberTimeStart(DateUtil.Formatter.yyyyMMddHHmmss.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketItem.getTimeStart()).minusMinutes(kylinPerformanceMisVo.getPayCountdownMinute())));
ticketData.setMemberTimeStart(DateUtil.Formatter.yyyyMMddHHmmss.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketItem.getTimeStart()).minusMinutes(ticketData.getAdvanceMinuteMember())));
ticketData.setTotalExchange(ticketItem.getTotalExchange());
ticketData.setTotalGeneral(ticketItem.getTotalGeneral());
ticketData.setIsTrueName(kylinPerformanceMisVo.getIsTrueName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment