修改了协议关联的数据字典错误的问题
This commit is contained in:
parent
5d6ef5bd46
commit
f7de34c4da
@ -16,6 +16,7 @@ import io.swagger.annotations.*;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -34,6 +35,29 @@ public class CouponController extends DefaultBaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改优惠券", notes = "修改优惠券接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "couponId", value = "优惠券ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@PutMapping("copy/{couponId}")
|
||||||
|
public SuccessResult copy(@PathVariable("couponId") String couponId) {
|
||||||
|
couponService.saveCopy(couponId);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除套餐包-订单", notes = "删除套餐包-订单接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@DeleteMapping("remove/{ids}")
|
||||||
|
public SuccessResult remove(@PathVariable("ids") String ids) {
|
||||||
|
couponService.remove(Arrays.asList(ids.split("\\_")));
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "新增优惠券", notes = "新增优惠券接口")
|
@ApiOperation(value = "新增优惠券", notes = "新增优惠券接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
|
@ -19,6 +19,7 @@ import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderVO;
|
|||||||
import cn.com.tenlion.operator.service.packageorder.IPackageOrderService;
|
import cn.com.tenlion.operator.service.packageorder.IPackageOrderService;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -43,6 +44,13 @@ public class PackageOrderResourceController extends DefaultBaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPackageInfoService iPackageInfoService;
|
private IPackageInfoService iPackageInfoService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "当前人所有餐包订单", notes = "当前人所有餐包订单接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("count/{userId}")
|
||||||
|
public Map<String, Integer> count(@PathVariable String userId) {
|
||||||
|
return packageOrderService.getCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "套餐包详情", notes = "套餐包详情接口")
|
@ApiOperation(value = "套餐包详情", notes = "套餐包详情接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
@ -52,7 +60,9 @@ public class PackageOrderResourceController extends DefaultBaseController {
|
|||||||
@GetMapping("getByNo/{packageNo}")
|
@GetMapping("getByNo/{packageNo}")
|
||||||
public PackageOrderDTO getByNo(@PathVariable("packageNo") String packageNo) {
|
public PackageOrderDTO getByNo(@PathVariable("packageNo") String packageNo) {
|
||||||
PackageOrderDTO orderDTO = packageOrderService.getByPackageNo(packageNo);
|
PackageOrderDTO orderDTO = packageOrderService.getByPackageNo(packageNo);
|
||||||
PackageInfoAppDTO appDTO = iPackageInfoService.getById(orderDTO.getPackageInfoId());
|
PackageInfoDTO infoDTO = iPackageInfoService.getByPackageInfoId(orderDTO.getPackageInfoId());
|
||||||
|
PackageInfoAppDTO appDTO = new PackageInfoAppDTO();
|
||||||
|
BeanUtils.copyProperties(infoDTO, appDTO);
|
||||||
orderDTO.setPackageInfoAppDTO(appDTO);
|
orderDTO.setPackageInfoAppDTO(appDTO);
|
||||||
return orderDTO;
|
return orderDTO;
|
||||||
}
|
}
|
||||||
@ -66,7 +76,9 @@ public class PackageOrderResourceController extends DefaultBaseController {
|
|||||||
@GetMapping("get/{packageOrderId}")
|
@GetMapping("get/{packageOrderId}")
|
||||||
public PackageOrderDTO get(@PathVariable("packageOrderId") String packageOrderId) {
|
public PackageOrderDTO get(@PathVariable("packageOrderId") String packageOrderId) {
|
||||||
PackageOrderDTO orderDTO = packageOrderService.get(packageOrderId);
|
PackageOrderDTO orderDTO = packageOrderService.get(packageOrderId);
|
||||||
PackageInfoAppDTO appDTO = iPackageInfoService.getById(orderDTO.getPackageInfoId());
|
PackageInfoDTO infoDTO = iPackageInfoService.getByPackageInfoId(orderDTO.getPackageInfoId());
|
||||||
|
PackageInfoAppDTO appDTO = new PackageInfoAppDTO();
|
||||||
|
BeanUtils.copyProperties(infoDTO, appDTO);
|
||||||
orderDTO.setPackageInfoAppDTO(appDTO);
|
orderDTO.setPackageInfoAppDTO(appDTO);
|
||||||
return orderDTO;
|
return orderDTO;
|
||||||
}
|
}
|
||||||
@ -119,6 +131,7 @@ public class PackageOrderResourceController extends DefaultBaseController {
|
|||||||
public List<PackageOrderDTO> list(@RequestBody IdsVO idsVO) {
|
public List<PackageOrderDTO> list(@RequestBody IdsVO idsVO) {
|
||||||
Map<String, Object> params = requestParams();
|
Map<String, Object> params = requestParams();
|
||||||
params.put("packageOrderIds", idsVO.getIds());
|
params.put("packageOrderIds", idsVO.getIds());
|
||||||
|
params.put("packagePayStatus", "1");
|
||||||
params.put("toResource", "对外提供查询info信息");
|
params.put("toResource", "对外提供查询info信息");
|
||||||
return packageOrderService.list(params);
|
return packageOrderService.list(params);
|
||||||
}
|
}
|
||||||
|
@ -34,5 +34,5 @@ public interface ICouponDao {
|
|||||||
|
|
||||||
List<CouponPO> listPO(Map<String, Object> params);
|
List<CouponPO> listPO(Map<String, Object> params);
|
||||||
|
|
||||||
|
void remove(Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
@ -200,4 +200,6 @@ public interface IPackageOrderService {
|
|||||||
Boolean updateOrder2(PackageOrderAppVO packageOrderVO);
|
Boolean updateOrder2(PackageOrderAppVO packageOrderVO);
|
||||||
|
|
||||||
void updateClose(String packageNo);
|
void updateClose(String packageNo);
|
||||||
|
|
||||||
|
Map<String, Integer> getCount(String userId);
|
||||||
}
|
}
|
@ -272,6 +272,28 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
|
|||||||
packageOrderDao.remove(params);
|
packageOrderDao.remove(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> getCount(String userId) {
|
||||||
|
Map<String, Integer> result = new HashMap<>();
|
||||||
|
result.put("ALL", 0);
|
||||||
|
result.put("MATERIAL", 0);
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("keYong", "可用的");
|
||||||
|
params.put("userId", userId);
|
||||||
|
params.put("packagePayStatus", "1");
|
||||||
|
params.put("packageType", "ALL");
|
||||||
|
List<PackageOrderDTO> list = list(params);
|
||||||
|
for(PackageOrderDTO dto : list) {
|
||||||
|
result.put("ALL", result.get("ALL") + dto.getPackageTotalSurplusCount());
|
||||||
|
}
|
||||||
|
params.put("packageType", "MATERIAL");
|
||||||
|
List<PackageOrderDTO> list2 = list(params);
|
||||||
|
for(PackageOrderDTO dto : list2) {
|
||||||
|
result.put("MATERIAL", result.get("MATERIAL") + dto.getPackageTotalSurplusCount());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PackageOrderDTO> list(Map<String, Object> params) {
|
public List<PackageOrderDTO> list(Map<String, Object> params) {
|
||||||
List<PackageOrderDTO> list = packageOrderDao.list(params);
|
List<PackageOrderDTO> list = packageOrderDao.list(params);
|
||||||
|
@ -6,9 +6,11 @@ import cn.com.tenlion.operator.enums.coupon.CouponTypeEnum;
|
|||||||
import cn.com.tenlion.operator.pojo.dtos.coupon.CouponDTO;
|
import cn.com.tenlion.operator.pojo.dtos.coupon.CouponDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.coupon.CouponSimpleDTO;
|
import cn.com.tenlion.operator.pojo.dtos.coupon.CouponSimpleDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.coupon.related.user.CouponRelatedUserDTO;
|
import cn.com.tenlion.operator.pojo.dtos.coupon.related.user.CouponRelatedUserDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.coupon.related.user.RelatedUserDTO;
|
||||||
import cn.com.tenlion.operator.pojo.pos.coupon.CouponPO;
|
import cn.com.tenlion.operator.pojo.pos.coupon.CouponPO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.coupon.CouponVO;
|
import cn.com.tenlion.operator.pojo.vos.coupon.CouponVO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.coupon.user.CouponUserVO;
|
import cn.com.tenlion.operator.pojo.vos.coupon.user.CouponUserVO;
|
||||||
|
import cn.com.tenlion.operator.pojo.vos.coupon.user.RelatedUserVO;
|
||||||
import cn.com.tenlion.operator.util.PayUtil;
|
import cn.com.tenlion.operator.util.PayUtil;
|
||||||
import cn.com.tenlion.operator.util.TenlionSMS;
|
import cn.com.tenlion.operator.util.TenlionSMS;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@ -24,6 +26,7 @@ import ink.wgink.pojo.ListPage;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.util.UUIDUtil;
|
import ink.wgink.util.UUIDUtil;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
||||||
import org.joda.time.format.DateTimeFormat;
|
import org.joda.time.format.DateTimeFormat;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -32,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -247,6 +251,19 @@ public class CouponService extends DefaultBaseService {
|
|||||||
return new SuccessResultList<>(couponDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
|
return new SuccessResultList<>(couponDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void remove(List<String> ids) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("couponIds", ids);
|
||||||
|
for(String id : ids) {
|
||||||
|
CouponDTO dto = get(id);
|
||||||
|
if (dto.getStatus().getText().equals(CouponStatusEnum.ACTIVE.getText())) {
|
||||||
|
throw new SaveException(dto.getTitle() + "</br>已激活不允许删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setUpdateInfo(params);
|
||||||
|
couponDao.remove(params);
|
||||||
|
}
|
||||||
|
|
||||||
public List<CouponSimpleDTO> listCanClaim() {
|
public List<CouponSimpleDTO> listCanClaim() {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
Map<String, Object> params = getHashMap(6);
|
Map<String, Object> params = getHashMap(6);
|
||||||
@ -289,4 +306,35 @@ public class CouponService extends DefaultBaseService {
|
|||||||
LocalDateTime endDatetime = LocalDateTime.parse(endTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
LocalDateTime endDatetime = LocalDateTime.parse(endTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||||
return now.isEqual(startDatetime) || now.isAfter(startDatetime) && (now.isBefore(endDatetime) || now.isEqual(endDatetime));
|
return now.isEqual(startDatetime) || now.isAfter(startDatetime) && (now.isBefore(endDatetime) || now.isEqual(endDatetime));
|
||||||
}
|
}
|
||||||
|
public void saveCopy(String couponId) {
|
||||||
|
CouponDTO couponDTO = get(couponId);
|
||||||
|
if (couponDTO.getReleaseQuantity() < 1) {
|
||||||
|
throw new SaveException("发布数量不合法");
|
||||||
|
}
|
||||||
|
if(couponDTO.getRelatedUsers().size() > 0) {
|
||||||
|
couponDTO.setReleaseQuantity(couponDTO.getRelatedUsers().size());
|
||||||
|
couponDTO.setType(CouponTypeEnum.QUOTA_USERS);
|
||||||
|
}else{
|
||||||
|
couponDTO.setType(CouponTypeEnum.QUOTA);
|
||||||
|
}
|
||||||
|
couponDTO.setStatus(CouponStatusEnum.UN_ACTIVE);
|
||||||
|
String couponId1 = UUIDUtil.getUUID();
|
||||||
|
Map<String, Object> params = HashMapUtil.beanToMap(couponDTO);
|
||||||
|
params.put("couponId", couponId1);
|
||||||
|
params.put("remainingQuantity", couponDTO.getReleaseQuantity());
|
||||||
|
params.put("type", couponDTO.getType().name());
|
||||||
|
setSaveInfo(params);
|
||||||
|
couponDao.save(params);
|
||||||
|
|
||||||
|
List<CouponRelatedUserDTO> couponRelatedUserDTOS = couponDTO.getRelatedUsers();
|
||||||
|
List<RelatedUserVO> couponRelatedUserVOS = new ArrayList<>();
|
||||||
|
for(CouponRelatedUserDTO dto : couponRelatedUserDTOS) {
|
||||||
|
RelatedUserVO userVO = new RelatedUserVO();
|
||||||
|
userVO.setUserId(dto.getUserId());
|
||||||
|
userVO.setUserInfoName(dto.getUserInfoName());
|
||||||
|
userVO.setUserUsername(dto.getUserUsername());
|
||||||
|
couponRelatedUserVOS.add(userVO);
|
||||||
|
}
|
||||||
|
couponRelatedUserService.saveBatch(couponId1, couponRelatedUserVOS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,21 @@
|
|||||||
coupon_id = #{couponId}
|
coupon_id = #{couponId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 删除套餐包-订单 -->
|
||||||
|
<update id="remove" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
cr_coupon
|
||||||
|
SET
|
||||||
|
gmt_modified = #{gmtModified},
|
||||||
|
modifier = #{modifier},
|
||||||
|
is_delete = 1
|
||||||
|
WHERE
|
||||||
|
coupon_id IN
|
||||||
|
<foreach collection="couponIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{couponIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateStatus" parameterType="map">
|
<update id="updateStatus" parameterType="map">
|
||||||
UPDATE
|
UPDATE
|
||||||
cr_coupon
|
cr_coupon
|
||||||
|
@ -62,6 +62,12 @@
|
|||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||||
<i class="fa fa-lg fa-edit"></i> 编辑优惠券
|
<i class="fa fa-lg fa-edit"></i> 编辑优惠券
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="copyEvent">
|
||||||
|
<i class="fa fa-lg fa-copy"></i> 复制优惠券
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||||
|
<i class="fa fa-lg fa-trash"></i> 删除
|
||||||
|
</button>
|
||||||
<!-- <button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="activiEvent">
|
<!-- <button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="activiEvent">
|
||||||
<i class="fa fa-lg fa-globe"></i> 激活优惠券
|
<i class="fa fa-lg fa-globe"></i> 激活优惠券
|
||||||
</button>-->
|
</button>-->
|
||||||
@ -324,6 +330,38 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if(layEvent === 'copyEvent') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||||
|
} else if(checkDatas.length > 1) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||||
|
} else {
|
||||||
|
top.dialog.confirm("确定复制?", function(index) {
|
||||||
|
var loadLayerIndex;
|
||||||
|
top.restAjax.put(top.restAjax.path('api/coupon/copy/{couponId}', [checkDatas[0].couponId]), {}, null, function(code, data) {
|
||||||
|
reloadTable();
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function() {
|
||||||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function() {
|
||||||
|
top.dialog.close(loadLayerIndex);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if(layEvent === 'removeEvent') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||||
|
} else {
|
||||||
|
var ids = '';
|
||||||
|
for(var i = 0, item; item = checkDatas[i++];) {
|
||||||
|
if(i > 1) {
|
||||||
|
ids += '_';
|
||||||
|
}
|
||||||
|
ids += item['couponId'];
|
||||||
|
}
|
||||||
|
removeData(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user