lisy
2023-08-18 616f788090c83156ac5cc0d4cd38b9de344ee3b7
管理后台:完善核销功能
4个文件已修改
65 ■■■■ 已修改文件
cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/PointMercharsClient.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/webapp/static/modular/system/tGoods/tPay_info.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -474,7 +474,10 @@
    @PostMapping("/base/pointMerchars/updateDetailsUserPointMercase")
    public void updateDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise){
        upmseService.updateById(merchandise);
        upmseService.update(merchandise,new LambdaQueryWrapper<UserPointsMerchandise>()
                .eq(UserPointsMerchandise::getUserId,merchandise.getUserId())
                .eq(UserPointsMerchandise::getId,merchandise.getId()));
    }
    @PostMapping("/base/pointMerchars/queryUserPointMerchaseByCode")
@@ -524,7 +527,9 @@
        if (list.size() > 0 ){
            for (UserPointsMerchandise pointsMerchandise : list) {
                pointsMerchandise.setState(2);
                upmseService.updateById(pointsMerchandise);
                upmseService.update(pointsMerchandise,new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getUserId,pointsMerchandise.getUserId())
                        .eq(UserPointsMerchandise::getId,pointsMerchandise.getId()));
            }
        }
@@ -669,7 +674,7 @@
        if (list.size() > 0 ){
            for (UserPointsMerchandise pointsMerchandise : list) {
                Map<String, Object> map = new HashMap<>();
                map.put("id",pointsMerchandise.getId());
                map.put("id",pointsMerchandise.getId().toString());
                map.put("userId",pointsMerchandise.getUserId());
                map.put("status", pointsMerchandise.getStatus());
                mapList.add(map);
@@ -679,4 +684,28 @@
        return mapList;
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/writeOffGoodsStatus")
    public boolean writeOffGoodsStatus(@RequestBody Map<String, Object> map){
        try {
            String o = (String) map.get("goodsId");
            Integer managerId = (Integer) map.get("managerId");
            UserPointsMerchandise byId = upmseService.getOne(new LambdaQueryWrapper<UserPointsMerchandise>()
                    .eq(UserPointsMerchandise::getId,Long.parseLong(o) ));
            if (byId.getStatus() == 2){
                return false;
            }
            byId.setStatus(2);
            byId.setVerificationUserId(managerId);
            byId.setVerificationTime(new Date());
            upmseService.update(byId,new LambdaQueryWrapper<UserPointsMerchandise>()
                    .eq(UserPointsMerchandise::getUserId,byId.getUserId())
                    .eq(UserPointsMerchandise::getId,byId.getId()));
            System.out.println(byId);
            return true;
        }catch (Exception e){
            return false;
        }
    }
}
cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/PointMercharsClient.java
@@ -27,4 +27,7 @@
    @PostMapping("/base/pointMerchars/queryUserPayedGoodsList")
    List<Map<String, Object>> queryUserPayedGoodsList(@RequestBody PointMercharsPayedVo pointMercharsPayedVo);
    @PostMapping("/base/pointMerchars/writeOffGoodsStatus")
    boolean writeOffGoodsStatus(@RequestBody Map<String, Object> map);
}
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java
@@ -14,6 +14,7 @@
import com.dsh.course.feignClient.activity.PointMercharsClient;
import com.dsh.course.feignClient.activity.model.*;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
import com.dsh.guns.core.base.tips.ErrorTip;
import com.dsh.guns.core.base.tips.SuccessTip;
import com.dsh.guns.core.common.constant.factory.PageFactory;
@@ -48,7 +49,7 @@
@Controller
@RequestMapping("/tGoods")
public class TGoodsController {
public class TGoodsController extends BaseController {
@@ -434,10 +435,19 @@
     */
    @RequestMapping("/write_off")
    @ResponseBody
    public Object GoodsWriteOff(Integer id){
        System.out.println(id);
        // TODO: 2023/8/15 核销操作
    public Object GoodsWriteOff(String id){
        Integer objectType = UserExt.getUser().getObjectType();
        Map<String, Object> stringObjectHashMap = new HashMap<>();
        stringObjectHashMap.put("goodsId",id);
        stringObjectHashMap.put("managerId",objectType);
        boolean b = pointMercharsClient.writeOffGoodsStatus(stringObjectHashMap);
        System.out.println(b);
        if (b){
        return new SuccessTip<>();
        }else {
            return ERROR;
        }
    }
cloud-server-management/src/main/webapp/static/modular/system/tGoods/tPay_info.js
@@ -20,7 +20,7 @@
        {title: '联系方式', field: 'phone', visible: true, align: 'center', valign: 'middle'},
        {title: '使用状态', field: 'status', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row, index) {
                return {1: "未使用", 2: "待核销"}[value]
                return {1: "未使用", 2: "已核销"}[value]
            }
        },
    ];
@@ -46,14 +46,17 @@
 * @constructor
 */
TPayInfo.WriteOff = function (){
    if (this.check()) {
    if (TPayInfo.check()) {
        if (TPayInfo.seItem.status === 2){
            return Feng.error("重复核销!");
        }
        var ajax = new $ax(Feng.ctxPath + "/tGoods/write_off", function (data) {
            Feng.success("核销成功!");
            TPayInfo.table.refresh();
        }, function (data) {
            Feng.error("核销失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id",this.seItem.id);
        ajax.set("id",TPayInfo.seItem.id);
        ajax.start();
    }
}