Browse Source

活动编辑+删除

zdm 6 years ago
parent
commit
df5f647763

+ 8 - 32
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java

@ -82,9 +82,8 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name = "count")
    private Long count;//报名人数
/*
    @Column(name = "del")
    private Integer del;//1有效0无效*/
    @Column(name = "del_flag")
    private Integer delFlag;//1有效0无效
    @Transient
@ -118,7 +117,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    private ActivityRuleDO activityRuleDO;//活动规则
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -127,7 +125,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.saasId = saasId;
    }
    @Column(name = "organizer")
    public String getOrganizer() {
        return organizer;
    }
@ -136,7 +133,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.organizer = organizer;
    }
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
@ -145,7 +141,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.title = title;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
@ -154,7 +149,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.description = description;
    }
    @Column(name = "location")
    public String getLocation() {
        return location;
    }
@ -163,7 +157,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.location = location;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
@ -172,7 +165,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.img = img;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
@ -181,7 +173,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.status = status;
    }
    @Column(name = "is_flag")
    public Integer getIsFlag() {
        return isFlag;
    }
@ -190,7 +181,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.isFlag = isFlag;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
@ -199,7 +189,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.remark = remark;
    }
    @Column(name = "area")
    public String getArea() {
        return area;
    }
@ -243,7 +232,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.total = total;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
@ -306,8 +294,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.taskDOS = taskDOS;
    }
    @Column(name = "registration_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegistrationTime() {
        return registrationTime;
    }
@ -316,8 +302,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.registrationTime = registrationTime;
    }
    @Column(name = "activity_offline_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getActivityOfflineTime() {
        return activityOfflineTime;
    }
@ -326,8 +310,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.activityOfflineTime = activityOfflineTime;
    }
    @Column(name = "dead_line")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDeadLine() {
        return deadLine;
    }
@ -336,7 +318,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.deadLine = deadLine;
    }
    @Column(name = "crowd_type")
    public Integer getCrowdType() {
        return crowdType;
    }
@ -345,7 +326,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.crowdType = crowdType;
    }
    @Column(name = "recommended")
    public Integer getRecommended() {
        return recommended;
    }
@ -354,7 +334,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.recommended = recommended;
    }
    @Column(name = "info")
    public String getInfo() {
        return info;
    }
@ -363,7 +342,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.info = info;
    }
    @Column(name = "count")
    public Long getCount() {
        return count;
    }
@ -383,7 +361,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    }
    @Column(name="limit_register")
    public Integer getLimitRegister() {
        return limitRegister;
    }
@ -391,13 +368,12 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    public void setLimitRegister(Integer limitRegister) {
        this.limitRegister = limitRegister;
    }
/*
    @Column(name = "del")
    public Integer getDel() {
        return del;
    public Integer getDelFlag() {
        return delFlag;
    }
    public void setDel(Integer del) {
        this.del = del;
    }*/
    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }
}

+ 8 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityRuleDO.java

@ -32,8 +32,8 @@ public class ActivityRuleDO extends UuidIdentityEntityWithOperator implements Se
    @Column(name = "value4")
    private String value4;//规则4
 /*   @Column(name = "del")
    private Integer del;//1有效、0无效*/
    @Column(name = "del_flag")
    private Integer delFlag;//1有效、0无效
    @Column(name = "saas_id")
@ -89,14 +89,13 @@ public class ActivityRuleDO extends UuidIdentityEntityWithOperator implements Se
    public void setValue4(String value4) {
        this.value4 = value4;
    }
  /*  @Column(name = "del")
    public Integer getDel() {
        return del;
    @Column(name = "del_flag")
    public Integer getDelFlag() {
        return delFlag;
    }
    public void setDel(Integer del) {
        this.del = del;
    }*/
    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }
}

+ 15 - 6
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java

