java110
2022-08-08 2d99bde9ae323f8e5d47244ae3b972936aca539d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.java110.community.cmd.ownerRepair;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.intf.community.IRepairPoolV1InnerServiceSMO;
import com.java110.po.owner.RepairPoolPo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
 
import java.text.ParseException;
 
@Java110Cmd(serviceCode = "ownerRepair.updateOwnerRepair")
public class UpdateOwnerRepairCmd extends Cmd {
 
    @Autowired
    private IRepairPoolV1InnerServiceSMO repairPoolV1InnerServiceSMOImpl;
 
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        Assert.hasKeyAndValue(reqJson, "repairId", "报修ID不能为空");
        Assert.hasKeyAndValue(reqJson, "repairType", "必填,请选择报修类型");
        Assert.hasKeyAndValue(reqJson, "repairName", "必填,请填写报修人名称");
        Assert.hasKeyAndValue(reqJson, "tel", "必填,请填写报修人手机号");
        Assert.hasKeyAndValue(reqJson, "repairObjType", "必填,请填写报修对象类型");
        Assert.hasKeyAndValue(reqJson, "repairObjId", "必填,请填写报修对象ID");
        Assert.hasKeyAndValue(reqJson, "repairObjName", "必填,请填写报修对象名称");
        Assert.hasKeyAndValue(reqJson, "appointmentTime", "必填,请填写预约时间");
        Assert.hasKeyAndValue(reqJson, "context", "必填,请填写报修内容");
        Assert.hasKeyAndValue(reqJson, "state", "必填,请填写报修状态");
    }
 
    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
        JSONObject businessOwnerRepair = new JSONObject();
        businessOwnerRepair.putAll(reqJson);
 
        RepairPoolPo repairPoolPo = BeanConvertUtil.covertBean(businessOwnerRepair, RepairPoolPo.class);
        int flag = repairPoolV1InnerServiceSMOImpl.updateRepairPoolNew(repairPoolPo);
        if (flag < 1) {
            throw new CmdException("删除工单");
        }
    }
}