diff --git a/.gitignore b/.gitignore index 4d43acc..b82a7cd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ *.jar *.war *.ear +/crm/src/main/webapp/Charts/exporting-server/java/highcharts-export/highcharts-export-convert/target/ +/crm/src/main/webapp/Charts/exporting-server/java/highcharts-export/highcharts-export-web/target/ \ No newline at end of file diff --git a/README.md b/README.md index c419565..0800f68 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -tigerp +fei ====== -Tiger's public repo for the CRM system. +Fy's public repo for the BaaS system. Some notes: @@ -9,7 +9,7 @@ Some notes: 1. You can create your database schema and restore database by executing following command

mysql -ucrm crmdb < src/main/db/dump.sql

-2. If you want to try 'offline' version of this CRM, you can check it out at http://localhost:8080/offline/home.html +2. If you want to try 'offline' version of the service, you can check it out at http://localhost:8080/offline/home.html

some users/password roles for the testing. diff --git a/a.txt b/a.txt deleted file mode 100644 index e18c374..0000000 --- a/a.txt +++ /dev/null @@ -1 +0,0 @@ -just for test \ No newline at end of file diff --git a/crm/ReportEngine/genReport.bat b/crm/ReportEngine/genReport.bat new file mode 100644 index 0000000..b9273ea --- /dev/null +++ b/crm/ReportEngine/genReport.bat @@ -0,0 +1,91 @@ +ECHO off + +REM org.eclipse.birt.report.engine.impl.ReportRunner Usage: +REM --mode/-m [ run | render | runrender] the default is runrender +REM for runrender mode: +REM we should add it in the end +REM --format/-f [ HTML \| PDF ] +REM --output/-o +REM --htmlType/-t < HTML \| ReportletNoCSS > +REM --locale /-l +REM --parameter/-p <"parameterName=parameterValue"> +REM --file/-F +REM --encoding/-e +REM +REM Locale: default is english +REM parameters in command line will overide parameters in parameter file +REM parameter name cant include characters such as \ ', '=', ':' +REM +REM For RUN mode: +REM we should add it in the end +REM --output/-o +REM --locale /-l +REM --parameter/-p +REM --file/-F +REM +REM Locale: default is english +REM parameters in command line will overide parameters in parameter file +REM parameter name cant include characters such as \ ', '=', ':' +REM +REM For RENDER mode: +REM we should add it in the end +REM --output/-o +REM --page/-p +REM --locale /-l +REM +REM Locale: default is english +IF not "%BIRT_HOME%" == "" GOTO runBirt +ECHO "Please set BIRT_HOME first." +GOTO end +:runBirt + + +SET java.io.tmpdir=%BIRT_HOME%\ReportEngine\tmpdir +SET org.eclipse.datatools_workspacepath=%java.io.tmpdir%\workspace_dtp + + +IF not exist %java.io.tmpdir% mkdir %java.io.tmpdir% +IF not exist %org.eclipse.datatools_workspacepath% mkdir %org.eclipse.datatools_workspacepath% + + +REM set the birt class path. +setlocal enabledelayedexpansion +set BIRTCLASSPATH= +for %%i in (%BIRT_HOME%\ReportEngine\lib\*.jar) do set BIRTCLASSPATH=%%i;!BIRTCLASSPATH! + + +REM set command +SET JAVACMD=java +set p1=%1 +set p2=%2 +set p3=%3 +set p4=%4 +set p5=%5 +set p6=%6 +set p7=%7 +set p8=%8 +set p9=%9 +shift +set p10=%9 +shift +set p11=%9 +shift +set p12=%9 +shift +set p13=%9 +shift +set p14=%9 +shift +set p15=%9 +shift +set p16=%9 +shift +set p17=%9 +shift +set p18=%9 +shift +set p19=%9 + +%JAVACMD% -cp "%BIRTCLASSPATH%" -DBIRT_HOME="%BIRT_HOME%\ReportEngine" org.eclipse.birt.report.engine.api.ReportRunner %p1% %p2% %p3% %p4% %p5% %p6% %p7% %p8% %p9% %p10% %p11% %p12% %p13% %p14% %p15% %p16% %p17% %p18% %p19% + +:end diff --git a/crm/ReportEngine/genReport.sh b/crm/ReportEngine/genReport.sh new file mode 100644 index 0000000..49530d2 --- /dev/null +++ b/crm/ReportEngine/genReport.sh @@ -0,0 +1,53 @@ +################USAGE OF REPORTRUNNER######################### +# echo "org.eclipse.birt.report.engine.impl.ReportRunner Usage:"; +# echo "--mode/-m [ run | render | runrender] the default is runrender " +# echo "for runrender mode: " +# echo "" "we should add it in the end " +# echo "" "--format/-f [ HTML | PDF ] " +# echo "" "--output/-o " +# echo "" "--htmlType/-t < HTML | ReportletNoCSS >" +# echo "" "--locale /-l" +# echo "" "--parameter/-p <"parameterName=parameterValue">" +# echo "" "--file/-F " +# echo "" "--encoding/-e " +# echo " " +# echo "Locale: default is english" +# echo "parameters in command line will overide parameters in parameter file" +# echo "parameter name cant include characters such as \ ', '=', ':'" +# echo " " +# echo "For RUN mode:" +# echo "we should add it in the end" +# echo "" "--output/-o " +# echo "" "--locale /-l" +# echo "" "--parameter/-p " +# echo "" "--file/-F " +# echo " " +# echo "Locale: default is english" +# echo "parameters in command line will overide parameters in parameter file" +# echo "parameter name cant include characters such as \ ', '=', ':'" +# echo " " +# echo "For RENDER mode:" +# echo "" "we should add it in the end" +# echo "" "--output/-o " +# echo "" "--page/-p " +# echo "" "--locale /-l" +# echo " " +# echo "Locale: default is english" +################END OF USAGE ######################### +if [ "$BIRT_HOME" = "" ]; + +then +echo " The BIRT_HOME need be set before BirtRunner can run."; +else + + +java_io_tmpdir=$BIRT_HOME/ReportEngine/tmpdir +org_eclipse_datatools_workspacepath=$java_io_tmpdir/workspace_dtp +mkdir -p $org_eclipse_datatools_workspacepath +unset BIRTCLASSPATH +for i in `ls $BIRT_HOME/ReportEngine/lib/*.jar`;do export BIRTCLASSPATH=$i:$BIRTCLASSPATH;done + +JAVACMD='java'; +$JAVACMD -Djava.awt.headless=true -cp "$BIRTCLASSPATH" -DBIRT_HOME="$BIRT_HOME/ReportEngine" -Dorg.eclipse.datatools_workspacepath="$org_eclipse_datatools_workspacepath" org.eclipse.birt.report.engine.api.ReportRunner ${1+"$@"} + +fi diff --git a/crm/ReportEngine/samples/AccountAndContact.rptdesign b/crm/ReportEngine/samples/AccountAndContact.rptdesign new file mode 100644 index 0000000..6542a0d --- /dev/null +++ b/crm/ReportEngine/samples/AccountAndContact.rptdesign @@ -0,0 +1,1473 @@ + + + Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035> + in + /templates/blank_report.gif + ltr + 72 + + + + + metadataBidiFormatStr + ILYNN + + + disabledMetadataBidiFormatStr + + + contentBidiFormatStr + ILYNN + + + disabledContentBidiFormatStr + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost/crmdb + crm + + + + + + + id + measure + cid + cid + + + name + dimension + cname + cname + + + id_3 + measure + aid + aid + + + name_4 + dimension + aname + aname + + + bdm_code + dimension + BDMCode + BDMCode + + + + + + 1 + id + integer + + + 2 + name + string + + + 3 + id_3 + integer + + + 4 + name_4 + string + + + 5 + bdm_code + string + + + + Data Source + + + 1 + id + id + integer + 4 + + + 2 + name + name + string + 12 + + + 3 + id_3 + id + integer + 4 + + + 4 + name_4 + name + string + 12 + + + 5 + bdm_code + bdm_code + string + 12 + + + + + + 2.0 + + + + + + + id + 1 + + 4 + 9 + 0 + NotNullable + + cid + + + + cid + + 9 + + + + + + + name + 2 + + 12 + 255 + 0 + NotNullable + + cname + + + + cname + + 255 + + + + + + + id + 3 + + 4 + 9 + 0 + Nullable + + aid + + + + aid + + 9 + + + + + + + name + 4 + + 12 + 255 + 0 + Nullable + + aname + + + + aname + + 255 + + + + + + + bdm_code + 5 + + 12 + 255 + 0 + Nullable + + BDMCode + + + + BDMCode + + 255 + + + + + + + +]]> + + + + + + + NewTabularHierarchy + + + + + integer + id_3 + + + + + + + NewTabularHierarchy1 + + + + + string + name_4 + + + + + + + + + + + count + dataSetRow["name_4"] + integer + + + + + Account&Contact + + + + + + + + + + + + + html + new Date()]]> + + + + + + + solid + 1px + solid + 1px + solid + 1px + solid + 1px + 7.930555555555555in + Account&Contact + + + id + cid + dataSetRow["id"] + integer + + + name + cname + dataSetRow["name"] + string + + + id_3 + aid + dataSetRow["id_3"] + integer + + + name_4 + aname + dataSetRow["name_4"] + string + + + bdm_code + BDMCode + dataSetRow["bdm_code"] + string + + + + justify + 1.5694444444444444in + + + 1.6111111111111112in + + + justify + 1.5833333333333333in + + + justify + 1.5833333333333333in + + + justify + 1.5833333333333333in + +
+ + none + none + none + none + + NewStyle + solid + medium + + + + NewStyle + solid + medium + + + + NewStyle + solid + medium + + + + NewStyle + solid + medium + + + + NewStyle + none + none + solid + medium + none + + + +
+ + + none + none + none + none + + NewStyle + solid + medium + + none + none + none + none + id + + + + NewStyle + solid + medium + + none + none + none + none + name + + + + NewStyle + solid + medium + + none + none + none + none + id_3 + + + + NewStyle + solid + medium + + none + none + none + none + name_4 + + + + NewStyle + solid + medium + + none + none + none + none + bdm_code + + + + +
+ + + solid + medium + + + solid + medium + + + solid + medium + + + solid + medium + + + solid + medium + + +
+
+ + Data Cube + + 2.6.1 + Pie Chart + Standard + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Categories + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + 0 + + enable.area.alt + false + + + + 'A','B','C','D','E' + + + 6,4,12,8,10 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + data["id/aname"] + + Text + Sum + + + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + 0 + + <Caption> + <Value></Value> + <Font> + <Size>16.0</Size> + <Bold>true</Bold> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>true</Visible> + + Below + + + 1 + true + + 10.0 + + + Text + Sum + + + + true + + + data["name/aname"] + + + + + Orthogonal_Value + + , + + Outside + false + + + Text + Sum + + + +]]> + SVG + false + 130pt + 212pt + + + id/aid + dimension["id"]["aid"] + integer + + + name/aname + dimension["name"]["aname"] + string + + + id/aid1 + measure["aid"] + integer + SUM + + + id/aname + measure["aname"] + integer + SUM + + + + +
diff --git a/crm/ReportEngine/samples/UserAndRole.rptdesign b/crm/ReportEngine/samples/UserAndRole.rptdesign new file mode 100644 index 0000000..3b50061 --- /dev/null +++ b/crm/ReportEngine/samples/UserAndRole.rptdesign @@ -0,0 +1,2604 @@ + + + Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035> + in + /templates/blank_report.gif + ltr + 72 + + + + + metadataBidiFormatStr + ILYNN + + + disabledMetadataBidiFormatStr + + + contentBidiFormatStr + ILYNN + + + disabledContentBidiFormatStr + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost/crmdb + crm + + + + + + + id + measure + uid + uid + + + name + dimension + uname + uname + + + id_3 + measure + cid + cid + + + name_4 + dimension + cname + cname + + + id_5 + measure + rid + rid + + + val + dimension + rolename + rolename + + + + + + + 1 + id + integer + + + 2 + name + string + + + 3 + id_3 + integer + + + 4 + name_4 + string + + + 5 + id_5 + integer + + + 6 + val + string + + + + Data Source + + + 1 + id + id + integer + 4 + + + 2 + name + name + string + 12 + + + 3 + id_3 + id + integer + 4 + + + 4 + name_4 + name + string + 12 + + + 5 + id_5 + id + integer + 4 + + + 6 + val + val + string + 12 + + + ""]]> + + + 2.0 + + + + + + + id + 1 + + 4 + 9 + 0 + NotNullable + + uid + + + + uid + + 9 + + + + + + + name + 2 + + 12 + 255 + 0 + NotNullable + + uname + + + + uname + + 255 + + + + + + + id + 3 + + 4 + 9 + 0 + Nullable + + cid + + + + cid + + 9 + + + + + + + name + 4 + + 12 + 255 + 0 + Nullable + + cname + + + + cname + + 255 + + + + + + + id + 5 + + 4 + 9 + 0 + Nullable + + rid + + + + rid + + 9 + + + + + + + val + 6 + + 12 + 255 + 0 + Nullable + + rolename + + + + rolename + + 255 + + + + + + + +]]> + + + + + + + NewTabularHierarchy + + + + + integer + id_3 + + + + + + + NewTabularHierarchy1 + + + + + string + name + + + + + + + NewTabularHierarchy2 + + + + + string + val + + + + + + + + + + + count + false + dataSetRow["id_5"] + integer + true + + + + + User&Role + + + + + + + + + + + + html + new Date()]]> + + + + + + + left + User&Role + + + id + uid + dataSetRow["id"] + integer + + + name + uname + dataSetRow["name"] + string + + + id_3 + cid + dataSetRow["id_3"] + integer + + + name_4 + cname + dataSetRow["name_4"] + string + + + id_5 + rid + dataSetRow["id_5"] + integer + + + val + rolename + dataSetRow["val"] + string + + + + + + + + +
+ + + 6 + 1 + + + + + 12pt + bold + #996633 + + + + + + + + + + + + + + + + + + + +
+ + + + + id + + + + + name + + + + + id_3 + + + + + name_4 + + + + + id_5 + + + + + val + + + + +
+ + 0.19444444444444445in + + + + + + + +
+
+ + User&Role + + +
+ + + + Data Cube + + 2.6.1 + Pie Chart + Standard + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true +
+ + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + + + 0.0 + 2.0 + 0.0 + 3.0 + + true + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Categories + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + 0 + + enable.area.alt + false + + + + 'A','B','C','D','E' + + + 6,4,12,8,10 + 0 + + + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 2.0 + 0.0 + 3.0 + + false + + + data["Summary Field/rid"] + + false + Text + + + + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + 0 + + <Caption> + <Value></Value> + <Font> + <Size>16.0</Size> + <Bold>true</Bold> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>true</Visible> + + Below + + + 1 + true + + 10.0 + + + Text + Sum + + + + true + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 2.0 + 0.0 + 3.0 + + false + + + data["rname/rolename"] + + + + + Orthogonal_Value + + , + + Outside + false + + + false + Text + Sum + + + +]]> + SVG + false + 130pt + 212pt + + + cid/cid + dimension["cid"]["cid"] + integer + + + uname/uname + dimension["uname"]["uname"] + string + + + rname/rolename + dimension["rname"]["rolename"] + string + + + Summary Field/rid + measure["rid"] + integer + SUM + + + + + + + Data Cube + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + + + 0.0 + 2.0 + 0.0 + 3.0 + + true + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Categories + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + A, B, C + + + 5,4,12 + 0 + + + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 2.0 + 0.0 + 3.0 + + false + + + data["Summary Field/rid"] + + false + Text + + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + + + 0.0 + 2.0 + 0.0 + 3.0 + + true + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 2.0 + 0.0 + 3.0 + + false + + + data["rname/rolename"] + + + + + Orthogonal_Value + + , + + Outside + false + + + false + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + + 0 + 255 + 255 + 255 + + + + 1 + + 255 + 0 + 0 + 0 + + + + 0.0 + 2.0 + 0.0 + 3.0 + + true + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + JPG + false + 130pt + 212pt + + + cid/cid + dimension["cid"]["cid"] + integer + + + uname/uname + dimension["uname"]["uname"] + string + + + rname/rolename + dimension["rname"]["rolename"] + string + + + Summary Field/rid + measure["rid"] + integer + SUM + + + + + + +
+ 角色分布情况 + + 16.0 + true + + Center + Center + + + + This chart contains no data. + + + Center + Center + + + + + + + + + + + + + + 角色分布情况 + + 16.0 + true + + Center + Center + + + + This chart contains no data. + + + Center + Center + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/crm/WebContent/META-INF/MANIFEST.MF b/crm/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/crm/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/crm/WebContent/WEB-INF/web.xml b/crm/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..1aa8cdb --- /dev/null +++ b/crm/WebContent/WEB-INF/web.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/crm/nb-configuration.xml b/crm/nb-configuration.xml new file mode 100644 index 0000000..6f59166 --- /dev/null +++ b/crm/nb-configuration.xml @@ -0,0 +1,26 @@ + + + + + + JDK_1.7 + + /less:/css + false + /scss:/css + false + + bootstrap-datepicker/js/locales + Tomcat + + diff --git a/crm/pom.xml b/crm/pom.xml index 7689f0a..972de33 100644 --- a/crm/pom.xml +++ b/crm/pom.xml @@ -27,12 +27,35 @@ UTF-8 + + org.eclipse.birt.runtime + org.eclipse.birt.runtime + 4.3.0 + + + org.apache.poi + org.eclipse.birt.runtime + + + + + org.apache.poi + poi + 3.9 + + org.apache.wicket wicket-core ${wicket.version} + + @@ -105,35 +128,13 @@ mysql mysql-connector-java - 5.1.6 + 5.1.26 commons-beanutils commons-beanutils 1.8.3 - - org.hibernate - hibernate-core - 4.2.1.Final - - - org.hibernate - hibernate-entitymanager - 4.2.1.Final - - - org.hibernate - hibernate-c3p0 - 4.2.1.Final - runtime - - - org.hibernate - hibernate-ehcache - 4.2.1.Final - runtime - org.apache.commons commons-lang3 @@ -156,6 +157,22 @@ mail 1.4 + + org.eclipse.persistence + eclipselink + 2.5.1 + + + javax.transaction + jta + 1.1 + provided + + + org.jumpmind.symmetric + symmetric-csv + 3.5.9 + @@ -232,6 +249,48 @@ true + + @@ -246,5 +305,11 @@ true + + http://download.eclipse.org/rt/eclipselink/maven.repo/ + eclipselink + default + Repository for library EclipseLink (JPA 2.1) + diff --git a/crm/src/main/db/dump.sql b/crm/src/main/db/dump.sql index d684112..a2ded82 100644 --- a/crm/src/main/db/dump.sql +++ b/crm/src/main/db/dump.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.6.14, for Win64 (x86_64) +-- MySQL dump 10.13 Distrib 5.5.30, for osx10.6 (i386) -- -- Host: localhost Database: crmdb -- ------------------------------------------------------ --- Server version 5.6.14-log +-- Server version 5.5.30 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -26,8 +26,7 @@ CREATE TABLE `account` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `bdm_code` varchar(255) DEFAULT NULL, - `administrativ_level` varchar(255) DEFAULT NULL, - `grade` varchar(255) DEFAULT NULL, + `administrativ_level` mediumint(9) DEFAULT NULL, `hospital_type` mediumint(9) DEFAULT NULL, `local_or_army` mediumint(9) DEFAULT NULL, `comprehensive_or_specialized` mediumint(9) DEFAULT NULL, @@ -46,13 +45,13 @@ CREATE TABLE `account` ( `num_of_surgery_room` mediumint(9) DEFAULT NULL, `num_of_using_opiates_medicine` mediumint(9) DEFAULT NULL, `num_of_using_opiates_injection` mediumint(9) DEFAULT NULL, - `date_of_establish` datetime DEFAULT NULL, + `date_of_establish` varchar(128) DEFAULT NULL, `registered_capital` mediumint(9) DEFAULT NULL, `tel` varchar(255) DEFAULT NULL, `fax` varchar(255) DEFAULT NULL, `market_classification` mediumint(9) DEFAULT NULL, - `province` varchar(255) DEFAULT NULL, - `city` varchar(255) DEFAULT NULL, + `province` int(11) DEFAULT NULL, + `city` int(11) DEFAULT NULL, `districts` varchar(255) DEFAULT NULL, `address` varchar(255) DEFAULT NULL, `owner` varchar(255) DEFAULT NULL, @@ -60,8 +59,9 @@ CREATE TABLE `account` ( `modifier` varchar(255) DEFAULT NULL, `modify_datetime` datetime DEFAULT NULL, `responsible_person` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `account_ix_01` (`bdm_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -70,7 +70,6 @@ CREATE TABLE `account` ( LOCK TABLES `account` WRITE; /*!40000 ALTER TABLE `account` DISABLE KEYS */; -INSERT INTO `account` VALUES (5,'bh',NULL,'1','1',1,1,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'李99','2013-10-14 21:23:00','李99','2013-10-14 21:23:00',NULL),(6,'account1','','C','',0,0,0,0,0,'307',0,997,490,486,700,0,0,0,0,0,0,0,'0000-00-00 00:00:00',453,'','',0,'ĵ','','',NULL,NULL,NULL,NULL,NULL,NULL),(7,'account2','','C','',0,0,0,0,0,'543',0,1,837,789,1,0,0,0,0,0,0,1996,'0000-00-00 00:00:00',2253431,'','',0,'','','',NULL,NULL,NULL,NULL,NULL,NULL),(8,'account3','','C','',0,0,0,0,0,'397',0,910,510,471,926,0,0,0,0,0,0,2002,'0000-00-00 00:00:00',633,'','',0,'','','',NULL,NULL,NULL,NULL,NULL,NULL),(9,'account4','','B','',0,0,0,0,0,'',0,0,0,0,0,0,0,0,0,0,0,0,'0000-00-00 00:00:00',0,'','',0,'̩','̩ɽ','̩',NULL,NULL,NULL,NULL,NULL,NULL),(10,'account5','','C','',0,0,0,0,0,'280',0,796,538,460,601,0,0,0,0,0,0,1951,'0000-00-00 00:00:00',532,'','һ',0,'','','',NULL,NULL,NULL,NULL,NULL,NULL),(11,'account1','123213','1','1',1,1,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'李99','2013-10-17 11:12:00','李99','2013-10-17 11:12:00',NULL),(12,'北京宣武医院','account1','1','1',1,1,1,1,1,'炫舞',321,12,200,123,213,213,123,23,12313,212,321,12,NULL,10000,'12345678912','12133213213',1,'北京','北京','宣武区','长椿街120号','李99','2013-10-17 11:13:00','李99','2013-10-17 11:13:00',NULL),(13,'北京宣武医院','account1','1','1',1,1,1,1,1,'炫舞',321,123,123,123,123,432,123,123,1233,233,31,12,'2013-10-01 00:00:00',10000,'12345678912','12133213213',1,'北京','北京','宣武区','长椿街120号','李99','2013-10-17 14:02:00','李99','2013-10-17 14:02:00',NULL),(14,'fff',NULL,'1','1',1,1,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'李99','2013-10-17 15:09:00','李99','2013-10-17 15:09:00',NULL); /*!40000 ALTER TABLE `account` ENABLE KEYS */; UNLOCK TABLES; @@ -94,7 +93,7 @@ CREATE TABLE `account_administrativ_level_pl` ( LOCK TABLES `account_administrativ_level_pl` WRITE; /*!40000 ALTER TABLE `account_administrativ_level_pl` DISABLE KEYS */; -INSERT INTO `account_administrativ_level_pl` VALUES (1,'一级'),(2,'一级甲等'),(3,'一级乙等'),(4,'一级丙等'),(5,'二级'),(6,'二级甲等'),(7,'二级乙等'),(8,'二级丙等'),(9,'三级'),(10,'三级甲等'),(11,'三级乙等'),(12,'三级丙等'),(13,'未评级未评等'); +INSERT INTO `account_administrativ_level_pl` VALUES (1,'一级'),(5,'二级'),(9,'三级'),(13,'未评级'); /*!40000 ALTER TABLE `account_administrativ_level_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -122,30 +121,6 @@ INSERT INTO `account_comprehensive_or_specialized_pl` VALUES (1,'综合医院'), /*!40000 ALTER TABLE `account_comprehensive_or_specialized_pl` ENABLE KEYS */; UNLOCK TABLES; --- --- Table structure for table `account_grade_pl` --- - -DROP TABLE IF EXISTS `account_grade_pl`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_grade_pl` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_grade_pl` --- - -LOCK TABLES `account_grade_pl` WRITE; -/*!40000 ALTER TABLE `account_grade_pl` DISABLE KEYS */; -INSERT INTO `account_grade_pl` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'); -/*!40000 ALTER TABLE `account_grade_pl` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Table structure for table `account_local_or_army_pl` -- @@ -218,150 +193,6 @@ INSERT INTO `account_medicaltype_pl` VALUES (1,'麻药目标医院'),(2,'慢痛 /*!40000 ALTER TABLE `account_medicaltype_pl` ENABLE KEYS */; UNLOCK TABLES; --- --- Table structure for table `account_pl1` --- - -DROP TABLE IF EXISTS `account_pl1`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl1` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl1` --- - -LOCK TABLES `account_pl1` WRITE; -/*!40000 ALTER TABLE `account_pl1` DISABLE KEYS */; -INSERT INTO `account_pl1` VALUES (1,'有效'),(2,'无效'),(3,'终止'),(4,'候选'); -/*!40000 ALTER TABLE `account_pl1` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `account_pl2` --- - -DROP TABLE IF EXISTS `account_pl2`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl2` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl2` --- - -LOCK TABLES `account_pl2` WRITE; -/*!40000 ALTER TABLE `account_pl2` DISABLE KEYS */; -INSERT INTO `account_pl2` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'); -/*!40000 ALTER TABLE `account_pl2` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `account_pl3` --- - -DROP TABLE IF EXISTS `account_pl3`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl3` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl3` --- - -LOCK TABLES `account_pl3` WRITE; -/*!40000 ALTER TABLE `account_pl3` DISABLE KEYS */; -INSERT INTO `account_pl3` VALUES (1,'是'),(2,'否'); -/*!40000 ALTER TABLE `account_pl3` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `account_pl4` --- - -DROP TABLE IF EXISTS `account_pl4`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl4` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl4` --- - -LOCK TABLES `account_pl4` WRITE; -/*!40000 ALTER TABLE `account_pl4` DISABLE KEYS */; -INSERT INTO `account_pl4` VALUES (1,'一级城市'),(2,'二级城市'),(3,'战略城市'); -/*!40000 ALTER TABLE `account_pl4` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `account_pl5` --- - -DROP TABLE IF EXISTS `account_pl5`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl5` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl5` --- - -LOCK TABLES `account_pl5` WRITE; -/*!40000 ALTER TABLE `account_pl5` DISABLE KEYS */; -INSERT INTO `account_pl5` VALUES (1,'北中国'),(2,'南中国'),(3,'东中国'); -/*!40000 ALTER TABLE `account_pl5` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `account_pl6` --- - -DROP TABLE IF EXISTS `account_pl6`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_pl6` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `account_pl6` --- - -LOCK TABLES `account_pl6` WRITE; -/*!40000 ALTER TABLE `account_pl6` DISABLE KEYS */; -INSERT INTO `account_pl6` VALUES (1,'麻药目标医院'),(2,'慢痛目标医院'),(3,'其他'); -/*!40000 ALTER TABLE `account_pl6` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Table structure for table `account_point_pl` -- @@ -445,9 +276,16 @@ CREATE TABLE `accountcrmuser` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `accountId` mediumint(9) NOT NULL, `crmuserId` mediumint(9) NOT NULL, + `externalId` varchar(45) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `accountId` (`accountId`,`crmuserId`) -) ENGINE=InnoDB AUTO_INCREMENT=2114 DEFAULT CHARSET=utf8; + UNIQUE KEY `accountId` (`accountId`,`crmuserId`), + KEY `account_crmuser_cons2` (`crmuserId`), + CONSTRAINT `account_crmuser_cons` FOREIGN KEY (`accountId`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `account_crmuser_cons2` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -456,7 +294,6 @@ CREATE TABLE `accountcrmuser` ( LOCK TABLES `accountcrmuser` WRITE; /*!40000 ALTER TABLE `accountcrmuser` DISABLE KEYS */; -INSERT INTO `accountcrmuser` VALUES (2014,5,20),(2109,5,99),(2016,6,20),(2017,7,20),(2018,8,20),(2019,9,20),(2020,10,20),(2021,11,20),(2110,11,99),(2022,12,20),(2111,12,99),(2023,13,20),(2112,13,99),(2024,14,20),(2113,14,99),(2025,15,20),(2026,16,20),(2027,17,20),(2028,18,20),(2029,19,20),(2030,20,20),(2031,21,20),(2032,22,20),(2033,23,20),(2034,24,20),(2035,25,20),(2036,26,20),(2037,27,20),(2038,28,20),(2039,29,20),(2040,30,20),(2041,31,20),(2042,32,20),(2043,33,20),(2044,34,20),(2045,35,20),(2046,36,20),(2047,37,20),(2048,38,20),(2049,39,20),(2050,40,20),(2051,41,20),(2052,42,20),(2053,43,20),(2054,44,20),(2055,45,20),(2056,46,20),(2057,47,20),(2058,48,20),(2059,49,20),(2060,50,20),(2061,51,20),(2062,52,20),(2063,53,20),(2064,54,20),(2065,55,20),(2066,56,20),(2067,57,20),(2068,58,20),(2069,59,20),(2070,60,20),(2071,61,20),(2072,62,20),(2073,63,20),(2074,64,20),(2075,65,20),(2076,66,20),(2077,67,20),(2078,68,20),(2079,69,20),(2080,70,20),(2081,71,20),(2082,72,20),(2083,73,20),(2084,74,20),(2085,75,20),(2086,76,20),(2087,77,20),(2088,78,20),(2089,79,20),(2090,80,20),(2091,81,20),(2092,82,20),(2093,83,20),(2094,84,20),(2095,85,20),(2096,86,20),(2097,87,20),(2098,88,20),(2099,89,20),(2100,90,20),(2101,91,20),(2102,92,20),(2103,93,20),(2104,94,20),(2105,95,20),(2106,96,20),(2107,97,20),(2108,98,20); /*!40000 ALTER TABLE `accountcrmuser` ENABLE KEYS */; UNLOCK TABLES; @@ -478,6 +315,7 @@ CREATE TABLE `activity` ( `participants` varchar(512) DEFAULT NULL, `activity_type` mediumint(9) DEFAULT NULL, `contactId` mediumint(9) DEFAULT NULL, + `coacheeId` int(32) DEFAULT NULL, `status` mediumint(9) DEFAULT NULL, `visiting_purpose` mediumint(9) DEFAULT NULL, `feature_product` mediumint(9) DEFAULT NULL, @@ -487,7 +325,7 @@ CREATE TABLE `activity` ( `modifier` varchar(255) DEFAULT NULL, `modify_datetime` datetime DEFAULT NULL, `responsible_person` varchar(255) DEFAULT NULL, - `coach` varchar(255) DEFAULT NULL, + `coach` int(32) DEFAULT NULL, `location` varchar(255) DEFAULT NULL, `total_score` mediumint(9) DEFAULT NULL, `planing` mediumint(9) DEFAULT NULL, @@ -496,7 +334,17 @@ CREATE TABLE `activity` ( `deliverable` mediumint(9) DEFAULT NULL, `objection_handing` mediumint(9) DEFAULT NULL, `summary` mediumint(9) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE + `whetherCoach` mediumint(9) DEFAULT NULL, + `coachTime` mediumint(9) DEFAULT NULL, + `accountId` mediumint(9) DEFAULT NULL, + `department` mediumint(9) DEFAULT NULL, + `whether_coach` varchar(255) DEFAULT NULL, + `activity_daypart` mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + KEY `crmuserId_activity_cons` (`crmuserId`), + KEY `contactId_activity_cons` (`contactId`), + CONSTRAINT `contactId_activity_cons` FOREIGN KEY (`contactId`) REFERENCES `contact` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `crmuserId_activity_cons` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -533,6 +381,71 @@ INSERT INTO `activity_activity_types_pl` VALUES (1,'专业化拜访'),(2,'事务 /*!40000 ALTER TABLE `activity_activity_types_pl` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Temporary table structure for view `activity_alert` +-- + +DROP TABLE IF EXISTS `activity_alert`; +/*!50001 DROP VIEW IF EXISTS `activity_alert`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `activity_alert` ( + `id` tinyint NOT NULL, + `time` tinyint NOT NULL, + `title` tinyint NOT NULL, + `name` tinyint NOT NULL, + `times` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `activity_coachtime_pl` +-- + +DROP TABLE IF EXISTS `activity_coachtime_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_coachtime_pl` ( + `id` int(11) NOT NULL, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_coachtime_pl` +-- + +LOCK TABLES `activity_coachtime_pl` WRITE; +/*!40000 ALTER TABLE `activity_coachtime_pl` DISABLE KEYS */; +INSERT INTO `activity_coachtime_pl` VALUES (1,'无'),(2,'半天'),(3,'全天'); +/*!40000 ALTER TABLE `activity_coachtime_pl` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `activity_daypart_pl` +-- + +DROP TABLE IF EXISTS `activity_daypart_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_daypart_pl` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_daypart_pl` +-- + +LOCK TABLES `activity_daypart_pl` WRITE; +/*!40000 ALTER TABLE `activity_daypart_pl` DISABLE KEYS */; +INSERT INTO `activity_daypart_pl` VALUES (1,'上午'),(2,'下午'); +/*!40000 ALTER TABLE `activity_daypart_pl` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `activity_event_type_pl` -- @@ -544,7 +457,7 @@ CREATE TABLE `activity_event_type_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -553,7 +466,7 @@ CREATE TABLE `activity_event_type_pl` ( LOCK TABLES `activity_event_type_pl` WRITE; /*!40000 ALTER TABLE `activity_event_type_pl` DISABLE KEYS */; -INSERT INTO `activity_event_type_pl` VALUES (1,'拜访'),(2,'辅导'); +INSERT INTO `activity_event_type_pl` VALUES (1,'拜访'),(2,'拜访辅导'),(3,'科室会辅导'); /*!40000 ALTER TABLE `activity_event_type_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -581,6 +494,78 @@ INSERT INTO `activity_feature_product_pl` VALUES (1,'美施康定'),(2,'奥施 /*!40000 ALTER TABLE `activity_feature_product_pl` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `activity_score3_pl` +-- + +DROP TABLE IF EXISTS `activity_score3_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_score3_pl` ( + `id` int(11) NOT NULL, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_score3_pl` +-- + +LOCK TABLES `activity_score3_pl` WRITE; +/*!40000 ALTER TABLE `activity_score3_pl` DISABLE KEYS */; +INSERT INTO `activity_score3_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'); +/*!40000 ALTER TABLE `activity_score3_pl` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `activity_score4_pl` +-- + +DROP TABLE IF EXISTS `activity_score4_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_score4_pl` ( + `id` int(11) NOT NULL, + `val` varchar(25) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_score4_pl` +-- + +LOCK TABLES `activity_score4_pl` WRITE; +/*!40000 ALTER TABLE `activity_score4_pl` DISABLE KEYS */; +INSERT INTO `activity_score4_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'),(16,'16'),(17,'17'),(18,'18'),(19,'19'),(20,'20'),(21,'21'),(22,'22'),(23,'23'),(24,'24'),(25,'25'); +/*!40000 ALTER TABLE `activity_score4_pl` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `activity_score5_pl` +-- + +DROP TABLE IF EXISTS `activity_score5_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_score5_pl` ( + `id` int(11) NOT NULL, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_score5_pl` +-- + +LOCK TABLES `activity_score5_pl` WRITE; +/*!40000 ALTER TABLE `activity_score5_pl` DISABLE KEYS */; +INSERT INTO `activity_score5_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'),(16,'16'),(17,'17'),(18,'18'),(19,'19'),(20,'20'),(21,'21'),(22,'22'),(23,'23'),(24,'24'),(25,'25'),(26,'26'),(27,'27'),(28,'28'),(29,'29'),(30,'30'),(31,'31'),(32,'32'),(33,'33'),(34,'34'),(35,'35'),(36,'36'),(37,'37'),(38,'38'),(39,'39'),(40,'40'),(41,'41'),(42,'42'),(43,'43'),(44,'44'),(45,'45'),(46,'46'),(47,'47'),(48,'48'),(49,'49'),(50,'50'); +/*!40000 ALTER TABLE `activity_score5_pl` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `activity_status` -- @@ -625,7 +610,7 @@ CREATE TABLE `activity_status_pl` ( LOCK TABLES `activity_status_pl` WRITE; /*!40000 ALTER TABLE `activity_status_pl` DISABLE KEYS */; -INSERT INTO `activity_status_pl` VALUES (1,'计划'),(2,'完成'),(3,'取消'); +INSERT INTO `activity_status_pl` VALUES (1,'计划'),(2,'完成'),(3,'未执行'); /*!40000 ALTER TABLE `activity_status_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -664,6 +649,7 @@ CREATE TABLE `activity_visiting_purpose_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, `activity_type` mediumint(9) DEFAULT NULL, + `parentId` mediumint(9) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -674,10 +660,34 @@ CREATE TABLE `activity_visiting_purpose_pl` ( LOCK TABLES `activity_visiting_purpose_pl` WRITE; /*!40000 ALTER TABLE `activity_visiting_purpose_pl` DISABLE KEYS */; -INSERT INTO `activity_visiting_purpose_pl` VALUES (1,'传递产品知识',1),(2,'处方观念沟通',1),(3,'病例沟通',1),(4,'会议安排',2),(5,'会议跟进',2),(6,'交接工作',2),(7,'了解竞争',2); +INSERT INTO `activity_visiting_purpose_pl` VALUES (1,'传递产品知识',1,1),(2,'处方观念沟通',1,1),(3,'病例沟通',1,1),(4,'会议安排',2,2),(5,'会议跟进',2,2),(6,'交接工作',2,2),(7,'了解竞争',2,2); /*!40000 ALTER TABLE `activity_visiting_purpose_pl` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `activity_whethercoach_pl` +-- + +DROP TABLE IF EXISTS `activity_whethercoach_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_whethercoach_pl` ( + `id` mediumint(9) NOT NULL, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `activity_whethercoach_pl` +-- + +LOCK TABLES `activity_whethercoach_pl` WRITE; +/*!40000 ALTER TABLE `activity_whethercoach_pl` DISABLE KEYS */; +INSERT INTO `activity_whethercoach_pl` VALUES (1,'协访半天'),(2,'协访一天'); +/*!40000 ALTER TABLE `activity_whethercoach_pl` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `activitycrmuser` -- @@ -690,8 +700,11 @@ CREATE TABLE `activitycrmuser` ( `activityId` mediumint(9) NOT NULL, `crmuserId` mediumint(9) NOT NULL, PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `activityId` (`activityId`,`crmuserId`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; + UNIQUE KEY `activityId` (`activityId`,`crmuserId`), + KEY `crm_activity_cons` (`crmuserId`), + CONSTRAINT `crm_activity_cons` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `crm_activity_cons2` FOREIGN KEY (`activityId`) REFERENCES `activity` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -700,88 +713,170 @@ CREATE TABLE `activitycrmuser` ( LOCK TABLES `activitycrmuser` WRITE; /*!40000 ALTER TABLE `activitycrmuser` DISABLE KEYS */; -INSERT INTO `activitycrmuser` VALUES (18,3,20),(19,3,21),(20,4,21),(21,5,99),(22,6,99),(23,7,99),(24,8,99),(25,9,99),(26,10,20),(27,11,20),(28,12,20),(29,13,99); /*!40000 ALTER TABLE `activitycrmuser` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `appinfo` +-- Table structure for table `alert` -- -DROP TABLE IF EXISTS `appinfo`; +DROP TABLE IF EXISTS `alert`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `appinfo` ( +CREATE TABLE `alert` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; + `name` varchar(255) NOT NULL, + `publishDate` bigint(20) DEFAULT NULL, + `expired` bigint(20) DEFAULT NULL, + `priority` mediumint(9) DEFAULT NULL, + `towhom` mediumint(9) DEFAULT NULL, + `description` longtext, + `owner` varchar(255) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `appinfo` +-- Dumping data for table `alert` -- -LOCK TABLES `appinfo` WRITE; -/*!40000 ALTER TABLE `appinfo` DISABLE KEYS */; -INSERT INTO `appinfo` VALUES (1,'爱奇艺'),(2,'影视圈'),(3,'多米音乐'),(4,'百度地图'),(5,'新浪微博'),(6,'三星学习'),(7,'印象笔记'),(8,'愤怒的小鸟'),(9,'疯狂飙车'),(10,'股票专家'),(11,'名片全能王'),(12,'携程旅游'); -/*!40000 ALTER TABLE `appinfo` ENABLE KEYS */; +LOCK TABLES `alert` WRITE; +/*!40000 ALTER TABLE `alert` DISABLE KEYS */; +/*!40000 ALTER TABLE `alert` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `boolean_pl` +-- Table structure for table `alert_priority_pl` -- -DROP TABLE IF EXISTS `boolean_pl`; +DROP TABLE IF EXISTS `alert_priority_pl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `boolean_pl` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, +CREATE TABLE `alert_priority_pl` ( + `id` mediumint(9) NOT NULL, `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `boolean_pl` +-- Dumping data for table `alert_priority_pl` -- -LOCK TABLES `boolean_pl` WRITE; -/*!40000 ALTER TABLE `boolean_pl` DISABLE KEYS */; -INSERT INTO `boolean_pl` VALUES (1,'是'),(2,'否'); -/*!40000 ALTER TABLE `boolean_pl` ENABLE KEYS */; +LOCK TABLES `alert_priority_pl` WRITE; +/*!40000 ALTER TABLE `alert_priority_pl` DISABLE KEYS */; +INSERT INTO `alert_priority_pl` VALUES (1,'高级'),(2,'中级'),(3,'低级'); +/*!40000 ALTER TABLE `alert_priority_pl` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `city` +-- Table structure for table `alert_publicobject_pl` -- -DROP TABLE IF EXISTS `city`; +DROP TABLE IF EXISTS `alert_publicobject_pl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `city` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `provinceId` varchar(255) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +CREATE TABLE `alert_publicobject_pl` ( + `id` mediumint(9) NOT NULL, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `city` +-- Dumping data for table `alert_publicobject_pl` -- -LOCK TABLES `city` WRITE; -/*!40000 ALTER TABLE `city` DISABLE KEYS */; -INSERT INTO `city` VALUES (1,'牡丹江','1'),(2,'济宁','2'),(3,'日照','2'),(4,'泰安','2'),(5,'青岛','2'); -/*!40000 ALTER TABLE `city` ENABLE KEYS */; +LOCK TABLES `alert_publicobject_pl` WRITE; +/*!40000 ALTER TABLE `alert_publicobject_pl` DISABLE KEYS */; +INSERT INTO `alert_publicobject_pl` VALUES (1,'管理员'),(2,'主管'),(3,'代表'); +/*!40000 ALTER TABLE `alert_publicobject_pl` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `com_visiting_purpose_pl` +-- Table structure for table `appinfo` -- -DROP TABLE IF EXISTS `com_visiting_purpose_pl`; +DROP TABLE IF EXISTS `appinfo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `appinfo` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `appinfo` +-- + +LOCK TABLES `appinfo` WRITE; +/*!40000 ALTER TABLE `appinfo` DISABLE KEYS */; +INSERT INTO `appinfo` VALUES (1,'爱奇艺'),(2,'影视圈'),(3,'多米音乐'),(4,'百度地图'),(5,'新浪微博'),(6,'三星学习'),(7,'印象笔记'),(8,'愤怒的小鸟'),(9,'疯狂飙车'),(10,'股票专家'),(11,'名片全能王'),(12,'携程旅游'); +/*!40000 ALTER TABLE `appinfo` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `boolean_pl` +-- + +DROP TABLE IF EXISTS `boolean_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `boolean_pl` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `boolean_pl` +-- + +LOCK TABLES `boolean_pl` WRITE; +/*!40000 ALTER TABLE `boolean_pl` DISABLE KEYS */; +INSERT INTO `boolean_pl` VALUES (1,'是'),(2,'否'); +/*!40000 ALTER TABLE `boolean_pl` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `city` +-- + +DROP TABLE IF EXISTS `city`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `city` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `city_parentid_cons` (`parentId`), + CONSTRAINT `city_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=344 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `city` +-- + +LOCK TABLES `city` WRITE; +/*!40000 ALTER TABLE `city` DISABLE KEYS */; +INSERT INTO `city` VALUES (1,'北京','110100',1),(2,'石家庄','130100',3),(3,'唐山','130200',3),(4,'秦皇岛','130300',3),(5,'邯郸','130400',3),(6,'邢台','130500',3),(7,'保定','130600',3),(8,'张家口','130700',3),(9,'承德','130800',3),(10,'沧州','130900',3),(11,'廊坊','131000',3),(12,'衡水','131100',3),(13,'太原','140100',4),(14,'大同','140200',4),(15,'阳泉','140300',4),(16,'长治','140400',4),(17,'晋城','140500',4),(18,'朔州','140600',4),(19,'晋中','140700',4),(20,'运城','140800',4),(21,'忻州','140900',4),(22,'临汾','141000',4),(23,'吕梁','141100',4),(24,'呼和浩特','150100',5),(25,'包头','150200',5),(26,'乌海','150300',5),(27,'赤峰','150400',5),(28,'通辽','150500',5),(29,'鄂尔多斯','150600',5),(30,'呼伦贝尔','150700',5),(31,'巴彦淖尔','150800',5),(32,'乌兰察布','150900',5),(33,'兴安盟','152200',5),(34,'锡林郭勒盟','152500',5),(35,'阿拉善盟','152900',5),(36,'沈阳','210100',6),(37,'大连','210200',6),(38,'鞍山','210300',6),(39,'抚顺','210400',6),(40,'本溪','210500',6),(41,'丹东','210600',6),(42,'锦州','210700',6),(43,'营口','210800',6),(44,'阜新','210900',6),(45,'辽阳','211000',6),(46,'盘锦','211100',6),(47,'铁岭','211200',6),(48,'朝阳','211300',6),(49,'葫芦岛','211400',6),(50,'长春','220100',7),(51,'吉林','220200',7),(52,'四平','220300',7),(53,'辽源','220400',7),(54,'通化','220500',7),(55,'白山','220600',7),(56,'松原','220700',7),(57,'白城','220800',7),(58,'延边朝鲜族自治州','222400',7),(59,'哈尔滨','230100',8),(60,'齐齐哈尔','230200',8),(61,'鸡西','230300',8),(62,'鹤岗','230400',8),(63,'双鸭山','230500',8),(64,'大庆','230600',8),(65,'伊春','230700',8),(66,'佳木斯','230800',8),(67,'七台河','230900',8),(68,'牡丹江','231000',8),(69,'黑河','231100',8),(70,'绥化','231200',8),(71,'大兴安岭地区','232700',8),(72,'上海','310100',9),(73,'县','310200',9),(74,'南京','320100',10),(75,'无锡','320200',10),(76,'徐州','320300',10),(77,'常州','320400',10),(78,'苏州','320500',10),(79,'南通','320600',10),(80,'连云港','320700',10),(81,'淮安','320800',10),(82,'盐城','320900',10),(83,'扬州','321000',10),(84,'镇江','321100',10),(85,'泰州','321200',10),(86,'宿迁','321300',10),(87,'杭州','330100',11),(88,'宁波','330200',11),(89,'温州','330300',11),(90,'嘉兴','330400',11),(91,'湖州','330500',11),(92,'绍兴','330600',11),(93,'金华','330700',11),(94,'衢州','330800',11),(95,'舟山','330900',11),(96,'台州','331000',11),(97,'丽水','331100',11),(98,'合肥','340100',12),(99,'芜湖','340200',12),(100,'蚌埠','340300',12),(101,'淮南','340400',12),(102,'马鞍山','340500',12),(103,'淮北','340600',12),(104,'铜陵','340700',12),(105,'安庆','340800',12),(106,'黄山','341000',12),(107,'滁州','341100',12),(108,'阜阳','341200',12),(109,'宿州','341300',12),(110,'巢湖','341400',12),(111,'六安','341500',12),(112,'亳州','341600',12),(113,'池州','341700',12),(114,'宣城','341800',12),(115,'福州','350100',13),(116,'厦门','350200',13),(117,'莆田','350300',13),(118,'三明','350400',13),(119,'泉州','350500',13),(120,'漳州','350600',13),(121,'南平','350700',13),(122,'龙岩','350800',13),(123,'宁德','350900',13),(124,'南昌','360100',14),(125,'景德镇','360200',14),(126,'萍乡','360300',14),(127,'九江','360400',14),(128,'新余','360500',14),(129,'鹰潭','360600',14),(130,'赣州','360700',14),(131,'吉安','360800',14),(132,'宜春','360900',14),(133,'抚州','361000',14),(134,'上饶','361100',14),(135,'济南','370100',15),(136,'青岛','370200',15),(137,'淄博','370300',15),(138,'枣庄','370400',15),(139,'东营','370500',15),(140,'烟台','370600',15),(141,'潍坊','370700',15),(142,'济宁','370800',15),(143,'泰安','370900',15),(144,'威海','371000',15),(145,'日照','371100',15),(146,'莱芜','371200',15),(147,'临沂','371300',15),(148,'德州','371400',15),(149,'聊城','371500',15),(150,'滨州','371600',15),(151,'荷泽','371700',15),(152,'郑州','410100',16),(153,'开封','410200',16),(154,'洛阳','410300',16),(155,'平顶山','410400',16),(156,'安阳','410500',16),(157,'鹤壁','410600',16),(158,'新乡','410700',16),(159,'焦作','410800',16),(160,'濮阳','410900',16),(161,'许昌','411000',16),(162,'漯河','411100',16),(163,'三门峡','411200',16),(164,'南阳','411300',16),(165,'商丘','411400',16),(166,'信阳','411500',16),(167,'周口','411600',16),(168,'驻马店','411700',16),(169,'武汉','420100',17),(170,'黄石','420200',17),(171,'十堰','420300',17),(172,'宜昌','420500',17),(173,'襄樊','420600',17),(174,'鄂州','420700',17),(175,'荆门','420800',17),(176,'孝感','420900',17),(177,'荆州','421000',17),(178,'黄冈','421100',17),(179,'咸宁','421200',17),(180,'随州','421300',17),(181,'恩施土家族苗族自治州','422800',17),(182,'省直辖行政单位','429000',17),(183,'长沙','430100',18),(184,'株洲','430200',18),(185,'湘潭','430300',18),(186,'衡阳','430400',18),(187,'邵阳','430500',18),(188,'岳阳','430600',18),(189,'常德','430700',18),(190,'张家界','430800',18),(191,'益阳','430900',18),(192,'郴州','431000',18),(193,'永州','431100',18),(194,'怀化','431200',18),(195,'娄底','431300',18),(196,'湘西土家族苗族自治州','433100',18),(197,'广州','440100',19),(198,'韶关','440200',19),(199,'深圳','440300',19),(200,'珠海','440400',19),(201,'汕头','440500',19),(202,'佛山','440600',19),(203,'江门','440700',19),(204,'湛江','440800',19),(205,'茂名','440900',19),(206,'肇庆','441200',19),(207,'惠州','441300',19),(208,'梅州','441400',19),(209,'汕尾','441500',19),(210,'河源','441600',19),(211,'阳江','441700',19),(212,'清远','441800',19),(213,'东莞','441900',19),(214,'中山','442000',19),(215,'潮州','445100',19),(216,'揭阳','445200',19),(217,'云浮','445300',19),(218,'南宁','450100',20),(219,'柳州','450200',20),(220,'桂林','450300',20),(221,'梧州','450400',20),(222,'北海','450500',20),(223,'防城港','450600',20),(224,'钦州','450700',20),(225,'贵港','450800',20),(226,'玉林','450900',20),(227,'百色','451000',20),(228,'贺州','451100',20),(229,'河池','451200',20),(230,'来宾','451300',20),(231,'崇左','451400',20),(232,'海口','460100',21),(233,'三亚','460200',21),(234,'省直辖县级行政单位','469000',21),(235,'辖区','500100',22),(236,'县','500200',22),(237,'','500300',22),(238,'成都','510100',23),(239,'自贡','510300',23),(240,'攀枝花','510400',23),(241,'泸州','510500',23),(242,'德阳','510600',23),(243,'绵阳','510700',23),(244,'广元','510800',23),(245,'遂宁','510900',23),(246,'内江','511000',23),(247,'乐山','511100',23),(248,'南充','511300',23),(249,'眉山','511400',23),(250,'宜宾','511500',23),(251,'广安','511600',23),(252,'达州','511700',23),(253,'雅安','511800',23),(254,'巴中','511900',23),(255,'资阳','512000',23),(256,'阿坝藏族羌族自治州','513200',23),(257,'甘孜藏族自治州','513300',23),(258,'凉山彝族自治州','513400',23),(259,'贵阳','520100',24),(260,'六盘水','520200',24),(261,'遵义','520300',24),(262,'安顺','520400',24),(263,'铜仁地区','522200',24),(264,'黔西南布依族苗族自治州','522300',24),(265,'毕节地区','522400',24),(266,'黔东南苗族侗族自治州','522600',24),(267,'黔南布依族苗族自治州','522700',24),(268,'昆明','530100',25),(269,'曲靖','530300',25),(270,'玉溪','530400',25),(271,'保山','530500',25),(272,'昭通','530600',25),(273,'丽江','530700',25),(274,'思茅','530800',25),(275,'临沧','530900',25),(276,'楚雄彝族自治州','532300',25),(277,'红河哈尼族彝族自治州','532500',25),(278,'文山壮族苗族自治州','532600',25),(279,'西双版纳傣族自治州','532800',25),(280,'大理白族自治州','532900',25),(281,'德宏傣族景颇族自治州','533100',25),(282,'怒江傈僳族自治州','533300',25),(283,'迪庆藏族自治州','533400',25),(284,'拉萨','540100',26),(285,'昌都地区','542100',26),(286,'山南地区','542200',26),(287,'日喀则地区','542300',26),(288,'那曲地区','542400',26),(289,'阿里地区','542500',26),(290,'林芝地区','542600',26),(291,'西安','610100',27),(292,'铜川','610200',27),(293,'宝鸡','610300',27),(294,'咸阳','610400',27),(295,'渭南','610500',27),(296,'延安','610600',27),(297,'汉中','610700',27),(298,'榆林','610800',27),(299,'安康','610900',27),(300,'商洛','611000',27),(301,'兰州','620100',28),(302,'嘉峪关','620200',28),(303,'金昌','620300',28),(304,'白银','620400',28),(305,'天水','620500',28),(306,'武威','620600',28),(307,'张掖','620700',28),(308,'平凉','620800',28),(309,'酒泉','620900',28),(310,'庆阳','621000',28),(311,'定西','621100',28),(312,'陇南','621200',28),(313,'临夏回族自治州','622900',28),(314,'甘南藏族自治州','623000',28),(315,'西宁','630100',29),(316,'海东地区','632100',29),(317,'海北藏族自治州','632200',29),(318,'黄南藏族自治州','632300',29),(319,'海南藏族自治州','632500',29),(320,'果洛藏族自治州','632600',29),(321,'玉树藏族自治州','632700',29),(322,'海西蒙古族藏族自治州','632800',29),(323,'银川','640100',30),(324,'石嘴山','640200',30),(325,'吴忠','640300',30),(326,'固原','640400',30),(327,'中卫','640500',30),(328,'乌鲁木齐','650100',31),(329,'克拉玛依','650200',31),(330,'吐鲁番地区','652100',31),(331,'哈密地区','652200',31),(332,'昌吉回族自治州','652300',31),(333,'博尔塔拉蒙古自治州','652700',31),(334,'巴音郭楞蒙古自治州','652800',31),(335,'阿克苏地区','652900',31),(336,'克孜勒苏柯尔克孜自治州','653000',31),(337,'喀什地区','653100',31),(338,'和田地区','653200',31),(339,'伊犁哈萨克自治州','654000',31),(340,'塔城地区','654200',31),(341,'阿勒泰地区','654300',31),(342,'省直辖行政单位','659000',31),(343,'天津',NULL,2); +/*!40000 ALTER TABLE `city` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `com_visiting_purpose_pl` +-- + +DROP TABLE IF EXISTS `com_visiting_purpose_pl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `com_visiting_purpose_pl` ( @@ -812,7 +907,7 @@ CREATE TABLE `contact` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `accountId` mediumint(9) NOT NULL, - `department` varchar(255) DEFAULT NULL, + `department` mediumint(9) DEFAULT NULL, `sex` mediumint(9) DEFAULT NULL, `native_place` varchar(255) DEFAULT NULL, `office_tel` varchar(255) DEFAULT NULL, @@ -822,8 +917,8 @@ CREATE TABLE `contact` ( `status` varchar(255) DEFAULT NULL, `market_classification` mediumint(9) DEFAULT NULL, `grade` mediumint(9) DEFAULT NULL, - `province` varchar(255) DEFAULT NULL, - `city` varchar(255) DEFAULT NULL, + `province` int(11) DEFAULT NULL, + `city` int(11) DEFAULT NULL, `districts` varchar(255) DEFAULT NULL, `duty` mediumint(9) DEFAULT NULL, `job_title` mediumint(9) DEFAULT NULL, @@ -834,8 +929,16 @@ CREATE TABLE `contact` ( `modifier` varchar(255) DEFAULT NULL, `modify_datetime` datetime DEFAULT NULL, `responsible_person` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; + `contactCode` varchar(255) DEFAULT NULL, + `num_of_monthlySurgery` mediumint(9) DEFAULT NULL, + `num_of_monthlyAnalgesia` mediumint(9) DEFAULT NULL, + `externalId` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `contactCode_UNIQUE` (`contactCode`), + UNIQUE KEY `externalId` (`externalId`), + KEY `account_id_cons` (`accountId`), + CONSTRAINT `account_id_cons` FOREIGN KEY (`accountId`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -844,7 +947,6 @@ CREATE TABLE `contact` ( LOCK TABLES `contact` WRITE; /*!40000 ALTER TABLE `contact` DISABLE KEYS */; -INSERT INTO `contact` VALUES (5,'BBcdcdcd',3,'1',1,NULL,NULL,NULL,NULL,NULL,'1',1,2,NULL,NULL,NULL,1,1,NULL,NULL,'李99','2013-09-28 17:00:40','李99','2013-10-04 08:38:00',NULL),(6,'122',3,'1',1,NULL,NULL,NULL,NULL,'sd@sina.sdfdsf','1',1,1,NULL,NULL,NULL,1,2,NULL,NULL,'李99','2013-09-28 21:48:12','李99','2013-09-30 21:15:00',NULL),(7,'asdsd',3,'1',1,'as',NULL,NULL,NULL,NULL,'1',1,1,NULL,NULL,NULL,1,1,NULL,NULL,'李99','2013-09-30 07:45:00','李99','2013-09-30 07:45:00',NULL),(8,'BBBB',4,'1',1,NULL,NULL,NULL,NULL,NULL,'1',1,2,NULL,NULL,NULL,1,1,NULL,NULL,'李99','2013-10-01 02:23:00','李99','2013-10-04 08:38:00',NULL); /*!40000 ALTER TABLE `contact` ENABLE KEYS */; UNLOCK TABLES; @@ -859,7 +961,7 @@ CREATE TABLE `contact_department_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -868,7 +970,7 @@ CREATE TABLE `contact_department_pl` ( LOCK TABLES `contact_department_pl` WRITE; /*!40000 ALTER TABLE `contact_department_pl` DISABLE KEYS */; -INSERT INTO `contact_department_pl` VALUES (1,'ICU'),(2,'内科'),(3,'外科'),(4,'中医科'),(5,'化疗科'),(6,'关怀科'),(7,'牙科'),(8,'急症科'),(9,'骨科'),(10,'肝胆外科'),(11,'血液科'),(12,'风湿科'),(13,'呼吸科'); +INSERT INTO `contact_department_pl` VALUES (1,'ICU'),(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,'神经科'),(49,'神经内科'),(50,'神经外科'),(51,'肾内科'),(52,'生物治疗科'),(53,'特需科'),(54,'疼痛科'),(55,'微创科'),(56,'胃肠外科'),(57,'消化科'),(58,'消化内科'),(59,'消化外科'),(60,'心内科'),(61,'心胸外科'),(62,'血管外科'),(63,'血透科'),(64,'药剂科'),(65,'医保办'),(66,'医务科'),(67,'整形美容科'),(68,'质控科'),(69,'中西医结合科'),(70,'肿瘤科'),(71,'肿瘤内科'),(72,'肿瘤外科'),(73,'综合科'); /*!40000 ALTER TABLE `contact_department_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -883,7 +985,7 @@ CREATE TABLE `contact_duty_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -892,7 +994,7 @@ CREATE TABLE `contact_duty_pl` ( LOCK TABLES `contact_duty_pl` WRITE; /*!40000 ALTER TABLE `contact_duty_pl` DISABLE KEYS */; -INSERT INTO `contact_duty_pl` VALUES (1,'主任'),(2,'主治医师'),(3,'科室主任'),(4,'采购'),(5,'科室主任'),(6,'院长'),(7,'副院长'),(8,'药剂科主任'); +INSERT INTO `contact_duty_pl` VALUES (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,'其他'); /*!40000 ALTER TABLE `contact_duty_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -931,7 +1033,7 @@ CREATE TABLE `contact_grade_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -940,7 +1042,7 @@ CREATE TABLE `contact_grade_pl` ( LOCK TABLES `contact_grade_pl` WRITE; /*!40000 ALTER TABLE `contact_grade_pl` DISABLE KEYS */; -INSERT INTO `contact_grade_pl` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'); +INSERT INTO `contact_grade_pl` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'),(5,'V'),(6,'非目标医生'); /*!40000 ALTER TABLE `contact_grade_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -955,7 +1057,7 @@ CREATE TABLE `contact_job_title_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -964,7 +1066,7 @@ CREATE TABLE `contact_job_title_pl` ( LOCK TABLES `contact_job_title_pl` WRITE; /*!40000 ALTER TABLE `contact_job_title_pl` DISABLE KEYS */; -INSERT INTO `contact_job_title_pl` VALUES (1,'住院医师'),(2,'主治医师'),(3,'副主任医师'),(4,'主任医师'),(5,'护士'),(6,'主管护师'),(7,'药师'),(8,'技师'); +INSERT INTO `contact_job_title_pl` VALUES (1,'住院医师'),(2,'主治医师'),(3,'副主任医师'),(4,'主任医师'),(5,'护士'),(6,'主管护士'),(7,'药师'),(8,'技师'),(9,'副主任护士'),(10,'主任护师'),(11,'主管药师'),(12,'副主任药师'),(13,'主任药师'),(14,'主管技师'),(15,'副主任技师'),(16,'主任技师'),(17,'其他'); /*!40000 ALTER TABLE `contact_job_title_pl` ENABLE KEYS */; UNLOCK TABLES; @@ -993,294 +1095,268 @@ INSERT INTO `contact_market_classification_pl` VALUES (1,'战略城市'),(2,'一 UNLOCK TABLES; -- --- Table structure for table `contact_pl1` +-- Table structure for table `contact_status_pl` -- -DROP TABLE IF EXISTS `contact_pl1`; +DROP TABLE IF EXISTS `contact_status_pl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl1` ( +CREATE TABLE `contact_status_pl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl1` +-- Dumping data for table `contact_status_pl` -- -LOCK TABLES `contact_pl1` WRITE; -/*!40000 ALTER TABLE `contact_pl1` DISABLE KEYS */; -INSERT INTO `contact_pl1` VALUES (1,'肿瘤科'),(2,'内科'),(3,'外科'),(4,'中医科'),(5,'化疗科'),(6,'关怀科'),(7,'牙科'),(8,'急症科'),(9,'骨科'),(10,'肝胆外科'),(11,'血液科'),(12,'风湿科'),(13,'呼吸科'); -/*!40000 ALTER TABLE `contact_pl1` ENABLE KEYS */; +LOCK TABLES `contact_status_pl` WRITE; +/*!40000 ALTER TABLE `contact_status_pl` DISABLE KEYS */; +INSERT INTO `contact_status_pl` VALUES (1,'有效'),(2,'无效'); +/*!40000 ALTER TABLE `contact_status_pl` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_pl2` +-- Table structure for table `contactcrmuser` -- -DROP TABLE IF EXISTS `contact_pl2`; +DROP TABLE IF EXISTS `contactcrmuser`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl2` ( +CREATE TABLE `contactcrmuser` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + `contactId` mediumint(9) NOT NULL, + `crmuserId` mediumint(9) NOT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `contactId` (`contactId`,`crmuserId`), + KEY `crm_contact_cons1` (`crmuserId`), + CONSTRAINT `crm_contact_cons1` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `crm_contact_cons2` FOREIGN KEY (`contactId`) REFERENCES `contact` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl2` +-- Dumping data for table `contactcrmuser` -- -LOCK TABLES `contact_pl2` WRITE; -/*!40000 ALTER TABLE `contact_pl2` DISABLE KEYS */; -INSERT INTO `contact_pl2` VALUES (1,'主任'),(2,'主治医师'),(3,'科室主任'),(4,'采购'),(5,'科室主任'),(6,'院长'); -/*!40000 ALTER TABLE `contact_pl2` ENABLE KEYS */; +LOCK TABLES `contactcrmuser` WRITE; +/*!40000 ALTER TABLE `contactcrmuser` DISABLE KEYS */; +/*!40000 ALTER TABLE `contactcrmuser` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_pl3` +-- Table structure for table `crmuser` -- -DROP TABLE IF EXISTS `contact_pl3`; +DROP TABLE IF EXISTS `crmuser`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl3` ( +CREATE TABLE `crmuser` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; + `name` varchar(255) NOT NULL, + `code` varchar(255) DEFAULT NULL, + `reportto` mediumint(9) DEFAULT NULL, + `role` mediumint(9) DEFAULT NULL, + `pl1` mediumint(9) DEFAULT NULL, + `pl2` mediumint(9) DEFAULT NULL, + `pl4` mediumint(9) DEFAULT NULL, + `pl5` mediumint(9) DEFAULT NULL, + `city` mediumint(9) DEFAULT NULL, + `department` varchar(255) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` date DEFAULT NULL, + `owner` varchar(255) DEFAULT NULL, + `level` mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl3` +-- Dumping data for table `crmuser` -- -LOCK TABLES `contact_pl3` WRITE; -/*!40000 ALTER TABLE `contact_pl3` DISABLE KEYS */; -INSERT INTO `contact_pl3` VALUES (1,'住院医师'),(2,'主治医师'),(3,'副主任医师'),(4,'主任医师'),(5,'护士'),(6,'主管护师'),(7,'药师'),(8,'技师'); -/*!40000 ALTER TABLE `contact_pl3` ENABLE KEYS */; +LOCK TABLES `crmuser` WRITE; +/*!40000 ALTER TABLE `crmuser` DISABLE KEYS */; +INSERT INTO `crmuser` VALUES (-1,'无','BJ',0,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(1,'管理员','BJ231011001',-1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `crmuser` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_pl4` +-- Table structure for table `crmuser_activited` -- -DROP TABLE IF EXISTS `contact_pl4`; +DROP TABLE IF EXISTS `crmuser_activited`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl4` ( +CREATE TABLE `crmuser_activited` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl4` +-- Dumping data for table `crmuser_activited` -- -LOCK TABLES `contact_pl4` WRITE; -/*!40000 ALTER TABLE `contact_pl4` DISABLE KEYS */; -INSERT INTO `contact_pl4` VALUES (1,'奥施康定'),(2,'奇曼丁'),(3,'意施丁'),(4,'综合'),(5,'麻药'),(6,'慢痛'); -/*!40000 ALTER TABLE `contact_pl4` ENABLE KEYS */; +LOCK TABLES `crmuser_activited` WRITE; +/*!40000 ALTER TABLE `crmuser_activited` DISABLE KEYS */; +INSERT INTO `crmuser_activited` VALUES (0,'未激活'),(1,'已激活'); +/*!40000 ALTER TABLE `crmuser_activited` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_pl5` +-- Table structure for table `crmuser_level_pl` -- -DROP TABLE IF EXISTS `contact_pl5`; +DROP TABLE IF EXISTS `crmuser_level_pl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl5` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +CREATE TABLE `crmuser_level_pl` ( + `id` int(11) NOT NULL, + `val` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl5` +-- Dumping data for table `crmuser_level_pl` -- -LOCK TABLES `contact_pl5` WRITE; -/*!40000 ALTER TABLE `contact_pl5` DISABLE KEYS */; -INSERT INTO `contact_pl5` VALUES (1,'有效'),(2,'无效'); -/*!40000 ALTER TABLE `contact_pl5` ENABLE KEYS */; +LOCK TABLES `crmuser_level_pl` WRITE; +/*!40000 ALTER TABLE `crmuser_level_pl` DISABLE KEYS */; +INSERT INTO `crmuser_level_pl` VALUES (11,'11'),(21,'21'),(31,'31'); +/*!40000 ALTER TABLE `crmuser_level_pl` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_pl6` +-- Table structure for table `crmuser_pl1` -- -DROP TABLE IF EXISTS `contact_pl6`; +DROP TABLE IF EXISTS `crmuser_pl1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_pl6` ( +CREATE TABLE `crmuser_pl1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_pl6` +-- Dumping data for table `crmuser_pl1` -- -LOCK TABLES `contact_pl6` WRITE; -/*!40000 ALTER TABLE `contact_pl6` DISABLE KEYS */; -INSERT INTO `contact_pl6` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'); -/*!40000 ALTER TABLE `contact_pl6` ENABLE KEYS */; +LOCK TABLES `crmuser_pl1` WRITE; +/*!40000 ALTER TABLE `crmuser_pl1` DISABLE KEYS */; +INSERT INTO `crmuser_pl1` VALUES (1,'有效'),(2,'无效'); +/*!40000 ALTER TABLE `crmuser_pl1` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contact_status_pl` +-- Table structure for table `crmuser_pl2` -- -DROP TABLE IF EXISTS `contact_status_pl`; +DROP TABLE IF EXISTS `crmuser_pl2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contact_status_pl` ( +CREATE TABLE `crmuser_pl2` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contact_status_pl` +-- Dumping data for table `crmuser_pl2` -- -LOCK TABLES `contact_status_pl` WRITE; -/*!40000 ALTER TABLE `contact_status_pl` DISABLE KEYS */; -INSERT INTO `contact_status_pl` VALUES (1,'有效'),(2,'无效'); -/*!40000 ALTER TABLE `contact_status_pl` ENABLE KEYS */; +LOCK TABLES `crmuser_pl2` WRITE; +/*!40000 ALTER TABLE `crmuser_pl2` DISABLE KEYS */; +INSERT INTO `crmuser_pl2` VALUES (1,'麻药'),(2,'慢痛'),(3,'奥诺美'),(4,'全部'); +/*!40000 ALTER TABLE `crmuser_pl2` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `contactcrmuser` +-- Table structure for table `data_exchange_operation` -- -DROP TABLE IF EXISTS `contactcrmuser`; +DROP TABLE IF EXISTS `data_exchange_operation`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contactcrmuser` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `contactId` mediumint(9) NOT NULL, - `crmuserId` mediumint(9) NOT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `contactId` (`contactId`,`crmuserId`) -) ENGINE=InnoDB AUTO_INCREMENT=1332 DEFAULT CHARSET=utf8; +CREATE TABLE `data_exchange_operation` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `val` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `contactcrmuser` +-- Dumping data for table `data_exchange_operation` -- -LOCK TABLES `contactcrmuser` WRITE; -/*!40000 ALTER TABLE `contactcrmuser` DISABLE KEYS */; -INSERT INTO `contactcrmuser` VALUES (1138,7,20),(1139,8,20),(1331,8,99),(1140,9,20),(1141,10,20),(1142,11,20),(1143,12,20),(1144,13,20),(1145,14,20),(1146,15,20),(1147,16,20),(1148,17,20),(1149,18,20),(1150,19,20),(1151,20,20),(1152,21,20),(1153,22,20),(1154,23,20),(1155,24,20),(1156,25,20),(1157,26,20),(1158,27,20),(1159,28,20),(1160,29,20),(1161,30,20),(1162,31,20),(1163,32,20),(1164,33,20),(1165,34,20),(1166,35,20),(1167,36,20),(1168,37,20),(1169,38,20),(1170,39,20),(1171,40,20),(1172,41,20),(1173,42,20),(1174,43,20),(1175,44,20),(1176,45,20),(1177,46,20),(1178,47,20),(1179,48,20),(1180,49,20),(1181,50,20),(1182,51,20),(1183,52,20),(1184,53,20),(1185,54,20),(1186,55,20),(1187,56,20),(1188,57,20),(1189,58,20),(1190,59,20),(1191,60,20),(1192,61,20),(1193,62,20),(1194,63,20),(1195,64,20),(1196,65,20),(1197,66,20),(1198,67,20),(1199,68,20),(1200,69,20),(1201,70,20),(1202,71,20),(1203,72,20),(1204,73,20),(1205,74,20),(1206,75,20),(1207,76,20),(1208,77,20),(1209,78,20),(1210,79,20),(1211,80,20),(1212,81,20),(1213,82,20),(1214,83,20),(1215,84,20),(1216,85,20),(1217,86,20),(1218,87,20),(1219,88,20),(1220,89,20),(1221,90,20),(1222,91,20),(1223,92,20),(1224,93,20),(1225,94,20),(1226,95,20),(1227,96,20),(1228,97,20),(1229,98,20),(1230,99,20),(1231,100,20),(1232,101,20),(1233,102,20),(1234,103,20),(1235,104,20),(1236,105,20),(1237,106,20),(1238,107,20),(1239,108,20),(1240,109,20),(1241,110,20),(1242,111,20),(1243,112,20),(1244,113,20),(1245,114,20),(1246,115,20),(1247,116,20),(1248,117,20),(1249,118,20),(1250,119,20),(1251,120,20),(1252,121,20),(1253,122,20),(1254,123,20),(1255,124,20),(1256,125,20),(1257,126,20),(1258,127,20),(1259,128,20),(1260,129,20),(1261,130,20),(1262,131,20),(1263,132,20),(1264,133,20),(1265,134,20),(1266,135,20),(1267,136,20),(1268,137,20),(1269,138,20),(1270,139,20),(1271,140,20),(1272,141,20),(1273,142,20),(1274,143,20),(1275,144,20),(1276,145,20),(1277,146,20),(1278,147,20),(1279,148,20),(1280,149,20),(1281,150,20),(1282,151,20),(1283,152,20),(1284,153,20),(1285,154,20),(1286,155,20),(1287,156,20),(1288,157,20),(1289,158,20),(1290,159,20),(1291,160,20),(1292,161,20),(1293,162,20),(1294,163,20),(1295,164,20),(1296,165,20),(1297,166,20),(1298,167,20),(1299,168,20),(1300,169,20),(1301,170,20),(1302,171,20),(1303,172,20),(1304,173,20),(1305,174,20),(1306,175,20),(1307,176,20),(1308,177,20),(1309,178,20),(1310,179,20),(1311,180,20),(1312,181,20),(1313,182,20),(1314,183,20),(1315,184,20),(1316,185,20),(1317,186,20),(1318,187,20),(1319,188,20),(1320,189,20),(1321,190,20),(1322,191,20),(1323,192,20),(1324,193,20),(1325,194,20),(1326,195,20),(1327,196,20),(1328,197,20),(1329,198,20),(1330,199,20); -/*!40000 ALTER TABLE `contactcrmuser` ENABLE KEYS */; +LOCK TABLES `data_exchange_operation` WRITE; +/*!40000 ALTER TABLE `data_exchange_operation` DISABLE KEYS */; +INSERT INTO `data_exchange_operation` VALUES (1,0,'Import'),(2,0,'Export'); +/*!40000 ALTER TABLE `data_exchange_operation` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `crmuser` +-- Table structure for table `data_exchange_status` -- -DROP TABLE IF EXISTS `crmuser`; +DROP TABLE IF EXISTS `data_exchange_status`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `crmuser` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `department` varchar(255) DEFAULT NULL, - `division` varchar(255) DEFAULT NULL, - `cellPhone` varchar(255) DEFAULT NULL, - `email` varchar(255) DEFAULT NULL, - `employeeNumber` varchar(255) DEFAULT NULL, - `photo` varchar(255) DEFAULT NULL, - `jobTitle` varchar(255) DEFAULT NULL, - `pl1` mediumint(9) DEFAULT NULL, - `pl2` mediumint(9) DEFAULT NULL, - `role` mediumint(9) DEFAULT NULL, - `pl4` mediumint(9) DEFAULT NULL, - `pl5` mediumint(9) DEFAULT NULL, - `sex` mediumint(9) DEFAULT NULL, - `loginName` varchar(255) DEFAULT NULL, - `password` varchar(255) DEFAULT NULL, - `sessionKey` varchar(255) DEFAULT NULL, - `lastLoginTime` bigint(20) DEFAULT NULL, - `whenadded` datetime DEFAULT NULL, - `reportto` mediumint(9) DEFAULT NULL, - `parcel` varchar(255) DEFAULT NULL, - `modifier` varchar(255) DEFAULT NULL, - `modify_datetime` datetime DEFAULT NULL, - `owner` varchar(255) DEFAULT NULL, - `postId` varchar(255) DEFAULT NULL, - `city` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8; +CREATE TABLE `data_exchange_status` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `val` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `crmuser` +-- Dumping data for table `data_exchange_status` -- -LOCK TABLES `crmuser` WRITE; -/*!40000 ALTER TABLE `crmuser` DISABLE KEYS */; -INSERT INTO `crmuser` VALUES (99,'李99',NULL,'医疗设备部','','li',NULL,'','职员',1,1,1,1,1,1,'li','827ccb0eea8a706c4c34a16891f84e7b','53856',NULL,NULL,100,NULL,'李99','2013-10-14 21:31:00',NULL,NULL,'1'),(100,'gvg',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,1,1,1,'jjj',NULL,NULL,NULL,'2013-10-14 18:58:00',101,NULL,'李99','2013-10-14 18:58:00','李99',NULL,NULL),(101,'gvg',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,1,1,1,'jjj','e10adc3949ba59abbe56e057f20f883e',NULL,NULL,'2013-10-14 18:58:00',99,NULL,'李99','2013-10-14 18:58:00','李99',NULL,NULL),(102,'brenda4',NULL,NULL,'18812348765','brenda.yuan@rexen.com.cn',NULL,NULL,'职员',1,1,1,1,1,2,'brenda4','827ccb0eea8a706c4c34a16891f84e7b',NULL,NULL,'2013-10-16 22:33:00',-1,NULL,'李99','2013-10-16 22:33:00','李99',NULL,NULL),(117,'yuan',NULL,NULL,'18812348765','brenda.yuan@rexen.com.cn',NULL,NULL,'职员',1,1,1,1,1,1,'yuan',NULL,NULL,NULL,'2013-10-17 12:44:00',-1,NULL,'李99','2013-10-17 12:44:00','李99',NULL,NULL); -/*!40000 ALTER TABLE `crmuser` ENABLE KEYS */; +LOCK TABLES `data_exchange_status` WRITE; +/*!40000 ALTER TABLE `data_exchange_status` DISABLE KEYS */; +INSERT INTO `data_exchange_status` VALUES (1,0,'Pending'),(2,0,'Abort'),(3,0,'Completed'),(4,0,'Cancelled'); +/*!40000 ALTER TABLE `data_exchange_status` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `crmuser_pl1` +-- Table structure for table `data_exchange_teample` -- -DROP TABLE IF EXISTS `crmuser_pl1`; +DROP TABLE IF EXISTS `data_exchange_teample`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `crmuser_pl1` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `crmuser_pl1` --- - -LOCK TABLES `crmuser_pl1` WRITE; -/*!40000 ALTER TABLE `crmuser_pl1` DISABLE KEYS */; -INSERT INTO `crmuser_pl1` VALUES (1,'有效'),(2,'无效'); -/*!40000 ALTER TABLE `crmuser_pl1` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `crmuser_pl2` --- - -DROP TABLE IF EXISTS `crmuser_pl2`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `crmuser_pl2` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `val` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +CREATE TABLE `data_exchange_teample` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `template` longtext NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `crmuser_pl2` +-- Dumping data for table `data_exchange_teample` -- -LOCK TABLES `crmuser_pl2` WRITE; -/*!40000 ALTER TABLE `crmuser_pl2` DISABLE KEYS */; -INSERT INTO `crmuser_pl2` VALUES (1,'麻药'),(2,'慢痛'),(3,'全部'); -/*!40000 ALTER TABLE `crmuser_pl2` ENABLE KEYS */; +LOCK TABLES `data_exchange_teample` WRITE; +/*!40000 ALTER TABLE `data_exchange_teample` DISABLE KEYS */; +INSERT INTO `data_exchange_teample` VALUES (1,'Account Full Import Template 1.0','\r\n\r\n 1000\r\n Account\r\n BdmCode\r\n account.csv\r\n crm_mysql\r\n \r\n 记录行ID\r\n String\r\n BdmCode\r\n \r\n \r\n \r\n 年诊疗人数\r\n Integer\r\n NumOfTreatPerYear\r\n \r\n\r\n \r\n 成立时间\r\n Date\r\n DateOfEstablish\r\n m/d/yy\r\n \r\n \r\n\r\n \r\n 客户名称\r\n String\r\n Name\r\n \r\n\r\n \r\n 医院行政级别\r\n Lookup\r\n AdministrativLevel\r\n AccountAdministrativLevelPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院分级\r\n Lookup\r\n Grade\r\n AccountGradePl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院类型\r\n Lookup\r\n HospitalType\r\n AccountTypePl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 地方军队医院\r\n Lookup\r\n LocalOrArmy\r\n AccountLocalOrArmyPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 综合专科医院\r\n Lookup\r\n ComprehensiveOrSpecialized\r\n AccountComprehensiveOrSpecializedPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 重点医院\r\n Lookup\r\n KeyType\r\n AccountPointPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 状态\r\n Lookup\r\n Status\r\n AccountStatusPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 法人\r\n String\r\n DutyOfficer\r\n \r\n\r\n \r\n 医生数量\r\n Integer\r\n NumOfDoctors\r\n \r\n\r\n \r\n 助理医师人数\r\n Integer\r\n NumOfAssistantDoctors\r\n \r\n \r\n \r\n 员工总数\r\n Integer\r\n NumOfStaff\r\n \r\n\r\n \r\n 门诊人数\r\n Integer\r\n NumOfOutpatient\r\n \r\n\r\n \r\n 总病床数\r\n Integer\r\n TotalNumOfSickbed\r\n \r\n\r\n \r\n 麻醉科医生数\r\n Integer\r\n NumOfAnesthesiaDoctor\r\n \r\n\r\n \r\n 疼痛学组医生数\r\n Integer\r\n NumOfPainDoctor\r\n \r\n\r\n \r\n 手术量年\r\n Integer\r\n NumOfSurgeryPerYear\r\n \r\n\r\n \r\n 手术间\r\n Integer\r\n NumOfSurgeryRoom\r\n \r\n\r\n \r\n 阿片类用药量\r\n Integer\r\n NumOfUsingOpiatesMedicine\r\n \r\n\r\n \r\n 阿片类注射剂量\r\n Integer\r\n NumOfUsingOpiatesInjection\r\n \r\n\r\n \r\n 注册资金\r\n Integer\r\n RegisteredCapital\r\n \r\n\r\n \r\n 主要电话号码\r\n String\r\n Tel\r\n \r\n\r\n \r\n 主要传真号码\r\n String\r\n Fax\r\n \r\n\r\n \r\n 市场分类\r\n Lookup\r\n MarketClassification\r\n AccountMarketClassificationPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院省份\r\n String\r\n Province\r\n \r\n\r\n \r\n 医院区县\r\n String\r\n Districts\r\n \r\n \r\n \r\n 医院详细地址\r\n String\r\n Address\r\n \r\n'); +/*!40000 ALTER TABLE `data_exchange_teample` ENABLE KEYS */; UNLOCK TABLES; -- @@ -1368,13 +1444,13 @@ INSERT INTO `dl` VALUES (1,'N2',2,'2013-10-09 14:42:28'),(2,'N3',3,'2013-10-20 1 UNLOCK TABLES; -- --- Table structure for table `externalmeeting` +-- Table structure for table `externalMeeting` -- -DROP TABLE IF EXISTS `externalmeeting`; +DROP TABLE IF EXISTS `externalMeeting`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `externalmeeting` ( +CREATE TABLE `externalMeeting` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `crmuserId` mediumint(9) NOT NULL, `endtime` bigint(20) DEFAULT NULL, @@ -1385,27 +1461,109 @@ CREATE TABLE `externalmeeting` ( `activity_type` mediumint(9) DEFAULT NULL, `coachId` mediumint(9) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `externalMeeting` +-- + +LOCK TABLES `externalMeeting` WRITE; +/*!40000 ALTER TABLE `externalMeeting` DISABLE KEYS */; +/*!40000 ALTER TABLE `externalMeeting` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `importMetaInfo` +-- + +DROP TABLE IF EXISTS `importMetaInfo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `importMetaInfo` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `entity_name` varchar(255) DEFAULT NULL, + `importfilename` varchar(255) DEFAULT NULL, + `logfilename` varchar(255) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `num_of_total_record` mediumint(9) DEFAULT NULL, + `num_of_imported` mediumint(9) DEFAULT NULL, + `num_of_failed` mediumint(9) DEFAULT NULL, + `status` mediumint(9) DEFAULT NULL, + `result` mediumint(9) DEFAULT NULL, + `num_of_updated` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `importMetaInfo` +-- + +LOCK TABLES `importMetaInfo` WRITE; +/*!40000 ALTER TABLE `importMetaInfo` DISABLE KEYS */; +/*!40000 ALTER TABLE `importMetaInfo` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `importresult` +-- + +DROP TABLE IF EXISTS `importresult`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `importresult` ( + `id` int(11) NOT NULL, + `val` varchar(45) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `importresult` +-- + +LOCK TABLES `importresult` WRITE; +/*!40000 ALTER TABLE `importresult` DISABLE KEYS */; +INSERT INTO `importresult` VALUES (0,'成功'),(1,'失败'); +/*!40000 ALTER TABLE `importresult` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `importstatus` +-- + +DROP TABLE IF EXISTS `importstatus`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `importstatus` ( + `id` int(11) NOT NULL, + `val` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `externalmeeting` +-- Dumping data for table `importstatus` -- -LOCK TABLES `externalmeeting` WRITE; -/*!40000 ALTER TABLE `externalmeeting` DISABLE KEYS */; -INSERT INTO `externalmeeting` VALUES (32,20,1375804800000,1375804800000,'拜访','[7,167]',2,2,0); -/*!40000 ALTER TABLE `externalmeeting` ENABLE KEYS */; +LOCK TABLES `importstatus` WRITE; +/*!40000 ALTER TABLE `importstatus` DISABLE KEYS */; +INSERT INTO `importstatus` VALUES (0,'运行'),(1,'已完成'); +/*!40000 ALTER TABLE `importstatus` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `internalmeeting` +-- Table structure for table `internalMeeting` -- -DROP TABLE IF EXISTS `internalmeeting`; +DROP TABLE IF EXISTS `internalMeeting`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `internalmeeting` ( +CREATE TABLE `internalMeeting` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `crmuserId` mediumint(9) NOT NULL, `endtime` bigint(20) DEFAULT NULL, @@ -1420,14 +1578,131 @@ CREATE TABLE `internalmeeting` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `internalmeeting` +-- Dumping data for table `internalMeeting` +-- + +LOCK TABLES `internalMeeting` WRITE; +/*!40000 ALTER TABLE `internalMeeting` DISABLE KEYS */; +/*!40000 ALTER TABLE `internalMeeting` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `loginhistory` +-- + +DROP TABLE IF EXISTS `loginhistory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `loginhistory` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `sessionId` varchar(128) DEFAULT NULL, + `loginName` varchar(256) DEFAULT NULL, + `loginTime` datetime DEFAULT NULL, + `logoutTime` datetime DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `sessionId` (`sessionId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `loginhistory` -- -LOCK TABLES `internalmeeting` WRITE; -/*!40000 ALTER TABLE `internalmeeting` DISABLE KEYS */; -/*!40000 ALTER TABLE `internalmeeting` ENABLE KEYS */; +LOCK TABLES `loginhistory` WRITE; +/*!40000 ALTER TABLE `loginhistory` DISABLE KEYS */; +/*!40000 ALTER TABLE `loginhistory` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Temporary table structure for view `parent_position` +-- + +DROP TABLE IF EXISTS `parent_position`; +/*!50001 DROP VIEW IF EXISTS `parent_position`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `parent_position` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `code` tinyint NOT NULL, + `reportto` tinyint NOT NULL, + `role` tinyint NOT NULL, + `pl1` tinyint NOT NULL, + `pl2` tinyint NOT NULL, + `pl4` tinyint NOT NULL, + `pl5` tinyint NOT NULL, + `city` tinyint NOT NULL, + `department` tinyint NOT NULL, + `whenadded` tinyint NOT NULL, + `modifier` tinyint NOT NULL, + `modify_datetime` tinyint NOT NULL, + `owner` tinyint NOT NULL, + `level` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `parent_user_info` +-- + +DROP TABLE IF EXISTS `parent_user_info`; +/*!50001 DROP VIEW IF EXISTS `parent_user_info`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `parent_user_info` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `department` tinyint NOT NULL, + `division` tinyint NOT NULL, + `cellPhone` tinyint NOT NULL, + `email` tinyint NOT NULL, + `employeeNumber` tinyint NOT NULL, + `photo` tinyint NOT NULL, + `jobTitle` tinyint NOT NULL, + `pl1` tinyint NOT NULL, + `pl2` tinyint NOT NULL, + `role` tinyint NOT NULL, + `pl4` tinyint NOT NULL, + `pl5` tinyint NOT NULL, + `sex` tinyint NOT NULL, + `loginName` tinyint NOT NULL, + `password` tinyint NOT NULL, + `sessionKey` tinyint NOT NULL, + `lastLoginTime` tinyint NOT NULL, + `whenadded` tinyint NOT NULL, + `parcel` tinyint NOT NULL, + `modifier` tinyint NOT NULL, + `modify_datetime` tinyint NOT NULL, + `owner` tinyint NOT NULL, + `province` tinyint NOT NULL, + `city` tinyint NOT NULL, + `office_tel` tinyint NOT NULL, + `num_of_signIn` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `parent_user_position` +-- + +DROP TABLE IF EXISTS `parent_user_position`; +/*!50001 DROP VIEW IF EXISTS `parent_user_position`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `parent_user_position` ( + `id` tinyint NOT NULL, + `userId` tinyint NOT NULL, + `positionId` tinyint NOT NULL, + `status` tinyint NOT NULL, + `createtime` tinyint NOT NULL, + `isPrimary` tinyint NOT NULL, + `externalId` tinyint NOT NULL, + `whenadded` tinyint NOT NULL, + `modifier` tinyint NOT NULL, + `modify_datetime` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `province` -- @@ -1436,10 +1711,11 @@ DROP TABLE IF EXISTS `province`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `province` ( - `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1448,10 +1724,61 @@ CREATE TABLE `province` ( LOCK TABLES `province` WRITE; /*!40000 ALTER TABLE `province` DISABLE KEYS */; -INSERT INTO `province` VALUES (1,'黑龙江'),(2,'山东'); +INSERT INTO `province` VALUES (1,'北京','110000'),(2,'天津','120000'),(3,'河北','130000'),(4,'山西','140000'),(5,'内蒙古','150000'),(6,'辽宁','210000'),(7,'吉林','220000'),(8,'黑龙江','230000'),(9,'上海','310000'),(10,'江苏','320000'),(11,'浙江','330000'),(12,'安徽','340000'),(13,'福建','350000'),(14,'江西','360000'),(15,'山东','370000'),(16,'河南','410000'),(17,'湖北','420000'),(18,'湖南','430000'),(19,'广东','440000'),(20,'广西','450000'),(21,'海南','460000'),(22,'重庆','500000'),(23,'四川','510000'),(24,'贵州','520000'),(25,'云南','530000'),(26,'西藏','540000'),(27,'陕西','610000'),(28,'甘肃','620000'),(29,'青海','630000'),(30,'宁夏','640000'),(31,'新疆','650000'),(32,'台湾','710000'),(33,'香港','810000'),(34,'澳门','820000'); /*!40000 ALTER TABLE `province` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `province1` +-- + +DROP TABLE IF EXISTS `province1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `province1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) NOT NULL, + `val` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `province1` +-- + +LOCK TABLES `province1` WRITE; +/*!40000 ALTER TABLE `province1` DISABLE KEYS */; +INSERT INTO `province1` VALUES (1,'110000','北京市'),(2,'120000','天津市'),(3,'130000','河北省'),(4,'140000','山西省'),(5,'150000','内蒙古'),(6,'210000','辽宁省'),(7,'220000','吉林省'),(8,'230000','黑龙江'),(9,'310000','上海市'),(10,'320000','江苏省'),(11,'330000','浙江省'),(12,'340000','安徽省'),(13,'350000','福建省'),(14,'360000','江西省'),(15,'370000','山东省'),(16,'410000','河南省'),(17,'420000','湖北省'),(18,'430000','湖南省'),(19,'440000','广东省'),(20,'450000','广 西'),(21,'460000','海南省'),(22,'500000','重庆市'),(23,'510000','四川省'),(24,'520000','贵州省'),(25,'530000','云南省'),(26,'540000','西 藏'),(27,'610000','陕西省'),(28,'620000','甘肃省'),(29,'630000','青海省'),(30,'640000','宁 夏'),(31,'650000','新 疆'),(32,'710000','台湾省'),(33,'810000','香 港'),(34,'820000','澳 门'); +/*!40000 ALTER TABLE `province1` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `record_type` +-- + +DROP TABLE IF EXISTS `record_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `record_type` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `val` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `record_type` +-- + +LOCK TABLES `record_type` WRITE; +/*!40000 ALTER TABLE `record_type` DISABLE KEYS */; +INSERT INTO `record_type` VALUES (1,0,'Account'),(2,0,'Contact'),(3,0,'Call'),(4,0,'Coaching'),(5,0,'AccuntTeam'),(6,0,'ContactTeam'); +/*!40000 ALTER TABLE `record_type` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `region_level1_pl` -- @@ -1510,6 +1837,7 @@ DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `val` varchar(255) DEFAULT NULL, + `name` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1520,7 +1848,7 @@ CREATE TABLE `role` ( LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (1,'高级用户'),(2,'主管'),(3,'销售代表'); +INSERT INTO `role` VALUES (1,'高级用户','全部'),(2,'主管','只读'),(3,'销售代表','只读'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -1548,6 +1876,54 @@ INSERT INTO `sales_visiting_purpose_pl` VALUES (1,'会议安排'),(2,'会议跟 /*!40000 ALTER TABLE `sales_visiting_purpose_pl` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `score1_pl` +-- + +DROP TABLE IF EXISTS `score1_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `score1_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `score1_pl` +-- + +LOCK TABLES `score1_pl` WRITE; +/*!40000 ALTER TABLE `score1_pl` DISABLE KEYS */; +INSERT INTO `score1_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'); +/*!40000 ALTER TABLE `score1_pl` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `score2_pl` +-- + +DROP TABLE IF EXISTS `score2_pl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `score2_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `score2_pl` +-- + +LOCK TABLES `score2_pl` WRITE; +/*!40000 ALTER TABLE `score2_pl` DISABLE KEYS */; +INSERT INTO `score2_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'),(16,'16'),(17,'17'),(18,'18'),(19,'19'),(20,'20'); +/*!40000 ALTER TABLE `score2_pl` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `sex_pl` -- @@ -1571,6 +1947,315 @@ LOCK TABLES `sex_pl` WRITE; INSERT INTO `sex_pl` VALUES (1,'男'),(2,'女'); /*!40000 ALTER TABLE `sex_pl` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Table structure for table `test_main` +-- + +DROP TABLE IF EXISTS `test_main`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `test_main` ( + `id` int(11) NOT NULL DEFAULT '0', + `value` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `test_main` +-- + +LOCK TABLES `test_main` WRITE; +/*!40000 ALTER TABLE `test_main` DISABLE KEYS */; +INSERT INTO `test_main` VALUES (1,'ONE'),(2,'TWO'); +/*!40000 ALTER TABLE `test_main` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `test_sub` +-- + +DROP TABLE IF EXISTS `test_sub`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `test_sub` ( + `id` int(11) NOT NULL DEFAULT '0', + `main_id` int(11) DEFAULT NULL, + `value` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `test_sub` +-- + +LOCK TABLES `test_sub` WRITE; +/*!40000 ALTER TABLE `test_sub` DISABLE KEYS */; +INSERT INTO `test_sub` VALUES (1,1,'ONEONE'),(2,2,'TWOTWO'); +/*!40000 ALTER TABLE `test_sub` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_position` +-- + +DROP TABLE IF EXISTS `user_position`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_position` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `userId` int(32) DEFAULT NULL, + `positionId` int(32) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `createtime` datetime DEFAULT NULL, + `isPrimary` int(11) DEFAULT NULL, + `externalId` varchar(128) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `positionId` (`positionId`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_position` +-- + +LOCK TABLES `user_position` WRITE; +/*!40000 ALTER TABLE `user_position` DISABLE KEYS */; +INSERT INTO `user_position` VALUES (1,1,1,NULL,NULL,1,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `user_position` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Temporary table structure for view `user_position_account` +-- + +DROP TABLE IF EXISTS `user_position_account`; +/*!50001 DROP VIEW IF EXISTS `user_position_account`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `user_position_account` ( + `id` tinyint NOT NULL, + `userName` tinyint NOT NULL, + `loginName` tinyint NOT NULL, + `email` tinyint NOT NULL, + `sex` tinyint NOT NULL, + `addTime` tinyint NOT NULL, + `positionName` tinyint NOT NULL, + `positionCode` tinyint NOT NULL, + `reportTo` tinyint NOT NULL, + `reporttto` tinyint NOT NULL, + `role` tinyint NOT NULL, + `regoin1` tinyint NOT NULL, + `regoin2` tinyint NOT NULL, + `city` tinyint NOT NULL, + `accountName` tinyint NOT NULL, + `BDMCode` tinyint NOT NULL, + `adminLevel` tinyint NOT NULL, + `status` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `user_position_query` +-- + +DROP TABLE IF EXISTS `user_position_query`; +/*!50001 DROP VIEW IF EXISTS `user_position_query`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `user_position_query` ( + `user_id` tinyint NOT NULL, + `position_id` tinyint NOT NULL, + `area` tinyint NOT NULL, + `region` tinyint NOT NULL, + `province` tinyint NOT NULL, + `productLine` tinyint NOT NULL, + `position_level` tinyint NOT NULL, + `position_name` tinyint NOT NULL, + `position_code` tinyint NOT NULL, + `delegatePosition` tinyint NOT NULL, + `delegateName` tinyint NOT NULL, + `manager_position_id` tinyint NOT NULL, + `managerPosition` tinyint NOT NULL, + `manager_position_name` tinyint NOT NULL, + `manager_position_level` tinyint NOT NULL, + `manager_employee_number` tinyint NOT NULL, + `regionManager` tinyint NOT NULL, + `accountName` tinyint NOT NULL, + `BDMcode` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `userinfo` +-- + +DROP TABLE IF EXISTS `userinfo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userinfo` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `department` varchar(255) DEFAULT NULL, + `division` varchar(255) DEFAULT NULL, + `cellPhone` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `employeeNumber` varchar(255) DEFAULT NULL, + `photo` varchar(255) DEFAULT NULL, + `jobTitle` varchar(255) DEFAULT NULL, + `pl1` mediumint(9) DEFAULT NULL, + `pl2` mediumint(9) DEFAULT NULL, + `role` mediumint(9) DEFAULT NULL, + `pl4` mediumint(9) DEFAULT NULL, + `pl5` mediumint(9) DEFAULT NULL, + `sex` mediumint(9) DEFAULT NULL, + `loginName` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + `sessionKey` varchar(255) DEFAULT NULL, + `lastLoginTime` bigint(20) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `parcel` varchar(255) DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `owner` varchar(255) DEFAULT NULL, + `province` int(11) DEFAULT NULL, + `city` int(11) DEFAULT NULL, + `office_tel` varchar(255) DEFAULT NULL, + `num_of_signIn` mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `employeeNumber` (`employeeNumber`), + UNIQUE KEY `loginName_UNIQUE` (`loginName`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `userinfo` +-- + +LOCK TABLES `userinfo` WRITE; +/*!40000 ALTER TABLE `userinfo` DISABLE KEYS */; +INSERT INTO `userinfo` VALUES (-1,'无',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,1,NULL,NULL,1,'dummy','827ccb0eea8a706c4c34a16891f84e7b',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(1,'Admin Nam',NULL,NULL,NULL,'tigerzhou@rexen.com.cn',NULL,NULL,NULL,1,NULL,1,NULL,NULL,1,'admin','827ccb0eea8a706c4c34a16891f84e7b',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,NULL,NULL); +/*!40000 ALTER TABLE `userinfo` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Final view structure for view `activity_alert` +-- + +/*!50001 DROP TABLE IF EXISTS `activity_alert`*/; +/*!50001 DROP VIEW IF EXISTS `activity_alert`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `activity_alert` AS select `act`.`id` AS `id`,(case when ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) = 0) then '今天' when ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) = 1) then '昨天' when ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) = 2) then '前天' when (((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) >= 3) and ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) < 7)) then '三天以前' when ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) >= 7) then '七天以前' else '错误' end) AS `time`,`act`.`title` AS `title`,`act`.`owner` AS `name`,`act`.`starttime` AS `times` from `activity` `act` where ((`act`.`status` = 1) and ((to_days(curdate()) - to_days(date_format(from_unixtime((`act`.`starttime` / 1000)),'%Y-%m-%d'))) >= 0)) order by `act`.`starttime` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `parent_position` +-- + +/*!50001 DROP TABLE IF EXISTS `parent_position`*/; +/*!50001 DROP VIEW IF EXISTS `parent_position`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `parent_position` AS select `crmuser`.`id` AS `id`,`crmuser`.`name` AS `name`,`crmuser`.`code` AS `code`,`crmuser`.`reportto` AS `reportto`,`crmuser`.`role` AS `role`,`crmuser`.`pl1` AS `pl1`,`crmuser`.`pl2` AS `pl2`,`crmuser`.`pl4` AS `pl4`,`crmuser`.`pl5` AS `pl5`,`crmuser`.`city` AS `city`,`crmuser`.`department` AS `department`,`crmuser`.`whenadded` AS `whenadded`,`crmuser`.`modifier` AS `modifier`,`crmuser`.`modify_datetime` AS `modify_datetime`,`crmuser`.`owner` AS `owner`,`crmuser`.`level` AS `level` from `crmuser` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `parent_user_info` +-- + +/*!50001 DROP TABLE IF EXISTS `parent_user_info`*/; +/*!50001 DROP VIEW IF EXISTS `parent_user_info`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `parent_user_info` AS select `userinfo`.`id` AS `id`,`userinfo`.`name` AS `name`,`userinfo`.`department` AS `department`,`userinfo`.`division` AS `division`,`userinfo`.`cellPhone` AS `cellPhone`,`userinfo`.`email` AS `email`,`userinfo`.`employeeNumber` AS `employeeNumber`,`userinfo`.`photo` AS `photo`,`userinfo`.`jobTitle` AS `jobTitle`,`userinfo`.`pl1` AS `pl1`,`userinfo`.`pl2` AS `pl2`,`userinfo`.`role` AS `role`,`userinfo`.`pl4` AS `pl4`,`userinfo`.`pl5` AS `pl5`,`userinfo`.`sex` AS `sex`,`userinfo`.`loginName` AS `loginName`,`userinfo`.`password` AS `password`,`userinfo`.`sessionKey` AS `sessionKey`,`userinfo`.`lastLoginTime` AS `lastLoginTime`,`userinfo`.`whenadded` AS `whenadded`,`userinfo`.`parcel` AS `parcel`,`userinfo`.`modifier` AS `modifier`,`userinfo`.`modify_datetime` AS `modify_datetime`,`userinfo`.`owner` AS `owner`,`userinfo`.`province` AS `province`,`userinfo`.`city` AS `city`,`userinfo`.`office_tel` AS `office_tel`,`userinfo`.`num_of_signIn` AS `num_of_signIn` from `userinfo` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `parent_user_position` +-- + +/*!50001 DROP TABLE IF EXISTS `parent_user_position`*/; +/*!50001 DROP VIEW IF EXISTS `parent_user_position`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `parent_user_position` AS select `user_position`.`id` AS `id`,`user_position`.`userId` AS `userId`,`user_position`.`positionId` AS `positionId`,`user_position`.`status` AS `status`,`user_position`.`createtime` AS `createtime`,`user_position`.`isPrimary` AS `isPrimary`,`user_position`.`externalId` AS `externalId`,`user_position`.`whenadded` AS `whenadded`,`user_position`.`modifier` AS `modifier`,`user_position`.`modify_datetime` AS `modify_datetime` from `user_position` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `user_position_account` +-- + +/*!50001 DROP TABLE IF EXISTS `user_position_account`*/; +/*!50001 DROP VIEW IF EXISTS `user_position_account`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `user_position_account` AS select `ac`.`id` AS `id`,`u`.`name` AS `userName`,`u`.`loginName` AS `loginName`,`u`.`email` AS `email`,`sp`.`val` AS `sex`,`u`.`whenadded` AS `addTime`,`c`.`name` AS `positionName`,`c`.`code` AS `positionCode`,(select `crm`.`name` from `crmuser` `crm` where (`crm`.`id` = `c`.`reportto`)) AS `reportTo`,(select `c1`.`name` from `crmuser` `c1` where (`c1`.`id` = (select `c2`.`reportto` from `crmuser` `c2` where (`c2`.`id` = `c`.`reportto`)))) AS `reporttto`,`r`.`val` AS `role`,`rlp4`.`val` AS `regoin1`,`rlp5`.`val` AS `regoin2`,`ct`.`val` AS `city`,`a`.`name` AS `accountName`,`a`.`bdm_code` AS `BDMCode`,`aalp`.`val` AS `adminLevel`,`asp`.`val` AS `status` from (((((((((((`userinfo` `u` left join `sex_pl` `sp` on((`u`.`sex` = `sp`.`id`))) left join `user_position` `up` on((`u`.`id` = `up`.`userId`))) left join `crmuser` `c` on((`up`.`positionId` = `c`.`id`))) left join `role` `r` on((`c`.`role` = `r`.`id`))) left join `region_level1_pl` `rlp4` on((`c`.`pl4` = `rlp4`.`id`))) left join `region_level1_pl` `rlp5` on((`c`.`pl5` = `rlp5`.`id`))) left join `city` `ct` on((`c`.`city` = `ct`.`id`))) left join `accountcrmuser` `ac` on((`c`.`id` = `ac`.`crmuserId`))) left join `account` `a` on((`ac`.`accountId` = `a`.`id`))) left join `account_status_pl` `asp` on((`a`.`status` = `asp`.`id`))) left join `account_administrativ_level_pl` `aalp` on((`a`.`administrativ_level` = `aalp`.`id`))) where (`up`.`status` = 1) order by `ac`.`id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `user_position_query` +-- + +/*!50001 DROP TABLE IF EXISTS `user_position_query`*/; +/*!50001 DROP VIEW IF EXISTS `user_position_query`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`crm`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `user_position_query` AS select `user_position`.`userId` AS `user_id`,`user_position`.`positionId` AS `position_id`,`region_level1_pl`.`val` AS `area`,`region_level2_pl`.`val` AS `region`,`province`.`val` AS `province`,`crmuser_pl2`.`val` AS `productLine`,`crmuser`.`level` AS `position_level`,`crmuser`.`name` AS `position_name`,`crmuser`.`code` AS `position_code`,`userinfo`.`employeeNumber` AS `delegatePosition`,`userinfo`.`name` AS `delegateName`,`parent_position`.`id` AS `manager_position_id`,`parent_position`.`code` AS `managerPosition`,`parent_position`.`name` AS `manager_position_name`,`parent_position`.`level` AS `manager_position_level`,`parent_user_info`.`employeeNumber` AS `manager_employee_number`,`parent_user_info`.`name` AS `regionManager`,`account`.`name` AS `accountName`,`account`.`bdm_code` AS `BDMcode` from (((((((((((`user_position` left join `crmuser` on((`user_position`.`positionId` = `crmuser`.`id`))) left join `userinfo` on((`user_position`.`userId` = `userinfo`.`id`))) left join `parent_position` on((`crmuser`.`reportto` = `parent_position`.`id`))) left join `parent_user_position` on((`parent_position`.`id` = `parent_user_position`.`positionId`))) left join `parent_user_info` on((`parent_user_position`.`userId` = `parent_user_info`.`id`))) join `accountcrmuser` on((`user_position`.`positionId` = `accountcrmuser`.`crmuserId`))) join `account` on((`accountcrmuser`.`accountId` = `account`.`id`))) left join `region_level1_pl` on((`crmuser`.`pl4` = `region_level1_pl`.`id`))) left join `region_level2_pl` on((`crmuser`.`pl5` = `region_level2_pl`.`id`))) left join `province` on((`account`.`province` = `province`.`id`))) left join `crmuser_pl2` on((`crmuser_pl2`.`id` = `crmuser`.`pl2`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1581,4 +2266,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2013-10-17 16:06:41 +-- Dump completed on 2013-11-26 23:55:19 diff --git a/crm/src/main/db/load.sql b/crm/src/main/db/load.sql index 847db6c..ceb1d92 100644 --- a/crm/src/main/db/load.sql +++ b/crm/src/main/db/load.sql @@ -1,117 +1,467 @@ -INSERT INTO account_pl1 (val) VALUES ('有效'); -INSERT INTO account_pl1 (val) VALUES('无效'); -INSERT INTO account_pl1 (val) VALUES('终止'); -INSERT INTO account_pl1 (val) VALUES('候选'); - - --- 医院分级; -INSERT INTO account_pl2 (val) VALUES('A'); -INSERT INTO account_pl2 (val) VALUES('B'); -INSERT INTO account_pl2 (val) VALUES('C'); -INSERT INTO account_pl2 (val) VALUES('D'); - --- 重点医院; -INSERT INTO account_pl3 (val) VALUES('是'); -INSERT INTO account_pl3 (val) VALUES('否'); - --- 市场分类; -INSERT INTO account_pl4 (val) VALUES('一级城市'); -INSERT INTO account_pl4 (val) VALUES('二级城市'); -INSERT INTO account_pl4 (val) VALUES('战略城市'); - --- 客户中国区域; -INSERT INTO account_pl5 (val) VALUES('北中国'); -INSERT INTO account_pl5 (val) VALUES('南中国'); -INSERT INTO account_pl5 (val) VALUES('东中国'); - - --- 医院类型; -INSERT INTO account_pl6 (val) VALUES('麻药目标医院'); -INSERT INTO account_pl6 (val) VALUES('慢痛目标医院'); -INSERT INTO account_pl6 (val) VALUES('其他'); +drop table if exists boolean_pl; +CREATE TABLE boolean_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO boolean_pl (val) VALUES('是'); +INSERT INTO boolean_pl (val) VALUES('否'); + +-- 医院行政级别 +drop table if exists account_administrativ_level_pl; +CREATE TABLE account_administrativ_level_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_administrativ_level_pl (val) VALUES('一级'); +INSERT INTO account_administrativ_level_pl (val) VALUES('一级甲等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('一级乙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('一级丙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('二级'); +INSERT INTO account_administrativ_level_pl (val) VALUES('二级甲等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('二级乙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('二级丙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('三级'); +INSERT INTO account_administrativ_level_pl (val) VALUES('三级甲等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('三级乙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('三级丙等'); +INSERT INTO account_administrativ_level_pl (val) VALUES('未评级未评等'); + +-- 医院分级 +drop table if exists account_grade_pl; +CREATE TABLE account_grade_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_grade_pl (val) VALUES('A'); +INSERT INTO account_grade_pl (val) VALUES('B'); +INSERT INTO account_grade_pl (val) VALUES('C'); +INSERT INTO account_grade_pl (val) VALUES('D'); + + +-- 医院状态 +drop table if exists account_status_pl; +CREATE TABLE account_status_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_status_pl (val) VALUES ('无效'); +INSERT INTO account_status_pl (val) VALUES('有效'); + + +drop table if exists account_local_or_army_pl; +CREATE TABLE account_local_or_army_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_local_or_army_pl (val) VALUES ('地方医院'); +INSERT INTO account_local_or_army_pl (val) VALUES('部队医院'); + +drop table if exists account_comprehensive_or_specialized_pl; +CREATE TABLE account_comprehensive_or_specialized_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_comprehensive_or_specialized_pl (val) VALUES ('综合医院'); +INSERT INTO account_comprehensive_or_specialized_pl (val) VALUES('专科医院'); + + +drop table if exists account_market_classification_pl; +CREATE TABLE account_market_classification_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_market_classification_pl (val) VALUES ('战略城市'); +INSERT INTO account_market_classification_pl (val) VALUES('一级城市'); +INSERT INTO account_market_classification_pl (val) VALUES('二级城市'); +INSERT INTO account_market_classification_pl (val) VALUES('三级城市'); +INSERT INTO account_market_classification_pl (val) VALUES('四级城市'); + +drop table if exists account_type_pl; +CREATE TABLE account_type_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_type_pl (val) VALUES ('癌痛目标医院'); +INSERT INTO account_type_pl (val) VALUES('慢痛目标医院'); +INSERT INTO account_type_pl (val) VALUES('奥诺美目标医院'); +INSERT INTO account_type_pl (val) VALUES('非目标医院'); + +drop table if exists account_point_pl; +CREATE TABLE account_point_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO account_point_pl (val) VALUES ('癌痛重点医院'); +INSERT INTO account_point_pl (val) VALUES('慢痛重点医院'); +INSERT INTO account_point_pl (val) VALUES('奥诺美重点医院'); +INSERT INTO account_point_pl (val) VALUES('非重点医院'); + + +--activity related picklist +-- 类型 +drop table if exists activity_event_type_pl; +CREATE TABLE activity_event_type_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO activity_event_type_pl (val) VALUES('拜访'); +INSERT INTO activity_event_type_pl (val) VALUES('辅导'); + +-- 活动状态; +drop table if exists activity_status_pl; +CREATE TABLE activity_status_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO activity_status_pl (val) VALUES('计划'); +INSERT INTO activity_status_pl (val) VALUES('完成'); +INSERT INTO activity_status_pl (val) VALUES('取消'); + +drop table if exists activity_activity_types_pl; +CREATE TABLE activity_activity_types_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO activity_activity_types_pl (val) VALUES('专业化拜访'); +INSERT INTO activity_activity_types_pl (val) VALUES('事务性拜访'); + +drop table if exists activity_visiting_purpose_pl; +CREATE TABLE activity_visiting_purpose_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + activity_type MEDIUMINT, + parentId MEDIUMINT, + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('传递产品知识',1,1); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('处方观念沟通',1,1); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('病例沟通',1,1); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('会议安排',2,2); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('会议跟进',2,2); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('交接工作',2,2); +INSERT INTO activity_visiting_purpose_pl (val,activity_type,parentId) VALUES('了解竞争',2,2); + +-- 拜访目的1 +drop table if exists sales_visiting_purpose_pl; +CREATE TABLE sales_visiting_purpose_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO sales_visiting_purpose_pl (val) VALUES('会议安排'); +INSERT INTO sales_visiting_purpose_pl (val) VALUES('会议跟进'); +INSERT INTO sales_visiting_purpose_pl (val) VALUES('交接工作'); +INSERT INTO sales_visiting_purpose_pl (val) VALUES('了解竞争'); + +-- 拜访目的2 +drop table if exists com_visiting_purpose_pl; +CREATE TABLE com_visiting_purpose_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO com_visiting_purpose_pl (val) VALUES('处方观念沟通'); +INSERT INTO com_visiting_purpose_pl (val) VALUES('病例沟通'); + + +drop table if exists activity_feature_product_pl; +CREATE TABLE activity_feature_product_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO activity_feature_product_pl (val) VALUES('美施康定'); +INSERT INTO activity_feature_product_pl (val) VALUES('奥施康定'); +INSERT INTO activity_feature_product_pl (val) VALUES('奇曼丁'); +INSERT INTO activity_feature_product_pl (val) VALUES('若思本'); +INSERT INTO activity_feature_product_pl (val) VALUES('奥诺美'); -- 性别; +drop table if exists sex_pl; +CREATE TABLE sex_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; INSERT INTO sex_pl (val) VALUES('男'); INSERT INTO sex_pl (val) VALUES('女'); - --- 科室; +-- 科室 +drop table if exists contact_department_pl; +CREATE TABLE contact_department_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; INSERT INTO contact_department_pl (val) VALUES('ICU'); +INSERT INTO contact_department_pl (val) VALUES('保健科'); +INSERT INTO contact_department_pl (val) VALUES('采购科'); +INSERT INTO contact_department_pl (val) VALUES('传染科'); +INSERT INTO contact_department_pl (val) VALUES('创伤外科'); +INSERT INTO contact_department_pl (val) VALUES('儿科'); +INSERT INTO contact_department_pl (val) VALUES('耳鼻喉科'); +INSERT INTO contact_department_pl (val) VALUES('方便门诊'); +INSERT INTO contact_department_pl (val) VALUES('放化疗科'); +INSERT INTO contact_department_pl (val) VALUES('放疗科'); +INSERT INTO contact_department_pl (val) VALUES('放射科'); +INSERT INTO contact_department_pl (val) VALUES('风湿科'); +INSERT INTO contact_department_pl (val) VALUES('妇产科'); +INSERT INTO contact_department_pl (val) VALUES('妇科'); +INSERT INTO contact_department_pl (val) VALUES('肝胆外科'); +INSERT INTO contact_department_pl (val) VALUES('感染科'); +INSERT INTO contact_department_pl (val) VALUES('肛肠科'); +INSERT INTO contact_department_pl (val) VALUES('姑息科'); +INSERT INTO contact_department_pl (val) VALUES('骨科'); +INSERT INTO contact_department_pl (val) VALUES('国际医疗科'); +INSERT INTO contact_department_pl (val) VALUES('核医学科'); +INSERT INTO contact_department_pl (val) VALUES('呼吸内科'); +INSERT INTO contact_department_pl (val) VALUES('护理部'); +INSERT INTO contact_department_pl (val) VALUES('急诊科'); +INSERT INTO contact_department_pl (val) VALUES('介入科'); +INSERT INTO contact_department_pl (val) VALUES('康复科'); +INSERT INTO contact_department_pl (val) VALUES('口腔科'); +INSERT INTO contact_department_pl (val) VALUES('老干科'); +INSERT INTO contact_department_pl (val) VALUES('麻醉科'); +INSERT INTO contact_department_pl (val) VALUES('泌尿外科'); +INSERT INTO contact_department_pl (val) VALUES('脑外科'); +INSERT INTO contact_department_pl (val) VALUES('内分泌科'); INSERT INTO contact_department_pl (val) VALUES('内科'); +INSERT INTO contact_department_pl (val) VALUES('宁养院'); +INSERT INTO contact_department_pl (val) VALUES('皮肤科'); +INSERT INTO contact_department_pl (val) VALUES('普外科'); +INSERT INTO contact_department_pl (val) VALUES('乳腺外科'); +INSERT INTO contact_department_pl (val) VALUES('烧伤整形科'); +INSERT INTO contact_department_pl (val) VALUES('神经科'); +INSERT INTO contact_department_pl (val) VALUES('神经内科'); +INSERT INTO contact_department_pl (val) VALUES('神经外科'); +INSERT INTO contact_department_pl (val) VALUES('肾内科'); +INSERT INTO contact_department_pl (val) VALUES('生物治疗科'); +INSERT INTO contact_department_pl (val) VALUES('特需科'); +INSERT INTO contact_department_pl (val) VALUES('疼痛科'); INSERT INTO contact_department_pl (val) VALUES('外科'); -INSERT INTO contact_department_pl (val) VALUES('中医科'); -INSERT INTO contact_department_pl (val) VALUES('化疗科'); -INSERT INTO contact_department_pl (val) VALUES('关怀科'); -INSERT INTO contact_department_pl (val) VALUES('牙科'); -INSERT INTO contact_department_pl (val) VALUES('急症科'); -INSERT INTO contact_department_pl (val) VALUES('骨科'); -INSERT INTO contact_department_pl (val) VALUES('肝胆外科'); +INSERT INTO contact_department_pl (val) VALUES('微创科'); +INSERT INTO contact_department_pl (val) VALUES('胃肠外科'); +INSERT INTO contact_department_pl (val) VALUES('消化科'); +INSERT INTO contact_department_pl (val) VALUES('消化内科'); +INSERT INTO contact_department_pl (val) VALUES('消化外科'); +INSERT INTO contact_department_pl (val) VALUES('心内科'); +INSERT INTO contact_department_pl (val) VALUES('心胸外科'); +INSERT INTO contact_department_pl (val) VALUES('血管外科'); +INSERT INTO contact_department_pl (val) VALUES('血透室'); INSERT INTO contact_department_pl (val) VALUES('血液科'); -INSERT INTO contact_department_pl (val) VALUES('风湿科'); -INSERT INTO contact_department_pl (val) VALUES('呼吸科'); - --- 职务; +INSERT INTO contact_department_pl (val) VALUES('药剂科'); +INSERT INTO contact_department_pl (val) VALUES('医保办'); +INSERT INTO contact_department_pl (val) VALUES('医务科'); +INSERT INTO contact_department_pl (val) VALUES('整形美容科'); +INSERT INTO contact_department_pl (val) VALUES('质控科'); +INSERT INTO contact_department_pl (val) VALUES('中西医结合科'); +INSERT INTO contact_department_pl (val) VALUES('中医科'); +INSERT INTO contact_department_pl (val) VALUES('肿瘤科'); +INSERT INTO contact_department_pl (val) VALUES('肿瘤内科'); +INSERT INTO contact_department_pl (val) VALUES('肿瘤外科'); +INSERT INTO contact_department_pl (val) VALUES('综合科'); +INSERT INTO contact_department_pl (val) VALUES('其他'); + +-- 行政职务; +drop table if exists contact_duty_pl; +CREATE TABLE contact_duty_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; + +INSERT INTO contact_duty_pl (val) VALUES('医生'); +INSERT INTO contact_duty_pl (val) VALUES('副主任'); INSERT INTO contact_duty_pl (val) VALUES('主任'); -INSERT INTO contact_duty_pl (val) VALUES('主治医师'); -INSERT INTO contact_duty_pl (val) VALUES('科室主任'); -INSERT INTO contact_duty_pl (val) VALUES('采购'); -INSERT INTO contact_duty_pl (val) VALUES('科室主任'); -INSERT INTO contact_duty_pl (val) VALUES('院长'); INSERT INTO contact_duty_pl (val) VALUES('副院长'); +INSERT INTO contact_duty_pl (val) VALUES('院长'); +INSERT INTO contact_duty_pl (val) VALUES('院长助理'); +INSERT INTO contact_duty_pl (val) VALUES('副书记'); +INSERT INTO contact_duty_pl (val) VALUES('书记'); +INSERT INTO contact_duty_pl (val) VALUES('护士'); +INSERT INTO contact_duty_pl (val) VALUES('护士长'); +INSERT INTO contact_duty_pl (val) VALUES('库管'); +INSERT INTO contact_duty_pl (val) VALUES('采购'); +INSERT INTO contact_duty_pl (val) VALUES('采购科科长'); +INSERT INTO contact_duty_pl (val) VALUES('药师'); +INSERT INTO contact_duty_pl (val) VALUES('药剂科副主任'); INSERT INTO contact_duty_pl (val) VALUES('药剂科主任'); - --- 职称; -INSERT INTO contact_pl3 (val) VALUES('住院医师'); -INSERT INTO contact_pl3 (val) VALUES('主治医师'); -INSERT INTO contact_pl3 (val) VALUES('副主任医师'); -INSERT INTO contact_pl3 (val) VALUES('主任医师'); -INSERT INTO contact_pl3 (val) VALUES('护士'); -INSERT INTO contact_pl3 (val) VALUES('主管护师'); -INSERT INTO contact_pl3 (val) VALUES('药师'); -INSERT INTO contact_pl3 (val) VALUES('技师'); - - --- 主要产品; -INSERT INTO contact_pl4 (val) VALUES('奥施康定'); -INSERT INTO contact_pl4 (val) VALUES('奇曼丁'); -INSERT INTO contact_pl4 (val) VALUES('意施丁'); -INSERT INTO contact_pl4 (val) VALUES('综合'); -INSERT INTO contact_pl4 (val) VALUES('麻药'); -INSERT INTO contact_pl4 (val) VALUES('慢痛'); +INSERT INTO contact_duty_pl (val) VALUES('医务科副科长'); +INSERT INTO contact_duty_pl (val) VALUES('医务科科长'); +INSERT INTO contact_duty_pl (val) VALUES('医保办主任'); +INSERT INTO contact_duty_pl (val) VALUES('科教科主任'); +INSERT INTO contact_duty_pl (val) VALUES('信息科科长'); +INSERT INTO contact_duty_pl (val) VALUES('其他'); + + +-- 专业职务; +drop table if exists contact_job_title_pl; +CREATE TABLE contact_job_title_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO contact_job_title_pl (val) VALUES('住院医师'); +INSERT INTO contact_job_title_pl (val) VALUES('主治医师'); +INSERT INTO contact_job_title_pl (val) VALUES('副主任医师'); +INSERT INTO contact_job_title_pl (val) VALUES('主任医师'); +INSERT INTO contact_job_title_pl (val) VALUES('护士'); +INSERT INTO contact_job_title_pl (val) VALUES('主管护师'); +INSERT INTO contact_job_title_pl (val) VALUES('副主任护士'); +INSERT INTO contact_job_title_pl (val) VALUES('主任护师'); +INSERT INTO contact_job_title_pl (val) VALUES('药师'); +INSERT INTO contact_job_title_pl (val) VALUES('主管药师'); +INSERT INTO contact_job_title_pl (val) VALUES('副主任药师'); +INSERT INTO contact_job_title_pl (val) VALUES('主任药师'); +INSERT INTO contact_job_title_pl (val) VALUES('技师'); +INSERT INTO contact_job_title_pl (val) VALUES('主管技师'); +INSERT INTO contact_job_title_pl (val) VALUES('副主任技师'); +INSERT INTO contact_job_title_pl (val) VALUES('主任技师'); +INSERT INTO contact_job_title_pl (val) VALUES('其他'); -- 状态; -INSERT INTO contact_pl5 (val) VALUES('有效'); -INSERT INTO contact_pl5 (val) VALUES('无效'); - --- 医生分级 -INSERT INTO contact_pl6 (val) VALUES('A'); -INSERT INTO contact_pl6 (val) VALUES('B'); -INSERT INTO contact_pl6 (val) VALUES('C'); -INSERT INTO contact_pl6 (val) VALUES('D'); - +drop table if exists contact_status_pl; +CREATE TABLE contact_status_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO contact_status_pl (val) VALUES('无效'); +INSERT INTO contact_status_pl (val) VALUES('有效'); + +-- 级别; +drop table if exists contact_grade_pl; +CREATE TABLE contact_grade_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO contact_grade_pl (val) VALUES('A'); +INSERT INTO contact_grade_pl (val) VALUES('B'); +INSERT INTO contact_grade_pl (val) VALUES('C'); +INSERT INTO contact_grade_pl (val) VALUES('D'); + +drop table if exists contact_market_classification_pl; +CREATE TABLE contact_market_classification_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO contact_market_classification_pl (val) VALUES ('战略城市'); +INSERT INTO contact_market_classification_pl (val) VALUES('一级城市'); +INSERT INTO contact_market_classification_pl (val) VALUES('二级城市'); +INSERT INTO contact_market_classification_pl (val) VALUES('三级城市'); +INSERT INTO contact_market_classification_pl (val) VALUES('四级城市'); + + +drop table if exists contact_generalization_target_pl; +CREATE TABLE contact_generalization_target_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO contact_generalization_target_pl (val) VALUES ('美施康定'); +INSERT INTO contact_generalization_target_pl (val) VALUES('奥施康定'); +INSERT INTO contact_generalization_target_pl (val) VALUES('奇曼丁'); +INSERT INTO contact_generalization_target_pl (val) VALUES('若思本'); +INSERT INTO contact_generalization_target_pl (val) VALUES('奥诺美'); + + +-- pick list for crmuser -- 状态; -INSERT INTO crmuser_pl1 (val) VALUES('有效'); -INSERT INTO crmuser_pl1 (val) VALUES('无效'); +drop table if exists crmuser_pl1; +CREATE TABLE crmuser_pl1 +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO `crmuser_pl1` (val) VALUES ('无效'); +INSERT INTO `crmuser_pl1` (val) VALUES ('有效'); -- 产品线; -INSERT INTO crmuser_pl2 (val) VALUES('麻药'); -INSERT INTO crmuser_pl2 (val) VALUES('慢痛'); -INSERT INTO crmuser_pl2 (val) VALUES('全部'); - - --- 角色; -INSERT INTO role (val) VALUES('高级用户'); -INSERT INTO role (val) VALUES('主管'); -INSERT INTO role (val) VALUES('销售代表'); --- INSERT INTO role (val) VALUES('区域经理'); --- INSERT INTO role (val) VALUES('服务经理'); - +drop table if exists crmuser_pl2; +CREATE TABLE crmuser_pl2 +( + id MEDIUMINT NOT NULL, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +-- 产品线; +INSERT INTO crmuser_pl2 (id,val) VALUES(1,'麻药'); +INSERT INTO crmuser_pl2 (id,val) VALUES(2,'慢痛'); +INSERT INTO crmuser_pl2 (id,val) VALUES(3,'奥诺美'); +INSERT INTO crmuser_pl2 (id,val) VALUES(4,'全部'); + + +-- 角色; +drop table if exists role; +CREATE TABLE role +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; +INSERT INTO `role` (val) VALUES ('管理员'); +INSERT INTO `role` (val) VALUES ('销售经理'); +INSERT INTO `role` (val) VALUES ('销售代表'); + +-- 一级区域; +drop table if exists region_level1_pl; +CREATE TABLE region_level1_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; --- 一级区域; INSERT INTO region_level1_pl (val) VALUES('北中国'); INSERT INTO region_level1_pl (val) VALUES('南中国'); INSERT INTO region_level1_pl (val) VALUES('东中国'); --- 二级区域; +-- 二级区域; +drop table if exists region_level2_pl; +CREATE TABLE region_level2_pl +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; INSERT INTO region_level2_pl (val) VALUES('华北'); INSERT INTO region_level2_pl (val) VALUES('西北'); INSERT INTO region_level2_pl (val) VALUES('东北'); @@ -120,28 +470,106 @@ INSERT INTO region_level2_pl (val) VALUES('华南'); INSERT INTO region_level2_pl (val) VALUES('华中'); INSERT INTO region_level2_pl (val) VALUES('华东'); +-- END of pick list for crmuser + +drop table if exists city; +CREATE TABLE city +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + provinceId VARCHAR(255) NOT NULL, + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; + +drop table if exists province; +CREATE TABLE province +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; + + -- 拜访类型 INSERT INTO activity_types (val) VALUES('拜访'); INSERT INTO activity_types (val) VALUES('外部会议'); INSERT INTO activity_types (val) VALUES('内部会议'); +DROP TABLE IF EXISTS `score1_pl`; +CREATE TABLE `score1_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `score1_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'); --- 拜访状态 -INSERT INTO activity_status (val) VALUES('计划'); -INSERT INTO activity_status (val) VALUES('完成'); +DROP TABLE IF EXISTS `score2_pl`; +CREATE TABLE `score2_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `score2_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'),(16,'16'),(17,'17'),(18,'18'),(19,'19'),(20,'20'); --- ramdom update table -UPDATE activity SET contactId = FLOOR(78* RAND()+1); +DROP TABLE IF EXISTS `crmuser_activited`; +CREATE TABLE `crmdb`.`crmuser_activited` ( + `id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB; +INSERT INTO `crmdb`.`crmuser_activited` (`id`, `val`) VALUES ('1', '已激活'); +INSERT INTO `crmdb`.`crmuser_activited` (`id`, `val`) VALUES ('2', '未激活'); -INSERT INTO contactcrmuser (contactId,crmuserId) VALUES(FLOOR(78* RAND()+1),20); +DROP TABLE IF EXISTS `area`; +DROP TABLE IF EXISTS `city`; +DROP TABLE IF EXISTS `province`; + +DROP TABLE IF EXISTS `area`; +CREATE TABLE `area` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `area_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `city` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE InnoDB; +DROP TABLE IF EXISTS `city`; +CREATE TABLE `city` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `city_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE InnoDB; + +DROP TABLE IF EXISTS `province`; +CREATE TABLE `province` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE InnoDB; + + +insert into crmuser (id,name) values(-1,"dummy"); +insert into account (id,name) values(-1,"dummy"); +insert into contact (id,name,accountId) values(-1,"dummy",-1); + + + + + +-- ramdom update table for testing purpose +UPDATE activity SET contactId = FLOOR(78* RAND()+1); +INSERT INTO contactcrmuser (contactId,crmuserId) VALUES(FLOOR(78* RAND()+1),20); UPDATE crmuser SET loginName = FLOOR(1000000* RAND()+1000); UPDATE crmuser SET password = FLOOR(1000000* RAND()+1000); UPDATE crmuser SET sessionKey = FLOOR(1000000* RAND()+1000); - diff --git a/crm/src/main/db/setup.sql b/crm/src/main/db/setup.sql index c8c3930..f89b7ba 100644 --- a/crm/src/main/db/setup.sql +++ b/crm/src/main/db/setup.sql @@ -1,6 +1,13 @@ - USE crmdb; +drop table if exists accountcrmuser; +drop table if exists activitycrmuser; +drop table if exists contactcrmuser; +drop table if exists activity; +drop table if exists contact; +drop table if exists crmuser; +drop table if exists account; + drop table if exists account; CREATE TABLE account ( @@ -32,8 +39,8 @@ CREATE TABLE account tel VARCHAR(255), fax VARCHAR(255), market_classification MEDIUMINT, - province VARCHAR(255), - city VARCHAR(255), + province int(11), + city int(11), districts VARCHAR(255), address VARCHAR(255), owner VARCHAR(255), @@ -41,124 +48,38 @@ CREATE TABLE account modifier VARCHAR(255), modify_datetime DATETIME, responsible_person VARCHAR(255), + UNIQUE INDEX `account_ix_01` (`bdm_code` ASC), PRIMARY KEY USING BTREE (id) ) ENGINE InnoDB; -drop table if exists boolean_pl; -CREATE TABLE boolean_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO boolean_pl (val) VALUES('是'); -INSERT INTO boolean_pl (val) VALUES('否'); - --- 医院行政级别 -drop table if exists account_administrativ_level_pl; -CREATE TABLE account_administrativ_level_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_administrativ_level_pl (val) VALUES('一级'); -INSERT INTO account_administrativ_level_pl (val) VALUES('一级甲等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('一级乙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('一级丙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('二级'); -INSERT INTO account_administrativ_level_pl (val) VALUES('二级甲等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('二级乙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('二级丙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('三级'); -INSERT INTO account_administrativ_level_pl (val) VALUES('三级甲等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('三级乙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('三级丙等'); -INSERT INTO account_administrativ_level_pl (val) VALUES('未评级未评等'); - --- 医院分级 -drop table if exists account_grade_pl; -CREATE TABLE account_grade_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_grade_pl (val) VALUES('A'); -INSERT INTO account_grade_pl (val) VALUES('B'); -INSERT INTO account_grade_pl (val) VALUES('C'); -INSERT INTO account_grade_pl (val) VALUES('D'); - - --- 医院状态 -drop table if exists account_status_pl; -CREATE TABLE account_status_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_status_pl (val) VALUES ('无效'); -INSERT INTO account_status_pl (val) VALUES('有效'); - - -drop table if exists account_local_or_army_pl; -CREATE TABLE account_local_or_army_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_local_or_army_pl (val) VALUES ('地方医院'); -INSERT INTO account_local_or_army_pl (val) VALUES('部队医院'); - -drop table if exists account_comprehensive_or_specialized_pl; -CREATE TABLE account_comprehensive_or_specialized_pl +drop table if exists crmuser; +CREATE TABLE crmuser ( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) + id MEDIUMINT NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + code varchar(255), + reportto MEDIUMINT, + role MEDIUMINT, + pl1 MEDIUMINT, + pl2 MEDIUMINT, + pl4 MEDIUMINT, + pl5 MEDIUMINT, + city VARCHAR(255), + department VARCHAR(255), + whenadded DATETIME, + modifier VARCHAR(255), + modify_datetime date, + owner VARCHAR(255), + level MEDIUMINT, + PRIMARY KEY USING BTREE (id) ) ENGINE InnoDB; -INSERT INTO account_comprehensive_or_specialized_pl (val) VALUES ('综合医院'); -INSERT INTO account_comprehensive_or_specialized_pl (val) VALUES('专科医院'); +insert into crmuser (id,name,code,reportto,role) values +(-1,'无','BJ',0,-1), +(1,'管理员','BJ231011001',-1,1), +(2,'北区地区经理01','BJ131011001',1,2), +(3,'北区代表001','BJ131001001',2,3); -drop table if exists account_market_classification_pl; -CREATE TABLE account_market_classification_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_market_classification_pl (val) VALUES ('战略城市'); -INSERT INTO account_market_classification_pl (val) VALUES('一级城市'); -INSERT INTO account_market_classification_pl (val) VALUES('二级城市'); -INSERT INTO account_market_classification_pl (val) VALUES('三级城市'); -INSERT INTO account_market_classification_pl (val) VALUES('四级城市'); - -drop table if exists account_type_pl; -CREATE TABLE account_type_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_type_pl (val) VALUES ('癌痛目标医院'); -INSERT INTO account_type_pl (val) VALUES('慢痛目标医院'); -INSERT INTO account_type_pl (val) VALUES('奥诺美目标医院'); -INSERT INTO account_type_pl (val) VALUES('非目标医院'); - -drop table if exists account_point_pl; -CREATE TABLE account_point_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO account_point_pl (val) VALUES ('癌痛重点医院'); -INSERT INTO account_point_pl (val) VALUES('慢痛重点医院'); -INSERT INTO account_point_pl (val) VALUES('奥诺美重点医院'); -INSERT INTO account_point_pl (val) VALUES('非重点医院'); drop table if exists accountcrmuser; CREATE TABLE accountcrmuser @@ -167,38 +88,44 @@ CREATE TABLE accountcrmuser accountId MEDIUMINT NOT NULL, crmuserId MEDIUMINT NOT NULL, UNIQUE KEY(accountId,crmuserId), - PRIMARY KEY USING BTREE (id) + PRIMARY KEY USING BTREE (id), + CONSTRAINT `account_crmuser_cons` FOREIGN KEY (`accountId`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `account_crmuser_cons2` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE InnoDB; -drop table if exists externalMeeting; -CREATE TABLE externalMeeting +drop table if exists contact; +CREATE TABLE contact ( id MEDIUMINT NOT NULL AUTO_INCREMENT, - crmuserId MEDIUMINT NOT NULL, - endtime BIGINT, - starttime BIGINT NOT NULL DEFAULT 0, - title VARCHAR(128), - contactIds VARCHAR(512), - status MEDIUMINT, - activity_type MEDIUMINT, - PRIMARY KEY USING BTREE (id) + name VARCHAR(255) NOT NULL, + accountId MEDIUMINT NOT NULL, + department VARCHAR(255), + sex MEDIUMINT, + native_place VARCHAR(255), + office_tel VARCHAR(255), + office_fax VARCHAR(255), + cellphone VARCHAR(255), + email VARCHAR(255), + status VARCHAR(255), + market_classification MEDIUMINT, + grade MEDIUMINT, + province int(11), + city int(11), + districts VARCHAR(255), + duty MEDIUMINT, + job_title MEDIUMINT, + visiting_target MEDIUMINT, + product_target VARCHAR(255), + owner VARCHAR(255), + whenadded DATETIME, + modifier VARCHAR(255), + modify_datetime DATETIME, + responsible_person VARCHAR(255), + PRIMARY KEY USING BTREE (id), + CONSTRAINT `account_id_cons` FOREIGN KEY (`accountId`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE InnoDB; -ALTER table externalMeeting ADD coachId MEDIUMINT; -drop table if exists internalMeeting; -CREATE TABLE internalMeeting -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - crmuserId MEDIUMINT NOT NULL, - endtime BIGINT, - starttime BIGINT NOT NULL DEFAULT 0, - title VARCHAR(128), - contactId MEDIUMINT, - crmusermanagerId MEDIUMINT, - status MEDIUMINT, - activity_type MEDIUMINT, - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; + drop table if exists activity; CREATE TABLE activity @@ -213,6 +140,7 @@ CREATE TABLE activity participants VARCHAR(512), activity_type MEDIUMINT, contactId MEDIUMINT, + coacheeId int(32), status MEDIUMINT, visiting_purpose MEDIUMINT, feature_product MEDIUMINT, @@ -222,96 +150,19 @@ CREATE TABLE activity modifier VARCHAR(255), modify_datetime DATETIME, responsible_person VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - --- 类型 -drop table if exists activity_event_type_pl; -CREATE TABLE activity_event_type_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO activity_event_type_pl (val) VALUES('拜访'); -INSERT INTO activity_event_type_pl (val) VALUES('辅导'); - --- 活动状态; -drop table if exists activity_status_pl; -CREATE TABLE activity_status_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO activity_status_pl (val) VALUES('计划'); -INSERT INTO activity_status_pl (val) VALUES('完成'); -INSERT INTO activity_status_pl (val) VALUES('取消'); - -drop table if exists activity_activity_types_pl; -CREATE TABLE activity_activity_types_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO activity_activity_types_pl (val) VALUES('专业化拜访'); -INSERT INTO activity_activity_types_pl (val) VALUES('事务性拜访'); - -drop table if exists activity_visiting_purpose_pl; -CREATE TABLE activity_visiting_purpose_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - activity_type MEDIUMINT, - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('传递产品知识',1); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('处方观念沟通',1); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('病例沟通',1); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('会议安排',2); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('会议跟进',2); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('交接工作',2); -INSERT INTO activity_visiting_purpose_pl (val,activity_type) VALUES('了解竞争',2); - --- 拜访目的1 -drop table if exists sales_visiting_purpose_pl; -CREATE TABLE sales_visiting_purpose_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO sales_visiting_purpose_pl (val) VALUES('会议安排'); -INSERT INTO sales_visiting_purpose_pl (val) VALUES('会议跟进'); -INSERT INTO sales_visiting_purpose_pl (val) VALUES('交接工作'); -INSERT INTO sales_visiting_purpose_pl (val) VALUES('了解竞争'); - --- 拜访目的2 -drop table if exists com_visiting_purpose_pl; -CREATE TABLE com_visiting_purpose_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) + coach int(32), + location VARCHAR(255), + total_score MEDIUMINT, + planing MEDIUMINT, + openling MEDIUMINT, + enquery_listening MEDIUMINT, + deliverable MEDIUMINT, + objection_handing MEDIUMINT, + summary MEDIUMINT, + PRIMARY KEY USING BTREE (id), + CONSTRAINT `crmuserId_activity_cons` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `contactId_activity_cons` FOREIGN KEY (`contactId`) REFERENCES `contact` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE InnoDB; -INSERT INTO com_visiting_purpose_pl (val) VALUES('处方观念沟通'); -INSERT INTO com_visiting_purpose_pl (val) VALUES('病例沟通'); - - -drop table if exists activity_feature_product_pl; -CREATE TABLE activity_feature_product_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO activity_feature_product_pl (val) VALUES('美施康定'); -INSERT INTO activity_feature_product_pl (val) VALUES('奥施康定'); -INSERT INTO activity_feature_product_pl (val) VALUES('奇曼丁'); -INSERT INTO activity_feature_product_pl (val) VALUES('若思本'); -INSERT INTO activity_feature_product_pl (val) VALUES('奥诺美'); - drop table if exists activitycrmuser; CREATE TABLE activitycrmuser @@ -320,237 +171,11 @@ CREATE TABLE activitycrmuser activityId MEDIUMINT NOT NULL, crmuserId MEDIUMINT NOT NULL, UNIQUE KEY(activityId,crmuserId), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - -drop table if exists contact; -CREATE TABLE contact -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - accountId MEDIUMINT NOT NULL, - department VARCHAR(255), - sex MEDIUMINT, - native_place VARCHAR(255), - office_tel VARCHAR(255), - office_fax VARCHAR(255), - cellphone VARCHAR(255), - email VARCHAR(255), - status VARCHAR(255), - market_classification MEDIUMINT, - grade MEDIUMINT, - province VARCHAR(255), - city VARCHAR(255), - districts VARCHAR(255), - duty MEDIUMINT, - job_title MEDIUMINT, - visiting_target MEDIUMINT, - product_target VARCHAR(255), - owner VARCHAR(255), - whenadded DATETIME, - modifier VARCHAR(255), - modify_datetime DATETIME, - responsible_person VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - - --- 性别; -drop table if exists sex_pl; -CREATE TABLE sex_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO sex_pl (val) VALUES('男'); -INSERT INTO sex_pl (val) VALUES('女'); --- 科室 -drop table if exists contact_department_pl; -CREATE TABLE contact_department_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO contact_department_pl (val) VALUES('ICU'); -INSERT INTO contact_department_pl (val) VALUES('保健科'); -INSERT INTO contact_department_pl (val) VALUES('采购科'); -INSERT INTO contact_department_pl (val) VALUES('传染科'); -INSERT INTO contact_department_pl (val) VALUES('创伤外科'); -INSERT INTO contact_department_pl (val) VALUES('儿科'); -INSERT INTO contact_department_pl (val) VALUES('耳鼻喉科'); -INSERT INTO contact_department_pl (val) VALUES('方便门诊'); -INSERT INTO contact_department_pl (val) VALUES('放化疗科'); -INSERT INTO contact_department_pl (val) VALUES('放疗科'); -INSERT INTO contact_department_pl (val) VALUES('放射科'); -INSERT INTO contact_department_pl (val) VALUES('风湿科'); -INSERT INTO contact_department_pl (val) VALUES('妇产科'); -INSERT INTO contact_department_pl (val) VALUES('妇科'); -INSERT INTO contact_department_pl (val) VALUES('肝胆外科'); -INSERT INTO contact_department_pl (val) VALUES('感染科'); -INSERT INTO contact_department_pl (val) VALUES('肛肠科'); -INSERT INTO contact_department_pl (val) VALUES('姑息科'); -INSERT INTO contact_department_pl (val) VALUES('骨科'); -INSERT INTO contact_department_pl (val) VALUES('国际医疗科'); -INSERT INTO contact_department_pl (val) VALUES('核医学科'); -INSERT INTO contact_department_pl (val) VALUES('呼吸内科'); -INSERT INTO contact_department_pl (val) VALUES('护理部'); -INSERT INTO contact_department_pl (val) VALUES('急诊科'); -INSERT INTO contact_department_pl (val) VALUES('介入科'); -INSERT INTO contact_department_pl (val) VALUES('康复科'); -INSERT INTO contact_department_pl (val) VALUES('口腔科'); -INSERT INTO contact_department_pl (val) VALUES('老干科'); -INSERT INTO contact_department_pl (val) VALUES('麻醉科'); -INSERT INTO contact_department_pl (val) VALUES('泌尿外科'); -INSERT INTO contact_department_pl (val) VALUES('脑外科'); -INSERT INTO contact_department_pl (val) VALUES('内分泌科'); -INSERT INTO contact_department_pl (val) VALUES('内科'); -INSERT INTO contact_department_pl (val) VALUES('宁养院'); -INSERT INTO contact_department_pl (val) VALUES('皮肤科'); -INSERT INTO contact_department_pl (val) VALUES('普外科'); -INSERT INTO contact_department_pl (val) VALUES('乳腺外科'); -INSERT INTO contact_department_pl (val) VALUES('烧伤整形科'); -INSERT INTO contact_department_pl (val) VALUES('神经科'); -INSERT INTO contact_department_pl (val) VALUES('神经内科'); -INSERT INTO contact_department_pl (val) VALUES('神经外科'); -INSERT INTO contact_department_pl (val) VALUES('肾内科'); -INSERT INTO contact_department_pl (val) VALUES('生物治疗科'); -INSERT INTO contact_department_pl (val) VALUES('特需科'); -INSERT INTO contact_department_pl (val) VALUES('疼痛科'); -INSERT INTO contact_department_pl (val) VALUES('外科'); -INSERT INTO contact_department_pl (val) VALUES('微创科'); -INSERT INTO contact_department_pl (val) VALUES('胃肠外科'); -INSERT INTO contact_department_pl (val) VALUES('消化科'); -INSERT INTO contact_department_pl (val) VALUES('消化内科'); -INSERT INTO contact_department_pl (val) VALUES('消化外科'); -INSERT INTO contact_department_pl (val) VALUES('心内科'); -INSERT INTO contact_department_pl (val) VALUES('心胸外科'); -INSERT INTO contact_department_pl (val) VALUES('血管外科'); -INSERT INTO contact_department_pl (val) VALUES('血透室'); -INSERT INTO contact_department_pl (val) VALUES('血液科'); -INSERT INTO contact_department_pl (val) VALUES('药剂科'); -INSERT INTO contact_department_pl (val) VALUES('医保办'); -INSERT INTO contact_department_pl (val) VALUES('医务科'); -INSERT INTO contact_department_pl (val) VALUES('整形美容科'); -INSERT INTO contact_department_pl (val) VALUES('质控科'); -INSERT INTO contact_department_pl (val) VALUES('中西医结合科'); -INSERT INTO contact_department_pl (val) VALUES('中医科'); -INSERT INTO contact_department_pl (val) VALUES('肿瘤科'); -INSERT INTO contact_department_pl (val) VALUES('肿瘤内科'); -INSERT INTO contact_department_pl (val) VALUES('肿瘤外科'); -INSERT INTO contact_department_pl (val) VALUES('综合科'); -INSERT INTO contact_department_pl (val) VALUES('其他'); - --- 行政职务; -drop table if exists contact_duty_pl; -CREATE TABLE contact_duty_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - -INSERT INTO contact_duty_pl (val) VALUES('医生'); -INSERT INTO contact_duty_pl (val) VALUES('副主任'); -INSERT INTO contact_duty_pl (val) VALUES('主任'); -INSERT INTO contact_duty_pl (val) VALUES('副院长'); -INSERT INTO contact_duty_pl (val) VALUES('院长'); -INSERT INTO contact_duty_pl (val) VALUES('院长助理'); -INSERT INTO contact_duty_pl (val) VALUES('副书记'); -INSERT INTO contact_duty_pl (val) VALUES('书记'); -INSERT INTO contact_duty_pl (val) VALUES('护士'); -INSERT INTO contact_duty_pl (val) VALUES('护士长'); -INSERT INTO contact_duty_pl (val) VALUES('库管'); -INSERT INTO contact_duty_pl (val) VALUES('采购'); -INSERT INTO contact_duty_pl (val) VALUES('采购科科长'); -INSERT INTO contact_duty_pl (val) VALUES('药师'); -INSERT INTO contact_duty_pl (val) VALUES('药剂科副主任'); -INSERT INTO contact_duty_pl (val) VALUES('药剂科主任'); -INSERT INTO contact_duty_pl (val) VALUES('医务科副科长'); -INSERT INTO contact_duty_pl (val) VALUES('医务科科长'); -INSERT INTO contact_duty_pl (val) VALUES('医保办主任'); -INSERT INTO contact_duty_pl (val) VALUES('科教科主任'); -INSERT INTO contact_duty_pl (val) VALUES('信息科科长'); -INSERT INTO contact_duty_pl (val) VALUES('其他'); - - --- 专业职务; -drop table if exists contact_job_title_pl; -CREATE TABLE contact_job_title_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO contact_job_title_pl (val) VALUES('住院医师'); -INSERT INTO contact_job_title_pl (val) VALUES('主治医师'); -INSERT INTO contact_job_title_pl (val) VALUES('副主任医师'); -INSERT INTO contact_job_title_pl (val) VALUES('主任医师'); -INSERT INTO contact_job_title_pl (val) VALUES('护士'); -INSERT INTO contact_job_title_pl (val) VALUES('主管护师'); -INSERT INTO contact_job_title_pl (val) VALUES('副主任护士'); -INSERT INTO contact_job_title_pl (val) VALUES('主任护师'); -INSERT INTO contact_job_title_pl (val) VALUES('药师'); -INSERT INTO contact_job_title_pl (val) VALUES('主管药师'); -INSERT INTO contact_job_title_pl (val) VALUES('副主任药师'); -INSERT INTO contact_job_title_pl (val) VALUES('主任药师'); -INSERT INTO contact_job_title_pl (val) VALUES('技师'); -INSERT INTO contact_job_title_pl (val) VALUES('主管技师'); -INSERT INTO contact_job_title_pl (val) VALUES('副主任技师'); -INSERT INTO contact_job_title_pl (val) VALUES('主任技师'); -INSERT INTO contact_job_title_pl (val) VALUES('其他'); - --- 状态; -drop table if exists contact_status_pl; -CREATE TABLE contact_status_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO contact_status_pl (val) VALUES('无效'); -INSERT INTO contact_status_pl (val) VALUES('有效'); - --- 级别; -drop table if exists contact_grade_pl; -CREATE TABLE contact_grade_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) + PRIMARY KEY USING BTREE (id), + CONSTRAINT `crm_activity_cons` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE , + CONSTRAINT `crm_activity_cons2` FOREIGN KEY (`activityId`) REFERENCES `activity` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE InnoDB; -INSERT INTO contact_grade_pl (val) VALUES('A'); -INSERT INTO contact_grade_pl (val) VALUES('B'); -INSERT INTO contact_grade_pl (val) VALUES('C'); -INSERT INTO contact_grade_pl (val) VALUES('D'); -drop table if exists contact_market_classification_pl; -CREATE TABLE contact_market_classification_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO contact_market_classification_pl (val) VALUES ('战略城市'); -INSERT INTO contact_market_classification_pl (val) VALUES('一级城市'); -INSERT INTO contact_market_classification_pl (val) VALUES('二级城市'); -INSERT INTO contact_market_classification_pl (val) VALUES('三级城市'); -INSERT INTO contact_market_classification_pl (val) VALUES('四级城市'); - - -drop table if exists contact_generalization_target_pl; -CREATE TABLE contact_generalization_target_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO contact_generalization_target_pl (val) VALUES ('美施康定'); -INSERT INTO contact_generalization_target_pl (val) VALUES('奥施康定'); -INSERT INTO contact_generalization_target_pl (val) VALUES('奇曼丁'); -INSERT INTO contact_generalization_target_pl (val) VALUES('若思本'); -INSERT INTO contact_generalization_target_pl (val) VALUES('奥诺美'); drop table if exists contactcrmuser; CREATE TABLE contactcrmuser @@ -559,152 +184,160 @@ CREATE TABLE contactcrmuser contactId MEDIUMINT NOT NULL, crmuserId MEDIUMINT NOT NULL, UNIQUE KEY(contactId,crmuserId), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - - -drop table if exists crmuser; -CREATE TABLE crmuser -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - department VARCHAR(255), - division VARCHAR(255), - cellPhone VARCHAR(255), - email VARCHAR(255), - employeeNumber VARCHAR(255), - photo VARCHAR(255), - jobTitle VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -ALTER table crmuser ADD pl1 MEDIUMINT; -ALTER table crmuser ADD pl2 MEDIUMINT; -ALTER table crmuser ADD role MEDIUMINT; -ALTER table crmuser ADD pl4 MEDIUMINT; -ALTER table crmuser ADD pl5 MEDIUMINT; -ALTER table crmuser ADD sex MEDIUMINT; -ALTER table crmuser ADD loginName VARCHAR(255); -ALTER table crmuser ADD password VARCHAR(255); -ALTER table crmuser ADD sessionKey VARCHAR(255); -ALTER table crmuser ADD lastLoginTime BIGINT; -ALTER table crmuser ADD whenadded DATETIME; -ALTER table crmuser ADD reportto MEDIUMINT; -ALTER table crmuser ADD parcel VARCHAR(255); -ALTER table crmuser ADD modifier VARCHAR(255); -ALTER table crmuser ADD modify_datetime date; -ALTER table crmuser ADD owner VARCHAR(255); -ALTER table crmuser ADD postId VARCHAR(255); -ALTER table crmuser ADD city VARCHAR(255); --- pick list for crmuser --- 状态; -drop table if exists crmuser_pl1; -CREATE TABLE crmuser_pl1 -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO `crmuser_pl1` (val) VALUES ('无效'); -INSERT INTO `crmuser_pl1` (val) VALUES ('有效'); --- 产品线; -drop table if exists crmuser_pl2; -CREATE TABLE crmuser_pl2 -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - --- 角色; -drop table if exists role; -CREATE TABLE role -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -INSERT INTO `role` (val) VALUES ('管理员'); -INSERT INTO `role` (val) VALUES ('销售经理'); -INSERT INTO `role` (val) VALUES ('销售代表'); --- 一级区域; -drop table if exists region_level1_pl; -CREATE TABLE region_level1_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - --- 二级区域; -drop table if exists region_level2_pl; -CREATE TABLE region_level2_pl -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - val VARCHAR(255), - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; - --- END of pick list for crmuser + PRIMARY KEY USING BTREE (id), + CONSTRAINT `crm_contact_cons1` FOREIGN KEY (`crmuserId`) REFERENCES `crmuser` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `crm_contact_cons2` FOREIGN KEY (`contactId`) REFERENCES `contact` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE InnoDB; + + + +drop table if exists user_position; +create table user_position ( + id mediumint(9) auto_increment, + userId int(32), + positionId int(32), + primary key (id), + unique index user_position_unique (userId,positionId) +)ENGINE InnoDB; + +DROP TABLE IF EXISTS userInfo; +CREATE TABLE userInfo ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + name varchar(255) NOT NULL, + department varchar(255) DEFAULT NULL, + division varchar(255) DEFAULT NULL, + cellPhone varchar(255) DEFAULT NULL, + email varchar(255) DEFAULT NULL, + employeeNumber varchar(255) DEFAULT NULL, + photo varchar(255) DEFAULT NULL, + jobTitle varchar(255) DEFAULT NULL, + pl1 mediumint(9) DEFAULT NULL, + pl2 mediumint(9) DEFAULT NULL, + role mediumint(9) DEFAULT NULL, + pl4 mediumint(9) DEFAULT NULL, + pl5 mediumint(9) DEFAULT NULL, + sex mediumint(9) DEFAULT NULL, + loginName varchar(255) DEFAULT NULL, + password varchar(255) DEFAULT NULL, + sessionKey varchar(255) DEFAULT NULL, + lastLoginTime bigint(20) DEFAULT NULL, + whenadded datetime DEFAULT NULL, + parcel varchar(255) DEFAULT NULL, + modifier varchar(255) DEFAULT NULL, + modify_datetime datetime DEFAULT NULL, + owner varchar(255) DEFAULT NULL, + province int(11), + city int(11), + isActivited mediumint(9) DEFAULT NULL, + ts bigint(20) DEFAULT NULL, + positionId mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE InnoDB; + +INSERT INTO `userInfo` (id,name,loginname,password,role,isActivited,ts,positionId,pl1) VALUES +(-1,'无','dummy','827ccb0eea8a706c4c34a16891f84e7b',1,2,1386766666,-1,1), +(1,'Admin Nam','admin','827ccb0eea8a706c4c34a16891f84e7b',1,2,1386766666,1,1), +(2,'Sales Manager','salesman','827ccb0eea8a706c4c34a16891f84e7b',2,2,1386766666,2,1), +(3,'Sales','sales','827ccb0eea8a706c4c34a16891f84e7b',3,2,1386766666,3,1); -drop table if exists city; -CREATE TABLE city -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - provinceId VARCHAR(255) NOT NULL, - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; -drop table if exists province; -CREATE TABLE province +drop table if exists externalMeeting; +CREATE TABLE externalMeeting ( id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, + crmuserId MEDIUMINT NOT NULL, + endtime BIGINT, + starttime BIGINT NOT NULL DEFAULT 0, + title VARCHAR(128), + contactIds VARCHAR(512), + status MEDIUMINT, + activity_type MEDIUMINT, PRIMARY KEY USING BTREE (id) ) ENGINE InnoDB; +ALTER table externalMeeting ADD coachId MEDIUMINT; - - -drop table if exists dealerAccount; -CREATE TABLE dealerAccount +drop table if exists internalMeeting; +CREATE TABLE internalMeeting ( id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - address VARCHAR(255), - tele VARCHAR(255), + crmuserId MEDIUMINT NOT NULL, + endtime BIGINT, + starttime BIGINT NOT NULL DEFAULT 0, + title VARCHAR(128), + contactId MEDIUMINT, + crmusermanagerId MEDIUMINT, status MEDIUMINT, - pl1 MEDIUMINT, - pl2 MEDIUMINT, + activity_type MEDIUMINT, PRIMARY KEY USING BTREE (id) ) ENGINE InnoDB; -ALTER table dealerAccount ADD whenadded DATETIME; -drop table if exists dealerContact; -CREATE TABLE dealerContact +DROP TABLE IF EXISTS `data_exchange_teample`; +DROP TABLE IF EXISTS `data_exchange_operation`; +DROP TABLE IF EXISTS data_exchange_status; +DROP TABLE IF EXISTS `record_type`; + +DROP TABLE IF EXISTS `record_type`; +CREATE TABLE `record_type` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `val` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +INSERT INTO `record_type` VALUES (1,0,'Account'),(2,0,'Contact'),(3,0,'Call'),(4,0,'Coaching'),(5,0,'AccuntTeam'),(6,0,'ContactTeam'); + +DROP TABLE IF EXISTS data_exchange_status; +CREATE TABLE data_exchange_status ( + id bigint(20) NOT NULL AUTO_INCREMENT, + version bigint(20) NOT NULL, + val varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB; +INSERT INTO `data_exchange_status` VALUES (1,0,'Pending'),(2,0,'Abort'),(3,0,'Completed'),(4,0,'Cancelled'); + +DROP TABLE IF EXISTS `data_exchange_operation`; +CREATE TABLE `data_exchange_operation` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `val` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `val` (`val`) +) ENGINE=InnoDB; +INSERT INTO `data_exchange_operation` VALUES (1,0,'Import'),(2,0,'Export'); + + +DROP TABLE IF EXISTS `data_exchange_teample`; +CREATE TABLE `data_exchange_teample` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `version` bigint(20) NOT NULL, + `name` varchar(255) NOT NULL, + `operation_id` bigint(20) NOT NULL, + `type_id` bigint(20) NOT NULL, + `template` longtext NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + KEY `FK8AE35445D557144C` (`type_id`), + KEY `FK8AE35445199BCB6C` (`operation_id`), + CONSTRAINT `FK8AE35445199BCB6C` FOREIGN KEY (`operation_id`) REFERENCES `data_exchange_operation` (`id`), + CONSTRAINT `FK8AE35445D557144C` FOREIGN KEY (`type_id`) REFERENCES `record_type` (`id`) +) ENGINE=InnoDB; + +INSERT INTO `data_exchange_teample` VALUES (1,1,'Account Full Import Template 1.0',1,1,'\r\n\r\n 1000\r\n Account\r\n BdmCode\r\n account.csv\r\n crm_mysql\r\n \r\n 记录行ID\r\n String\r\n BdmCode\r\n \r\n \r\n \r\n 年诊疗人数\r\n Integer\r\n NumOfTreatPerYear\r\n \r\n\r\n \r\n 成立时间\r\n Date\r\n DateOfEstablish\r\n m/d/yy\r\n \r\n \r\n\r\n \r\n 客户名称\r\n String\r\n Name\r\n \r\n\r\n \r\n 医院行政级别\r\n Lookup\r\n AdministrativLevel\r\n AccountAdministrativLevelPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院分级\r\n Lookup\r\n Grade\r\n AccountGradePl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院类型\r\n Lookup\r\n HospitalType\r\n AccountTypePl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 地方军队医院\r\n Lookup\r\n LocalOrArmy\r\n AccountLocalOrArmyPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 综合专科医院\r\n Lookup\r\n ComprehensiveOrSpecialized\r\n AccountComprehensiveOrSpecializedPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 重点医院\r\n Lookup\r\n KeyType\r\n AccountPointPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 状态\r\n Lookup\r\n Status\r\n AccountStatusPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 法人\r\n String\r\n DutyOfficer\r\n \r\n\r\n \r\n 医生数量\r\n Integer\r\n NumOfDoctors\r\n \r\n\r\n \r\n 助理医师人数\r\n Integer\r\n NumOfAssistantDoctors\r\n \r\n \r\n \r\n 员工总数\r\n Integer\r\n NumOfStaff\r\n \r\n\r\n \r\n 门诊人数\r\n Integer\r\n NumOfOutpatient\r\n \r\n\r\n \r\n 总病床数\r\n Integer\r\n TotalNumOfSickbed\r\n \r\n\r\n \r\n 麻醉科医生数\r\n Integer\r\n NumOfAnesthesiaDoctor\r\n \r\n\r\n \r\n 疼痛学组医生数\r\n Integer\r\n NumOfPainDoctor\r\n \r\n\r\n \r\n 手术量年\r\n Integer\r\n NumOfSurgeryPerYear\r\n \r\n\r\n \r\n 手术间\r\n Integer\r\n NumOfSurgeryRoom\r\n \r\n\r\n \r\n 阿片类用药量\r\n Integer\r\n NumOfUsingOpiatesMedicine\r\n \r\n\r\n \r\n 阿片类注射剂量\r\n Integer\r\n NumOfUsingOpiatesInjection\r\n \r\n\r\n \r\n 注册资金\r\n Integer\r\n RegisteredCapital\r\n \r\n\r\n \r\n 主要电话号码\r\n String\r\n Tel\r\n \r\n\r\n \r\n 主要传真号码\r\n String\r\n Fax\r\n \r\n\r\n \r\n 市场分类\r\n Lookup\r\n MarketClassification\r\n AccountMarketClassificationPl\r\n Val\r\n Id\r\n \r\n\r\n \r\n 医院省份\r\n String\r\n Province\r\n \r\n\r\n \r\n 医院区县\r\n String\r\n Districts\r\n \r\n \r\n \r\n 医院详细地址\r\n String\r\n Address\r\n \r\n'); + + +drop table if exists loginhistory; +CREATE TABLE loginhistory ( id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - sex MEDIUMINT, - tel_work VARCHAR(255), - dealerAccountId MEDIUMINT NOT NULL, - status MEDIUMINT, - pl1 MEDIUMINT, + sessionId varchar(128), + loginName varchar(256), + loginTime datetime, + logoutTime datetime, + UNIQUE KEY `sessionId` (`sessionId`), PRIMARY KEY USING BTREE (id) ) ENGINE InnoDB; -ALTER table dealerContact ADD whenadded DATETIME; -drop table if exists dealerContact; -CREATE TABLE dealerContact -( - id MEDIUMINT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - sex MEDIUMINT, - tel_work VARCHAR(255), - dealerAccountId MEDIUMINT NOT NULL, - status MEDIUMINT, - pl1 MEDIUMINT, - PRIMARY KEY USING BTREE (id) -) ENGINE InnoDB; diff --git a/crm/src/main/db/update35.sql b/crm/src/main/db/update35.sql new file mode 100644 index 0000000..4979096 --- /dev/null +++ b/crm/src/main/db/update35.sql @@ -0,0 +1,5 @@ +ALTER TABLE `crmdb`.`role` +ADD COLUMN `name` VARCHAR(45) NULL AFTER `val`; +UPDATE `crmdb`.`role` SET `name`='全部' WHERE `id`='1'; +UPDATE `crmdb`.`role` SET `name`='只读' WHERE `id`='2'; +UPDATE `crmdb`.`role` SET `name`='只读' WHERE `id`='3'; diff --git a/crm/src/main/db/update_1.sql b/crm/src/main/db/update_1.sql new file mode 100644 index 0000000..a5ff31b --- /dev/null +++ b/crm/src/main/db/update_1.sql @@ -0,0 +1,23 @@ + +ALTER table crmuser ADD ts BIGINT; +UPDATE `crmdb`.`crmuser` SET `email`='brenda.yuan@rexen.com.cn', `isActivited`='1', `ts`='1382611111318' WHERE `id`='101'; +UPDATE `crmdb`.`crmuser` SET `isActivited`='1', `ts`='1382615122318' WHERE `id`='99'; +UPDATE `crmdb`.`crmuser` SET `isActivited`='1', `ts`='1382613388598' WHERE `id`='100'; + + +DROP TABLE IF EXISTS `score1_pl`; +CREATE TABLE `score1_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `score1_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'); + + +DROP TABLE IF EXISTS `score2_pl`; +CREATE TABLE `score2_pl` ( + `id` int(11) NOT NULL DEFAULT '0', + `val` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `score2_pl` VALUES (0,'0'),(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7'),(8,'8'),(9,'9'),(10,'10'),(11,'11'),(12,'12'),(13,'13'),(14,'14'),(15,'15'),(16,'16'),(17,'17'),(18,'18'),(19,'19'),(20,'20'); \ No newline at end of file diff --git a/crm/src/main/db/update_2.sql b/crm/src/main/db/update_2.sql new file mode 100644 index 0000000..c3d43bd --- /dev/null +++ b/crm/src/main/db/update_2.sql @@ -0,0 +1,47 @@ +use crmdb; + + +ALTER table account modify province int(11) default 1; +ALTER table account modify city int(11) default 1; +update account set province=1,city=1; + +ALTER table contact modify province int(11) default 1; +ALTER table contact modify city int(11) default 1; +update contact set province=1,city=1; + + +DROP TABLE IF EXISTS `area`; +DROP TABLE IF EXISTS `city`; +DROP TABLE IF EXISTS `province`; + + + +CREATE TABLE `province` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; + +CREATE TABLE `city` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `city_parentid_cons` (`parentId`), + CONSTRAINT `city_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=344 DEFAULT CHARSET=utf8; + +CREATE TABLE `area` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `area_parentid_cons` (`parentId`), + CONSTRAINT `area_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `city` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `province` VALUES (1,'北京市','110000'),(2,'天津市','120000'),(3,'河北省','130000'),(4,'山西省','140000'),(5,'内蒙古','150000'),(6,'辽宁省','210000'),(7,'吉林省','220000'),(8,'黑龙江','230000'),(9,'上海市','310000'),(10,'江苏省','320000'),(11,'浙江省','330000'),(12,'安徽省','340000'),(13,'福建省','350000'),(14,'江西省','360000'),(15,'山东省','370000'),(16,'河南省','410000'),(17,'湖北省','420000'),(18,'湖南省','430000'),(19,'广东省','440000'),(20,'广 西','450000'),(21,'海南省','460000'),(22,'重庆市','500000'),(23,'四川省','510000'),(24,'贵州省','520000'),(25,'云南省','530000'),(26,'西 藏','540000'),(27,'陕西省','610000'),(28,'甘肃省','620000'),(29,'青海省','630000'),(30,'宁 夏','640000'),(31,'新 疆','650000'),(32,'台湾省','710000'),(33,'香 港','810000'),(34,'澳 门','820000'); +INSERT INTO `city` VALUES (1,'北京市','110100',1),(2,'石家庄市','130100',3),(3,'唐山市','130200',3),(4,'秦皇岛市','130300',3),(5,'邯郸市','130400',3),(6,'邢台市','130500',3),(7,'保定市','130600',3),(8,'张家口市','130700',3),(9,'承德市','130800',3),(10,'沧州市','130900',3),(11,'廊坊市','131000',3),(12,'衡水市','131100',3),(13,'太原市','140100',4),(14,'大同市','140200',4),(15,'阳泉市','140300',4),(16,'长治市','140400',4),(17,'晋城市','140500',4),(18,'朔州市','140600',4),(19,'晋中市','140700',4),(20,'运城市','140800',4),(21,'忻州市','140900',4),(22,'临汾市','141000',4),(23,'吕梁市','141100',4),(24,'呼和浩特市','150100',5),(25,'包头市','150200',5),(26,'乌海市','150300',5),(27,'赤峰市','150400',5),(28,'通辽市','150500',5),(29,'鄂尔多斯市','150600',5),(30,'呼伦贝尔市','150700',5),(31,'巴彦淖尔市','150800',5),(32,'乌兰察布市','150900',5),(33,'兴安盟','152200',5),(34,'锡林郭勒盟','152500',5),(35,'阿拉善盟','152900',5),(36,'沈阳市','210100',6),(37,'大连市','210200',6),(38,'鞍山市','210300',6),(39,'抚顺市','210400',6),(40,'本溪市','210500',6),(41,'丹东市','210600',6),(42,'锦州市','210700',6),(43,'营口市','210800',6),(44,'阜新市','210900',6),(45,'辽阳市','211000',6),(46,'盘锦市','211100',6),(47,'铁岭市','211200',6),(48,'朝阳市','211300',6),(49,'葫芦岛市','211400',6),(50,'长春市','220100',7),(51,'吉林市','220200',7),(52,'四平市','220300',7),(53,'辽源市','220400',7),(54,'通化市','220500',7),(55,'白山市','220600',7),(56,'松原市','220700',7),(57,'白城市','220800',7),(58,'延边朝鲜族自治州','222400',7),(59,'哈尔滨市','230100',8),(60,'齐齐哈尔市','230200',8),(61,'鸡西市','230300',8),(62,'鹤岗市','230400',8),(63,'双鸭山市','230500',8),(64,'大庆市','230600',8),(65,'伊春市','230700',8),(66,'佳木斯市','230800',8),(67,'七台河市','230900',8),(68,'牡丹江市','231000',8),(69,'黑河市','231100',8),(70,'绥化市','231200',8),(71,'大兴安岭地区','232700',8),(72,'市辖区','310100',9),(73,'县','310200',9),(74,'南京市','320100',10),(75,'无锡市','320200',10),(76,'徐州市','320300',10),(77,'常州市','320400',10),(78,'苏州市','320500',10),(79,'南通市','320600',10),(80,'连云港市','320700',10),(81,'淮安市','320800',10),(82,'盐城市','320900',10),(83,'扬州市','321000',10),(84,'镇江市','321100',10),(85,'泰州市','321200',10),(86,'宿迁市','321300',10),(87,'杭州市','330100',11),(88,'宁波市','330200',11),(89,'温州市','330300',11),(90,'嘉兴市','330400',11),(91,'湖州市','330500',11),(92,'绍兴市','330600',11),(93,'金华市','330700',11),(94,'衢州市','330800',11),(95,'舟山市','330900',11),(96,'台州市','331000',11),(97,'丽水市','331100',11),(98,'合肥市','340100',12),(99,'芜湖市','340200',12),(100,'蚌埠市','340300',12),(101,'淮南市','340400',12),(102,'马鞍山市','340500',12),(103,'淮北市','340600',12),(104,'铜陵市','340700',12),(105,'安庆市','340800',12),(106,'黄山市','341000',12),(107,'滁州市','341100',12),(108,'阜阳市','341200',12),(109,'宿州市','341300',12),(110,'巢湖市','341400',12),(111,'六安市','341500',12),(112,'亳州市','341600',12),(113,'池州市','341700',12),(114,'宣城市','341800',12),(115,'福州市','350100',13),(116,'厦门市','350200',13),(117,'莆田市','350300',13),(118,'三明市','350400',13),(119,'泉州市','350500',13),(120,'漳州市','350600',13),(121,'南平市','350700',13),(122,'龙岩市','350800',13),(123,'宁德市','350900',13),(124,'南昌市','360100',14),(125,'景德镇市','360200',14),(126,'萍乡市','360300',14),(127,'九江市','360400',14),(128,'新余市','360500',14),(129,'鹰潭市','360600',14),(130,'赣州市','360700',14),(131,'吉安市','360800',14),(132,'宜春市','360900',14),(133,'抚州市','361000',14),(134,'上饶市','361100',14),(135,'济南市','370100',15),(136,'青岛市','370200',15),(137,'淄博市','370300',15),(138,'枣庄市','370400',15),(139,'东营市','370500',15),(140,'烟台市','370600',15),(141,'潍坊市','370700',15),(142,'济宁市','370800',15),(143,'泰安市','370900',15),(144,'威海市','371000',15),(145,'日照市','371100',15),(146,'莱芜市','371200',15),(147,'临沂市','371300',15),(148,'德州市','371400',15),(149,'聊城市','371500',15),(150,'滨州市','371600',15),(151,'荷泽市','371700',15),(152,'郑州市','410100',16),(153,'开封市','410200',16),(154,'洛阳市','410300',16),(155,'平顶山市','410400',16),(156,'安阳市','410500',16),(157,'鹤壁市','410600',16),(158,'新乡市','410700',16),(159,'焦作市','410800',16),(160,'濮阳市','410900',16),(161,'许昌市','411000',16),(162,'漯河市','411100',16),(163,'三门峡市','411200',16),(164,'南阳市','411300',16),(165,'商丘市','411400',16),(166,'信阳市','411500',16),(167,'周口市','411600',16),(168,'驻马店市','411700',16),(169,'武汉市','420100',17),(170,'黄石市','420200',17),(171,'十堰市','420300',17),(172,'宜昌市','420500',17),(173,'襄樊市','420600',17),(174,'鄂州市','420700',17),(175,'荆门市','420800',17),(176,'孝感市','420900',17),(177,'荆州市','421000',17),(178,'黄冈市','421100',17),(179,'咸宁市','421200',17),(180,'随州市','421300',17),(181,'恩施土家族苗族自治州','422800',17),(182,'省直辖行政单位','429000',17),(183,'长沙市','430100',18),(184,'株洲市','430200',18),(185,'湘潭市','430300',18),(186,'衡阳市','430400',18),(187,'邵阳市','430500',18),(188,'岳阳市','430600',18),(189,'常德市','430700',18),(190,'张家界市','430800',18),(191,'益阳市','430900',18),(192,'郴州市','431000',18),(193,'永州市','431100',18),(194,'怀化市','431200',18),(195,'娄底市','431300',18),(196,'湘西土家族苗族自治州','433100',18),(197,'广州市','440100',19),(198,'韶关市','440200',19),(199,'深圳市','440300',19),(200,'珠海市','440400',19),(201,'汕头市','440500',19),(202,'佛山市','440600',19),(203,'江门市','440700',19),(204,'湛江市','440800',19),(205,'茂名市','440900',19),(206,'肇庆市','441200',19),(207,'惠州市','441300',19),(208,'梅州市','441400',19),(209,'汕尾市','441500',19),(210,'河源市','441600',19),(211,'阳江市','441700',19),(212,'清远市','441800',19),(213,'东莞市','441900',19),(214,'中山市','442000',19),(215,'潮州市','445100',19),(216,'揭阳市','445200',19),(217,'云浮市','445300',19),(218,'南宁市','450100',20),(219,'柳州市','450200',20),(220,'桂林市','450300',20),(221,'梧州市','450400',20),(222,'北海市','450500',20),(223,'防城港市','450600',20),(224,'钦州市','450700',20),(225,'贵港市','450800',20),(226,'玉林市','450900',20),(227,'百色市','451000',20),(228,'贺州市','451100',20),(229,'河池市','451200',20),(230,'来宾市','451300',20),(231,'崇左市','451400',20),(232,'海口市','460100',21),(233,'三亚市','460200',21),(234,'省直辖县级行政单位','469000',21),(235,'市辖区','500100',22),(236,'县','500200',22),(237,'市','500300',22),(238,'成都市','510100',23),(239,'自贡市','510300',23),(240,'攀枝花市','510400',23),(241,'泸州市','510500',23),(242,'德阳市','510600',23),(243,'绵阳市','510700',23),(244,'广元市','510800',23),(245,'遂宁市','510900',23),(246,'内江市','511000',23),(247,'乐山市','511100',23),(248,'南充市','511300',23),(249,'眉山市','511400',23),(250,'宜宾市','511500',23),(251,'广安市','511600',23),(252,'达州市','511700',23),(253,'雅安市','511800',23),(254,'巴中市','511900',23),(255,'资阳市','512000',23),(256,'阿坝藏族羌族自治州','513200',23),(257,'甘孜藏族自治州','513300',23),(258,'凉山彝族自治州','513400',23),(259,'贵阳市','520100',24),(260,'六盘水市','520200',24),(261,'遵义市','520300',24),(262,'安顺市','520400',24),(263,'铜仁地区','522200',24),(264,'黔西南布依族苗族自治州','522300',24),(265,'毕节地区','522400',24),(266,'黔东南苗族侗族自治州','522600',24),(267,'黔南布依族苗族自治州','522700',24),(268,'昆明市','530100',25),(269,'曲靖市','530300',25),(270,'玉溪市','530400',25),(271,'保山市','530500',25),(272,'昭通市','530600',25),(273,'丽江市','530700',25),(274,'思茅市','530800',25),(275,'临沧市','530900',25),(276,'楚雄彝族自治州','532300',25),(277,'红河哈尼族彝族自治州','532500',25),(278,'文山壮族苗族自治州','532600',25),(279,'西双版纳傣族自治州','532800',25),(280,'大理白族自治州','532900',25),(281,'德宏傣族景颇族自治州','533100',25),(282,'怒江傈僳族自治州','533300',25),(283,'迪庆藏族自治州','533400',25),(284,'拉萨市','540100',26),(285,'昌都地区','542100',26),(286,'山南地区','542200',26),(287,'日喀则地区','542300',26),(288,'那曲地区','542400',26),(289,'阿里地区','542500',26),(290,'林芝地区','542600',26),(291,'西安市','610100',27),(292,'铜川市','610200',27),(293,'宝鸡市','610300',27),(294,'咸阳市','610400',27),(295,'渭南市','610500',27),(296,'延安市','610600',27),(297,'汉中市','610700',27),(298,'榆林市','610800',27),(299,'安康市','610900',27),(300,'商洛市','611000',27),(301,'兰州市','620100',28),(302,'嘉峪关市','620200',28),(303,'金昌市','620300',28),(304,'白银市','620400',28),(305,'天水市','620500',28),(306,'武威市','620600',28),(307,'张掖市','620700',28),(308,'平凉市','620800',28),(309,'酒泉市','620900',28),(310,'庆阳市','621000',28),(311,'定西市','621100',28),(312,'陇南市','621200',28),(313,'临夏回族自治州','622900',28),(314,'甘南藏族自治州','623000',28),(315,'西宁市','630100',29),(316,'海东地区','632100',29),(317,'海北藏族自治州','632200',29),(318,'黄南藏族自治州','632300',29),(319,'海南藏族自治州','632500',29),(320,'果洛藏族自治州','632600',29),(321,'玉树藏族自治州','632700',29),(322,'海西蒙古族藏族自治州','632800',29),(323,'银川市','640100',30),(324,'石嘴山市','640200',30),(325,'吴忠市','640300',30),(326,'固原市','640400',30),(327,'中卫市','640500',30),(328,'乌鲁木齐市','650100',31),(329,'克拉玛依市','650200',31),(330,'吐鲁番地区','652100',31),(331,'哈密地区','652200',31),(332,'昌吉回族自治州','652300',31),(333,'博尔塔拉蒙古自治州','652700',31),(334,'巴音郭楞蒙古自治州','652800',31),(335,'阿克苏地区','652900',31),(336,'克孜勒苏柯尔克孜自治州','653000',31),(337,'喀什地区','653100',31),(338,'和田地区','653200',31),(339,'伊犁哈萨克自治州','654000',31),(340,'塔城地区','654200',31),(341,'阿勒泰地区','654300',31),(342,'省直辖行政单位','659000',31),(343,'天津',NULL,2); diff --git a/crm/src/main/db/update_20.sql b/crm/src/main/db/update_20.sql new file mode 100644 index 0000000..cc91922 --- /dev/null +++ b/crm/src/main/db/update_20.sql @@ -0,0 +1,116 @@ +use crmdb; +ALTER TABLE `crmdb`.`contact` +ADD COLUMN `contactCode` VARCHAR(255) NULL AFTER `responsible_person`, +ADD UNIQUE INDEX `contactCode_UNIQUE` (`contactCode` ASC); + +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('14', '保健科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('15', '采购科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('16', '传染科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('17', '创伤外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('18', '儿科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('19', '耳鼻喉科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('20', '方便门诊'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('21', '放化疗科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('22', '放疗科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('23', '放射科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('24', '妇产科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('25', '妇科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('26', '感染科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('27', '肛肠科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('28', '姑息科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('29', '国际医疗科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('30', '核医学科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('31', '呼吸内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('32', '护理科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('33', '急诊科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('34', '介入科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('35', '康复科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('36', '口腔科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('37', '老干科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('38', '麻醉科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('39', '泌尿外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('40', '脑外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('41', '内分泌科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('42', '宁养科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('43', '皮肤科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('44', '普外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('45', '其他'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('46', '乳腺外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('47', '烧伤整形科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('48', '神经科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('49', '神经内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('50', '神经外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('51', '肾内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('52', '生物治疗科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('53', '特需科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('54', '疼痛科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('55', '微创科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('56', '胃肠外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('57', '消化科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('58', '消化内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('59', '消化外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('60', '心内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('61', '心胸外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('62', '血管外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('63', '血透科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('64', '药剂科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('65', '医保办'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('66', '医务科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('67', '整形美容科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('68', '质控科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('69', '中西医结合科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('70', '肿瘤科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('71', '肿瘤内科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('72', '肿瘤外科'); +INSERT INTO `crmdb`.`contact_department_pl` (`id`, `val`) VALUES ('73', '综合科'); + + +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('9', '医生'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('10', '副主任'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('11', '院长助理'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('12', '书记'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('13', '副书记'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('14', '护士'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('15', '护士长'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('16', '库管'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('17', '采购科科长'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('18', '药师'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('19', '药剂科副主任'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('20', '医务科科长'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('21', '医务科副科长'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('22', '医保办主任'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('23', '科教科主任'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('24', '信息卡科长'); +INSERT INTO `crmdb`.`contact_duty_pl` (`id`, `val`) VALUES ('25', '其他'); + +UPDATE `crmdb`.`contact_job_title_pl` SET `val`='主管护士' WHERE `id`='6'; +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('9', '副主任护士'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('10', '主任护师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('11', '主管药师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('12', '副主任药师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('13', '主任药师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('14', '主管技师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('15', '副主任技师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('16', '主任技师'); +INSERT INTO `crmdb`.`contact_job_title_pl` (`id`, `val`) VALUES ('17', '其他'); + + +ALTER TABLE `crmdb`.`userinfo` +ADD COLUMN `office_tel` VARCHAR(255) NULL AFTER `positionId`; + +DROP TABLE IF EXISTS `activity_whethercoach_pl`; +CREATE TABLE `crmdb`.`activity_whethercoach_pl` ( + `id` MEDIUMINT(9) NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`activity_whethercoach_pl` (`id`, `val`) VALUES ('1', '否'); +INSERT INTO `crmdb`.`activity_whethercoach_pl` (`id`, `val`) VALUES ('2', '协防半天'); +INSERT INTO `crmdb`.`activity_whethercoach_pl` (`id`, `val`) VALUES ('3', '协防一天'); + +UPDATE `crmdb`.`activity_event_type_pl` SET `val`='拜访辅导' WHERE `id`='2'; +INSERT INTO `crmdb`.`activity_event_type_pl` (`id`, `val`) VALUES ('3', '科室会辅导'); + +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `whetherCoach` MEDIUMINT(9) NULL AFTER `summary`; \ No newline at end of file diff --git a/crm/src/main/db/update_21.sql b/crm/src/main/db/update_21.sql new file mode 100644 index 0000000..f3f3f18 --- /dev/null +++ b/crm/src/main/db/update_21.sql @@ -0,0 +1,27 @@ +use crmdb; +UPDATE `crmdb`.`activity_whethercoach_pl` SET `val`='协访半天' WHERE `id`='2'; +UPDATE `crmdb`.`activity_whethercoach_pl` SET `val`='协访一天' WHERE `id`='3'; +UPDATE `crmdb`.`crmuser_activited` SET `id`='0', `val`='未激活' WHERE `id`='1'; +UPDATE `crmdb`.`crmuser_activited` SET `id`='1', `val`='已激活' WHERE `id`='2'; +DELETE FROM `crmdb`.`activity_whethercoach_pl` WHERE `id`='1'; +UPDATE `crmdb`.`activity_whethercoach_pl` SET `id`='1' WHERE `id`='2'; +UPDATE `crmdb`.`activity_whethercoach_pl` SET `id`='2' WHERE `id`='3'; +UPDATE `crmdb`.`userinfo` SET `email`='tigerzhou@rexen.com.cn', `sex`='1', `isActivited`='1' WHERE `id`='1'; +UPDATE `crmdb`.`userinfo` SET `email`='alexsong@rexen.com.cn', `sex`='1', `isActivited`='1' WHERE `id`='2'; +UPDATE `crmdb`.`userinfo` SET `email`='feiyunzhou@rexen.com.cn', `sex`='1', `isActivited`='1' WHERE `id`='3'; +UPDATE `crmdb`.`userinfo` SET `sex`='1', `isActivited`='1' WHERE `id`='-1'; +UPDATE `crmdb`.`userinfo` SET `city`='1' WHERE `id`='1'; +UPDATE `crmdb`.`userinfo` SET `city`='1' WHERE `id`='2'; +UPDATE `crmdb`.`userinfo` SET `city`='1' WHERE `id`='3'; +UPDATE `crmdb`.`userinfo` SET `province`='1' WHERE `id`='1'; +UPDATE `crmdb`.`userinfo` SET `province`='1' WHERE `id`='2'; +UPDATE `crmdb`.`userinfo` SET `province`='1' WHERE `id`='3'; + +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `coachTime` MEDIUMINT(9) NULL AFTER `whetherCoach`; + +ALTER TABLE `crmdb`.`contact` +ADD COLUMN `num_of_monthlySurgery` MEDIUMINT(9) NULL AFTER `contactCode`, +ADD COLUMN `num_of_monthlyAnalgesia` MEDIUMINT(9) NULL AFTER `num_of_monthlySurgery`; + + diff --git a/crm/src/main/db/update_22.sql b/crm/src/main/db/update_22.sql new file mode 100644 index 0000000..8befd28 --- /dev/null +++ b/crm/src/main/db/update_22.sql @@ -0,0 +1,125 @@ +use crmdb; + + +drop table if exists activity_score3_pl; +CREATE TABLE `crmdb`.`activity_score3_pl` ( + `id` INT NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + + drop table if exists activity_score4_pl; +CREATE TABLE `crmdb`.`activity_score4_pl` ( + `id` INT NOT NULL, + `val` VARCHAR(25) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + + +drop table if exists activity_score5_pl; +CREATE TABLE `crmdb`.`activity_score5_pl` ( +`id` INT NOT NULL, +`val` VARCHAR(255) NULL, +PRIMARY KEY (`id`) +)ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('0', '0'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('1', '1'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('2', '2'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('3', '3'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('4', '4'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('5', '5'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('6', '6'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('7', '7'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('8', '8'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('9', '9'); +INSERT INTO `crmdb`.`activity_score3_pl` (`id`, `val`) VALUES ('10', '10'); + +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('0', '0'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('1', '1'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('2', '2'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('3', '3'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('4', '4'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('5', '5'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('6', '6'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('7', '7'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('8', '8'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('9', '9'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('10', '10'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('11', '11'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('12', '12'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('13', '13'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('14', '14'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('15', '15'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('16', '16'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('17', '17'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('18', '18'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('19', '19'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('20', '20'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('21', '21'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('22', '22'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('23', '23'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('24', '24'); +INSERT INTO `crmdb`.`activity_score4_pl` (`id`, `val`) VALUES ('25', '25'); + +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('0', '0'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('1', '1'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('2', '2'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('3', '3'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('4', '4'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('5', '5'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('6', '6'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('7', '7'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('8', '8'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('9', '9'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('10', '10'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('11', '11'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('12', '12'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('13', '13'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('14', '14'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('15', '15'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('16', '16'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('17', '17'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('18', '18'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('19', '19'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('20', '20'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('21', '21'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('22', '22'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('23', '23'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('24', '24'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('25', '25'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('26', '26'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('27', '27'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('28', '28'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('29', '29'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('30', '30'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('31', '31'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('32', '32'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('33', '33'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('34', '34'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('35', '35'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('36', '36'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('37', '37'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('38', '38'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('39', '39'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('40', '40'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('41', '41'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('42', '42'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('43', '43'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('44', '44'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('45', '45'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('46', '46'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('47', '47'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('48', '48'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('49', '49'); +INSERT INTO `crmdb`.`activity_score5_pl` (`id`, `val`) VALUES ('50', '50'); + + +UPDATE `crmdb`.`crmuser_pl2` SET `id`='3', `val`='奥诺美' WHERE `id`='3'; + INSERT INTO `crmdb`.`crmuser_pl2` (`id`, `val`) VALUES ('4', '全部'); +UPDATE `crmdb`.`activity_visiting_purpose_pl` SET `activity_type`='1', `parentId`='1' WHERE `id`='3'; + +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `accountId` MEDIUMINT(9) NULL AFTER `coachTime`, +ADD COLUMN `department` MEDIUMINT(9) NULL AFTER `accountId`, +ADD COLUMN `whether_coach` VARCHAR(255) NULL AFTER `department`; \ No newline at end of file diff --git a/crm/src/main/db/update_23.sql b/crm/src/main/db/update_23.sql new file mode 100644 index 0000000..d165a13 --- /dev/null +++ b/crm/src/main/db/update_23.sql @@ -0,0 +1,11 @@ +use crmdb; +DROP TABLE IF EXISTS `activity_coachtime_pl`; +CREATE TABLE `crmdb`.`activity_coachtime_pl` ( + `id` INT NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`activity_coachtime_pl` (`id`, `val`) VALUES ('1', '无'); +INSERT INTO `crmdb`.`activity_coachtime_pl` (`id`, `val`) VALUES ('2', '半天'); +INSERT INTO `crmdb`.`activity_coachtime_pl` (`id`, `val`) VALUES ('3', '全天'); \ No newline at end of file diff --git a/crm/src/main/db/update_24.sql b/crm/src/main/db/update_24.sql new file mode 100644 index 0000000..d4fea0e --- /dev/null +++ b/crm/src/main/db/update_24.sql @@ -0,0 +1,8 @@ +use crmdb; +ALTER TABLE `crmdb`.`userinfo` +ADD COLUMN `num_of_signIn` MEDIUMINT(9) NULL AFTER `office_tel`; + +ALTER TABLE `crmdb`.`user_position` +ADD COLUMN `status` INT NULL DEFAULT NULL AFTER `positionId`, +ADD COLUMN `createtime` DATETIME NULL DEFAULT NULL AFTER `status`, +ADD COLUMN `isPrimary` INT NULL DEFAULT NULL AFTER `createtime`; \ No newline at end of file diff --git a/crm/src/main/db/update_25.sql b/crm/src/main/db/update_25.sql new file mode 100644 index 0000000..349f319 --- /dev/null +++ b/crm/src/main/db/update_25.sql @@ -0,0 +1,13 @@ +use crmdb; +ALTER TABLE `crmdb`.`account` +CHANGE COLUMN `administrativ_level` `administrativ_level` MEDIUMINT(9) NULL DEFAULT NULL , +CHANGE COLUMN `grade` `grade` MEDIUMINT(9) NULL DEFAULT NULL ; + +ALTER TABLE `crmdb`.`contact` +CHANGE COLUMN `department` `department` MEDIUMINT(9) NULL ; + +ALTER TABLE `crmdb`.`crmuser` +CHANGE COLUMN `city` `city` MEDIUMINT(9) NULL DEFAULT NULL ; + +ALTER TABLE `crmdb`.`accountcrmuser` +ADD COLUMN `externalId` VARCHAR(45) NULL AFTER `crmuserId`; \ No newline at end of file diff --git a/crm/src/main/db/update_26.sql b/crm/src/main/db/update_26.sql new file mode 100644 index 0000000..9c55073 --- /dev/null +++ b/crm/src/main/db/update_26.sql @@ -0,0 +1,10 @@ +use crmdb; +ALTER TABLE `crmdb`.`data_exchange_teample` +DROP FOREIGN KEY `FK8AE35445D557144C`, +DROP FOREIGN KEY `FK8AE35445199BCB6C`; +ALTER TABLE `crmdb`.`data_exchange_teample` +DROP COLUMN `type_id`, +DROP COLUMN `operation_id`, +DROP COLUMN `version`, +DROP INDEX `FK8AE35445199BCB6C` , +DROP INDEX `FK8AE35445D557144C` ; \ No newline at end of file diff --git a/crm/src/main/db/update_28.sql b/crm/src/main/db/update_28.sql new file mode 100644 index 0000000..45f1cea --- /dev/null +++ b/crm/src/main/db/update_28.sql @@ -0,0 +1,50 @@ +DROP TABLE IF EXISTS `alert`; +CREATE TABLE `crmdb`.`alert` ( + `id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255) NOT NULL, + `publishDate` BIGINT(20) NULL, + `expired` BIGINT(20) NULL, + `priority` MEDIUMINT(9) NULL, + `towhom` MEDIUMINT(9) NULL, + `description` LONGTEXT NULL, + `owner` VARCHAR(255) NULL, + `whenadded` DATETIME NULL, + `modifier` VARCHAR(255) NULL, + `modify_datetime` DATETIME NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `alert_priority_pl`; + CREATE TABLE `crmdb`.`alert_priority_pl` ( + `id` MEDIUMINT(9) NOT NULL, + `val` VARCHAR(255) NULL, +PRIMARY KEY (`id`) +)ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `alert_publicobject_pl`; +CREATE TABLE `crmdb`.`alert_publicobject_pl` ( + `id` MEDIUMINT(9) NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`alert_priority_pl` (`id`, `val`) VALUES ('1', '高级'); +INSERT INTO `crmdb`.`alert_priority_pl` (`id`, `val`) VALUES ('2', '中级'); +INSERT INTO `crmdb`.`alert_priority_pl` (`id`, `val`) VALUES ('3', '低级'); + +INSERT INTO `crmdb`.`alert_publicobject_pl` (`id`, `val`) VALUES ('1', '管理员'); +INSERT INTO `crmdb`.`alert_publicobject_pl` (`id`, `val`) VALUES ('2', '主管'); +INSERT INTO `crmdb`.`alert_publicobject_pl` (`id`, `val`) VALUES ('3', '代表'); + +drop view if exists crmdb.activity_alert; +create view crmdb.activity_alert as +SELECT id, +case when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=0 THEN '今天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=1 THEN '昨天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=2 THEN '前天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))>=3 and to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))<7 THEN '三天以前' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))>=7 THEN '七天以前' +ELSE '错误' END as time, +title +FROM crmdb.activity act where event_type=1 and status=1 order by time + diff --git a/crm/src/main/db/update_29.sql b/crm/src/main/db/update_29.sql new file mode 100644 index 0000000..da59ebe --- /dev/null +++ b/crm/src/main/db/update_29.sql @@ -0,0 +1,33 @@ +use crmdb; +drop view if exists crmdb.user_position_account; +create view user_position_account as +select ac.id as id,u.name as userName,u.loginName as loginName,u.email as email,sp.val as sex,u.whenadded as addTime, +c.name as positionName,c.code as positionCode,(select name from crmuser crm where crm.id=c.reportto) as reportTo,(select name from crmuser c1 where c1.id =(select c2.reportto from crmuser c2 where id=c.reportto)) as reporttto,r.val as role,rlp4.val as regoin1,rlp5.val as regoin2,ct.val as city, +a.name as accountName,a.bdm_code as BDMCode,aalp.val as adminLevel,asp.val as status +from userinfo u +left join sex_pl sp +on u.sex=sp.id +left join user_position up +on u.id=up.userId +left join crmuser c +on up.positionId =c.id +left join role r +on c.role=r.id +left join region_level1_pl rlp4 +on c.pl4=rlp4.id +left join region_level1_pl rlp5 +on c.pl5=rlp5.id +left join city ct +on c.city=ct.id +left join accountcrmuser ac +on c.id=ac.crmuserId +left join account a +on ac.accountId=a.id +left join account_status_pl asp +on a.status =asp.id +left join account_administrativ_level_pl aalp on +a.administrativ_level=aalp.id +where up.status=1 order by id; + +ALTER TABLE `crmdb`.`userinfo` +DROP COLUMN `positionId`; diff --git a/crm/src/main/db/update_3.sql b/crm/src/main/db/update_3.sql new file mode 100644 index 0000000..5970e59 --- /dev/null +++ b/crm/src/main/db/update_3.sql @@ -0,0 +1,5 @@ + +ALTER TABLE `crmdb`.`activity` +CHANGE COLUMN `coach` `coach` MEDIUMINT(9) NULL DEFAULT NULL ; +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `coacheeId` MEDIUMINT(9) NULL AFTER `contactId`; diff --git a/crm/src/main/db/update_31.sql b/crm/src/main/db/update_31.sql new file mode 100644 index 0000000..0367b55 --- /dev/null +++ b/crm/src/main/db/update_31.sql @@ -0,0 +1,34 @@ +UPDATE `crmdb`.`activity_status_pl` SET `val`='未执行' WHERE `id`='3'; + +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `activity_daypart` MEDIUMINT(9) NULL AFTER `whether_coach`; + +drop table if exists activity_daypart_pl; +CREATE TABLE `crmdb`.`activity_daypart_pl` ( + `id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`)); + +INSERT INTO `crmdb`.`activity_daypart_pl` (`id`, `val`) VALUES ('1', '上午'); +INSERT INTO `crmdb`.`activity_daypart_pl` (`id`, `val`) VALUES ('2', '下午'); + +-- ALTER TABLE `crmdb`.`activitycrmuser` +-- DROP FOREIGN KEY `crm_activity_cons2`; + +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='2'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='3'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='4'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='6'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='7'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='8'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='10'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='11'; +DELETE FROM `crmdb`.`account_administrativ_level_pl` WHERE `id`='12'; + +UPDATE `crmdb`.`account_administrativ_level_pl` SET `val`='未评级' WHERE `id`= '13'; + +drop table `crmdb`.`account_grade_pl`; + +ALTER TABLE `crmdb`.`account` +DROP COLUMN `grade`; + diff --git a/crm/src/main/db/update_32.sql b/crm/src/main/db/update_32.sql new file mode 100644 index 0000000..99fe9d9 --- /dev/null +++ b/crm/src/main/db/update_32.sql @@ -0,0 +1,42 @@ +use crmdb; + +set session old_alter_table =on; +ALTER IGNORE TABLE crmuser ADD UNIQUE (code); +set session old_alter_table =off; + +ALTER table contact ADD externalId varchar(128); +set session old_alter_table =on; +ALTER IGNORE TABLE contact ADD UNIQUE (externalId); +set session old_alter_table =off; + +set session old_alter_table =on; +ALTER IGNORE TABLE userinfo ADD UNIQUE (employeeNumber); +set session old_alter_table =off; + + +DROP TABLE IF EXISTS `area`; +DROP TABLE IF EXISTS `city`; +DROP TABLE IF EXISTS `province`; + +DROP TABLE IF EXISTS `province`; +CREATE TABLE `province` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; +INSERT INTO `province` VALUES (1,'北京','110000'),(2,'天津','120000'),(3,'河北','130000'),(4,'山西','140000'),(5,'内蒙古','150000'),(6,'辽宁','210000'),(7,'吉林','220000'),(8,'黑龙江','230000'),(9,'上海','310000'),(10,'江苏','320000'),(11,'浙江','330000'),(12,'安徽','340000'),(13,'福建','350000'),(14,'江西','360000'),(15,'山东','370000'),(16,'河南','410000'),(17,'湖北','420000'),(18,'湖南','430000'),(19,'广东','440000'),(20,'广西','450000'),(21,'海南','460000'),(22,'重庆','500000'),(23,'四川','510000'),(24,'贵州','520000'),(25,'云南','530000'),(26,'西藏','540000'),(27,'陕西','610000'),(28,'甘肃','620000'),(29,'青海','630000'),(30,'宁夏','640000'),(31,'新疆','650000'),(32,'台湾','710000'),(33,'香港','810000'),(34,'澳门','820000'); + +DROP TABLE IF EXISTS `city`; +CREATE TABLE `city` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `val` varchar(20) DEFAULT NULL, + `externalId` varchar(20) DEFAULT NULL, + `parentId` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `city_parentid_cons` (`parentId`), + CONSTRAINT `city_parentid_cons` FOREIGN KEY (`parentId`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT INTO `city` VALUES (1,'北京','110100',1),(2,'石家庄','130100',3),(3,'唐山','130200',3),(4,'秦皇岛','130300',3),(5,'邯郸','130400',3),(6,'邢台','130500',3),(7,'保定','130600',3),(8,'张家口','130700',3),(9,'承德','130800',3),(10,'沧州','130900',3),(11,'廊坊','131000',3),(12,'衡水','131100',3),(13,'太原','140100',4),(14,'大同','140200',4),(15,'阳泉','140300',4),(16,'长治','140400',4),(17,'晋城','140500',4),(18,'朔州','140600',4),(19,'晋中','140700',4),(20,'运城','140800',4),(21,'忻州','140900',4),(22,'临汾','141000',4),(23,'吕梁','141100',4),(24,'呼和浩特','150100',5),(25,'包头','150200',5),(26,'乌海','150300',5),(27,'赤峰','150400',5),(28,'通辽','150500',5),(29,'鄂尔多斯','150600',5),(30,'呼伦贝尔','150700',5),(31,'巴彦淖尔','150800',5),(32,'乌兰察布','150900',5),(33,'兴安盟','152200',5),(34,'锡林郭勒盟','152500',5),(35,'阿拉善盟','152900',5),(36,'沈阳','210100',6),(37,'大连','210200',6),(38,'鞍山','210300',6),(39,'抚顺','210400',6),(40,'本溪','210500',6),(41,'丹东','210600',6),(42,'锦州','210700',6),(43,'营口','210800',6),(44,'阜新','210900',6),(45,'辽阳','211000',6),(46,'盘锦','211100',6),(47,'铁岭','211200',6),(48,'朝阳','211300',6),(49,'葫芦岛','211400',6),(50,'长春','220100',7),(51,'吉林','220200',7),(52,'四平','220300',7),(53,'辽源','220400',7),(54,'通化','220500',7),(55,'白山','220600',7),(56,'松原','220700',7),(57,'白城','220800',7),(58,'延边朝鲜族自治州','222400',7),(59,'哈尔滨','230100',8),(60,'齐齐哈尔','230200',8),(61,'鸡西','230300',8),(62,'鹤岗','230400',8),(63,'双鸭山','230500',8),(64,'大庆','230600',8),(65,'伊春','230700',8),(66,'佳木斯','230800',8),(67,'七台河','230900',8),(68,'牡丹江','231000',8),(69,'黑河','231100',8),(70,'绥化','231200',8),(71,'大兴安岭地区','232700',8),(72,'上海','310100',9),(73,'县','310200',9),(74,'南京','320100',10),(75,'无锡','320200',10),(76,'徐州','320300',10),(77,'常州','320400',10),(78,'苏州','320500',10),(79,'南通','320600',10),(80,'连云港','320700',10),(81,'淮安','320800',10),(82,'盐城','320900',10),(83,'扬州','321000',10),(84,'镇江','321100',10),(85,'泰州','321200',10),(86,'宿迁','321300',10),(87,'杭州','330100',11),(88,'宁波','330200',11),(89,'温州','330300',11),(90,'嘉兴','330400',11),(91,'湖州','330500',11),(92,'绍兴','330600',11),(93,'金华','330700',11),(94,'衢州','330800',11),(95,'舟山','330900',11),(96,'台州','331000',11),(97,'丽水','331100',11),(98,'合肥','340100',12),(99,'芜湖','340200',12),(100,'蚌埠','340300',12),(101,'淮南','340400',12),(102,'马鞍山','340500',12),(103,'淮北','340600',12),(104,'铜陵','340700',12),(105,'安庆','340800',12),(106,'黄山','341000',12),(107,'滁州','341100',12),(108,'阜阳','341200',12),(109,'宿州','341300',12),(110,'巢湖','341400',12),(111,'六安','341500',12),(112,'亳州','341600',12),(113,'池州','341700',12),(114,'宣城','341800',12),(115,'福州','350100',13),(116,'厦门','350200',13),(117,'莆田','350300',13),(118,'三明','350400',13),(119,'泉州','350500',13),(120,'漳州','350600',13),(121,'南平','350700',13),(122,'龙岩','350800',13),(123,'宁德','350900',13),(124,'南昌','360100',14),(125,'景德镇','360200',14),(126,'萍乡','360300',14),(127,'九江','360400',14),(128,'新余','360500',14),(129,'鹰潭','360600',14),(130,'赣州','360700',14),(131,'吉安','360800',14),(132,'宜春','360900',14),(133,'抚州','361000',14),(134,'上饶','361100',14),(135,'济南','370100',15),(136,'青岛','370200',15),(137,'淄博','370300',15),(138,'枣庄','370400',15),(139,'东营','370500',15),(140,'烟台','370600',15),(141,'潍坊','370700',15),(142,'济宁','370800',15),(143,'泰安','370900',15),(144,'威海','371000',15),(145,'日照','371100',15),(146,'莱芜','371200',15),(147,'临沂','371300',15),(148,'德州','371400',15),(149,'聊城','371500',15),(150,'滨州','371600',15),(151,'荷泽','371700',15),(152,'郑州','410100',16),(153,'开封','410200',16),(154,'洛阳','410300',16),(155,'平顶山','410400',16),(156,'安阳','410500',16),(157,'鹤壁','410600',16),(158,'新乡','410700',16),(159,'焦作','410800',16),(160,'濮阳','410900',16),(161,'许昌','411000',16),(162,'漯河','411100',16),(163,'三门峡','411200',16),(164,'南阳','411300',16),(165,'商丘','411400',16),(166,'信阳','411500',16),(167,'周口','411600',16),(168,'驻马店','411700',16),(169,'武汉','420100',17),(170,'黄石','420200',17),(171,'十堰','420300',17),(172,'宜昌','420500',17),(173,'襄樊','420600',17),(174,'鄂州','420700',17),(175,'荆门','420800',17),(176,'孝感','420900',17),(177,'荆州','421000',17),(178,'黄冈','421100',17),(179,'咸宁','421200',17),(180,'随州','421300',17),(181,'恩施土家族苗族自治州','422800',17),(182,'省直辖行政单位','429000',17),(183,'长沙','430100',18),(184,'株洲','430200',18),(185,'湘潭','430300',18),(186,'衡阳','430400',18),(187,'邵阳','430500',18),(188,'岳阳','430600',18),(189,'常德','430700',18),(190,'张家界','430800',18),(191,'益阳','430900',18),(192,'郴州','431000',18),(193,'永州','431100',18),(194,'怀化','431200',18),(195,'娄底','431300',18),(196,'湘西土家族苗族自治州','433100',18),(197,'广州','440100',19),(198,'韶关','440200',19),(199,'深圳','440300',19),(200,'珠海','440400',19),(201,'汕头','440500',19),(202,'佛山','440600',19),(203,'江门','440700',19),(204,'湛江','440800',19),(205,'茂名','440900',19),(206,'肇庆','441200',19),(207,'惠州','441300',19),(208,'梅州','441400',19),(209,'汕尾','441500',19),(210,'河源','441600',19),(211,'阳江','441700',19),(212,'清远','441800',19),(213,'东莞','441900',19),(214,'中山','442000',19),(215,'潮州','445100',19),(216,'揭阳','445200',19),(217,'云浮','445300',19),(218,'南宁','450100',20),(219,'柳州','450200',20),(220,'桂林','450300',20),(221,'梧州','450400',20),(222,'北海','450500',20),(223,'防城港','450600',20),(224,'钦州','450700',20),(225,'贵港','450800',20),(226,'玉林','450900',20),(227,'百色','451000',20),(228,'贺州','451100',20),(229,'河池','451200',20),(230,'来宾','451300',20),(231,'崇左','451400',20),(232,'海口','460100',21),(233,'三亚','460200',21),(234,'省直辖县级行政单位','469000',21),(235,'辖区','500100',22),(236,'县','500200',22),(237,'','500300',22),(238,'成都','510100',23),(239,'自贡','510300',23),(240,'攀枝花','510400',23),(241,'泸州','510500',23),(242,'德阳','510600',23),(243,'绵阳','510700',23),(244,'广元','510800',23),(245,'遂宁','510900',23),(246,'内江','511000',23),(247,'乐山','511100',23),(248,'南充','511300',23),(249,'眉山','511400',23),(250,'宜宾','511500',23),(251,'广安','511600',23),(252,'达州','511700',23),(253,'雅安','511800',23),(254,'巴中','511900',23),(255,'资阳','512000',23),(256,'阿坝藏族羌族自治州','513200',23),(257,'甘孜藏族自治州','513300',23),(258,'凉山彝族自治州','513400',23),(259,'贵阳','520100',24),(260,'六盘水','520200',24),(261,'遵义','520300',24),(262,'安顺','520400',24),(263,'铜仁地区','522200',24),(264,'黔西南布依族苗族自治州','522300',24),(265,'毕节地区','522400',24),(266,'黔东南苗族侗族自治州','522600',24),(267,'黔南布依族苗族自治州','522700',24),(268,'昆明','530100',25),(269,'曲靖','530300',25),(270,'玉溪','530400',25),(271,'保山','530500',25),(272,'昭通','530600',25),(273,'丽江','530700',25),(274,'思茅','530800',25),(275,'临沧','530900',25),(276,'楚雄彝族自治州','532300',25),(277,'红河哈尼族彝族自治州','532500',25),(278,'文山壮族苗族自治州','532600',25),(279,'西双版纳傣族自治州','532800',25),(280,'大理白族自治州','532900',25),(281,'德宏傣族景颇族自治州','533100',25),(282,'怒江傈僳族自治州','533300',25),(283,'迪庆藏族自治州','533400',25),(284,'拉萨','540100',26),(285,'昌都地区','542100',26),(286,'山南地区','542200',26),(287,'日喀则地区','542300',26),(288,'那曲地区','542400',26),(289,'阿里地区','542500',26),(290,'林芝地区','542600',26),(291,'西安','610100',27),(292,'铜川','610200',27),(293,'宝鸡','610300',27),(294,'咸阳','610400',27),(295,'渭南','610500',27),(296,'延安','610600',27),(297,'汉中','610700',27),(298,'榆林','610800',27),(299,'安康','610900',27),(300,'商洛','611000',27),(301,'兰州','620100',28),(302,'嘉峪关','620200',28),(303,'金昌','620300',28),(304,'白银','620400',28),(305,'天水','620500',28),(306,'武威','620600',28),(307,'张掖','620700',28),(308,'平凉','620800',28),(309,'酒泉','620900',28),(310,'庆阳','621000',28),(311,'定西','621100',28),(312,'陇南','621200',28),(313,'临夏回族自治州','622900',28),(314,'甘南藏族自治州','623000',28),(315,'西宁','630100',29),(316,'海东地区','632100',29),(317,'海北藏族自治州','632200',29),(318,'黄南藏族自治州','632300',29),(319,'海南藏族自治州','632500',29),(320,'果洛藏族自治州','632600',29),(321,'玉树藏族自治州','632700',29),(322,'海西蒙古族藏族自治州','632800',29),(323,'银川','640100',30),(324,'石嘴山','640200',30),(325,'吴忠','640300',30),(326,'固原','640400',30),(327,'中卫','640500',30),(328,'乌鲁木齐','650100',31),(329,'克拉玛依','650200',31),(330,'吐鲁番地区','652100',31),(331,'哈密地区','652200',31),(332,'昌吉回族自治州','652300',31),(333,'博尔塔拉蒙古自治州','652700',31),(334,'巴音郭楞蒙古自治州','652800',31),(335,'阿克苏地区','652900',31),(336,'克孜勒苏柯尔克孜自治州','653000',31),(337,'喀什地区','653100',31),(338,'和田地区','653200',31),(339,'伊犁哈萨克自治州','654000',31),(340,'塔城地区','654200',31),(341,'阿勒泰地区','654300',31),(342,'省直辖行政单位','659000',31),(343,'天津',NULL,2); +-- ALTER table userinfo drop positionId; diff --git a/crm/src/main/db/update_33.sql b/crm/src/main/db/update_33.sql new file mode 100644 index 0000000..6f7798d --- /dev/null +++ b/crm/src/main/db/update_33.sql @@ -0,0 +1,47 @@ +drop table if exists importMetaInfo; +CREATE TABLE importMetaInfo +( + id MEDIUMINT NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + entity_name VARCHAR(255), + importfilename VARCHAR(255), + logfilename VARCHAR(255), + whenadded DATETIME, + modifier VARCHAR(255), + modify_datetime DATETIME, + num_of_total_record MEDIUMINT, + num_of_imported MEDIUMINT, + num_of_failed MEDIUMINT, + status MEDIUMINT, + result MEDIUMINT, + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB; + + + +DROP TABLE IF EXISTS `importstatus`; +CREATE TABLE `crmdb`.`importstatus` ( + `id` INT NOT NULL, + `val` VARCHAR(45), + PRIMARY KEY (`id`) +) ENGINE InnoDB; +INSERT INTO importstatus (id,val) VALUES(0,'运行'); +INSERT INTO importstatus (id,val) VALUES(1,'已完成'); + +DROP TABLE IF EXISTS `importresult`; +CREATE TABLE `crmdb`.`importresult` ( + `id` INT NOT NULL, + `val` VARCHAR(45) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE InnoDB; +INSERT INTO importresult (id,val) VALUES(0,'成功'); +INSERT INTO importresult (id,val) VALUES(1,'失败'); + + +ALTER table user_position add externalId varchar(128); +ALTER table user_position add whenadded DATETIME; +ALTER table user_position add modifier VARCHAR(255); +ALTER table user_position add modify_datetime DATETIME; + + +ALTER TABLE user_position drop KEY user_position_unique; \ No newline at end of file diff --git a/crm/src/main/db/update_34.sql b/crm/src/main/db/update_34.sql new file mode 100644 index 0000000..aae5ef3 --- /dev/null +++ b/crm/src/main/db/update_34.sql @@ -0,0 +1,15 @@ +ALTER TABLE `crmdb`.`userinfo` +DROP COLUMN `ts`, +DROP COLUMN `isActivited`, +ADD UNIQUE INDEX `loginName_UNIQUE` (`loginName` ASC); + + +alter table importMetaInfo add num_of_updated int; + + +-- ALTER table accountcrmuser add externalId varchar(128); +ALTER table accountcrmuser add whenadded DATETIME; +ALTER table accountcrmuser add modifier VARCHAR(255); +ALTER table accountcrmuser add modify_datetime DATETIME; + +insert into user_position (userId,positionId,isPrimary) values(1,1,1); \ No newline at end of file diff --git a/crm/src/main/db/update_35.sql b/crm/src/main/db/update_35.sql new file mode 100644 index 0000000..8f89aab --- /dev/null +++ b/crm/src/main/db/update_35.sql @@ -0,0 +1,4 @@ +-- ALTER TABLE `crmdb`.`userinfo` +-- DROP COLUMN `ts`, +-- DROP COLUMN `isActivited`, +-- ADD UNIQUE INDEX `loginName_UNIQUE` (`loginName` ASC); \ No newline at end of file diff --git a/crm/src/main/db/update_36.sql b/crm/src/main/db/update_36.sql new file mode 100644 index 0000000..147081d --- /dev/null +++ b/crm/src/main/db/update_36.sql @@ -0,0 +1,7 @@ + +use crmdb; + + +set session old_alter_table =on; +ALTER IGNORE TABLE user_position ADD UNIQUE (positionId); +set session old_alter_table =off; diff --git a/crm/src/main/db/update_37.sql b/crm/src/main/db/update_37.sql new file mode 100644 index 0000000..7abe7e6 --- /dev/null +++ b/crm/src/main/db/update_37.sql @@ -0,0 +1,13 @@ +drop view if exists crmdb.activity_alert; +create view crmdb.activity_alert as +SELECT id, +case when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=0 THEN '今天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=1 THEN '昨天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))=2 THEN '前天' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))>=3 and to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))<7 THEN '三天以前' +when to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))>=7 THEN '七天以前' +ELSE '错误' END as time, +title, +act.owner as name, +act.starttime as times +FROM crmdb.activity act where status=1 and to_days(curdate())-to_days(DATE_FORMAT(from_unixtime(act.starttime/1000),'%Y-%m-%d'))>=0 order by times \ No newline at end of file diff --git a/crm/src/main/db/update_38.sql b/crm/src/main/db/update_38.sql new file mode 100644 index 0000000..516bab5 --- /dev/null +++ b/crm/src/main/db/update_38.sql @@ -0,0 +1,3 @@ +use crmdb; + +alter table account CHANGE COLUMN date_of_establish date_of_establish varchar(128); \ No newline at end of file diff --git a/crm/src/main/db/update_39.sql b/crm/src/main/db/update_39.sql new file mode 100644 index 0000000..c5c6a02 --- /dev/null +++ b/crm/src/main/db/update_39.sql @@ -0,0 +1,41 @@ +drop view if exists parent_user_info; +drop view if exists parent_user_position; +drop view if exists parent_position; +create view parent_user_info as select * from userinfo; +create view parent_user_position as select * from user_position; +create view parent_position as select * from crmuser; + +drop view if exists user_position_query; + +create view user_position_query as +select user_position.userid user_id, + user_position.positionid position_id, + region_level1_pl.val area, + region_level2_pl.val region, + province.val province, + crmuser_pl2.val productLine, + crmuser.level position_level, + crmuser.name position_name, + crmuser.code position_code, + userinfo.employeenumber delegatePosition, + userinfo.name delegateName, + parent_position.id manager_position_id, + parent_position.code managerPosition, + parent_position.name manager_position_name, + parent_position.level manager_position_level, + parent_user_info.employeenumber manager_employee_number, + parent_user_info.name regionManager, + account.name accountName, + account.bdm_code BDMcode +from user_position +left join crmuser on user_position.positionid = crmuser.id +left join userinfo on user_position.userid = userinfo.id +left join parent_position on crmuser.reportto = parent_position.id +left join parent_user_position on parent_position.id = parent_user_position.positionid +left join parent_user_info on parent_user_position.userid = parent_user_info.id +inner join accountcrmuser on user_position.positionid = accountcrmuser.crmuserid +inner join account on accountcrmuser.accountid = account.id +left join region_level1_pl on crmuser.pl4 = region_level1_pl.id +left join region_level2_pl on crmuser.pl5 = region_level2_pl.id +left join province on account.province = province.id +left join crmuser_pl2 on crmuser_pl2.id = crmuser.pl2 diff --git a/crm/src/main/db/update_4.sql b/crm/src/main/db/update_4.sql new file mode 100644 index 0000000..a00a678 --- /dev/null +++ b/crm/src/main/db/update_4.sql @@ -0,0 +1,19 @@ +use crmdb; + +drop trigger if exists activity_score_insert; +DELIMITER | + +CREATE TRIGGER activity_score_insert BEFORE INSERT ON activity + FOR EACH ROW BEGIN + SET NEW.total_score = (NEW.planing + NEW.openling + NEW.enquery_listening + NEW.deliverable + NEW.objection_handing + NEW.summary); + END; +| + +drop trigger if exists activity_score_update; +CREATE TRIGGER activity_score_update BEFORE UPDATE ON activity + FOR EACH ROW BEGIN + SET NEW.total_score = (NEW.planing + NEW.openling + NEW.enquery_listening + NEW.deliverable + NEW.objection_handing + NEW.summary); + END; +| + +DELIMITER ; \ No newline at end of file diff --git a/crm/src/main/db/update_40.sql b/crm/src/main/db/update_40.sql new file mode 100644 index 0000000..991b60a --- /dev/null +++ b/crm/src/main/db/update_40.sql @@ -0,0 +1,8 @@ +drop table if exists crmuser_level_pl; +CREATE TABLE `crmdb`.`crmuser_level_pl` ( + `id` INT NOT NULL, + `val` VARCHAR(45) NULL, + PRIMARY KEY (`id`)); + INSERT INTO `crmdb`.`crmuser_level_pl` (`id`, `val`) VALUES ('11', '11'); +INSERT INTO `crmdb`.`crmuser_level_pl` (`id`, `val`) VALUES ('21', '21'); +INSERT INTO `crmdb`.`crmuser_level_pl` (`id`, `val`) VALUES ('31', '31'); \ No newline at end of file diff --git a/crm/src/main/db/update_41.sql b/crm/src/main/db/update_41.sql new file mode 100644 index 0000000..d0ee79e --- /dev/null +++ b/crm/src/main/db/update_41.sql @@ -0,0 +1,2 @@ +INSERT INTO `crmdb`.`contact_grade_pl` (`val`) VALUES ('V'); +INSERT INTO `crmdb`.`contact_grade_pl` (`val`) VALUES ('非目标医生'); diff --git a/crm/src/main/db/update_5.sql b/crm/src/main/db/update_5.sql new file mode 100644 index 0000000..693b2bd --- /dev/null +++ b/crm/src/main/db/update_5.sql @@ -0,0 +1,15 @@ +use crmdb; +ALTER TABLE `crmdb`.`crmuser` +CHANGE COLUMN `isActivited` `isActivited` MEDIUMINT(9) NULL DEFAULT NULL ; + +DROP TABLE IF EXISTS `crmuser_activited`; +CREATE TABLE `crmdb`.`crmuser_activited` ( + `id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB; +INSERT INTO `crmdb`.`crmuser_activited` (`id`, `val`) VALUES ('1', '已激活'); +INSERT INTO `crmdb`.`crmuser_activited` (`id`, `val`) VALUES ('2', '未激活'); + +ALTER TABLE `crmdb`.`account` +ADD UNIQUE INDEX `account_ix_01` (`bdm_code` ASC); \ No newline at end of file diff --git a/crm/src/main/db/update_51.sql b/crm/src/main/db/update_51.sql new file mode 100644 index 0000000..e1da5ce --- /dev/null +++ b/crm/src/main/db/update_51.sql @@ -0,0 +1,16 @@ +DELETE FROM `crmdb`.`activity_coachtime_pl` WHERE `id`='1'; +DROP TABLE `crmdb`.`activity_whethercoach_pl`; +UPDATE `crmdb`.`city` SET `val`='菏泽' WHERE `id`='151'; +UPDATE `crmdb`.`city` SET `val`='重庆' WHERE `id`='235'; +DELETE FROM `crmdb`.`city` WHERE `id`='236'; +INSERT INTO `crmdb`.`city` (`id`, `val`, `parentId`) VALUES ('345', '未知地域', '31'); +INSERT INTO `crmdb`.`city` (`id`, `val`, `parentId`) VALUES ('346', '未知地域', '27'); +INSERT INTO `crmdb`.`city` (`id`, `val`, `parentId`) VALUES ('347', '三河(虚拟)', '1'); + +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美北区' WHERE `id`='1'; +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美东北区' WHERE `id`='2'; +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美东一区' WHERE `id`='3'; +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美东二区' WHERE `id`='4'; +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美西区' WHERE `id`='5'; +UPDATE `crmdb`.`region_level2_pl` SET `val`='奥诺美南区' WHERE `id`='6'; +DELETE FROM `crmdb`.`region_level2_pl` WHERE `id`='7'; \ No newline at end of file diff --git a/crm/src/main/db/update_52.sql b/crm/src/main/db/update_52.sql new file mode 100644 index 0000000..ac3c3ff --- /dev/null +++ b/crm/src/main/db/update_52.sql @@ -0,0 +1,8 @@ +UPDATE `crmdb`.`alert_publicobject_pl` SET `val`='系统管理员' WHERE `id`='1'; +UPDATE `crmdb`.`alert_publicobject_pl` SET `val`='地区经理' WHERE `id`='2'; +UPDATE `crmdb`.`alert_publicobject_pl` SET `val`='销售代表' WHERE `id`='3'; + +DELETE FROM `crmdb`.`contact_grade_pl` WHERE `id`='4'; +UPDATE `crmdb`.`contact_grade_pl` SET `id`='4' WHERE `id`='5'; +UPDATE `crmdb`.`contact_grade_pl` SET `id`='5' WHERE `id`='6'; + diff --git a/crm/src/main/db/update_53.sql b/crm/src/main/db/update_53.sql new file mode 100644 index 0000000..9f503f0 --- /dev/null +++ b/crm/src/main/db/update_53.sql @@ -0,0 +1,51 @@ +DELETE FROM `crmdb`.`crmuser_pl2` WHERE `id`='4'; + +INSERT INTO `crmdb`.`alert_publicobject_pl` (`id`, `val`) VALUES ('4', '所有人'); + +drop view if exists crmdb.call_export; +create view crmdb.call_export as +SELECT act.id as id,act.title as Activity_title,acp.val as Activity_whetherCoach,afpp.val as Activity_feature_product,at.val as Activity_types,act.whenadded as Activity_addTime,act.modify_datetime as Activity_modifyTime,from_unixtime(act.starttime/1000) as Activity_start,from_unixtime(act.endtime/1000) as Activity_end, +u.name as Position_name,rlp1.val as Region_level_1,rlp2.val as Region_level_2,u.code as position_code,r.val as position_role, +c.name as Contact_name,cgp.val as Contact_grade,cdp.val as Contact_department,sp.val as Contact_sex,c.email as Contact_email,cdp2.val as Contact_duty,cjtp.val as Contact_job_title, +a.name as Account_name , a.bdm_code as Account_BDMCode,atl.val as Account_type,aalp.val as Account_administrative_level,aloap.val as local_or_army,acosp.val as comprehensive_or_specialized,app.val as isKey,asp.val as Account_status +FROM crmdb.activity act +left join crmdb.activity_coachtime_pl acp on +act.whetherCoach=acp.id +left join crmdb.activity_feature_product_pl afpp on +act.feature_product=afpp.id +left join crmdb.activity_types at on +act.activity_type=at.id +left join crmdb.crmuser u on +act.crmuserId = u.id +left join crmdb.contact c on +act.contactId = c.id +left join crmdb.contact_grade_pl cgp on +c.grade=cgp.id +left join crmdb.contact_department_pl cdp on +c.department=cdp.id +left join crmdb.sex_pl sp on +c.sex=sp.id +left join crmdb.contact_duty_pl cdp2 on +c.duty=cdp2.id +left join crmdb.contact_job_title_pl cjtp on +c.job_title=cjtp.id +left join crmdb.region_level1_pl rlp1 on +u.pl5=rlp1.id +left join crmdb.region_level2_pl rlp2 on +u.pl4=rlp2.id +left join crmdb.role r on +u.role=r.id +left join crmdb.account a on +c.accountId= a.id +left join crmdb.account_type_pl atl on +a.hospital_type = atl.id +left join crmdb.account_administrativ_level_pl aalp on +a.administrativ_level=aalp.id +left join crmdb.account_local_or_army_pl aloap on +a.local_or_army=aloap.id +left join crmdb.account_comprehensive_or_specialized_pl acosp on +a.comprehensive_or_specialized=acosp.id +left join crmdb.account_point_pl app on +a.key_type=app.id +left join crmdb.account_status_pl asp on +a.status=asp.id order by id \ No newline at end of file diff --git a/crm/src/main/db/update_54.sql b/crm/src/main/db/update_54.sql new file mode 100644 index 0000000..1c02bb6 --- /dev/null +++ b/crm/src/main/db/update_54.sql @@ -0,0 +1,13 @@ +CREATE TABLE `product` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(128) NOT NULL, + `status` int(11) NOT NULL DEFAULT '1', + `parentid` int(11) DEFAULT NULL, + `specification` varchar(512) DEFAULT NULL, + `created_date` datetime DEFAULT NULL, + `modified_date` datetime DEFAULT NULL, + `created_by_user_id` int(11) DEFAULT NULL, + `modfied_by_user_id` int(11) DEFAULT NULL, + `level` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; diff --git a/crm/src/main/db/update_55.sql b/crm/src/main/db/update_55.sql new file mode 100644 index 0000000..a4c4ebd --- /dev/null +++ b/crm/src/main/db/update_55.sql @@ -0,0 +1,15 @@ +use crmdb; + +drop table if exists activity_coachtime_pl; +CREATE TABLE activity_coachtime_pl +( + id MEDIUMINT NOT NULL, + val VARCHAR(255), + PRIMARY KEY USING BTREE (id) +) ENGINE InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `crmdb`.`activity_coachtime_pl` (`id`, `val`) VALUES ('1', '半天'); +INSERT INTO `crmdb`.`activity_coachtime_pl` (`id`, `val`) VALUES ('2', '全天'); + + +ALTER table accountcrmuser add owner VARCHAR(255); +ALTER table user_position add owner VARCHAR(255); \ No newline at end of file diff --git a/crm/src/main/db/update_56.sql b/crm/src/main/db/update_56.sql new file mode 100644 index 0000000..0a31884 --- /dev/null +++ b/crm/src/main/db/update_56.sql @@ -0,0 +1,32 @@ +DELETE FROM `crmdb`.`region_level1_pl` WHERE `id`='3'; +DELETE FROM `crmdb`.`region_level1_pl` WHERE `id`='1'; +DELETE FROM `crmdb`.`region_level1_pl` WHERE `id`='2'; +INSERT INTO `crmdb`.`region_level1_pl` (`id`, `val`) VALUES ('1', '中国区'); + +ALTER TABLE `crmdb`.`alert` +ADD COLUMN `alertRegion` MEDIUMINT(9) NULL AFTER `modify_datetime`; + +DROP TABLE IF EXISTS `crmdb`.`alert_region_pl`; +CREATE TABLE `crmdb`.`alert_region_pl` ( + `id` INT NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('1', '奥诺美北区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('2', '奥诺美东北区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('3', '奥诺美东一区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('4', '奥诺美东二区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('5', '奥诺美西区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('6', '奥诺美南区'); +INSERT INTO `crmdb`.`alert_region_pl` (`id`, `val`) VALUES ('7', '所有区'); + +DELETE FROM `crmdb`.`data_exchange_teample` WHERE `id`='1'; + +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('1', 'Account Export Full Template 1.0', '\n\n 1000\n Account\n BdmCode\n account.csv\n crm_mysql\n 100000\n GBK\n \n Id\n Integer\n Id\n \n\n \n Name\n String\n Name\n \n\n\n \n BdmCode\n String\n BdmCode\n \n\n\n \n DutyOfficer\n String\n DutyOfficer\n \n\n \n numofdoctors\n Integer\n numofdoctors\n \n\n \n numofsurgeryroom\n Integer\n numofsurgeryroom\n \n \n numofsurgeryperyear\n Integer\n numofsurgeryperyear\n \n \n numofpaindoctor\n Integer\n numofpaindoctor\n \n \n numofanesthesiadoctor\n Integer\n numofanesthesiadoctor\n \n \n totalnumofsickbed\n Integer\n totalnumofsickbed\n \n \n numofoutpatient\n Integer\n numofoutpatient\n \n \n numoftreatperyear\n Integer\n numoftreatperyear\n \n \n numofstaff\n Integer\n numofstaff\n \n \n numofassistantdoctors\n Integer\n numofassistantdoctors\n \n\n \n registeredcapital\n Integer\n registeredcapital\n \n \n numofusingopiatesinjection\n Integer\n numofusingopiatesinjection\n \n \n numofusingopiatesmedicine\n Integer\n numofusingopiatesmedicine\n \n\n \n dateofestablish\n Date\n dateofestablish\n m/d/yy\n \n\n \n fax\n Integer\n fax\n \n\n \n tel\n Integer\n tel\n \n\n \n districts\n Integer\n districts\n \n \n address\n Integer\n address\n \n \n owner\n Integer\n owner\n \n \n responsibleperson\n Integer\n responsibleperson\n \n\n\n \n whenadded\n Date\n whenadded\n m/d/yy\n \n\n \n modifydatetime\n Date\n modifydatetime\n m/d/yy\n \n\n \n modifier\n String\n modifier\n \n\n \n administrativlevel\n Integer\n administrativlevel\n \n\n\n \n 医院类型\n Lookup\n HospitalType\n AccountTypePl\n Val\n Id\n \n\n \n localorarmy\n Lookup\n localorarmy\n AccountLocalOrArmyPl\n Val\n Id\n \n\n \n comprehensiveorspecialized\n Lookup\n comprehensiveorspecialized\n AccountComprehensiveOrSpecializedPl\n Val\n Id\n \n\n\n \n keytype\n Lookup\n keytype\n AccountPointPl\n Val\n Id\n \n \n status\n Lookup\n status\n AccountStatusPl\n Val\n Id\n \n\n \n marketclassification\n Lookup\n marketclassification\n AccountMarketClassificationPl\n Val\n Id\n \n \n province\n Lookup\n province\n Province\n Val\n Id\n \n \n city\n Lookup\n city\n City\n Val\n Id\n \n\n'); +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('2', 'Contact Export Full Template 1.0', '\n\n 1000\n Contact\n contact.csv\n contactCode\n crm_mysql\n GBK\n 100000\n \n contactCode\n String\n contactCode\n \n \n duty\n Lookup\n duty\n ContactDutyPl\n val\n Id\n \n \n grade\n Lookup\n grade\n ContactGradePl\n val\n Id\n \n \n \n \n \n marketclassification\n Lookup\n marketclassification\n ContactMarketClassificationPl\n val\n Id\n \n \n \n jobtitle\n Lookup\n jobtitle\n ContactJobTitlePl\n val\n Id\n \n \n \n accountId\n Lookup\n accountId\n Account\n Name\n Id\n \n \n \n \n \n city\n Lookup\n city\n City\n val\n Id\n \n \n \n sex\n Lookup\n sex\n SexPl\n val\n Id\n \n \n \n \n \n province\n Lookup\n province\n Province\n val\n Id\n \n \n cellphone\n String\n cellphone\n \n \n contactCode\n String\n contactCode\n \n \n 科室\n Lookup\n department\n ContactDepartmentPl\n val\n id\n \n \n districts\n String\n districts\n \n \n email\n String\n email\n \n \n modifier\n String\n modifier\n \n \n name\n String\n name\n \n \n nativeplace\n String\n nativeplace\n \n \n officefax\n String\n officefax\n \n \n officetel\n String\n officetel\n \n \n owner\n String\n owner\n \n \n producttarget\n String\n producttarget\n \n \n responsibleperson\n String\n responsibleperson\n \n \n status\n String\n status\n \n \n modifydatetime\n Date\n modifydatetime\n m/d/yy\n \n \n whenadded\n Date\n whenadded\n m/d/yy\n \n \n \n \n \n \n'); +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('3', 'Position Export Full Template 1.0', '\n\n 1000\n Crmuser\n Id\n position.csv\n crm_mysql\n GBK\n 100000\n \n Id\n Integer\n Id\n \n \n Name\n String\n Name\n \n \n code\n String\n code\n \n \n reportto\n Integer\n reportto\n \n \n role\n Lookup\n role\n Role\n Val\n Id\n \n \n pl1\n Lookup\n pl1\n CrmuserPl1\n Val\n Id\n \n \n pl2\n Lookup\n pl2\n CrmuserPl2\n Val\n Id\n \n \n role\n Lookup\n role\n Role\n Val\n Id\n \n \n role\n Lookup\n role\n Role\n Val\n Id\n \n \n 城市\n Lookup\n city\n City\n Val\n Id\n \n \n modifier\n String\n Name\n \n \n department\n String\n Name\n \n\n \n pl4\n Lookup\n pl4\n RegionLevel1Pl\n Val\n Id\n \n \n pl5\n Lookup\n pl5\n RegionLevel2Pl\n Val\n Id\n \n \n whenadded\n Date\n whenadded\n m/d/yy\n \n \n modifydatetime\n Date\n modifydatetime\n m/d/yy\n \n \n owner\n String\n owner\n \n \n level\n Integer\n level\n \n'); +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('4', 'Activity Export Full Template 1.0', '\n\n 1000\n Activity\n Id\n Activity.csv\n crm_mysql\n GBK\n 100000\n \n Id\n Integer\n Id\n \n \n Name\n String\n Name\n \n \n eventtype\n Lookup\n eventtype\n ActivityEventTypePl\n val\n Id\n \n \n starttime\n Date\n starttime\n m/d/yy\n \n \n endtime\n Date\n endtime\n m/d/yy\n \n \n title\n String\n title\n \n \n participants\n String\n participants\n \n \n activitytype\n Lookup\n activitytype\n \n ActivityTypes\n val\n Id\n \n\n'); +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('5', 'Account Team Export Full Template 1.0', '\n\n 1000\n Accountcrmuser\n account_position.csv\n Id\n crm_mysql\n GBK\n 100000\n \n Id\n Integer\n Id\n \n \n \n accountId\n Lookup\n accountId\n Account\n Name\n Id\n \n \n \n crmuser\n Lookup\n crmuserid\n Crmuser\n name\n Id\n \n'); +INSERT INTO `crmdb`.`data_exchange_teample` (`id`, `name`, `template`) VALUES ('6', 'UserPosition Team Export Full Template 1.0', '\n\n 1000\n UserPosition\n user_position.csv\n ExternalId \n crm_mysql \n GBK\n 100000\n \n Id \n Integer \n Id \n \n positionId \n Integer \n positionId \n \n userId \n Integer \n userId \n \n \n positionid \n Lookup \n positionId \n Crmuser \n Name \n Id \n \n \n userId \n Lookup \n userId \n Userinfo \n name \n Id \n \n \n externalId \n String \n externalId \n \n'); + diff --git a/crm/src/main/db/update_57.sql b/crm/src/main/db/update_57.sql new file mode 100644 index 0000000..17e6698 --- /dev/null +++ b/crm/src/main/db/update_57.sql @@ -0,0 +1,14 @@ +ALTER TABLE `crmdb`.`activity` +ADD COLUMN `activity_coachType` MEDIUMINT(9) NULL AFTER `activity_daypart`; + +DROP TABLE IF EXISTS `crmdb`.`activity_coachtype_pl`; +CREATE TABLE `crmdb`.`activity_coachtype_pl` ( + `id` MEDIUMINT(9) NOT NULL, + `val` VARCHAR(255) NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; + +INSERT INTO `crmdb`.`activity_coachtype_pl` (`id`, `val`) VALUES ('1', '拜访辅导'); +INSERT INTO `crmdb`.`activity_coachtype_pl` (`id`, `val`) VALUES ('2', '科室会辅导'); +DELETE FROM `crmdb`.`activity_event_type_pl` WHERE `id`='3'; +UPDATE `crmdb`.`activity_event_type_pl` SET `val`='辅导' WHERE `id`='2'; \ No newline at end of file diff --git a/crm/src/main/db/update_58.sql b/crm/src/main/db/update_58.sql new file mode 100644 index 0000000..eaeec28 --- /dev/null +++ b/crm/src/main/db/update_58.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS `crmdb`.`data_audit`; +CREATE TABLE `crmdb`.`data_audit` ( + `id` INT NOT NULL AUTO_INCREMENT, + `entity_name` VARCHAR(45) NOT NULL, + `record_id` INT NOT NULL, + `modify_time` DATETIME NOT NULL, + `modifier` VARCHAR(45) NOT NULL, + `column_name` VARCHAR(45) NOT NULL, + `old_value` VARCHAR(45) , + `new_value` VARCHAR(45) , + PRIMARY KEY (`id`)); \ No newline at end of file diff --git a/crm/src/main/db/update_59.sql b/crm/src/main/db/update_59.sql new file mode 100644 index 0000000..9057d01 --- /dev/null +++ b/crm/src/main/db/update_59.sql @@ -0,0 +1,44 @@ +use crmdb; +drop table if Exists product; +drop table if Exists productline; +drop table if Exists productcategory; +CREATE TABLE `product` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(128) NOT NULL, + `status` int(11) NOT NULL DEFAULT '1', + `productlineId` int(11) NOT NULL, + `description` varchar(512) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `owner` varchar(50) DEFAULT NULL, + `modifier` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; + +CREATE TABLE `productcategory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(128) NOT NULL, + `status` int(11) NOT NULL DEFAULT '1', + `productId` int(11) NOT NULL, + `description` varchar(512) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `owner` varchar(50) DEFAULT NULL, + `modifier` varchar(50) DEFAULT NULL, + `productlineId` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=utf8; + +CREATE TABLE `productline` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(128) NOT NULL, + `status` int(11) NOT NULL DEFAULT '1', + `description` varchar(512) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `owner` varchar(50) DEFAULT NULL, + `modifier` varchar(50) DEFAULT NULL, + `val` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + diff --git a/crm/src/main/db/update_6.sql b/crm/src/main/db/update_6.sql new file mode 100644 index 0000000..e0752ff --- /dev/null +++ b/crm/src/main/db/update_6.sql @@ -0,0 +1,5 @@ +use crmdb; + +-- ALTER table activity_visiting_purpose_pl change activity_type parentId mediumint(9); +ALTER table activity_visiting_purpose_pl add parentId mediumint(9); +update activity_visiting_purpose_pl set parentId = activity_type; \ No newline at end of file diff --git a/crm/src/main/db/update_60.sql b/crm/src/main/db/update_60.sql new file mode 100644 index 0000000..7b963de --- /dev/null +++ b/crm/src/main/db/update_60.sql @@ -0,0 +1,3 @@ +ALTER TABLE `crmdb`.`activity` +CHANGE COLUMN `endtime` `endtime` DATETIME NULL , +CHANGE COLUMN `starttime` `starttime` DATETIME NOT NULL ; \ No newline at end of file diff --git a/crm/src/main/db/update_61.sql b/crm/src/main/db/update_61.sql new file mode 100644 index 0000000..433a86d --- /dev/null +++ b/crm/src/main/db/update_61.sql @@ -0,0 +1,15 @@ +CREATE TABLE `crmdb`.`accountcrmuser_relation_history` ( + `id` INT NOT NULL AUTO_INCREMENT, + `position_id` INT NOT NULL, + `account_id` INT NOT NULL, + `modify_time` DATE NOT NULL, + `modifier` VARCHAR(45) NOT NULL, + PRIMARY KEY (`id`)); + +CREATE TABLE `crmdb`.`userposition_relation_history` ( + `id` INT NOT NULL AUTO_INCREMENT, + `position_id` INT NOT NULL, + `userinfo_id` INT NOT NULL, + `modify_time` DATE NOT NULL, + `modifier` VARCHAR(45) NOT NULL, + PRIMARY KEY (`id`)); diff --git a/crm/src/main/db/update_62.sql b/crm/src/main/db/update_62.sql new file mode 100644 index 0000000..f5039ce --- /dev/null +++ b/crm/src/main/db/update_62.sql @@ -0,0 +1,3 @@ +ALTER TABLE `crmdb`.`alert` +CHANGE COLUMN `expired` `expired` DATETIME NULL DEFAULT NULL , +CHANGE COLUMN `publishDate` `publishDate` DATETIME NULL DEFAULT NULL ; diff --git a/crm/src/main/db/update_63.sql b/crm/src/main/db/update_63.sql new file mode 100644 index 0000000..e305f40 --- /dev/null +++ b/crm/src/main/db/update_63.sql @@ -0,0 +1,15 @@ +drop view if exists crmdb.activity_alert; +create view crmdb.activity_alert as +select +id, +case +when to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))=0 THEN '今天' +when to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))=1 THEN '昨天' +when to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))=2 THEN '前天' +when to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))>=3 and to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))<7 THEN '三天以前' +when to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))>=7 THEN '七天以前' +ELSE '错误' END as time, +title, +act.owner as name, +act.starttime as times +from activity act where status=1 and to_days(curdate())-to_days(DATE_FORMAT(act.starttime,'%Y-%m-%d'))>=0 order by times \ No newline at end of file diff --git a/crm/src/main/db/update_64.sql b/crm/src/main/db/update_64.sql new file mode 100644 index 0000000..11123b5 --- /dev/null +++ b/crm/src/main/db/update_64.sql @@ -0,0 +1,15 @@ +ALTER TABLE `crmdb`.`alert` +ADD COLUMN `attachment` MEDIUMINT(9) NULL AFTER `alertRegion`; + +CREATE TABLE `crmdb`.`alertattachment` ( + `id` MEDIUMINT(9) NOT NULL, + `fileName` VARCHAR(255) NULL, + `whenadded` DATETIME NULL, + `owner` VARCHAR(255) NULL, + `alertId` MEDIUMINT(9) NULL, + `modify_datetime` DATETIME NULL, + PRIMARY KEY (`id`) + )ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; + +ALTER TABLE `crmdb`.`data_audit` +CHANGE COLUMN `modify_time` `modify_time` DATETIME NOT NULL ; diff --git a/crm/src/main/db/update_65.sql b/crm/src/main/db/update_65.sql new file mode 100644 index 0000000..c74f2e8 --- /dev/null +++ b/crm/src/main/db/update_65.sql @@ -0,0 +1,35 @@ +drop view if exists user_position_query; +create view user_position_query as select +accountcrmuser.id as id, + `user_position`.`userId` AS `user_id`, + `user_position`.`positionId` AS `position_id`, + `region_level1_pl`.`val` AS `area`, + `region_level2_pl`.`val` AS `region`, + `province`.`val` AS `province`, + `crmuser_pl2`.`val` AS `productLine`, + `crmuser`.`level` AS `position_level`, + `crmuser`.`name` AS `position_name`, + `crmuser`.`code` AS `position_code`, + `userinfo`.`employeeNumber` AS `delegatePosition`, + `userinfo`.`name` AS `delegateName`, + `parent_position`.`id` AS `manager_position_id`, + `parent_position`.`code` AS `managerPosition`, + `parent_position`.`name` AS `manager_position_name`, + `parent_position`.`level` AS `manager_position_level`, + `parent_user_info`.`employeeNumber` AS `manager_employee_number`, + `parent_user_info`.`name` AS `regionManager`, + `account`.`name` AS `accountName`, + `account`.`bdm_code` AS `BDMcode` + from + (((((((((((`user_position` + left join `crmuser` ON ((`user_position`.`positionId` = `crmuser`.`id`))) + left join `userinfo` ON ((`user_position`.`userId` = `userinfo`.`id`))) + left join `parent_position` ON ((`crmuser`.`reportto` = `parent_position`.`id`))) + left join `parent_user_position` ON ((`parent_position`.`id` = `parent_user_position`.`positionId`))) + left join `parent_user_info` ON ((`parent_user_position`.`userId` = `parent_user_info`.`id`))) + join `accountcrmuser` ON ((`user_position`.`positionId` = `accountcrmuser`.`crmuserId`))) + join `account` ON ((`accountcrmuser`.`accountId` = `account`.`id`))) + left join `region_level1_pl` ON ((`crmuser`.`pl4` = `region_level1_pl`.`id`))) + left join `region_level2_pl` ON ((`crmuser`.`pl5` = `region_level2_pl`.`id`))) + left join `province` ON ((`account`.`province` = `province`.`id`))) + left join `crmuser_pl2` ON ((`crmuser_pl2`.`id` = `crmuser`.`pl2`))) \ No newline at end of file diff --git a/crm/src/main/db/update_66.sql b/crm/src/main/db/update_66.sql new file mode 100644 index 0000000..d92785a --- /dev/null +++ b/crm/src/main/db/update_66.sql @@ -0,0 +1,8 @@ +ALTER TABLE `crmdb`.`userposition_relation_history` +CHANGE COLUMN `userinfo_id` `user_id` INT(11) NOT NULL , +CHANGE COLUMN `modify_time` `modify_time` DATETIME NOT NULL ; + + +ALTER TABLE `crmdb`.`accountcrmuser_relation_history` +CHANGE COLUMN `modify_time` `modify_time` DATETIME NOT NULL ; + diff --git a/crm/src/main/db/update_67.sql b/crm/src/main/db/update_67.sql new file mode 100644 index 0000000..970ae93 --- /dev/null +++ b/crm/src/main/db/update_67.sql @@ -0,0 +1,41 @@ +drop VIEW if exists user_position_query; +USE `crmdb`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `crm`@`localhost` + SQL SECURITY DEFINER +VIEW `user_position_query` AS + select + `accountcrmuser`.`id` AS `id`, + `user_position`.`userId` AS `user_id`, + `user_position`.`positionId` AS `position_id`, + `region_level1_pl`.`val` AS `area`, + `region_level2_pl`.`val` AS `region`, + `province`.`val` AS `province`, + `productline`.`val` AS `productLine`, + `crmuser`.`level` AS `position_level`, + `crmuser`.`name` AS `position_name`, + `crmuser`.`code` AS `position_code`, + `userinfo`.`employeeNumber` AS `delegatePosition`, + `userinfo`.`name` AS `delegateName`, + `parent_position`.`id` AS `manager_position_id`, + `parent_position`.`code` AS `managerPosition`, + `parent_position`.`name` AS `manager_position_name`, + `parent_position`.`level` AS `manager_position_level`, + `parent_user_info`.`employeeNumber` AS `manager_employee_number`, + `parent_user_info`.`name` AS `regionManager`, + `account`.`name` AS `accountName`, + `account`.`bdm_code` AS `BDMcode` + from + (((((((((((`user_position` + left join `crmuser` ON ((`user_position`.`positionId` = `crmuser`.`id`))) + left join `userinfo` ON ((`user_position`.`userId` = `userinfo`.`id`))) + left join `parent_position` ON ((`crmuser`.`reportto` = `parent_position`.`id`))) + left join `parent_user_position` ON ((`parent_position`.`id` = `parent_user_position`.`positionId`))) + left join `parent_user_info` ON ((`parent_user_position`.`userId` = `parent_user_info`.`id`))) + join `accountcrmuser` ON ((`user_position`.`positionId` = `accountcrmuser`.`crmuserId`))) + join `account` ON ((`accountcrmuser`.`accountId` = `account`.`id`))) + left join `region_level1_pl` ON ((`crmuser`.`pl4` = `region_level1_pl`.`id`))) + left join `region_level2_pl` ON ((`crmuser`.`pl5` = `region_level2_pl`.`id`))) + left join `province` ON ((`account`.`province` = `province`.`id`))) + left join `productline` ON ((`productline`.`id` = `crmuser`.`pl2`))); diff --git a/crm/src/main/db/update_68.sql b/crm/src/main/db/update_68.sql new file mode 100644 index 0000000..184f650 --- /dev/null +++ b/crm/src/main/db/update_68.sql @@ -0,0 +1,22 @@ +drop view if exists activity_alert; +create view activity_alert as + +select `act`.`id` AS `id`, +(case when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) = 0) then '今天' +when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) = 1) then '昨天' +when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) = 2) then '前天' +when (((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) >= 3) and ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) < 7)) then '三天以前' +when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) >= 7) then '七天以前' + else '错误' end) AS `time`, +`act`.`title` AS `title`,`act`.`owner` AS `name`,`act`.`starttime` AS `starttime` ,act.endtime as endtime, +c.name as contact,avpp.val as purpose,act.whenadded as addtime,pl.val as product,acp.val as coachtype +from `activity` `act` +left join contact c on +c.id=act.contactId +left join activity_visiting_purpose_pl avpp on +act.visiting_purpose=avpp.id +left join productline pl on +pl.id=act.feature_product +left join activity_coachtype_pl acp on +acp.id=act.activity_coachType + where ((`act`.`status` = 1) and ((to_days(curdate()) - to_days(date_format(`act`.`starttime`,'%Y-%m-%d'))) >= 0)) order by `starttime` desc; diff --git a/crm/src/main/db/update_69.sql b/crm/src/main/db/update_69.sql new file mode 100644 index 0000000..a247244 --- /dev/null +++ b/crm/src/main/db/update_69.sql @@ -0,0 +1,20 @@ +drop view if exists user_position_account; +create view user_position_account as +select `ac`.`id` AS `id`,`u`.`name` AS `userName`,`u`.`loginName` AS `loginName`,`u`.`email` AS `email`,`sp`.`val` AS `sex`,`u`.`whenadded` AS `addTime`,`c`.`name` AS `positionName`,`c`.`code` AS `positionCode`, +(select `crm`.`name` from `crmuser` `crm` where (`crm`.`id` = `c`.`reportto`)) AS `reportTo`, +(select u.name from userinfo u left join user_position iup on iup.userId=u.id left join crmuser ic on ic.id=iup.positionId where ic.name=(select `crm`.`name` from `crmuser` `crm` where (`crm`.`id` = `c`.`reportto`))) as DSMName, +(select `c1`.`name` from `crmuser` `c1` where (`c1`.`id` = (select `c2`.`reportto` from `crmuser` `c2` where (`c2`.`id` = `c`.`reportto`)))) AS `reporttto`, +(select u.name from userinfo u left join user_position iup on iup.userId=u.id left join crmuser ic on ic.id=iup.positionId where ic.name=(select `c1`.`name` from `crmuser` `c1` where (`c1`.`id` = (select `c2`.`reportto` from `crmuser` `c2` where (`c2`.`id` = `c`.`reportto`))))) as RSMName, +`r`.`val` AS `role`,`rlp4`.`val` AS `regoin1`,`rlp5`.`val` AS `regoin2`,`ct`.`val` AS `city`,`a`.`name` AS `accountName`,`a`.`bdm_code` AS `BDMCode`,`aalp`.`val` AS `adminLevel`,`asp`.`val` AS `status` from (((((((((((`userinfo` `u` +left join `sex_pl` `sp` on((`u`.`sex` = `sp`.`id`))) +left join `user_position` `up` on((`u`.`id` = `up`.`userId`))) +left join `crmuser` `c` on((`up`.`positionId` = `c`.`id`))) +left join `role` `r` on((`c`.`role` = `r`.`id`))) +left join `region_level1_pl` `rlp4` on((`c`.`pl4` = `rlp4`.`id`))) +left join `region_level1_pl` `rlp5` on((`c`.`pl5` = `rlp5`.`id`))) +left join `city` `ct` on((`c`.`city` = `ct`.`id`))) + left join `accountcrmuser` `ac` on((`c`.`id` = `ac`.`crmuserId`))) +left join `account` `a` on((`ac`.`accountId` = `a`.`id`))) +left join `account_status_pl` `asp` on((`a`.`status` = `asp`.`id`))) +left join `account_administrativ_level_pl` `aalp` on((`a`.`administrativ_level` = `aalp`.`id`))) +where up.status = 1 and c.role>2 and ac.id>0 order by `ac`.`id`; diff --git a/crm/src/main/db/update_7.sql b/crm/src/main/db/update_7.sql new file mode 100644 index 0000000..ba1e6a5 --- /dev/null +++ b/crm/src/main/db/update_7.sql @@ -0,0 +1,59 @@ + + + + +DROP TABLE IF EXISTS `userInfo`; +CREATE TABLE `userInfo` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `department` varchar(255) DEFAULT NULL, + `division` varchar(255) DEFAULT NULL, + `cellPhone` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `employeeNumber` varchar(255) DEFAULT NULL, + `photo` varchar(255) DEFAULT NULL, + `jobTitle` varchar(255) DEFAULT NULL, + `pl1` mediumint(9) DEFAULT NULL, + `pl2` mediumint(9) DEFAULT NULL, + `role` mediumint(9) DEFAULT NULL, + `pl4` mediumint(9) DEFAULT NULL, + `pl5` mediumint(9) DEFAULT NULL, + `sex` mediumint(9) DEFAULT NULL, + `loginName` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + `sessionKey` varchar(255) DEFAULT NULL, + `lastLoginTime` bigint(20) DEFAULT NULL, + `whenadded` datetime DEFAULT NULL, + `reportto` mediumint(9) DEFAULT NULL, + `parcel` varchar(255) DEFAULT NULL, + `modifier` varchar(255) DEFAULT NULL, + `modify_datetime` datetime DEFAULT NULL, + `owner` varchar(255) DEFAULT NULL, + `postId` varchar(255) DEFAULT NULL, + `city` varchar(255) DEFAULT NULL, + `isActivited` mediumint(9) DEFAULT NULL, + `ts` bigint(20) DEFAULT NULL, + `positionId` mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8; + +INSERT INTO `userInfo` (id,name,loginname,password,role,isActivited,ts,positionId) VALUES +(-1,'无','dummy','827ccb0eea8a706c4c34a16891f84e7b',1,2,1386766666,-1), +(1,'Admin Nam','admin','827ccb0eea8a706c4c34a16891f84e7b',1,2,1386766666,1), +(2,'Sales Manager','salesman','827ccb0eea8a706c4c34a16891f84e7b',2,2,1386766666,2), +(3,'Sales','sales','827ccb0eea8a706c4c34a16891f84e7b',3,2,1386766666,3); + +insert into crmuser (id,name,code,reportto,role) values +(-1,'无','BJ',0,-1), +(1,'管理员','BJ231011001',-1,1), +(2,'北区地区经理01','BJ131011001',1,2), +(3,'北区代表001','BJ131001001',2,3); + + + +ALTER table crmuser ADD level MEDIUMINT; +ALTER table crmuser ADD position_code varchar(255); + + + + diff --git a/crm/src/main/db/update_70.sql b/crm/src/main/db/update_70.sql new file mode 100644 index 0000000..b5a7b34 --- /dev/null +++ b/crm/src/main/db/update_70.sql @@ -0,0 +1,3 @@ +ALTER TABLE `crmdb`.`alertattachment` +CHANGE COLUMN `id` `id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT , +ADD COLUMN `modifier` VARCHAR(255) NULL AFTER `modify_datetime`; \ No newline at end of file diff --git a/crm/src/main/db/update_71.sql b/crm/src/main/db/update_71.sql new file mode 100644 index 0000000..27c0cc2 --- /dev/null +++ b/crm/src/main/db/update_71.sql @@ -0,0 +1,2 @@ +ALTER TABLE `crmdb`.`alertattachment` +ADD COLUMN `srcForFile` VARCHAR(255) NULL AFTER `modifier`; \ No newline at end of file diff --git a/crm/src/main/db/update_72.sql b/crm/src/main/db/update_72.sql new file mode 100644 index 0000000..d8cd489 --- /dev/null +++ b/crm/src/main/db/update_72.sql @@ -0,0 +1,3 @@ +ALTER TABLE `crmdb`.`contact` +ADD COLUMN `initializationdepartment` VARCHAR(128) NULL AFTER `externalId`; +UPDATE `crmdb`.`contact_grade_pl` SET `val`='VIP' WHERE `id`='4'; \ No newline at end of file diff --git a/crm/src/main/db/update_73.sql b/crm/src/main/db/update_73.sql new file mode 100644 index 0000000..217b5a6 --- /dev/null +++ b/crm/src/main/db/update_73.sql @@ -0,0 +1,82 @@ +USE `crmdb`; +drop view if exists activity_alert; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `crm`@`localhost` + SQL SECURITY DEFINER +VIEW `activity_alert` AS + select + `act`.`id` AS `id`, + (case + when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) = 0) then '今天' + when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) = 1) then '昨天' + when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) = 2) then '前天' + when + (((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) >= 3) + and ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) < 7)) + then + '三天以前' + when ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) >= 7) then '七天以前' + else '错误' + end) AS `time`, + `act`.`title` AS `title`, + `act`.`owner` AS `name`, + `act`.`starttime` AS `starttime`, + `act`.`endtime` AS `endtime`, + `c`.`id` AS `contact`, + `avpp`.`val` AS `purpose`, + `act`.`whenadded` AS `addtime`, + `pl`.`val` AS `product`, + `acp`.`val` AS `coachtype` + from + ((((`activity` `act` + left join `contact` `c` ON ((`c`.`id` = `act`.`contactId`))) + left join `activity_visiting_purpose_pl` `avpp` ON ((`act`.`visiting_purpose` = `avpp`.`id`))) + left join `productline` `pl` ON ((`pl`.`id` = `act`.`feature_product`))) + left join `activity_coachtype_pl` `acp` ON ((`acp`.`id` = `act`.`activity_coachType`))) + where + ((`act`.`status` = 1) + and ((to_days(curdate()) - to_days(date_format(`act`.`starttime`, '%Y-%m-%d'))) >= 0)) + order by `act`.`starttime` desc; + + + drop view if exists user_position_query; + CREATE + ALGORITHM = UNDEFINED + DEFINER = `crm`@`localhost` + SQL SECURITY DEFINER +VIEW `user_position_query` AS + select + `accountcrmuser`.`id` AS `id`, + `user_position`.`userId` AS `user_id`, + `user_position`.`positionId` AS `position_id`, + `region_level1_pl`.`val` AS `area`, + `region_level2_pl`.`val` AS `region`, + `province`.`val` AS `province`, + `productline`.`val` AS `productLine`, + `crmuser`.`level` AS `position_level`, + `crmuser`.`name` AS `position_name`, + `crmuser`.`code` AS `position_code`, + `userinfo`.`employeeNumber` AS `delegatePosition`, + `userinfo`.`name` AS `delegateName`, + `parent_position`.`id` AS `manager_position_id`, + `parent_position`.`code` AS `managerPosition`, + `parent_position`.`name` AS `manager_position_name`, + `parent_position`.`level` AS `manager_position_level`, + `parent_user_info`.`employeeNumber` AS `manager_employee_number`, + `parent_user_info`.`name` AS `regionManager`, + `account`.`id` AS `accountName`, + `account`.`bdm_code` AS `BDMcode` + from + (((((((((((`user_position` + left join `crmuser` ON ((`user_position`.`positionId` = `crmuser`.`id`))) + left join `userinfo` ON ((`user_position`.`userId` = `userinfo`.`id`))) + left join `parent_position` ON ((`crmuser`.`reportto` = `parent_position`.`id`))) + left join `parent_user_position` ON ((`parent_position`.`id` = `parent_user_position`.`positionId`))) + left join `parent_user_info` ON ((`parent_user_position`.`userId` = `parent_user_info`.`id`))) + join `accountcrmuser` ON ((`user_position`.`positionId` = `accountcrmuser`.`crmuserId`))) + join `account` ON ((`accountcrmuser`.`accountId` = `account`.`id`))) + left join `region_level1_pl` ON ((`crmuser`.`pl4` = `region_level1_pl`.`id`))) + left join `region_level2_pl` ON ((`crmuser`.`pl5` = `region_level2_pl`.`id`))) + left join `province` ON ((`account`.`province` = `province`.`id`))) + left join `productline` ON ((`productline`.`id` = `crmuser`.`pl2`))) diff --git a/crm/src/main/db/update_8.sql b/crm/src/main/db/update_8.sql new file mode 100644 index 0000000..1b91b40 --- /dev/null +++ b/crm/src/main/db/update_8.sql @@ -0,0 +1,9 @@ + +drop table if exists user_position; +create table user_position ( +id int(64) auto_increment, +userId int(64), +positionId int(64), +primary key (id), +unique index user_position_unique (userId,positionId) +)ENGINE InnoDB; \ No newline at end of file diff --git a/crm/src/main/doc/account_crmuser_import.csv b/crm/src/main/doc/account_crmuser_import.csv new file mode 100644 index 0000000..babebdb --- /dev/null +++ b/crm/src/main/doc/account_crmuser_import.csv @@ -0,0 +1 @@ +BDM,λ,ExternalId 16940,SH131011001,16940SH131011001 16879,SH131011001,16879SH131011001 16836,SH131011001,16836SH131011001 \ No newline at end of file diff --git a/crm/src/main/doc/account_crmuser_import.xml b/crm/src/main/doc/account_crmuser_import.xml new file mode 100644 index 0000000..192c097 --- /dev/null +++ b/crm/src/main/doc/account_crmuser_import.xml @@ -0,0 +1,30 @@ + + + 1000 + Accountcrmuser + account_crmuser_import.csv + ExternalId + crm_mysql + 100000 + + ExternalId + String + ExternalId + + + BDM编码 + Lookup + accountId + Account + BdmCode + Id + + + 岗位编码 + Lookup + crmuserid + Crmuser + Code + Id + + \ No newline at end of file diff --git a/crm/src/main/doc/account_export.xml b/crm/src/main/doc/account_export.xml new file mode 100644 index 0000000..00327ea --- /dev/null +++ b/crm/src/main/doc/account_export.xml @@ -0,0 +1,246 @@ + + + 1000 + Account + BdmCode + account.csv + crm_mysql + 100000 + + Id + Integer + Id + + + + Name + String + Name + + + + + BdmCode + String + BdmCode + + + + + Grade + String + Grade + + + + DutyOfficer + String + DutyOfficer + + + + numofdoctors + Integer + numofdoctors + + + + numofsurgeryroom + Integer + numofsurgeryroom + + + numofsurgeryperyear + Integer + numofsurgeryperyear + + + numofpaindoctor + Integer + numofpaindoctor + + + numofanesthesiadoctor + Integer + numofanesthesiadoctor + + + totalnumofsickbed + Integer + totalnumofsickbed + + + numofoutpatient + Integer + numofoutpatient + + + numoftreatperyear + Integer + numoftreatperyear + + + numofstaff + Integer + numofstaff + + + numofassistantdoctors + Integer + numofassistantdoctors + + + + registeredcapital + Integer + registeredcapital + + + numofusingopiatesinjection + Integer + numofusingopiatesinjection + + + numofusingopiatesmedicine + Integer + numofusingopiatesmedicine + + + + dateofestablish + Date + dateofestablish + m/d/yy + + + + fax + Integer + fax + + + + tel + Integer + tel + + + + districts + Integer + districts + + + address + Integer + address + + + owner + Integer + owner + + + responsibleperson + Integer + responsibleperson + + + + + whenadded + Date + whenadded + m/d/yy + + + + modifydatetime + Date + modifydatetime + m/d/yy + + + + modifier + String + modifier + + + + administrativlevel + String + administrativlevel + + + + + 医院类型 + Lookup + HospitalType + AccountTypePl + Val + Id + + + + localorarmy + Lookup + localorarmy + AccountLocalOrArmyPl + Val + Id + + + + comprehensiveorspecialized + Lookup + comprehensiveorspecialized + AccountComprehensiveOrSpecializedPl + Val + Id + + + + + keytype + Lookup + keytype + AccountPointPl + Val + Id + + + status + Lookup + status + AccountStatusPl + Val + Id + + + + marketclassification + Lookup + marketclassification + AccountMarketClassificationPl + Val + Id + + + province + Lookup + province + Province + Val + Id + + + city + Lookup + city + City + Val + Id + + diff --git a/crm/src/main/doc/account_import.csv b/crm/src/main/doc/account_import.csv new file mode 100644 index 0000000..f408d14 --- /dev/null +++ b/crm/src/main/doc/account_import.csv @@ -0,0 +1 @@ +BDM,׼ҽԺ,ʡ,,,,ҽԺ,طҽԺ,ۺרҽԺ,صҽԺ,״̬,ҽԺּ,г 10071,ѪܲרҽԺ,,,,,ŵĿҽԺ,طҽԺ,ۺҽԺ,ŵصҽԺ,Ч,,սԳ 11139,йһͻְҽԺ,,,ϳ,δ,ĿҽԺ,ҽԺ,רҽԺ,صҽԺ,Ч,,һ 1114,дȾҽԺ,,,,,ʹĿҽԺ,ҽԺ,ۺҽԺ,ŵصҽԺ,Ч,, \ No newline at end of file diff --git a/crm/src/main/doc/account_import.xml b/crm/src/main/doc/account_import.xml new file mode 100644 index 0000000..fc82666 --- /dev/null +++ b/crm/src/main/doc/account_import.xml @@ -0,0 +1,106 @@ + + + 1000 + Account + BdmCode + account_import.csv + crm_mysql + 100000 + + BDM编码 + String + BdmCode + + + 标准医院名 + String + Name + + + 省份 + Lookup + Province + Province + Val + Id + + + 城市 + Lookup + city + City + Val + Id + + + 区县 + String + districts + + + true + 行政级别 + Lookup + AdministrativLevel + AccountAdministrativLevelPl + Val + Id + + + true + 医院分级 + Lookup + Grade + AccountGradePl + Val + Id + + + 医院类型 + Lookup + HospitalType + AccountTypePl + Val + Id + + + 地方军队医院 + Lookup + LocalOrArmy + AccountLocalOrArmyPl + Val + Id + + + 综合专科医院 + Lookup + ComprehensiveOrSpecialized + AccountComprehensiveOrSpecializedPl + Val + Id + + + 重点医院 + Lookup + KeyType + AccountPointPl + Val + Id + + + 状态 + Lookup + Status + AccountStatusPl + Val + Id + + + 市场分类 + Lookup + MarketClassification + AccountMarketClassificationPl + Val + Id + + diff --git a/crm/src/main/doc/account_position_export.xml b/crm/src/main/doc/account_position_export.xml new file mode 100644 index 0000000..876b701 --- /dev/null +++ b/crm/src/main/doc/account_position_export.xml @@ -0,0 +1,32 @@ + + + 1000 + Accountcrmuser + account_position.csv + Id + crm_mysql + 100000 + + Id + Integer + Id + + + + accountId + Lookup + accountId + Account + Name + Id + + + + crmuser + Lookup + crmuserid + Crmuser + name + Id + + \ No newline at end of file diff --git a/crm/src/main/doc/activity_crmuser_export.xml b/crm/src/main/doc/activity_crmuser_export.xml new file mode 100644 index 0000000..33499ae --- /dev/null +++ b/crm/src/main/doc/activity_crmuser_export.xml @@ -0,0 +1,35 @@ + + + 1000 + Activitycrmuser + activity_crmuser.csv + Id + crm_mysql + 100000 + + Id + Integer + Id + + + + activityid + Lookup + activityid + Activity + Name + Id + + + + crmuserid + Lookup + crmuserid + Userinfo + name + Id + + + + + \ No newline at end of file diff --git a/crm/src/main/doc/activity_export.xml b/crm/src/main/doc/activity_export.xml new file mode 100644 index 0000000..364059b --- /dev/null +++ b/crm/src/main/doc/activity_export.xml @@ -0,0 +1,67 @@ + + + 1000 + Activity + Id + Activity.csv + crm_mysql + 100000 + + Id + Integer + Id + + + Name + String + Name + + + + crmuserId + Lookup + crmuserId + Userinfo + Name + Id + + + eventtype + Lookup + eventtype + ActivityEventTypePl + val + Id + + + starttime + Date + starttime + m/d/yy + + + endtime + Date + endtime + m/d/yy + + + title + String + title + + + participants + String + participants + + + activitytype + Lookup + activitytype + + ActivityTypes + val + Id + + diff --git a/crm/src/main/doc/configuration.xml b/crm/src/main/doc/configuration.xml new file mode 100644 index 0000000..94d59d6 --- /dev/null +++ b/crm/src/main/doc/configuration.xml @@ -0,0 +1,37 @@ + + + 1000 + crm_mysql + Account + ExternalId + + false + Id + Integer + Id + + + false + ExternalId + Integer + ExternalId + + + false + StartTime + Date + StartTime + YYYY-MM-DD + + + true + Department + Lookup + DepartmentId + Department + Name + Id + + account.csv + 1000000 + diff --git a/crm/src/main/doc/contact_export.xml b/crm/src/main/doc/contact_export.xml new file mode 100644 index 0000000..349d7f6 --- /dev/null +++ b/crm/src/main/doc/contact_export.xml @@ -0,0 +1,180 @@ + + + 1000 + Contact + contact.csv + contactCode + crm_mysql + 100000 + + contactCode + String + contactCode + + + duty + Lookup + duty + ContactDutyPl + val + Id + + + grade + Lookup + grade + ContactGradePl + val + Id + + + + + + marketclassification + Lookup + marketclassification + ContactMarketClassificationPl + val + Id + + + + jobtitle + Lookup + jobtitle + ContactJobTitlePl + val + Id + + + + accountId + Lookup + accountId + Account + Name + Id + + + + + + city + Lookup + city + City + val + Id + + + + sex + Lookup + sex + SexPl + val + Id + + + + + + province + Lookup + province + Province + val + Id + + + cellphone + String + cellphone + + + contactCode + String + contactCode + + + 科室 + Lookup + department + ContactDepartmentPl + val + id + + + districts + String + districts + + + email + String + email + + + modifier + String + modifier + + + name + String + name + + + nativeplace + String + nativeplace + + + officefax + String + officefax + + + officetel + String + officetel + + + owner + String + owner + + + producttarget + String + producttarget + + + responsibleperson + String + responsibleperson + + + status + String + status + + + modifydatetime + Date + modifydatetime + m/d/yy + + + whenadded + Date + whenadded + m/d/yy + + + + + + + \ No newline at end of file diff --git a/crm/src/main/doc/contact_import.csv b/crm/src/main/doc/contact_import.csv new file mode 100644 index 0000000..2a6d48c --- /dev/null +++ b/crm/src/main/doc/contact_import.csv @@ -0,0 +1 @@ +,ҽּ,¾,ʹ̨,ְ,ְ,Ա,ֻ,BDM,״̬,CRMҽ,ο, ƽ,A,80,80,סԺҽʦ,,,13888888888,20540,Ч,D0000001,, лȻ,A,20,20,ҽʦ,,Ů,13777777777,20540,Ч,D0000002,, ,A,20,20,ҽʦ,ɹ,,13555555555,20151,Ч,D0000003,, \ No newline at end of file diff --git a/crm/src/main/doc/contact_import.xml b/crm/src/main/doc/contact_import.xml new file mode 100644 index 0000000..be95619 --- /dev/null +++ b/crm/src/main/doc/contact_import.xml @@ -0,0 +1,76 @@ + + + 1000 + Contact + contact_import.csv + ContactCode + crm_mysql + 100000 + + + Code + String + ContactCode + + + + 目标医生姓名 + String + name + + + 医生级别 + Lookup + grade + ContactGradePl + val + Id + + + 职称 + Lookup + jobtitle + ContactJobTitlePl + val + Id + + + + 行政职务(如有) + Lookup + duty + ContactDutyPl + val + Id + + + 医院ID + Lookup + accountid + Account + BdmCode + Id + + + 科室 + Lookup + department + ContactDepartmentPl + val + id + + + 性别 + Lookup + sex + SexPl + val + Id + + + + 手机 + String + cellphone + + \ No newline at end of file diff --git a/crm/src/main/doc/crmuser_import.csv b/crm/src/main/doc/crmuser_import.csv new file mode 100644 index 0000000..0cff48d --- /dev/null +++ b/crm/src/main/doc/crmuser_import.csv @@ -0,0 +1 @@ +λ,λ,ϼλ,ɫ,״̬,Ʒ,,һ,, E1131031001,E1131031001,,,Ч,ŵ,31,й,,ŵһ һ01,SH131021001,E1131031001,,Ч,ŵ,21,й,Ϻ,ŵһ һ001,SH131011001,SH131021001,۴,Ч,ŵ,11,й,Ϻ,ŵһ \ No newline at end of file diff --git a/crm/src/main/doc/crmuser_reportto_import.csv b/crm/src/main/doc/crmuser_reportto_import.csv new file mode 100644 index 0000000..0cff48d --- /dev/null +++ b/crm/src/main/doc/crmuser_reportto_import.csv @@ -0,0 +1 @@ +λ,λ,ϼλ,ɫ,״̬,Ʒ,,һ,, E1131031001,E1131031001,,,Ч,ŵ,31,й,,ŵһ һ01,SH131021001,E1131031001,,Ч,ŵ,21,й,Ϻ,ŵһ һ001,SH131011001,SH131021001,۴,Ч,ŵ,11,й,Ϻ,ŵһ \ No newline at end of file diff --git a/crm/src/main/doc/mag.rptdesign b/crm/src/main/doc/mag.rptdesign new file mode 100644 index 0000000..903ef96 --- /dev/null +++ b/crm/src/main/doc/mag.rptdesign @@ -0,0 +1,8302 @@ + + + Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130918-1142> + + + Data Cube - dl_by_dn_date.dl_by_dn_date.x + integer + false + + + Data Cube - dl_by_dn_date.dl_by_dn_date.y + integer + false + + + downloading_mag.downloading_of_magazine.x + integer + false + + + downloading_mag.downloading_of_magazine.y + integer + false + + + downloading_mag.downloading_of_magazine.width + integer + false + + + downloading_mag.downloading_of_magazine.height + integer + false + + + downloading_mag.Group3.NewTabularHierarchy4.x + integer + false + + + downloading_mag.Group3.NewTabularHierarchy4.y + integer + false + + + 135 + 80 + 226 + 46 + 150 + 200 + 12 + 46 + + + queryText + 297 + + + queryTimeOut + 297 + + + rowFetchSize + 297 + + + queryText + 273 + + + queryTimeOut + 273 + + + rowFetchSize + 273 + + + queryText + 275 + + + queryTimeOut + 275 + + + rowFetchSize + 275 + + + in + /templates/blank_report.gif + auto layout + ltr + 96 + + + + + metadataBidiFormatStr + ILYNN + + + disabledMetadataBidiFormatStr + + + contentBidiFormatStr + ILYNN + + + disabledContentBidiFormatStr + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/analyzerdb + analyzer + New BIRT JDBC Data Source + abc + + + + + + + id + measure + id + id + + + device_id + dimension + device_id + device_id + + + log_time + dimension + log_time + log_time + + + event_type + dimension + event_type + event_type + + + param1 + dimension + param1 + param1 + + + param2 + dimension + param2 + param2 + + + param3 + dimension + param3 + param3 + + + param4 + dimension + param4 + param4 + + + param5 + dimension + param5 + param5 + + + param6 + dimension + param6 + param6 + + + + + + 1 + id + decimal + + + 2 + device_id + string + + + 3 + log_time + date-time + + + 4 + event_type + string + + + 5 + param1 + string + + + 6 + param2 + string + + + 7 + param3 + string + + + 8 + param4 + string + + + 9 + param5 + string + + + 10 + param6 + string + + + + analyzer data source + + + 1 + id + id + decimal + -5 + + + 2 + device_id + device_id + string + 12 + + + 3 + log_time + log_time + date-time + 93 + + + 4 + event_type + event_type + string + 12 + + + 5 + param1 + param1 + string + 12 + + + 6 + param2 + param2 + string + 12 + + + 7 + param3 + param3 + string + 12 + + + 8 + param4 + param4 + string + 12 + + + 9 + param5 + param5 + string + 12 + + + 10 + param6 + param6 + string + 12 + + + + + + 2.0 + + + + + + + id + 1 + + -5 + 20 + 0 + NotNullable + + id + + + + id + + 20 + + + + + + + device_id + 2 + + 12 + 64 + 0 + NotNullable + + device_id + + + + device_id + + 64 + + + + + + + log_time + 3 + + 93 + 19 + 0 + NotNullable + + log_time + + + + log_time + + 19 + + + + + + + event_type + 4 + + 12 + 32 + 0 + Nullable + + event_type + + + + event_type + + 32 + + + + + + + param1 + 5 + + 12 + 64 + 0 + Nullable + + param1 + + + + param1 + + 64 + + + + + + + param2 + 6 + + 12 + 64 + 0 + Nullable + + param2 + + + + param2 + + 64 + + + + + + + param3 + 7 + + 12 + 64 + 0 + Nullable + + param3 + + + + param3 + + 64 + + + + + + + param4 + 8 + + 12 + 64 + 0 + Nullable + + param4 + + + + param4 + + 64 + + + + + + + param5 + 9 + + 12 + 64 + 0 + Nullable + + param5 + + + + param5 + + 64 + + + + + + + param6 + 10 + + 12 + 64 + 0 + Nullable + + param6 + + + + param6 + + 64 + + + + + + + +]]> + + + nulls lowest + + + count(id) + measure + count(id) + count(id) + + + dldt + dimension + dldt + dldt + + + + + + + 1 + count(id) + decimal + + + 2 + dldt + date + + + + analyzer data source + + + 1 + count(id) + count(id) + decimal + -5 + + + 2 + dldt + dldt + date + 12 + + + + + + 2.0 + + + + + + + imei + 1 + + 12 + 32 + 0 + Nullable + + imei + + + + imei + + 32 + + + + + + + dldt + 2 + + 12 + 10 + 0 + Nullable + + dldt + + + + dldt + + 10 + + + + + + + +]]> + + + + + count(device_id) + measure + count(device_id) + count(device_id) + + + dt + dimension + dt + dt + + + + + + + 1 + count(device_id) + decimal + + + 2 + dt + date + + + + analyzer data source + + + 1 + count(device_id) + count(device_id) + decimal + -5 + + + 2 + dt + dt + date + 12 + + + + + + 2.0 + + + + + + + count(device_id) + 1 + + -5 + 21 + 0 + NotNullable + + count(device_id) + + + + count(device_id) + + 21 + + + + + + + dt + 2 + + 12 + 8 + 0 + Nullable + + dt + + + + dt + + 8 + + + + + + + +]]> + + + + + count(id) + measure + count(id) + count(id) + + + dt + dimension + dt + dt + + + + + + + 1 + count(id) + decimal + + + 2 + dt + string + + + + analyzer data source + + + 1 + count(id) + count(id) + decimal + -5 + + + 2 + dt + dt + string + 12 + + + + + + 2.0 + + + + + + + count(id) + 1 + + -5 + 21 + 0 + NotNullable + + count(id) + + + + count(id) + + 21 + + + + + + + dt + 2 + + 12 + 8 + 0 + Nullable + + dt + + + + dt + + 8 + + + + + + + +]]> + + + + + count(id) + measure + count(id) + count(id) + + + dt + dimension + dt + dt + + + + + + + 1 + count(id) + decimal + + + 2 + dt + date + + + + analyzer data source + + + 1 + count(id) + count(id) + decimal + -5 + + + 2 + dt + dt + date + 12 + + + + + + 2.0 + + + + + + + count(id) + 1 + + -5 + 21 + 0 + NotNullable + + count(id) + + + + count(id) + + 21 + + + + + + + dt + 2 + + 12 + 8 + 0 + Nullable + + dt + + + + dt + + 8 + + + + + + + +]]> + + + nulls lowest + + + dt + dimension + dt + dt + + + MagazineName + dimension + MagazineName + MagazineName + + + count(magazine.MagazineId) + measure + count(magazine.MagazineId) + count(magazine.MagazineId) + + + + + + + 1 + dt + date + + + 2 + MagazineName + string + + + 3 + count(magazine.MagazineId) + decimal + + + + analyzer data source + + + 1 + dt + dt + date + 12 + + + 2 + MagazineName + MagazineName + string + 12 + + + 3 + count(magazine.MagazineId) + count(magazine.MagazineId) + decimal + -5 + + + + + + 2.0 + + + + + + + id + 1 + + -5 + 20 + 0 + NotNullable + + id + + + + id + + 20 + + + + + + + device_id + 2 + + 12 + 64 + 0 + NotNullable + + device_id + + + + device_id + + 64 + + + + + + + log_time + 3 + + 93 + 19 + 0 + NotNullable + + log_time + + + + log_time + + 19 + + + + + + + event_type + 4 + + 12 + 32 + 0 + Nullable + + event_type + + + + event_type + + 32 + + + + + + + param1 + 5 + + 12 + 64 + 0 + Nullable + + param1 + + + + param1 + + 64 + + + + + + + param2 + 6 + + 12 + 64 + 0 + Nullable + + param2 + + + + param2 + + 64 + + + + + + + param3 + 7 + + 12 + 64 + 0 + Nullable + + param3 + + + + param3 + + 64 + + + + + + + param4 + 8 + + 12 + 64 + 0 + Nullable + + param4 + + + + param4 + + 64 + + + + + + + param5 + 9 + + 12 + 64 + 0 + Nullable + + param5 + + + + param5 + + 64 + + + + + + + param6 + 10 + + 12 + 64 + 0 + Nullable + + param6 + + + + param6 + + 64 + + + + + + + MagazineId + 11 + + -5 + 20 + 0 + NotNullable + + MagazineId + + + + MagazineId + + 20 + + + + + + + Description + 12 + + 12 + 21845 + 0 + Nullable + + Description + + + + Description + + 21845 + + + + + + + MagazineName + 13 + + 12 + 64 + 0 + Nullable + + MagazineName + + + + MagazineName + + 64 + + + + + + + MagazineCover + 14 + + 12 + 256 + 0 + Nullable + + MagazineCover + + + + MagazineCover + + 256 + + + + + + + AdminId + 15 + + -5 + 20 + 0 + NotNullable + + AdminId + + + + AdminId + + 20 + + + + + + + CreateDate + 16 + + 93 + 19 + 0 + Nullable + + CreateDate + + + + CreateDate + + 19 + + + + + + + CategoryId + 17 + + -5 + 20 + 0 + Nullable + + CategoryId + + + + CategoryId + + 20 + + + + + + + PublishDate + 18 + + 93 + 19 + 0 + Nullable + + PublishDate + + + + PublishDate + + 19 + + + + + + + PressId + 19 + + -5 + 20 + 0 + Nullable + + PressId + + + + PressId + + 20 + + + + + + + +]]> + + + + + param2 + dimension + param2 + param2 + + + log_time + dimension + log_time + log_time + + + ct + measure + ct + ct + + + + + + + 1 + param2 + string + + + 2 + log_time + date-time + + + 3 + ct + decimal + + + + analyzer data source + + + 1 + param2 + param2 + string + 12 + + + 2 + log_time + log_time + date-time + 93 + + + 3 + ct + ct + decimal + -5 + + + + + + 2.0 + + + + + + + id + 1 + + -5 + 20 + 0 + NotNullable + + id + + + + id + + 20 + + + + + + + device_id + 2 + + 12 + 64 + 0 + NotNullable + + device_id + + + + device_id + + 64 + + + + + + + log_time + 3 + + 93 + 19 + 0 + NotNullable + + log_time + + + + log_time + + 19 + + + + + + + event_type + 4 + + 12 + 32 + 0 + Nullable + + event_type + + + + event_type + + 32 + + + + + + + param1 + 5 + + 12 + 64 + 0 + Nullable + + param1 + + + + param1 + + 64 + + + + + + + param2 + 6 + + 12 + 64 + 0 + Nullable + + param2 + + + + param2 + + 64 + + + + + + + param3 + 7 + + 12 + 64 + 0 + Nullable + + param3 + + + + param3 + + 64 + + + + + + + param4 + 8 + + 12 + 64 + 0 + Nullable + + param4 + + + + param4 + + 64 + + + + + + + param5 + 9 + + 12 + 64 + 0 + Nullable + + param5 + + + + param5 + + 64 + + + + + + + param6 + 10 + + 12 + 64 + 0 + Nullable + + param6 + + + + param6 + + 64 + + + + + + + +]]> + + + + + MagazineId + measure + MagazineId + MagazineId + + + MagazineName + dimension + MagazineName + MagazineName + + + + + + 1 + MagazineId + decimal + + + 2 + MagazineName + string + + + + analyzer data source + + + 1 + MagazineId + MagazineId + decimal + -5 + + + 2 + MagazineName + MagazineName + string + 12 + + + + + + 2.0 + + + + + + + MagazineId + 1 + + -5 + 20 + 0 + NotNullable + + MagazineId + + + + MagazineId + + 20 + + + + + + + MagazineName + 2 + + 12 + 64 + 0 + Nullable + + MagazineName + + + + MagazineName + + 64 + + + + + + + +]]> + + + + + count(distinct id) + measure + count(distinct id) + count(distinct id) + + + + + + + 1 + count(distinct id) + decimal + + + + analyzer data source + + + 1 + count(distinct id) + count(distinct id) + decimal + -5 + + + + + + 2.0 + + + + + + + count(distinct id) + 1 + + -5 + 21 + 0 + NotNullable + + count(distinct id) + + + + count(distinct id) + + 21 + + + + + + + +]]> + + + + + + + NewTabularHierarchy + + + + + string + event_type + + + + + + + NewTabularHierarchy1 + + + + + string + device_id + + + + + + + + + + + count + false + dataSetRow["event_type"] + integer + true + + + + + event_data + + + + + NewTabularHierarchy2 + + + + + string + dt + + + + + + + NewTabularHierarchy3 + + + + + string + MagazineName + + + + + + + + + + + sum + false + dataSetRow["count(magazine.MagazineId)"] + decimal + true + + + + + download_spec_magazine_by_date + + + + + true + NewTabularHierarchy5 + + + + + integer + year + + + DateTime + date-time + + + log_time + + + integer + month + + + DateTime + date-time + + + log_time + + + integer + week-of-year + + + DateTime + date-time + + + log_time + + + integer + day-of-month + + + DateTime + date-time + + + log_time + + + + + + + NewTabularHierarchy4 + + + + + string + MagazineName + + + decimal + MagazineId + + + magazineInfo + + + + + + + + + dataSetRow["ct"] + decimal + + + + + downloading_of_magazine + + + + + param2 + MagazineId + + + NewTabularHierarchy4 + + + + + + + + + + + + 0in + + + html + new Date()]]> + + + + + + + 19.927083333333332in + 8.291666666666666in + + 1.0208333333333333in + + + 4.53125in + + + 2.7395833333333335in + + + 0.3958333333333333in + + + 12pt + bold + right + auto + + + + + + 12pt + bold + num_of_device_id + + + count(distinct id) + count(distinct id) + dataSetRow["count(distinct id)"] + decimal + + + count(distinct id) + + + + + + 0.3541666666666667in + + 3 + 1 + + + + + 2.96875in + + 3 + 1 + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + 'A','B','C','D','E' + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + Text + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["count(id)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + + + + 1 + + 255 + 128 + 128 + 128 + + true + + + North + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["dldt"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Years + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Below + 1 + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + false + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + false + +]]> + SVG + false + 2.5520833333333335in + 8.104166666666666in + devices_by_date + + + count(id) + dataSetRow["count(id)"] + decimal + + + dldt + dataSetRow["dldt"] + string + + + + + + + 0.3333333333333333in + + 3 + 1 + + + + + 4in + + 3 + 1 + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + A, B, C + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["count(device_id)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + + + + 1 + + 255 + 128 + 128 + 128 + + true + + + North + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + true + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["dt"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.5625in + 8.0625in + active_device_by_date + + + count(device_id) + dataSetRow["count(device_id)"] + decimal + + + dt + dataSetRow["dt"] + string + + + + + + + 0.23958333333333334in + + 3 + 1 + + + + + 3.6041666666666665in + + 3 + 1 + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + A, B, C + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["count(id)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + + + + 1 + + 255 + 128 + 128 + 128 + + true + + + North + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["dt"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + false + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.1666666666666665in + 8.020833333333334in + visiting_by_date + + + count(id) + dataSetRow["count(id)"] + decimal + + + dt + dataSetRow["dt"] + string + + + + + + + 0.23958333333333334in + + 3 + 1 + + + + + 3.8020833333333335in + + 3 + 1 + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + A, B, C + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["count(id)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["dt"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.3541666666666665in + 8.21875in + start_download_by_date + + + count(id) + dataSetRow["count(id)"] + decimal + + + dt + dataSetRow["dt"] + string + + + + + + + 0.3229166666666667in + + 3 + 1 + + + + + 3.46875in + + 3 + 1 + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + A, B, C + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + Text + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + row["MagazineName"] + + Text + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + + 255 + 242 + 88 + 106 + + + 255 + 255 + 149 + 117 + + 90.0 + + + + 255 + 232 + 172 + 57 + + + 255 + 250 + 209 + 63 + + 90.0 + + + + 255 + 98 + 196 + 117 + + + 255 + 128 + 255 + 128 + + 90.0 + + + + 255 + 64 + 128 + 128 + + + 255 + 103 + 205 + 142 + + 90.0 + + + + 255 + 128 + 128 + 192 + + + 255 + 159 + 189 + 203 + + 90.0 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["count(magazine.MagazineId)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["dt"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Text + Sum + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.1979166666666665in + 8.125in + download_spec_magazine_by_date + + + dt + dataSetRow["dt"] + string + + + MagazineName + dataSetRow["MagazineName"] + string + + + count(magazine.MagazineId) + dataSetRow["count(magazine.MagazineId)"] + decimal + + + + + + + 0.3645833333333333in + + 3 + 1 + + + + + + + report + + + diff --git a/crm/src/main/doc/nb-configuration.xml b/crm/src/main/doc/nb-configuration.xml new file mode 100644 index 0000000..d2aae48 --- /dev/null +++ b/crm/src/main/doc/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + none + JDK_1.7 + + diff --git a/crm/src/main/doc/nbactions-release-profile.xml b/crm/src/main/doc/nbactions-release-profile.xml new file mode 100644 index 0000000..6b2c7a8 --- /dev/null +++ b/crm/src/main/doc/nbactions-release-profile.xml @@ -0,0 +1,83 @@ + + + + run + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + Xms2048m -classpath %classpath ${packageClassName} account.xml + java + + + + debug + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} Xms2048m -classpath %classpath ${packageClassName} account.xml + java + true + + + + profile + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + ${profiler.args} Xms2048m -classpath %classpath ${packageClassName} account.xml + ${profiler.java} + + + + build-with-dependencies + also-make + + install + + + /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home + + + + profile.single.main + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath ${packageClassName} + java + ${classPathScope} + /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home + + + + run.single.main + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath ${packageClassName} + java + ${classPathScope} + /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home + + + + rebuild + + clean + install + + + /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home + + + diff --git a/crm/src/main/doc/nbactions.xml b/crm/src/main/doc/nbactions.xml new file mode 100644 index 0000000..70b02d3 --- /dev/null +++ b/crm/src/main/doc/nbactions.xml @@ -0,0 +1,40 @@ + + + + run + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -Xms1024m -classpath %classpath com.rexen.crm.integration.DataImport contact_import.xml + java + /Users/Ralf/NetBeansProjects/dataloader + + + + debug + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Xms1024m -classpath %classpath com.rexen.crm.integration.DataImport contact_import.xml + java + true + /Users/Ralf/NetBeansProjects/dataloader + + + + profile + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + ${profiler.args} -Xms1024m -classpath %classpath com.rexen.crm.integration.DataImport contact_import.xml + ${profiler.java} + /Users/Ralf/NetBeansProjects/dataloader + + + diff --git a/crm/src/main/doc/newCrmDB.xlsx b/crm/src/main/doc/newCrmDB.xlsx new file mode 100644 index 0000000..e3e2a9c Binary files /dev/null and b/crm/src/main/doc/newCrmDB.xlsx differ diff --git a/crm/src/main/doc/pom.xml b/crm/src/main/doc/pom.xml new file mode 100644 index 0000000..dba4d7b --- /dev/null +++ b/crm/src/main/doc/pom.xml @@ -0,0 +1,87 @@ + + 4.0.0 + + crm + dataloader + 1.0 + jar + + dataloader + http://maven.apache.org + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + true + + + + + maven-assembly-plugin + + + + dataloader.core.DataLoader + + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + + + + UTF-8 + + + + + org.eclipse.persistence + eclipselink + 2.5.1 + + + log4j + log4j + 1.2.17 + + + org.jumpmind.symmetric + symmetric-csv + 3.5.9 + + + mysql + mysql-connector-java + 5.1.26 + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + config/sun_checks.xml + + + + + diff --git a/crm/src/main/doc/premium.rptdesign b/crm/src/main/doc/premium.rptdesign new file mode 100644 index 0000000..48f188d --- /dev/null +++ b/crm/src/main/doc/premium.rptdesign @@ -0,0 +1,5876 @@ + + + Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130918-1142> + + + queryText + 108 + + + queryTimeOut + 108 + + + rowFetchSize + 108 + + + in + /templates/grouped_listing.gif + org.eclipse.birt.report.designer.ui.cheatsheet.groupedlisting + auto layout + ltr + 96 + + + + + metadataBidiFormatStr + ILYNN + + + disabledMetadataBidiFormatStr + + + contentBidiFormatStr + ILYNN + + + disabledContentBidiFormatStr + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/analyzerdb + analyzer + + + + + + metadataBidiFormatStr + ILYNN + + + disabledMetadataBidiFormatStr + + + contentBidiFormatStr + ILYNN + + + disabledContentBidiFormatStr + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/analyzerdb + analyzer + + + + + + + deviceName + dimension + deviceName + deviceName + + + appId + measure + appId + appId + + + dldt + dimension + dldt + dldt + + + id + measure + id + id + + + appName + dimension + appName + appName + + + + + + + 1 + deviceName + string + + + 2 + appId + integer + + + 3 + dldt + date-time + + + 4 + id + integer + + + 5 + appName + string + + + + Data Source + + + 1 + deviceName + deviceName + string + + + 2 + appId + appId + integer + + + 3 + dldt + dldt + date-time + + + 4 + id + id + integer + + + 5 + appName + appName + string + + + '2013-10-01' AND `analyzerdb`.`appinfo`.ID > 104 +]]> + + + 2.0 + + + + + + + deviceName + 1 + + 12 + 255 + 0 + Nullable + + deviceName + + + + deviceName + + 255 + + + + + + + appId + 2 + + 4 + 9 + 0 + Nullable + + appId + + + + appId + + 9 + + + + + + + dldt + 3 + + 93 + 19 + 0 + Nullable + + dldt + + + + dldt + + 19 + + + + + + + id + 4 + + 4 + 9 + 0 + NotNullable + + id + + + + id + + 9 + + + + + + + appName + 5 + + 12 + 255 + 0 + Nullable + + appName + + + + appName + + 255 + + + + + + + +]]> + + + + + COUNT_BY_APP + measure + COUNT_BY_APP + COUNT_BY_APP + + + appName + dimension + appName + appName + + + + + + + 1 + COUNT_BY_APP + decimal + + + 2 + appName + string + + + + Data Source + + + 1 + COUNT_BY_APP + COUNT_BY_APP + decimal + + + 2 + appName + appName + string + + + '2013-10-01' AND `analyzerdb`.`appinfo`.ID > 104 + GROUP BY `analyzerdb`.`appinfo`.APPNAME]]> + + + 2.0 + + + + + + + COUNT_BY_APP + 1 + + -5 + 21 + 0 + NotNullable + + COUNT_BY_APP + + + + COUNT_BY_APP + + 21 + + + + + + + appName + 2 + + 12 + 255 + 0 + Nullable + + appName + + + + appName + + 255 + + + + + + + +]]> + + + + + COUNT(ID) + measure + COUNT(ID) + COUNT(ID) + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + dimension + DATE_FORMAT(DLDT, '%Y-%m-%d') + DATE_FORMAT(DLDT, '%Y-%m-%d') + + + + + + + 1 + COUNT(ID) + decimal + + + 2 + DATE_FORMAT(DLDT, '%Y-%m-%d') + string + + + + Data Source + + + 1 + COUNT(ID) + COUNT(ID) + decimal + + + 2 + DATE_FORMAT(DLDT, '%Y-%m-%d') + DATE_FORMAT(DLDT, '%Y-%m-%d') + string + + + '2013-10-01' AND APPID > 104 + GROUP BY DATE_FORMAT(DLDT, '%Y-%m-%d') +]]> + + + 2.0 + + + + + + + COUNT(ID) + 1 + + -5 + 21 + 0 + NotNullable + + COUNT(ID) + + + + COUNT(ID) + + 21 + + + + + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + 2 + + 12 + 10 + 0 + Nullable + + DATE_FORMAT(DLDT, '%Y-%m-%d') + + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + + 10 + + + + + + + +]]> + + + + + COUNT_BY_DN + measure + COUNT_BY_DN + COUNT_BY_DN + + + deviceName + dimension + DEVICENAME + DEVICENAME + + + + + + + 1 + COUNT_BY_DN + decimal + + + 2 + deviceName + string + + + + Data Source + + + 1 + COUNT_BY_DN + COUNT_BY_DN + decimal + + + 2 + deviceName + deviceName + string + + + '2013-10-01' AND APPID > 104 + GROUP BY DEVICENAME +]]> + + + 2.0 + + + + + + + COUNT_BY_DN + 1 + + -5 + 21 + 0 + NotNullable + + COUNT_BY_DN + + + + COUNT_BY_DN + + 21 + + + + + + + deviceName + 2 + + 12 + 255 + 0 + Nullable + + DEVICENAME + + + + DEVICENAME + + 255 + + + + + + + +]]> + + + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + dimension + DATE_FORMAT(DLDT, '%Y-%m-%d') + DATE_FORMAT(DLDT, '%Y-%m-%d') + + + deviceName + dimension + DEVICENAME + DEVICENAME + + + COUNT(ID) + measure + COUNT(ID) + COUNT(ID) + + + + + + + 1 + DATE_FORMAT(DLDT, '%Y-%m-%d') + string + + + 2 + deviceName + string + + + 3 + COUNT(ID) + decimal + + + + Data Source + + + 1 + DATE_FORMAT(DLDT, '%Y-%m-%d') + DATE_FORMAT(DLDT, '%Y-%m-%d') + string + + + 2 + deviceName + deviceName + string + + + 3 + COUNT(ID) + COUNT(ID) + decimal + + + '2013-10-01' AND APPID > 104 + GROUP BY DATE_FORMAT(DLDT, '%Y-%m-%d'),DEVICENAME +]]> + + + 2.0 + + + + + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + 1 + + 12 + 10 + 0 + Nullable + + DATE_FORMAT(DLDT, '%Y-%m-%d') + + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + + 10 + + + + + + + deviceName + 2 + + 12 + 255 + 0 + Nullable + + DEVICENAME + + + + DEVICENAME + + 255 + + + + + + + COUNT(ID) + 3 + + -5 + 21 + 0 + NotNullable + + COUNT(ID) + + + + COUNT(ID) + + 21 + + + + + + + +]]> + + + + + CT + measure + CT + CT + + + dt + dimension + DT + DT + + + + + + 1 + CT + decimal + + + 2 + dt + date + + + + 109_105_47_77_analyzer + + + 1 + CT + CT + decimal + -5 + + + 2 + dt + dt + date + 91 + + + = '2013-11-01' + GROUP BY DT +]]> + + + 2.0 + + + + + + + CT + 1 + + -5 + 21 + 0 + NotNullable + + CT + + + + CT + + 21 + + + + + + + dt + 2 + + 91 + 10 + 0 + Nullable + + DT + + + + DT + + 10 + + + + + + + +]]> + + + + + COUNT(*) + measure + COUNT(*) + COUNT(*) + + + site + dimension + SITE + SITE + + + page + dimension + PAGE + PAGE + + + trackdatetime + dimension + trackdatetime + trackdatetime + + + + + + 1 + COUNT(*) + decimal + + + 2 + site + string + + + 3 + page + string + + + 4 + trackdatetime + date + + + + 109_105_47_77_analyzer + + + 1 + COUNT(*) + COUNT(*) + decimal + -5 + + + 2 + site + site + string + 12 + + + 3 + page + page + string + 12 + + + 4 + trackdatetime + trackdatetime + date + 91 + + + + + + 2.0 + + + + + + + COUNT(*) + 1 + + -5 + 21 + 0 + NotNullable + + COUNT(*) + + + + COUNT(*) + + 21 + + + + + + + site + 2 + + 12 + 255 + 0 + Nullable + + SITE + + + + SITE + + 255 + + + + + + + page + 3 + + 12 + 255 + 0 + Nullable + + PAGE + + + + PAGE + + 255 + + + + + + + trackdatetime + 4 + + 91 + 10 + 0 + Nullable + + trackdatetime + + + + trackdatetime + + 10 + + + + + + + +]]> + + + + + COUNT_OF_ROW + measure + COUNT_OF_ROW + COUNT_OF_ROW + + + + + + + 1 + COUNT_OF_ROW + decimal + + + + 109_105_47_77_analyzer + + + 1 + COUNT_OF_ROW + COUNT_OF_ROW + decimal + -5 + + + '2013-10-01' AND APPID > 104 +]]> + + + 2.0 + + + + + + + COUNT_OF_ROW + 1 + + -5 + 21 + 0 + NotNullable + + COUNT_OF_ROW + + + + COUNT_OF_ROW + + 21 + + + + + + + +]]> + + + nulls lowest + + + adt + dimension + dt + dt + + + ct + measure + ct + ct + + + + + + + 1 + adt + date + + + 2 + ct + decimal + + + + 109_105_47_77_analyzer + + + 1 + adt + adt + date + 91 + + + 2 + ct + ct + decimal + -5 + + + ='2013-11-01' group by adt) as a +left JOIN ( +SELECT COUNT(ID) as bct, DATE_FORMAT(DLDT, '%Y-%m-%d') +as bdt +FROM `analyzerdb`.`dl` + WHERE DLDT >= '2013-11-01' + AND APPID > 104 + GROUP BY DATE_FORMAT(DLDT, '%Y-%m-%d')) as b + on a.adt=b.bdt) as c;]]> + + + 2.0 + + + + + + + id + 1 + + 4 + 9 + 0 + NotNullable + + id + + + + id + + 9 + + + + + + + dt + 2 + + 91 + 10 + 0 + Nullable + + dt + + + + dt + + 10 + + + + + + + +]]> + + + + + + + + + + 0in + + + 100% + + + + + html + new Date()]]> + + + + + + + + + + 18.34375in + 9.59375in + + 9.59375in + + + 0.23958333333333334in + + + + + + 0.2708333333333333in + + + total_downloading + + + COUNT_OF_ROW + COUNT_OF_ROW + dataSetRow["COUNT_OF_ROW"] + decimal + + + "Total number of download: "+row["COUNT_OF_ROW"] + html + + + + + 0.375in + + + + + + 3.9166666666666665in + + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + 01/05/2000,02/01/2000,04/12/2000,03/12/2000,02/29/2000 + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + DateTime + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["COUNT(*)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + + + + 1 + + 255 + 128 + 128 + 128 + + true + + + North + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["trackdatetime"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Days + DateTime + Sum + + + en_US + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + + yyyy-MM-dd + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + false + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + false + +]]> + SVG + false + 3.6041666666666665in + 8.135416666666666in + pageview + + + COUNT(*) + dataSetRow["COUNT(*)"] + decimal + + + site + dataSetRow["site"] + string + + + page + dataSetRow["page"] + string + + + trackdatetime + dataSetRow["trackdatetime"] + date + + + + + + + 0.3541666666666667in + + + + + + 4.40625in + + + + 2.6.1 + Pie Chart + Standard + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Categories + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional_With_Depth + Points + 10.0 + 0 + + enable.area.alt + false + + + + 'A','B','C','D','E' + + + 6,4,12,8,10 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["COUNT_BY_APP"] + + Text + Sum + + + + + Orthogonal_Value + + + Percentile_Orthogonal_Value + + ( + %) + 100.0 + 2 + + + + Base_Value + + + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + 0 + + <Caption> + <Value></Value> + <Font> + <Size>16.0</Size> + <Bold>true</Bold> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>true</Visible> + + Below + + + 1 + true + + 10.0 + + + Text + Sum + + + + true + + + row["appName"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Text + Sum + + + +]]> + SVG + false + 4.125in + 8.0625in + dl_by_app + + + COUNT_BY_APP + dataSetRow["COUNT_BY_APP"] + decimal + + + appName + dataSetRow["appName"] + string + + + + + + + + + #808080 + bold + #FFFFFF + 4pt + 2pt + 2pt + auto + + + + + + 3.2083333333333335in + + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + 01/05/2000,02/01/2000,04/12/2000,03/12/2000,02/29/2000 + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + DateTime + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["COUNT(ID)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + + + + 1 + + 255 + 128 + 128 + 128 + + true + + + North + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["DATE_FORMAT(DLDT, '%Y-%m-%d')"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Days + DateTime + Sum + + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + + Y-M-d + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.6in + 8.135416666666666in + dl_by_date + + + COUNT(ID) + dataSetRow["COUNT(ID)"] + decimal + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + dataSetRow["DATE_FORMAT(DLDT, '%Y-%m-%d')"] + date + + + + + + + 0.23958333333333334in + + + + + + 2.4270833333333335in + + + + 2.6.1 + Bar Chart + Side-by-side + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + false + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + 5 + 5 + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + + + 0 + + 255 + 0 + 0 + 0 + + false + + + 2.0 + 2.0 + 2.0 + 2.0 + + + + + + + + + Vertical + Top_Bottom + + + 1 + + 255 + 0 + 0 + 0 + + true + + Right + Series + + <Caption> + <Value></Value> + <Font> + <Alignment/> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + <Visible>false</Visible> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Above + + + 0.0 + 0.0 + 212.0 + 130.0 + + + 3.0 + 3.0 + 3.0 + 3.0 + + -1 + -1 + -1 + -1 + + + 1 + + 255 + 0 + 0 + 0 + + false + + true + + Two_Dimensional + Points + 10.0 + + enable.area.alt + false + + + + 01/05/2000,02/01/2000,04/12/2000,03/12/2000,02/29/2000 + + + 5,4,12 + 0 + + + + + + This chart contains no data. + + + Center + Center + + + + + 64 + 127 + 127 + 127 + + + + 128 + 127 + 127 + 127 + + true + + + 10.0 + 10.0 + 10.0 + 10.0 + + false + + + DateTime + + <Caption> + <Value>X-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Below + + Linear + + <Caption> + <Value>Y-Axis Title</Value> + <Font> + <Size>14.0</Size> + <Bold>true</Bold> + <Alignment> + <horizontalAlignment>Center</horizontalAlignment> + <verticalAlignment>Center</verticalAlignment> + </Alignment> + </Font> + </Caption> + <Background xsi:type="attribute:ColorDefinition"> + <Transparency>0</Transparency> + <Red>255</Red> + <Green>255</Green> + <Blue>255</Blue> + </Background> + <Outline> + <Style>Solid</Style> + <Thickness>1</Thickness> + <Color> + <Transparency>255</Transparency> + <Red>0</Red> + <Green>0</Green> + <Blue>0</Blue> + </Color> + </Outline> + <Insets> + <Top>0.0</Top> + <Left>2.0</Left> + <Bottom>0.0</Bottom> + <Right>3.0</Right> + </Insets> + <Visible>false</Visible> + + Left + + + row["deviceName"] + + Text + + + + + + 255 + 80 + 166 + 218 + + + 255 + 108 + 222 + 228 + + 90.0 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["COUNT(ID)"] + + Text + Sum + + + Series 1 + + + Orthogonal_Value + + , + + Outside + false + + onmouseover + + Show_Tooltip + + + 200 + + + + Rectangle + + + Text + Sum + + + Vertical + + + 1 + + 255 + 0 + 0 + 0 + + true + + + Left + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + false + + + + + + + + 255 + 80 + 166 + 218 + + + 255 + 242 + 88 + 106 + + + 255 + 232 + 172 + 57 + + + 255 + 128 + 255 + 128 + + + 255 + 64 + 128 + 128 + + + 255 + 128 + 128 + 192 + + + 255 + 170 + 85 + 85 + + + 255 + 128 + 128 + 0 + + + 255 + 192 + 192 + 192 + + + 255 + 255 + 255 + 128 + + + 255 + 128 + 192 + 128 + + + 255 + 7 + 146 + 94 + + + 255 + 0 + 128 + 255 + + + 255 + 255 + 128 + 192 + + + 255 + 0 + 255 + 255 + + + 255 + 255 + 128 + 128 + + + 255 + 0 + 128 + 192 + + + 255 + 128 + 128 + 192 + + + 255 + 255 + 0 + 255 + + + 255 + 128 + 64 + 64 + + + 255 + 255 + 128 + 64 + + + 255 + 80 + 240 + 120 + + + 255 + 0 + 64 + 128 + + + 255 + 128 + 0 + 64 + + + 255 + 255 + 0 + 128 + + + 255 + 128 + 128 + 64 + + + 255 + 128 + 128 + 128 + + + 255 + 255 + 128 + 255 + + + 255 + 0 + 64 + 0 + + + 255 + 0 + 0 + 0 + + + 255 + 255 + 255 + 255 + + + 255 + 255 + 128 + 0 + + + + true + + + row["DATE_FORMAT(DLDT, '%Y-%m-%d')"] + + + + + Orthogonal_Value + + , + + Outside + false + + + true + Days + DateTime + Sum + + Ascending + + row["DATE_FORMAT(DLDT, '%Y-%m-%d')"] + + + Horizontal + + + 1 + + 255 + 0 + 0 + 0 + + true + + + + Y-M-dd + + Below + + + + 1 + + 255 + 196 + 196 + 196 + + false + + Across + + + 1 + + 255 + 196 + 196 + 196 + + true + + + + + + 1 + + 255 + 225 + 225 + 225 + + false + + Across + + + 1 + + 255 + 225 + 225 + 225 + + false + + + + 5 + + + Min + + 0.0 + + + true + true + false + + Vertical + 50.0 + + + -20.0 + 45.0 + 0.0 + None + + + +]]> + SVG + false + 3.6in + 8.114583333333334in + dl_by_dn_date + + + DATE_FORMAT(DLDT, '%Y-%m-%d') + dataSetRow["DATE_FORMAT(DLDT, '%Y-%m-%d')"] + date + + + deviceName + dataSetRow["deviceName"] + string + + + COUNT(ID) + dataSetRow["COUNT(ID)"] + decimal + + + + + + + + diff --git a/crm/src/main/doc/user_position_import.csv b/crm/src/main/doc/user_position_import.csv new file mode 100644 index 0000000..99a8756 --- /dev/null +++ b/crm/src/main/doc/user_position_import.csv @@ -0,0 +1 @@ +PositionExternalId,EmployeeNumber,ExternalId,Ƿ E1131031001,101SH218,E1131031001101SH218, NT131031001,101BJ144,NT131031001101BJ144, NE131031001,101LN098,NE131031001101LN098, \ No newline at end of file diff --git a/crm/src/main/doc/userinfo_import.csv b/crm/src/main/doc/userinfo_import.csv new file mode 100644 index 0000000..edb49d8 --- /dev/null +++ b/crm/src/main/doc/userinfo_import.csv @@ -0,0 +1 @@ +,email,employeeNumber,¼,Password,û״̬,Ƿ񼤻 ʢ,sample@mail.com,101SH218,101SH218,12345,Ч,Ѽ ,sample@mail.com,101BJ144,101BJ144,12345,Ч,Ѽ ,sample@qq.com,101LN098,101LN098,12345,Ч,Ѽ \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/AccountPage.html b/crm/src/main/java/com/rex/crm/AccountPage.html index 4100483..1ae9b30 100755 --- a/crm/src/main/java/com/rex/crm/AccountPage.html +++ b/crm/src/main/java/com/rex/crm/AccountPage.html @@ -1,37 +1,51 @@ - - - -

-
- -
-
- -
-
- data table -
-
-
+ });// end onDomReady function + +
+
+
+
+
+
+
+
+ +
+ +
+
+
+ data table +
+
+
+
+
- - + + diff --git a/crm/src/main/java/com/rex/crm/AccountPage.java b/crm/src/main/java/com/rex/crm/AccountPage.java index 6367163..51e7e31 100644 --- a/crm/src/main/java/com/rex/crm/AccountPage.java +++ b/crm/src/main/java/com/rex/crm/AccountPage.java @@ -3,113 +3,200 @@ import java.util.List; import java.util.Map; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.log4j.Logger; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.markup.html.list.ListView; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; +import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.request.IRequestParameters; +import org.apache.wicket.util.string.StringValue; -import com.google.common.base.Joiner; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import com.rex.crm.beans.AdvancedSearchFilter; +import com.rex.crm.beans.Choice; import com.rex.crm.common.Entity; import com.rex.crm.common.Field; import com.rex.crm.common.FilterPanel; import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.common.advancedSearch.AdvancedSearchPanel; import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; import com.rex.crm.util.Configuration; - /** - * @author Feiyun Zhou + * @author Feiyun Zhou */ public class AccountPage extends TemplatePage { - private String search_target = ""; - - /** - * Constructor - */ - public AccountPage() + private static final Logger logger = Logger.getLogger(AccountPage.class); + private String search_target = ""; + + /** + * Constructor + */ + public AccountPage() + { + //PageParameters pp = new PageParameters(); + //IRequestParameters params = this.getRequestCycle().getRequest().getRequestParameters(); + initPage(null, null); + } + + public AccountPage(Map map, List tdata) + { + initPage(map, tdata); + } + + public AccountPage( List tdata) + { + initPage(null, tdata); + } + + private void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("account"); + setPageTitle(entity.getDisplay()); + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + // TODO get userId from request's session + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + + Form form = new Form("form") { - initPage(null,null); - - } - - public AccountPage(Map map,List tdata){ - initPage(map, tdata); - } - - private void initPage(final Map filter,List tdata){ - Map entities = Configuration.getEntityTable(); - final Entity entity = entities.get("account"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - //TODO get userId from request's session - final String userId = ((SignIn2Session)getSession()).getUserId(); - final int roleId = ((SignIn2Session)getSession()).getRoleId(); - - Form form = new Form("form"){ - @Override - protected void onSubmit() { - String sql = entity.getSql(); - if(roleId == 1){ - sql = entity.getSqlAdmin(); - } - - search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; - - List searchableFields = entity.getSearchableFields(); - String joint = " like '%"+search_target+"%'"; - String likequery = ""; - for(Field sf:searchableFields){ - likequery = likequery + " OR "+ sf.getName() + joint; + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + switch (roleId) + { + case 1: + sql = entity.getSqlAdmin(); + break; + case 2: + sql = entity.getSqlManager(); + break; + case 3: + sql = entity.getSql(); + break; + } + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + sql = sql + " where name like '%" + search_target + "%' " + likequery; + System.out.println(sql); + List datalist = null; + + switch (roleId) + { + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql, positionId, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, positionId, positionId); + break; + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + } + + setResponsePage(new AccountPage(filter, datalist)); + + } + + }; + add(form); + + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + } - - sql = sql + " where name like '%"+search_target+"%' " + likequery; - System.out.println(sql); - List datalist = DAOImpl.queryEntityRelationList(sql, userId); - setResponsePage(new AccountPage(filter,datalist)); - - } - - }; - add(form); - - TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); - form.add(search_input); - - if(tdata == null || tdata.size() == 0){ - if(filter == null){ - String sql = entity.getSql(); - //if the user is admin we use admin sql to query database - if(roleId == 1){ - sql = entity.getSqlAdmin(); - } - tdata = DAOImpl.queryEntityRelationList(sql, userId); - }else{ - List ft = Lists.newArrayList(); - for (String k : filter.keySet()) { - if(filter.get(k)) ft.add(k); - } - tdata = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); + } ); +// add(new AdvancedPanel("advancedSearch",entity)); + String sql = entity.getSql(); + switch (roleId) + { + case 1: + sql = entity.getSqlAdmin(); + break; + case 2: + sql = entity.getSqlManager(); + break; + case 3: + sql = entity.getSql(); + break; + } + if (tdata == null || tdata.size() == 0) + { + + if (filter == null) + { +// if(params != null){ +// StringValue ad_search_sql_value = params.getParameterValue("ad_search_sql"); +// if( !ad_search_sql_value.isNull() && !ad_search_sql_value.isEmpty()){ +// sql = sql + " where " + ad_search_sql_value.toString(); +// logger.debug("sql is: " + sql); +// } +// } + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, positionId, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId, positionId); } + + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); } - add(new PageableTablePanel("datalist",entity,tdata)); - - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,AccountPage.class)); - + + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId,positionId); + } + + } } + // add(new AdvancedSearchPanel("advancedSearch","account")); + add(new PageableTablePanel("datalist", entity, tdata, null)); + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + + add(new FilterPanel("filterPanel", choices, filter, AccountPage.class,entity)); + + + + + } } \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/ActivitedUser.html b/crm/src/main/java/com/rex/crm/ActivitedUser.html index 8da295a..c77886b 100644 --- a/crm/src/main/java/com/rex/crm/ActivitedUser.html +++ b/crm/src/main/java/com/rex/crm/ActivitedUser.html @@ -1,40 +1,72 @@ + - - - - - + + + + + + + - -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - -
-
-
- + }); + function checkPasswords() { + var pass1 = document.getElementById("newPassword").value; + var pass2 = document.getElementById("password").value; + if (pass1!= pass2){ + alert("两次新密码输入不一致,请重新输入!"); + //设置新密码,验证新密码为空 + $("#newPassword").val(""); + $("#password").val(""); + }else{ + pass1.setCustomValidity(""); + } + } + + +
+
+ +
+
+
+ +
+ 您好 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+
+ \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/ActivitedUser.java b/crm/src/main/java/com/rex/crm/ActivitedUser.java index ce16cd3..f5e6c1f 100644 --- a/crm/src/main/java/com/rex/crm/ActivitedUser.java +++ b/crm/src/main/java/com/rex/crm/ActivitedUser.java @@ -8,12 +8,16 @@ import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.PasswordTextField; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.util.string.StringValue; import com.google.common.collect.Maps; import com.rex.crm.beans.CRMUser; +import com.rex.crm.beans.UserInfo; +import com.rex.crm.common.ErrorPromptPage; import com.rex.crm.db.DAOImpl; public class ActivitedUser extends WebPage{ @@ -22,45 +26,62 @@ public class ActivitedUser extends WebPage{ private static final Logger logger = Logger.getLogger(UpdateSignPassword.class); final Map models = Maps.newHashMap(); public ActivitedUser(){ - String logigName = this.getRequest().getRequestParameters().getParameterValue("loginName").toString(); - logger.debug("loginName:"+logigName); - initPage(logigName); + logger.debug("activitedUser"); + String activitedCode = this.getRequest().getRequestParameters().getParameterValue("activitedCode").toString(); + logger.debug("loginName:"+activitedCode); + String [] strs=activitedCode.split("_"); + logger.debug("str:"+strs[0]); + long createTime = Long.parseLong(strs[0]); + int userID =Integer.parseInt(strs[1]); + UserInfo userInfo = DAOImpl.getUserByActivation(userID,createTime); + /*if(userInfo.IsActivited()==0){ + initPage(userID,createTime); + }else{ + setResponsePage(new ErrorPromptPage()); + }*/ } - public void initPage(final String loginName){ + public void initPage(final int userID,final long createTime){ logger.debug("init"); - CRMUser crmuser = DAOImpl.getUserByActivation(loginName); - final int userId = crmuser.getId(); + UserInfo userInfo = DAOImpl.getUserByActivation(userID,createTime);; + final int userId = userInfo.getId(); + final String userLoginName = userInfo.getLoginName(); //此时获取到对象,接收客户端的数据 final Label promptLabel = new Label("prompt","操作失败重新输入!"); Form form = new Form("form"){ @Override protected void onSubmit() { + System.out.println("submit"); String password = models.get("password").getObject() == null? null:String.valueOf(models.get("password").getObject()); logger.debug("pwd:"+password); - if(DAOImpl.updateCrmUserPassword(userId, password)){ - //用此用户登录 - SignIn2Session session = getMysession(); - session.setUser(null); - if (session.signIn(loginName, password)) - { - setResponsePage(getApplication().getHomePage()); - }else{ - promptLabel.add(new AttributeAppender("style",new Model("display:block;"),";")); - } - //setResponsePage(getApplication().getHomePage()); - }else{ - promptLabel.add(new AttributeAppender("style",new Model("display:block;"),";")); + if(DAOImpl.updateCrmUserPassword(userId, password)){ + //修改crmuser的激活状态为已激活 + DAOImpl.updateUserActivited(userId); + //用此用户登录 + SignIn2Session session = getMysession(); + session.setUser(null); + if (session.signIn(userLoginName, password)) + { + setResponsePage(getApplication().getHomePage()); + }else{ + promptLabel.add(new AttributeAppender("style",new Model("display:block;"),";")); + } + }else{ + promptLabel.add(new AttributeAppender("style",new Model("display:block;"),";")); + } } - } }; add(form); add(promptLabel); - form.add(new Label("userName",crmuser.getName())); + form.add(new Label("userName",userInfo.getName())); IModel textModel = new Model(""); + form.add(new Label("loginName",userInfo.getLoginName())); PasswordTextField password = new PasswordTextField("password",textModel); - password.add(new AttributeAppender("value","")); models.put("password",textModel); form.add(password); + IModel textModelPassword = new Model(""); + PasswordTextField newPassword = new PasswordTextField("newPassword",textModel); + models.put("newPassword",textModelPassword); + form.add(newPassword); } private SignIn2Session getMysession() { diff --git a/crm/src/main/java/com/rex/crm/ActivityPage.html b/crm/src/main/java/com/rex/crm/ActivityPage.html index 7c0e811..0703701 100755 --- a/crm/src/main/java/com/rex/crm/ActivityPage.html +++ b/crm/src/main/java/com/rex/crm/ActivityPage.html @@ -1,29 +1,43 @@ - - - - });// end onDomReady function - - -
-
- -
- data table +
+
+
+
+
-
-
- - - +
+
+
+ +
+
+
+
+ data table +
+
+
+
+ + + diff --git a/crm/src/main/java/com/rex/crm/ActivityPage.java b/crm/src/main/java/com/rex/crm/ActivityPage.java index 75abbe6..f6aed34 100644 --- a/crm/src/main/java/com/rex/crm/ActivityPage.java +++ b/crm/src/main/java/com/rex/crm/ActivityPage.java @@ -3,22 +3,21 @@ import java.util.List; import java.util.Map; -import org.apache.wicket.markup.html.basic.Label; +import org.apache.commons.lang3.tuple.Pair; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.CreateDataPage; +import com.google.common.collect.Lists; +import com.rex.crm.beans.Choice; import com.rex.crm.common.Entity; -import com.rex.crm.common.EntityDetailPage; import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.Param; -import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; import com.rex.crm.util.Configuration; @@ -29,20 +28,24 @@ public class ActivityPage extends TemplatePage { private String search_target = ""; public ActivityPage(){ - init(null); + init(null,null); } + public ActivityPage(final Map filter,List tdata){ + init(filter,tdata); + } + public ActivityPage(List tdata){ - init(tdata); + init(null,tdata); } - public void init(List tdata) + public void init(final Map filter,List tdata) { Map entities = Configuration.getEntityTable(); final Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); //TODO get userId from request's session - final String userId = ((SignIn2Session)getSession()).getUserId(); + final String posId = ((SignIn2Session)getSession()).getPositionId(); final int roleId = ((SignIn2Session)getSession()).getRoleId(); @@ -52,9 +55,18 @@ public void init(List tdata) protected void onSubmit() { String sql = entity.getSql(); - if(roleId == 1){ - sql = entity.getSqlAdmin(); - } + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; //sql = sql + " where title like '%"+search_target+"%'"; @@ -63,31 +75,90 @@ protected void onSubmit() { String likequery = ""; for(Field sf:searchableFields){ likequery = likequery + " OR "+ sf.getName() + joint; - } - + } sql = sql + " where title like '%"+search_target+"%' " + likequery; - List datalist = DAOImpl.queryEntityRelationList(sql, userId); - setResponsePage(new ActivityPage(datalist)); + List datalist = null; + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql,posId); + } + setResponsePage(new ActivityPage(filter,datalist)); } }; add(form); - + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + }); TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); form.add(search_input); - - - String sql = entity.getSql(); - if(roleId == 1){ - sql = entity.getSqlAdmin(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; } if(tdata == null || tdata.size() == 0){ - tdata = DAOImpl.queryEntityRelationList(sql, userId); + + if(filter == null){ + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, posId); + } + + + }else{ + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) { + if(filter.get(k)) ft.add(k); + } + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata =DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, posId); + } + + + } + + } - add(new PageableTablePanel("datalist",entity,tdata)); - + add(new PageableTablePanel("datalist",entity,tdata,null)); + + + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + add(new FilterPanel("filterPanel",choices ,filter,ActivityPage.class,entity)); } } \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/ActivitySelectPage.html b/crm/src/main/java/com/rex/crm/ActivitySelectPage.html new file mode 100644 index 0000000..179d8fa --- /dev/null +++ b/crm/src/main/java/com/rex/crm/ActivitySelectPage.html @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/crm/src/main/java/com/rex/crm/ActivitySelectPage.java b/crm/src/main/java/com/rex/crm/ActivitySelectPage.java new file mode 100644 index 0000000..f14d40d --- /dev/null +++ b/crm/src/main/java/com/rex/crm/ActivitySelectPage.java @@ -0,0 +1,59 @@ +package com.rex.crm; + +import java.util.Map; +import java.util.Set; + +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Button; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; + +import com.google.common.collect.Maps; +import com.rex.crm.common.CreateDataPage; + +public class ActivitySelectPage extends TemplatePage{ + /** + * Constructor + */ + public ActivitySelectPage(){ + //传参时间和实体名 + StringValue entityName = getRequest().getRequestParameters().getParameterValue("entityName"); + final String createAddress = getRequest().getRequestParameters().getParameterValue("createAddress").toString(); + final String name = entityName.toString(); + Set names = getRequest().getRequestParameters().getParameterNames(); + final Map map = Maps.newHashMap(); + for(String nm:names){ + StringValue sv = getRequest().getRequestParameters().getParameterValue(nm); + map.put(nm, sv.toString()); + } + if(("activity").equals(name)){ + initPage(name,map,createAddress); + }else{ + Form form = new Form("buttonForm"); + form.add(new Button("callCoachBtn") { + @Override + public void onSubmit() { + setResponsePage(new CreateDataPage("coaching", map,createAddress)); + } + }); + form.add(new Link("willCoachBtn") { + @Override + public void onClick() { + setResponsePage(new CreateDataPage("willcoaching", map,createAddress)); + } + }); + add(form); + } + } + public void initPage(final String name,final Map params,String createAddress){ + setResponsePage(new CreateDataPage(name,params,createAddress)); + } +} diff --git a/crm/src/main/java/com/rex/crm/AlertPage.html b/crm/src/main/java/com/rex/crm/AlertPage.html new file mode 100644 index 0000000..bb86255 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/AlertPage.html @@ -0,0 +1,42 @@ + + + + + +
+
+
+
+
+
+
+
+ +
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/AlertPage.java b/crm/src/main/java/com/rex/crm/AlertPage.java new file mode 100644 index 0000000..bb88baf --- /dev/null +++ b/crm/src/main/java/com/rex/crm/AlertPage.java @@ -0,0 +1,157 @@ +package com.rex.crm; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.admin.AdminTemplatePage; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; +import com.rexen.crm.beans.UserRole; + +public class AlertPage extends AdminTemplatePage{ + private String search_target = ""; + public AlertPage(){ + init(null,null); + } + public AlertPage(final Map filter,List tdata){ + init(filter,tdata); + } + + public void init(final Map filter,List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("alert"); + setPageTitle("系统管理-信息发布"); + //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + //TODO get userId from request's session + final String posId = ((SignIn2Session)getSession()).getPositionId(); + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + + + Form form = new Form("form"){ + + @Override + protected void onSubmit() { + + String sql = entity.getSql(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + sql = sql + " where name like '%" + search_target + "%' " + likequery; + System.out.println(sql); + List datalist = null; + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql,posId); + } + setResponsePage(new AlertPage(filter,datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + }); + TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); + form.add(search_input); + String sql = entity.getSql(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + if(tdata == null || tdata.size() == 0){ + + if(filter == null){ + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, posId); + } + + + }else{ + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) { + if(filter.get(k)) ft.add(k); + } + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata =DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, posId); + } + + + } + + + } + add(new PageableTablePanel("datalist",entity,tdata,null)); + + + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + add(new FilterPanel("filterPanel",choices ,filter,AlertPage.class,entity)); + } +} + diff --git a/crm/src/main/java/com/rex/crm/AreaPage.html b/crm/src/main/java/com/rex/crm/AreaPage.html new file mode 100644 index 0000000..9e91925 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/AreaPage.html @@ -0,0 +1,42 @@ + + + + + + +
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/AreaPage.java b/crm/src/main/java/com/rex/crm/AreaPage.java new file mode 100644 index 0000000..2fa4c83 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/AreaPage.java @@ -0,0 +1,108 @@ +package com.rex.crm; + +import java.util.List; +import java.util.Map; + + + +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; +import com.rex.crm.admin.AdminTemplatePage; +/** + * @author Sam sun + */ +public class AreaPage extends AdminTemplatePage{ + private String search_target = ""; + + public AreaPage() + { + initPage(null, null); + } + + public AreaPage(final Map filter, List tdata) + { + initPage(filter, tdata); + } + public void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("province"); + setPageTitle("系统管理-区域管理"); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where val like '%" + search_target + "%' " + likequery; + List datalist = null; + datalist = DAOImpl.queryEntityRelationList(sql); + setResponsePage(new AreaPage(filter, datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + }); + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + tdata = DAOImpl.queryEntityRelationList(sql); + + if (filter == null) + { + tdata = DAOImpl.queryEntityRelationList(sql); + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + + } +} diff --git a/crm/src/main/java/com/rex/crm/CalendarPage.html b/crm/src/main/java/com/rex/crm/CalendarPage.html index 15f0297..9d8fe9a 100755 --- a/crm/src/main/java/com/rex/crm/CalendarPage.html +++ b/crm/src/main/java/com/rex/crm/CalendarPage.html @@ -3,6 +3,8 @@ xmlns:wicket="http://wicket.apache.org"> + + -
-
+
+
data table
- diff --git a/crm/src/main/java/com/rex/crm/CalendarPage.java b/crm/src/main/java/com/rex/crm/CalendarPage.java index 4b8a00b..4a2ead2 100644 --- a/crm/src/main/java/com/rex/crm/CalendarPage.java +++ b/crm/src/main/java/com/rex/crm/CalendarPage.java @@ -10,7 +10,6 @@ import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; import org.apache.wicket.protocol.http.WebApplication; -import com.rex.crm.account.AccountListPanel; import com.rex.crm.common.CalendarPanel; import com.rex.crm.common.Entity; import com.rex.crm.common.TableDataPanel; @@ -29,13 +28,10 @@ public class CalendarPage extends TemplatePage public CalendarPage() { Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + //Entity entity = entities.get("activity"); + setPageTitle("日历"); + - final String userId = ((SignIn2Session)getSession()).getUserId(); - //List mapList = DAOImpl.queryEntityRelationList(entity.getSql(), userId); - //add(new TableDataPanel("datalist",entity,mapList)); add(new CalendarPanel("datalist")); diff --git a/crm/src/main/java/com/rex/crm/CoachingPage.html b/crm/src/main/java/com/rex/crm/CoachingPage.html new file mode 100644 index 0000000..6fb1dad --- /dev/null +++ b/crm/src/main/java/com/rex/crm/CoachingPage.html @@ -0,0 +1,45 @@ + + + + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ data table +
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/CoachingPage.java b/crm/src/main/java/com/rex/crm/CoachingPage.java new file mode 100644 index 0000000..da07747 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/CoachingPage.java @@ -0,0 +1,165 @@ +package com.rex.crm; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; + + +/** + * @author Feiyun Zhou + */ +public class CoachingPage extends TemplatePage +{ + private String search_target = ""; + public CoachingPage(){ + init(null,null); + } + public CoachingPage(final Map filter,List tdata){ + init(filter,tdata); + } + + public CoachingPage(List tdata){ + init(null,tdata); + } + public void init(final Map filter,List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("coaching"); + setPageTitle(entity.getDisplay()); + //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + //TODO get userId from request's session + final String posId = ((SignIn2Session)getSession()).getPositionId(); + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + + + Form form = new Form("form"){ + + @Override + protected void onSubmit() { + + String sql = entity.getSql(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; + + //sql = sql + " where title like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%"+search_target+"%'"; + String likequery = ""; + for(Field sf:searchableFields){ + likequery = likequery + " OR "+ sf.getName() + joint; + } + sql = sql + " where title like '%"+search_target+"%' " + likequery; + System.out.println("sql:"+sql); + List datalist = null; + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql,posId); + } + setResponsePage(new CoachingPage(filter,datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + }); + TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); + form.add(search_input); + String sql = entity.getSql(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + if(tdata == null || tdata.size() == 0){ + + if(filter == null){ + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, posId); + } + + + }else{ + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) { + if(filter.get(k)) ft.add(k); + } + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft,posId,posId); + break; + case UserRole.USER_ROLE_SALES: + tdata =DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, posId); + } + + + } + + + } + add(new PageableTablePanel("datalist",entity,tdata,null)); + + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + + add(new FilterPanel("filterPanel",choices ,filter,CoachingPage.class,entity)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/ContactPage.html b/crm/src/main/java/com/rex/crm/ContactPage.html index c502438..4341365 100755 --- a/crm/src/main/java/com/rex/crm/ContactPage.html +++ b/crm/src/main/java/com/rex/crm/ContactPage.html @@ -1,35 +1,50 @@ - - - - -
-
- -
-
- + });// end onDomReady function + -
- data table +
+
+
+
+
-
-
- - - +
+
+ +
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+ + + diff --git a/crm/src/main/java/com/rex/crm/ContactPage.java b/crm/src/main/java/com/rex/crm/ContactPage.java index 8ea8d54..2cbb7af 100644 --- a/crm/src/main/java/com/rex/crm/ContactPage.java +++ b/crm/src/main/java/com/rex/crm/ContactPage.java @@ -6,16 +6,19 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.PropertyModel; import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; +import com.rex.crm.beans.Choice; import com.rex.crm.common.Entity; import com.rex.crm.common.Field; import com.rex.crm.common.FilterPanel; import com.rex.crm.common.PageableTablePanel; import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; import com.rex.crm.util.Configuration; @@ -40,6 +43,12 @@ public ContactPage(Map filter,List tdata) initPage(filter,tdata); + } + public ContactPage(List tdata) + { + + initPage(null,tdata); + } public ContactPage(Map map){ @@ -52,7 +61,7 @@ private void initPage(final Map filter,List tdata){ setPageTitle(entity.getDisplay()); //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); //TODO get userId from request's session - final String userId = ((SignIn2Session)getSession()).getUserId(); + final String posId = ((SignIn2Session)getSession()).getPositionId(); final int roleId = ((SignIn2Session)getSession()).getRoleId(); Form form = new Form("form"){ @@ -60,29 +69,40 @@ private void initPage(final Map filter,List tdata){ @Override protected void onSubmit() { String sql = entity.getSql(); - if(roleId == 1){ - sql = entity.getSqlAdmin(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; } search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; -// sql = sql + " where name like '%"+search_target+"%' OR an like '%"+search_target+"%' OR " + -// "product_target_val like '%"+search_target+"%'"; - //sql = "(" + sql + ") as bcontact"; - /*sql = "select * from " + sql + ", contact_generalization_target_pl where contact_generalization_target_pl.id=product_target AND " + - " (name like '%"+search_target+"%' OR an like '%"+search_target+"%' OR contact_generalization_target_pl.val like '%"+search_target+"%')"; - */ List searchableFields = entity.getSearchableFields(); String joint = " like '%"+search_target+"%'"; String likequery = ""; for(Field sf:searchableFields){ likequery = likequery + " OR "+ sf.getName() + joint; } - sql = sql + " where name like '%"+search_target+"%' " + likequery; - System.out.println("TEST:"+sql); - List datalist = DAOImpl.queryEntityRelationList(sql, userId); + List datalist = null; + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql, posId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, posId); + } setResponsePage(new ContactPage(filter,datalist)); } @@ -92,15 +112,44 @@ protected void onSubmit() { TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); form.add(search_input); - - // List mapList = null; + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + +} ); + String sql = entity.getSql(); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } if (tdata == null || tdata.size() == 0) { + + + if (filter == null) { - String sql = entity.getSql(); - if (roleId == 1) { - sql = entity.getSqlAdmin(); + + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, posId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, posId); } - tdata = DAOImpl.queryEntityRelationList(sql, userId); + + } else { List ft = Lists.newArrayList(); @@ -108,16 +157,25 @@ protected void onSubmit() { if (filter.get(k)) ft.add(k); } - tdata = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, posId); + break; + case UserRole.USER_ROLE_SALES: + tdata =DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, posId); + } } } - add(new PageableTablePanel("datalist",entity,tdata)); - + add(new PageableTablePanel("datalist",entity,tdata,null)); + + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,ContactPage.class)); + add(new FilterPanel("filterPanel",choices ,filter,ContactPage.class,entity)); } } \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/CreateEventPage.html b/crm/src/main/java/com/rex/crm/CreateEventPage.html index f429404..6c72672 100755 --- a/crm/src/main/java/com/rex/crm/CreateEventPage.html +++ b/crm/src/main/java/com/rex/crm/CreateEventPage.html @@ -1,208 +1,379 @@ - - - - }); - - //$("#selected_account").select2(); - - //$("#selected_contact").select2(); - - /* $("#search_click").click(function(e){ - e.preventDefault(); - window.open("../mount/searchContactPage","Ratting","width=850,height=470,left=150,top=200,0,status=0,"); - }); */ - - });// end onDomReady function - - - -
-
- - - - -
-
- - -
-
- -
- - - - - - -
- 拜访   - 辅导 -
- -
-
- - -
- -
- -
-
-
- -
- - -    - -
-
- - -
- -
- -
-
- -
- - - -
- -    - -     -
- -
- -
- -
- -
-
- -
- -
- -
-
-
- -
- - - - - - -
- -
 
-
- -
- - - - - - -
- -
 
-
-
- +
+
+
+ + +
+ +
+ +
+
+
活动类型:
+
+
+
+ +
+ 拜访 +
+
+ 辅导 +
+
+
+
+
+
+
+
活动名称:
+
+
+
+ +
+
+
+ +
+
+
+
拜访类型:
+
+
+
+ +
+
+
- +
+
+
拜访医生:
+
+
+
+ + + + +
+
+
+
+
+
拜访目的:
+
+
+
+ +
+
+
+
+
+
+
主推产品:
+
+
+
+ +
+
+
+
+
+
开始时间:
+
+
+
+
+ +
+
+
+
+
+
+
结束时间:
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ 保存&返回 +
+
+ 取消 +
+
+ +
+
+

提示信息

+
+
- -
-
-
- -
-
-
- 取消 -
-
- 保存&返回 -
-
- -
-
-

评分明细列表

-
-
- + + diff --git a/crm/src/main/java/com/rex/crm/CreateEventPage.java b/crm/src/main/java/com/rex/crm/CreateEventPage.java index 0ab88c3..7bc483a 100644 --- a/crm/src/main/java/com/rex/crm/CreateEventPage.java +++ b/crm/src/main/java/com/rex/crm/CreateEventPage.java @@ -14,6 +14,7 @@ import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.HiddenField; @@ -22,7 +23,8 @@ import org.apache.wicket.markup.html.form.RadioGroup; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.html.link.PopupSettings; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; @@ -30,275 +32,305 @@ import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.util.string.StringValue; +import com.rex.crm.beans.CRMUser; import com.rex.crm.beans.Choice; +import com.rex.crm.beans.UserInfo; import com.rex.crm.common.Entity; import com.rex.crm.db.DAOImpl; import com.rex.crm.util.Configuration; - /** - * @author Feiyun Zhou + * @author Feiyun Zhou */ -public class CreateEventPage extends TemplatePage -{ - +public class CreateEventPage extends TemplatePage { + private static final Logger logger = Logger.getLogger(CreateEventPage.class); public Date startDate; protected String endDate; protected String endTime; protected String startTime; + protected String contact_select; protected String hidden_contact_select; protected String hidden_select_user; - protected Choice visiting_purpose = new Choice(1L,""); - protected Choice feature_product = new Choice(1L,""); - protected Choice activity_type = new Choice(1L,""); - protected Choice selected_event_type = new Choice(1L,"拜访"); + protected Choice visiting_purpose = new Choice(1L, ""); + protected Choice feature_product = new Choice(1L, ""); + protected Choice activity_type = new Choice(1L, ""); + protected Choice selected_event_type = new Choice(1L, "拜访"); protected String act_title_input = ""; protected Integer event_type = 1; protected String selected_user = ""; - /** - * Constructor - */ - public CreateEventPage() - { - + protected String status = "计划中"; /*new Choice(1L,"计划中");*/ + protected String location = ""; + protected int total_score; + protected Choice planing = new Choice(0L, ""); + protected Choice openling = new Choice(0L, ""); + protected Choice enquery_listening = new Choice(0L, ""); + protected Choice deliverable = new Choice(0L, ""); + protected Choice objection_handing = new Choice(0L, ""); + protected Choice summary = new Choice(0L, ""); + protected String owner = ""; + protected String whenadded = ""; + protected String crmuserId = ""; + /** + * Constructor + */ + public CreateEventPage() { + initPage(0); + } + + public CreateEventPage(int type) { + initPage(type); + } - Map entities = Configuration.getEntityTable(); + public void initPage(final int type) { + Map entities = Configuration.getEntityTable(); Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); - final String user = ((SignIn2Session)getSession()).getUser(); - final int roleId = ((SignIn2Session)getSession()).getRoleId(); - Form form = new Form("form"){ + final String posId = ((SignIn2Session) getSession()).getPositionId(); + final String user = ((SignIn2Session) getSession()).getUser(); + final String userId = ((SignIn2Session) getSession()).getUserId(); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + CRMUser crmUser = DAOImpl.getCRMUserInfoById(Integer.parseInt(posId)); + final String crmUserName = crmUser.getName(); + //add prompt + final RepeatingView div = new RepeatingView("promptDiv"); + final AbstractItem divitem = new AbstractItem(div.newChildId()); + final Label promptButton = new Label("promptButton","X"); + divitem.add(promptButton); + final Label promptLabel = new Label("prompt","红色字体字段为必填项,请输入!"); + divitem.add(promptLabel); + div.add(new AttributeAppender("style",new Model("display:none"),";")); + divitem.add(new AttributeAppender("style",new Model("display:none"),";")); + div.add(divitem); + add(div); + //set event type + RadioGroup event_type_group = new RadioGroup("event_type_group", new PropertyModel(this, "event_type")); + final Radio callRadio = new Radio("radio1", new Model(1L)); + event_type_group.add(callRadio); + final Radio coachingRadio = new Radio("radio2", new Model(2L)); + if (roleId == 3) { + coachingRadio.add(new AttributeAppender("disabled", "true")); + } + final AttributeModifier redioModifier = new AttributeModifier("checked","checked"); + //辅导名称拼接字段 + final StringBuffer concahName = new StringBuffer(); + Form form = new Form("form") { @Override - protected void onSubmit() - { - logger.debug("the form was submitted!"); - - //logger.debug("startDate:"+ startDate); + protected void onSubmit() { + logger.debug("this form was submitted!"); String sd = getRequest().getPostParameters().getParameterValue("start_date").toString(); - String st = getRequest().getPostParameters().getParameterValue("start_time").toString(); String ed = getRequest().getPostParameters().getParameterValue("end_date").toString(); - String et = getRequest().getPostParameters().getParameterValue("end_time").toString(); - //String visit_type = getRequest().getPostParameters().getParameterValue("visit_type").toString(); String visit_type = String.valueOf(activity_type); - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - String sdt = sd+ " " +st; - String edt = ed + " " + et; + logger.debug("opening:" + String.valueOf(openling.getId())); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + String sdt = sd; + String edt = ed; + int contactId = 0; + int coacheeId = 0; Date startdt = null; Date enddt = null; + boolean flag = true; try { - startdt = dateformat.parse(sdt); - enddt = dateformat.parse(edt); + startdt = dateformat.parse(sdt); + enddt = dateformat.parse(edt); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - logger.debug(String.format("time info %s %s %s %s", sd,st,ed,et)); - logger.debug("event_type:"+ event_type); - logger.debug("contact id:"+ hidden_contact_select); - logger.debug("visit_type:" + visit_type); - logger.debug("usersereaser:" + user); - logger.debug("hidden_select_user: "+ hidden_select_user); - try { - - int crmuserId = 0; - String participants = user; - if(event_type == 1){ - //visiting - crmuserId = Integer.parseInt(uid); - - }else if(event_type == 2){ - //coaching - crmuserId = Integer.parseInt(hidden_select_user); - participants = participants+ ", "+ selected_user; + + if(event_type==1){ + if (null == hidden_contact_select) { + contactId = 0; + div.add(new AttributeAppender("style",new Model("display:block"),";")); + divitem.add(new AttributeAppender("style",new Model("display:block"),";")); + promptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + promptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + callRadio.add(redioModifier); + coachingRadio.add(redioModifier.remove("checked")); + flag = false; + } else { + contactId = Integer.parseInt(hidden_contact_select); + } + }else{ + if(null==hidden_select_user){ + coacheeId = 0; + div.add(new AttributeAppender("style",new Model("display:block"),";")); + divitem.add(new AttributeAppender("style",new Model("display:block"),";")); + promptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + promptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + coachingRadio.add(redioModifier); + callRadio.add(redioModifier.remove("checked")); + flag = false; + }else{ + coacheeId = Integer.parseInt(hidden_select_user); } - - - //insert the event, and return the generated id of the event - long generatedkey = DAOImpl.addCalendarEvent(crmuserId, Integer.parseInt(hidden_contact_select), String.valueOf(activity_type.getId()), - act_title_input, String.valueOf(startdt.getTime()/1000), - String.valueOf(enddt.getTime()/1000),1,user,user,user, - String.valueOf(visiting_purpose.getId()), - String.valueOf(feature_product.getId()),event_type,participants); - logger.debug("generatedkey:"+ generatedkey); - - - - if(generatedkey>0){ - - if(event_type == 1){ - //if it is a visiting, we only send this event to the owner; - DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); - }else if(event_type == 2){ - //if it is a coaching, we need send this event to the manager and sales - - //add new record for the manager - DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); - - //add new record for the sales - DAOImpl.insert2UserRelationTable("activity",hidden_select_user,String.valueOf(generatedkey)); + } + if(flag){ + if (null == act_title_input) { + if (event_type == 1) { + concahName.append("拜访:"); + //根据医生Id获取医生对象 + act_title_input = concahName.append(DAOImpl.getContactById(contactId).getName()).toString(); + } else { + concahName.append(crmUserName); + concahName.append(sd); + concahName.append("拜访辅导"); + act_title_input = concahName.toString(); } - } - - - } catch (NumberFormatException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + try { + int crmuserId = 0; + String participants = user; + if (event_type == 1) { + //visiting + crmuserId = Integer.parseInt(posId); + } else if (event_type == 2) { + //coaching + crmuserId = Integer.parseInt(posId);; + participants = participants + ", " + selected_user; + contactId = -1; + concahName.append("拜访辅导"); + visiting_purpose = new Choice(8L, ""); + } + System.out.println("拜访类型:"+String.valueOf(visiting_purpose.getId())); + //insert the event, and return the generated id of the event + long generatedkey = DAOImpl.addCalendarEventForCoach(crmuserId, contactId, String.valueOf(activity_type.getId()), + act_title_input, String.valueOf(startdt.getTime() / 1000), + String.valueOf(enddt.getTime() / 1000), 1, user, user, user, + String.valueOf(visiting_purpose.getId()), + String.valueOf(feature_product.getId()), event_type.intValue(), participants, + coacheeId, location, total_score, String.valueOf(planing.getId()), String.valueOf(openling.getId()), String.valueOf(enquery_listening.getId()), String.valueOf(deliverable.getId()), String.valueOf(objection_handing.getId()), String.valueOf(summary.getId())); + logger.debug("generatedkey:" + generatedkey); + if (generatedkey > 0) { + if (event_type == 1) { + //if it is a visiting, we only send this event to the owner; + DAOImpl.insert2UserRelationTable("activity",userId, posId ,String.valueOf(coacheeId),String.valueOf(generatedkey)); + } else if (event_type == 2) { + //if it is a coaching, we need send this event to the manager and sales + //add new record for the manager + logger.debug("key:" + String.valueOf(generatedkey)); + DAOImpl.insert2UserRelationTable("activity",userId, posId,String.valueOf(coacheeId), String.valueOf(generatedkey)); + //add new record for the sales + DAOImpl.insert2UserRelationTable("activity", userId,hidden_select_user,String.valueOf(coacheeId), String.valueOf(generatedkey)); + } + } + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + if (type == 0) { + setResponsePage(PageFactory.createPage("calendar")); + } else { + setResponsePage(new ActivityPage()); + } } - setResponsePage(PageFactory.createPage("calendar")); - } }; add(form); - - - StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); - - String startdate = null; - long current = System.currentTimeMillis(); - Date current_date_time = new Date(current); - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); - //set default time to current time - if(startdateValue != null && !startdateValue.isEmpty() && !startdateValue.isNull()){ - startdate = startdateValue.toString(); - }else{ - startdate = dateformat.format(current_date_time); - } - logger.debug("startdate:"+startdate); - - - - - WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); - //startDate = startdate; - //DateTextField start_date_input = new DateTextField("start_date_input", new PropertyModel(this,"startDate")); - form.add(start_date_input); - start_date_input.add(new AttributeModifier("value",startdate)); - - SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); - WebMarkupContainer start_time_input = new WebMarkupContainer("start_time_input"); - form.add(start_time_input); - start_time_input.add(new AttributeModifier("value",timeformatter.format(current_date_time))); - - SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - - Date sDate = current_date_time; - try { - sDate = dateformat2.parse(startdate+ " " + timeformatter.format(current_date_time)); + //辅导者 + TextField coach = new TextField("crmuserId", new PropertyModel(this, "crmuserId")); + coach.add(new AttributeModifier("value", crmUser.getName())); + form.add(coach); + //创建人 + TextField owner = new TextField("owner", new PropertyModel(this, "owner")); + owner.add(new AttributeModifier("value", crmUser.getName())); + form.add(owner); + //创建时间 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + TextField whenadded = new TextField("whenadded", new PropertyModel(this, "whenadded")); + whenadded.add(new AttributeModifier("value", df.format(new Date()))); + form.add(whenadded); + //状态默认为计划中 + TextField status = new TextField("status", new PropertyModel(this, "status")); + form.add(status); + //计划地点 + TextField location = new TextField("location", new PropertyModel(this, "location")); + form.add(location); + //分数 + TextField total_score = new TextField("total_score", new PropertyModel(this, "total_score")); + form.add(total_score); + StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); + + String startdate = null; + long current = System.currentTimeMillis(); + Date current_date_time = new Date(current); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + //set default time to current time + if (startdateValue != null && !startdateValue.isEmpty() && !startdateValue.isNull()) { + startdate = startdateValue.toString(); + } else { + startdate = dateformat.format(current_date_time); + } + SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); + WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); + form.add(start_date_input); + start_date_input.add(new AttributeModifier("value", startdate.substring(0, 10) + "T" + timeformatter.format(current_date_time))); + SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + Date sDate = current_date_time; + try { + sDate = dateformat2.parse(startdate + "T" + timeformatter.format(current_date_time)); } catch (ParseException e) { - // TODO Auto-generated catch block - logger.warn("failed to parse date:",e); + logger.warn("failed to parse date:", e); } - - - Date next_date_time = new Date(sDate.getTime()+3600*1000); - WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); - form.add(end_date_input); - end_date_input.add(new AttributeModifier("value",dateformat.format(next_date_time))); - - - - - WebMarkupContainer end_time_input = new WebMarkupContainer("end_time_input",new Model("")); - form.add(end_time_input); - end_time_input.add(new AttributeModifier("value",timeformatter.format(next_date_time))); - - - PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) - .setWidth(850).setLeft(150).setTop(200); - form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class).setPopupSettings(popupSettings)); - - - form.add(new HiddenField("hidden_contact_select" ,new PropertyModel(this,"hidden_contact_select"))); - form.add(new TextField("contact_select", new Model(""))); - - + Date next_date_time = new Date(sDate.getTime() + 3600 * 1000); + WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); + form.add(end_date_input); + end_date_input.add(new AttributeModifier("value", dateformat.format(next_date_time))); +// PopupSettings popupSettings = new PopupSettings("查找").setLeft(150).setTop(200); + form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class)); + form.add(new HiddenField("hidden_contact_select", new PropertyModel(this, "hidden_contact_select"))); + form.add(new TextField("contact_select", new Model(""))); PageParameters params = new PageParameters(); - params.set("mid", uid); - form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class,params ).setPopupSettings(popupSettings)); - form.add(new HiddenField("hidden_select_user" ,new PropertyModel(this,"hidden_select_user"))); - form.add(new TextField("selected_user" ,new PropertyModel(this,"selected_user"))); - - //final List sales_visiting_purpose_pl = DAOImpl.queryPickList("sales_visiting_purpose_pl"); - //final List com_visiting_purpose_pl = DAOImpl.queryPickList("com_visiting_purpose_pl"); - - - IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() - { - @Override - public List getObject() { - List choices = new ArrayList(); - return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); - } - - }; - - //visiting purpose choice - final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input","com_visiting_purpose_pl",visiting_purpose_choices_model,new PropertyModel(this,"visiting_purpose")); - visiting_purpose_choice.setOutputMarkupId(true); + params.set("mid", posId); + form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class, params)); + form.add(new HiddenField("hidden_select_user", new PropertyModel(this, "hidden_select_user"))); + form.add(new TextField("selected_user", new PropertyModel(this, "selected_user"))); + IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() { + @Override + public List getObject() { + List choices = new ArrayList(); + return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); + } + }; + //visiting purpose choice + final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input", "com_visiting_purpose_pl", visiting_purpose_choices_model, new PropertyModel(this, "visiting_purpose")); + visiting_purpose_choice.setOutputMarkupId(true); form.add(visiting_purpose_choice); - - //event type choice - DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input","activity_activity_types_pl",null,new PropertyModel(this,"activity_type")); - activity_type_choice.setOutputMarkupId(true); - form.add(activity_type_choice); - - activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") - { - + //event type choice + DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input", "activity_activity_types_pl", null, new PropertyModel(this, "activity_type")); + activity_type_choice.setOutputMarkupId(true); + form.add(activity_type_choice); + activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { - -// if(activity_type.getId() == 1L){ -// -// visiting_purpose_choice.setChoices(com_visiting_purpose_pl); -// }else{ -// -// visiting_purpose_choice.setChoices(sales_visiting_purpose_pl); -// } target.add(visiting_purpose_choice); } - }); - - - //set event type - RadioGroup event_type_group=new RadioGroup("event_type_group",new PropertyModel(this,"event_type")); - event_type_group.add(new Radio("radio1", new Model(1L))); - Radio coachingRadio = new Radio("radio2", new Model(2L)); - if(roleId == 3){ - coachingRadio.add(new AttributeAppender("disabled","true")); - } - event_type_group.add(coachingRadio); - form.add(event_type_group); - - - - form.add(createDropDownListFromPickList("feature_product_input","activity_feature_product_pl",null,new PropertyModel(this,"feature_product"))); - form.add(new TextField("act_title_input", new PropertyModel(this,"act_title_input"))); + }); - - } - + event_type_group.add(coachingRadio); + form.add(event_type_group); + form.add(createDropDownListFromPickList("feature_product_input", "activity_feature_product_pl", null, new PropertyModel(this, "feature_product"))); + form.add(createDropDownListFromPickList("planing_input", "score1_pl", null, new PropertyModel(this, "planing"))); + form.add(createDropDownListFromPickList("openling_input", "score1_pl", null, new PropertyModel(this, "openling"))); + form.add(createDropDownListFromPickList("enquery_listening_input", "score1_pl", null, new PropertyModel(this, "enquery_listening"))); + form.add(createDropDownListFromPickList("deliverable_input", "score2_pl", null, new PropertyModel(this, "deliverable"))); + form.add(createDropDownListFromPickList("objection_handing_input", "score1_pl", null, new PropertyModel(this, "objection_handing"))); + form.add(createDropDownListFromPickList("summary_input", "score2_pl", null, new PropertyModel(this, "summary"))); + form.add(new TextField("act_title_input", new PropertyModel(this, "act_title_input"))); + //拜访辅导。辅导者,状态, + } - - private DropDownChoice createDropDownListFromPickList(String markupId, String picklistName,IModel choices,PropertyModel default_model){ - - if(choices == null){ - choices = Model.ofList(DAOImpl.queryPickList(picklistName)); - } - - return new DropDownChoice(markupId, default_model, choices, + private DropDownChoice createDropDownListFromPickList(String markupId, String picklistName, IModel choices, PropertyModel default_model) { + if (choices == null) { + choices = Model.ofList(DAOImpl.queryPickList(picklistName)); + } + return new DropDownChoice(markupId, default_model, choices, new IChoiceRenderer() { - @Override public Object getDisplayValue(Choice choice) { // TODO Auto-generated method stub @@ -310,42 +342,36 @@ public String getIdValue(Choice choice, int index) { // TODO Auto-generated method stub return String.valueOf(choice.getId()); } - }); - } - - class SelectOption implements Serializable{ - private int key; - private String value; - - public SelectOption(int key, String value) { - this.key = key; - this.value = value; - } - public SelectOption() { - - } - - public int getKey() { - return key; - } - - public void setKey(int key) { - this.key = key; - } + } - public String getValue() { - return value; - } + class SelectOption implements Serializable { - public void setValue(String value) { - this.value = value; - } - } + private int key; + private String value; + public SelectOption(int key, String value) { + this.key = key; + this.value = value; + } + public SelectOption() { + } -} + public int getKey() { + return key; + } + public void setKey(int key) { + this.key = key; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + } +} diff --git a/crm/src/main/java/com/rex/crm/DataManagement.html b/crm/src/main/java/com/rex/crm/DataManagement.html new file mode 100644 index 0000000..3ca3587 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/DataManagement.html @@ -0,0 +1,38 @@ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ data table +
+
+ + +
+ + diff --git a/crm/src/main/java/com/rex/crm/DataManagement.java b/crm/src/main/java/com/rex/crm/DataManagement.java new file mode 100644 index 0000000..cbdbd02 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/DataManagement.java @@ -0,0 +1,102 @@ +package com.rex.crm; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; + +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; + +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; + +import com.rex.crm.common.Entity; + +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; + +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; + + +/** + * @author Feiyun Zhou + */ +public class DataManagement extends TemplatePage +{ + private String search_target = ""; + public DataManagement(){ + init(null,null); + } + public DataManagement(final Map filter,List tdata){ + init(filter,tdata); + } + + public void init(final Map filter,List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("data_exchange_teample"); + setPageTitle(entity.getDisplay()); + //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + //TODO get userId from request's session + final String userId = ((SignIn2Session)getSession()).getUserId(); + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + + +// Form form = new Form("form"){ +// +// @Override +// protected void onSubmit() { +// +// String sql = entity.getSql(); +// +// search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; +// +// //sql = sql + " where title like '%"+search_target+"%'"; +// List searchableFields = entity.getSearchableFields(); +// String joint = " like '%"+search_target+"%'"; +// String likequery = ""; +// for(Field sf:searchableFields){ +// likequery = likequery + " OR "+ sf.getName() + joint; +// } +// sql = sql + " where title like '%"+search_target+"%' " + likequery; +// List datalist = null; +// datalist = DAOImpl.queryEntityRelationList(sql); +// setResponsePage(new DataManagement(filter,datalist)); +// } +// +// }; +// add(form); + +// TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); +// form.add(search_input); + String sql = entity.getSql(); + if(tdata == null || tdata.size() == 0){ + + if(filter == null){ + tdata = DAOImpl.queryEntityRelationList(sql); + } + else{ + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) { + if(filter.get(k)) ft.add(k); + } + + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + } + + } + add(new PageableTablePanel("datalist",entity,tdata,null)); + + +// //for the side bar +// List>> types = null; +// types = DAOImpl.queryFilters(sql, entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist()); +// add(new FilterPanel("filterPanel",types ,filter,DataManagement.class)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/DealerAccountPage.html b/crm/src/main/java/com/rex/crm/DealerAccountPage.html deleted file mode 100755 index d34a8a8..0000000 --- a/crm/src/main/java/com/rex/crm/DealerAccountPage.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - -
-
- -
-
-
- data table -
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/DealerAccountPage.java b/crm/src/main/java/com/rex/crm/DealerAccountPage.java deleted file mode 100644 index 93d2dd6..0000000 --- a/crm/src/main/java/com/rex/crm/DealerAccountPage.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.rex.crm; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.Entity; -import com.rex.crm.common.FilterPanel; -import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.TableDataPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.Configuration; - - -/** - * @author Feiyun Zhou - */ -public class DealerAccountPage extends TemplatePage -{ - /** - * Constructor - */ - public DealerAccountPage() - { - initPage(null); - } - - - public DealerAccountPage(Map map){ - initPage(map); - } - - private void initPage(Map filter){ - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("dealerAccount"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - //TODO get userId from request's session - String userId = "20"; - List mapList = null; - if(filter == null){ - mapList = DAOImpl.queryEntityRelationList(entity.getSql(), userId); - }else{ - - List ft = Lists.newArrayList(); - for (String k : filter.keySet()) { - if(filter.get(k)) ft.add(k); - } - mapList = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); - - - } - add(new PageableTablePanel("datalist",entity,mapList)); - - - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,DealerAccountPage.class)); - - } - -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/DealerContactPage.html b/crm/src/main/java/com/rex/crm/DealerContactPage.html deleted file mode 100755 index 43b0658..0000000 --- a/crm/src/main/java/com/rex/crm/DealerContactPage.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -
-
- -
-
-
- data table -
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/DealerContactPage.java b/crm/src/main/java/com/rex/crm/DealerContactPage.java deleted file mode 100644 index d43e4a9..0000000 --- a/crm/src/main/java/com/rex/crm/DealerContactPage.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.rex.crm; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.Entity; -import com.rex.crm.common.FilterPanel; -import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.TableDataPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.Configuration; - - -/** - * @author Feiyun Zhou - */ -public class DealerContactPage extends TemplatePage -{ - /** - * Constructor - */ - public DealerContactPage() - { - initPage(null); - - } - - public DealerContactPage(Map map){ - initPage(map); - } - - private void initPage(Map filter){ - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("dealerContact"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - //TODO get userId from request's session - String userId = "20"; - List mapList = null; - if(filter == null){ - mapList = DAOImpl.queryEntityRelationList(entity.getSql(), userId); - }else{ - - List ft = Lists.newArrayList(); - for (String k : filter.keySet()) { - if(filter.get(k)) ft.add(k); - } - mapList = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); - - - } - add(new PageableTablePanel("datalist",entity,mapList)); - - - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,DealerContactPage.class)); - - } -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/EventCoachEditorPage.html b/crm/src/main/java/com/rex/crm/EventCoachEditorPage.html new file mode 100644 index 0000000..4fa99bd --- /dev/null +++ b/crm/src/main/java/com/rex/crm/EventCoachEditorPage.html @@ -0,0 +1,276 @@ + + + + + + + +
+
+
+ + +
+
+
+ +
+
+
活动名称:
+
+
+
+ +
+
+
+
+
+
辅导人:
+
+
+
+ +
+
+
+
+
+
被辅导人:
+
+
+
+ +    + +
+
+
+
+
+
访前计划:
+
+
+
+ +
+
+
+
+
+
开场:
+
+
+
+ +
+
+
+
+
+
探询聆听:
+
+
+
+ +
+
+
+
+
+
利益销售:
+
+
+
+ +
+
+
+
+
+
异常处理:
+
+
+
+ +
+
+
+
+
+
缔结:
+
+
+
+ +
+
+
+
+
+
总分:
+
+
+
+  (满分100分) +
+
+
+
+
+
计划地点:
+
+
+
+ +
+
+
+
+
+
状态:
+
+
+
+ +
+
+
+
+
+
创建者:
+
+
+
+ +
+
+
+
+
+
创建时间:
+
+
+
+ +
+
+
+
+
+
修改者:
+
+
+
+ +
+
+
+
+
+
修改时间:
+
+
+
+ +
+
+
+ +
+
+
主推产品:
+
+
+
+ +
+
+
+
+
+
开始时间:
+
+
+
+
+ +
+
+
+
+
+
+
结束时间:
+
+
+
+
+ +
+
+
+
+
+
+
+
+ 保存&返回 +
+
+ 取消 +
+
+
+
+
+

提示信息

+
+
+
+ + \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/EventCoachEditorPage.java b/crm/src/main/java/com/rex/crm/EventCoachEditorPage.java new file mode 100644 index 0000000..71936ae --- /dev/null +++ b/crm/src/main/java/com/rex/crm/EventCoachEditorPage.java @@ -0,0 +1,315 @@ +package com.rex.crm; + +import java.io.Serializable; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.HiddenField; +import org.apache.wicket.markup.html.form.IChoiceRenderer; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.link.PopupSettings; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.AbstractReadOnlyModel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; + +import com.rex.crm.beans.CRMUser; +import com.rex.crm.beans.Choice; +import com.rex.crm.beans.UserInfo; +import com.rex.crm.common.Entity; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; + +public class EventCoachEditorPage extends TemplatePage{ + private static final Logger logger = Logger.getLogger(EventCoachEditorPage.class); + public Date startDate; + protected String endDate; + protected String endTime; + protected String startTime; + protected String crmuserId = ""; + protected String location = ""; + protected int total_score; + protected Choice planing = new Choice(0L,""); + protected Choice openling = new Choice(0L,""); + protected Choice enquery_listening = new Choice(0L,""); + protected Choice deliverable = new Choice(0L,""); + protected Choice objection_handing = new Choice(0L,""); + protected Choice summary = new Choice(0L,""); + protected String owner = ""; + protected String whenadded = ""; + protected String modifier = ""; + protected String modifier_time = ""; + protected String act_name_input = ""; + protected String selected_user = ""; + protected Choice feature_product = new Choice(1L, ""); + protected String status = "计划中"; + protected String hidden_select_user; + /** + * Constructor + */ + public EventCoachEditorPage(final long eventId) { + Map entities = Configuration.getEntityTable(); + Entity entity = entities.get("activity"); + setPageTitle(entity.getDisplay()); + final String posId = ((SignIn2Session) getSession()).getPositionId(); + final String user = ((SignIn2Session) getSession()).getUser(); + CRMUser crmUser = DAOImpl.getCRMUserInfoById(Integer.parseInt(posId)); + Map entity_data = DAOImpl.queryEntityById(entity.getSql_ent(),String.valueOf(eventId)); + //add prompt + final RepeatingView div = new RepeatingView("promptDiv"); + final AbstractItem divitem = new AbstractItem(div.newChildId()); + final Label promptButton = new Label("promptButton","X"); + divitem.add(promptButton); + final Label promptLabel = new Label("prompt","红色输入框为必填项,请输入!"); + divitem.add(promptLabel); + div.add(new AttributeAppender("style",new Model("display:none"),";")); + divitem.add(new AttributeAppender("style",new Model("display:none"),";")); + div.add(divitem); + add(div); + //辅导名称拼接字段 + final String crmuserName = crmUser.getName(); + final StringBuffer concahName = new StringBuffer(); + Form form = new Form("form") { + @Override + protected void onSubmit() { + String sd = getRequest().getPostParameters() + .getParameterValue("start_date").toString(); + String ed = getRequest().getPostParameters() + .getParameterValue("end_date").toString(); + String visit_type = String.valueOf(2); + SimpleDateFormat dateformat = new SimpleDateFormat( + "yyyy-MM-dd'T'HH:mm"); + Date act_endtime = new Date(System.currentTimeMillis()); + String sdt = sd; + String edt = ed; + Date startdt = null; + Date enddt = null; + int coachId = 0; + try { + startdt = dateformat.parse(sdt); + enddt = dateformat.parse(edt); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(null==act_name_input){ + concahName.append(crmuserName); + concahName.append(sd); + concahName.append("拜访辅导"); + act_name_input = concahName.toString(); + } + if(null==hidden_select_user){ + coachId = 0; + }else{ + coachId = Integer.parseInt(hidden_select_user); + } + boolean flag = true; + //验证字段是否为空如果为空则做页面提示 + if(coachId==0){ + div.add(new AttributeAppender("style",new Model("display:block"),";")); + divitem.add(new AttributeAppender("style",new Model("display:block"),";")); + promptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + promptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + flag = false; + } + if(flag){ + try { + DAOImpl.updateCalendarEventForCoach(String.valueOf(eventId),hidden_select_user, + String.valueOf(startdt.getTime() / 1000), + String.valueOf(enddt.getTime() / 1000),user,coachId,location,total_score,String.valueOf(planing.getId()),String.valueOf(openling.getId()),String.valueOf(enquery_listening.getId()),String.valueOf(deliverable.getId()),String.valueOf(objection_handing.getId()),String.valueOf(summary.getId()),act_name_input); + + } catch (NumberFormatException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(PageFactory.createPage("calendar")); + } + } + }; + add(form); + + StringValue startdateValue = this.getRequest().getRequestParameters() + .getParameterValue("startdate"); + + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + Date startDate = new Date( + ((Number) entity_data.get("starttime")).longValue()); + String startdate = dateformat.format(startDate); + + logger.debug("startdate:" + startdate); + + WebMarkupContainer start_date_input = new WebMarkupContainer( + "start_date_input"); + form.add(start_date_input); + start_date_input.add(new AttributeModifier("value", startdate)); + Date endDate = new Date( + ((Number) entity_data.get("endtime")).longValue()); + WebMarkupContainer end_date_input = new WebMarkupContainer( + "end_date_input"); + form.add(end_date_input); + end_date_input.add(new AttributeModifier("value", dateformat + .format(endDate))); + feature_product.setId(((Number) entity_data.get("feature_product")) + .longValue()); + form.add(createDropDownListFromPickList("feature_product", + "activity_feature_product_pl", null, new PropertyModel(this, + "feature_product"))); + //辅导者 + //获取辅导者对象 + CRMUser crmuser = DAOImpl.getCrmUserById((int) entity_data.get("crmuserId")); + crmuserId = crmuser.getName(); + form.add(new TextField("crmuserId", new PropertyModel(this, + "crmuserId"))); + + + hidden_select_user = String.valueOf(entity_data.get("crmuserId")); + form.add(new HiddenField("hidden_select_user", + new PropertyModel(this, "hidden_select_user"))); + //被辅导者 + int selected_userId = (int)entity_data.get("coacheeId"); + selected_user = DAOImpl.getCrmUserById(selected_userId).getName(); + form.add(new TextField("selected_user" ,new PropertyModel(this,"selected_user"))); + + + PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) + .setWidth(850).setLeft(150).setTop(200); + PageParameters params = new PageParameters(); + params.set("mid", posId); + form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class,params ).setPopupSettings(popupSettings)); + //form.add(new HiddenField("hidden_select_user" ,new PropertyModel(this,"hidden_select_user"))); + //地址 + location = (String)entity_data.get("location"); + form.add(new TextField("location", new PropertyModel(this, + "location"))); + //评分一系列分数 + total_score = (int)entity_data.get("total_score"); + form.add(new TextField("total_score", new PropertyModel(this, + "total_score"))); + + planing.setId(((Number) entity_data.get("planing")) + .longValue()); + form.add(createDropDownListFromPickList("planing_input", + "score1_pl", null, new PropertyModel(this, + "planing"))); + openling.setId(((Number) entity_data.get("openling")) + .longValue()); + form.add(createDropDownListFromPickList("openling_input", + "score1_pl", null, new PropertyModel(this, + "openling"))); + enquery_listening.setId(((Number) entity_data.get("enquery_listening")) + .longValue()); + form.add(createDropDownListFromPickList("enquery_listening_input", + "score1_pl", null, new PropertyModel(this, + "enquery_listening"))); + deliverable.setId(((Number) entity_data.get("deliverable")) + .longValue()); + form.add(createDropDownListFromPickList("deliverable_input", + "score2_pl", null, new PropertyModel(this, + "deliverable"))); + objection_handing.setId(((Number) entity_data.get("objection_handing")) + .longValue()); + form.add(createDropDownListFromPickList("objection_handing_input", + "score2_pl", null, new PropertyModel(this, + "objection_handing"))); + summary.setId(((Number) entity_data.get("summary")) + .longValue()); + form.add(createDropDownListFromPickList("summary_input", + "score2_pl", null, new PropertyModel(this, + "summary"))); + owner = (String) entity_data.get("owner"); + form.add(new TextField("owner", new PropertyModel(this, + "owner"))); + Date createTime = (Date)entity_data.get("whenadded"); + whenadded = createTime.toString(); + form.add(new TextField("whenadded", new PropertyModel(this, + "whenadded"))); + act_name_input = (String) entity_data.get("title"); + + form.add(new TextField("act_name_input", new PropertyModel(this, + "act_name_input"))); + TextField modifier = new TextField("modifier", new PropertyModel(this,"modifier")); + modifier.add(new AttributeModifier("value",crmUser.getName())); + form.add(modifier); + //创建时间 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + TextField modifier_time = new TextField("modifier_time", new PropertyModel(this,"modifier_time")); + modifier_time.add(new AttributeModifier("value",df.format(new Date()))); + form.add(modifier_time); + TextField statusField = new TextField("status", new PropertyModel(this,"status")); + form.add(statusField); + } + private DropDownChoice createDropDownListFromPickList(String markupId, + String picklistName, IModel choices, PropertyModel default_model) { + + if (choices == null) { + choices = Model.ofList(DAOImpl.queryPickList(picklistName)); + } + + return new DropDownChoice(markupId, default_model, choices, + new IChoiceRenderer() { + + @Override + public Object getDisplayValue(Choice choice) { + // TODO Auto-generated method stub + return choice.getVal(); + } + + @Override + public String getIdValue(Choice choice, int index) { + // TODO Auto-generated method stub + return String.valueOf(choice.getId()); + } + + }); + } + class SelectOption implements Serializable { + private int key; + private String value; + + public SelectOption(int key, String value) { + this.key = key; + this.value = value; + } + + public SelectOption() { + + } + + public int getKey() { + return key; + } + + public void setKey(int key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } +} diff --git a/crm/src/main/java/com/rex/crm/EventEditorPage.html b/crm/src/main/java/com/rex/crm/EventEditorPage.html index bf6e006..9b285bf 100755 --- a/crm/src/main/java/com/rex/crm/EventEditorPage.html +++ b/crm/src/main/java/com/rex/crm/EventEditorPage.html @@ -1,166 +1,149 @@ - - - - - -
-
- - - - -
-
- -
- -
- -
- -
-
-
- -
- -
-
- -
- -
- - - - - - -
 
-
- -
- - - - - - -
 
- - - -
- -
- - -
- - - -
- + xmlns:wicket="http://wicket.apache.org"> + + + + +
+
+
+ + +
+ +
+
+
活动名称:
+
+
+ +
+
+
+
+
拜访类型:
+
+
+ +
+
+
+
+ + +
拜访医生:
+
+
+ - 查找医生 -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- - - - - - +
- -
-
-
- 取消 -
-
- 保存&返回 -
-
-
-
- -
- +
+ +
+
主推产品:
+
+
+ +
+
+
+
+
开始时间:
+
+
+
+ +
+
+
+
+
+
结束时间:
+
+
+
+ +
+
+
+
+ + + +
+
+
+ 保存&返回 +
+
+ 取消 +
+
+
+ +
+
+

提示信息

+
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/EventEditorPage.java b/crm/src/main/java/com/rex/crm/EventEditorPage.java index f9fae65..55cce22 100644 --- a/crm/src/main/java/com/rex/crm/EventEditorPage.java +++ b/crm/src/main/java/com/rex/crm/EventEditorPage.java @@ -16,6 +16,7 @@ import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; +import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.extensions.markup.html.form.DateTextField; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; @@ -27,6 +28,8 @@ import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.PopupSettings; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; @@ -44,76 +47,101 @@ import com.rex.crm.db.DAOImpl; import com.rex.crm.util.Configuration; - /** - * @author Feiyun Zhou + * @author Feiyun Zhou */ -public class EventEditorPage extends TemplatePage -{ - - private static final Logger logger = Logger.getLogger(EventEditorPage.class); +public class EventEditorPage extends TemplatePage { + + private static final Logger logger = Logger + .getLogger(EventEditorPage.class); public Date startDate; protected String endDate; protected String endTime; protected String startTime; protected String hidden_contact_select; protected String contact_name; - protected Choice visiting_purpose = new Choice(1L,""); - protected Choice feature_product = new Choice(1L,"");; - protected Choice activity_type = new Choice(1L,"");; - protected String act_title_input = ""; - /** - * Constructor - */ - public EventEditorPage(final long eventId) - { - - - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); + protected Choice visiting_purpose = new Choice(1L, ""); + protected Choice feature_product = new Choice(1L, ""); + ; + protected Choice activity_type = new Choice(1L, ""); + ; + protected String act_title_input = ""; + + /** + * Constructor + */ + public EventEditorPage(final long eventId) { + + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); - final String user = ((SignIn2Session)getSession()).getUser(); - - Map entity_data = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eventId)); - - Form form = new Form("form"){ + //final String posId = ((SignIn2Session) getSession()).getPositionId(); + final String user = ((SignIn2Session) getSession()).getUser(); + + Map entity_data = DAOImpl.queryEntityById(entity.getSql_ent(), + String.valueOf(eventId)); + //add prompt + final RepeatingView div = new RepeatingView("promptDiv"); + final AbstractItem divitem = new AbstractItem(div.newChildId()); + final Label promptButton = new Label("promptButton","X"); + divitem.add(promptButton); + final Label promptLabel = new Label("prompt","红色输入框为必填项,请输入!"); + divitem.add(promptLabel); + div.add(new AttributeAppender("style",new Model("display:none"),";")); + divitem.add(new AttributeAppender("style",new Model("display:none"),";")); + div.add(divitem); + add(div); + Form form = new Form("form") { @Override - protected void onSubmit() - { + protected void onSubmit() { logger.debug("the form was submitted!"); - - //logger.debug("startDate:"+ startDate); - String sd = getRequest().getPostParameters().getParameterValue("start_date").toString(); - String st = getRequest().getPostParameters().getParameterValue("start_time").toString(); - String ed = getRequest().getPostParameters().getParameterValue("end_date").toString(); - String et = getRequest().getPostParameters().getParameterValue("end_time").toString(); - //String visit_type = getRequest().getPostParameters().getParameterValue("visit_type").toString(); + + // logger.debug("startDate:"+ startDate); + String sd = getRequest().getPostParameters() + .getParameterValue("start_date").toString(); + String ed = getRequest().getPostParameters() + .getParameterValue("end_date").toString(); String visit_type = String.valueOf(activity_type.getId()); - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); -// SimpleDateFormat timeformat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); - Date act_endtime =new Date(System.currentTimeMillis()); - String sdt = sd+ " " +st; - String edt = ed + " " + et; + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + Date act_endtime = new Date(System.currentTimeMillis()); + String sdt = sd; + String edt = ed; Date startdt = null; Date enddt = null; + int contactId = 0; + //标识 + boolean flag = true; try { - startdt = dateformat.parse(sdt); - enddt = dateformat.parse(edt); + startdt = dateformat.parse(sdt); + enddt = dateformat.parse(edt); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - logger.debug(String.format("time info %s %s %s %s", sd,st,ed,et)); - - logger.debug("contact id:"+ hidden_contact_select); + logger.debug(String.format("time info %s %s", sd, ed)); + logger.debug("contact id:" + hidden_contact_select); logger.debug("visit_type:" + visit_type); logger.debug("usersereaser:" + user); + if(null==hidden_contact_select){ + contactId = 0; + }else{ + contactId = Integer.parseInt(hidden_contact_select); + } + if(contactId==0){ + div.add(new AttributeAppender("style",new Model("display:block"),";")); + divitem.add(new AttributeAppender("style",new Model("display:block"),";")); + promptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + promptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + flag = false; + } + System.out.println("title:"+act_title_input); try { - - DAOImpl.updateCalendarEvent(String.valueOf(eventId), hidden_contact_select, visit_type, act_title_input, startdt.getTime(), enddt.getTime(), - 1, user, String.valueOf(visiting_purpose.getId()), String.valueOf(feature_product.getId())); - + DAOImpl.updateCalendarEvent(String.valueOf(eventId), + hidden_contact_select, visit_type, act_title_input, + String.valueOf(startdt.getTime() / 1000),String.valueOf(enddt.getTime() / 1000), 1, user, + String.valueOf(visiting_purpose.getId()), + String.valueOf(feature_product.getId())); + } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -121,113 +149,103 @@ protected void onSubmit() // TODO Auto-generated catch block e.printStackTrace(); } - - setResponsePage(PageFactory.createPage("calendar")); - + setResponsePage(new EventViewerPage(String.valueOf(eventId))); } }; add(form); - - - StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); - - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); - Date startDate = new Date(((Number)entity_data.get("starttime")).longValue()); - String startdate = dateformat.format(startDate); - - logger.debug("startdate:"+startdate); - - - - - WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); - //startDate = startdate; - //DateTextField start_date_input = new DateTextField("start_date_input", new PropertyModel(this,"startDate")); - form.add(start_date_input); - start_date_input.add(new AttributeModifier("value",startdate)); - - SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); - WebMarkupContainer start_time_input = new WebMarkupContainer("start_time_input"); - form.add(start_time_input); - start_time_input.add(new AttributeModifier("value",timeformatter.format(startDate))); - - SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - - Date endDate = new Date(((Number)entity_data.get("endtime")).longValue()); - WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); - form.add(end_date_input); - end_date_input.add(new AttributeModifier("value",dateformat.format(endDate))); - - - WebMarkupContainer end_time_input = new WebMarkupContainer("end_time_input",new Model("")); - form.add(end_time_input); - end_time_input.add(new AttributeModifier("value",timeformatter.format(endDate))); - - - PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) - .setWidth(850).setLeft(150).setTop(200); - form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class).setPopupSettings(popupSettings)); - - - hidden_contact_select = String.valueOf(entity_data.get("contactId")); - form.add(new HiddenField("hidden_contact_select" ,new PropertyModel(this,"hidden_contact_select"))); - contact_name = String.valueOf(entity_data.get("cn")); - form.add(new TextField("contact_select", new PropertyModel(this,"contact_name"))); - - IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() - { - @Override - public List getObject() { - List choices = new ArrayList(); - return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); - } - + StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); + + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); + Date startDate = new Date( ((Number) entity_data.get("starttime")).longValue()); + String startdate = dateformat.format(startDate); + + logger.debug("startdate:" + startdate); + + WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); + // startDate = startdate; + // DateTextField start_date_input = new + // DateTextField("start_date_input", new + // PropertyModel(this,"startDate")); + form.add(start_date_input); + SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); + start_date_input.add(new AttributeModifier("value", startdate + "T" + timeformatter.format(startDate))); + + Date endDate = new Date(((Number) entity_data.get("endtime")).longValue()); + WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); + form.add(end_date_input); + end_date_input.add(new AttributeModifier("value", dateformat.format(endDate) + "T" + timeformatter.format(endDate))); + + PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) + .setWidth(850).setLeft(150).setTop(200); + form.add(new BookmarkablePageLink("search_btn", + SearchContactPage.class).setPopupSettings(popupSettings)); + + hidden_contact_select = String.valueOf(entity_data.get("contactId")); + form.add(new HiddenField("hidden_contact_select", + new PropertyModel(this, "hidden_contact_select"))); + contact_name = String.valueOf(entity_data.get("cn")); + form.add(new TextField("contact_select", new PropertyModel( + this, "contact_name"))); - }; + IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() { + @Override + public List getObject() { + List choices = new ArrayList(); + return DAOImpl.queryPickListByFilter( + "activity_visiting_purpose_pl", "activity_type", + String.valueOf(activity_type.getId())); + } + }; - //visiting purpose choice - visiting_purpose.setId(((Number)entity_data.get("visiting_purpose")).longValue()); - final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input","com_visiting_purpose_pl",visiting_purpose_choices_model,new PropertyModel(this,"visiting_purpose")); - visiting_purpose_choice.setOutputMarkupId(true); + // visiting purpose choice + visiting_purpose.setId(((Number) entity_data.get("visiting_purpose")) + .longValue()); + final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList( + "visiting_purpose_input", "com_visiting_purpose_pl", + visiting_purpose_choices_model, new PropertyModel(this, + "visiting_purpose")); + visiting_purpose_choice.setOutputMarkupId(true); form.add(visiting_purpose_choice); - - //event type choice - activity_type.setId(((Number)entity_data.get("act_type")).longValue()); - DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input","activity_activity_types_pl",null,new PropertyModel(this,"activity_type")); - activity_type_choice.setOutputMarkupId(true); - form.add(activity_type_choice); - - activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") - { - + + // event type choice + activity_type.setId(((Number) entity_data.get("act_type")).longValue()); + DropDownChoice activity_type_choice = createDropDownListFromPickList( + "activity_type_input", "activity_activity_types_pl", null, + new PropertyModel(this, "activity_type")); + activity_type_choice.setOutputMarkupId(true); + form.add(activity_type_choice); + + activity_type_choice.add(new AjaxFormComponentUpdatingBehavior( + "onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(visiting_purpose_choice); } - }); - - feature_product.setId(((Number)entity_data.get("feature_product")).longValue()); - form.add(createDropDownListFromPickList("feature_product_input","activity_feature_product_pl",null,new PropertyModel(this,"feature_product"))); - act_title_input = (String)entity_data.get("title"); - form.add(new TextField("act_title_input", new PropertyModel(this,"act_title_input"))); - - - } - - - - private DropDownChoice createDropDownListFromPickList(String markupId, String picklistName,IModel choices,PropertyModel default_model){ - - if(choices == null){ - choices = Model.ofList(DAOImpl.queryPickList(picklistName)); - } - - return new DropDownChoice(markupId, default_model, choices, - new IChoiceRenderer() { + }); + + feature_product.setId(((Number) entity_data.get("feature_product")) + .longValue()); + form.add(createDropDownListFromPickList("feature_product_input", + "activity_feature_product_pl", null, new PropertyModel(this, + "feature_product"))); + act_title_input = (String) entity_data.get("title"); + form.add(new TextField("act_title_input", new PropertyModel(this, + "act_title_input"))); + + } + private DropDownChoice createDropDownListFromPickList(String markupId, + String picklistName, IModel choices, PropertyModel default_model) { + + if (choices == null) { + choices = Model.ofList(DAOImpl.queryPickList(picklistName)); + } + + return new DropDownChoice(markupId, default_model, choices, + new IChoiceRenderer() { @Override public Object getDisplayValue(Choice choice) { // TODO Auto-generated method stub @@ -239,42 +257,36 @@ public String getIdValue(Choice choice, int index) { // TODO Auto-generated method stub return String.valueOf(choice.getId()); } - }); - } - - class SelectOption implements Serializable{ - private int key; - private String value; - - public SelectOption(int key, String value) { - this.key = key; - this.value = value; - } - public SelectOption() { - - } - - public int getKey() { - return key; - } - - public void setKey(int key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } + } + class SelectOption implements Serializable { + private int key; + private String value; -} + public SelectOption(int key, String value) { + this.key = key; + this.value = value; + } + + public SelectOption() { + } + public int getKey() { + return key; + } + public void setKey(int key) { + this.key = key; + } + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } +} diff --git a/crm/src/main/java/com/rex/crm/EventViewerPage.html b/crm/src/main/java/com/rex/crm/EventViewerPage.html index 056507b..2238443 100755 --- a/crm/src/main/java/com/rex/crm/EventViewerPage.html +++ b/crm/src/main/java/com/rex/crm/EventViewerPage.html @@ -1,90 +1,94 @@ - - - + + +
+
+
+
+
+ + +
+
+
+ 返回 +
+
+ 编辑 +
+
+ +
+
+
+
+ 删除 +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - });// end onDomReady function - - + + + + + -
-
-
-
-
- - -
-
-
- 删除 -
- -
-
- -
- 返回 -
-
- 编辑 -
-
- 完成 -
-
-
- -
-
- +
-
- - - -
-
-
-
-
- - -
- + + diff --git a/crm/src/main/java/com/rex/crm/EventViewerPage.java b/crm/src/main/java/com/rex/crm/EventViewerPage.java index c8f4ddc..a1cfdca 100644 --- a/crm/src/main/java/com/rex/crm/EventViewerPage.java +++ b/crm/src/main/java/com/rex/crm/EventViewerPage.java @@ -55,26 +55,25 @@ public class EventViewerPage extends TemplatePage */ public EventViewerPage() { - + System.out.println("无参数"); Map entities = Configuration.getEntityTable(); Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); + final String posId = ((SignIn2Session)getSession()).getPositionId(); final int roleId = ((SignIn2Session)getSession()).getRoleId(); StringValue eventIdValue = this.getRequest().getRequestParameters().getParameterValue("eventid"); //final long eventId long eid = 0; if(!eventIdValue.isEmpty() && !eventIdValue.isNull()){ eid = eventIdValue.toLong(); - } final long eventId = eid; + System.out.println("eventID:"+eventId); Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eventId)); //if the complete and edit button visible; boolean write_btn_visible = true; //get the event status int status = 2; - if(map != null){ Object st = map.get("act_status"); status = ((Number)st).intValue(); @@ -102,19 +101,28 @@ protected void onSubmit() //update status of calenderEvent mark it to be completed Date act_end_datetime = new Date(); DAOImpl.updateStatusOfCalendarEvent((int)eventId, 2,act_end_datetime); - //判断类型如果是辅导类型则跳转到评分界面 setResponsePage(PageFactory.createPage("calendar")); } }; add(form); - + int eventType = 0; + if(map != null){ + eventType = ((Number) map.get("event_type")).intValue(); + logger.debug("eventType:"+eventType); + } + final int event_type = eventType; + System.out.println("event_type:"+eventType); Link edit_event_btn = new Link("edit_event_btn") { - @Override public void onClick() { - - setResponsePage(new EventEditorPage(eventId)); + //判断活动类型 + if(event_type==1){ + setResponsePage(new EventEditorPage(eventId)); + }else{ + setResponsePage(new EventCoachEditorPage(eventId)); + } + } }; edit_event_btn.setVisible(write_btn_visible); @@ -124,15 +132,25 @@ public void onClick() { @Override public void onClick() { - - DAOImpl.deleteRecord( String.valueOf(eventId), "activity"); - - setResponsePage(PageFactory.createPage("calendar")); + DAOImpl.deleteRecord( String.valueOf(eventId), "activity"); + setResponsePage(PageFactory.createPage("calendar")); } }; delete_event_btn.setVisible(write_btn_visible); form.addOrReplace(delete_event_btn); - + if(map!= null){ + //获取当前时间 + Date currentDate = new Date(); + logger.debug("currentDate:"+currentDate);; + //获取开始时间 + Date startDate = new Date(((Number)map.get("starttime")).longValue()); + logger.debug("startDate:"+startDate); + //如果两个时间比较大于0则开始时间大于当前时间 + if(startDate.compareTo(currentDate)>0){ + logger.debug("计划时间晚于当前时间"); + write_btn_visible = false; + } + } WebMarkupContainer complete_btn = new WebMarkupContainer("complete_btn"); complete_btn.setVisible(write_btn_visible); form.add(complete_btn); @@ -142,27 +160,15 @@ public void onClick() { //add(new Label("name",String.valueOf(map.get("name")))); add(new EntityDetailPanel("detailed",entity,map,String.valueOf(eventId),1,"calendar")); - - } - - public EventViewerPage(String id) { - + System.out.println("id:"+id); Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); + final Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); final int roleId = ((SignIn2Session)getSession()).getRoleId(); -// StringValue eventIdValue = this.getRequest().getRequestParameters().getParameterValue("eventid"); - //final long eventId -// long eid = 0; -// if(!eventIdValue.isEmpty() && !eventIdValue.isNull()){ -// eid = eventIdValue.toLong(); -// -// } final int eventId = Integer.parseInt(id); logger.debug("entity"+entity); Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eventId)); @@ -198,19 +204,30 @@ protected void onSubmit() //update status of calenderEvent mark it to be completed Date act_end_datetime = new Date(); DAOImpl.updateStatusOfCalendarEvent((int)eventId, 2,act_end_datetime); - - setResponsePage(PageFactory.createPage("calendar")); - + if(entity.getName().equals("activity")){ + setResponsePage(new ActivityPage()); + }else{ + setResponsePage(PageFactory.createPage("calendar")); + } } }; add(form); - + int eventType = 0; + if(map != null){ + eventType = ((Number) map.get("event_type")).intValue(); + logger.debug("eventType:"+eventType); + } + final int event_type = eventType; + System.out.println("event_type:"+eventType); Link edit_event_btn = new Link("edit_event_btn") { @Override public void onClick() { - - setResponsePage(new EventEditorPage(eventId)); + if(event_type==1){ + setResponsePage(new EventEditorPage(eventId)); + }else{ + setResponsePage(new EventCoachEditorPage(eventId)); + } } }; edit_event_btn.setVisible(write_btn_visible); @@ -222,12 +239,28 @@ public void onClick() { public void onClick() { DAOImpl.deleteRecord( String.valueOf(eventId), "activity"); - setResponsePage(PageFactory.createPage("calendar")); + if(entity.getName().equals("activity")){ + setResponsePage(new ActivityPage()); + }else{ + setResponsePage(PageFactory.createPage("calendar")); + } } }; delete_event_btn.setVisible(write_btn_visible); form.addOrReplace(delete_event_btn); - + if(map!= null){ + //获取当前时间 + Date currentDate = new Date(); + logger.debug("currentDate:"+currentDate);; + //获取开始时间 + Date startDate = new Date(((Number)map.get("starttime")).longValue()); + logger.debug("startDate:"+startDate); + //如果两个时间比较大于0则开始时间大于当前时间 + if(startDate.compareTo(currentDate)>0){ + logger.debug("计划时间晚于当前时间"); + write_btn_visible = false; + } + } WebMarkupContainer complete_btn = new WebMarkupContainer("complete_btn"); complete_btn.setVisible(write_btn_visible); form.add(complete_btn); diff --git a/crm/src/main/java/com/rex/crm/HomePage.html b/crm/src/main/java/com/rex/crm/HomePage.html index 151c261..f302ad6 100644 --- a/crm/src/main/java/com/rex/crm/HomePage.html +++ b/crm/src/main/java/com/rex/crm/HomePage.html @@ -1,167 +1,79 @@ - - - +
+
+
+ +
+
全局搜索
+ +
+ + + +
+
快速创建
+ +
+ +
+
+
+
+
+
+ data table +
+
+
+
- var barChartData = { - labels : ["一月","二月","三月","四月","五月","六月","七月"], - datasets : [ - { - fillColor : "rgba(220,220,220,0.5)", - strokeColor : "rgba(220,220,220,1)", - data : [65,59,90,81,56,55,40] - }, - { - fillColor : "rgba(151,187,205,0.5)", - strokeColor : "rgba(151,187,205,1)", - data : [28,48,40,19,96,27,100] - } - ] - - } - - var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Bar(barChartData); - var pieData = [ - { - value: 30, - color:"#F38630" - }, - { - value : 50, - color : "#E0E4CC" - }, - { - value : 100, - color : "#69D2E7" - } - - ]; - - var myPie = new Chart(document.getElementById("canvas2").getContext("2d")).Pie(pieData); - - }); - -
-
- -
-
-
- - - - - - - - - - - -
- -
- -
- - -
- -
-
-
-
-
    -
  • -
    -
    - -
    -
  • - -
  • -
    -
    - -
    -
  • - -
  • -
    -
    - -
    -
  • -
  • -
    -
    - -
    -
  • - +
    +
    +
    +
    + data table +
    +
    +
    +
    + +
+ + - - -
-
-
- + + \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/HomePage.java b/crm/src/main/java/com/rex/crm/HomePage.java index 1980748..9bcd19f 100644 --- a/crm/src/main/java/com/rex/crm/HomePage.java +++ b/crm/src/main/java/com/rex/crm/HomePage.java @@ -1,58 +1,89 @@ package com.rex.crm; -import java.text.SimpleDateFormat; -import java.util.Date; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.ChoiceRenderer; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.IChoiceRenderer; +import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.list.AbstractItem; -import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.request.mapper.parameter.PageParameters; -import com.google.common.collect.Maps; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.CalendarPanel; -import com.rex.crm.common.TeamManPanel; +import com.rex.crm.beans.CRMUser; +import com.rex.crm.beans.Choice; import com.rex.crm.common.CreateDataPage; import com.rex.crm.common.Entity; -import com.rex.crm.common.EntityDetailPanel; -import com.rex.crm.common.FilterPanel; -import com.rex.crm.common.NewDataFormPanel; -import com.rex.crm.common.Relation; -import com.rex.crm.common.RelationDataPanel; -import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.Field; +import com.rex.crm.common.PageableTablePanel; import com.rex.crm.db.DAOImpl; +import com.rex.crm.db.DBHelper; import com.rex.crm.reporter.ReportingTablePanel; import com.rex.crm.reporter.VisitingReporter; import com.rex.crm.util.Configuration; +import com.rexen.crm.beans.UserRole; + +import java.sql.Connection; + +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.MapHandler; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.model.PropertyModel; public class HomePage extends TemplatePage { private static final long serialVersionUID = 1L; + private String search_target = "";//add + private final Map models = Maps.newHashMap(); + public static long getNumOfAccountOfUser(String userId) { + long size = 0; + Connection conn = null; + String sql = "select count(distinct account.id) as num_of_account from " + + "accountcrmuser,account where accountcrmuser.crmuserId=? AND account.id=accountcrmuser.accountId"; + try { + QueryRunner run = new QueryRunner(); + conn = DBHelper.getConnection(); + Map map = run.query(conn, sql, new MapHandler(), userId); + size = (long) map.get("num_of_account"); + } catch (Exception e) { + + } finally { + DBHelper.closeConnection(conn); + } + return size; + } + + public HomePage() { super(); setPageTitle("主页"); - final String userId = ((SignIn2Session)getSession()).getUserId(); + final String posId = ((SignIn2Session)getSession()).getPositionId(); final int roleId = ((SignIn2Session)getSession()).getRoleId(); - add(new Label("num_of_account_cell",DAOImpl.getNumOfAccountOfUser(userId))); - add(new Label("num_of_contact_cell",DAOImpl.getNumOfContactOfUser(userId))); - add(new Label("num_of_activity_cell",DAOImpl.getNumOfActivityOfUser(userId))); - - BookmarkablePageLink contact_link = new BookmarkablePageLink("contact_link", ContactPage.class); - add(contact_link); - BookmarkablePageLink account_link = new BookmarkablePageLink("account_link", AccountPage.class); - add(account_link); - BookmarkablePageLink activity_link = new BookmarkablePageLink("activity_link", CalendarPage.class); - add(activity_link); + // 业务概览注释 +// add(new Label("num_of_account_cell",DAOImpl.getNumOfAccountOfUser(posId))); +// add(new Label("num_of_contact_cell",DAOImpl.getNumOfContactOfUser(posId))); +// add(new Label("num_of_activity_cell",DAOImpl.getNumOfActivityOfUser(posId))); +// +// BookmarkablePageLink contact_link = new BookmarkablePageLink("contact_link", ContactPage.class); +// add(contact_link); +// BookmarkablePageLink account_link = new BookmarkablePageLink("account_link", AccountPage.class); +// add(account_link); +// BookmarkablePageLink activity_link = new BookmarkablePageLink("activity_link", CalendarPage.class); +// add(activity_link); +// //quick creation bar @@ -60,10 +91,51 @@ public HomePage() { param.add("entityName", "contact"); BookmarkablePageLink contact_create_link = new BookmarkablePageLink("contact_create_link", CreateDataPage.class,param ); add(contact_create_link); - + + WebMarkupContainer userInfo_create_li = new WebMarkupContainer("userInfo_create_li"); + param = new PageParameters(); + param.set("entityName", "userinfo"); + BookmarkablePageLink userInfo_create_link = new BookmarkablePageLink("userInfo_create_link", CreateDataPage.class,param); + userInfo_create_li.setVisible(false); + userInfo_create_li.add(userInfo_create_link); + add(userInfo_create_li); + + if(roleId == 1){ + userInfo_create_li.setVisible(true); + } - BookmarkablePageLink activity_create_link = new BookmarkablePageLink("activity_create_link", CreateEventPage.class); - add(activity_create_link); + /* param = new PageParameters(); + param.add("entityName", "activity"); + BookmarkablePageLink activity_create_link = new BookmarkablePageLink("activity_create_link", CreateDataPage.class,param); + add(activity_create_link);*/ + + + WebMarkupContainer activity_create_li = new WebMarkupContainer("activity_create_li"); + param = new PageParameters(); + param.set("en", "contact"); + param.set("excludeName", "activity"); + param.set("target",-1); + BookmarkablePageLink activity_create_link = new BookmarkablePageLink("activity_create_link", SelectActivityContactPage.class,param); + activity_create_li.setVisible(false); + activity_create_li.add(activity_create_link); + add(activity_create_li); + + if(roleId == 3){ + activity_create_li.setVisible(true); + } + + + WebMarkupContainer coaching_create_li = new WebMarkupContainer("coaching_create_li"); + param = new PageParameters(); + param.add("entityName", "coaching"); + BookmarkablePageLink coaching_create_link = new BookmarkablePageLink("coaching_create_link", ActivitySelectPage.class,param); + coaching_create_li.setVisible(false); + coaching_create_li.add(coaching_create_link); + add(coaching_create_li); + + if(roleId == 2){ + coaching_create_li.setVisible(true); + } WebMarkupContainer account_create_li = new WebMarkupContainer("account_create_li"); param = new PageParameters(); @@ -77,44 +149,187 @@ public HomePage() { account_create_li.setVisible(true); } + WebMarkupContainer position_create_li = new WebMarkupContainer("position_create_li"); + param = new PageParameters(); + param.add("entityName", "crmuser"); + BookmarkablePageLink position_create_link = new BookmarkablePageLink("position_create_link", CreateDataPage.class,param); + position_create_li.setVisible(false); + position_create_li.add(position_create_link); + add(position_create_li); + if(roleId == 1){ + position_create_li.setVisible(true); + } - /** - * 目标医生拜访频率统计 - */ - String cap = "目标医生拜访频率统计"; - List visitingFreq = VisitingReporter.generateVisitingFrequencyReportingByUserId(userId); - Entity reportEntity = Configuration.getEntityByName("contactVisitingFrequency"); - ReportingTablePanel visiting_report_panel = new ReportingTablePanel("visiting_frequency_report_panel", cap, reportEntity, visitingFreq); - add(visiting_report_panel); - /** - * 目标医生拜访覆盖率统计 - */ - cap = "目标医生拜访覆盖率统计"; - List visitingCoverList = VisitingReporter.generateVisitingCoverReportingByUserId(userId); - Entity report_Entity = Configuration.getEntityByName("contactVisitingCoverRate"); - ReportingTablePanel visiting_reportPanel = new ReportingTablePanel("visiting_cover_report_panel", cap, report_Entity, visitingCoverList); - add(visiting_reportPanel); - - cap = "区域内工作天数"; - List workingdays = VisitingReporter.generateWorkingDayReportingByUserId(userId); - Entity reportEntity2 = Configuration.getEntityByName("workingday"); - ReportingTablePanel report_panel = new ReportingTablePanel("working_day_report_panel", cap, reportEntity2, workingdays); - report_panel.add(new AttributeAppender("style",new Model("display:block;"),";")); - add(report_panel); - - - cap = "日均拜访量"; - List visitingPerDay = VisitingReporter.generateVisitingPerDay(visitingFreq,workingdays); - - if (visitingPerDay != null && visitingPerDay.size() > 0) { - Entity reportentity = Configuration.getEntityByName("visitingPerDayReport"); - ReportingTablePanel reportPanel = new ReportingTablePanel("num_of_visiting_per_day_report_panel", cap, reportentity, visitingPerDay); - add(reportPanel); - } else { - add(new WebMarkupContainer("num_of_visiting_per_day_report_panel").setVisible(false)); + + + + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("alert"); + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + List entitys = Configuration.getEntities(); + + + IModel selected_model = new Model(new Choice(0l,"account")); + List entityChoice = new ArrayList(); + final Map entityList = new HashMap(); + for(Entity entityName :entitys){ + if(entityName.isGlobalsearch()){ + Choice choice =new Choice(); + choice.setVal(entityName.getDisplay()); + choice.setName(entityName.getName()); + entityChoice.add(choice); + entityList.put(String.valueOf(entityName.getName()), entityName); + } + } + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + DropDownChoice search_select = new DropDownChoice("search_select",selected_model,entityChoice, new IChoiceRenderer() { + @Override + public Object getDisplayValue(Choice choice) { + // TODO Auto-generated method stub + return choice.getVal(); + } + @Override + public String getIdValue(Choice choice, int index) { + // TODO Auto-generated method stub + return String.valueOf(choice.getName()); } + }); + models.put("entityName", selected_model); + search_select.setNullValid(false); + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String entityName = String.valueOf(((Choice) models.get("entityName").getObject()).getName()); + Entity en = entityList.get(entityName); + String sql = en.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_MANAGER: + sql = en.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = en.getSql(); + break; + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = en.getSqlAdmin(); + System.err.print(sql); + } + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + List searchableFields = en.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + if(en.getName().equalsIgnoreCase("coaching")||en.getName().equalsIgnoreCase("activity")||en.getName().equalsIgnoreCase("willcoaching")){ + sql = sql + " where title like '%" + search_target + "%' " + likequery; + } else{ + sql = sql + " where name like '%" + search_target + "%' " + likequery; + } + System.out.println(sql); + List datalist = null; + + switch (roleId) + { + case UserRole.USER_ROLE_MANAGER: + + if(en.getName().equalsIgnoreCase("account")){ + datalist = DAOImpl.queryEntityRelationList(sql, positionId, positionId,positionId); + }else if(en.getName().equalsIgnoreCase("contact")){ + datalist = DAOImpl.queryEntityRelationList(sql,positionId); + }else if(en.getName().equalsIgnoreCase("coaching")||en.getName().equalsIgnoreCase("activity")||en.getName().equalsIgnoreCase("willcoaching")){ + datalist = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + } + break; + case UserRole.USER_ROLE_SALES: + if(en.getName().equalsIgnoreCase("account")){ + datalist = DAOImpl.queryEntityRelationList(sql, positionId,positionId); + }else if(en.getName().equalsIgnoreCase("coaching")||en.getName().equalsIgnoreCase("activity") + ||en.getName().equalsIgnoreCase("willcoaching")||en.getName().equalsIgnoreCase("contact")){ + datalist = DAOImpl.queryEntityRelationList(sql,positionId); + } + break; + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + System.err.print(sql); + } + + if(entityName.equals("account")){ + setResponsePage(new AccountPage(datalist)); + }else if(entityName.equals("contact")){ + setResponsePage(new ContactPage(datalist)); + }else if(entityName.equals("activity")){ + setResponsePage(new ActivityPage(datalist)); + }else if(entityName.equals("coaching")){ + setResponsePage(new CoachingPage(datalist)); + }else if(entityName.equals("willcoaching")){ + setResponsePage(new CoachingPage(datalist)); + } + + } + + }; +// ChoiceRenderer choiceRenderer = new ChoiceRenderer("name","URL"); + + add(form); + form.add(search_select); + form.add(search_input); + + + String sql = ""; + + switch (roleId) + { + case 1: + sql = "SELECT * from alert where expired > now() and publishDate < now() ORDER BY whenadded DESC"; + break; + case 2: + sql = entity.getSqlManager(); + break; + case 3: + sql = entity.getSql(); + break; + } + List tdata = null; + //获取登录用户的positonID,从而获取crmuser获取大区 + if(((SignIn2Session)getSession()).getRoleId()!=1){ + CRMUser user = DAOImpl.getCrmUserById(((SignIn2Session)getSession()).getPositionId()); + tdata = DAOImpl.queryEntityRelationList(sql,String.valueOf(user.getPl5())); + }else{ + tdata = DAOImpl.queryEntityRelationList(sql); + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + System.out.println("ds:"+((SignIn2Session)getSession()).getRoleId()); + + if(((SignIn2Session)getSession()).getRoleId()==3){ + final Entity entityAct = entities.get("todolist"); + String userName = ((SignIn2Session) getSession()).getUser(); + String sql2="SELECT * FROM crmdb.activity_alert where name='"+userName+"'"; + List tdataAct = DAOImpl.queryEntityRelationList(sql2); + //Entity Fordetail = entities.get("activity"); + add(new PageableTablePanel("datalistAct", entityAct, tdataAct, null)); + }else if(((SignIn2Session)getSession()).getRoleId()==2){ + final Entity entityAct = entities.get("todolistcoach"); + String userName = ((SignIn2Session) getSession()).getUser(); + String sql2="SELECT * FROM crmdb.activity_alert where name='"+userName+"'"; + List tdataAct = DAOImpl.queryEntityRelationList(sql2); + //Entity Fordetail = entities.get("activity"); + add(new PageableTablePanel("datalistAct", entityAct, tdataAct, null)); + } + else{ + WebMarkupContainer container_label = new WebMarkupContainer("datalistAct"); + container_label.setVisible(false); + add( container_label); + } + } } diff --git a/crm/src/main/java/com/rex/crm/NullPosition.html b/crm/src/main/java/com/rex/crm/NullPosition.html new file mode 100644 index 0000000..89f7933 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/NullPosition.html @@ -0,0 +1,11 @@ + + + 登出 + + + +

您暂时没有岗位,请联系管理员为您分配岗位!

+

再见!

+ 回主页 + + diff --git a/crm/src/main/java/com/rex/crm/NullPosition.java b/crm/src/main/java/com/rex/crm/NullPosition.java new file mode 100644 index 0000000..ad8527b --- /dev/null +++ b/crm/src/main/java/com/rex/crm/NullPosition.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.rex.crm; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.request.mapper.parameter.PageParameters; + +public class NullPosition extends WebPage +{ + public NullPosition(final PageParameters parameters) + { + + getSession().invalidate(); + } +} diff --git a/crm/src/main/java/com/rex/crm/PageFactory.java b/crm/src/main/java/com/rex/crm/PageFactory.java index 76eecdf..cfcc8ec 100644 --- a/crm/src/main/java/com/rex/crm/PageFactory.java +++ b/crm/src/main/java/com/rex/crm/PageFactory.java @@ -2,6 +2,12 @@ import org.apache.wicket.Page; +import com.rex.crm.admin.PositionPage; +import com.rex.crm.admin.ProductPage; +import com.rex.crm.admin.ProductTreePage; +import com.rex.crm.admin.UserPage; +import com.rex.crm.common.EntityDetailPage; + public class PageFactory { public static Page createPage(String name){ @@ -14,15 +20,30 @@ public static Page createPage(String name){ }else if(name.equalsIgnoreCase("activity")){ return new ActivityPage(); }else if(name.equalsIgnoreCase("crmuser")){ - return new UserPage(); - }else if(name.equalsIgnoreCase("dealerAccount")){ - return new DealerAccountPage(); - }else if(name.equalsIgnoreCase("dealerContact")){ - return new DealerContactPage(); - }else{ + return new PositionPage(); + }else if(name.equalsIgnoreCase("coaching")||name.equalsIgnoreCase("willCoaching")){ + return new CoachingPage(); + }else if(name.equalsIgnoreCase("userInfo")){ + return new UserPage(); + }else if(name.equalsIgnoreCase("alert")){ + return new AlertPage(); + }else if(name.equalsIgnoreCase("productline")||name.equalsIgnoreCase("product")||name.equalsIgnoreCase("productcategory")){ + return new ProductPage(); + }else if(name.equalsIgnoreCase("province")||name.equalsIgnoreCase("city")){ + return new AreaPage(); + } + else{ return new HomePage(); } } + public static Page createPageToDetail(String EntityName,String id){ + return new EntityDetailPage(EntityName,id); + } + public static Page createPageTree(String EntityName,String id){ + + return new ProductTreePage(id,EntityName); + } + /** * @param args */ diff --git a/crm/src/main/java/com/rex/crm/SearchCRMUserPage.html b/crm/src/main/java/com/rex/crm/SearchCRMUserPage.html index 1e5c89c..4e8227b 100755 --- a/crm/src/main/java/com/rex/crm/SearchCRMUserPage.html +++ b/crm/src/main/java/com/rex/crm/SearchCRMUserPage.html @@ -1,18 +1,20 @@ + - - - - - - - - - - - - + + + + + + + + + + + + });// end onDomReady function + + + +
+
+ + - - - - - - -
- - - - - - - - - - - - - - - - - - -
-
-
- - +
+
+ + +
+ 全选 + +
+
+
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/SearchCRMUserPage.java b/crm/src/main/java/com/rex/crm/SearchCRMUserPage.java index df1a8ae..d1098cf 100755 --- a/crm/src/main/java/com/rex/crm/SearchCRMUserPage.java +++ b/crm/src/main/java/com/rex/crm/SearchCRMUserPage.java @@ -4,11 +4,15 @@ import java.util.Map; import org.apache.log4j.Logger; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Check; import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.wicket.markup.html.form.CheckGroupSelector; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.AbstractItem; @@ -19,119 +23,204 @@ import org.apache.wicket.util.string.StringValue; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.rex.crm.beans.Contact; import com.rex.crm.common.EntityDetailPage; +import com.rex.crm.common.Field; import com.rex.crm.common.NewDataFormPanel; import com.rex.crm.db.DAOImpl; +import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.PageableListView; /** - * - * + * + * * @author Feiyun */ public class SearchCRMUserPage extends WebPage { - private static final Logger logger = Logger.getLogger(SearchCRMUserPage.class); + private static final Logger logger = Logger.getLogger(SearchCRMUserPage.class); private String search_target; - - List selectedUserIds = Lists.newArrayList(); - private String entityId; - private String entityName; + List selectedUserIds = Lists.newArrayList(); + private String entityId; + private String uid; +// private String entityName; + private int type = 0; /** * Constructor - * - * @param parameters - * Page parameters (ignored since this is the home page) + * + * @param parameters Page parameters (ignored since this is the home page) */ public SearchCRMUserPage() { StringValue value = this.getRequest().getRequestParameters().getParameterValue("cid"); - if(value != null){ + StringValue entityname = getRequest().getRequestParameters().getParameterValue("entityname"); + StringValue postId = this.getRequest().getRequestParameters().getParameterValue("positionId"); + + if (value != null) { entityId = value.toString(); } - initPage(entityName,null,entityId); + if(postId != null){ + uid = postId.toString(); + } + initPage(entityname.toString(), null, entityId,uid, type); } - - - public SearchCRMUserPage(String entityName, String entityId) { - logger.debug("sdfsfsdfdsf:"+entityName); - this.entityName = entityName; + public SearchCRMUserPage(String entityName, final String entityId, String uid, int type) { + //logger.debug("sdfsfsdfdsf:"+entityName); this.entityId = entityId; - initPage(entityName,null,entityId); + this.type = type; + this.uid=uid; + initPage(entityName, null, entityId,uid, type); } - - public SearchCRMUserPage(List maplist, String entityName, String cid) { - this.entityName = entityName; - entityId = cid; - initPage(entityName,maplist,cid); + + public SearchCRMUserPage(List maplist, String entityName, final String entityId, String uid,int type) { + this.entityId = entityId; + this.type = type; + this.uid = uid; + initPage(entityName, maplist, entityId,uid, type); } - public void initPage(final String entiytname, List list,final String cid) { - final String userId = ((SignIn2Session) getSession()).getUserId(); - Form form = new Form("form") { - @Override + public void initPage(final String entityname, List list, final String entityId, final String uid, final int type) { + Form form = new Form("form") { + @SuppressWarnings("unchecked") + @Override protected void onSubmit() { logger.debug("the form was submitted!"); List maplist = null; - if(entiytname.equals("account")||entiytname.equals("contact")){ - maplist = DAOImpl.searchCRMUser(search_target); - }else{ - maplist = DAOImpl.searchCRMAccount(search_target); + + if (entityname.equals("account") || entityname.equals("contact")) { + maplist = DAOImpl.searchCRMUser(search_target); + }else if(entityname.equals("userinfo")){ + maplist = DAOImpl.searchUserPosition(uid,search_target); + }else { + if (type == 0||type==4) { + maplist = DAOImpl.searchCRMAccount(search_target); + }else if (type == 1) { + maplist = DAOImpl.searchCRMContact(search_target); + }else if(type == 2){ + maplist = DAOImpl.searchUser(search_target); + } else{ + maplist = DAOImpl.searchCRMUser(search_target); + } } - - setResponsePage(new SearchCRMUserPage(maplist,entityName,cid)); + + + setResponsePage(new SearchCRMUserPage(maplist, entityname, entityId,uid, type)); } }; form.add(new TextField("search_input", new PropertyModel(this, "search_target"))); - add(form); - - + add(form); + + + + Form users_sbumission_form = new Form("users_sbumission_form"); - Form users_sbumission_form = new Form("users_sbumission_form") { + users_sbumission_form.add(new AjaxButton("ajax-button", users_sbumission_form) + { @Override - protected void onSubmit() { - - logger.debug("seletedUserIds:"+ selectedUserIds); - for(String uid:selectedUserIds){ - try{ - DAOImpl.insertRelationOfEntityIDCRMUserID(entityName,cid, uid); - }catch(Exception e){ - - } - } - setResponsePage(new EntityDetailPage(entityName,cid)); + protected void onSubmit(AjaxRequestTarget target, Form form) + { + logger.debug("seletedUserIds:" + selectedUserIds); + for (String positionId : selectedUserIds) { + try { + DAOImpl.insertRelationOfEntityIDCRMUserID(entityname, entityId,positionId ,type); + } catch (Exception e) { + + } + } + + target.appendJavaScript(" window.opener.location.href='./EntityDetailPage?entityName="+entityname+"&id="+entityId+"'; window.close();"); } - }; + + @Override + protected void onError(AjaxRequestTarget target, Form form) + { + // repaint the feedback panel so errors are shown + //target.add(feedback); + } + }); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); add(users_sbumission_form); - CheckGroup group=new CheckGroup("group", new PropertyModel(this,"selectedUserIds")); + CheckGroup group = new CheckGroup("group", new PropertyModel(this, "selectedUserIds")); + if (roleId == 1) { + CheckGroupSelector chks = new CheckGroupSelector("checkboxs"); + group.add(chks); + WebMarkupContainer container_label = new WebMarkupContainer("checkboxs_label"); + group.add(container_label); + container_label.add(new AttributeAppender("for", new Model(chks.getMarkupId()), " ")); + } else { + WebMarkupContainer container = new WebMarkupContainer("checkboxs"); + container.setVisible(false); + group.add(container); + } users_sbumission_form.add(group); - RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); - group.add(dataRowRepeater); + + + + // RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); + // group.add(dataRowRepeater); + + + + + + + //初始化的时候查不出数据 + if (list == null) { + list=DAOImpl.queryEntityRelationList("Select * from account where 1=0"); + } + + final Map tableData = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Map map : (List) list) { + String key = String.valueOf(map.get("id")); + ids.add(key); + tableData.put(key, map); + } - if (list != null) { - for (Map map : list) { - - int uid = ((Number) map.get("id")).intValue(); + final PageableListView listview = new PageableListView("dataRowRepeater", ids, 20) { + + @Override + protected void populateItem(ListItem item) { + String key = item.getDefaultModelObjectAsString(); + Map map = tableData.get(key); + + + + int positionId = ((Number) map.get("id")).intValue(); String name = (String) map.get("name"); String cellPhone = (String) map.get("cellPhone"); - String division = (String) map.get("division"); String email = (String) map.get("email"); - AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); - dataRowRepeater.add(item); - item.add(new Check("checkbox", new Model(String.valueOf(uid)))); + // AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); + // dataRowRepeater.add(item); + Check chk = new Check("checkbox", new Model(String.valueOf(positionId))); + item.add(chk); + WebMarkupContainer container_label = new WebMarkupContainer("checkboxs_label"); + item.add(container_label); + container_label.add(new AttributeAppender("for", new Model(chk.getMarkupId()), " ")); item.add(new Label("name", name)); item.add(new Label("cellPhone", cellPhone)); - item.add(new Label("division", division)); item.add(new Label("email", email)); - - - + } - } + }; + group.add(listview); + AjaxPagingNavigator nav =new AjaxPagingNavigator("navigator", listview); + nav.setOutputMarkupId(true); + + group.setOutputMarkupId(true); + group.setRenderBodyOnly(false); + + group.add(nav); + + group.setVersioned(false); + + } } diff --git a/crm/src/main/java/com/rex/crm/SearchContactPage.html b/crm/src/main/java/com/rex/crm/SearchContactPage.html index 072fce9..5775464 100755 --- a/crm/src/main/java/com/rex/crm/SearchContactPage.html +++ b/crm/src/main/java/com/rex/crm/SearchContactPage.html @@ -1,18 +1,20 @@ + - - - - - - - - - + + + + + + + + + + + - - + }); - - - - - - - - - - - - - - - - - - -
- - + });// end onDomReady function + + + +
+ +
+
+
+
+ +
+
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/SearchContactPage.java b/crm/src/main/java/com/rex/crm/SearchContactPage.java index df4a275..2ea217a 100755 --- a/crm/src/main/java/com/rex/crm/SearchContactPage.java +++ b/crm/src/main/java/com/rex/crm/SearchContactPage.java @@ -45,13 +45,13 @@ public SearchContactPage(List maplist) { } public void initPage(List list) { - final String userId = ((SignIn2Session) getSession()).getUserId(); + final String posId = ((SignIn2Session) getSession()).getPositionId(); Form form = new Form("form") { @Override protected void onSubmit() { logger.debug("the form was submitted!"); // new PropertyModel(this, "selected") - List maplist = DAOImpl.searchContact(userId, search_target); + List maplist = DAOImpl.searchContact(posId, search_target); setResponsePage(new SearchContactPage(maplist)); } diff --git a/crm/src/main/java/com/rex/crm/SelectActivityContactPage.html b/crm/src/main/java/com/rex/crm/SelectActivityContactPage.html new file mode 100644 index 0000000..5189bb4 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SelectActivityContactPage.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+
+
+ + diff --git a/crm/src/main/java/com/rex/crm/SelectActivityContactPage.java b/crm/src/main/java/com/rex/crm/SelectActivityContactPage.java new file mode 100644 index 0000000..425cd56 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SelectActivityContactPage.java @@ -0,0 +1,240 @@ +package com.rex.crm; + +import com.google.common.collect.Lists; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Maps; +import com.rex.crm.common.CreateDataPage; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; +import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.PageableListView; + +public class SelectActivityContactPage extends WebPage { + private static final Logger logger = Logger.getLogger(SelectActivityContactPage.class); + + private static String search_target; + final String posId = ((SignIn2Session) getSession()).getPositionId(); + final String userId = ((SignIn2Session) getSession()).getUserId(); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final Map entities = Configuration.getEntityTable(); + Entity entity = null; + public SelectActivityContactPage(){ + String relationTableName = getRequest().getRequestParameters().getParameterValue("en").toString(); + String tragetEntity = getRequest().getRequestParameters().getParameterValue("excludeName").toString(); + final String excludeId = getRequest().getRequestParameters().getParameterValue("eid").toString(); + String target = getRequest().getRequestParameters().getParameterValue("target").toString(); + entity = entities.get(relationTableName); + + List maplist = selectConatct(tragetEntity,roleId,posId,entity,entities ); + initPage(maplist,relationTableName,tragetEntity,excludeId,target); + // setResponsePage(new SelectActivityContactPage(,"contact",tragetEntity,excludeId,target)); + } + public SelectActivityContactPage(List list,final String relationTableName,final String tragetEntity,final String excludeId,final String target){ + initPage(list,relationTableName,tragetEntity,excludeId,target); + } + public void initPage(List list,final String relationTableName,final String tragetEntity,final String excludeId,final String target) { + final Entity entity = entities.get(relationTableName); + Form form = new Form("form") { + @Override + protected void onSubmit() { + List maplist = selectConatct(tragetEntity,roleId,posId,entity,entities ); + setResponsePage(new SelectActivityContactPage(maplist,relationTableName,tragetEntity,excludeId,target)); + } + }; + form.add(new TextField("search_input", new PropertyModel(this, "search_target"))); + add(form); + + + final List searchableFields = entity.getSearchableFields(); + + final Map tableData = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Map map : (List) list) { + String key = String.valueOf(map.get("id")); + ids.add(key); + tableData.put(key, map); + } + + + final PageableListView listview = new PageableListView("dataRowRepeater", ids, 20) { + + @Override + protected void populateItem(ListItem item) { + String key = item.getDefaultModelObjectAsString(); + Map map = tableData.get(key); + final int uid = ((Number) map.get("id")).intValue(); + String name = (String) map.get("name"); + + item.add(new AttributeAppender("data-id",new Model(uid))); + item.add(new AttributeAppender("data-name",new Model(name))); + item.add(new AttributeAppender("data-ename",relationTableName)); + + //item.add(new AttributeAppender("data-cname", new Model(cname))); + Label cap = new Label("name_span", new Model(name)); + Link link = new Link("createJump"){ + @Override + public void onClick() { + Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(uid)); + Entity entity = entities.get("contact"); + List paramFields = entity.getParamFields(); + Map params = Maps.newHashMap(); + for(Field f:paramFields){ + params.put("contact"+"."+f.getName(), map.get(f.getName())); + } + setResponsePage(new CreateDataPage("activity",params)); + } + + }; + link.add(cap); + //link.add(new AttributeAppender("html",new Model(name),"")); + item.add(link); + + + RepeatingView column_repeater = new RepeatingView("column_repeater"); + item.add(column_repeater); + for(Field f:searchableFields){ + Object obj = map.get(f.getName()); + if(!f.getName().equalsIgnoreCase("name") && obj != null){ + AbstractItem column_item = new AbstractItem(column_repeater.newChildId()); + column_repeater.add(column_item); + + String celldata =String.valueOf(obj); + column_item.add(new Label("celldata",""+f.getDisplay()+": "+celldata).setEscapeModelStrings(false)); + } + } + + + + Object obj = map.get("num_of_visiting"); + if (obj != null) { + AbstractItem column_item = new AbstractItem(column_repeater.newChildId()); + column_repeater.add(column_item); + String num_of_visiting = String.valueOf(obj); + column_item.add(new Label("celldata", num_of_visiting + "(拜访次数)")); + } + + + + } + }; + + add(listview); + AjaxPagingNavigator nav =new AjaxPagingNavigator("navigator", listview); + nav.setOutputMarkupId(true); + + add(nav); + setVersioned(false); + + } + + public static List selectConatct(final String tragetEntity,int roleId,String posId,Entity entity,Map entities ){ + List maplist = null; + if (tragetEntity.equalsIgnoreCase("activity")) { + + String sql = assembleSearchingSQL(roleId, entity); + + switch (roleId) { + case 2:{ + maplist = DAOImpl.queryEntityRelationList(sql, posId, posId); + + break; + } + case 3:{ + maplist = DAOImpl.queryEntityRelationList(sql, posId); + Entity activityEnt = entities.get("activity"); + String actSQL = activityEnt.getSql(); + actSQL = "select contactName,count(contactName) as ct from ("+ actSQL + ") as bact where status=2 group by contactName"; + logger.debug("number_of_act:"+actSQL); + + List num_of_act_per_contact = DAOImpl.queryEntityRelationList(actSQL, posId); + + Map activity_contact_map = Maps.newHashMap(); + for(Map map:num_of_act_per_contact){ + activity_contact_map.put(String.valueOf(map.get("contactName")),map); + } + + + // Map contact_map = Maps.newHashMap(); + for(Map map:maplist){ + String contactId = String.valueOf(map.get("id")); + if(activity_contact_map.containsKey(contactId)){ + map.put("num_of_visiting", activity_contact_map.get(contactId).get("ct")); + } + } + + //sorting + //Collections.s` + Collections.sort(maplist,new Comparator(){ + + @Override + public int compare(Map o1, Map o2) { + Object obj1 = o1.get("num_of_visiting"); + Object obj2 = o2.get("num_of_visiting"); + if(obj1 == null || obj2 == null) return 0; + + long v1 = (long)o1.get("num_of_visiting"); + long v2 = (long)o2.get("num_of_visiting"); + + return (int)(v2-v1); + + } + + }); + + + break; + } + case 1: + maplist = DAOImpl.queryEntityRelationList(sql); + } + } + return maplist; + } + private static String assembleSearchingSQL(final int roleId, final Entity entity) { + String sql = entity.getSql(); + switch(roleId){ + case 1: + sql = entity.getSqlAdmin(); + break; + case 2: + sql = entity.getSqlManager(); + break; + case 3: + sql = entity.getSql(); + break; + } + + search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; + + List searchableFields = entity.getSearchableFields(); + String joint = " like '%"+search_target+"%'"; + String likequery = ""; + for(Field sf:searchableFields){ + likequery = likequery + " OR "+ sf.getName() + joint; + } + + sql = sql + " where name like '%"+search_target+"%' " + likequery ; + return sql; + } +} diff --git a/crm/src/main/java/com/rex/crm/SelectCRMUserPage.html b/crm/src/main/java/com/rex/crm/SelectCRMUserPage.html index 419c2b7..3958bca 100755 --- a/crm/src/main/java/com/rex/crm/SelectCRMUserPage.html +++ b/crm/src/main/java/com/rex/crm/SelectCRMUserPage.html @@ -1,18 +1,21 @@ + - - - - - - - - - + + + + + + + + + + + + - - + }); - - - - - - - - - - - - - - - - - - - - -
- - + });// end onDomReady function + + + +
+ +
+
+
+
+ +
+
+
+
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/SelectCRMUserPage.java b/crm/src/main/java/com/rex/crm/SelectCRMUserPage.java index bab0ce6..fd003ab 100755 --- a/crm/src/main/java/com/rex/crm/SelectCRMUserPage.java +++ b/crm/src/main/java/com/rex/crm/SelectCRMUserPage.java @@ -38,7 +38,9 @@ public class SelectCRMUserPage extends WebPage { * Page parameters (ignored since this is the home page) */ public SelectCRMUserPage() { - StringValue mid = getPageParameters().get("mid"); + StringValue mid = getRequest().getRequestParameters().getParameterValue("mid"); + //.getPageParameters().get("mid"); + logger.debug("mid:"+mid); initPage(null,mid.toString()); } @@ -53,8 +55,8 @@ public void initPage(List list,final String managerId) { protected void onSubmit() { logger.debug("the form was submitted!"); // new PropertyModel(this, "selected") - List maplist = DAOImpl.searchCRMUser(managerId, search_target); - + //List maplist = DAOImpl.searchCRMUser(managerId, search_target); + List maplist = DAOImpl.searchCRMUserOfManager(managerId,search_target); setResponsePage(new SelectCRMUserPage(maplist,managerId)); } diff --git a/crm/src/main/java/com/rex/crm/SelectEntryPage.html b/crm/src/main/java/com/rex/crm/SelectEntryPage.html index e743c02..28b5f86 100755 --- a/crm/src/main/java/com/rex/crm/SelectEntryPage.html +++ b/crm/src/main/java/com/rex/crm/SelectEntryPage.html @@ -1,18 +1,17 @@ + - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - -
- - + });// end onDomReady function + + + +
+
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/SelectEntryPage.java b/crm/src/main/java/com/rex/crm/SelectEntryPage.java index 2edae49..903adfd 100755 --- a/crm/src/main/java/com/rex/crm/SelectEntryPage.java +++ b/crm/src/main/java/com/rex/crm/SelectEntryPage.java @@ -1,7 +1,10 @@ package com.rex.crm; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.log4j.Logger; import org.apache.wicket.behavior.AttributeAppender; @@ -17,9 +20,17 @@ import org.apache.wicket.util.string.StringValue; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import com.rex.crm.beans.Contact; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; import com.rex.crm.common.NewDataFormPanel; import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; +import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.PageableListView; /** * @@ -39,57 +50,316 @@ public class SelectEntryPage extends WebPage { * Page parameters (ignored since this is the home page) */ public SelectEntryPage() { - String entityName = getRequest().getRequestParameters().getParameterValue("en").toString(); - initPage(null,entityName); + String relationTableName = getRequest().getRequestParameters().getParameterValue("en").toString(); + String tragetEntity = getRequest().getRequestParameters().getParameterValue("excludeName").toString(); + final String excludeId = getRequest().getRequestParameters().getParameterValue("eid").toString(); + String target = getRequest().getRequestParameters().getParameterValue("target").toString(); + initPage(null,relationTableName,tragetEntity,excludeId,target); } - public SelectEntryPage(List maplist,String entityName) { - initPage(maplist,entityName); + public SelectEntryPage(List maplist,String relationTableName,String tragetEntity,String excludeId,String target) { + initPage(maplist,relationTableName,tragetEntity,excludeId,target); } - public void initPage(List list,final String entityName) { + public void initPage(List list,final String relationTableName,final String tragetEntity,final String excludeId,final String target) { + final String posId = ((SignIn2Session) getSession()).getPositionId(); final String userId = ((SignIn2Session) getSession()).getUserId(); - final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get(relationTableName); Form form = new Form("form") { @Override protected void onSubmit() { List maplist = null; - if(entityName.equalsIgnoreCase("account")){ - maplist = DAOImpl.searchAccount(userId, search_target, roleId); - }else if(entityName.equalsIgnoreCase("crmuser")){ - maplist = DAOImpl.searchCRMUser(search_target); + if(relationTableName.equalsIgnoreCase("account")){ + + String sql = assembleSearchingSQL(roleId, entity); + + switch (roleId) { + case 2: + maplist = DAOImpl.queryEntityRelationList(sql, posId, posId, posId); + break; + case 3: + maplist = DAOImpl.queryEntityRelationList(sql, posId, posId); + break; + case 1: + sql = "select * from ("+ sql + ") as bact where status=1 "; + maplist = DAOImpl.queryEntityRelationList(sql); + } + + + }else if(relationTableName.equalsIgnoreCase("contact")){ + + if (tragetEntity.equalsIgnoreCase("activity")) { + + String sql = assembleSearchingSQL(roleId, entity); + + switch (roleId) { + case 2:{ + maplist = DAOImpl.queryEntityRelationList(sql, posId, posId); + + break; + } + case 3:{ + maplist = DAOImpl.queryEntityRelationList(sql, posId); + + Entity activityEnt = entities.get("activity"); + String actSQL = activityEnt.getSql(); + actSQL = "select contactName,count(contactName) as ct from ("+ actSQL + ") as bact where status=2 group by contactName"; + logger.debug("number_of_act:"+actSQL); + + List num_of_act_per_contact = DAOImpl.queryEntityRelationList(actSQL, posId); + + Map activity_contact_map = Maps.newHashMap(); + for(Map map:num_of_act_per_contact){ + activity_contact_map.put(String.valueOf(map.get("contactName")),map); + } + + + // Map contact_map = Maps.newHashMap(); + for(Map map:maplist){ + String contactId = String.valueOf(map.get("id")); + if(activity_contact_map.containsKey(contactId)){ + map.put("num_of_visiting", activity_contact_map.get(contactId).get("ct")); + } + } + + //sorting + //Collections.s` + Collections.sort(maplist,new Comparator(){ + + @Override + public int compare(Map o1, Map o2) { + Object obj1 = o1.get("num_of_visiting"); + Object obj2 = o2.get("num_of_visiting"); + if(obj1 == null || obj2 == null) return 0; + + long v1 = (long)o1.get("num_of_visiting"); + long v2 = (long)o2.get("num_of_visiting"); + + return (int)(v2-v1); + + } + + }); + + + break; + } + case 1: + maplist = DAOImpl.queryEntityRelationList(sql); + + } + }else if (tragetEntity.equalsIgnoreCase("crmuser")) { + // maplist = DAOImpl.searchCRMUser(search_target); + maplist = DAOImpl.searchManager(search_target, excludeId); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + + } else if (tragetEntity.equalsIgnoreCase("userInfo")) { + // maplist = DAOImpl.searchCRMUser(search_target); + maplist = DAOImpl.searchCRMUser(search_target); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + + } else if (tragetEntity.equalsIgnoreCase("contact")) { + // maplist = DAOImpl.searchCRMUser(search_target); + maplist = DAOImpl.searchMergeContact(search_target); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + + } + } else if(relationTableName.equalsIgnoreCase("crmuser")){ + //maplist = DAOImpl.searchCRMUser(search_target); + if (tragetEntity.equalsIgnoreCase("crmuser")){ + maplist = DAOImpl.searchManager(search_target,excludeId); + }else if(tragetEntity.equalsIgnoreCase("coaching")||tragetEntity.equalsIgnoreCase("willcoaching")){ + String sql = assembleSearchingSQL(roleId, entity); + if(roleId==1){ + maplist = DAOImpl.queryEntityRelationList(sql); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + }else if(roleId == 2){ + + // sql = entity.getSqlManagerCoaching(); + sql = "select * from (select crmuser.id as id, crmuser.name as name, crmuser.code ,userinfo.name as userInfoName from crmuser,userinfo,user_position where crmuser.id=user_position.positionId" + + " and user_position.userId=userInfo.id and crmuser.reportto=?) as aquery"; + logger.debug("sql XXXXX:" + sql); + maplist = DAOImpl.queryEntityRelationList(sql,posId); + }else if(roleId == 3){ + maplist = DAOImpl.queryEntityRelationList(sql,posId); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + } + }else if(tragetEntity.equalsIgnoreCase("userInfo")){ + if(target.equalsIgnoreCase("-1")){ + maplist = DAOImpl.searchPositionCRMUser(search_target); + }else { + maplist = DAOImpl.searchCRMUser(search_target); + } + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + }else if(tragetEntity.equalsIgnoreCase("user_position")){ + + maplist = DAOImpl.searchPositionCRMUser(search_target); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + + } + }else if (relationTableName.equalsIgnoreCase("userinfo")) { + String sql = assembleSearchingSQL(roleId, entity); +// if(){ + maplist = DAOImpl.queryEntityRelationList(sql); +// } +// maplist = DAOImpl.queryEntityRelationList(sql,userId); + Map dummy = Maps.newHashMap(); + dummy.put("id", -1); + dummy.put("name", "无"); + maplist.add(dummy); + + }else if (relationTableName.equalsIgnoreCase("productline")) { + String sql = assembleSearchingSQL(roleId, entity); + maplist = DAOImpl.queryEntityRelationList(sql); + + }else if (relationTableName.equalsIgnoreCase("product")) { + String sql = assembleSearchingSQL(roleId, entity); + maplist = DAOImpl.queryEntityRelationList(sql); + + } + else if (relationTableName.equalsIgnoreCase("province")) { + String sql = assembleSearchingSQL(roleId, entity); + logger.debug("d;"+sql); + maplist = DAOImpl.queryEntityRelationList(sql); + + }else if(relationTableName.equalsIgnoreCase("alert")){ + String sql = "select * from alert"; + maplist = DAOImpl.queryEntityRelationList(sql); } - PageParameters parm = new PageParameters(); - parm.set("en", entityName); //this.setResponsePage(cls, parameters) - setResponsePage(new SelectEntryPage(maplist,entityName)); + + setResponsePage(new SelectEntryPage(maplist,relationTableName,tragetEntity,excludeId,target)); } }; form.add(new TextField("search_input", new PropertyModel(this, "search_target"))); add(form); - - RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); - add(dataRowRepeater); - - if (list != null) { - for (Map map : list) { + + + // RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); + // add(dataRowRepeater); + + final List searchableFields = entity.getSearchableFields(); + + //初始化的时候查不出数据 + if (list == null) { + list=DAOImpl.queryEntityRelationList("Select * from account where 1=0"); + } + + final Map tableData = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Map map : (List) list) { + String key = String.valueOf(map.get("id")); + ids.add(key); + tableData.put(key, map); + } + + + + + final PageableListView listview = new PageableListView("dataRowRepeater", ids, 20) { + + @Override + protected void populateItem(ListItem item) { + String key = item.getDefaultModelObjectAsString(); + Map map = tableData.get(key); int uid = ((Number) map.get("id")).intValue(); String name = (String) map.get("name"); - AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); - dataRowRepeater.add(item); - + item.add(new AttributeAppender("data-id",new Model(uid))); item.add(new AttributeAppender("data-name",new Model(name))); - item.add(new AttributeAppender("data-ename",entityName)); + item.add(new AttributeAppender("data-ename",relationTableName)); //item.add(new AttributeAppender("data-cname", new Model(cname))); Label cap = new Label("name_span", new Model(name)); item.add(cap); + RepeatingView column_repeater = new RepeatingView("column_repeater"); + item.add(column_repeater); + for(Field f:searchableFields){ + Object obj = map.get(f.getName()); + if(!f.getName().equalsIgnoreCase("name") && obj != null){ + AbstractItem column_item = new AbstractItem(column_repeater.newChildId()); + column_repeater.add(column_item); + + String celldata =String.valueOf(obj); + column_item.add(new Label("celldata",""+f.getDisplay()+": "+celldata).setEscapeModelStrings(false)); + } + } + + + + Object obj = map.get("num_of_visiting"); + if (obj != null) { + AbstractItem column_item = new AbstractItem(column_repeater.newChildId()); + column_repeater.add(column_item); + String num_of_visiting = String.valueOf(obj); + column_item.add(new Label("celldata", num_of_visiting + "(拜访次数)")); + } } + }; + + add(listview); + //PagingNavigator nav = new PagingNavigator("navigator", listview); + AjaxPagingNavigator nav =new AjaxPagingNavigator("navigator", listview); + nav.setOutputMarkupId(true); + + add(nav); + setVersioned(false); + + } + + private String assembleSearchingSQL(final int roleId, final Entity entity) { + String sql = entity.getSql(); + switch(roleId){ + case 1: + sql = entity.getSqlAdmin(); + break; + case 2: + sql = entity.getSqlManager(); + break; + case 3: + sql = entity.getSql(); + break; + } + + search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; + + List searchableFields = entity.getSearchableFields(); + String joint = " like '%"+search_target+"%'"; + String likequery = ""; + for(Field sf:searchableFields){ + likequery = likequery + " OR "+ sf.getName() + joint; + } + if(entity.getName().toString().equals("province")){ + sql = sql + " where val like '%"+search_target+"%' " + likequery ; + }else{ + sql = sql + " where name like '%"+search_target+"%' " + likequery ; } + return sql; } } diff --git a/crm/src/main/java/com/rex/crm/SelectPositionPage.html b/crm/src/main/java/com/rex/crm/SelectPositionPage.html new file mode 100644 index 0000000..314e368 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SelectPositionPage.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + 选择岗位 + + + + + + + + diff --git a/crm/src/main/java/com/rex/crm/SelectPositionPage.java b/crm/src/main/java/com/rex/crm/SelectPositionPage.java new file mode 100644 index 0000000..48e26c8 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SelectPositionPage.java @@ -0,0 +1,61 @@ +package com.rex.crm; + +import java.util.List; + +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.Model; + +import com.rex.crm.beans.CRMUser; +import com.rex.crm.beans.UserPosition; +import com.rex.crm.db.DAOImpl; + +public class SelectPositionPage extends WebPage{ + /** + * Constructor + */ + public SelectPositionPage(List list){ + //遍历数组,添加按钮 + RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); + AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); + dataRowRepeater.add(item); + RepeatingView columnRepeater = new RepeatingView("columnRepeater"); + SignIn2Session session = (SignIn2Session)getSession(); + for(UserPosition position:list){ + //根据岗位ID获取岗位名称 + CRMUser user = DAOImpl.getCRMUserInfoById(position.getPositionId()); + if(user.getPl1()==2){ + continue; + } + AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model()); + ButtonFragment btnFragment = new ButtonFragment("celldatafield","buttonFragment",this,user.getName(),String.valueOf(position.getPositionId()),user.getRole()); + columnitem.add(btnFragment); + columnRepeater.add(columnitem); + } + item.add(columnRepeater); + add(dataRowRepeater); + } + private class ButtonFragment extends Fragment { + + public ButtonFragment(String id, String markupId,MarkupContainer markupProvider,String value,final String positionId,final int roleId){ + super(id, markupId, markupProvider); + Link link = new Link("button"){ + @Override + public void onClick() { + SignIn2Session session = (SignIn2Session) getSession(); + session.setPositionId(positionId); + session.setRoleId(roleId); + setResponsePage(getApplication().getHomePage()); + } + }; + link.add(new Label("positionName",value)); + add(link); + } + } +} diff --git a/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.html b/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.html new file mode 100644 index 0000000..8ffa1ff --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.html @@ -0,0 +1,87 @@ + + + + + + + + + + + + +
+
+
+
+
您好,欢迎使用crm,进入系统之前您需要修改以下信息
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.java b/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.java new file mode 100644 index 0000000..178f93d --- /dev/null +++ b/crm/src/main/java/com/rex/crm/SettingKeyUserInfoPage.java @@ -0,0 +1,79 @@ +package com.rex.crm; + + +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.PasswordTextField; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; + +import com.google.common.collect.Maps; +import com.rex.crm.beans.UserInfo; +import com.rex.crm.beans.UserPosition; +import com.rex.crm.db.DAOImpl; + +public class SettingKeyUserInfoPage extends WebPage{ + private static final long serialVersionUID = -3798004593574047292L; + private static final Logger logger = Logger.getLogger(SettingKeyUserInfoPage.class); + final Map models = Maps.newHashMap(); + + public SettingKeyUserInfoPage(UserInfo userInfo){ + final int userId = userInfo.getId(); + final int numOfSign = userInfo.getNum_of_signIn(); + Form form = new Form("form"){ + @Override + protected void onSubmit() { + String phone = models.get("phone").getObject() == null ? null : String.valueOf(models.get("phone").getObject()); + String email = models.get("email").getObject() == null ? null : String.valueOf(models.get("email").getObject()); + String password = models.get("newPassword").getObject() == null ? null : String.valueOf(models.get("newPassword").getObject()); + //修改用户关键信息,并增加登录次数 + if(DAOImpl.updateKeyUserInfoMessage(phone, email, password,userId)){ + List positions = DAOImpl.getPositionsByUserId(userId); + if(positions.size()>1){ + setResponsePage(new SelectPositionPage(positions)); + }else { + setResponsePage(getApplication().getHomePage()); + } + DAOImpl.addSignInNumber(userId,numOfSign+1); + } + } + }; + //根据id获取对象 + //Userinfo + Model textModel = new Model(""); + TextField phone = new TextField("phone", textModel); + phone.add(new AttributeAppender("class","required-field")); + phone.add(new AttributeModifier("pattern", new Model("^((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)"))); + models.put("phone",textModel); + Model emailModel = new Model(""); + TextField email = new TextField("email", emailModel); + email.add(new AttributeAppender("class","required-field")); + email.add(new AttributeModifier("type", new Model("email"))); + models.put("email", emailModel); + IModel newPasswordModel = new Model(""); + PasswordTextField newPassword = new PasswordTextField("newPassword", newPasswordModel); + newPassword.add(new AttributeAppender("value", "")); + newPassword.add(new AttributeAppender("class","required-field")); + models.put("newPassword", newPasswordModel); + IModel checkNewPasswordModel = new Model(""); + PasswordTextField checkPassword = new PasswordTextField("checkNewPassword", checkNewPasswordModel); + checkPassword.add(new AttributeAppender("value", "")); + checkPassword.add(new AttributeAppender("class","required-field")); + models.put("checkNewPassword", checkNewPasswordModel); + form.add(new Label("userName",userInfo.getName())); + form.add(phone); + form.add(email); + form.add(newPassword); + form.add(checkPassword); + add(form); + } + +} diff --git a/crm/src/main/java/com/rex/crm/SignIn.html b/crm/src/main/java/com/rex/crm/SignIn.html index 6dbdc03..9d84ed4 100755 --- a/crm/src/main/java/com/rex/crm/SignIn.html +++ b/crm/src/main/java/com/rex/crm/SignIn.html @@ -12,8 +12,10 @@ + + - +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/UserDeatialInfo.java b/crm/src/main/java/com/rex/crm/UserDeatialInfo.java index 03ef799..04c80c6 100644 --- a/crm/src/main/java/com/rex/crm/UserDeatialInfo.java +++ b/crm/src/main/java/com/rex/crm/UserDeatialInfo.java @@ -1,244 +1,279 @@ package com.rex.crm; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.MarkupContainer; import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.form.upload.FileUpload; -import org.apache.wicket.markup.html.form.upload.FileUploadField; -import org.apache.wicket.markup.html.image.Image; import org.apache.wicket.markup.html.list.AbstractItem; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.util.file.File; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.rex.crm.beans.CRMUser; import com.rex.crm.beans.Choice; +import com.rex.crm.beans.UserInfo; import com.rex.crm.common.Entity; -import com.rex.crm.common.EntityDetailPage; import com.rex.crm.common.Field; import com.rex.crm.db.DAOImpl; import com.rex.crm.util.CRMUtility; import com.rex.crm.util.Configuration; -public class UserDeatialInfo extends TemplatePage{ - private static final long serialVersionUID = 7459440666591284026L; - private static final Logger logger = Logger.getLogger(UserDeatialInfo.class); - final Map fieldNameToModel = Maps.newHashMap(); - final Map models = Maps.newHashMap(); - //设置显示行数 - private int number_of_column = 1; - /** - * Contract - */ - public UserDeatialInfo() { - logger.debug("init userManager"); - add(new Label("infoName","基本信息")); - initPage(); - } - private void initPage(){ - logger.debug("sessionID:"+((SignIn2Session)getSession()).getUserId()); - int userId =Integer.parseInt(((SignIn2Session)getSession()).getUserId()); - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("crmuser"); +public class UserDeatialInfo extends UserInfoSettingPage { + + private static final long serialVersionUID = 7459440666591284026L; + private static final Logger logger = Logger.getLogger(UserDeatialInfo.class); + final Map fieldNameToModel = Maps.newHashMap(); + final Map models = Maps.newHashMap(); + //设置显示行数 + private int number_of_column = 1; + + /** + * Contract + */ + public UserDeatialInfo() { + logger.debug("init userManager"); + setPageTitle("个人信息"); + initPage(""); + } + public UserDeatialInfo(String result){ + logger.debug("init userManager"); + setPageTitle("个人信息"); + initPage(result); + } + private void initPage(String result) { + logger.debug("sessionID:" + ((SignIn2Session) getSession()).getUserId()); + int userId = Integer.parseInt(((SignIn2Session) getSession()).getUserId()); + Entity entity = Configuration.getEntityByName("userinfo"); String primaryKeyName = entity.getPrimaryKeyName(); - //get crmUser - CRMUser user = DAOImpl.getCRMUserInfoById(userId); - - //add and setting image and image style - /*if(null==user.getPhoto()){ - Image image = new Image("userphoto","src/main/webapp/image/userDefaultImg.jpg"); - } - WebMarkupContainer image = new WebMarkupContainer("userphoto"); - image.add(new AttributeAppender("src","http://localhost:8080/crm/image/1.jpeg")); - //image.add(new AttributeAppender("src","http://localhost:8080/crm/"+user.getPhoto())); - add(image); - RepeatingView divRepeater = new RepeatingView("userRealtionInfo"); - add(divRepeater);*/ - final List fieldNames = Lists.newArrayList(); - //得到基本信息信息 - RepeatingView fieldGroupRepeater = new RepeatingView("fieldGroupRepeater"); - add(fieldGroupRepeater); - List groupfields = new ArrayList(); - List fields = entity.getFields(); - for (Field f : fields) { - if (f.isBaseInfo()==true) { - groupfields.add(f); - } - } - AbstractItem groupitem = new AbstractItem(fieldGroupRepeater.newChildId()); - fieldGroupRepeater.add(groupitem); - RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); - groupitem.add(dataRowRepeater); - int numOfField = 0; - List visibleFields = Lists.newArrayList(); - for (Field f : groupfields) { - if (!f.isVisible() ) - continue; - numOfField++; - visibleFields.add(f); - } - logger.debug("numOfField:"+numOfField); - int num_of_row = (numOfField / number_of_column) ; - for (int i = 0; i pickList = DAOImpl.queryPickList(currentField.getPicklist()); - Map list = Maps.newHashMap(); - List ids = Lists.newArrayList(); - for (Choice p : pickList) { - list.put(p.getId(), p.getVal()); - ids.add(p.getId()); - } - IModel choiceModel = new Model(Long.parseLong(""+user.getSex())); - models.put(currentField.getName(), choiceModel); - fieldNameToModel.put(currentField.getName(), choiceModel); - columnitem.add(new DropDownChoiceFragment("editdata", "dropDownFragment", this, ids,list, choiceModel)); - }else{ - IModel textModel = new Model(""); - models.put(CRMUtility.formatValue(currentField.getFormatter(),String.valueOf(fieldName)),textModel); - fieldNameToModel.put(currentField.getName(), textModel); - columnitem.add(new TextInputFragment("editdata","textInputFragment", this, textModel,fieldName,currentField)); - columnitem.add(new AttributeAppender("style",new Model("text-align:left;"),";")); - } - logger.debug("fieldName:"+fieldName); - logger.debug("userName:"+user.getName()); - } - columnRepeater.add(columnitem); - } - } - //add user photo - /*final FileUploadField fileUploadField =new FileUploadField("image"); - Form imgForm = new Form("imgForm"){ - @Override - protected void onSubmit() { - final FileUpload upload = fileUploadField.getFileUpload(); - if(upload !=null){ - try { - upload.writeTo(new File("")); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - }; - imgForm.add(fileUploadField); - imgForm.setMultiPart(true); - add(imgForm);*/ - //create edit userForm - Form form = new Form("form") { - @Override - protected void onSubmit() { - logger.debug("the form was submitted!"); - String userName = ""; - String cellPhone = ""; - String email = ""; - String photo = ""; - int sex = 0; - for (String k : fieldNameToModel.keySet()) { - logger.debug("k"+k); - String value = fieldNameToModel.get(k).getObject() == null? null:String.valueOf(fieldNameToModel.get(k).getObject()); - if(k.equals("name")){ - userName = value; - }else if(k.equals("cellPhone")){ - cellPhone = value; - }else if(k.equals("photo")){ - photo = value; - }else if(k.equals("sex")){ - sex = Integer.parseInt(value); - }else{ - email = value; - } - } - - int userId =Integer.parseInt(((SignIn2Session)getSession()).getUserId()); - DAOImpl.updateStatusOfInternalMeeting(userId,userName,cellPhone,email,photo); - setResponsePage(HomePage.class); - } - }; - form.add(fieldGroupRepeater); - add(form); - add(new Label("successFlag","恭喜您!操作成功!")); - add(new AttributeAppender("style",new Model("dispaly:block;"),";")); - } - - private class TextInputFragment extends Fragment { - public TextInputFragment(String id, String markupId, - MarkupContainer markupProvider, IModel model,String value,Field currentField) { - super(id, markupId, markupProvider); - TextField text = new TextField("input", model); - text.add(new AttributeAppender("value", new Model(value), ";")); - if(!currentField.isEditable()){text.add(new AttributeAppender("disabled",new Model("disabled"),";"));} - add(text); - } - } - - private class TextFragment extends Fragment { - public TextFragment(String id, String markupId, - MarkupContainer markupProvider, String label) { - super(id, markupId, markupProvider); - add(new Label("celldata", label)); - } - } - - private class DropDownChoiceFragment extends Fragment { - public DropDownChoiceFragment(String id, String markupId, - MarkupContainer markupProvider, final List ids, - final Map list, IModel model) { - super(id, markupId, markupProvider); - add(new DropDownChoice("dropDownInput", model, ids, - new IChoiceRenderer() { - @Override - public Object getDisplayValue(Long id) { - // TODO Auto-generated method stub - return list.get(id); - } + //get crmUser + UserInfo user = DAOImpl.getUserInfoById(userId); + //add prompt + final RepeatingView div = new RepeatingView("promptDiv"); + final AbstractItem group = new AbstractItem(div.newChildId()); + final Label promptButton = new Label("promptButton","X"); + group.add(promptButton); + final Label promptLabel = new Label("prompt","提示:操作已成功!"); + group.add(promptLabel); + if("".equals(result)||"failure".equals(result)){ + div.add(new AttributeAppender("style",new Model("display:none"),";")); + group.add(new AttributeAppender("style",new Model("display:none"),";")); + } + div.add(group); + add(div); + //add prompt + final RepeatingView errordiv = new RepeatingView("alertDiv"); + final AbstractItem errorgroup = new AbstractItem(div.newChildId()); + final Label errorpromptButton = new Label("alertButton","X"); + errorgroup.add(errorpromptButton); + final Label errorpromptLabel = new Label("alert","提示:用户登录名已存在!"); + errorgroup.add(errorpromptLabel); + if("".equals(result)||"success".equals(result)){ + errordiv.add(new AttributeAppender("style",new Model("display:none"),";")); + errorgroup.add(new AttributeAppender("style",new Model("display:none"),";")); + } + errordiv.add(errorgroup); + add(errordiv); + final List fieldNames = Lists.newArrayList(); + //得到基本信息信息 + RepeatingView fieldGroupRepeater = new RepeatingView("fieldGroupRepeater"); + add(fieldGroupRepeater); + List groupfields = new ArrayList(); + List fields = entity.getFields(); + for (Field f : fields) { + if (f.isBaseInfo() == true) { + groupfields.add(f); + } + } + AbstractItem groupitem = new AbstractItem(fieldGroupRepeater.newChildId()); + fieldGroupRepeater.add(groupitem); + RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); + groupitem.add(dataRowRepeater); + int numOfField = 0; + List visibleFields = Lists.newArrayList(); + for (Field f : groupfields) { + if (!f.isVisible()) { + continue; + } + numOfField++; + visibleFields.add(f); + } + logger.debug("numOfField:" + numOfField); + int num_of_row = (numOfField / number_of_column); + for (int i = 0; i < num_of_row; i++) { + AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); + dataRowRepeater.add(item); + //添加了一行 + RepeatingView columnRepeater = new RepeatingView("columnRepeater"); + item.add(columnRepeater); + //行内添加两列元素 + for (int j = 0; j < 2 * number_of_column; j++) { + AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model(String.valueOf(primaryKeyName))); + Field currentField = visibleFields.get(i * number_of_column + j / 2); + if (j % 2 == 0) { + columnitem.add(new TextFragment("editdata", "textFragment", this, currentField.getDisplay() + ":")); + if (currentField.isRequired()) { + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")).add(new AttributeAppender("style", new Model("color:red"), ";")); + }else{ + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); + } + fieldNames.add(currentField.getName()); + } else { + String fieldName = null; + if (currentField.getName().equals("name")) { + fieldName = user.getName(); + } else if (currentField.getName().equalsIgnoreCase("cellPhone")) { + fieldName = user.getCellPhone(); + } else if (currentField.getName().equals("loginName")) { + fieldName = user.getLoginName(); + } else if (currentField.getName().equals("sex")) { + fieldName = "" + user.getSex(); + } else if (currentField.getName().equals("office_tel")){ + fieldName = "" + user.getOffice_tel(); + }else { + fieldName = user.getEmail(); + } + if (currentField.getName().equals("sex")) { + List pickList = DAOImpl.queryPickList(currentField.getPicklist()); + Map list = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Choice p : pickList) { + list.put(p.getId(), p.getVal()); + ids.add(p.getId()); + } + IModel choiceModel = new Model(Long.parseLong("" + user.getSex())); + models.put(currentField.getName(), choiceModel); + fieldNameToModel.put(currentField.getName(), choiceModel); + columnitem.add(new DropDownChoiceFragment("editdata", "dropDownFragment", this, ids, list, choiceModel)); + } else { + IModel textModel = new Model(""); + models.put(CRMUtility.formatValue(currentField.getFormatter(), String.valueOf(fieldName)), textModel); + fieldNameToModel.put(currentField.getName(), textModel); + columnitem.add(new TextInputFragment("editdata", "textInputFragment", this, textModel, fieldName, currentField)); + } + } + columnRepeater.add(columnitem); + } + } + //add user photo + //create edit userForm + + Form form = new Form("form") { + @Override + protected void onSubmit() { + logger.debug("the form was submitted!"); + String userName = ""; + String cellPhone = ""; + String email = ""; + String photo = ""; + String loginName = ""; + String office = ""; + int sex = 0; + for (String k : fieldNameToModel.keySet()) { + logger.debug("k" + k); + String value = fieldNameToModel.get(k).getObject() == null ? null : String.valueOf(fieldNameToModel.get(k).getObject()); + if (k.equals("name")) { + userName = value; + } else if (k.equals("cellPhone")) { + cellPhone = value; + } else if (k.equals("photo")) { + photo = value; + } else if (k.equals("sex")) { + sex = Integer.parseInt(value); + } else if (k.equals("loginName")) { + loginName = value; + } else if(k.equals("email")){ + email = value; + }else if(k.equals("office_tel")){ + office = value; + } + } + int userId = Integer.parseInt(((SignIn2Session) getSession()).getUserId()); + UserInfo userinfo = DAOImpl.getUserInfoById(userId); + List loginNames =DAOImpl.getLoginNames(String.valueOf(userId)); + if(loginNames.contains(loginName)){ + errordiv.add(new AttributeAppender("style",new Model("display:block"),";")); + errorgroup.add(new AttributeAppender("style",new Model("display:block"),";")); + errorpromptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + errorpromptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + setResponsePage(new UserDeatialInfo("failure")); + }else{ + if(DAOImpl.updateStatusOfInternalMeeting(userId, userName, cellPhone, email, photo, sex, loginName,office)){ + div.add(new AttributeAppender("style",new Model("display:block"),";")); + group.add(new AttributeAppender("style",new Model("display:block"),";")); + promptLabel.add(new AttributeAppender("style",new Model("display:block"),";")); + promptButton.add(new AttributeAppender("style",new Model("display:block"),";")); + setResponsePage(new UserDeatialInfo("success")); + }; + } + } + }; + form.add(fieldGroupRepeater); + add(form); + } + + private class TextInputFragment extends Fragment { + + public TextInputFragment(String id, String markupId, + MarkupContainer markupProvider, IModel model, String value, Field currentField) { + super(id, markupId, markupProvider); + TextField text = new TextField("input", model); + text.add(new AttributeModifier("value", new Model(value))); + if (!currentField.isEditable()) { + text.add(new AttributeAppender("disabled", new Model("disabled"), ";")); + } + if (currentField.isRequired()) { + //text.add(new AttributeModifier("required", new Model("required"))); + text.add(new AttributeAppender("class",new Model("required-field")," ")); + } + if (currentField.getDataType().equals("tel") || currentField.getDataType().equals("fax")) { + text.add(new AttributeModifier("pattern", new Model("^((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)"))); + } + text.add(new AttributeModifier("type", new Model(currentField.getDataType()))); + text.add(new AttributeModifier("id", new Model(currentField.getName()))); + add(text); + } + } + + private class TextFragment extends Fragment { + + public TextFragment(String id, String markupId, + MarkupContainer markupProvider, String label) { + super(id, markupId, markupProvider); + add(new Label("celldata", label)); + } + } + + private class DropDownChoiceFragment extends Fragment { + + public DropDownChoiceFragment(String id, String markupId, + MarkupContainer markupProvider, final List ids, + final Map list, IModel model) { + super(id, markupId, markupProvider); + add(new DropDownChoice("dropDownInput", model, ids, + new IChoiceRenderer() { + @Override + public Object getDisplayValue(Long id) { + // TODO Auto-generated method stub + return list.get(id); + } - @Override - public String getIdValue(Long id, int index) { - return String.valueOf(id); - } - })); - } - } + @Override + public String getIdValue(Long id, int index) { + return String.valueOf(id); + } + })); + } + } } diff --git a/crm/src/main/java/com/rex/crm/UserInfoSettingPage.html b/crm/src/main/java/com/rex/crm/UserInfoSettingPage.html new file mode 100644 index 0000000..20f30f8 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/UserInfoSettingPage.html @@ -0,0 +1,26 @@ + + + + + +
+
+
+ +
+
+ +
+
+
+
+ + diff --git a/crm/src/main/java/com/rex/crm/UserInfoSettingPage.java b/crm/src/main/java/com/rex/crm/UserInfoSettingPage.java new file mode 100644 index 0000000..2059ee4 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/UserInfoSettingPage.java @@ -0,0 +1,65 @@ +package com.rex.crm; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.Model; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +/** + * + * @author brenda.yuan + * + */ +public class UserInfoSettingPage extends TemplatePage{ + + private static final long serialVersionUID = 1L; + protected static ImmutableMap pageMenuMap; + static{ + //TODO Load them from configuration + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + + MenuItem item = new MenuItem(); + item.setCaption("个人信息"); + item.setDestination(UserDeatialInfo.class); + item.setId("navitem-userdetailInfo"); + builder.put("userDetailInfo", item); + + item = new MenuItem(); + item.setCaption("修改密码"); + item.setDestination(UpdateSignPassword.class); + item.setId("navitem-updateSignPassword"); + builder.put("updateSignPassword", item); + + pageMenuMap = builder.build(); + } + public UserInfoSettingPage(){ + setPageTitle("账号管理"); + List menulist = Lists.newArrayList(); + menulist.add("userDetailInfo"); + menulist.add("updateSignPassword"); + ArrayList menu = Lists.newArrayList(); + for(String key:menulist){ + menu.add(pageMenuMap.get(key)); + } + ListView lv = new ListView("userMenu", menu) { + @Override + protected void populateItem(ListItem item) { + MenuItem menuitem = (MenuItem) item.getModelObject(); + BookmarkablePageLink link = new BookmarkablePageLink("link", menuitem.getDestination()); + link.add(new Label("caption", menuitem.getCaption()).setEscapeModelStrings(false)); + item.add(link); + item.add(new AttributeAppender("id", Model.of(menuitem.getId()))); + // item.add(new SimpleAttributeModifier("class", "my-css-class")); + + } + }; + add(lv); + } +} diff --git a/crm/src/main/java/com/rex/crm/UserPage.html b/crm/src/main/java/com/rex/crm/UserPage.html deleted file mode 100755 index 3633813..0000000 --- a/crm/src/main/java/com/rex/crm/UserPage.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -
-
- -
- data table -
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/UserPage.java b/crm/src/main/java/com/rex/crm/UserPage.java deleted file mode 100644 index 76ee5d4..0000000 --- a/crm/src/main/java/com/rex/crm/UserPage.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.rex.crm; - -import java.util.List; -import java.util.Map; - -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.model.PropertyModel; - -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.Entity; -import com.rex.crm.common.Field; -import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.TableDataPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.Configuration; - - -/** - * @author Feiyun Zhou - */ -public class UserPage extends TemplatePage -{ - private String search_target = ""; - /** - * Constructor - */ - public UserPage(){ - initPage(null); - } - - public UserPage(List tdata){ - initPage(tdata); - } - public void initPage(List tdata) - { - Map entities = Configuration.getEntityTable(); - final Entity entity = entities.get("crmuser"); - setPageTitle(entity.getDisplay()); - - Form form = new Form("form"){ - - @Override - protected void onSubmit() { - String sql = entity.getSql(); - - - search_target = (search_target==null || search_target.equalsIgnoreCase("*"))? "":search_target; - - //sql = sql + " AND name like '%"+search_target+"%'"; - List searchableFields = entity.getSearchableFields(); - String joint = " like '%"+search_target+"%'"; - String likequery = ""; - for(Field sf:searchableFields){ - likequery = likequery + " OR "+ sf.getName() + joint; - } - - sql = sql + " where name like '%"+search_target+"%' " + likequery; - System.out.println(sql); - List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); - setResponsePage(new UserPage(datalist)); - - } - - }; - add(form); - - TextField search_input = new TextField("search_input", new PropertyModel(this,"search_target")); - form.add(search_input); - - - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - if( tdata == null || tdata.size() == 0){ - tdata = DAOImpl.queryEntityRelationList(entity.getSql(), "dummy"); - } - add(new PageableTablePanel("datalist",entity,tdata)); - - } -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/WicketApplication.java b/crm/src/main/java/com/rex/crm/WicketApplication.java index 66c2167..89c32ca 100644 --- a/crm/src/main/java/com/rex/crm/WicketApplication.java +++ b/crm/src/main/java/com/rex/crm/WicketApplication.java @@ -1,9 +1,14 @@ package com.rex.crm; -import javax.servlet.ServletContext; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.apache.wicket.Component; import org.apache.wicket.RestartResponseAtInterceptPageException; +import org.apache.wicket.RuntimeConfigurationType; import org.apache.wicket.Session; import org.apache.wicket.authorization.Action; import org.apache.wicket.authorization.IAuthorizationStrategy; @@ -15,7 +20,11 @@ import org.apache.wicket.request.resource.SharedResourceReference; import org.apache.wicket.util.file.File; -import com.rex.crm.FolderResource; +import com.rex.crm.admin.AdminTreePage; +import com.rex.crm.common.CreateDataPage; +import com.rex.crm.common.EditDataPage; +import com.rex.crm.common.EntityDetailPage; +import com.rex.crm.util.CRMUtility; /** * Application object for your web application. If you want to run this application without deploying, run the Start class. @@ -24,7 +33,16 @@ */ public class WicketApplication extends WebApplication { - /** + + + + @Override + public RuntimeConfigurationType getConfigurationType() { + // TODO Auto-generated method stub + return RuntimeConfigurationType.DEPLOYMENT; + } + + /** * @see org.apache.wicket.Application#getHomePage() */ @Override @@ -57,6 +75,12 @@ public void init() mountPage("/mount/eventViewer",EventViewerPage.class); mountPage("/mount/searchCRMUser", SearchCRMUserPage.class); mountPage("/mount/ActivitedUser", ActivitedUser.class); + mountPage("/mount/CreateDataPage", CreateDataPage.class); + mountPage("/mount/ActivitySelectPage",ActivitySelectPage.class); + mountPage("/mount/EntityDetailPage",EntityDetailPage.class); + mountPage("/mount/AdminTreePage",AdminTreePage.class); + mountPage("/mount/AccountPage",AccountPage.class); + // Register the authorization strategy getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() { @@ -90,7 +114,18 @@ public boolean isInstantiationAuthorized( } }); + + + } - + @Override + protected void onDestroy() { + CRMUtility.getThreadPoolExecutor().shutdown(); + super.onDestroy(); + } + + + + } diff --git a/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java b/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java deleted file mode 100644 index e768c0c..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.rex.crm.account; - -import java.util.Iterator; -import java.util.List; - -import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; -import org.apache.wicket.model.IModel; - -import com.rex.crm.beans.Account; -import com.rex.crm.db.DAOImpl; - -public class AccountDataProvider extends SortableDataProvider { - - private int userId; - public AccountDataProvider(int userId){ - this.userId = userId; - } - - @Override - public Iterator iterator(long first, long count) { - // TODO Auto-generated method stub - List list = DAOImpl.getAccountsByUserId(userId); - return list.iterator(); - } - - @Override - public long size() { - return DAOImpl.getSizeOfAccountByUserId(userId); - } - - @Override - public IModel model(Account object) { - return new DetachableAccountModel(object); - } - -} diff --git a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html b/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html deleted file mode 100755 index 79becfb..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -
-
-
- [operation bar] -
-
-
    -
  • -
- - -
-
- [operation bar] -
-
- - - - - - - - - - - - - - - - - - -
姓名电话部门职位邮箱
-
-
-
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java b/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java deleted file mode 100644 index 29c1a8c..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.rex.crm.account; - -import java.lang.reflect.InvocationTargetException; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.RepeatingView; -import org.apache.wicket.markup.repeater.data.DataView; - -import com.rex.crm.TemplatePage; -import com.rex.crm.beans.Account; -import com.rex.crm.beans.CRMUser; -import com.rex.crm.common.CRUDPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.user.CRMUserDataProvider; - -/** - * @author Feiyun Zhou - */ -public class AccountDetailPage extends TemplatePage { - - public AccountDetailPage(String accountId){ - Account account = DAOImpl.getAccountById(Integer.parseInt(accountId)); - initPage(account); - } - - public AccountDetailPage(Account account) { - setPageTitle("客户"); - initPage(account); - } - - private void initPage(Account account){ - //TODO Get permission infor of user from database. - add(new CRUDPanel("operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.DEL,CRUDPanel.Permissions.EDIT))); - - List filedsName = account.getFieldNames(); - Map fieldMap = account.getMappingOfField2ColumnName(); - - RepeatingView rv = new RepeatingView("entityDetail"); - add(rv); - - for (String name : filedsName) { - if (fieldMap.get(name) != null) { - WebMarkupContainer item = new WebMarkupContainer(rv.newChildId()); - rv.add(item); - Label label = null; - try { - label = new Label("caption", fieldMap.get(name) + ": " + BeanUtils.getProperty(account, name)); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - item.add(label); - } - } - - - - DataView dataView = new DataView("team-pageable", new CRMUserDataProvider(account.getId())) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - CRMUser user = item.getModelObject(); - item.add(new Label("name", user.getName())); - item.add(new Label("cellphone", user.getCellPhone())); - item.add(new Label("division", user.getDivision())); - item.add(new Label("jobtitle", user.getJobTitle())); - item.add(new Label("email", user.getEmail())); - - } - - - }; - dataView.setItemsPerPage(10000L); - add(dataView); - - //TODO Get permission info of user from database. - add(new CRUDPanel("team-operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.ADD))); - - } -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html b/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html deleted file mode 100755 index 7a34b2f..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel.html b/crm/src/main/java/com/rex/crm/account/AccountListPanel.html deleted file mode 100644 index a67f147..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel.html +++ /dev/null @@ -1,41 +0,0 @@ - -
-
- [operation bar] -
-
- - - - - - - - - - - - - - - - -
名称地址电话级别
-
-
- - - -
\ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel.java b/crm/src/main/java/com/rex/crm/account/AccountListPanel.java deleted file mode 100644 index 2e4bc17..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.rex.crm.account; - -import java.util.EnumSet; - -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.data.DataView; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; - -import com.rex.crm.beans.Account; -import com.rex.crm.common.CRUDPanel; - -public class AccountListPanel extends Panel { - private static final long serialVersionUID = 2501105233172820074L; - - public AccountListPanel(String id) { - super(id); - - DataView dataView = new DataView("pageable", new AccountDataProvider(20)) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - Account account = item.getModelObject(); - item.add(new ActionPanel("name",item.getModel(),account.getName())); - item.add(new Label("address", account.getAddress())); - item.add(new Label("tele", account.getTele())); - item.add(new Label("classification", account.getClassification())); - } - }; - dataView.setItemsPerPage(10000L); - add(dataView); - - //TODO Get permission info of user from database. - add(new CRUDPanel("operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.DEL,CRUDPanel.Permissions.ADD,CRUDPanel.Permissions.EDIT))); - - } - - public AccountListPanel(String id, IModel model) { - super(id, model); - } - - class ActionPanel extends Panel - { - /** - * @param id - * component id - * @param model - * model for contact - */ - public ActionPanel(String id, IModel model,String name) - { - super(id, model); - add(new Link("select") - { - - @Override - public void onClick() - { - Account selected = (Account)getParent().getDefaultModelObject(); - setResponsePage(new AccountDetailPage(selected)); - } - }.add(new Label("label", new Model(name))) - ); - } - } - -} diff --git a/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java b/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java deleted file mode 100755 index 3c16572..0000000 --- a/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.rex.crm.account; - -import org.apache.wicket.model.LoadableDetachableModel; - -import com.rex.crm.beans.Account; -import com.rex.crm.db.DAOImpl; - -/** - * detachable model for an instance of contact - * - * @author igor - * - */ -public class DetachableAccountModel extends LoadableDetachableModel -{ - private final int id; - - - /** - * @param c - */ - public DetachableAccountModel(Account a) - { - this(a.getId()); - } - - /** - * @param id - */ - public DetachableAccountModel(int id) - { - if (id == 0) - { - throw new IllegalArgumentException(); - } - this.id = id; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - return Long.valueOf(id).hashCode(); - } - - /** - * used for dataview with ReuseIfModelsEqualStrategy item reuse strategy - * - * @see org.apache.wicket.markup.repeater.ReuseIfModelsEqualStrategy - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) - { - if (obj == this) - { - return true; - } - else if (obj == null) - { - return false; - } - else if (obj instanceof DetachableAccountModel) - { - DetachableAccountModel other = (DetachableAccountModel)obj; - return other.id == id; - } - return false; - } - - /** - * @see org.apache.wicket.model.LoadableDetachableModel#load() - */ - @Override - protected Account load() - { - return DAOImpl.getAccountById(id); - } -} diff --git a/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.html b/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.html new file mode 100755 index 0000000..c9c9b88 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.html @@ -0,0 +1,28 @@ + + + + + +
+ + + +
+
+ +
+
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.java b/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.java new file mode 100644 index 0000000..691d7bd --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/AdminTemplatePage.java @@ -0,0 +1,46 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.base.Joiner; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.rex.crm.TemplatePage; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; + +/** + * @author Feiyun Zhou + */ +public class AdminTemplatePage extends TemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public AdminTemplatePage() + { + this.setPageTitle("系统管理"); + } + +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/AdminTreePage.html b/crm/src/main/java/com/rex/crm/admin/AdminTreePage.html new file mode 100755 index 0000000..6846780 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/AdminTreePage.html @@ -0,0 +1,45 @@ + + + + + + +
+
+
+
岗位树 +
+
+
+
+ +
+
+
+
+ data table +
+
+
+
+ +
+
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/AdminTreePage.java b/crm/src/main/java/com/rex/crm/admin/AdminTreePage.java new file mode 100644 index 0000000..9e4a62b --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/AdminTreePage.java @@ -0,0 +1,111 @@ +package com.rex.crm.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.html.panel.EmptyPanel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; +import org.apache.wicket.util.template.PackageTextTemplate; + +import com.google.gson.Gson; +import com.rex.crm.common.AccountPositionPanel; +import com.rex.crm.common.Entity; +import com.rex.crm.common.EntityDetailContainerPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.tree.Node; +import com.rex.crm.common.tree.TreeFactory; +import com.rex.crm.common.tree.TreePanel; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; + +/** + * @author Feiyun Zhou + */ +public class AdminTreePage extends AdminTemplatePage +{ + + private String search_target = ""; + + /** + * Constructor + */ + public AdminTreePage() + { + setPageTitle("系统管理-岗位树"); + StringValue positionId = getRequest().getRequestParameters().getParameterValue("positionId"); + if (positionId.isEmpty() || positionId.isNull()) + { + initPage(null); + } + else + { + initPage(positionId.toString()); + } + + urlFor(AdminTreePage.class, null); + + } + + public AdminTreePage(String reportto) { + setPageTitle("系统管理-岗位树"); + initPage(reportto); + urlFor(AdminTreePage.class, null); + + } + + private void initPage(final String positionId) + { + Gson gson = new Gson(); + String result = gson.toJson(TreeFactory.createPositionTree(), Node.class); + add(new TreePanel("treePanel", result)); + Map entities = Configuration.getEntityTable(); + if (positionId != null) + { + if (positionId.equals("-1")) + { + List tdata = DAOImpl.queryEntityRelationList("select * from user_position_query"); + add(new PageableTablePanel("datalist", entities.get("user_position_query"), tdata, null)); + + }else{ + PageParameters pp = new PageParameters(); + pp.add("positionId", positionId); + EntityDetailContainerPanel panel = new EntityDetailContainerPanel("datalist", "crmuser", positionId, this.getClass(), pp); + add(panel); + } + } + else + { + add(new EmptyPanel("datalist")); + } + } + + @Override + public void renderHead(IHeaderResponse response) + { + super.renderHead(response); + StringValue act_key = getRequest().getRequestParameters().getParameterValue("positionId"); + Map map = new HashMap<>(); + + map.put("act_key", act_key.toString()); + PackageTextTemplate ptt = new PackageTextTemplate(getClass(), "adminpage.js"); + //OnDomReadyHeaderItem onDomReadyHeaderItem = OnDomReadyHeaderItem.forScript( ptt.asString( map ) ); + //response.render(onDomReadyHeaderItem); + System.out.println(ptt.asString(map)); + response.render(JavaScriptHeaderItem.forScript(ptt.asString(map), null)); + + try + { + ptt.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + +} diff --git a/crm/src/main/java/com/rex/crm/admin/DataImportPage.html b/crm/src/main/java/com/rex/crm/admin/DataImportPage.html new file mode 100644 index 0000000..d73e704 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/DataImportPage.html @@ -0,0 +1,64 @@ + + + + + +
+
+
+ + +

+ +

+    + 查看日志 +

+ +
+
+
+
+ +

模板

+ +

+

注意事项

+
导入顺序
+

数据导入功能主要用于系统数据的初始化,以及大批量数据的更改与调整;在数据初始化时候,数据初始化的顺序一次为

+
    +
  1. 岗位信息、医院信息、用户信息
  2. +
  3. 医生信息、岗位汇报关系、岗位与用户的对应关系、医院与岗位对应关系
  4. +
+
导入逻辑
+
    +
  1. 医院信息导入:以BDM编码为标识,通过BDM编码进行新增与更新操作
  2. +
  3. 岗位信息导入:以岗位编码为标识,通过岗位编码进行新增与更新操作
  4. +
  5. 用户信息导入:以用户员工号为标识,通过员工号进行新增与更新操作
  6. +
  7. 医生信息导入:以医生CRM编码为标识,通过CRM编码进行新增与更新操作,在导入医生的时候,如果指定了医院的BDM编码,那么医生与医院的对应关系也 将被导入;如果在医生导入的CSV文件中,没有BDM编码,那么这条医生记录将不会被导入到系统中
  8. + +
  9. 岗位汇报关系导入:以岗位编码为标识,通过岗位编码进行更新岗位的汇报关 系,前提必要条件是所有的岗位信息必须存在
  10. +
  11. 岗位与用户的对应关系导入:按照岗位编码为标识,通过岗位编码进行新增与 更新操作,目前不保留岗位与用户对应信息的历史;未来系统将支持岗位与用户对 应关 系历史
  12. +
  13. 医院与岗位对应关系导入:以岗位编码与BDM编码联合为标识,进行新增操作, 目前只支持全量的导入,既在导入过程中,系统将删除所有的岗位与医院对应关 系;在后续的开发过程当中,我们会开发一个架构调整模块来专门支持在各个岗位 节点的新增,更新,删除操作
  14. +
+
+
+ +
+ + + diff --git a/crm/src/main/java/com/rex/crm/admin/DataImportPage.java b/crm/src/main/java/com/rex/crm/admin/DataImportPage.java new file mode 100644 index 0000000..7a22241 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/DataImportPage.java @@ -0,0 +1,194 @@ +package com.rex.crm.admin; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; + +import org.apache.log4j.Logger; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.IChoiceRenderer; +import org.apache.wicket.markup.html.form.upload.FileUpload; +import org.apache.wicket.markup.html.form.upload.FileUploadField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.link.DownloadLink; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.util.file.File; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.io.Files; +import com.rex.crm.admin.AdminTemplatePage; +import com.rex.crm.beans.Choice; +import com.rex.crm.dataport.DataImporter; +import com.rex.crm.dataport.ImportDataWizard; +import com.rex.crm.util.CRMUtility; +import com.rexen.crm.integration.DataImportDelegate; + +/** + * @author Feiyun Zhou + */ +public class DataImportPage extends AdminTemplatePage +{ + private static final Logger logger = Logger.getLogger(ImportDataWizard.class); + private static final List choiceList = Lists.newArrayList(); + static { + choiceList.add(new Choice(0L, "导入医院")); + choiceList.add(new Choice(1L, "导入医生")); + choiceList.add(new Choice(2L, "导入岗位")); + choiceList.add(new Choice(3L, "导入岗位汇报关系")); + choiceList.add(new Choice(4L, "导入用户")); + choiceList.add(new Choice(5L, "导入岗位和医院关系")); + choiceList.add(new Choice(6L, "导入用户和岗位关系")); + } + private FileUploadField fileUploadField; + private Choice selected_entity = choiceList.get(0); + BookmarkablePageLink view_log_btn ; + + public DataImportPage() + { + setPageTitle("系统管理-数据导入"); + init(); + } + + public void init() + { + fileUploadField = new FileUploadField("fileUpload"); + + Form form = new Form("form"){ + + protected void onSubmit() + { + if(selected_entity ==null) return; + logger.debug("selected_entity:"+ selected_entity.getId()); + + //DataImportDelegate da = new DataImportDelegate(); + FileUpload fileupload = fileUploadField.getFileUpload(); + String outputfolder = CRMUtility.readFileAttribure("uploadpath"); + + java.io.File tmpDir = null; + tmpDir = Files.createTempDir(); + if (fileupload != null) + { + + + try + { + + + String gbk_tmpFileName = tmpDir.getAbsolutePath() + File.separator+ "gbk_"+fileupload.getClientFileName(); + String utf8_tmpFileName = tmpDir.getAbsolutePath() + File.separator+ "utf8_"+fileupload.getClientFileName(); + fileupload.writeTo(new File(gbk_tmpFileName)); + fileupload.closeStreams(); + String file_content = Files.toString(new File(gbk_tmpFileName), Charset.forName("gbk")); + Files.write(file_content, new File(utf8_tmpFileName), Charsets.UTF_8); + logger.debug("UTF8 format file:"+ utf8_tmpFileName); + + logger.debug("selected_entity:"+selected_entity.getVal()); + String entityName = ""; + int entityId = (int)selected_entity.getId(); + switch(entityId){ + case 0: + entityName = "account"; + break; + case 1: + entityName = "contact"; + break; + case 2: + entityName = "crmuser"; + break; + case 3: + entityName = "crmuser"; + break; + case 4: + entityName = "userinfo"; + break; + case 5: + entityName = "accountcrmuser"; + break; + case 6: + entityName = "user_position"; + break; + + } + + if(entityName.isEmpty()) { + logger.debug("entity name is null"); + return; + } + + + DataImporter.importDataOnBackground(entityName, utf8_tmpFileName); + //da.load(template, FileName.toString()); + //this.setResponsePage(ImportLogPage.class); + view_log_btn.setVisible(true); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + }; + + add(form); + form.add(fileUploadField); + form.setMultiPart(true); + IModel choices = Model.ofList(choiceList); + + DropDownChoice dropdown = createDropDownListFromPickList("entityName", choices, new PropertyModel(this,"selected_entity")); + form.add(dropdown); + + view_log_btn = new BookmarkablePageLink("view_log_btn",ImportLogPage.class ); + form.add(view_log_btn); + view_log_btn.setVisible(false); + + File account_template = new File(DataImportPage.class.getResource("/templates/account.csv").getPath()); + add(new DownloadLink("account_template", account_template,"1医院模板.csv")); + + File contact_template = new File(DataImportPage.class.getResource("/templates/contact.csv").getPath()); + add(new DownloadLink("contact_template", contact_template,"2医生模板.csv")); + + File user_template = new File(DataImportPage.class.getResource("/templates/userinfo.csv").getPath()); + add(new DownloadLink("user_template", user_template,"5用户模板.csv")); + + File crmuser_template = new File(DataImportPage.class.getResource("/templates/crmuser.csv").getPath()); + add(new DownloadLink("crmuser_template", crmuser_template,"3岗位模板.csv")); + + File crmuser_report_template = new File(DataImportPage.class.getResource("/templates/crmuser_reportto.csv").getPath()); + add(new DownloadLink("crmuser_report_template", crmuser_report_template,"4岗位汇报关系模板.csv")); + + File accountcrmuser_template = new File(DataImportPage.class.getResource("/templates/accountcrmuser.csv").getPath()); + add(new DownloadLink("accountcrmuser_template", accountcrmuser_template,"6岗位和医院关系模板.csv ")); + + File user_position_template= new File(DataImportPage.class.getResource("/templates/user_position.csv").getPath()); + add(new DownloadLink("user_position_template", user_position_template,"7用户和岗位关系模板.csv")); + + } + + + private DropDownChoice createDropDownListFromPickList(String markupId,IModel choices,IModel default_model) { + + DropDownChoice choice = new DropDownChoice(markupId, default_model, choices, + new IChoiceRenderer() { + @Override + public Object getDisplayValue(Choice choice) { + // TODO Auto-generated method stub + return choice.getVal(); + } + @Override + public String getIdValue(Choice choice, int index) { + // TODO Auto-generated method stub + return String.valueOf(choice.getId()); + } + + + }); + + choice.setNullValid(true); + return choice; + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/DownloadPage.html b/crm/src/main/java/com/rex/crm/admin/DownloadPage.html new file mode 100644 index 0000000..e0b5ace --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/DownloadPage.html @@ -0,0 +1,27 @@ + + + + + + + +
+
+ +
+ + + diff --git a/crm/src/main/java/com/rex/crm/admin/DownloadPage.java b/crm/src/main/java/com/rex/crm/admin/DownloadPage.java new file mode 100644 index 0000000..25a4649 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/DownloadPage.java @@ -0,0 +1,154 @@ +package com.rex.crm.admin; + +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.wicket.markup.html.link.Link; +import com.rex.crm.SignIn2Session; +import com.rexen.crm.integration.DataExportDelegate; +import com.rex.crm.common.Entity; +import com.rex.crm.util.Configuration; + + +/** + * @author Feiyun Zhou + */ +public class DownloadPage extends AdminTemplatePage{ + + public DownloadPage(){ + setPageTitle("系统管理-下载数据"); + init(); + } + + public void init() + { + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("downLoad"); +// setPageTitle(entity.getDisplay()); + //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + //TODO get userId from request's session + + add(new Link("account") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "Account Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + add(new Link("contact") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "Contact Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + add(new Link("position") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "Position Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + add(new Link("activity") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "Activity Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + add(new Link("accountCrmuser") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "Account Team Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + add(new Link("userPosition") { + + @Override + public void onClick() { + DataExportDelegate dataExport = new DataExportDelegate(); +// String template = DAOImpl.selectTemplate(); + String teample = "UserPosition Team Export Full Template 1.0"; + HttpServletResponse response = (HttpServletResponse)getRequestCycle().getResponse().getContainerResponse(); + try + { + dataExport.export(teample, response); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setResponsePage(new DownloadPage()); + } + }); + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/ImportLogPage.html b/crm/src/main/java/com/rex/crm/admin/ImportLogPage.html new file mode 100644 index 0000000..eb366de --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ImportLogPage.html @@ -0,0 +1,36 @@ + + + + + + +
+ + + + + +
+
+ +
+
+ 刷新   + 导入   +

+ data table +

+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/ImportLogPage.java b/crm/src/main/java/com/rex/crm/admin/ImportLogPage.java new file mode 100644 index 0000000..e2d7e9f --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ImportLogPage.java @@ -0,0 +1,111 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.form.upload.FileUpload; +import org.apache.wicket.markup.html.form.upload.FileUploadField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.util.file.File; + +import com.google.common.collect.Lists; +import com.rex.crm.SignIn2Session; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.dataport.ImportDataWizard; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.CRMUtility; +import com.rex.crm.util.Configuration; +import com.rexen.crm.beans.UserRole; +import com.rexen.crm.integration.DataImportDelegate; + +/** + * @author Feiyun Zhou + */ +public class ImportLogPage extends AdminTemplatePage { + private String search_target = ""; + + public ImportLogPage() { + initPage(null, null); + } + + public void initPage(final Map filter, List tdata) { + final Entity entity = Configuration.getEntityByName("importlog"); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + setPageTitle("系统管理-导入日志"); + + String sql = entity.getSql(); + switch (roleId) { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) { + switch (roleId) { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + if (filter == null) { + switch (roleId) { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + } else { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) { + if (filter.get(k)) + ft.add(k); + } + + switch (roleId) { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId, positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId); + break; + } + + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + add(new BookmarkablePageLink("refresh_btn", ImportLogPage.class)); + add(new BookmarkablePageLink("import_btn", DataImportPage.class)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/MergePage.html b/crm/src/main/java/com/rex/crm/admin/MergePage.html new file mode 100755 index 0000000..fdbe584 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/MergePage.html @@ -0,0 +1,62 @@ + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + +
字段名称被合并目标合并目标合并结果
+
+ +
+
+ +
+ + + + + + +
+ + 查找 +    +
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/MergePage.java b/crm/src/main/java/com/rex/crm/admin/MergePage.java new file mode 100644 index 0000000..d87976f --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/MergePage.java @@ -0,0 +1,279 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.HiddenField; +import org.apache.wicket.markup.html.form.IChoiceRenderer; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.link.PopupSettings; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.request.IRequestParameters; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.rex.crm.beans.AdvancedSearchFilter; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.EditDataFormPanel; +import com.rex.crm.common.Entity; +import com.rex.crm.common.EntityDetailPage; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.common.advancedSearch.AdvancedSearchPanel; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.CRMUtility; +import com.rex.crm.util.Configuration; +import com.rex.crm.SelectEntryPage; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class MergePage extends AdminTemplatePage { + private static final Logger logger = Logger.getLogger(MergePage.class); + private String search_target = ""; + private Map> fieldName_model = Maps.newHashMap(); + /** + * Constructor + */ + public MergePage() { + // PageParameters pp = new PageParameters(); + // IRequestParameters params = + // this.getRequestCycle().getRequest().getRequestParameters(); + String entityId_a = getRequest().getRequestParameters().getParameterValue("entityIda").toString(); + String entityId_b = getRequest().getRequestParameters().getParameterValue("entityIdb").toString(); + String entityName = getRequest().getRequestParameters().getParameterValue("entityName").toString(); + initPage(entityName, entityId_a, entityId_b); + } + public MergePage(String entityName,String entityId_f,String entityId_s) { + initPage(entityName, entityId_f, entityId_s); + } + + private void initPage(final String entityName, final String entityId_A, final String entityId_B) { + + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final Entity entity = Configuration.getEntityByName(entityName); + final String user = ((SignIn2Session) getSession()).getUser(); + final Map datalistA = DAOImpl.queryEntityById(entity.getSql_ent(), entityId_A); + Map datalistB = null; + if(entityId_B != null){ + datalistB = DAOImpl.queryEntityById(entity.getSql_ent(), entityId_B); + } + final Map datalistC = datalistB; + Form form = new Form("form"){ + + @Override + protected void onSubmit() { + List names = Lists.newArrayList(); + List values = Lists.newArrayList(); + logger.debug("fieldName_model:::"+fieldName_model); + for(String fieldName: fieldName_model.keySet()){ + IModel model = fieldName_model.get(fieldName); + Choice choice = model.getObject(); + if (choice != null) { + names.add(fieldName); + + Field field = entity.getFieldByName(fieldName); + + if (field.getPicklist() != null) { + values.add(choice.getKey()); + } else if(field.getDataType().equalsIgnoreCase("number")) { + values.add(choice.getKey()); + }else{ + values.add("'"+ choice.getKey() + "'"); + } + } + + } + logger.debug("names:"+names); + logger.debug("values:"+values); + try { + EditDataFormPanel.recordValueChanges(datalistC, entity, entityId_B, user, values, names, + entityName); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + DAOImpl.updateRecord(entityId_B, entityName, names, values); + DAOImpl.updateRecordStatus(entityId_A, entityName); + if(entityName.equalsIgnoreCase("contact")){ + DAOImpl.updateActivityCountactById(entityId_B,entityId_A); + } else{ + DAOImpl.updateAccountCountactById(entityId_B,entityId_A); + } + setResponsePage(new EntityDetailPage(entityName, entityId_B)); + } + + }; + add(form); + + RepeatingView row_repeater = new RepeatingView("row_repeater"); + form.add(row_repeater); + form.add(new Label("entityIda",entityId_A)); + form.add(new Label("entityName",entityName)); + int i = 0; + for (Field field : entity.getFields()) { + if(!field.isShow()||field.isPrimaryKey()) continue; + AbstractItem item = new AbstractItem(row_repeater.newChildId()); + row_repeater.add(item); + String field_name = field.getDisplay(); + item.add(new Label("field_name", field_name)); + String value_a = getFieldDisplayValueFromMap(datalistA, field); + String value_b = null; + String raw_value_b =null; + if(datalistB!=null){ + value_b = getFieldDisplayValueFromMap(datalistB, field); + raw_value_b = getFieldRawValueFromMap(datalistB,field); + } + String raw_value_a = getFieldRawValueFromMap(datalistA,field); + + + //add field_value_a + item.add(new Label("field_value_a",value_a)); + + //add field_value_b + if(value_b!=null||i>0){ + item.add(new Label("field_value_b",value_b)); + } else { + item.add(new RelationTableSearchFragment("field_value_b","relationTableSearchFragment", this, entity.getName(), entity.getName(), entity.getName(), null, entityId_A)); + } + + if ((!value_a.isEmpty() && !value_a.isEmpty())&&(!value_a.equalsIgnoreCase(value_b)) ) { + + if (field.getFieldType() != null && field.getFieldType().equalsIgnoreCase("auto")) { + + item.add(new Label("value_picker", value_b)); + } else { + // add the picker + List choices = Lists.newArrayList(); + Choice choice = new Choice(); + choice.setKey(raw_value_a); + choice.setVal(value_a); + choices.add(choice); + + choice = new Choice(); + choice.setKey(raw_value_b); + choice.setVal(value_b); + choices.add(choice); + + IModel model = new Model(); + fieldName_model.put(field.getName(), model); + IModel chocies_model = Model.ofList(choices); + item.add(new DropDownChoiceFragment("value_picker", "dropDownFragment", this, chocies_model, model)); + } + } else { + item.add(new WebMarkupContainer("value_picker")); + } + i++; + } + + } + + private class DropDownChoiceFragment extends Fragment { + public DropDownChoiceFragment(String id, String markupId, MarkupContainer markupProvider, IModel choices,IModel default_model) { + super(id, markupId, markupProvider); + DropDownChoice dropDownInput = createDropDownListFromPickList("dropDownInput",choices,default_model); + add(dropDownInput); + + } + + } + + private DropDownChoice createDropDownListFromPickList(String markupId,IModel choices,IModel default_model) { + + DropDownChoice choice = new DropDownChoice(markupId, default_model, choices, + new IChoiceRenderer() { + @Override + public Object getDisplayValue(Choice choice) { + // TODO Auto-generated method stub + return choice.getVal(); + } + @Override + public String getIdValue(Choice choice, int index) { + // TODO Auto-generated method stub + return choice.getKey(); + } + + + }); + + choice.setNullValid(true); + return choice; + } + + + private class RelationTableSearchFragment extends Fragment { + public RelationTableSearchFragment(String id, String markupId, MarkupContainer markupProvider, final String entityName, String excludeEntityName ,final String value, IModel model, final String eid) { + super(id, markupId, markupProvider); + + PageParameters params = new PageParameters(); + params.set("en", entityName); + params.set("excludeName", excludeEntityName); +// params.set("target", (long) model.getObject()); + params.set("eid", eid); + + PopupSettings popupSettings = new PopupSettings("查找"); + add(new BookmarkablePageLink("search_btn", SelectEntryPage.class, params).setPopupSettings(popupSettings)); + HiddenField hidden = new HiddenField("selected_id_hidden", model); + hidden.add(new AttributeAppender("id", entityName + "_id")); + add(hidden); + TextField text = new TextField("selected_value_input", new Model(value)); + text.add(new AttributeAppender("id", entityName + "_name")); + add(text); + } + } + + private String getFieldRawValueFromMap(Map data, Field field){ + Object rawvalue = data.get(field.getName()); + rawvalue = (rawvalue == null) ? "" : rawvalue; + String value = CRMUtility.formatValue(field.getFormatter(), String.valueOf(rawvalue)); + value = (value == null) ? "" : value; + + return value; + } + private String getFieldDisplayValueFromMap(Map data, Field field) { + String value = null; + + if (field.getPicklist() != null) { + + value = CRMUtility.formatValue(field.getFormatter(), DAOImpl.queryPickListByIdCached(field.getPicklist(), String.valueOf(data.get(field.getName())))); + value = (value == null) ? "" : value; + + } else if (field.getRelationTable() != null) { + value = CRMUtility.formatValue(field.getFormatter(), DAOImpl.queryCachedRelationDataById(field.getRelationTable(), String.valueOf(data.get(field.getName())))); + value = (value == null) ? "" : value; + + } else { + Object rawvalue = data.get(field.getName()); + rawvalue = (rawvalue == null) ? "" : rawvalue; + value = CRMUtility.formatValue(field.getFormatter(), String.valueOf(rawvalue)); + value = (value == null) ? "" : value; + } + + return value; + + } + +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/PositionPage.html b/crm/src/main/java/com/rex/crm/admin/PositionPage.html new file mode 100644 index 0000000..f047203 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/PositionPage.html @@ -0,0 +1,47 @@ + + + + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/PositionPage.java b/crm/src/main/java/com/rex/crm/admin/PositionPage.java new file mode 100644 index 0000000..b99b754 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/PositionPage.java @@ -0,0 +1,195 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class PositionPage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public PositionPage() + { + initPage(null, null); + } + + public PositionPage(final Map filter, List tdata) + { + initPage(filter, tdata); + } + + public void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("crmuser"); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + setPageTitle("系统管理-岗位列表"); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where name like '%" + search_target + "%' " + likequery; + List datalist = null; + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + +// List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); + setResponsePage(new PositionPage(filter, datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + + }); + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + if (filter == null) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + + + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId); + break; + } + + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + add(new FilterPanel("filterPanel", choices, filter, PositionPage.class,entity)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/PositionTreePage.html b/crm/src/main/java/com/rex/crm/admin/PositionTreePage.html new file mode 100644 index 0000000..6af19db --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/PositionTreePage.html @@ -0,0 +1,44 @@ + + + + + +
+
+
+
区域管理 +
+
+
+
+ +
+
+
+
+ data table +
+
+
+
+ +
+
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/PositionTreePage.java b/crm/src/main/java/com/rex/crm/admin/PositionTreePage.java new file mode 100644 index 0000000..1f9d956 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/PositionTreePage.java @@ -0,0 +1,142 @@ +package com.rex.crm.admin; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.beanutils.converters.IntegerArrayConverter; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.markup.html.panel.EmptyPanel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.util.string.StringValue; +import org.apache.wicket.util.template.PackageTextTemplate; + +import com.google.common.base.Joiner; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.rex.crm.beans.CRMUser; +import com.rex.crm.common.AccountPositionPanel; +import com.rex.crm.common.Entity; +import com.rex.crm.common.EntityDetailContainerPanel; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.tree.Node; +import com.rex.crm.common.tree.TreeFactory; +import com.rex.crm.common.tree.TreePanel; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; + +/** + * @author Feiyun Zhou + */ +public class PositionTreePage extends AdminTemplatePage +{ + + private String search_target = ""; + + /** + * Constructor + */ + public PositionTreePage() + { + setPageTitle("系统管理-区域管理"); + StringValue positionId = getRequest().getRequestParameters() + .getParameterValue("positionId"); + + int level = 0; + if (!positionId.isNull() && !positionId.isEmpty()) + { + level = DAOImpl.getLevelByPositionId(positionId.toInt()); + } + if (positionId.isEmpty() || positionId.isNull()) + { + initPage(null, 0); + } + else + { + initPage(positionId.toString(), level); + } + + urlFor(PositionTreePage.class, null); + + } + + public PositionTreePage(String id, String level) + { + setPageTitle("系统管理-区域管理"); + int lev = Integer.parseInt(level); + initPage(id, lev); + } + + private void initPage(final String positionId, int level) + { + Gson gson = new Gson(); + String result = gson.toJson(TreeFactory.createAccountPositionTree(),Node.class); + add(new TreePanel("treePanel", result)); + Map entities = Configuration.getEntityTable(); + + if (positionId != null) + { + if (positionId.equals("-1")) + { + List tdata = DAOImpl.queryEntityRelationList("select * from user_position_query"); + add(new PageableTablePanel("datalist", entities.get("user_position_query"), tdata, null)); + } + else + { + AccountPositionPanel panel = new AccountPositionPanel("datalist", + "crmuser", positionId, level); + add(panel); + } + } + else + { + add(new EmptyPanel("datalist")); + } + } + + @Override + public void renderHead(IHeaderResponse response) + { + super.renderHead(response); + StringValue act_key = getRequest().getRequestParameters() + .getParameterValue("positionId"); + Map map = new HashMap<>(); + + map.put("act_key", act_key.toString()); + PackageTextTemplate ptt = new PackageTextTemplate(getClass(), + "adminpage.js"); + // OnDomReadyHeaderItem onDomReadyHeaderItem = + // OnDomReadyHeaderItem.forScript( ptt.asString( map ) ); + // response.render(onDomReadyHeaderItem); + System.out.println(ptt.asString(map)); + response.render(JavaScriptHeaderItem.forScript(ptt.asString(map), null)); + + try + { + ptt.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + +} diff --git a/crm/src/main/java/com/rex/crm/admin/ProductPage.html b/crm/src/main/java/com/rex/crm/admin/ProductPage.html new file mode 100644 index 0000000..e9e16ca --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ProductPage.html @@ -0,0 +1,42 @@ + + + + + + +
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/ProductPage.java b/crm/src/main/java/com/rex/crm/admin/ProductPage.java new file mode 100644 index 0000000..17c76f2 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ProductPage.java @@ -0,0 +1,121 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class ProductPage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public ProductPage() + { + initPage(null, null); + } + + public ProductPage(final Map filter, List tdata) + { + initPage(filter, tdata); + } + + public void initPage(final Map filter, List tdata) + { + setPageTitle("系统管理-产品管理"); + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("productline"); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where name like '%" + search_target + "%' " + likequery; + List datalist = null; + datalist = DAOImpl.queryEntityRelationList(sql); + +// List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); + setResponsePage(new ProductPage(filter, datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + + }); + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + tdata = DAOImpl.queryEntityRelationList(sql); + + if (filter == null) + { + tdata = DAOImpl.queryEntityRelationList(sql); + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/ProductTreePage.html b/crm/src/main/java/com/rex/crm/admin/ProductTreePage.html new file mode 100644 index 0000000..7025702 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ProductTreePage.html @@ -0,0 +1,45 @@ + + + + + + +
+
+
+
产品树 +
+
+
+
+ +
+
+
+
+ data table +
+
+
+
+ +
+
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/ProductTreePage.java b/crm/src/main/java/com/rex/crm/admin/ProductTreePage.java new file mode 100644 index 0000000..0ea5d34 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ProductTreePage.java @@ -0,0 +1,104 @@ +package com.rex.crm.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.html.panel.EmptyPanel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; +import org.apache.wicket.util.template.PackageTextTemplate; + +import com.google.gson.Gson; +import com.rex.crm.common.Entity; +import com.rex.crm.common.EntityDetailContainerPanel; +import com.rex.crm.common.EntityDetailPage; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.tree.Node; +import com.rex.crm.common.tree.ProductTreePanel; +import com.rex.crm.common.tree.TreeFactory; +import com.rex.crm.common.tree.TreePanel; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.Configuration; +import java.util.List; +/** + * @author Feiyun Zhou + */ +public class ProductTreePage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public ProductTreePage() + { + setPageTitle("系统管理-产品树"); + StringValue positionId = getRequest().getRequestParameters().getParameterValue("positionId"); + StringValue entityName = getRequest().getRequestParameters().getParameterValue("entityName"); + +// System.out.println("StringValue:"+positionId); +// System.out.println("entityName:"+entityName); + + if(positionId.isEmpty() || positionId.isNull()){ + initPage(null,null); + }else{ + initPage(positionId.toString(),entityName.toString()); + } + + urlFor(ProductTreePage.class, null); + + } + + public ProductTreePage(final String id, final String entityName){ + initPage(id,entityName); + } + + private void initPage(final String positionId,final String entityName){ + Gson gson = new Gson(); + String result = gson.toJson(TreeFactory.createProductTree(),Node.class); + add(new ProductTreePanel("treePanel",result)); + + if(positionId !=null){ + PageParameters pp = new PageParameters(); + pp.add("positionId", -1); + if(positionId.equals("-1")){ + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("productline"); + List tdata = DAOImpl.queryEntityRelationList(entity.getSql()); + add(new PageableTablePanel("datalist", entity, tdata, null)); + //setResponsePage(new ProductPage()); + }else{ + EntityDetailContainerPanel panel = new EntityDetailContainerPanel("datalist",entityName,positionId,this.getClass(),pp); + add(panel); + } + }else{ + add(new EmptyPanel("datalist")); + } + + } + //监听请求 Ajax + // 级联 + @Override + public void renderHead(IHeaderResponse response) { + super.renderHead(response); + StringValue act_key = getRequest().getRequestParameters().getParameterValue("positionId"); + Map map = new HashMap<>(); + + map.put("act_key", act_key.toString()); + PackageTextTemplate ptt = new PackageTextTemplate( getClass(), "adminpage.js" ); + //OnDomReadyHeaderItem onDomReadyHeaderItem = OnDomReadyHeaderItem.forScript( ptt.asString( map ) ); + //response.render(onDomReadyHeaderItem); + System.out.println(ptt.asString(map)); + response.render(JavaScriptHeaderItem.forScript(ptt.asString(map),null)); + + try { + ptt.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/ReportPage.html b/crm/src/main/java/com/rex/crm/admin/ReportPage.html new file mode 100644 index 0000000..200decd --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ReportPage.html @@ -0,0 +1,46 @@ + + + + + + +
+ + + + + +
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/ReportPage.java b/crm/src/main/java/com/rex/crm/admin/ReportPage.java new file mode 100644 index 0000000..53af842 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/ReportPage.java @@ -0,0 +1,185 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; +import com.rex.crm.AccountPage; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class ReportPage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public ReportPage() + { + initPage(null, null); + } + + public ReportPage(final Map filter, List tdata) + { + initPage(filter, tdata); + } + + public void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + //final Entity entity = entities.get("callreport"); + final Entity entity = entities.get("user_position_account"); + + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String userId = ((SignIn2Session) getSession()).getUserId(); + setPageTitle("系统管理-报表"); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where userName like '%" + search_target + "%' " + likequery; + List datalist = null; + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,userId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + +// List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); + // setResponsePage(new UserPage(filter, datalist)); + setResponsePage(new ReportPage(filter, datalist)); + + } + + }; + add(form); + + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, userId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + + if (filter == null) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, userId ); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + + + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, userId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, userId); + break; + } + + } + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/UploadPage.html b/crm/src/main/java/com/rex/crm/admin/UploadPage.html new file mode 100644 index 0000000..7262ff6 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UploadPage.html @@ -0,0 +1,31 @@ + + + + + + +
+
+ +
上传医院
+
上传医生
+
上传岗位
+
上传用户
+
上传医院团队
+
上传岗位用户关系
+
+
+
+
+
+ +
+ + + diff --git a/crm/src/main/java/com/rex/crm/admin/UploadPage.java b/crm/src/main/java/com/rex/crm/admin/UploadPage.java new file mode 100644 index 0000000..86e27a4 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UploadPage.java @@ -0,0 +1,152 @@ +package com.rex.crm.admin; + +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.upload.FileUpload; +import org.apache.wicket.markup.html.form.upload.FileUploadField; +import org.apache.wicket.util.file.File; + +import com.rex.crm.util.CRMUtility; +import com.rexen.crm.integration.DataImportDelegate; + +/** + * @author Feiyun Zhou + */ +public class UploadPage extends AdminTemplatePage +{ + + public UploadPage() + { + init(); + } + + public void init() + { + + final FileUploadField account = new FileUploadField("account"); + + final FileUploadField contact = new FileUploadField("contact"); + + final FileUploadField position = new FileUploadField("position"); + + final FileUploadField user = new FileUploadField("user"); + + final FileUploadField accountTeam = new FileUploadField("accountTeam"); + + final FileUploadField userPosition = new FileUploadField("userPosition"); + +// final FileUploadField userInfo = new FileUploadField("userInfo"); + Form form = new Form("form") + { + @Override + protected void onSubmit() + { + DataImportDelegate da = new DataImportDelegate(); + FileUpload accountFileUpload = account.getFileUpload(); + CRMUtility util = new CRMUtility(); + StringBuffer FileName = new StringBuffer(util.readFileAttribure("uploadpath")); + + if (accountFileUpload != null) + { + String template = "Account Full Import Template 1.0"; + FileName.append(accountFileUpload.getClientFileName()); + try + { + accountFileUpload.writeTo(new File(FileName.toString())); + da.load(template, FileName.toString()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + FileUpload contactFileUpload = contact.getFileUpload(); + if (contactFileUpload != null) + { + FileName.append(contactFileUpload.getClientFileName()); + String template = "Contact Import Template 1.0"; + try + { + contactFileUpload.writeTo(new File(FileName.toString())); + da.load(template, FileName.toString()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + FileUpload positionFileUpload = position.getFileUpload(); + if (positionFileUpload != null) + { + FileName.append(positionFileUpload.getClientFileName()); + String template = "Position Import Template 1.0"; + try + { + positionFileUpload.writeTo(new File(FileName.toString())); + da.load(template, FileName.toString()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + FileUpload accountTeamyFileUpload = accountTeam.getFileUpload(); + if (accountTeamyFileUpload != null) + { + FileName.append(accountTeamyFileUpload.getClientFileName()); + String template = "Account Team Import Template 1.0"; + try + { + accountTeamyFileUpload.writeTo(new File(FileName.toString())); + da.load(template, FileName.toString()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + FileUpload userFileUpload = user.getFileUpload(); + if (userFileUpload != null) + { + String userFileName = "d:\\" + userFileUpload.getClientFileName(); + String template = "UserInfo Import Template 1.0"; + try + { + userFileUpload.writeTo(new File(userFileName)); + da.load(template, userFileName); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + FileUpload userPositionFileUpload = userPosition.getFileUpload(); + if (userPositionFileUpload != null) + { + FileName.append(userPositionFileUpload.getClientFileName()); + String template = "UsrePosition Import Template 1.0"; + try + { + userPositionFileUpload.writeTo(new File(FileName.toString())); + da.load(template, FileName.toString()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + }; + add(form); + form.add(account); + form.add(contact); + form.add(position); + form.add(accountTeam); + form.add(user); + form.add(userPosition); + form.setMultiPart(true); + + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/UserPage.html b/crm/src/main/java/com/rex/crm/admin/UserPage.html new file mode 100755 index 0000000..597e828 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UserPage.html @@ -0,0 +1,47 @@ + + + + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/UserPage.java b/crm/src/main/java/com/rex/crm/admin/UserPage.java new file mode 100644 index 0000000..2e233ab --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UserPage.java @@ -0,0 +1,197 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class UserPage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public UserPage() + { + setPageTitle("系统管理-用户管理"); + initPage(null, null); + } + + public UserPage(final Map filter, List tdata) + { + setPageTitle("系统管理-用户管理"); + initPage(filter, tdata); + } + + public void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("userinfo"); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String userId = ((SignIn2Session) getSession()).getUserId(); + setPageTitle(entity.getDisplay()); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where name like '%" + search_target + "%' " + likequery; + List datalist = null; + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,userId,userId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + +// List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); + setResponsePage(new UserPage(filter, datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + + }); + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlAdmin(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManager(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, userId,userId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + + if (filter == null) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql, userId,userId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, userId); + break; + } + + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + + + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, userId,userId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, userId); + break; + } + + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + + // for the side bar + List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); + add(new FilterPanel("filterPanel", choices, filter, UserPage.class,entity)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/UserPositionPage.html b/crm/src/main/java/com/rex/crm/admin/UserPositionPage.html new file mode 100644 index 0000000..d28d23a --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UserPositionPage.html @@ -0,0 +1,50 @@ + + + + + + +
+
+ + + +
+
+
+
+ +
+
+
+
+
+ data table +
+
+
+
+
+ +
+ + diff --git a/crm/src/main/java/com/rex/crm/admin/UserPositionPage.java b/crm/src/main/java/com/rex/crm/admin/UserPositionPage.java new file mode 100644 index 0000000..607149d --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/UserPositionPage.java @@ -0,0 +1,195 @@ +package com.rex.crm.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.PropertyModel; + +import com.google.common.collect.Lists; +import com.rex.crm.beans.Choice; +import com.rex.crm.common.Entity; +import com.rex.crm.common.Field; +import com.rex.crm.common.FilterPanel; +import com.rex.crm.common.PageableTablePanel; +import com.rex.crm.common.TableDataPanel; +import com.rex.crm.common.advancedSearch.AdvancedSearchPage; +import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; +import com.rex.crm.util.Configuration; +import com.rex.crm.SignIn2Session; + +/** + * @author Feiyun Zhou + */ +public class UserPositionPage extends AdminTemplatePage +{ + private String search_target = ""; + + /** + * Constructor + */ + public UserPositionPage() + { + initPage(null, null); + } + + public UserPositionPage(final Map filter, List tdata) + { + initPage(filter, tdata); + } + + public void initPage(final Map filter, List tdata) + { + Map entities = Configuration.getEntityTable(); + final Entity entity = entities.get("user_position"); + final int roleId = ((SignIn2Session) getSession()).getRoleId(); + final String positionId = ((SignIn2Session) getSession()).getPositionId(); + setPageTitle("系统管理-岗位关系"); + + + Form form = new Form("form") + { + + @Override + protected void onSubmit() + { + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSql(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSql(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + + search_target = (search_target == null || search_target.equalsIgnoreCase("*")) ? "" : search_target; + + // sql = sql + " AND name like '%"+search_target+"%'"; + List searchableFields = entity.getSearchableFields(); + String joint = " like '%" + search_target + "%'"; + String likequery = ""; + for (Field sf : searchableFields) + { + likequery = likequery + " OR " + sf.getName() + joint; + } + + sql = sql + " where name like '%" + search_target + "%' " + likequery; + List datalist = null; + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + datalist = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + datalist = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + datalist = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + +// List datalist = DAOImpl.queryEntityRelationList(sql, "dummy"); + setResponsePage(new UserPositionPage(filter, datalist)); + + } + + }; + add(form); + form.add(new Link("ad_search_link"){ + @Override + public void onClick() { + setResponsePage(new AdvancedSearchPage(entity.getName(),null)); + + } + + }); + TextField search_input = new TextField("search_input", new PropertyModel(this, "search_target")); + form.add(search_input); + + String sql = entity.getSql(); + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSql(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSql(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSql(); + break; + } + // List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); + if (tdata == null || tdata.size() == 0) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + if (filter == null) + { + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityRelationList(sql); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityRelationList(sql,positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityRelationList(sql, positionId); + break; + } + + } + else + { + List ft = Lists.newArrayList(); + for (String k : filter.keySet()) + { + if (filter.get(k)) + ft.add(k); + } + + + switch (roleId) + { + case UserRole.USER_ROLE_ADMINISTRATOR: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft); + break; + case UserRole.USER_ROLE_MANAGER: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId,positionId); + break; + case UserRole.USER_ROLE_SALES: + tdata = DAOImpl.queryEntityWithFilter(sql, entity.getFilterField(), ft, positionId); + break; + } + + } + + } + add(new PageableTablePanel("datalist", entity, tdata, null)); + +// List choices = DAOImpl.queryPickList(entity.getFieldByName(entity.getFilterField()).getPicklist()); +// add(new FilterPanel("filterPanel", choices, filter, PositionPage.class,entity)); + + } +} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/admin/adminpage.js b/crm/src/main/java/com/rex/crm/admin/adminpage.js new file mode 100644 index 0000000..d7a7311 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/admin/adminpage.js @@ -0,0 +1,2 @@ +var act_key='${act_key}'; + diff --git a/crm/src/main/java/com/rex/crm/ajax/DataProvider.java b/crm/src/main/java/com/rex/crm/ajax/DataProvider.java index a5885c6..b7bb270 100644 --- a/crm/src/main/java/com/rex/crm/ajax/DataProvider.java +++ b/crm/src/main/java/com/rex/crm/ajax/DataProvider.java @@ -37,9 +37,11 @@ import com.rex.crm.beans.Contact; import com.rex.crm.beans.Province; import com.rex.crm.beans.Resp; +import com.rex.crm.beans.UserInfo; import com.rex.crm.common.Entity; import com.rex.crm.common.Field; import com.rex.crm.db.DAOImpl; +import com.rexen.crm.beans.UserRole; import com.rex.crm.html.Node; import com.rex.crm.util.CRMUtility; import com.rex.crm.util.Configuration; @@ -49,7 +51,7 @@ * @author Feiyun */ public class DataProvider { - private static final Logger logger = Logger.getLogger(DataProvider.class); + private static final Logger logger = Logger.getLogger(DataProvider.class); public DataProvider() { @@ -803,8 +805,31 @@ public static String getActivitiesTableDataByUserId(String[] args){ String id = args[0]; Map entities = Configuration.getEntityTable(); Entity entity = entities.get("activity"); - Multimap multiMap = getEntityListByIdOfUserId(entity.getSql(),id); - + CRMUser user = DAOImpl.getCrmUserById(Integer.parseInt(id)); + int roleId = user.getRole(); + String sql = null; + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + sql = entity.getSqlCalendar(); + break; + case UserRole.USER_ROLE_MANAGER: + sql = entity.getSqlManagerCalendar(); + break; + case UserRole.USER_ROLE_SALES: + sql = entity.getSqlCalendar(); + break; + } + Multimap multiMap = null; + switch(roleId){ + case UserRole.USER_ROLE_ADMINISTRATOR: + multiMap = getEntityListByIdOfUserId(sql,id); + break; + case UserRole.USER_ROLE_MANAGER: + multiMap = getEntityListByIdOfUserId(sql,id); + break; + case UserRole.USER_ROLE_SALES: + multiMap = getEntityListByIdOfUserId(sql, id); + } return getIndexTable(entity,multiMap,id); } @@ -931,10 +956,10 @@ public static String getIndexTable(Entity entity, Multimap multiMa public static String login(String[] args){ String loginName = args[0]; String password = args[1]; - CRMUser user = DAOImpl.login(loginName,password); + UserInfo user = DAOImpl.login(loginName,password); if(user != null){ Gson gson = new Gson(); - return gson.toJson(user, CRMUser.class); + return gson.toJson(user, UserInfo.class); }else{ return "{}"; } @@ -942,9 +967,9 @@ public static String login(String[] args){ } - private static Multimap getEntityListByIdOfUserId(String sql, String userId){ + private static Multimap getEntityListByIdOfUserId(String sql, String... ids){ Multimap multimap = LinkedHashMultimap.create(); - List maplist = DAOImpl.queryEntityRelationList(sql, userId); + List maplist = DAOImpl.queryEntityRelationList(sql, ids); for(Map map:(List)maplist){ Integer id = Integer.parseInt(String.valueOf(map.get("id"))); diff --git a/crm/src/main/java/com/rex/crm/beans/AccountCRMUserRelation.java b/crm/src/main/java/com/rex/crm/beans/AccountCRMUserRelation.java index a2792b2..4957e98 100644 --- a/crm/src/main/java/com/rex/crm/beans/AccountCRMUserRelation.java +++ b/crm/src/main/java/com/rex/crm/beans/AccountCRMUserRelation.java @@ -2,9 +2,18 @@ public class AccountCRMUserRelation { private int accountId; - private int userId; + private int crmuserId; + private int id; - public int getAccountId() { + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAccountId() { return accountId; } @@ -12,11 +21,12 @@ public void setAccountId(int accountId) { this.accountId = accountId; } - public int getUserId() { - return userId; - } + public int getCrmuserId() { + return crmuserId; + } + + public void setCrmuserId(int crmuserId) { + this.crmuserId = crmuserId; + } - public void setUserId(int userId) { - this.userId = userId; - } } diff --git a/crm/src/main/java/com/rex/crm/beans/AdvancedSearchField.java b/crm/src/main/java/com/rex/crm/beans/AdvancedSearchField.java new file mode 100644 index 0000000..9804cd2 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/AdvancedSearchField.java @@ -0,0 +1,37 @@ +package com.rex.crm.beans; + +import java.io.Serializable; + +public class AdvancedSearchField implements Serializable { + + private String type; + private String id; + private String label; + private AdvancedSearchField[] list; + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } + public AdvancedSearchField[] getList() { + return list; + } + public void setList(AdvancedSearchField[] list) { + this.list = list; + } + +} diff --git a/crm/src/main/java/com/rex/crm/beans/AdvancedSearchFilter.java b/crm/src/main/java/com/rex/crm/beans/AdvancedSearchFilter.java new file mode 100644 index 0000000..0099b00 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/AdvancedSearchFilter.java @@ -0,0 +1,37 @@ +package com.rex.crm.beans; + +import java.io.Serializable; + +public class AdvancedSearchFilter implements Serializable { + + private FilterMeta field; + private FilterMeta value; + private FilterMeta operator; + + + public FilterMeta getField() { + return field; + } + public void setField(FilterMeta field) { + this.field = field; + } + public FilterMeta getValue() { + return value; + } + public void setValue(FilterMeta value) { + this.value = value; + } + public FilterMeta getOperator() { + return operator; + } + public void setOperator(FilterMeta operator) { + this.operator = operator; + } + + + +} + + + + diff --git a/crm/src/main/java/com/rex/crm/beans/CRMUser.java b/crm/src/main/java/com/rex/crm/beans/CRMUser.java index d024565..adc62e3 100644 --- a/crm/src/main/java/com/rex/crm/beans/CRMUser.java +++ b/crm/src/main/java/com/rex/crm/beans/CRMUser.java @@ -29,6 +29,20 @@ public class CRMUser { private int role; private int reportto; private int sex; + private int isActivited; + private long ts; + private int pl1; + private int level; + private String code; + private String userInfoName; + private int pl5; + public String getUserInfoName() { + return userInfoName; + } + + public void setUserInfoName(String userInfoName) { + this.userInfoName = userInfoName; + } public String getName() { return name; @@ -126,6 +140,14 @@ public void setPhoto(String photo) { this.photo = photo; } + public int getIsActivited() { + return isActivited; + } + + public void setIsActivited(int isActivited) { + this.isActivited = isActivited; + } + @Override public String toString() { Gson gson = new GsonBuilder().create(); @@ -143,6 +165,7 @@ public Map toMap(){ map.put("name", name); map.put("id", id); map.put("photo", photo); + map.put("isActivited","isActivited"); return map; } @@ -221,5 +244,47 @@ public int getSex() { public void setSex(int sex) { this.sex = sex; } + + public long getTs() { + return ts; + } + + public void setTs(long ts) { + this.ts = ts; + } + + public int getPl1() { + return pl1; + } + + public void setPl1(int pl1) { + this.pl1 = pl1; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public int getPl5() { + return pl5; + } + + public void setPl5(int pl5) { + this.pl5 = pl5; + } + + } diff --git a/crm/src/main/java/com/rex/crm/beans/Choice.java b/crm/src/main/java/com/rex/crm/beans/Choice.java index d593409..f19e0a1 100644 --- a/crm/src/main/java/com/rex/crm/beans/Choice.java +++ b/crm/src/main/java/com/rex/crm/beans/Choice.java @@ -4,6 +4,7 @@ public class Choice implements Serializable { private long id; + private String key; private String val; private String name; @@ -37,5 +38,11 @@ public String getName() { public void setName(String name) { this.name = name; } + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } } diff --git a/crm/src/main/java/com/rex/crm/beans/FilterMeta.java b/crm/src/main/java/com/rex/crm/beans/FilterMeta.java new file mode 100644 index 0000000..be2e396 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/FilterMeta.java @@ -0,0 +1,22 @@ +package com.rex.crm.beans; + +import java.io.Serializable; + + +public class FilterMeta implements Serializable { + private String label; + private String value; + + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } +} diff --git a/crm/src/main/java/com/rex/crm/beans/Product.java b/crm/src/main/java/com/rex/crm/beans/Product.java new file mode 100644 index 0000000..3b8b716 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/Product.java @@ -0,0 +1,61 @@ +package com.rex.crm.beans; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class Product { + private int id; + private String name; + + @Override + public String toString() { + Gson gson = new GsonBuilder().create(); + return gson.toJson(this, Product.class).toString(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @SuppressWarnings("all") + public Map toMap(){ + Map map = new HashMap(); + map.put("name", name); + return map; + } + + + public static Map getMappingOfField2ColumnName(){ + Map list = new HashMap(); + list.put("name", "名称"); + return list; + } + + public static List getFieldNames(){ + List list = new ArrayList(); + Field[] fields = Product.class.getDeclaredFields(); + for(Field f:fields){ + list.add(f.getName()); + } + return list; + } + +} diff --git a/crm/src/main/java/com/rex/crm/beans/ProductLine.java b/crm/src/main/java/com/rex/crm/beans/ProductLine.java new file mode 100644 index 0000000..b8030ee --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/ProductLine.java @@ -0,0 +1,64 @@ +package com.rex.crm.beans; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class ProductLine { + private int id; + private String val; + + @Override + public String toString() { + Gson gson = new GsonBuilder().create(); + return gson.toJson(this, ProductLine.class).toString(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getVal() { + return val; + } + + public void setVal(String val) { + this.val = val; + } + + @SuppressWarnings("all") + public Map toMap(){ + Map map = new HashMap(); + map.put("val", val); + return map; + } + + + public static Map getMappingOfField2ColumnName(){ + Map list = new HashMap(); + list.put("val", "名称"); + return list; + } + + public static List getFieldNames(){ + List list = new ArrayList(); + Field[] fields = CRMUser.class.getDeclaredFields(); + for(Field f:fields){ + list.add(f.getName()); + } + return list; + } + + + + +} diff --git a/crm/src/main/java/com/rex/crm/beans/Productcategory.java b/crm/src/main/java/com/rex/crm/beans/Productcategory.java new file mode 100644 index 0000000..c6e45e1 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/Productcategory.java @@ -0,0 +1,61 @@ +package com.rex.crm.beans; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class Productcategory { + private int id; + private String name; + + @Override + public String toString() { + Gson gson = new GsonBuilder().create(); + return gson.toJson(this, Product.class).toString(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @SuppressWarnings("all") + public Map toMap(){ + Map map = new HashMap(); + map.put("name", name); + return map; + } + + + public static Map getMappingOfField2ColumnName(){ + Map list = new HashMap(); + list.put("name", "名称"); + return list; + } + + public static List getFieldNames(){ + List list = new ArrayList(); + Field[] fields = Product.class.getDeclaredFields(); + for(Field f:fields){ + list.add(f.getName()); + } + return list; + } + +} diff --git a/crm/src/main/java/com/rex/crm/beans/UserInfo.java b/crm/src/main/java/com/rex/crm/beans/UserInfo.java new file mode 100644 index 0000000..eba4a21 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/UserInfo.java @@ -0,0 +1,279 @@ +package com.rex.crm.beans; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class UserInfo { + private int id; + private String name; + private String cellPhone; + private String company; + private String businessUnit; + private String department; + private String division; + private String employeeNumber; + private String jobTitle; + private String email; + private int cityId; + private String photo; + private String password; + private String loginName; + private String sessionKey; + private long lastLoginTime; + private int role; + private int reportto; + private int sex; + private int pl1; + private int level; + private String position_code; + private int positionId; + private String office_tel; + private int num_of_signIn; + public int getPositionId() + { + return positionId; + } + public void setPositionId(int positionId) + { + this.positionId = positionId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCellPhone() { + return cellPhone; + } + + public void setCellPhone(String cellPhone) { + this.cellPhone = cellPhone; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getBusinessUnit() { + return businessUnit; + } + + public void setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getDivision() { + return division; + } + + public void setDivision(String division) { + this.division = division; + } + + public String getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(String emplyeeNumber) { + this.employeeNumber = emplyeeNumber; + } + + public String getJobTitle() { + return jobTitle; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getCityId() { + return cityId; + } + + public void setCityId(int cityId) { + this.cityId = cityId; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().create(); + return gson.toJson(this, CRMUser.class).toString(); + } + + @SuppressWarnings("all") + public Map toMap(){ + Map map = new HashMap(); + map.put("cellPhone", cellPhone); + map.put("division", division); + map.put("department", department); + map.put("email", email); + map.put("jobTitle", jobTitle); + map.put("name", name); + map.put("id", id); + map.put("photo", photo); + map.put("isActivited","isActivited"); + return map; + } + + + public static Map getMappingOfField2ColumnName(){ + Map list = new HashMap(); + list.put("name", "名称"); + list.put("cellPhone", "电话"); + list.put("email", "邮箱"); + list.put("jobTitle", "职位"); + list.put("division", "部门"); + return list; + } + + public static List getFieldNames(){ + List list = new ArrayList(); + Field[] fields = CRMUser.class.getDeclaredFields(); + for(Field f:fields){ + list.add(f.getName()); + } + return list; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getSessionKey() { + return sessionKey; + } + + public void setSessionKey(String sessionKey) { + this.sessionKey = sessionKey; + } + + public long getLastLoginTime() { + return lastLoginTime; + } + + public void setLastLoginTime(long lastLoginTime) { + this.lastLoginTime = lastLoginTime; + } + + public int getRole() { + return role; + } + + public void setRole(int role) { + this.role = role; + } + + public int getReportto() { + return reportto; + } + + public void setReportto(int reportto) { + this.reportto = reportto; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + + public int getPl1() { + return pl1; + } + + public void setPl1(int pl1) { + this.pl1 = pl1; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public String getPosition_code() { + return position_code; + } + + public void setPosition_code(String position_code) { + this.position_code = position_code; + } + public String getOffice_tel() { + return office_tel; + } + public void setOffice_tel(String office_tel) { + this.office_tel = office_tel; + } + public int getNum_of_signIn() { + return num_of_signIn; + } + public void setNum_of_signIn(int num_of_signIn) { + this.num_of_signIn = num_of_signIn; + } + + + +} diff --git a/crm/src/main/java/com/rex/crm/beans/UserPosition.java b/crm/src/main/java/com/rex/crm/beans/UserPosition.java new file mode 100644 index 0000000..e0a5463 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/beans/UserPosition.java @@ -0,0 +1,33 @@ +package com.rex.crm.beans; + +public class UserPosition { + private int id; + private int userId; + private int positionId; + private int isPrimary; + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getUserId() { + return userId; + } + public void setUserId(int userId) { + this.userId = userId; + } + public int getPositionId() { + return positionId; + } + public void setPositionId(int positionId) { + this.positionId = positionId; + } + public int getIsPrimary() { + return isPrimary; + } + public void setIsPrimary(int isPrimary) { + this.isPrimary = isPrimary; + } + +} diff --git a/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.html b/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.html new file mode 100644 index 0000000..30667f8 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.html @@ -0,0 +1,69 @@ + + + +
+
+
+
+
+ +
+
+ 添加 +
+
+ 删除 +
+
+
+
+ + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+
+ + +
\ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.java b/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.java new file mode 100644 index 0000000..f118bfc --- /dev/null +++ b/crm/src/main/java/com/rex/crm/common/AccountPositionPanel.java @@ -0,0 +1,344 @@ +package com.rex.crm.common; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.Map; + +import javax.mail.Session; + +import org.apache.log4j.Logger; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Check; +import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.wicket.markup.html.form.CheckGroupSelector; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.SubmitLink; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.list.AbstractItem; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.PageableListView; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.RepeatingView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.behavior.Behavior; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.rex.crm.SearchCRMUserPage; +import com.rex.crm.SignIn2Session; +import com.rex.crm.admin.PositionTreePage; +import com.rex.crm.beans.Account; +import com.rex.crm.beans.CRMUser; +import com.rex.crm.beans.UserInfo; +import com.rex.crm.common.tree.Node; +import com.rex.crm.db.DAOImpl; +import com.rex.crm.util.CRMUtility; +import com.rex.crm.util.Configuration; +import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator; + +public class AccountPositionPanel extends Panel { + private static final long serialVersionUID = 2501105233172820074L; + private static final Logger logger = Logger.getLogger(AccountPositionPanel.class); + private String etId; + private String currentEntityName; + List selectedRowIds = Lists.newArrayList(); + + public AccountPositionPanel(String id,final String en,final String entityId,final int level) { + super(id); + etId = entityId; + currentEntityName = en; + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + final String userId = ((SignIn2Session)getSession()).getUserId(); + //team sql + String teamSql = ""; + teamSql = "select * from user_position_query where " + getCondition(Integer.parseInt(entityId)); + List mapList = DAOImpl.queryEntityRelationList(teamSql); + Entity entity=null ; + entity = Configuration.getEntityByName("regionManage"); + add(new Label("title","区域管理 ")); + + final List fields = entity.getFields(); + final String entityName = entity.getName(); + Form form = new Form("form"); + add(form); + if(roleId != 1){ + WebMarkupContainer con = new WebMarkupContainer("remove_team_member_click"); + add(con); + con.setVisible(false); + //con.add(new AttributeAppender("style", new Model("display:none;"), ";")); + + }else{ + + add(new SubmitLink("remove_team_member_click",form){ + @Override + public void onSubmit(){ + + try{ + delete(Integer.parseInt(entityId)); + }catch(Exception e){ + + } + PageParameters param = new PageParameters(); + param.add("positionId", entityId); + param.add("level",String.valueOf(level)); + setResponsePage(PositionTreePage.class,param ); + + } + }); + } + + //add button submission + if(roleId != 1){ + WebMarkupContainer con = new WebMarkupContainer("add_users_link"); + add(con); + con.setVisible(false); + }else{ + add(new Link("add_users_link"){ + + @Override + public void onClick() { + this.setResponsePage(new SearchCRMUserPage(currentEntityName,entityId,userId,0)); + } + + }); + + } + + //set column name + RepeatingView columnNameRepeater = new RepeatingView("columnNameRepeater"); + form.add(columnNameRepeater); + int count=0; + for(Field f:entity.getFields()){ + if (!f.isVisible()|| f.getPriority() >1) + continue; + AbstractItem item = new AbstractItem(columnNameRepeater.newChildId()); + if(count==0){ + item.add(new AttributeAppender("class", new Model("table-first-link"), " ")); + count++; + } + columnNameRepeater.add(item); + item.add(new Label("columnName", f.getDisplay())); + } + + + final Map tableData = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Map map : (List) mapList) { + String key = String.valueOf(map.get("id")); + ids.add(key); + tableData.put(key, map); + } + + + final PageableListView listview = new PageableListView("dataRowRepeater", ids, 15) { + + @Override + protected void populateItem(ListItem item) { + String key = item.getDefaultModelObjectAsString(); + RepeatingView columnRepeater = new RepeatingView("columnRepeater"); + Map map = tableData.get(key); + item.add(columnRepeater); + final String realId = String.valueOf(map.get("id")); + final String rowId = String.valueOf(map.get("rid")); + for (Field f : fields) { + if (!f.isVisible() || f.getPriority() >1) + continue; + AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model() { + @Override + public Serializable getObject() { + Param p = new Param(); + p.setId(rowId); + p.setExtraId(realId); + p.setEntityName(entityName); + return p; + + } + }); + if (f.isDetailLink()) { + String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); + if(value.equals("null")||value.equals("")||value.equals("dummy")){ + value = "无"; + } + columnitem.add(new AttributeAppender("class", new Model("table-first-link"), " ")); + columnitem.add(new DetailLinkFragment("celldata","detailFragment",this,value)); + } else { + if (f.getPicklist() != null) { + // get option from picklist + String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryPickListByIdCached(f.getPicklist(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")||value.equals("dummy")){ + value = "无"; + } + columnitem.add(new Label("celldata", value)); + } else if(f.getRelationTable() != null){ + String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryCachedRelationDataById(f.getRelationTable(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")||value.equals("dummy")){ + value = "无"; + } + columnitem.add(new Label("celldata", value)); + }else { + String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); + if(value.equals("null")||value.equals("")||value.equals("dummy")){ + value = "无"; + } + columnitem.add(new Label("celldata", value)); + } + } + columnRepeater.add(columnitem); + } + + } + }; + form.add(listview); + //PagingNavigator nav = new PagingNavigator("navigator", listview); + AjaxPagingNavigator nav =new AjaxPagingNavigator("navigator", listview); + nav.setOutputMarkupId(true); + + form.add(nav); + form.setVersioned(false); + add(new NewDataFormPanel("formPanel",entity,null)); + } + + public AccountPositionPanel(String id, IModel model) { + super(id, model); + } + + private class DetailLinkFragment extends Fragment + { + public DetailLinkFragment(String id, String markupId, MarkupContainer markupProvider,String caption) + { + super(id, markupId, markupProvider); + add(new Link("detailclick") + { + + @Override + public void onClick() + { + Param p = (Param)getParent().getParent().getDefaultModelObject(); + setResponsePage(new EntityDetailPage(p.getEntityName(),p.getExtraId())); + + } + }.add(new Label("caption", new Model(caption)))); + } + } + + private class checkboxFragment extends Fragment { + + public checkboxFragment(String id, String markupId, MarkupContainer markupProvider,Model Imodel) + { + super(id, markupId, markupProvider); + // TODO Auto-generated constructor stub + add(new Check("checkbox",Imodel)); + } + + } + + private int queryPositionLevel(int positionId) + { + int level = 100; + + Map position = DAOImpl.queryEntityById("select * from crmuser where id = ?", String.valueOf(positionId)); + if(position.size() > 0) + { + level = (int) position.get("level"); + } + + return level; + } + + private ArrayList queryPositionByParent(int positionId) + { + List list = DAOImpl.searchCRMUserByManager(String.valueOf(positionId), ""); + ArrayList ids = new ArrayList<>(); + for(Object o : list) + { + Map map = (Map) o; + ids.add(Integer.valueOf((Integer)map.get("id"))); + } + + return ids; + } + + private void delete(int positionId) + { + int level = queryPositionLevel(positionId); + + if(level == 11) + { + DAOImpl.deleteAccountTeamWithPositionId(positionId); + } + else if(level > 1) + { + ArrayList ids = queryPositionByParent(positionId); + for(int id : ids) + { + delete(id); + } + } + } + + private ArrayList queryPosition(int positionId) + { + ArrayList ids = new ArrayList<>(); + + int level = queryPositionLevel(positionId); + + if(level == 11) + { + ids.add(positionId); + } + else if(level > 11) + { + for(int id : queryPositionByParent(positionId)) + { + level = queryPositionLevel(positionId); + + if(level == 11) + { + ids.add(level); + } + else if(level > 11) + { + ids.addAll(queryPosition(id)); + } + } + } + + return ids; + } + + private String getCondition(int positionId) + { + ArrayList ids = queryPosition(positionId); + StringBuilder sb = new StringBuilder(); + if(ids != null && ids.size() > 0) + { + sb = new StringBuilder(); + sb.append("position_id in("); + sb.append(ids.get(0)); + ids.remove(0); + + for(int id : ids) + { + sb.append(","); + sb.append(id); + } + + sb.append(")"); + } + + + return sb.toString(); + } +} diff --git a/crm/src/main/java/com/rex/crm/common/AddEntityPage.java b/crm/src/main/java/com/rex/crm/common/AddEntityPage.java index 7e221ca..22a090b 100644 --- a/crm/src/main/java/com/rex/crm/common/AddEntityPage.java +++ b/crm/src/main/java/com/rex/crm/common/AddEntityPage.java @@ -52,7 +52,7 @@ public AddEntityPage(final String entityName, String id){ logger.debug(r.getSql()); logger.debug("parms:"+id); List list = DAOImpl.queryEntityRelationList(r.getSql(), id); - item.add(new RelationDataPanel("relationPanel",r,list,String.valueOf(lid))); + item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid),null)); } diff --git a/crm/src/main/java/com/rex/crm/common/CRUDPanel.html b/crm/src/main/java/com/rex/crm/common/CRUDPanel.html index 93d32a6..f9d4aa0 100644 --- a/crm/src/main/java/com/rex/crm/common/CRUDPanel.html +++ b/crm/src/main/java/com/rex/crm/common/CRUDPanel.html @@ -6,29 +6,49 @@ }); -
- - - - + +
+
+
+
+
+
+
+
+
+
+
- - - 添加 + 新建 - Delete + 删除 - Edit + 编辑 - resetPwd + 重置密码 + + + 完成 + + + 下载 + + + 未执行 + + + 合并 + + + 失效 \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java index 7795004..2739c8a 100644 --- a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java +++ b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java @@ -1,41 +1,31 @@ package com.rex.crm.common; +import java.util.Calendar; +import java.util.Date; import java.util.EnumSet; import java.util.Map; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.data.DataView; -import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import com.rex.crm.AccountPage; -import com.rex.crm.ActivityPage; -import com.rex.crm.ContactPage; -import com.rex.crm.CreateEventPage; -import com.rex.crm.UserPage; -import com.rex.crm.beans.Account; import com.rex.crm.db.DAOImpl; +import com.rex.crm.db.model.Activity; import com.rex.crm.util.Configuration; public class CRUDPanel extends Panel { private static final long serialVersionUID = 2501105233172820074L; public enum Permissions { - ADD, DEL, EDIT,NONE,RESETPWD; + ADD, DEL, EDIT,NONE,RESETPWD,DONE,DOWNLOAD,UPLOAD,noExecute,MERGE,INEFFECTIVE; } - public CRUDPanel( final String id, final String entityName,final String entityId,EnumSet userPerms) { - super(id); - + public CRUDPanel(final String id, final String entityName, + final String entityId,EnumSet userPerms, final ICRUDActionListener listener) { + super(id); Map entities = Configuration.getEntityTable(); final Entity entity = entities.get(entityName); @@ -44,6 +34,11 @@ public CRUDPanel( final String id, final String entityName,final String entity add(new Fragment("delCon","emptyFragment",this)); add(new Fragment("editCon","emptyFragment",this)); add(new Fragment("resetPwdCon","emptyFragment",this)); + add(new Fragment("doneCon","emptyFragment",this)); + add(new Fragment("downloadCon","emptyFragment",this)); + add(new Fragment("noExecuteCon","emptyFragment",this)); + add(new Fragment("mergeCon","emptyFragment",this)); + add(new Fragment("ineffectiveCon","emptyFragment",this)); } else { if (userPerms.contains(Permissions.ADD)) { @@ -52,11 +47,8 @@ public CRUDPanel( final String id, final String entityName,final String entity @Override public void onClick() { - if(entity.getName().equals("activity")){ - setResponsePage(new CreateEventPage()); - }else{ - setResponsePage(new CreateDataPage(entity.getName())); - } + + listener.create(); } }); add(addfrag); @@ -70,20 +62,9 @@ public void onClick() { @Override public void onClick() { - if(entityName.equals("account")){ - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new AccountPage()); - }else if(entityName.equals("contact")){ - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new ContactPage()); - }else if(entityName.equals("activity")) { - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new ActivityPage()); - }else { - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new UserPage()); - } - + + listener.delete(); + } }); add(delfrag); @@ -93,28 +74,44 @@ public void onClick() { if (userPerms.contains(Permissions.EDIT)) { Fragment editfrag = new Fragment("editCon","editFragment",this); - editfrag.addOrReplace(new Link("edit_data_btn") { + Link link = new Link("edit_data_btn") { @Override public void onClick() { - - setResponsePage(new EditDataPage(entity.getName(),entityId)); + listener.update(); + //setResponsePage(new EditDataPage(entity.getName(),entityId)); } - }); + }; + editfrag.addOrReplace(link); + //根据entityId获取对象,获取开始时间,然后判断时间是否未来时则隐藏 + if(entityName.equals("activity")||entityName.equals("coaching")||entityName.equals("willcoaching")){ + Activity activity = DAOImpl.getActivityById(Integer.parseInt(entityId)); + Date newDate = new Date(); + Calendar cal = Calendar.getInstance(); + cal.setTime(newDate); + cal.set(Calendar.DATE,cal.get(Calendar.DATE)-7); + newDate = cal.getTime(); + Date startTime =activity.getStarttime(); + if(startTime.compareTo(newDate)<0){ + editfrag.add(new AttributeAppender("class",new Model("hiddenStyle")," ")); + }else if(activity.getStatus()==3||activity.getStatus()==2){ + editfrag.add(new AttributeAppender("class",new Model("hiddenStyle")," ")); + } + } addOrReplace(editfrag); }else{ addOrReplace(new Fragment("editCon","emptyFragment",this)); } //判断如果entityName为crmuser,则添加重置密码按钮 if (userPerms.contains(Permissions.RESETPWD)) { - if(entityName.equals("crmuser")){ + if(entityName.equals("userinfo")){ Fragment editfrag = new Fragment("resetPwdCon","resetPwdFragment",this); editfrag.add(new Link("resetPwd_data_btn") { @Override public void onClick() { int userId = Integer.parseInt(entityId); - DAOImpl.resetUserPassword(userId); - setResponsePage(new UserPage()); + //重置密码设置密码为null,发送邮件设置 + listener.resetPassword(userId); } }); add(editfrag); @@ -124,10 +121,111 @@ public void onClick() { }else{ add(new Fragment("resetPwdCon","emptyFragment",this)); } + if (userPerms.contains(Permissions.DONE)) { + Fragment addfrag = new Fragment("doneCon","doneFragment",this); + Link link = new Link("done_data_btn") { + + @Override + public void onClick() { + + listener.doneBtn(); + } + }; + addfrag.add(link); + //根据entityId获取对象,获取开始时间,然后判断时间是否未来时则隐藏 + if(entityName.equals("activity")||entityName.equals("coaching")||entityName.equals("willcoaching")){ + Activity activity = DAOImpl.getActivityById(Integer.parseInt(entityId)); + Date newDate = new Date(); + Date startTime = activity.getStarttime(); + if(startTime.compareTo(newDate)>=0){ + addfrag.add(new AttributeAppender("class",new Model("hiddenStyle")," ")); + }else if(activity.getStatus()==3){ + addfrag.add(new AttributeAppender("class",new Model("hiddenStyle")," ")); + } + } + add(addfrag); + }else{ + add(new Fragment("doneCon","emptyFragment",this)); + } + + if (userPerms.contains(Permissions.DOWNLOAD)) { + //downLoad_account_btn + Fragment downLoadfrag = new Fragment("downloadCon","downLoadFragment",this); + downLoadfrag.add(new Link("downLoad_account_btn") { + + @Override + public void onClick() { + + try + { + listener.downLoadBtn(); + } + catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + add(downLoadfrag); + }else{ + add(new Fragment("downloadCon","emptyFragment",this)); + } + if (userPerms.contains(Permissions.noExecute)) { + Fragment addfrag = new Fragment("noExecuteCon","noExecuteFragment",this); + Link link = new Link("noExecute_data_btn") { + + @Override + public void onClick() { + listener.noExecute(entityName, Integer.parseInt(entityId)); + } + }; + addfrag.add(link); + add(addfrag); + //根据entityId获取对象,获取开始时间,然后判断时间是否未来时则隐藏 + if(entityName.equals("activity")||entityName.equals("coaching")||entityName.equals("willcoaching")){ + Activity activity = DAOImpl.getActivityById(Integer.parseInt(entityId)); + if(activity.getStatus()!=1){ + addfrag.add(new AttributeAppender("class",new Model("hiddenStyle")," ")); + } + } + }else{ + add(new Fragment("noExecuteCon","emptyFragment",this)); + } - - } + + + if (userPerms.contains(Permissions.MERGE)) { + Fragment addfrag = new Fragment("mergeCon","mergeFragment",this); + Link link = new Link("merge_data_btn") { + @Override + public void onClick() { + listener.merge(); + } + }; + addfrag.add(link); + add(addfrag); + }else{ + add(new Fragment("mergeCon","emptyFragment",this)); + } + + if (userPerms.contains(Permissions.INEFFECTIVE)) { + Fragment addfrag = new Fragment("ineffectiveCon","ineffectiveFragment",this); + Link link = new Link("ineffective_data_btn") { + + @Override + public void onClick() { + listener.ineffective(); + } + }; + addfrag.add(link); + add(addfrag); + }else{ + add(new Fragment("ineffectiveCon","emptyFragment",this)); + } + + } } } diff --git a/crm/src/main/java/com/rex/crm/common/CalendarPanel.html b/crm/src/main/java/com/rex/crm/common/CalendarPanel.html index 1c805c4..d8126e4 100644 --- a/crm/src/main/java/com/rex/crm/common/CalendarPanel.html +++ b/crm/src/main/java/com/rex/crm/common/CalendarPanel.html @@ -1,23 +1,29 @@ + + + + + + -
-
-
-
-