Browse Source

[健康银行]

wangzhinan 6 years ago
parent
commit
6b87e13d6b

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java

@ -82,6 +82,9 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name = "count")
    private Long count;//报名人数
    @Column(name = "globel_template")
    private String globelTemplate;//通用模板
/*
    @Column(name = "del")
    private Integer del;//1有效0无效*/
@ -391,6 +394,15 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    public void setLimitRegister(Integer limitRegister) {
        this.limitRegister = limitRegister;
    }
    @Column(name = "globel_template")
    public String getGlobelTemplate() {
        return globelTemplate;
    }
    public void setGlobelTemplate(String globelTemplate) {
        this.globelTemplate = globelTemplate;
    }
/*
    @Column(name = "del")
    public Integer getDel() {

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -63,5 +63,6 @@ public class HealthBankMapping {
        public static final String doctorDescreaseIntegrate = "/doctorDescreaseIntegrate";
        public static final String selectAccountByPatient="/selectAccountByPatient";
        public static final String selectByActivityRule = "/selectByActivityRule";
        public static final String patientGetInteger = "/patientGetInteger";
    }
}

+ 20 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -283,6 +283,26 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
    }
    /**
     * 居民获取积分
     *
     * @param creditsDetail
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.patientGetInteger)
    @ApiOperation(value = "居民获取积分")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> patientGetInteger(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                               @RequestParam(value = "creditsDetail",required = true)String creditsDetail){
        try {
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            return service.patientGetInteger(creditsDetailDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 4 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/AccountDao.java

@ -3,7 +3,9 @@ package com.yihu.jw.dao;/**
 */
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.ActivityRuleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -12,4 +14,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @desc health bank account dao
 **/
public interface AccountDao extends PagingAndSortingRepository<AccountDO,String>,JpaSpecificationExecutor<AccountDO> {
    @Query("select t from AccountDO t where t.patientId=?1 and t.status=1")
    AccountDO selectByPatientId(String patientId);
}

+ 3 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDao.java

@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import javax.print.DocFlavor;
import java.util.List;
/**
@ -20,4 +21,6 @@ public interface TaskDao extends PagingAndSortingRepository<TaskDO,String>,JpaSp
    @Query("select t from TaskDO t where t.transactionId = ?1 and t.type='RULE_TASK'")
    TaskDO selectByTaskRuleId(String transactionId);
}

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

@ -62,7 +62,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        }
        activityDO.setCreateTime(new Date());
        activityDO.setUpdateTime(new Date());
        activityDO.setDel(1);
      /*  activityDO.setDel(1);*/
        activityDO= activityDao.save(activityDO);
        ActivityRuleDO activityRuleDO = new ActivityRuleDO();
        activityRuleDO.setCreateTime(new Date());
@ -72,7 +72,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        activityRuleDO.setValue1(value1);
        activityRuleDO.setValue2(value2);
        activityRuleDO.setValue3(value3);
        activityRuleDO.setDel(1);
      /*  activityRuleDO.setDel(1);*/
        activityRuleDao.save(activityRuleDO);
        MixEnvelop<Boolean, Boolean> envelop = new MixEnvelop<>();
        envelop.setObj(true);

+ 42 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -1067,4 +1067,46 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    }
    /**
     * 健康问答添加积分
     *
     * @param creditsDetailDO
     * @return
     * @throws Exception
     */
    public MixEnvelop<CreditsDetailDO,CreditsDetailDO> patientGetInteger(CreditsDetailDO creditsDetailDO) throws Exception {
        MixEnvelop<CreditsDetailDO,CreditsDetailDO> envelop = new MixEnvelop<>();
        AccountDO accountDO = accountDao.selectByPatientId(creditsDetailDO.getAccountId());
        creditsDetailDO.setUpdateTime(new Date());
        creditsDetailDO.setCreateTime(new Date());
        creditsDetailDO.setStatus(1);
        creditsDetailDO.setIntegrate(creditsDetailDO.getIntegrate());
        creditsDetailDO.setSaasId("dev");
        creditsDetailDO.setTradeType("ACTIVITY_TASK");
        creditsDetailDO.setTradeDirection(1);
        creditsDetailDO.setAccountId(accountDO.getId());
        CreditsDetailDO creditsDetailDO1 = credittsLogDetailDao.save(creditsDetailDO);
        if (creditsDetailDO1 == null){
            throw new Exception("积分添加失败!");
        }
        TaskPatientDetailDO patientDetailDO = taskPatientDetailDao.selectByTaskIdAndPatientId(creditsDetailDO.getTransactionId(),creditsDetailDO.getPatientId());
        patientDetailDO.setUpdateTime(new Date());
        patientDetailDO.setTotal(patientDetailDO.getTotal()+creditsDetailDO.getIntegrate());
        patientDetailDO.setStatus(1);
        TaskPatientDetailDO taskPatientDetailDO = taskPatientDetailDao.save(patientDetailDO);
        if (taskPatientDetailDO == null){
            throw new Exception("修改活动状态和积分失败!");
        }
        accountDO.setTotal(accountDO.getTotal()+creditsDetailDO.getIntegrate());
        accountDO.setUpdateTime(new Date());
        AccountDO accountDO1 = accountDao.save(accountDO);
        if (accountDO1 == null){
            throw new Exception("修改银行账户积分失败!");
        }
        envelop.setObj(creditsDetailDO);
        return envelop;
    }
}

+ 2 - 2
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -84,8 +84,8 @@ spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.17.110.160:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
    username: linzhou
    password: linzhou
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.