瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 4 年之前
父節點
當前提交
21a20fe76c

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

@ -53,6 +53,7 @@ public class HealthBankMapping {
        public static final String updateGoods ="/updateGoods";
        public static final String createCreditsDetail = "/createCreditsDetail";
        public static final String findCreditsLogInfo ="/findCreditsLogInfo";
        public static final String findCreditsLogInfoWithOrder ="/findCreditsLogInfoWithOrder";
        public static final String selectByActivity = "/selectByActivity";
        public static final String selectByRanking = "/selectByRanking";
        public static final String selectByActivityRanking = "/selectByActivityRanking";

+ 1 - 1
readme.MD

@ -19,7 +19,7 @@
     ag-basic 对外的接口网关
     manage-gateway 基卫后台管理系统的接口网关
     .gitignore   项目提交忽略配置文件
     
项目运行
    环境变量配置
        开发环境:  spring_profiles_active jwdev

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/methodlog/MethodLogEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -44,6 +45,11 @@ public class MethodLogEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page") int page,
			@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
			@RequestParam(value = "size") int size) throws Exception {
				if(StringUtil.isBlank(sorts)){
					sorts = "-createTime";
				}
		List<BaseMethodLogDO> baseDoctors = baseMethodLogService.search(fields, filters, sorts, page, size);
		int count = (int) baseMethodLogService.getCount(filters);
		return success(baseDoctors, count, page, size);

+ 6 - 0
svr/svr-base/src/main/resources/application.yml

@ -124,6 +124,8 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: jwtest
@ -170,6 +172,8 @@ pay:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: iottest
@ -304,6 +308,8 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: jwOracleTest

+ 13 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java

@ -1,25 +1,38 @@
package com.yihu.jw.healthyhouse.interceptor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.healthyhouse.constant.LoginInfo;
import com.yihu.jw.healthyhouse.model.user.User;
import com.yihu.jw.healthyhouse.service.user.UserService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.wlyy.HouseUserContant;
import javassist.*;
import javassist.bytecode.CodeAttribute;
import javassist.bytecode.LocalVariableAttribute;
import javassist.bytecode.MethodInfo;
import net.sf.json.JSON;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -143,7 +143,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/smartDeviceDistribution",method = RequestMethod.GET)
    @ApiOperation("智能设备发放")
    public MixEnvelop smartDeviceDistribution(@ApiParam(name="startTime",value="开始时间",defaultValue = "")
                                                  @RequestParam(value="startTime",required = false) String startTime,
                                              @RequestParam(value="startTime",required = false) String startTime,
                                              @ApiParam(name="endTime",value="结束时间",defaultValue = "")
                                                  @RequestParam(value="endTime",required = false) String endTime,
                                              @ApiParam(name="deviceType",value="设备类型",defaultValue = "")

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-iot
    name:  svr-iot-lb
  cloud:
    config:
      failFast: true

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

@ -61,7 +61,34 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查看积分记录  带排序
     *
     * @param creditsDetail 积分对象
     * @param orderType  排序类型:0默认排序;1扣分排序;2加分排序
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findCreditsLogInfoWithOrder)
    @ApiOperation(value = "查看积分记录")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> selectCreditsLogInfoWithOeder(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                                             @RequestParam(value = "creditsDetail",required = false)String creditsDetail,
                                                                             @ApiParam(name = "orderType",defaultValue = "0",value = "排序类型:0默认排序;1扣分排序;2加分排序")
                                                                             @RequestParam(value = "orderType", required = false)Integer orderType,
                                                                             @ApiParam(name = "page", value = "第几页,从1开始")
                                                                             @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                                             @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                                             @RequestParam(value = "size", required = false)Integer size){
        try{
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            return service.findByConditionWithOrder(creditsDetailDO,orderType,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**

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

@ -22,8 +22,12 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.print.DocFlavor;
import javax.transaction.Transactional;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -93,6 +97,112 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success, creditsDetailDOS,page,size,count);
    }
    /**
     *  find creditsLogInfo
     *  带排序
     * @return
     * @throws ParseException
     */
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> findByConditionWithOrder(CreditsDetailDO creditsDetailDO, Integer orderType, Integer page, Integer size) throws ParseException {
        String sql = getCreditsLogInSqlWithOrder(creditsDetailDO,page,size,"*",orderType);
        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        for (CreditsDetailDO creditsDetailDO1 : creditsDetailDOS){
            if (creditsDetailDO1.getTradeType() != null && creditsDetailDO1.getTradeType().equalsIgnoreCase("ACTIVITY_TASK")){
                TaskDO taskDO = taskDao.findOne(creditsDetailDO1.getTransactionId());
                creditsDetailDO1.setTaskDO(taskDO);
            }else if (creditsDetailDO1.getTradeType()!=null&&creditsDetailDO1.getTradeType().equals("EXCHANGE_GOODS")){
                ExchangeGoodsDO exchangeGoodsDO =exchangeGoodsDao.findOne(creditsDetailDO1.getTransactionId());
                TaskGoodsDO taskGoodsDO = taskGoodsDao.selectById(exchangeGoodsDO.getActivityGoodsId());
                exchangeGoodsDO.setTaskGoodsDO(taskGoodsDO);
                creditsDetailDO1.setExchangeGoodsDO(exchangeGoodsDO);
            }
        }
        String sqlcount = getCreditsLogInSqlWithOrder(creditsDetailDO,0,0,"count",orderType);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success, creditsDetailDOS,page,size,count);
    }
    public  String getCreditsLogInSqlWithOrder(Object object,Integer page,Integer size,String isFlag,Integer orderType){
        StringBuffer sb = new StringBuffer();
        Class c =object.getClass();
        Table table = (Table)c.getAnnotation(Table.class);
        String tableName = table.name();
        if (isFlag.equalsIgnoreCase("count")){
            sb.append("select count(1) AS total from ").append(tableName).append(" where 1=1 and status=1 ");
        }else if(isFlag.equalsIgnoreCase("*")){
            sb.append("select * from ").append(tableName).append(" where 1=1 and status=1 ");
        }
        JSONObject object1  = (JSONObject) JSONObject.toJSON(object);
        if (object1.getString("id") !=null){
            sb.append(" and id = '" + object1.getString("id")+"' ");
        }
        Field[] fArray= c.getDeclaredFields();
        for(Field f:fArray){
            //拿到字段后与实体类中的属性匹配,并得到其get方法,用来获取他的属性值
            String getMethodName ="";
            boolean isCExist =f.isAnnotationPresent(Column.class);
            if(isCExist){
                Column mc =f.getAnnotation(Column.class);
                String columeName =mc.name();  //字段对应数据库名字
                String name =f.getName();       //字段名字
                Class a= f.getType();          //字段类型
                Object value=null;              //字段值
                getMethodName="get"+name.substring(0,1).toUpperCase()+name.substring(1);//拼接属性的get方法
                try {
                    Method m =c.getMethod(getMethodName);
                    value =(Object)m.invoke(object);     //拿到属性的值
                    if(value == null || "".equals(value)){  //如果属性没值,不拼接sql
                        continue;
                    }
                    else if(value instanceof String){
                        value ="'%"+value+"%'";
                        sb.append(" and ").append(columeName +" like " ).append(value+"");
                    }else if (value instanceof Integer){
                        value = value;
                        sb.append(" and ").append(columeName +" = " ).append(value+"");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date1 = jsonObject.getDate("startTime");
        Date date2 = jsonObject.getDate("endTime");
        String startTime = null;
        String endTime = null;
        if (date1 != null){
            startTime = sdf.format(date1);
        }
        if (date2 != null) {
            endTime = sdf.format(date2);
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&& org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){
            sb.append(" and start_time >= '"+startTime+"' and end_time <='"+endTime+"'");
        } else if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&&!org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)) {
            sb.append(" and start_time >= '"+startTime+"'");
        }else if (org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)&&!org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)){
            sb.append(" and end_time <= '"+endTime+"'");
        }
        if(isFlag.equalsIgnoreCase("*")){
            if(orderType==0){
                sb.append(" ORDER BY create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
            else if(orderType==1){
                sb.append(" ORDER BY trade_direction ASC,create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
            else if(orderType==2){
                sb.append(" ORDER BY trade_direction DESC,create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
        }
        return sb.toString();
    }
    /**

+ 7 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -139,11 +139,14 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
        try {
            JSONObject json = new JSONObject(rehabilitationPlan);
            if(json.has("totalExpense")) {
                json.put("totalExpense", DataUtils.doubleToInt(json.getDouble("totalExpense")));
                json.put("totalExpense", (DataUtils.doubleToInt(json.getDouble("totalExpense")))*100);
            }
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
                if(j.has("expense")){
                    j.put("expense", (DataUtils.doubleToInt(j.getDouble("expense")))*100);
                }
                if(j.has("executeTime")) {
                    String executeTime = j.get("executeTime").toString();
                    String[] result = null;
@ -379,6 +382,9 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
                if(j.has("expense")){
                    j.put("expense", (DataUtils.doubleToInt(j.getDouble("expense")))*100);
                }
                if(j.has("executeTime")) {
                    String executeTime = j.get("executeTime").toString();
                    String[] result = null;

+ 3 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -738,11 +738,11 @@ public class RehabilitationManageService {
//        if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
//            executeDoctorList.add(one.get("create_user_name")+"");
//        }
        executeDoctorList.add(one.get("executeDoctorName")+"");
        resultMap.put("remark",one.get("remark"));
        executeDoctorList.add(one.get("executeDoctorName")+"");//
        resultMap.put("remark",one.get("remark"));//备注
        resultMap.put("executeDoctorList",executeDoctorList);//执行医生名称列表
        resultMap.put("executeDoctorCode",one.get("executeDoctor")+"");//执行医生code
        resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生code
        resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生名称
        resultMap.put("specialistDoctorCode",one.get("createDoctor")+"");//创建人(专科)医生code
        resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
        resultMap.put("title",one.get("title"));//项目标题