@ -97,13 +97,19 @@ public class ActivityController extends EnvelopRestEndpoint {
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateActivity)
    @ApiOperation(value = "下架活动")
    public MixEnvelop<Boolean, Boolean> outActivity(@ApiParam(name = "activity",value = "健康活动JSON")
                                            @RequestParam(value = "activity",required = true)String activity){
    @ApiOperation(value = "编辑活动")
    public MixEnvelop<Boolean, Boolean> outActivity(@ApiParam(name = "activity", value = "健康活动JSON")
                                                    @RequestParam(value = "activity", required = true) String activity,
                                                    @ApiParam(name = "value1", value = "活动币JSON")
                                                    @RequestParam(value = "value1", required = false) String value1,
                                                    @ApiParam(name = "value2", value = "活动时间")
                                                    @RequestParam(value = "value2", required = false) String value2,
                                                    @ApiParam(name = "value3", value = "兑奖设置")
                                                    @RequestParam(value = "value3", required = false) String value3) {
        try {
            ActivityDO activityDO = toEntity(activity,ActivityDO.class);
            return service.update(activityDO);
        }catch (Exception e){
            ActivityDO activityDO = toEntity(activity, ActivityDO.class);
            return service.update(activityDO,value1,value2,value3);
        } catch (Exception e) {
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
@ -165,4 +171,7 @@ public class ActivityController extends EnvelopRestEndpoint {
    }
}

+ 20 - 3
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -15,6 +15,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.ISqlUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -62,7 +63,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        }
        activityDO.setCreateTime(new Date());
        activityDO.setUpdateTime(new Date());
        activityDO.setDel(1);
        activityDO.setDelFlag(1);
        activityDO= activityDao.save(activityDO);
        ActivityRuleDO activityRuleDO = new ActivityRuleDO();
        activityRuleDO.setCreateTime(new Date());
@ -72,7 +73,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        activityRuleDO.setValue1(value1);
        activityRuleDO.setValue2(value2);
        activityRuleDO.setValue3(value3);
        activityRuleDO.setDel(1);
        activityRuleDO.setDelFlag(1);
        activityRuleDao.save(activityRuleDO);
        MixEnvelop<Boolean, Boolean> envelop = new MixEnvelop<>();
        envelop.setObj(true);
@ -133,8 +134,20 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @param activityDO 活动参数对象
     * @return
     */
    public MixEnvelop<Boolean, Boolean> update(ActivityDO activityDO){
    public MixEnvelop<Boolean, Boolean> update(ActivityDO activityDO, String value1, String value2, String value3) throws Exception {
        if (StringUtils.isBlank(activityDO.getId())) {
            throw new Exception("活动id不能为空!");
        }
        ActivityRuleDO activityRuleDO = activityRuleDao.selectByActivityId(activityDO.getId());
        activityRuleDO.setUpdateTime(new Date());
        activityRuleDO.setSaasId("dev");
        activityRuleDO.setValue1(value1);
        activityRuleDO.setValue2(value2);
        activityRuleDO.setValue3(value3);
        activityRuleDO.setDelFlag(1);
        activityRuleDO= activityRuleDao.save(activityRuleDO);
        activityDao.save(activityDO);
        activityDO.setActivityRuleDO(activityRuleDO);
        MixEnvelop<Boolean, Boolean> envelop = new MixEnvelop<>();
        envelop.setObj(true);
        return envelop;
@ -261,10 +274,14 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
                taskPatientDetailDO.setUpdateTime(new Date());
                taskPatientDetailDao.save(taskPatientDetailDO);
            }
            ActivityRuleDO ruleDO = activityRuleDao.selectByActivityId(ids.get(i));
            ruleDO.setDelFlag(0);
            activityRuleDao.save(ruleDO);
            ActivityDO activityDO = activityDao.findOne(ids.get(i));
            activityDO.setStatus(-1);
            activityDO.setCreateTime(new Date());
            activityDO.setUpdateTime(new Date());
            activityDO.setDelFlag(0);
            activityDao.save(activityDO);
        }
        return envelop;